:root { color-scheme: dark; font-family: system-ui, sans-serif; background: #101716; color: #edf3ef; }
* { box-sizing: border-box; }
body { max-width: 1000px; margin: auto; padding: 24px; }
nav { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 30px; }
nav a { color: #bacbbf; text-decoration: none; padding: 10px 16px; border-radius: 24px; }
nav a[aria-current=page] { background: #bdcf86; color: #172117; }
header { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 24px; }
h1 { margin: 0; font-size: clamp(30px, 5vw, 42px); }
h2 { margin: 0 0 16px; font-size: 20px; }
p { line-height: 1.6; }
small, .muted { color: #a7b9b0; }
.badge { border-radius: 24px; padding: 10px 16px; background: #33483e; }
.grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.panel { background: #1b2723; border: 1px solid #33483e; border-radius: 22px; padding: 24px; }
.metric { font-size: 38px; font-variant-numeric: tabular-nums; margin: 12px 0; }
.metric small { font-size: 18px; }
.wide { grid-column: 1 / -1; }
button, input { font: inherit; padding: 14px 18px; border-radius: 12px; border: 1px solid #526b5d; background: #2c4036; color: #edf3ef; }
button { cursor: pointer; touch-action: none; user-select: none; -webkit-user-select: none; }
button:disabled { opacity: .4; cursor: default; }
button:focus-visible, a:focus-visible { outline: 3px solid #bdcf86; outline-offset: 3px; }
button:active { background: #567460; }
.primary { background: #bdcf86; color: #172117; font-weight: 700; }
.stop { background: #a13730; font-size: 22px; font-weight: 800; min-height: 65px; width: 100%; margin-top: 18px; }
.pad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-top: 20px; }
.pad button { min-height: 74px; }
.pad span { text-align: center; align-self: center; }
.camera-pad { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.camera-pad button { min-height: 60px; }
dl { margin: 0; }
dl div { display: flex; justify-content: space-between; gap: 16px; padding: 12px 0; border-bottom: 1px solid #33483e; }
dt { color: #a7b9b0; }
dd { margin: 0; text-align: right; overflow-wrap: anywhere; }
.message { min-height: 48px; color: #e7d899; }
.good { color: #bdcf86; }
.warning { color: #ffc58a; }
.error { color: #ffb0a6; }
#login { margin: 20px 0; }
#login input { max-width: 100%; }
#login[hidden] { display: none; }
footer { margin-top: 24px; color: #a7b9b0; font-size: 14px; line-height: 1.6; }
.live-panel { grid-column: 1 / -1; position: sticky; top: 8px; z-index: 3; padding: 14px; }
.live-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 10px; }
.live-heading h2 { margin: 0; }
.husky-modes { display:flex;flex-wrap:wrap;gap:6px;margin:10px 0; }
.husky-modes button { padding:8px 10px;font-size:13px; }
.husky-modes button[aria-pressed="true"],#husky-follow[aria-pressed="true"] { background:#176b3a;color:white;border:2px solid #89e8a4; }
.live-heading button { padding: 8px 12px; }
.live-view { background: #080d0a; height: clamp(160px, 32vh, 400px); display: flex; justify-content: center; align-items: center; border-radius: 12px; overflow: hidden; }
.live-view img { width: 100%; height: 100%; object-fit: contain; }
.live-view img.stale { opacity: .25; }
.live-view p { color: #a7b9b0; margin: 12px; }
#live-status { margin: 8px 0 0; font-size: 13px; min-height: 20px; }
@media(max-width:650px) { .panel.live-panel { padding: 10px; top: 4px; } .live-view { height: clamp(140px, 29vh, 270px); } .live-heading h2 { font-size: 18px; } }
@media(max-width:650px) { body { padding: 16px; } .grid { grid-template-columns: 1fr; } .panel { padding: 18px; } header { align-items: flex-start; } .badge { font-size: 13px; } }
@media(max-width:650px) {
    .panel.drive-controls { padding: 12px; }
    .drive-controls h2 { margin-bottom: 8px; }
    .drive-controls > .muted { font-size: 13px; line-height: 1.4; margin: 8px 0; }
    .drive-controls .pad { margin-top: 10px; gap: 6px; }
    .drive-controls .pad button { min-height: 54px; padding: 8px; font-size: 14px; }
    .drive-controls .stop { min-height: 48px; margin-top: 8px; padding: 10px; }
    .drive-controls .message { min-height: 20px; margin: 8px 0 0; font-size: 12px; line-height: 1.4; }
}

/* Keep the video and direction pad together, without a tall sticky overlay. */
.live-panel { position:static; }
.live-panel .live-view { height:clamp(140px,24vh,260px); }
.live-panel .drive-controls h2 { display:none; }
.live-panel .drive-controls .pad { margin-top:8px;gap:6px; }
.live-panel .drive-controls .pad button { min-height:46px;padding:6px;font-size:14px; }
.live-panel .drive-controls .stop { min-height:44px;margin-top:6px;padding:8px; }
.live-panel .drive-controls > .muted { font-size:12px;line-height:1.3; }
.live-panel .drive-controls .message { min-height:18px;margin:4px 0; }
