/* Screens: kiosk board. Everything scales from one root size derived from the viewport,
   so the same layout fills 1920×1080, 3840×2160 and degrades sensibly on a tablet. Inter only. */
/* Colour tokens come from /theme.css (light base, [data-theme="dark"] override; the kiosk defaults to
   dark via ?theme=). Only kiosk-specific tokens live here. */
:root {
  --bg-2: #ffffff;
  --row: rgba(16, 34, 52, 0.03);
  --row-alt: rgba(16, 34, 52, 0.012);
  --time: var(--text);
  /* 1920×1080 → ~16.5px, 3840×2160 → ~33px, 1024×768 → ~11px (clamped). */
  font-size: clamp(11px, calc(0.55vw + 0.55vh), 48px);
}
[data-theme="dark"] {
  --bg-2: #141929;
  --row: rgba(255, 255, 255, 0.025);
  --row-alt: rgba(255, 255, 255, 0.012);
  --time: #ffd23f;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text); font-family: var(--sans); -webkit-font-smoothing: antialiased; overflow: hidden; }
body { font-size: 1rem; font-variant-numeric: tabular-nums; }
.dim { color: var(--dim); }

.screen { height: 100vh; display: flex; flex-direction: column; padding: 1.6rem 2.4rem 1.2rem; gap: 1rem; background: var(--bg); }

/* ---------- header ---------- */
.hdr { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 2rem; }
.hdr-brand { display: flex; align-items: center; gap: .8rem; min-width: 0; }
.logo-mark { width: 2.4rem; height: 2.4rem; color: var(--text); flex: none; }
.accent { color: var(--accent); }
.logo-img { height: 2.6rem; max-width: 12rem; object-fit: contain; flex: none; }
.brand-title { font-weight: 700; font-size: 1.25rem; letter-spacing: -.02em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.brand-title.custom { letter-spacing: 0; font-size: 1.4rem; }
.slash { color: var(--accent); }
.brand-sub { color: var(--muted); font-size: .8rem; font-weight: 500; }
.hdr-station { text-align: center; min-width: 0; }
.stn-name { font-weight: 800; font-size: 2.1rem; letter-spacing: -.01em; line-height: 1.1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 60vw; }
.stn-sub { color: var(--muted); font-size: .95rem; margin-top: .3rem; }
.hdr-clock { text-align: right; }
.clock { font-weight: 800; font-size: 2.6rem; line-height: 1; letter-spacing: -.02em; }
.clock-sub { color: var(--muted); font-size: .85rem; margin-top: .35rem; text-transform: capitalize; }

/* ---------- walk bar ---------- */
.walk { display: flex; align-items: center; gap: .8rem; padding: .55rem 1rem; border: 1px solid var(--line-strong); background: var(--hover); border-radius: .7rem; font-size: 1rem; }
.walk-mark { width: .35rem; height: 1.3rem; border-radius: .2rem; background: var(--d0); }
.walk-hint { color: var(--muted); margin-left: auto; font-size: .85rem; }

/* ---------- board ---------- */
.board { flex: 1; min-height: 0; display: flex; flex-direction: column; border: 1px solid var(--line); border-radius: 1rem; background: var(--bg-2); overflow: hidden; transition: opacity .35s ease; box-shadow: var(--shadow); }
.board.fade { opacity: 0; }
.rows { flex: 1; min-height: 0; overflow: hidden; position: relative; }
.brow { display: grid; grid-template-columns: 6.5rem 7rem 1fr 7rem 13rem; align-items: center; gap: 1.2rem; padding: 0 1.6rem; height: 3.6rem; border-bottom: 1px solid var(--line); font-size: 1.5rem; font-weight: 600; position: relative; transition: opacity .45s ease, transform .45s cubic-bezier(.2,.8,.2,1), background .3s; background: var(--row-alt); }
.brow:nth-child(even) { background: var(--row); }
.brow.head { height: 2.4rem; font-size: .9rem; font-weight: 500; color: var(--muted); background: var(--hover); border-bottom: 1px solid var(--line-strong); }
.brow.enter { opacity: 0; transform: translateY(.6rem); }
.brow.leave { opacity: 0; transform: translateX(-1rem); pointer-events: none; }
.brow > span { min-width: 0; }
.brow.head > span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--muted); font-weight: 500; }
.c-time { color: var(--time); font-weight: 800; letter-spacing: -.01em; }
.c-line { display: flex; }
.code { display: inline-block; font-weight: 700; font-size: 1.05rem; padding: .25rem .55rem; border-radius: .45rem; background: var(--accent-soft); color: var(--accent); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.code.train { background: var(--cyan-soft); color: var(--cyan); }
.c-dest { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-weight: 700; }
.c-plat { text-align: center; font-weight: 800; }
.head .c-plat, .head .c-status { text-align: center; }
.c-status { text-align: center; display: flex; flex-direction: column; align-items: center; justify-content: center; line-height: 1.05; }
.c-status .st-main { font-weight: 800; }
.c-status .st-sub { font-size: .8rem; font-weight: 600; opacity: .85; }
.c-status.d0 { color: var(--d0); }
.c-status.d1 { color: var(--d1); }
.c-status.d2 { color: var(--d2); }
.c-status.d3 { color: var(--d3); }
.c-status.early { color: var(--early); }
.c-status.sched { color: var(--muted); font-weight: 500; }
.c-status.cancelled { color: var(--d3); }
.c-status.gone { color: var(--muted); }
.brow.cancelled .c-dest, .brow.cancelled .c-time { text-decoration: line-through; text-decoration-thickness: .12em; opacity: .7; }
.brow.gone { opacity: .35; }
.brow.gone .c-time { color: var(--muted); }
/* walk highlighting: reachable rows carry a green bar, unreachable ones are dimmed */
.brow.go::before { content: ''; position: absolute; left: 0; top: .5rem; bottom: .5rem; width: .35rem; border-radius: 0 .2rem .2rem 0; background: var(--d0); }
.brow.miss { opacity: .5; }
.empty { padding: 3rem; text-align: center; color: var(--muted); font-size: 1.3rem; }

/* ---------- footer ---------- */
.ftr { display: flex; align-items: center; justify-content: space-between; gap: 1rem; font-size: .85rem; color: var(--muted); }
.ftr-left { display: flex; align-items: center; gap: .5rem; }
.live-dot { width: .6rem; height: .6rem; border-radius: 50%; background: var(--ok); color: var(--ok); animation: pulse 1.6s infinite; display: inline-block; }
.live-dot.busy { animation-duration: .7s; }
.live-dot.stale { background: var(--d1); animation: none; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 color-mix(in srgb, currentColor 45%, transparent); } 70% { box-shadow: 0 0 0 .5rem transparent; } 100% { box-shadow: 0 0 0 0 transparent; } }
.ftr-right { display: flex; align-items: center; gap: .45rem; }
.ftr-right span:not(.lg) { margin-right: .9rem; }
.lg { width: .7rem; height: .7rem; border-radius: .2rem; display: inline-block; }
.lg.d0 { background: var(--d0); } .lg.d1 { background: var(--d1); } .lg.d2 { background: var(--d2); } .lg.d3 { background: var(--d3); }

/* ---------- trial ribbon ---------- */
.ribbon { position: fixed; right: 0; bottom: 2.6rem; z-index: 5; padding: .35rem .8rem; border-radius: .5rem 0 0 .5rem; background: var(--panel-solid); border: 1px solid var(--line-strong); border-right: 0; color: var(--muted); font-size: .75rem; font-weight: 500; text-decoration: none; }
.ribbon b { color: var(--accent); font-weight: 600; }

/* ---------- tablets / narrow ---------- */
@media (max-width: 1100px) {
  .screen { padding: 1rem 1.2rem .8rem; }
  .hdr { grid-template-columns: 1fr auto; }
  .hdr-station { grid-column: 1 / -1; text-align: left; order: 3; }
  .stn-name { max-width: 100%; font-size: 1.6rem; }
  .brow { grid-template-columns: 5rem 5.5rem 1fr 4rem 9rem; gap: .8rem; padding: 0 1rem; }
  .clock { font-size: 2rem; }
}
@media (max-width: 700px) {
  body:not(.compact) .brow { grid-template-columns: 4.5rem 1fr 3rem 7rem; font-size: 1.2rem; height: 3.2rem; }
  body:not(.compact) .c-line { display: none; }
  .walk-hint { display: none; }
  .ftr-right { display: none; }
}

/* ---------- compact (embed widget) ---------- */
html.compact, body.compact { height: auto; min-height: 0; overflow: hidden; }
html.compact { font-size: 13px; }
body.compact .screen { height: auto; min-height: 0; padding: .7rem .9rem .5rem; gap: .5rem; background: var(--bg); }
body.compact .hdr { grid-template-columns: 1fr auto; gap: .8rem; }
body.compact .hdr-brand { display: none; }
body.compact .hdr-station { text-align: left; order: 0; grid-column: auto; }
body.compact .stn-name { font-size: 1.25rem; max-width: 100%; }
body.compact .stn-sub { font-size: .8rem; margin-top: .1rem; }
body.compact .clock { font-size: 1.4rem; }
body.compact .clock-sub { display: none; }
body.compact .board { border-radius: .6rem; box-shadow: none; }
body.compact .brow { height: 2.7rem; font-size: 1.05rem; gap: .6rem; padding: 0 .8rem; grid-template-columns: 3.6rem 4.6rem 1fr 3.4rem 8rem; }
.c-status .st-main { white-space: nowrap; }
body.compact .brow.head { height: 1.9rem; font-size: .66rem; }
body.compact .code { font-size: .8rem; padding: .15rem .4rem; }
body.compact .c-status .st-sub { font-size: .7rem; }
body.compact .walk { font-size: .85rem; padding: .35rem .7rem; }
body.compact .ftr { font-size: .72rem; }
body.compact .ftr-right { display: none; }
body.compact .empty { padding: 1.4rem; font-size: 1rem; }
body.compact .ribbon { position: static; display: block; width: fit-content; margin: 0 .9rem .6rem auto; border-radius: .4rem; border-right: 1px solid var(--line-strong); font-size: .7rem; }
@media (max-width: 420px) {
  body.compact .brow { grid-template-columns: 3.4rem 1fr 2.4rem 5.6rem; }
  body.compact .c-line { display: none; }
}
@media (prefers-reduced-motion: reduce) { .brow, .board { transition: none; } .live-dot { animation: none; } }
