:root {
  --paper: #f4f2ed;
  --surface: #ffffff;
  --ink: #15181c;
  --ink-soft: #3a3f47;
  --muted: #5b6472;
  --rule: #15181c;
  --rule-faint: rgba(21, 24, 28, .18);
  --band: #ebe6d9;
  --accent: #7a1f1f;
  --ok: #2e6b3a;
  --warn: #a86b1a;
  --err: #a8321a;
  --bar-bg: #15181c;
  --bar-fg: #f4f2ed;
  --bar-fg-soft: rgba(244, 242, 237, .65);
  --bar-fg-faint: rgba(244, 242, 237, .55);
  --bar-accent: #e07a6b;
  --serif: 'Source Serif 4', 'Times New Roman', serif;
  --sans: 'IBM Plex Sans', system-ui, sans-serif;
  --mono: 'IBM Plex Mono', ui-monospace, monospace;
}

:root.dark {
  --paper: #0f1216;
  --surface: #161a20;
  --ink: #f1ece0;
  --ink-soft: #c7c2b6;
  --muted: #8a92a0;
  --rule: #f1ece0;
  --rule-faint: rgba(241, 236, 224, .18);
  --band: #1d222a;
  --accent: #e07a6b;
  --ok: #7bc48a;
  --warn: #e0b46b;
  --err: #e07a6b;
  --bar-bg: #050709;
  --bar-fg: #f1ece0;
  --bar-fg-soft: rgba(241, 236, 224, .72);
  --bar-fg-faint: rgba(241, 236, 224, .55);
  --bar-accent: #e07a6b;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  -webkit-font-smoothing: antialiased;
  transition: background 400ms ease, color 400ms ease;
}

.shell {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: #2a2d32;
}

:root.light .shell { background: #c9c5b8; }

.screen {
  width: min(calc(100vh * 9 / 16 - 48px), 720px);
  aspect-ratio: 9 / 16;
  background: var(--paper);
  color: var(--ink);
  border: 1px solid var(--rule);
  box-shadow: 0 40px 80px -30px rgba(0, 0, 0, .45);
  display: grid;
  grid-template-rows: auto auto 1fr auto auto;
  overflow: hidden;
}

.top {
  background: var(--bar-bg);
  color: var(--bar-fg);
  padding: 18px 24px;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 18px;
}

.logo {
  display: flex;
  align-items: center;
  gap: 12px;
}

.logo .mark {
  width: 48px;
  height: 48px;
  border: 2px solid var(--bar-fg);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--serif);
  font-weight: 900;
  font-size: 20px;
  letter-spacing: -.02em;
  color: var(--bar-fg);
}

.logo .wm {
  font-family: var(--serif);
  font-weight: 900;
  font-size: 28px;
  line-height: 1;
  letter-spacing: -.015em;
}

.logo .wm small {
  display: block;
  font-family: var(--mono);
  font-weight: 400;
  font-size: 11px;
  letter-spacing: .22em;
  text-transform: uppercase;
  color: var(--bar-fg-soft);
  margin-top: 5px;
}

.clock-big {
  text-align: right;
  font-family: var(--mono);
  font-weight: 500;
  font-size: 44px;
  line-height: 1;
  letter-spacing: -.04em;
  font-variant-numeric: tabular-nums;
}

.clock-big small {
  display: block;
  font-size: 11px;
  font-weight: 400;
  letter-spacing: .22em;
  text-transform: uppercase;
  color: var(--bar-fg-soft);
  margin-top: 6px;
}

.subbar {
  background: var(--band);
  padding: 10px 24px;
  border-bottom: 1px solid var(--rule);
  display: flex;
  justify-content: space-between;
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: .18em;
  text-transform: uppercase;
  color: var(--ink-soft);
}

.subbar .live { display: inline-flex; align-items: center; gap: 8px; }

.subbar .dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--ok);
  box-shadow: 0 0 0 0 var(--ok);
  animation: pulse 2s infinite;
  transition: background 300ms ease;
}

.subbar .dot.warn { background: var(--warn); animation: pulse-warn 2s infinite; }
.subbar .dot.err { background: var(--err); animation: pulse-err 2s infinite; }

@keyframes pulse {
  0%   { box-shadow: 0 0 0 0 rgba(46, 107, 58, .5); }
  70%  { box-shadow: 0 0 0 8px rgba(46, 107, 58, 0); }
  100% { box-shadow: 0 0 0 0 rgba(46, 107, 58, 0); }
}
@keyframes pulse-warn {
  0%   { box-shadow: 0 0 0 0 rgba(168, 107, 26, .5); }
  70%  { box-shadow: 0 0 0 8px rgba(168, 107, 26, 0); }
  100% { box-shadow: 0 0 0 0 rgba(168, 107, 26, 0); }
}
@keyframes pulse-err {
  0%   { box-shadow: 0 0 0 0 rgba(168, 50, 26, .5); }
  70%  { box-shadow: 0 0 0 8px rgba(168, 50, 26, 0); }
  100% { box-shadow: 0 0 0 0 rgba(168, 50, 26, 0); }
}

.body { display: grid; grid-template-columns: 1fr 1px 1fr; flex: 1; }
.body .vr { background: var(--rule); }
.col { padding: 20px 22px; display: flex; flex-direction: column; gap: 20px; }

.card { display: flex; flex-direction: column; }

.card > h3 {
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: .22em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0 0 10px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--rule);
  display: flex;
  justify-content: space-between;
  align-items: baseline;
}

.card > h3 .status { font-size: 11px; color: var(--muted); letter-spacing: .14em; }
.card.stale > h3 .status { color: var(--warn); }

.lunsj .dish {
  font-family: var(--serif);
  font-weight: 700;
  font-size: 30px;
  line-height: 1.08;
  letter-spacing: -.015em;
  margin-bottom: 8px;
}

.lunsj .sub {
  font-family: var(--serif);
  font-style: italic;
  font-size: 17px;
  line-height: 1.4;
  color: var(--ink-soft);
}

.lunsj .aller {
  margin-top: 14px;
  padding-top: 10px;
  border-top: 1px dotted var(--rule-faint);
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--ink-soft);
}

.lunsj .nextday {
  margin-top: 12px;
  font-family: var(--serif);
  font-size: 15px;
  line-height: 1.4;
}

.lunsj .nextday .lbl {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: .18em;
  text-transform: uppercase;
  color: var(--muted);
  display: block;
  margin-bottom: 2px;
}

.lunsj.error .dish { color: var(--muted); font-style: italic; }
.lunsj.error .nextday, .lunsj.error .aller { display: none; }

.wx .now-row { display: grid; grid-template-columns: auto auto 1fr; gap: 14px; align-items: center; }
.wx .now-icon { width: 72px; height: 72px; flex-shrink: 0; }
.wx .now-icon svg { width: 100%; height: 100%; display: block; }
.tmrw-icon { display: inline-block; width: 22px; height: 22px; vertical-align: middle; margin-right: 6px; }
.tmrw-icon svg { width: 100%; height: 100%; display: block; }
.wx .temp { font-family: var(--serif); font-weight: 900; font-size: 64px; line-height: .9; letter-spacing: -.03em; }
.wx .desc { font-family: var(--serif); font-style: italic; font-size: 17px; color: var(--ink-soft); line-height: 1.3; }

.wx .desc small {
  display: block;
  font-family: var(--mono);
  font-style: normal;
  font-size: 11px;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--muted);
  margin-top: 4px;
}

.wx .chart { margin-top: 14px; padding-top: 10px; border-top: 1px dotted var(--rule-faint); }

.wx .chart .chart-hd {
  display: flex;
  justify-content: space-between;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: .18em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 8px;
}

.wx .chart svg { width: 100%; height: 180px; display: block; color: var(--ink); }

.wx .chart-legend {
  display: flex;
  gap: 14px;
  margin-top: 8px;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--muted);
}

.wx .chart-legend .sw { display: inline-block; width: 14px; height: 3px; margin-right: 6px; vertical-align: middle; border-radius: 2px; }
.wx .chart-legend .sw-temp { background: var(--accent); }
.wx .chart-legend .sw-rain { background: currentColor; opacity: .45; height: 6px; }
.wx .chart-legend .sw-night { background: var(--rule-faint); height: 6px; }

.wx .tomorrow {
  margin-top: 10px;
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--muted);
  padding-top: 8px;
  border-top: 1px dotted var(--rule-faint);
}

.wx .tomorrow b {
  font-family: var(--serif);
  font-style: normal;
  font-weight: 700;
  font-size: 18px;
  color: var(--ink);
  letter-spacing: -.01em;
  text-transform: none;
}

.tbane table { width: 100%; border-collapse: collapse; font-family: var(--mono); font-size: 14px; }
.tbane thead th { text-align: left; font-size: 10px; letter-spacing: .22em; text-transform: uppercase; color: var(--muted); font-weight: 500; padding: 6px 0; border-bottom: 1px solid var(--rule); }
.tbane tbody td { padding: 9px 0; border-bottom: 1px dotted var(--rule-faint); font-variant-numeric: tabular-nums; }
.tbane tr:last-child td { border: 0; }

.tbane .line-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  background: var(--accent);
  color: #fff;
  border-radius: 4px;
  font-family: var(--sans);
  font-weight: 700;
  font-size: 14px;
}

.tbane .dir { font-family: var(--sans); font-size: 15px; font-weight: 500; }
.tbane .min { text-align: right; font-weight: 500; font-size: 16px; }
.tbane tr.soon .min { color: var(--accent); font-weight: 600; }
.tbane tr.delayed .min { color: var(--warn); }
.tbane-empty { padding: 20px 0; text-align: center; color: var(--muted); font-style: italic; }

.notice { background: var(--surface); border: 1px solid var(--rule); border-left: 4px solid var(--accent); padding: 12px 14px; }
.notice[hidden] { display: none; }
.notice .tag { font-family: var(--mono); font-size: 11px; letter-spacing: .22em; text-transform: uppercase; color: var(--accent); margin-bottom: 4px; }
.notice .msg { font-family: var(--serif); font-size: 16px; line-height: 1.35; }
.notice.secondary { border-left-color: var(--ink-soft); }
.notice.secondary .tag { color: var(--ink-soft); }

.news .news-list { list-style: none; margin: 0; padding: 0; animation: newsfade .5s ease; }
.news .news-list li { display: grid; grid-template-columns: 44px 1fr; gap: 10px; padding: 9px 0; border-bottom: 1px dotted var(--rule-faint); align-items: baseline; }
.news .news-list li:last-child { border-bottom: 0; }
.news .time { font-family: var(--mono); font-size: 11px; letter-spacing: .08em; color: var(--muted); font-variant-numeric: tabular-nums; }
.news .head { font-family: var(--serif); font-size: 15px; line-height: 1.32; color: var(--ink); }

@keyframes newsfade {
  from { opacity: 0; transform: translateY(4px); }
  to   { opacity: 1; transform: none; }
}

.news-dots { display: flex; gap: 6px; justify-content: center; margin-top: 10px; }
.news-dots .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--rule-faint); }
.news-dots .dot.on { background: var(--accent); }

.countdown { background: var(--bar-bg); color: var(--bar-fg); padding: 16px 24px 18px; display: grid; grid-template-columns: 1fr auto; gap: 14px; align-items: center; border-top: 1px solid var(--rule); }
.countdown .title { font-family: var(--mono); font-size: 11px; letter-spacing: .22em; text-transform: uppercase; color: var(--bar-fg-soft); margin-bottom: 4px; }
.countdown .event { font-family: var(--serif); font-weight: 700; font-size: 20px; line-height: 1.05; letter-spacing: -.01em; }
.countdown .event em { font-style: italic; color: var(--bar-fg-soft); font-weight: 400; }
.countdown .digits { display: flex; gap: 10px; }
.countdown .unit { text-align: center; min-width: 58px; }
.countdown .unit .num { font-family: var(--mono); font-weight: 500; font-size: 34px; line-height: 1; letter-spacing: -.03em; font-variant-numeric: tabular-nums; color: var(--bar-accent); }
.countdown .unit .lbl { font-family: var(--mono); font-size: 10px; letter-spacing: .22em; text-transform: uppercase; color: var(--bar-fg-faint); margin-top: 4px; }

.foot { background: var(--band); padding: 8px 24px; border-top: 1px solid var(--rule); display: flex; justify-content: space-between; font-family: var(--mono); font-size: 10px; letter-spacing: .22em; text-transform: uppercase; color: var(--muted); }

.mode-toggle { position: fixed; top: 16px; right: 16px; background: var(--surface); border: 1px solid var(--rule); color: var(--ink); font-family: var(--mono); font-size: 10px; letter-spacing: .22em; text-transform: uppercase; padding: 8px 12px; cursor: pointer; z-index: 20; }
.mode-toggle:hover { background: var(--band); }
body.kiosk .mode-toggle { display: none; }
