html, body { margin: 0; height: 100%; background: #000; color: #fff; overflow: hidden; cursor: none;
             font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", sans-serif; }
.hidden { display: none !important; }

/* Sizes use container units of #tv (cqh/cqw), not the window, so they stay right when the TV is turned sideways. */
#tv { position: absolute; top: 0; left: 0; width: 100vw; height: 100vh; overflow: hidden; container: tv / size; }
/* Portrait: lay the page out tall, then turn it to fit the sideways screen. */
body.rot-portrait #tv, body.rot-portrait-flipped #tv { width: 100vh; height: 100vw; transform-origin: 0 0; }
body.rot-portrait #tv { left: 100vw; transform: rotate(90deg); }
body.rot-portrait-flipped #tv { top: 100vh; transform: rotate(-90deg); }
#frame { position: absolute; inset: 0; display: flex; flex-direction: column; }
#stage { position: relative; flex: 1; overflow: hidden; }

body.preview { cursor: default; }

/* ---------- background and layout zones ---------- */
#bg { position: absolute; inset: 0; background: #000; overflow: hidden; }
#bg .bg-pic { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; display: block; }
#stage { --gap: 0px; --radius: 0px; }
#stage[data-gap="thin"] { --gap: 1.2cqh; }
#stage[data-gap="wide"] { --gap: 3cqh; }
#stage.rounded { --radius: 1.8cqh; }
/* Half the gap around each zone plus half around the screen edge gives even spacing everywhere. */
#zones { position: absolute; inset: calc(var(--gap) / 2); }
.zone { position: absolute; box-sizing: border-box; padding: calc(var(--gap) / 2); }
.zone-box { position: relative; width: 100%; height: 100%; overflow: hidden; border-radius: var(--radius);
            container: zone / size; }
.zone.inset { z-index: 3; padding: 0; }
.zone.inset .zone-box { border-radius: max(var(--radius), 1.4cqh); box-shadow: 0 1cqh 4cqh rgba(0,0,0,.55); background: #000; }

/* ---------- slides and transitions ---------- */
/* Sizes inside slides use container units (cqh/cqw/cqmin), so a slide scales to whichever zone it plays in. */
.layer { position: absolute; inset: 0; opacity: 0; overflow: hidden; background: transparent;
         transition: opacity .8s ease, transform .9s cubic-bezier(.22,.8,.3,1); }
#stage .layer.show { opacity: 1; transform: none; z-index: 2; }   /* beats every transition's starting position */
.layer.leave { z-index: 1; }
/* With see-through slides, fading the old one out a beat later avoids a flash of background mid-fade. */
.tr-fade .layer.leave { transition-delay: .35s; }
.tr-slide .layer { transform: translateX(100%); opacity: 1; }
.tr-slide .layer.leave { transform: translateX(-30%); opacity: .3; }
.tr-zoom .layer { transform: scale(1.12); }
.tr-zoom .layer.leave { transform: scale(.94); opacity: 0; }
.tr-none .layer { transition: none; }

.layer > .fg { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.fit-contain { object-fit: contain; }
.fit-cover { object-fit: cover; }
.layer > .bg-blur { position: absolute; inset: -6%; width: 112%; height: 112%; object-fit: cover; filter: blur(4cqmin) brightness(.55) saturate(1.2); }
.kenburns { animation: kenburns var(--kb-time, 10s) ease-out forwards; }
@keyframes kenburns { from { transform: scale(1); } to { transform: scale(1.14); } }
.layer > iframe { position: absolute; top: 0; left: 0; width: 100%; height: 100%; border: 0; background: #fff; }

/* ---------- pairing / idle ---------- */
.screen { position: absolute; inset: 0; display: none; flex-direction: column; align-items: center; justify-content: center;
          text-align: center; background: radial-gradient(circle at 50% 40%, #1e293b, #020617); z-index: 20; }
.screen.on { display: flex; }
.label { font-size: 2.4cqw; letter-spacing: .3em; text-transform: uppercase; color: #94a3b8; }
.code { font-family: ui-monospace, "Cascadia Mono", Menlo, monospace; font-size: 13cqw; font-weight: 700; letter-spacing: .06em; margin: 2cqh 0; }
.hint { font-size: 2cqw; color: #cbd5e1; max-width: 70cqw; line-height: 1.5; }
.sub { position: absolute; bottom: 3cqh; font-size: 1.2cqw; color: #64748b; }
#status { position: absolute; right: 1cqw; bottom: 1cqh; font-size: 12px; color: #f87171; display: none; z-index: 30; }

/* ---------- ticker ---------- */
#ticker { height: 7.5cqh; display: flex; align-items: stretch; font-size: 3.6cqh; font-weight: 600; flex: none; z-index: 5; }
.tk-label { display: flex; align-items: center; padding: 0 2cqw; background: rgba(0,0,0,.35); text-transform: uppercase;
            letter-spacing: .08em; font-weight: 800; white-space: nowrap; }
.tk-label:empty { display: none; }
.tk-track { flex: 1; overflow: hidden; position: relative; display: flex; align-items: center; }
.tk-run { display: inline-flex; white-space: nowrap; will-change: transform; animation: tk linear infinite; }
.tk-run span { padding-right: 3cqw; }
.tk-run .sep { opacity: .6; padding-right: 3cqw; }
.tk-run .src { opacity: .75; font-weight: 800; text-transform: uppercase; font-size: .8em; letter-spacing: .06em; padding-right: 1cqw; }
@keyframes tk { from { transform: translateX(0); } to { transform: translateX(-50%); } }

/* ---------- overlays ---------- */
#info { position: absolute; top: 2.5cqh; right: 1.8cqw; display: flex; gap: 1cqw; z-index: 10; }
#info > div { background: rgba(0,0,0,.55); backdrop-filter: blur(6px); border-radius: 1.4cqh; padding: 1cqh 1.4cqw;
              display: flex; flex-direction: column; justify-content: center; text-shadow: 0 1px 2px rgba(0,0,0,.4); }
#clock .time { font-size: 4.4cqh; font-weight: 700; line-height: 1.05; font-variant-numeric: tabular-nums; }
#clock .date { font-size: 1.9cqh; opacity: .85; }
#wxbadge { flex-direction: row !important; align-items: center; gap: .8cqw; }
#wxbadge svg { width: 5.5cqh; height: 5.5cqh; }
#wxbadge .t { font-size: 4.4cqh; font-weight: 700; line-height: 1; }
#wxbadge .l { font-size: 1.9cqh; opacity: .85; }
#logo { position: absolute; max-height: 11cqh; max-width: 18cqw; z-index: 10; filter: drop-shadow(0 2px 6px rgba(0,0,0,.4)); }
#logo.top-left { top: 2.5cqh; left: 1.8cqw; } #logo.top-right { top: 2.5cqh; right: 1.8cqw; }
#logo.bottom-left { bottom: 2.5cqh; left: 1.8cqw; } #logo.bottom-right { bottom: 2.5cqh; right: 1.8cqw; }
body.has-ticker #logo.bottom-left, body.has-ticker #logo.bottom-right { bottom: 10cqh; }

/* ---------- weather slide ---------- */
.wx { position: absolute; inset: 0; display: grid; grid-template-rows: auto 1fr auto auto; padding: 3.5cqh 5cqw 2.5cqh; gap: 1.8cqh;
      background: linear-gradient(160deg, #0ea5e9, #1e3a8a); }
.wx.night { background: linear-gradient(160deg, #1e1b4b, #020617); }
.wx.cloudy, .wx.fog { background: linear-gradient(160deg, #64748b, #1e293b); }
.wx.rain, .wx.drizzle, .wx.sleet, .wx.storm { background: linear-gradient(160deg, #334155, #0f172a); }
.wx.snow { background: linear-gradient(160deg, #94a3b8, #334155); }
.wx-head { font-size: 3.4cqh; font-weight: 600; opacity: .9; letter-spacing: .02em; }
.wx-head small { display: block; font-size: 2.2cqh; font-weight: 400; opacity: .8; }
.wx-now { display: flex; align-items: center; gap: 4cqw; }
.wx-now svg { width: 22cqh; height: 22cqh; flex: none; filter: drop-shadow(0 6px 20px rgba(0,0,0,.25)); }
.wx-temp { font-size: 18cqh; font-weight: 200; line-height: .9; letter-spacing: -.03em; }
.wx-temp sup { font-size: .35em; vertical-align: top; margin-left: .3cqw; font-weight: 300; }
.wx-cond { font-size: 4.4cqh; font-weight: 600; }
.wx-meta { display: flex; gap: 3cqw; font-size: 2.6cqh; opacity: .9; margin-top: 1cqh; }
.wx-hours { display: grid; grid-template-columns: repeat(8, 1fr); gap: 1cqw; background: rgba(255,255,255,.1); border-radius: 2cqh; padding: 1.2cqh 1cqw; }
.wx-hours div { text-align: center; font-size: 2.3cqh; }
.wx-hours svg { width: 4.4cqh; height: 4.4cqh; display: block; margin: .3cqh auto; }
.wx-hours b { font-size: 2.8cqh; }
.wx-hours .p { font-size: 1.8cqh; color: #7dd3fc; min-height: 1em; }
.wx-days { display: grid; grid-template-columns: repeat(6, 1fr); gap: 1cqw; }
.wx-days div { background: rgba(255,255,255,.12); border-radius: 2cqh; padding: 1.2cqh 1cqw; text-align: center; font-size: 2.3cqh; }
.wx-days svg { width: 5.6cqh; height: 5.6cqh; display: block; margin: .4cqh auto; }
.wx-days .hi { font-size: 3.2cqh; font-weight: 700; } .wx-days .lo { opacity: .7; margin-left: .6cqw; }
.wx-days .p { font-size: 1.9cqh; color: #7dd3fc; min-height: 1em; }

/* ---------- news slide ---------- */
.news { position: absolute; inset: 0; background: #0b1020; display: flex; flex-direction: column; }
.news-bar { display: flex; align-items: center; gap: 1.5cqw; padding: 2.6cqh 4cqw; background: #111827; border-bottom: .5cqh solid #dc2626; }
.news-bar .tag { background: #dc2626; padding: .6cqh 1.2cqw; border-radius: .8cqh; font-weight: 800; letter-spacing: .1em; font-size: 2.4cqh; }
.news-bar .src { font-size: 3cqh; font-weight: 600; }
.news-bar .dots { margin-left: auto; margin-right: 28cqw; display: flex; gap: .6cqw; }
.news-bar .dots i { width: 1.2cqh; height: 1.2cqh; border-radius: 50%; background: #475569; display: block; }
.news-bar .dots i.on { background: #f8fafc; }
.news-body { flex: 1; display: grid; grid-template-columns: 1.15fr 1fr; gap: 4cqw; padding: 5cqh 4cqw; align-items: center; min-height: 0; }
.news-body.noimg { grid-template-columns: 1fr; padding: 6cqh 10cqw; }
.news-img { width: 100%; height: 100%; max-height: 66cqh; object-fit: cover; border-radius: 2cqh; background: #1f2937; }
.news-title { font-size: 6cqh; font-weight: 800; line-height: 1.15; margin: 0 0 3cqh;
              display: -webkit-box; -webkit-line-clamp: 5; -webkit-box-orient: vertical; overflow: hidden; }
.news-body.noimg .news-title { font-size: 8cqh; }
.news-sum { font-size: 3cqh; line-height: 1.45; color: #cbd5e1; display: -webkit-box; -webkit-line-clamp: 5; -webkit-box-orient: vertical; overflow: hidden; }
.news-time { font-size: 2.4cqh; color: #94a3b8; margin-top: 3cqh; }
.news-story { animation: fadeUp .7s ease both; }
@keyframes fadeUp { from { opacity: 0; transform: translateY(2cqh); } to { opacity: 1; transform: none; } }

/* ---------- announcement slide ---------- */
.txt { position: absolute; inset: 0; display: flex; flex-direction: column; justify-content: center; padding: 8cqh 9cqw;
       background-size: cover; background-position: center; }
.txt.has-bg::before { content: ""; position: absolute; inset: 0; background: rgba(0,0,0,.45); }
.txt > * { position: relative; }
.txt.center { text-align: center; align-items: center; }
.txt h1 { font-size: min(11cqh, 6.2cqw); line-height: 1.05; margin: 0 0 4cqh; font-weight: 800; text-shadow: 0 2px 10px rgba(0,0,0,.25); }
.txt p { font-size: min(5cqh, 2.8cqw); line-height: 1.4; margin: 0; white-space: pre-line; max-width: 80cqw; }
.txt.size-s h1 { font-size: min(8cqh, 4.5cqw); } .txt.size-s p { font-size: min(3.8cqh, 2.1cqw); }
.txt.size-l h1 { font-size: min(15cqh, 8.4cqw); } .txt.size-l p { font-size: min(6.5cqh, 3.7cqw); }
.txt.panel-clear h1, .txt.panel-clear p { text-shadow: 0 .3cqh 2cqh rgba(0,0,0,.55); }
.txt .glass { background: rgba(0,0,0,.32); backdrop-filter: blur(2cqmin) saturate(1.3); border: 1px solid rgba(255,255,255,.2);
              border-radius: 3cqmin; padding: 6cqmin 7cqmin; max-width: 86cqw; box-sizing: border-box; box-shadow: 0 2cqh 6cqh rgba(0,0,0,.3); }
.txt.center .glass { display: flex; flex-direction: column; align-items: center; }
.txt .glass p:last-child, .txt .glass h1:last-child { margin-bottom: 0; }
.txt h1, .txt p { animation: fadeUp .9s ease both; } .txt p { animation-delay: .25s; }

.loading { position: absolute; inset: 0; display: grid; place-items: center; font-size: 4cqh; color: #94a3b8; background: #0f172a; }

/* ---------- slides in tall, narrow zones (sidebars, columns) ---------- */
@container zone (aspect-ratio < 1.1) {
  .wx { grid-template-rows: auto 1fr auto; padding: 5cqw; gap: 3cqw; }
  .wx-head { font-size: 6cqw; } .wx-head small { font-size: 4cqw; }
  .wx-now { flex-direction: column; justify-content: center; text-align: center; gap: 2cqw; }
  .wx-now svg { width: 34cqw; height: 34cqw; }
  .wx-temp { font-size: 26cqw; } .wx-cond { font-size: 7cqw; }
  .wx-meta { flex-direction: column; align-items: center; gap: 1cqw; font-size: 4.4cqw; }
  .wx-hours { display: none; }
  .wx-days { grid-template-columns: repeat(3, 1fr); gap: 2cqw; } .wx-days div:nth-child(n+4) { display: none; }
  .wx-days div { font-size: 4.4cqw; padding: 2.5cqw 1cqw; border-radius: 3cqw; }
  .wx-days svg { width: 11cqw; height: 11cqw; } .wx-days .hi { font-size: 6cqw; } .wx-days .p { font-size: 3.4cqw; }

  .news-bar { padding: 3.5cqw 5cqw; gap: 3cqw; border-bottom-width: 1cqw; }
  .news-bar .tag { font-size: 3.8cqw; padding: 1cqw 2cqw; } .news-bar .src { font-size: 4.6cqw; }
  .news-bar .dots { margin-right: 0; gap: 1.2cqw; } .news-bar .dots i { width: 2cqw; height: 2cqw; }
  .news-body, .news-body.noimg { grid-template-columns: 1fr; grid-template-rows: auto 1fr; padding: 6cqw 5cqw; gap: 5cqw; align-items: start; }
  .news-img { height: auto; aspect-ratio: 16 / 10; max-height: 40cqh; border-radius: 3cqw; }
  .news-title, .news-body.noimg .news-title { font-size: 7.5cqw; margin-bottom: 3cqw; }
  .news-sum { font-size: 4.6cqw; } .news-time { font-size: 3.8cqw; margin-top: 3cqw; }
  .txt { padding: 8cqw; }
}

/* ---------- slides in short, wide zones (banners) ---------- */
@container zone (aspect-ratio > 2.2) {
  .wx { display: flex; align-items: center; gap: 3cqw; padding: 0 3cqw; }
  .wx-head { font-size: 14cqh; max-width: 22cqw; } .wx-head small { font-size: 10cqh; }
  .wx-now { gap: 2cqw; } .wx-now svg { width: 70cqh; height: 70cqh; }
  .wx-temp { font-size: 58cqh; } .wx-cond { font-size: 15cqh; } .wx-meta { display: none; }
  .wx-hours { display: none; }
  .wx-days { margin-left: auto; grid-template-columns: repeat(4, auto); gap: 1.2cqw; } .wx-days div:nth-child(n+5) { display: none; }
  .wx-days div { font-size: 11cqh; padding: 5cqh 1.6cqw; border-radius: 6cqh; }
  .wx-days svg { width: 26cqh; height: 26cqh; } .wx-days .hi { font-size: 14cqh; } .wx-days .p { display: none; }

  .news { flex-direction: row; }
  .news-bar { flex-direction: column; justify-content: center; align-items: flex-start; gap: 5cqh; padding: 0 2.5cqw; border-bottom: none; border-right: 1.2cqh solid #dc2626; }
  .news-bar .tag { font-size: 12cqh; padding: 2.5cqh 1cqw; border-radius: 3cqh; }
  .news-bar .src { font-size: 12cqh; max-width: 22cqw; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .news-bar .dots { display: none; }
  .news-body, .news-body.noimg { grid-template-columns: 1fr; padding: 0 3cqw; }
  .news-img, .news-sum, .news-time { display: none; }
  .news-title, .news-body.noimg .news-title { font-size: 24cqh; margin: 0; -webkit-line-clamp: 2; }
  .txt { padding: 6cqh 4cqw; }
  .txt h1, .txt.size-s h1, .txt.size-l h1 { font-size: min(30cqh, 5cqw); margin-bottom: 3cqh; }
  .txt p, .txt.size-s p, .txt.size-l p { font-size: min(16cqh, 2.6cqw); }
  .txt .glass { padding: 4cqh 3cqw; }
}

/* Shorter strips (a portrait footer, say): fewer forecast days, no heading. */
@container zone (aspect-ratio > 2.2) and (aspect-ratio < 4.5) {
  .wx-head { display: none; }
  .wx-days div:nth-child(n+3) { display: none; }
  .wx-days { grid-template-columns: repeat(2, auto); }
}

/* ---------- widgets: schedule and menu ---------- */
/* --fit is lowered by the player until the content fits its zone. */
.wg { position: absolute; inset: 0; display: flex; flex-direction: column; padding: calc(var(--fit, 1) * 5cqmin) calc(var(--fit, 1) * 6cqmin);
      box-sizing: border-box; gap: calc(var(--fit, 1) * 2.5cqmin); --accent: #fbbf24; --ink: #fff; --soft: rgba(255,255,255,.72); --card: rgba(255,255,255,.08); color: var(--ink); }
.wg.theme-midnight { background: linear-gradient(160deg, #1e1b4b, #0f172a 70%); --accent: #fbbf24; }
.wg.theme-warm { background: linear-gradient(160deg, #7c2d12, #431407); --accent: #fdba74; }
.wg.theme-forest { background: linear-gradient(160deg, #064e3b, #022c22); --accent: #6ee7b7; }
.wg.theme-ocean { background: linear-gradient(160deg, #075985, #0c4a6e 60%, #082f49); --accent: #7dd3fc; }
.wg.theme-light { background: linear-gradient(180deg, #fffbeb, #fef3c7); --ink: #1c1917; --soft: #57534e; --card: rgba(120,53,15,.07); --accent: #b45309; }
.wg.theme-glass { background: rgba(0,0,0,.35); backdrop-filter: blur(2cqmin); --card: rgba(255,255,255,.1); }
.wg-head { flex: none; border-bottom: calc(var(--fit, 1) * .5cqmin) solid var(--accent); padding-bottom: calc(var(--fit, 1) * 2cqmin); }
.wg-title { font-size: calc(var(--fit, 1) * 7.5cqmin); font-weight: 800; line-height: 1.05; letter-spacing: -.01em; }
.wg-sub { font-size: calc(var(--fit, 1) * 3.4cqmin); color: var(--soft); margin-top: calc(var(--fit, 1) * .8cqmin); }
.wg-body { flex: 1; min-height: 0; overflow: hidden; display: flex; flex-direction: column; gap: calc(var(--fit, 1) * 1.6cqmin); }
.wg-empty { margin: auto; font-size: calc(var(--fit, 1) * 4.5cqmin); color: var(--soft); text-align: center; }
.wg-note { flex: none; font-size: calc(var(--fit, 1) * 2.8cqmin); color: var(--soft); text-align: center; font-style: italic; }

.ev { display: flex; align-items: center; gap: calc(var(--fit, 1) * 3cqmin); background: var(--card); border-radius: calc(var(--fit, 1) * 2cqmin);
      padding: calc(var(--fit, 1) * 1.8cqmin) calc(var(--fit, 1) * 2.6cqmin); border-left: calc(var(--fit, 1) * .8cqmin) solid transparent; flex: none; }
.ev-time { flex: none; min-width: 6.2em; font-size: calc(var(--fit, 1) * 4.2cqmin); font-weight: 800; color: var(--accent); font-variant-numeric: tabular-nums; line-height: 1.1; }
.ev-time small { font-size: .55em; margin-left: .2em; font-weight: 700; }
.ev-end { display: block; font-size: .5em; font-weight: 600; color: var(--soft); margin-top: .2em; }
.ev-main { flex: 1; min-width: 0; }
.ev-title { font-size: calc(var(--fit, 1) * 4.6cqmin); font-weight: 700; line-height: 1.15; }
.ev-loc { display: flex; align-items: center; gap: .35em; font-size: calc(var(--fit, 1) * 3cqmin); color: var(--soft); margin-top: .25em; }
.ev-loc .pin { width: 1em; height: 1em; flex: none; }
.ev-badge { flex: none; font-size: calc(var(--fit, 1) * 2.6cqmin); font-weight: 800; text-transform: uppercase; letter-spacing: .08em;
            background: var(--accent); color: #111; padding: .35em .8em; border-radius: 999px; }
.ev-badge.next { background: transparent; color: var(--accent); border: .15em solid var(--accent); }
.ev.now { border-left-color: var(--accent); background: color-mix(in srgb, var(--accent) 22%, transparent); }
.ev.done { opacity: .4; }

.mn-cols { display: flex; flex-direction: column; gap: calc(var(--fit, 1) * 3cqmin); }
.wg-menu.two-col .mn-cols { display: block; column-count: 2; column-gap: calc(var(--fit, 1) * 6cqmin); }
.mn-sec { break-inside: avoid; margin-bottom: calc(var(--fit, 1) * 3cqmin); }
.mn-sec h3 { margin: 0 0 calc(var(--fit, 1) * 1.4cqmin); font-size: calc(var(--fit, 1) * 4cqmin); color: var(--accent); text-transform: uppercase; letter-spacing: .1em; }
.mn-item { margin-bottom: calc(var(--fit, 1) * 1.6cqmin); break-inside: avoid; }
.mn-line { display: flex; align-items: baseline; gap: .4em; font-size: calc(var(--fit, 1) * 4.2cqmin); font-weight: 700; }
.mn-dots { flex: 1; border-bottom: .12em dotted var(--soft); opacity: .6; transform: translateY(-.25em); }
.mn-price { font-weight: 800; color: var(--accent); }
.mn-desc { font-size: calc(var(--fit, 1) * 3cqmin); color: var(--soft); margin-top: .15em; line-height: 1.3; }
@container zone (aspect-ratio < 1.1) { .wg-menu.two-col .mn-cols { column-count: 1; } }
/* Wide but not banner-short (the main area above a banner, say): two columns. */
@container zone (aspect-ratio > 1.9) and (aspect-ratio <= 3.4) {
  .wg-sched .wg-body { display: grid; grid-template-columns: 1fr 1fr; align-content: start; }
  .wg-menu .mn-cols { display: block; column-count: 2; column-gap: calc(var(--fit, 1) * 6cqmin); }
}
@container zone (aspect-ratio > 3.4) {
  .wg { flex-direction: row; align-items: center; }
  .wg-head { border-bottom: none; border-right: calc(var(--fit, 1) * .5cqmin) solid var(--accent); padding: 0 calc(var(--fit, 1) * 3cqmin) 0 0; max-width: 28%; }
  .wg-body { flex-direction: row; height: 100%; align-items: center; }
  .ev { flex: 1 1 0; min-width: 0; padding: 4cqh 1.6cqw; border-radius: 6cqh; gap: 1.4cqw; }
  .ev.done, .ev.later { display: none; }
  /* A banner is short, so size from its height. */
  .wg-title { font-size: calc(var(--fit, 1) * 15cqh); } .wg-sub { font-size: calc(var(--fit, 1) * 8cqh); }
  .ev-time { font-size: calc(var(--fit, 1) * 11cqh); min-width: 0; }
  .ev-title { font-size: calc(var(--fit, 1) * 12cqh); } .ev-loc { font-size: calc(var(--fit, 1) * 8cqh); }
  .ev-badge { font-size: calc(var(--fit, 1) * 7cqh); }
}
/* Sidebars: the badge goes under the activity name instead of squeezing it. */
@container zone (aspect-ratio < 1.1) {
  .ev { display: grid; grid-template-columns: auto minmax(0, 1fr); column-gap: calc(var(--fit, 1) * 3cqmin); row-gap: .4em; }
  .ev-time { min-width: 0; }
  .ev-badge { grid-column: 2; justify-self: start; }
}

/* Small notice while the controller can't confirm its license (the TV keeps playing). */
#license-badge { position: absolute; left: 1cqw; bottom: 1cqh; z-index: 30; font: 600 12px system-ui, sans-serif; color: #fde68a;
  background: rgba(0, 0, 0, .55); padding: 3px 8px; border-radius: 6px; }
#license-badge.hidden { display: none; }

/* ---------- photo album ---------- */
.album { position: absolute; inset: 0; overflow: hidden; background: #000; container-type: size; }
.album-empty { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .6em; text-align: center; padding: 6%;
  color: #e2e8f0; background: radial-gradient(circle at 50% 40%, #1e293b, #020617); font-size: clamp(14px, 3.2cqmin, 40px); }
.album-empty-ic { font-size: 2.6em; }
.album-empty span { color: #94a3b8; max-width: 30em; }

.al-frame { position: absolute; inset: 0; opacity: 0; transition: opacity 1.8s ease; }
.al-frame.in { opacity: 1; }
.al-frame.out { opacity: 0; transition-duration: 2s; }
.al-cap { position: absolute; left: 4cqw; bottom: 4cqh; z-index: 3; color: #fff; font-weight: 600; letter-spacing: .01em;
  font-size: clamp(12px, 2.6cqmin, 34px); text-shadow: 0 2px 12px rgba(0, 0, 0, .7), 0 0 2px rgba(0, 0, 0, .6);
  opacity: 0; transform: translateY(8px); transition: opacity 1.2s ease 1.2s, transform 1.2s ease 1.2s; }
.al-frame.in .al-cap { opacity: .95; transform: none; }
.al-memory { position: absolute; top: 4cqh; left: 4cqw; z-index: 3; padding: .35em .9em; border-radius: 99px; font-weight: 700;
  font-size: clamp(11px, 2cqmin, 26px); color: #422006; background: linear-gradient(135deg, #fde68a, #fbbf24); box-shadow: 0 6px 20px rgba(0, 0, 0, .35); }

/* cinema */
.album-cinema .al-bg { position: absolute; inset: -8%; width: 116%; height: 116%; object-fit: cover; filter: blur(40px) brightness(.55) saturate(1.2); }
.album-cinema .al-img { position: absolute; inset: 0; width: 100%; height: 100%; animation: al-drift var(--al-time, 10s) ease-out forwards; }
.album-cinema .al-contain { object-fit: contain; filter: drop-shadow(0 10px 40px rgba(0, 0, 0, .5)); }
.album-cinema .al-cover-soft { object-fit: cover; }
.album-cinema .al-cover { object-fit: cover; }
.album-cinema .al-frame::after { content: ''; position: absolute; inset: 0; pointer-events: none; z-index: 2;
  background: linear-gradient(to top, rgba(0, 0, 0, .45), transparent 28%), radial-gradient(ellipse at center, transparent 60%, rgba(0, 0, 0, .35)); }
.album-cinema .al-pair { display: flex; gap: 6px; background: #000; }
.album-cinema .al-half { position: relative; flex: 1; overflow: hidden; }
.album-cinema .al-half .al-cap { left: 8%; }
@keyframes al-drift { from { transform: scale(1.0); } to { transform: scale(1.09); } }

/* gallery */
.album-gallery { background: #1a1714; }
.album-gallery .al-wall { position: absolute; inset: 0;
  background: radial-gradient(ellipse at 50% 18%, rgba(255, 236, 200, .22), transparent 55%),
              repeating-linear-gradient(90deg, rgba(255, 255, 255, .012) 0 2px, transparent 2px 7px),
              linear-gradient(180deg, #3a332d, #231f1b 70%, #1a1714); }
.album-gallery .al-art { position: absolute; left: 50%; top: 46%; margin: 0; transform: translate(-50%, -50%) scale(.985); transition: transform 2.4s ease;
  display: flex; flex-direction: column; align-items: center; }
.album-gallery .al-frame.in .al-art { transform: translate(-50%, -50%); }
.album-gallery .al-mat { background: #f6f2ea; padding: clamp(10px, 4.5cqmin, 70px); border: clamp(4px, 1.1cqmin, 16px) solid #15120f;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .15), inset 0 4px 10px rgba(0, 0, 0, .18), 0 30px 60px rgba(0, 0, 0, .55), 0 6px 14px rgba(0, 0, 0, .4); }
.album-gallery .al-mat img { display: block; max-width: 64cqw; max-height: 62cqh; box-shadow: 0 0 0 1px rgba(0, 0, 0, .25), inset 0 0 8px rgba(0, 0, 0, .3); }
.album-gallery .al-art.tall .al-mat img { max-height: 66cqh; max-width: 44cqw; }
.album-gallery figcaption { margin-top: clamp(8px, 2.6cqmin, 40px); padding: .45em 1em; background: #f4efe6; color: #2b2520; border-radius: 2px;
  box-shadow: 0 4px 10px rgba(0, 0, 0, .4); font: 500 clamp(10px, 1.7cqmin, 22px)/1.35 Georgia, 'Times New Roman', serif; text-align: center; }
.album-gallery figcaption b { display: block; font-weight: 700; }
.album-gallery figcaption span { color: #6b5f53; font-style: italic; }

/* prints */
.album-prints { background: #6b4a2f; }
.album-prints .al-table { position: absolute; inset: 0;
  background: radial-gradient(ellipse at 50% 40%, rgba(255, 220, 170, .25), transparent 65%),
              repeating-linear-gradient(92deg, rgba(0, 0, 0, .05) 0 3px, transparent 3px 11px, rgba(255, 255, 255, .03) 11px 13px, transparent 13px 29px),
              linear-gradient(180deg, #7a5536, #5a3d26); }
.album-prints .al-print { position: absolute; margin: 0; width: min(36cqw, 50cqh); background: #fbfaf6; padding: 3.2% 3.2% 0; border-radius: 2px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, .25), 0 18px 40px rgba(0, 0, 0, .45);
  transform: translate(-50%, -50%) rotate(calc(var(--r) * 2.2)) scale(1.35); opacity: 0;
  transition: transform 1.1s cubic-bezier(.2, .9, .3, 1.15), opacity .5s ease, filter 1.5s ease; }
.album-prints .al-print.tall { width: min(26cqw, 40cqh); }
.album-prints .al-print.down { transform: translate(-50%, -50%) rotate(var(--r)) scale(1); opacity: 1; }
.album-prints .al-print.gone { opacity: 0; transition: opacity 1.4s ease; }
.album-prints .al-print img { display: block; width: 100%; aspect-ratio: 1; object-fit: cover; background: #222; }
.album-prints .al-print.tall img { aspect-ratio: 4 / 5; }
.album-prints .al-print figcaption { min-height: 2.6em; display: flex; align-items: center; justify-content: center; text-align: center; padding: .2em .4em;
  color: #1e3a8a; font: clamp(11px, 2.3cqmin, 30px)/1.1 'Segoe Print', 'Bradley Hand', 'Comic Sans MS', 'Marker Felt', cursive; }

/* mosaic */
.album-mosaic { background: #0b0b0c; }
.album-mosaic .al-grid { position: absolute; inset: 0; display: grid; gap: 6px; padding: 6px;
  grid-template-columns: repeat(var(--cols, 3), 1fr); grid-template-rows: repeat(var(--rows, 2), 1fr); }
.album-mosaic .al-tile { position: relative; overflow: hidden; border-radius: 6px; background: #18181b; }
.album-mosaic .al-tile.big { grid-column: span 2; grid-row: span 2; }
.album-mosaic .al-tile img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; opacity: 0; transform: scale(1.06);
  transition: opacity 1.4s ease, transform 8s ease-out; }
.album-mosaic .al-tile img.in { opacity: 1; transform: scale(1); }
.album-mosaic .al-tile img.out { opacity: 0; }
.album-mosaic .al-tile::after { content: attr(data-cap); position: absolute; left: 0; right: 0; bottom: 0; z-index: 2; padding: 1.6em .8em .6em; color: #fff;
  font-weight: 600; font-size: clamp(10px, 1.6cqmin, 20px); background: linear-gradient(to top, rgba(0, 0, 0, .6), transparent); }
.album-mosaic .al-tile[data-cap=""]::after { display: none; }

/* ---------- countdown ---------- */
.cd { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center;
      padding: 6cqh 6cqw; box-sizing: border-box; }
.cd .glass { background: rgba(0,0,0,.32); backdrop-filter: blur(2cqmin) saturate(1.3); border: 1px solid rgba(255,255,255,.2);
             border-radius: 3cqmin; padding: 5cqmin 7cqmin; display: flex; flex-direction: column; align-items: center; }
.cd.panel-clear > *, .cd.panel-clear .glass > * { text-shadow: 0 .3cqh 2cqh rgba(0,0,0,.55); }
.cd-title { font-size: min(8cqh, 5cqw); font-weight: 800; line-height: 1.1; margin-bottom: 3cqh; }
.cd-num { font-size: min(42cqh, 26cqw); font-weight: 900; line-height: .9; font-variant-numeric: tabular-nums; letter-spacing: -.03em; }
.cd-unit { font-size: min(7cqh, 4.4cqw); font-weight: 700; text-transform: uppercase; letter-spacing: .14em; opacity: .85; margin-top: 1cqh; }
.cd-clock { display: flex; gap: min(3cqh, 2cqw); }
.cd-clock div { display: flex; flex-direction: column; align-items: center; background: rgba(0,0,0,.22); border-radius: 2cqmin;
                padding: 2cqh min(2.4cqh, 1.6cqw); min-width: min(22cqh, 15cqw); }
.cd-clock b { font-size: min(24cqh, 13cqw); font-weight: 900; line-height: 1; font-variant-numeric: tabular-nums; }
.cd-clock span { font-size: min(3.6cqh, 2.2cqw); text-transform: uppercase; letter-spacing: .14em; opacity: .8; margin-top: 1cqh; }
.cd-done { font-size: min(18cqh, 10cqw); font-weight: 900; line-height: 1; }
.cd-sub { font-size: min(4.6cqh, 2.8cqw); margin-top: 3cqh; opacity: .9; max-width: 80cqw; line-height: 1.35; }
.cd.intro .cd-title, .cd.intro .cd-num, .cd.intro .cd-clock, .cd.intro .cd-done { animation: fadeUp .9s ease both; }

/* ---------- calendar ---------- */
.cal-day { flex: none; font-size: calc(var(--fit, 1) * 3.4cqmin); font-weight: 800; text-transform: uppercase; letter-spacing: .1em;
           color: var(--accent); margin-top: calc(var(--fit, 1) * 1.2cqmin); }
.cal-day:first-child { margin-top: 0; }
.cal-all { font-size: .7em; text-transform: uppercase; letter-spacing: .06em; }

/* ---------- YouTube ---------- */
.ytbox { position: absolute; inset: 0; background: #000; overflow: hidden; pointer-events: none; }
.ytbox iframe { position: absolute; top: 0; left: 0; width: 100%; height: 100%; border: 0; }
/* Fill the zone: make the 16:9 player big enough to cover it, cropping the edges. */
.ytbox.yt-cover iframe { width: max(100%, 177.78cqh); height: max(100%, 56.25cqw); left: 50%; top: 50%; transform: translate(-50%, -50%); }

/* ---------- TV off hours ---------- */
#off { position: absolute; inset: 0; background: #000; z-index: 40; }

/* ---------- emergency alert ---------- */
#alert { position: absolute; inset: 0; z-index: 50; display: flex; flex-direction: column; align-items: center; justify-content: center;
         text-align: center; padding: 6cqh 8cqw; box-sizing: border-box; color: #fff; }
#alert.hidden { display: none; }
#alert.al-red { background: radial-gradient(circle at 50% 35%, #dc2626, #7f1d1d); }
#alert.al-orange { background: radial-gradient(circle at 50% 35%, #f97316, #7c2d12); }
#alert.al-blue { background: radial-gradient(circle at 50% 35%, #2563eb, #1e3a8a); }
#alert.al-green { background: radial-gradient(circle at 50% 35%, #16a34a, #14532d); }
#alert::before { content: ""; position: absolute; inset: 1.4cqmin; border: 1cqmin solid rgba(255,255,255,.85); border-radius: 2cqmin;
                 animation: alertPulse 1.6s ease-in-out infinite; pointer-events: none; }
@keyframes alertPulse { 50% { opacity: .25; } }
.al-tag { font-size: min(5cqh, 3cqw); font-weight: 900; letter-spacing: .3em; text-transform: uppercase; background: rgba(0,0,0,.28);
          padding: .35em 1.1em; border-radius: 999px; margin-bottom: 4cqh; }
#alert h1 { font-size: min(13cqh, 7.5cqw); line-height: 1.05; margin: 0 0 4cqh; font-weight: 900; text-shadow: 0 .4cqh 2cqh rgba(0,0,0,.3); }
#alert p { font-size: min(6cqh, 3.4cqw); line-height: 1.35; margin: 0; max-width: 82cqw; white-space: pre-line; }
