/* ============================================================
   ARYO Control — main.css
   Target: iPad Air (1st gen), 1024×768 landscape, iOS 12 Safari.
   Uses flexbox + CSS grid (both fine on iOS 10.3+), CSS variables
   (iOS 9.3+), and -webkit- prefixes where iOS 12 still needs them.
   ============================================================ */

:root {
  --bg: #141416;
  --card: #1D1D21;
  --card-2: #26262B;
  --border: rgba(255,255,255,0.07);
  --text: #F4F4F6;
  --muted: #8B8B93;
  --dim: #56565E;
  --accent: #2E3B95;        /* also in js/config.js */
  --accent-soft: #3E4DB8;
  --accent-text: #98A4F2;
  --live: #E5484D;
  --ok: #3FB950;
  --radius: 22px;
  --radius-sm: 14px;
  --gap: 14px;
  --nav-h: 74px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: rgba(0,0,0,0);
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  user-select: none;
  overflow: hidden;
  position: fixed;
  width: 100%;
}

textarea, input { -webkit-user-select: text; user-select: text; }

button {
  font: inherit; color: inherit; background: none; border: 0;
  cursor: pointer; -webkit-appearance: none; appearance: none;
}
button:focus, a:focus { outline: none; }
button:focus-visible, a:focus-visible { box-shadow: 0 0 0 3px var(--accent-soft); }

a { color: inherit; text-decoration: none; }
svg { display: block; width: 100%; height: 100%; }

.is-hidden { display: none !important; }

/* ---------------- app frame ---------------- */
.app {
  position: absolute; top: 0; right: 0; bottom: 0; left: 0;
  padding-top: constant(safe-area-inset-top);
  padding-top: env(safe-area-inset-top);
}

.screen {
  position: absolute; top: 0; right: 0; left: 0;
  bottom: var(--nav-h);
  padding: 20px 20px 6px;
  opacity: 0;
  visibility: hidden;
  -webkit-transition: opacity .18s ease, visibility 0s linear .18s;
  transition: opacity .18s ease, visibility 0s linear .18s;
  -webkit-overflow-scrolling: touch;
}
.screen.is-active {
  opacity: 1; visibility: visible;
  -webkit-transition: opacity .22s ease;
  transition: opacity .22s ease;
}

/* ---------------- bottom nav ---------------- */
.nav {
  position: absolute; left: 0; right: 0; bottom: 0;
  height: var(--nav-h);
  padding: 0 20px;
  padding-bottom: constant(safe-area-inset-bottom);
  padding-bottom: env(safe-area-inset-bottom);
  display: -webkit-box; display: -webkit-flex; display: flex;
  -webkit-box-pack: center; -webkit-justify-content: center; justify-content: center;
  -webkit-box-align: center; -webkit-align-items: center; align-items: center;
  background: rgba(20,20,22,0.92);
  border-top: 1px solid var(--border);
}
.nav-item {
  width: 132px; height: 56px;
  margin: 0 6px;
  border-radius: 16px;
  display: -webkit-box; display: -webkit-flex; display: flex;
  -webkit-box-orient: vertical; -webkit-flex-direction: column; flex-direction: column;
  -webkit-box-align: center; -webkit-align-items: center; align-items: center;
  -webkit-box-pack: center; -webkit-justify-content: center; justify-content: center;
  color: var(--muted);
}
.nav-icon { width: 24px; height: 24px; }
.nav-label { font-size: 11px; font-weight: 500; margin-top: 4px; letter-spacing: .01em; }
.nav-item.is-active { color: #fff; background: var(--accent); }
.nav-item.is-pressed:not(.is-active) { background: var(--card-2); }

/* ---------------- cards ---------------- */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.25);
  min-height: 0;
  overflow: hidden;
  position: relative;
}
.card-title {
  font-size: 13px; font-weight: 600; color: var(--muted);
  margin-bottom: 12px; letter-spacing: .01em;
}
.card-title-spaced { margin-top: 22px; }
.card-head {
  display: -webkit-box; display: -webkit-flex; display: flex;
  -webkit-box-pack: justify; -webkit-justify-content: space-between; justify-content: space-between;
  -webkit-box-align: center; -webkit-align-items: center; align-items: center;
  margin-bottom: 12px;
}
.card-head .card-title { margin-bottom: 0; }
.head-actions { display: -webkit-box; display: -webkit-flex; display: flex; -webkit-box-align: center; -webkit-align-items: center; align-items: center; }
.card-note { font-size: 13px; color: var(--dim); margin-top: 10px; }
.card.is-disabled .stat-value { color: var(--dim); }

.pill {
  font-size: 11px; font-weight: 600; color: var(--muted);
  background: var(--card-2); border-radius: 999px; padding: 5px 10px;
}

/* buttons */
.btn {
  height: 44px; padding: 0 20px; border-radius: 12px;
  font-size: 15px; font-weight: 600;
  background: var(--card-2); color: var(--text);
}
.btn-accent { background: var(--accent); color: #fff; }
.btn-quiet { color: var(--muted); }
.btn.is-pressed { opacity: .7; }
.btn-text {
  height: 34px; padding: 0 12px; border-radius: 10px;
  font-size: 14px; font-weight: 600; color: var(--accent-text);
  margin: -6px -12px -6px 0;
}
.btn-text.is-pressed { background: rgba(46,59,149,0.2); }
.btn-icon {
  width: 46px; height: 46px; border-radius: 14px; padding: 11px;
  background: rgba(255,255,255,0.08); color: #fff;
}

/* editor */
.editor-area {
  width: 100%; min-height: 150px; resize: none;
  background: var(--bg); color: var(--text);
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 12px 14px; font: inherit; font-size: 16px; line-height: 1.45;
  -webkit-appearance: none; appearance: none;
}
.editor-area:focus { outline: none; border-color: var(--accent-soft); }
.editor-area-tall { min-height: 320px; }
.editor-actions {
  display: -webkit-box; display: -webkit-flex; display: flex;
  -webkit-box-pack: end; -webkit-justify-content: flex-end; justify-content: flex-end;
  margin-top: 10px;
}
.editor-actions .btn { margin-left: 8px; }
.editor-hint { font-size: 12px; color: var(--dim); margin-top: 8px; }

/* ================================================== HOME */
.home-grid {
  height: 100%;
  display: -webkit-box; display: -webkit-flex; display: flex;
}
.home-rail {
  width: 300px; -webkit-flex-shrink: 0; flex-shrink: 0;
  margin-right: var(--gap);
  display: -webkit-box; display: -webkit-flex; display: flex;
  -webkit-box-orient: vertical; -webkit-flex-direction: column; flex-direction: column;
}
.home-main {
  -webkit-box-flex: 1; -webkit-flex: 1; flex: 1;
  min-width: 0;
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-template-rows: auto 1fr auto;
  grid-gap: var(--gap);
}
.card-priorities { grid-column: 1; grid-row: 1 / span 2; }
.card-football  { grid-column: 2; grid-row: 1; }
.card-player    { grid-column: 2; grid-row: 2; }
.card-quick     { grid-column: 1 / span 2; grid-row: 3; }

/* clock */
.clock { padding: 4px 6px 2px; }
.clock-time {
  font-size: 84px; font-weight: 200; line-height: 1;
  letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums;
}
.clock-date { font-size: 17px; font-weight: 500; color: var(--muted); margin-top: 8px; }

/* weather */
.weather {
  display: -webkit-box; display: -webkit-flex; display: flex;
  -webkit-box-align: center; -webkit-align-items: center; align-items: center;
  padding: 16px 6px 18px;
}
.weather-icon { width: 34px; height: 34px; color: var(--accent-text); margin-right: 12px; }
.weather-main { -webkit-box-flex: 1; -webkit-flex: 1; flex: 1; }
.weather-temp { font-size: 26px; font-weight: 500; line-height: 1; }
.weather-cond { font-size: 13px; color: var(--muted); margin-top: 3px; }
.weather-range { font-size: 13px; color: var(--muted); white-space: pre; font-variant-numeric: tabular-nums; }

.card-today { -webkit-box-flex: 1; -webkit-flex: 1; flex: 1; margin-bottom: var(--gap); }
.today-item {
  display: -webkit-box; display: -webkit-flex; display: flex;
  padding: 9px 0; border-top: 1px solid var(--border);
  font-size: 15px;
}
.today-item:first-child { border-top: 0; padding-top: 0; }
.today-time { width: 56px; color: var(--muted); font-variant-numeric: tabular-nums; -webkit-flex-shrink: 0; flex-shrink: 0; }
.today-item.is-next .today-time { color: var(--accent-text); font-weight: 600; }
.today-item.is-next .today-title { font-weight: 600; }
.today-title { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.today-empty { font-size: 14px; color: var(--dim); line-height: 1.4; }

/* camera status list (home) */
.card-cams { padding-bottom: 14px; }
.cs {
  display: -webkit-box; display: -webkit-flex; display: flex;
  -webkit-box-align: center; -webkit-align-items: center; align-items: center;
  font-size: 14px; padding: 6px 0;
}
.cs-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--dim); margin-right: 10px; -webkit-flex-shrink: 0; flex-shrink: 0; }
.cs.is-online .cs-dot { background: var(--ok); }
.cs.is-error .cs-dot, .cs.is-offline .cs-dot { background: var(--live); }
.cs.is-connecting .cs-dot { background: #D7A54A; }
.cs-name { -webkit-box-flex: 1; -webkit-flex: 1; flex: 1; }
.cs-state { color: var(--dim); font-size: 13px; }

/* tasks */
.task-list { display: block; }
.task-group {
  font-size: 12px; font-weight: 600; color: var(--accent-text);
  margin: 10px 0 4px;
}
.task-group:first-child { margin-top: 0; }
.task {
  width: 100%; text-align: left;
  display: -webkit-box; display: -webkit-flex; display: flex;
  -webkit-box-align: center; -webkit-align-items: center; align-items: center;
  min-height: 46px; padding: 6px 8px; margin: 0 -8px;
  border-radius: 12px; font-size: 16px;
}
.task.is-pressed { background: var(--card-2); }
.task-check {
  width: 24px; height: 24px; border-radius: 50%;
  border: 1.5px solid var(--dim); color: transparent;
  padding: 4px; margin-right: 12px; -webkit-flex-shrink: 0; flex-shrink: 0;
}
.task.is-done .task-check { background: var(--accent); border-color: var(--accent); color: #fff; }
.task.is-done .task-text { color: var(--dim); text-decoration: line-through; }
.task-text { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* quick actions */
.quick-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  grid-gap: 10px;
}
.quick {
  height: 78px; border-radius: 16px;
  background: var(--card-2);
  display: -webkit-box; display: -webkit-flex; display: flex;
  -webkit-box-orient: vertical; -webkit-flex-direction: column; flex-direction: column;
  -webkit-box-align: center; -webkit-align-items: center; align-items: center;
  -webkit-box-pack: center; -webkit-justify-content: center; justify-content: center;
}
.quick.is-pressed { background: var(--accent); }
.quick-icon { width: 26px; height: 26px; color: var(--accent-text); }
.quick.is-pressed .quick-icon { color: #fff; }
.quick-label { font-size: 12px; font-weight: 500; margin-top: 8px; color: var(--text); }

/* fixture */
.fx {
  display: -webkit-box; display: -webkit-flex; display: flex;
  -webkit-box-align: center; -webkit-align-items: center; align-items: center;
}
.fx-team { -webkit-box-flex: 1; -webkit-flex: 1; flex: 1; text-align: center; min-width: 0; }
.fx-badge {
  width: 52px; height: 52px; border-radius: 50%; margin: 0 auto 8px;
  background: var(--card-2); border: 1px solid var(--border);
  font-size: 13px; font-weight: 700; letter-spacing: .04em;
  line-height: 50px; color: var(--text);
}
.fx-team:first-child .fx-badge { background: var(--accent); border-color: var(--accent); color: #fff; }
.fx-name { font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fx-centre { width: 96px; text-align: center; }
.fx-time { font-size: 30px; font-weight: 300; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.fx-day { font-size: 12px; color: var(--muted); margin-top: 2px; }
.fx-score { font-size: 32px; font-weight: 500; font-variant-numeric: tabular-nums; }
.fx-minute { font-size: 12px; color: var(--live); font-weight: 600; margin-top: 2px; }
.fx-meta { text-align: center; font-size: 12px; color: var(--dim); margin-top: 12px; }
.fx-empty { font-size: 14px; color: var(--dim); padding: 12px 0; }

.fixture-lg .fx-badge { width: 72px; height: 72px; line-height: 70px; font-size: 16px; }
.fixture-lg .fx-time { font-size: 44px; }
.fixture-lg .fx-score { font-size: 48px; }
.fixture-lg .fx-name { font-size: 14px; color: var(--text); }
.fixture-lg .fx-centre { width: 140px; }

/* mini player */
.card-player { padding: 16px; }
.mini-player {
  display: -webkit-box; display: -webkit-flex; display: flex;
  -webkit-box-align: center; -webkit-align-items: center; align-items: center;
  height: 100%;
}
.mp-art {
  width: 72px; height: 72px; border-radius: 12px; -webkit-flex-shrink: 0; flex-shrink: 0;
  background: var(--card-2) center/cover no-repeat;
  color: var(--dim); padding: 22px;
}
.mp-art svg { display: block; }
.mp-meta { -webkit-box-flex: 1; -webkit-flex: 1; flex: 1; min-width: 0; margin: 0 12px; }
.mp-title { font-size: 16px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mp-artist { font-size: 13px; color: var(--muted); margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mini-player.is-off .mp-title { color: var(--muted); }

.transport {
  display: -webkit-box; display: -webkit-flex; display: flex;
  -webkit-box-align: center; -webkit-align-items: center; align-items: center;
  -webkit-box-pack: center; -webkit-justify-content: center; justify-content: center;
}
.tbtn {
  width: 56px; height: 56px; border-radius: 50%; padding: 15px;
  color: var(--text);
}
.tbtn-sm { width: 46px; height: 46px; padding: 12px; }
.tbtn-main { background: var(--accent); color: #fff; }
.tbtn.is-pressed { opacity: .65; -webkit-transform: scale(.96); transform: scale(.96); }
.mini-player.is-off .tbtn { opacity: .35; }

/* stacked variant (Home): art + text on top, transport underneath */
.mini-player-stack {
  -webkit-box-orient: vertical; -webkit-flex-direction: column; flex-direction: column;
  -webkit-box-align: stretch; -webkit-align-items: stretch; align-items: stretch;
  -webkit-box-pack: justify; -webkit-justify-content: space-between; justify-content: space-between;
  padding: 4px 4px 0;
}
.mini-player-stack .mp-art { width: 104px; height: 104px; padding: 32px; }
.mini-player-stack .mp-meta { margin: 12px 0 0; }
.mini-player-stack .mp-title { font-size: 18px; }
.mini-player-stack .mp-artist { font-size: 14px; }
.mini-player-stack .transport { -webkit-box-pack: start; -webkit-justify-content: flex-start; justify-content: flex-start; margin: 10px 0 0 -8px; }
.mini-player-stack .tbtn-sm { width: 54px; height: 54px; padding: 14px; margin-right: 6px; }

/* ================================================== GAMING */
.gaming-grid {
  height: 100%;
  display: -webkit-box; display: -webkit-flex; display: flex;
}
.gaming-left {
  width: 400px; -webkit-flex-shrink: 0; flex-shrink: 0; margin-right: var(--gap);
  display: -webkit-box; display: -webkit-flex; display: flex;
  -webkit-box-orient: vertical; -webkit-flex-direction: column; flex-direction: column;
}
.gaming-right {
  -webkit-box-flex: 1; -webkit-flex: 1; flex: 1; min-width: 0;
  display: -webkit-box; display: -webkit-flex; display: flex;
  -webkit-box-orient: vertical; -webkit-flex-direction: column; flex-direction: column;
}
.gaming-left .card, .gaming-right .card { margin-bottom: var(--gap); }
.gaming-left .card:last-child, .gaming-right .card:last-child { margin-bottom: 0; }
.card-football-lg { padding: 22px 20px; }
.card-scores { -webkit-box-flex: 1; -webkit-flex: 1; flex: 1; }
.card-notes { -webkit-box-flex: 1; -webkit-flex: 1; flex: 1; overflow: auto; -webkit-overflow-scrolling: touch; }
.gaming-right .card-player { -webkit-flex-shrink: 0; flex-shrink: 0; height: 104px; }
.quick-grid-5 .quick { height: 68px; }

.live-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--dim); }
.live-dot.is-on { background: var(--live); box-shadow: 0 0 0 4px rgba(229,72,77,0.2); }

.sc {
  display: -webkit-box; display: -webkit-flex; display: flex;
  -webkit-box-align: center; -webkit-align-items: center; align-items: center;
  height: 44px; border-top: 1px solid var(--border); font-size: 15px;
}
.sc:first-child { border-top: 0; }
.sc-team { width: 60px; font-weight: 600; letter-spacing: .03em; }
.sc-team + .sc-score + .sc-team { text-align: right; }
.sc-score { -webkit-box-flex: 1; -webkit-flex: 1; flex: 1; text-align: center; font-size: 18px; font-variant-numeric: tabular-nums; }
.sc-vs { color: var(--dim); font-size: 14px; }
.sc-min { width: 52px; text-align: right; font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; }
.sc.is-live .sc-min { color: var(--live); font-weight: 600; }

.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); grid-gap: 8px; }
.stat { text-align: center; background: var(--card-2); border-radius: 12px; padding: 12px 4px; }
.stat-value { font-size: 22px; font-weight: 500; font-variant-numeric: tabular-nums; }
.stat-label { font-size: 11px; color: var(--muted); margin-top: 2px; }

.saved-flag {
  font-size: 12px; color: var(--ok); font-weight: 600; margin-right: 12px;
  opacity: 0; -webkit-transition: opacity .3s; transition: opacity .3s;
}
.saved-flag.is-visible { opacity: 1; }
.notes-view { font-size: 16px; line-height: 1.5; }
.note-head { font-weight: 600; margin-top: 4px; }
.note-item { color: var(--text); padding-left: 16px; position: relative; }
.note-item:before { content: ''; position: absolute; left: 3px; top: 10px; width: 5px; height: 5px; border-radius: 50%; background: var(--accent-text); }
.note-gap { height: 12px; }

/* ================================================== CAMERAS */
.cam-grid {
  height: 100%;
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-template-rows: 1fr 1fr;
  grid-gap: var(--gap);
}
.cam {
  position: relative; border-radius: var(--radius); overflow: hidden;
  background: var(--card); border: 1px solid var(--border);
  box-shadow: 0 8px 24px rgba(0,0,0,0.25);
}
.cam-wide { grid-column: 1 / span 2; }
.cam-body { position: absolute; top: 0; right: 0; bottom: 0; left: 0; background: #0E0E10; }
.cam-feed { width: 100%; height: 100%; object-fit: cover; display: block; }
.cam-placeholder {
  position: absolute; top: 50%; left: 50%;
  -webkit-transform: translate(-50%,-50%); transform: translate(-50%,-50%);
  text-align: center; color: var(--dim);
}
.cam-placeholder svg { width: 40px; height: 40px; margin: 0 auto 10px; opacity: .6; }
.cam-state { font-size: 14px; }
.cam.is-online .cam-placeholder { display: none; }
.cam.is-connecting .cam-state { color: #D7A54A; }
.cam.is-error .cam-state, .cam.is-offline .cam-state { color: var(--live); }
.cam-foot {
  position: absolute; left: 0; right: 0; bottom: 0;
  padding: 14px 18px;
  display: -webkit-box; display: -webkit-flex; display: flex;
  -webkit-box-align: center; -webkit-align-items: center; align-items: center;
  -webkit-box-pack: justify; -webkit-justify-content: space-between; justify-content: space-between;
  background: -webkit-linear-gradient(top, rgba(14,14,16,0), rgba(14,14,16,0.85));
  background: linear-gradient(to bottom, rgba(14,14,16,0), rgba(14,14,16,0.85));
}
.cam-name { font-size: 16px; font-weight: 600; }
.cam-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--dim); }
.cam.is-online .cam-dot { background: var(--ok); }
.cam.is-error .cam-dot, .cam.is-offline .cam-dot { background: var(--live); }
.cam.is-connecting .cam-dot { background: #D7A54A; }

/* fullscreen camera */
.cam-full {
  position: absolute; top: 0; right: 0; bottom: 0; left: 0; z-index: 20;
  background: #000;
  display: -webkit-box; display: -webkit-flex; display: flex;
  -webkit-box-orient: vertical; -webkit-flex-direction: column; flex-direction: column;
}
.cam-full-bar {
  height: 68px; padding: 0 16px;
  display: -webkit-box; display: -webkit-flex; display: flex;
  -webkit-box-align: center; -webkit-align-items: center; align-items: center;
}
.cam-full-name { -webkit-box-flex: 1; -webkit-flex: 1; flex: 1; font-size: 18px; font-weight: 600; margin-left: 14px; }
.cam-full-time { font-size: 18px; font-weight: 300; margin-right: 14px; font-variant-numeric: tabular-nums; }
.cam-full-feed { -webkit-box-flex: 1; -webkit-flex: 1; flex: 1; min-height: 0; }
.cam-feed-full { object-fit: contain; }

/* ================================================== MUSIC */
.music-grid {
  height: 100%;
  display: -webkit-box; display: -webkit-flex; display: flex;
}
.now-playing {
  width: 460px; -webkit-flex-shrink: 0; flex-shrink: 0;
  margin-right: 28px; padding: 4px 8px 0;
  display: -webkit-box; display: -webkit-flex; display: flex;
  -webkit-box-orient: vertical; -webkit-flex-direction: column; flex-direction: column;
  -webkit-box-align: center; -webkit-align-items: center; align-items: center;
}
.art-lg {
  width: 280px; height: 280px; border-radius: 26px;
  background: var(--card) center/cover no-repeat;
  box-shadow: 0 20px 50px rgba(0,0,0,0.5);
  color: var(--dim); padding: 90px;
}
.np-meta { text-align: center; margin-top: 22px; width: 100%; }
.np-title { font-size: 24px; font-weight: 600; letter-spacing: -0.01em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.np-artist { font-size: 16px; color: var(--muted); margin-top: 4px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.progress { width: 100%; margin-top: 20px; }
.progress-bar { height: 5px; border-radius: 3px; background: var(--card-2); overflow: hidden; }
.progress-fill { height: 100%; width: 0; background: var(--accent-text); border-radius: 3px; }
.progress-times {
  display: -webkit-box; display: -webkit-flex; display: flex;
  -webkit-box-pack: justify; -webkit-justify-content: space-between; justify-content: space-between;
  font-size: 12px; color: var(--muted); margin-top: 6px; font-variant-numeric: tabular-nums;
}
.progress.is-off { opacity: .3; }

.transport-lg { margin-top: 14px; }
.transport-lg .tbtn { width: 64px; height: 64px; padding: 18px; margin: 0 10px; }
.transport-lg .tbtn-main { width: 80px; height: 80px; padding: 24px; }

.volume {
  width: 100%; margin-top: 18px;
  display: -webkit-box; display: -webkit-flex; display: flex;
  -webkit-box-align: center; -webkit-align-items: center; align-items: center;
}
.vol-icon { width: 20px; height: 20px; color: var(--muted); -webkit-flex-shrink: 0; flex-shrink: 0; }
.slider {
  -webkit-box-flex: 1; -webkit-flex: 1; flex: 1; margin: 0 14px;
  -webkit-appearance: none; appearance: none;
  height: 44px; background: transparent;
}
.slider::-webkit-slider-runnable-track { height: 5px; border-radius: 3px; background: var(--card-2); }
.slider::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none;
  width: 26px; height: 26px; border-radius: 50%; background: #fff;
  margin-top: -10.5px; box-shadow: 0 2px 8px rgba(0,0,0,0.4);
}

.device-row {
  width: 100%; margin-top: 18px;
  display: -webkit-box; display: -webkit-flex; display: flex;
  -webkit-box-align: center; -webkit-align-items: center; align-items: center;
  -webkit-box-pack: justify; -webkit-justify-content: space-between; justify-content: space-between;
}
.device-label { font-size: 13px; color: var(--muted); }
.device-btn {
  height: 40px; padding: 0 16px; border-radius: 12px;
  background: var(--card-2); font-size: 14px; font-weight: 600;
}
.device-list {
  width: 100%; margin-top: 10px; background: var(--card);
  border: 1px solid var(--border); border-radius: var(--radius-sm); overflow: hidden;
}
.device-item {
  width: 100%; height: 48px; padding: 0 16px; text-align: left;
  display: -webkit-box; display: -webkit-flex; display: flex;
  -webkit-box-align: center; -webkit-align-items: center; align-items: center;
  -webkit-box-pack: justify; -webkit-justify-content: space-between; justify-content: space-between;
  border-top: 1px solid var(--border); font-size: 15px;
}
.device-item:first-child { border-top: 0; }
.device-item.is-active { color: var(--accent-text); font-weight: 600; }
.device-type { font-size: 12px; color: var(--dim); }
.device-loading { padding: 14px 16px; font-size: 14px; color: var(--muted); }
.btn-connect { margin-top: 18px; width: 100%; }

.music-side {
  -webkit-box-flex: 1; -webkit-flex: 1; flex: 1; min-width: 0;
  overflow-y: auto; -webkit-overflow-scrolling: touch; padding-right: 4px;
}
.playlist-grid { display: grid; grid-template-columns: repeat(3, 1fr); grid-gap: 12px; }
.pl {
  height: 96px; border-radius: 18px; padding: 14px 16px; text-align: left;
  display: -webkit-box; display: -webkit-flex; display: flex;
  -webkit-box-orient: vertical; -webkit-flex-direction: column; flex-direction: column;
  -webkit-box-pack: end; -webkit-justify-content: flex-end; justify-content: flex-end;
  color: #fff;
  box-shadow: inset 0 -40px 40px -30px rgba(0,0,0,0.45);
}
.pl.is-pressed { opacity: .8; }
.pl-name { font-size: 16px; font-weight: 600; }
.pl-sub { font-size: 12px; opacity: .75; margin-top: 2px; }

.recent {
  display: -webkit-box; display: -webkit-flex; display: flex;
  -webkit-box-align: center; -webkit-align-items: center; align-items: center;
  height: 58px; border-top: 1px solid var(--border);
}
.recent:first-child { border-top: 0; }
.recent-art { width: 42px; height: 42px; border-radius: 9px; margin-right: 14px; -webkit-flex-shrink: 0; flex-shrink: 0; }
.recent-meta { min-width: 0; }
.recent-title { display: block; font-size: 15px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.recent-artist { display: block; font-size: 13px; color: var(--muted); }

/* ================================================== RESPONSIVE
   Primary target is 1024×768. These keep it usable elsewhere. */
@media (max-width: 900px) {
  .home-rail { width: 240px; }
  .clock-time { font-size: 64px; }
  .gaming-left { width: 320px; }
  .now-playing { width: 360px; }
  .art-lg { width: 220px; height: 220px; padding: 70px; }
  .nav-item { width: 100px; }
}
@media (max-width: 700px) {
  .screen { overflow-y: auto; padding: 14px 14px 6px; }
  .home-grid, .gaming-grid, .music-grid { display: block; height: auto; }
  .home-rail, .gaming-left, .now-playing { width: auto; margin: 0 0 var(--gap); }
  .home-main { grid-template-columns: 1fr; grid-template-rows: auto; }
  .card-priorities, .card-football, .card-player, .card-quick { grid-column: 1; grid-row: auto; }
  .quick-grid { grid-template-columns: repeat(3, 1fr); }
  .cam-grid { grid-template-columns: 1fr; grid-template-rows: 220px 220px 260px; height: auto; }
  .cam-wide { grid-column: 1; }
  .nav-item { width: 76px; margin: 0 2px; }
}
@media (min-width: 1300px) {
  .home-rail { width: 360px; }
  .clock-time { font-size: 104px; }
  .gaming-left { width: 480px; }
}

@media (prefers-reduced-motion: reduce) {
  .screen, .saved-flag { -webkit-transition: none; transition: none; }
}
