:root {
  --bg: #d7e6f4;
  --bg-elev: #ffffff;
  --bg-soft: #f2f6fb;
  --border: #d4e0ed;
  --text: #122033;
  --muted: #5a6b7c;
  --accent: #1d6fd6;
  --accent-2: #0d9488;
  --warn: #d97706;
  --bad: #dc2626;
  --good: #16a34a;
  --shadow: 0 12px 32px rgba(18, 48, 84, 0.08);
  --shadow-soft: 0 4px 14px rgba(18, 48, 84, 0.05);
  --radius: 22px;
  --radius-sm: 14px;
  --page-max: 1120px;
  --header-pad: 0.85rem;
  font-family: "Segoe UI", system-ui, -apple-system, BlinkMacSystemFont, "Helvetica Neue", sans-serif;
}

* { box-sizing: border-box; }

html {
  background-color: var(--bg);
  min-height: 100%;
  min-height: -webkit-fill-available;
}

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  min-height: -webkit-fill-available;
  color: var(--text);
  background-color: var(--bg);
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  position: relative;
}

body.mode-standard { --page-max: 46rem; }
body.mode-expert { --page-max: 1180px; }

.app-backdrop {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background-color: var(--bg);
  background-image:
    radial-gradient(1000px 480px at 8% -8%, rgba(29, 111, 214, 0.18), transparent 58%),
    radial-gradient(820px 420px at 96% 0%, rgba(13, 148, 136, 0.14), transparent 52%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.35), transparent 28%);
  background-repeat: no-repeat;
  top: -20vh;
  bottom: -20vh;
  left: 0;
  right: 0;
  height: auto;
}

.page {
  width: min(var(--page-max), calc(100% - 2rem));
  margin: 0 auto;
  padding-top: max(0.15rem, env(safe-area-inset-top, 0px));
  padding-right: env(safe-area-inset-right, 0px);
  padding-bottom: max(2.5rem, calc(2rem + env(safe-area-inset-bottom, 0px)));
  padding-left: env(safe-area-inset-left, 0px);
}

body.mode-standard .expert-only { display: none !important; }
body.mode-expert .standard-only { display: none !important; }

/* ---------- Header ---------- */

.app-bar {
  position: sticky;
  top: 0;
  z-index: 30;
  padding: 0.7rem 0 0.85rem;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: blur(18px) saturate(1.25);
  -webkit-backdrop-filter: blur(18px) saturate(1.25);
}

.app-bar-main {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.app-bar-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
}

.brand {
  display: flex;
  gap: 0.75rem;
  align-items: center;
  min-width: 0;
}

.logo-mark {
  width: 2.6rem;
  height: 2.6rem;
  border-radius: 15px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(145deg, #3b82f6, #14b8a6);
  color: #fff;
  flex-shrink: 0;
  box-shadow: 0 8px 18px rgba(29, 111, 214, 0.25);
}

.brand-text { min-width: 0; }

.eyebrow {
  margin: 0 0 0.12rem;
  color: var(--accent-2);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 0.68rem;
  font-weight: 700;
}

h1 {
  margin: 0;
  font-size: clamp(1.28rem, 3.2vw, 1.7rem);
  letter-spacing: -0.035em;
  line-height: 1.18;
  color: var(--text);
}

.subtitle {
  margin: 0;
  color: var(--muted);
  font-size: 0.92rem;
  max-width: 38rem;
  line-height: 1.45;
}

.app-bar-actions {
  display: flex;
  gap: 0.45rem;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  flex-shrink: 0;
}

.story-link {
  color: var(--text);
  text-decoration: none;
  font-size: 0.78rem;
  font-weight: 750;
  letter-spacing: -0.01em;
  padding: 0.42rem 0.8rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: #fff;
}

.story-link:hover { border-color: var(--accent); color: var(--accent); }

.mode-switch,
.lang-switch {
  display: inline-flex;
  padding: 0.18rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.7);
}

.mode-btn,
.lang-btn {
  border: none;
  background: transparent;
  color: var(--muted);
  border-radius: 999px;
  padding: 0.42rem 0.85rem;
  font-weight: 700;
  font-size: 0.78rem;
  cursor: pointer;
}

.lang-btn {
  padding: 0.42rem 0.6rem;
  min-width: 2.3rem;
}

.mode-btn.active,
.lang-btn.active {
  background: #fff;
  color: var(--text);
  box-shadow: var(--shadow-soft);
}

/* ---------- Buttons ---------- */

.btn {
  border: 1px solid var(--border);
  background: #fff;
  color: var(--text);
  border-radius: 999px;
  padding: 0.6rem 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: 0.15s ease;
  font-size: 0.88rem;
}

.btn:hover {
  border-color: #c5d3e2;
  background: var(--bg-soft);
}

.btn.primary {
  background: linear-gradient(135deg, #1d6fd6, #0d9488);
  color: #fff;
  border: none;
}

.btn.primary:hover { filter: brightness(1.05); }

.btn:disabled { opacity: 0.55; cursor: wait; }

.btn-icon {
  width: 2.4rem;
  height: 2.4rem;
  min-width: 2.4rem;
  min-height: 2.4rem;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 0;
}

.btn-icon svg { display: block; }

/* ---------- Simple view ---------- */

.simple-view {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin-top: 0.35rem;
  width: 100%;
}

.place-bar {
  padding: 0.1rem 0.1rem 0;
}

.card {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.15rem 1.15rem 1.2rem;
}

.field-label,
.card-title {
  margin: 0;
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--text);
  letter-spacing: 0.01em;
}

.field-label {
  margin-bottom: 0.5rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.7rem;
}

.card-title {
  font-size: 1.02rem;
  letter-spacing: -0.025em;
}

.card-sub,
.card-caption {
  margin: 0.18rem 0 0;
  color: var(--muted);
  font-size: 0.82rem;
}

.card-caption { margin-top: 0.65rem; }

.card-title-row {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.8rem;
}

.place-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.place-pill {
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.78);
  color: var(--muted);
  border-radius: 999px;
  padding: 0.5rem 0.9rem;
  font-weight: 700;
  font-size: 0.86rem;
  cursor: pointer;
  transition: 0.15s ease;
  text-align: center;
  min-width: 0;
}

.place-pill:hover {
  border-color: #c5d3e2;
  color: var(--text);
}

.place-pill.active {
  background: var(--text);
  border-color: var(--text);
  color: #fff;
}

.briefing-hours {
  margin-top: 1.15rem;
  padding-top: 1.05rem;
  border-top: 1px solid var(--border);
}

.std-segment {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.3rem;
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0.22rem;
}

.seg-btn {
  border: none;
  background: transparent;
  color: var(--muted);
  border-radius: 999px;
  padding: 0.62rem 0.7rem;
  font-weight: 700;
  font-size: 0.88rem;
  cursor: pointer;
}

.seg-btn.active {
  background: #fff;
  color: var(--text);
  box-shadow: var(--shadow-soft);
}

.std-lead-hint {
  margin: 0.65rem 0 0;
  color: var(--muted);
  font-size: 0.86rem;
  text-align: center;
}

.accuracy-card {
  padding: 0;
  overflow: hidden;
}

.accuracy-toolbar {
  padding: 1.1rem 1.15rem 0.95rem;
}

.hero-card {
  padding: 1.15rem 1.2rem 1.2rem;
  margin: 0 0.7rem;
  border-radius: 18px;
  border: 1px solid var(--border);
  background: var(--bg-soft);
}

.hero-card[data-grade="great"] {
  background: linear-gradient(180deg, rgba(22, 163, 74, 0.12), var(--bg-soft) 70%);
  border-color: rgba(22, 163, 74, 0.22);
}

.hero-card[data-grade="good"] {
  background: linear-gradient(180deg, rgba(13, 148, 136, 0.12), var(--bg-soft) 70%);
  border-color: rgba(13, 148, 136, 0.22);
}

.hero-card[data-grade="ok"] {
  background: linear-gradient(180deg, rgba(217, 119, 6, 0.12), var(--bg-soft) 70%);
  border-color: rgba(217, 119, 6, 0.22);
}

.hero-card[data-grade="shaky"] {
  background: linear-gradient(180deg, rgba(220, 38, 38, 0.1), var(--bg-soft) 70%);
  border-color: rgba(220, 38, 38, 0.2);
}

.hero-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  margin-bottom: 0.75rem;
}

.hero-kicker {
  margin: 0 0 0.22rem;
  color: var(--accent);
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
}

.hero-place {
  margin: 0;
  font-size: 1.55rem;
  letter-spacing: -0.04em;
  line-height: 1.12;
}

.hero-city {
  margin: 0.18rem 0 0;
  color: var(--muted);
  font-size: 0.92rem;
}

.grade-block {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.3rem;
  flex-shrink: 0;
}

.grade-ring {
  width: 5.2rem;
  height: 5.2rem;
  border-radius: 50%;
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  border: 3px solid var(--border);
  background: #fff;
  gap: 0.08rem;
  padding: 0.25rem;
  text-align: center;
  box-shadow: var(--shadow-soft);
}

.grade-ring .grade-main {
  font-weight: 800;
  font-size: 0.95rem;
  letter-spacing: -0.02em;
  line-height: 1.05;
  max-width: 100%;
}

.grade-ring .grade-sub {
  font-weight: 700;
  font-size: 0.68rem;
  letter-spacing: -0.01em;
  line-height: 1;
  opacity: 0.85;
}

.grade-ring[data-grade="great"] {
  border-color: var(--good);
  color: var(--good);
}

.grade-ring[data-grade="good"] {
  border-color: var(--accent-2);
  color: var(--accent-2);
}

.grade-ring[data-grade="ok"] {
  border-color: var(--warn);
  color: var(--warn);
}

.grade-ring[data-grade="shaky"] {
  border-color: var(--bad);
  color: var(--bad);
}

.grade-headline {
  margin: 0 0 0.28rem;
  font-size: 1.22rem;
  letter-spacing: -0.03em;
}

.grade-detail {
  margin: 0 0 0.8rem;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.45;
}

.trust-bar-wrap { margin: 0 0 0.95rem; }

.trust-bar {
  height: 0.5rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.7);
  border: 1px solid var(--border);
  overflow: hidden;
}

.trust-bar-fill {
  height: 100%;
  width: 15%;
  border-radius: 999px;
  background: var(--warn);
  transition: width 0.35s ease, background 0.25s ease;
}

.trust-bar-fill[data-grade="great"] { background: var(--good); }
.trust-bar-fill[data-grade="good"] { background: var(--accent-2); }
.trust-bar-fill[data-grade="ok"] { background: var(--warn); }
.trust-bar-fill[data-grade="shaky"] { background: var(--bad); }

.trust-bar-labels {
  display: flex;
  justify-content: space-between;
  margin-top: 0.32rem;
  font-size: 0.68rem;
  font-weight: 600;
  color: var(--muted);
}

.day-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(6.8rem, 1fr));
  gap: 0.55rem;
}

.day-card {
  border: 1px solid var(--border);
  background: var(--bg-soft);
  border-radius: var(--radius-sm);
  padding: 0.8rem 0.7rem;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  min-width: 0;
}

.day-card.wet {
  border-color: rgba(29, 111, 214, 0.28);
  background: linear-gradient(180deg, rgba(29, 111, 214, 0.1), var(--bg-soft) 72%);
}

.day-card-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.35rem;
}

.day-name {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.01em;
}

.day-emoji {
  font-size: 1.3rem;
  line-height: 1;
}

.day-temps {
  display: flex;
  align-items: baseline;
  gap: 0.4rem;
}

.day-temps strong {
  font-size: 1.38rem;
  letter-spacing: -0.04em;
}

.day-temps span {
  color: var(--muted);
  font-weight: 700;
  font-size: 0.92rem;
}

.day-meta {
  display: flex;
  flex-direction: column;
  gap: 0.12rem;
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--muted);
  line-height: 1.3;
}

.stat-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.45rem;
  border-top: 1px solid var(--border);
  padding-top: 0.85rem;
}

.stat { text-align: center; }

.stat strong {
  display: block;
  font-size: 1.18rem;
  letter-spacing: -0.03em;
}

.stat span {
  color: var(--muted);
  font-size: 0.7rem;
  font-weight: 600;
  line-height: 1.25;
}

.accuracy-chart,
.accuracy-rain {
  padding: 1.1rem 1.15rem 1.15rem;
  border-top: 1px solid var(--border);
}

.chart-wrap {
  position: relative;
  min-height: 280px;
}

.chart-wrap-std { min-height: 200px; }

.surprise-counts {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin-bottom: 0.7rem;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.38rem 0.68rem;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 600;
  border: 1px solid var(--border);
  background: var(--bg-soft);
}

.chip strong { font-size: 0.92rem; }

.chip-bad {
  background: rgba(220, 38, 38, 0.07);
  color: #b91c1c;
  border-color: rgba(220, 38, 38, 0.18);
}

.chip-cool {
  background: rgba(29, 111, 214, 0.07);
  color: #1d4ed8;
  border-color: rgba(29, 111, 214, 0.18);
}

.surprise-feed {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.surprise-card {
  display: flex;
  gap: 0.7rem;
  padding: 0.75rem 0.8rem;
  border-radius: 14px;
  background: var(--bg-soft);
  border: 1px solid var(--border);
}

.surprise-card.false_dry {
  border-color: rgba(220, 38, 38, 0.2);
  background: rgba(220, 38, 38, 0.04);
}

.surprise-emoji { font-size: 1.25rem; line-height: 1; }

.surprise-card strong {
  display: block;
  font-size: 0.9rem;
  margin-bottom: 0.12rem;
}

.surprise-card p {
  margin: 0;
  color: var(--muted);
  font-size: 0.78rem;
}

.surprise-nums {
  margin-top: 0.22rem !important;
  color: var(--text) !important;
  font-weight: 600;
}

.hour-strip {
  display: flex;
  gap: 0.45rem;
  overflow-x: auto;
  padding: 0 0.15rem 0.35rem;
  scrollbar-width: thin;
}

.hour-chip {
  min-width: 3.45rem;
  padding: 0.55rem 0.4rem;
  border-radius: 13px;
  background: var(--bg-soft);
  border: 1px solid var(--border);
  text-align: center;
  flex-shrink: 0;
}

.hour-chip.wet {
  border-color: rgba(29, 111, 214, 0.32);
  background: rgba(29, 111, 214, 0.08);
}

.hour-time {
  display: block;
  font-size: 0.68rem;
  color: var(--muted);
  font-weight: 600;
}

.hour-emoji {
  display: block;
  font-size: 1rem;
  line-height: 1;
  margin: 0.18rem 0 0.04rem;
}

.hour-chip strong {
  display: block;
  font-size: 1.02rem;
  margin: 0.08rem 0;
}

.hour-rain {
  font-size: 0.66rem;
  color: var(--muted);
  font-weight: 600;
  letter-spacing: 0.02em;
}

.std-foot-note,
.foot-note {
  text-align: center;
  color: var(--muted);
  font-size: 0.8rem;
  margin: 0.2rem 0 0;
  line-height: 1.55;
}

.linkish {
  display: inline;
  border: none;
  background: none;
  color: var(--accent);
  font-weight: 700;
  cursor: pointer;
  padding: 0;
  margin-left: 0.25rem;
  font-size: inherit;
}

.empty {
  color: var(--muted);
  margin: 0.5rem 0 0;
  font-size: 0.88rem;
}

/* ---------- Expert panels ---------- */

.expert-dashboard {
  margin-top: 0.55rem;
}

.panel {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.05rem 1.15rem 1.15rem;
  margin-bottom: 0.95rem;
}

.panel-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 1rem;
  margin-bottom: 0.85rem;
}

.panel-head h2 {
  margin: 0;
  font-size: 1.02rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.section-sub {
  margin: 0.22rem 0 0;
  color: var(--muted);
  font-size: 0.84rem;
}

.hint { color: var(--muted); font-size: 0.84rem; }

.controls {
  display: grid;
  grid-template-columns: 1.35fr 1fr;
  gap: 1rem 1.25rem;
  align-items: start;
}

.controls-bar {
  position: sticky;
  top: 4.4rem;
  z-index: 20;
  background: color-mix(in srgb, var(--bg-elev) 92%, transparent);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}

#lead-panel {
  scroll-margin-top: 8.5rem;
}

.control-block {
  display: flex;
  flex-direction: column;
  gap: 0.42rem;
  min-width: 0;
}

.control-label {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.12rem;
  font-size: 0.78rem;
  font-weight: 700;
}

.control-label .hint {
  font-weight: 500;
  font-size: 0.74rem;
  line-height: 1.35;
  max-width: 36rem;
}

.tabs {
  display: flex;
  gap: 0.35rem;
  flex-wrap: wrap;
  align-items: center;
}

.tab {
  border: 1px solid var(--border);
  background: var(--bg-soft);
  color: var(--muted);
  border-radius: 999px;
  padding: 0.32rem 0.7rem;
  cursor: pointer;
  font-weight: 600;
  font-size: 0.78rem;
  text-align: center;
  line-height: 1.2;
}

.tab.tab-compact {
  display: inline-flex;
  flex-direction: row;
  align-items: baseline;
  gap: 0.35rem;
  white-space: nowrap;
  padding: 0.32rem 0.68rem;
  min-height: 1.9rem;
}

.tab .tab-label { font-weight: 700; }

.tab.active {
  color: #fff;
  background: var(--text);
  border-color: var(--text);
}

.tab-sub {
  display: inline;
  font-size: 0.7rem;
  font-weight: 600;
  opacity: 0.72;
  margin-top: 0;
}

.tab.active .tab-sub { opacity: 0.85; }

.metrics-panel { margin-bottom: 0.95rem; }

.metrics {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.75rem;
}

.metric-card {
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 0.9rem 0.95rem;
  box-shadow: none;
  position: relative;
  overflow: hidden;
}

.metric-card::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 3px;
  background: var(--accent);
}

.metric-card:nth-child(2)::before { background: var(--accent-2); }
.metric-card:nth-child(3)::before { background: #3b82f6; }
.metric-card:nth-child(4)::before { background: #64748b; }

.metric-card .label {
  display: block;
  color: var(--muted);
  font-size: 0.76rem;
  margin-bottom: 0.28rem;
  font-weight: 600;
}

.metric-card strong {
  font-size: 1.55rem;
  letter-spacing: -0.04em;
}

.metric-card .unit {
  display: block;
  margin-top: 0.2rem;
  color: var(--muted);
  font-size: 0.74rem;
}

.layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 0.95rem;
  margin-bottom: 0.95rem;
}

.layout > .panel {
  min-width: 0;
  display: flex;
  flex-direction: column;
  margin-bottom: 0;
}

.table-wrap {
  overflow-x: auto;
  max-width: 100%;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
}

th, td {
  text-align: left;
  padding: 0.5rem 0.42rem;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

th {
  color: var(--muted);
  font-weight: 600;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.045em;
}

tr:hover td { background: rgba(18, 32, 51, 0.025); }

.row-highlight td {
  background: rgba(29, 111, 214, 0.1);
}

.row-highlight td:first-child {
  box-shadow: inset 3px 0 0 #1d6fd6;
  font-weight: 700;
}

tr.row-highlight:hover td {
  background: rgba(29, 111, 214, 0.16);
}

.lead-key {
  display: inline-block;
  width: 0.7rem;
  height: 0.7rem;
  margin-right: 0.35rem;
  border-radius: 3px;
  background: rgba(29, 111, 214, 0.22);
  box-shadow: inset 3px 0 0 #1d6fd6;
  vertical-align: -1px;
}

.lead-legend {
  margin: 0.7rem 0 0;
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 600;
  line-height: 1.4;
}

.skill-table .place-cell {
  white-space: normal;
}

.station-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(11.5rem, 1fr));
  gap: 0.75rem;
  align-items: stretch;
}

.station-card {
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  box-shadow: none;
  padding: 0.85rem 0.95rem;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  min-width: 0;
}

.station-card h3 {
  margin: 0;
  font-size: 0.98rem;
  font-weight: 700;
  line-height: 1.3;
}

.station-card .pill { align-self: flex-start; }

.station-card dl {
  margin: 0.15rem 0 0;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 0.28rem 0.6rem;
  font-size: 0.84rem;
  line-height: 1.4;
}

.station-card dt { color: var(--muted); }
.station-card dd {
  margin: 0;
  font-weight: 600;
  overflow-wrap: anywhere;
}

.station-note,
.shared-note {
  margin: 0.15rem 0 0;
  color: #1d4e89;
  font-size: 0.78rem;
  font-weight: 600;
  line-height: 1.35;
}

.shared-note {
  margin: 0.85rem 0 0;
  padding: 0.55rem 0.75rem;
  border-radius: 12px;
  background: rgba(29, 111, 214, 0.08);
  text-align: center;
}

.token-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  align-items: center;
  margin-top: 0.85rem;
}

.token-label {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--muted);
}

.token-row input {
  flex: 1 1 12rem;
  min-width: 0;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.45rem 0.65rem;
  font: inherit;
  background: #fff;
  color: var(--text);
}

#loc-tabs.tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

#loc-tabs .tab {
  justify-content: center;
  width: auto;
  text-align: center;
}

.pill {
  display: inline-block;
  padding: 0.14rem 0.48rem;
  border-radius: 999px;
  background: rgba(29, 111, 214, 0.1);
  color: #1d4ed8;
  font-size: 0.72rem;
  font-weight: 700;
}

.miss-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin: 0 0 0.7rem;
}

.miss-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.32rem 0.7rem;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 600;
  border: 1px solid var(--border);
}

.miss-pill.false-dry {
  background: rgba(220, 38, 38, 0.07);
  color: #b91c1c;
  border-color: rgba(220, 38, 38, 0.18);
}

.miss-pill.false-wet {
  background: rgba(29, 111, 214, 0.07);
  color: #1d4ed8;
  border-color: rgba(29, 111, 214, 0.18);
}

.kind-tag {
  display: inline-block;
  padding: 0.12rem 0.5rem;
  border-radius: 999px;
  font-size: 0.74rem;
  font-weight: 700;
}

.kind-tag.false_dry {
  background: rgba(220, 38, 38, 0.1);
  color: #b91c1c;
}

.kind-tag.false_wet {
  background: rgba(29, 111, 214, 0.1);
  color: #1d4ed8;
}

.coverage-note {
  margin: 0.75rem 0 0;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 600;
  text-align: center;
  line-height: 1.4;
}

.dataset-stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.65rem;
  margin-bottom: 0.85rem;
}

.dataset-stat {
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 0.7rem 0.75rem;
  text-align: center;
}

.dataset-stat strong {
  display: block;
  font-size: 1.2rem;
  letter-spacing: -0.03em;
}

.dataset-stat span {
  display: block;
  margin-top: 0.15rem;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 600;
}

.dataset-badge {
  display: inline-flex;
  align-items: center;
  padding: 0.28rem 0.7rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 700;
  background: rgba(217, 119, 6, 0.12);
  color: #b45309;
  white-space: nowrap;
}

.dataset-badge[data-ready="true"] {
  background: rgba(22, 163, 74, 0.12);
  color: #15803d;
}

.bias-hours {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: 0.3rem;
}

.bias-cell {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.1rem;
  padding: 0.35rem 0.1rem;
  border-radius: 10px;
  background: var(--bg-soft);
  border: 1px solid var(--border);
  min-width: 0;
}

.bias-h {
  font-size: 0.64rem;
  font-weight: 700;
  color: var(--muted);
}

.bias-v {
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.bias-cell[data-tone="warm"] {
  background: rgba(220, 38, 38, 0.08);
  border-color: rgba(220, 38, 38, 0.18);
  color: #b91c1c;
}

.bias-cell[data-tone="cold"] {
  background: rgba(29, 111, 214, 0.08);
  border-color: rgba(29, 111, 214, 0.18);
  color: #1d4ed8;
}

.weak-list {
  margin: 0.75rem 0 0;
  padding-left: 1.1rem;
  color: var(--muted);
  font-size: 0.84rem;
  line-height: 1.45;
}

.training-meta {
  margin: 0 0 0.85rem;
  color: var(--muted);
  font-size: 0.86rem;
}

.dl-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
}

a.btn {
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

a.btn[aria-disabled="true"] {
  opacity: 0.45;
  pointer-events: none;
}

.tools-divider {
  height: 1px;
  background: var(--border);
  margin: 1rem 0 0.85rem;
}

.footer-actions {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  flex-wrap: wrap;
  margin-bottom: 0;
}

footer {
  padding: 1rem 0 0.5rem;
  color: var(--muted);
  font-size: 0.86rem;
  text-align: center;
}

footer a { color: var(--accent); }

.status {
  min-height: 1.2em;
  color: var(--accent-2);
  font-weight: 600;
  text-align: center;
}

.err { color: var(--bad); }
.good { color: var(--good); }

body.mode-standard footer {
  max-width: 40rem;
  margin-left: auto;
  margin-right: auto;
}

@media (min-width: 900px) {
  .station-grid {
    grid-template-columns: repeat(auto-fit, minmax(10.5rem, 1fr));
  }
  .bias-hours { grid-template-columns: repeat(24, minmax(0, 1fr)); }
}

@media (max-width: 900px) {
  .metrics { grid-template-columns: 1fr 1fr; }
  .layout { grid-template-columns: 1fr; }
  .controls { grid-template-columns: 1fr; }
  .dataset-stats { grid-template-columns: 1fr 1fr; }
  .day-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 720px) {
  .page {
    width: 100%;
    padding-top: 0;
    padding-left: max(1rem, env(safe-area-inset-left, 0px));
    padding-right: max(1rem, env(safe-area-inset-right, 0px));
  }
  .app-bar {
    margin-left: calc(-1 * max(1rem, env(safe-area-inset-left, 0px)));
    margin-right: calc(-1 * max(1rem, env(safe-area-inset-right, 0px)));
    padding: calc(0.7rem + max(0.15rem, env(safe-area-inset-top, 0px)))
      max(1rem, env(safe-area-inset-right, 0px))
      0.85rem
      max(1rem, env(safe-area-inset-left, 0px));
    background: var(--bg);
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
  }
  .layout .panel-head {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.3rem;
  }
  .skill-table {
    font-size: 0.8rem;
  }
  .controls-bar {
    position: static;
    background: var(--bg-elev);
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
  }
  .skill-table th,
  .skill-table td {
    padding: 0.4rem 0.16rem;
  }
  .skill-table th {
    letter-spacing: 0.02em;
    font-size: 0.66rem;
  }
  .app-bar-top {
    flex-direction: column;
    align-items: stretch;
  }
  .app-bar-actions {
    width: 100%;
    justify-content: flex-start;
  }
  .controls-bar { top: 0.45rem; }
}

@media (max-width: 560px) {
  .page {
    width: 100%;
    padding-left: max(0.625rem, env(safe-area-inset-left, 0px));
    padding-right: max(0.625rem, env(safe-area-inset-right, 0px));
  }
  .app-bar {
    margin-left: calc(-1 * max(0.625rem, env(safe-area-inset-left, 0px)));
    margin-right: calc(-1 * max(0.625rem, env(safe-area-inset-right, 0px)));
    padding-left: max(0.625rem, env(safe-area-inset-left, 0px));
    padding-right: max(0.625rem, env(safe-area-inset-right, 0px));
  }
  .layout .panel { padding: 0.85rem 0.7rem 0.95rem; }
  .metrics { grid-template-columns: 1fr 1fr; }
  .stat-row { gap: 0.2rem; }
  .hero-place { font-size: 1.32rem; }
  .day-grid {
    display: flex;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    gap: 0.5rem;
    padding-bottom: 0.15rem;
  }
  .day-card {
    min-width: 7.6rem;
    flex: 0 0 auto;
    scroll-snap-align: start;
  }
  .grade-ring {
    width: 4.7rem;
    height: 4.7rem;
  }
}
