*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; height: 100dvh; display: flex; flex-direction: column; background: var(--bg); color: var(--ink); font: 400 1rem/1.4 var(--font); }
button { font: inherit; color: inherit; }

.top { position: relative; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: max(10px, env(safe-area-inset-top)) 16px 8px; }
.top h1 { margin: 0; font: 700 1.45rem/1.1 var(--font-cond); letter-spacing: 0.005em; }
.lang { min-height: 44px; padding: 0 14px; border: 1px solid var(--line); border-radius: 22px; background: var(--surface); cursor: pointer; }

.banner { margin: 0 16px 10px; padding: 10px 12px; display: flex; gap: 10px; align-items: flex-start; border-radius: 10px; background: var(--sev-3); color: var(--sev-3-on); font-weight: 600; }
.banner.warn { background: var(--sev-1); color: var(--sev-1-on); }
.banner[hidden], .warnings[hidden] { display: none; }
.banner .sevi { flex: none; width: 24px; height: 24px; }
.banner .sevi .shape { fill: currentColor; }
.banner .sevi .mark { stroke: var(--sev-3); } .banner .sevi .mark-fill { fill: var(--sev-3); }
.banner.warn .sevi .mark { stroke: var(--sev-1); } .banner.warn .sevi .mark-fill { fill: var(--sev-1); }

.warnings { display: flex; flex-direction: column; gap: 8px; margin: 0 16px 10px; }
.wchip { display: flex; gap: 10px; align-items: flex-start; padding: 9px 12px; border-radius: 10px; font-weight: 600; }
.wchip .sevi { flex: none; width: 24px; height: 24px; margin-top: 1px; }
.wchip .sevi .shape { fill: currentColor; }
.wchip.yellow { background: var(--sev-1); color: var(--sev-1-on); }
.wchip.orange { background: var(--sev-2); color: var(--sev-2-on); }
.wchip.red { background: var(--sev-3); color: var(--sev-3-on); }
.wchip.yellow .sevi .mark { stroke: var(--sev-1); } .wchip.yellow .sevi .mark-fill { fill: var(--sev-1); }
.wchip.orange .sevi .mark { stroke: var(--sev-2); } .wchip.orange .sevi .mark-fill { fill: var(--sev-2); }
.wchip.red .sevi .mark { stroke: var(--sev-3); } .wchip.red .sevi .mark-fill { fill: var(--sev-3); }
.wchip small { display: block; font-weight: 500; opacity: 0.9; }
body[data-tab='map'] .warnings { flex-direction: row; overflow-x: auto; margin-bottom: 6px; }
body[data-tab='map'] .wchip { flex: none; padding: 6px 10px; }
body[data-tab='map'] .wchip small { display: none; }

.views { flex: 1; min-height: 0; position: relative; }
.view { display: none; position: absolute; inset: 0; overflow-y: auto; padding: 0 16px 24px; -webkit-overflow-scrolling: touch; }
body[data-tab='routes'] #view-routes, body[data-tab='about'] #view-about { display: block; }
body[data-tab='map'] #view-map { display: block; padding: 0; overflow: hidden; }

.fresh { margin: 0 0 10px; color: var(--ink-2); font-size: 0.9rem; }
.grp { margin: 18px 0 8px; font-size: 0.95rem; font-weight: 600; color: var(--ink-2); }

.card { background: var(--surface); border-radius: 12px; border-left: 6px solid var(--sev-n); margin-bottom: 10px; overflow: hidden; }
.card.sev-0 { border-left-color: var(--sev-0); } .card.sev-1 { border-left-color: var(--sev-1); }
.card.sev-2 { border-left-color: var(--sev-2); } .card.sev-3 { border-left-color: var(--sev-3); }
.card .head { display: grid; grid-template-columns: 32px 1fr auto 44px; align-items: center; column-gap: 10px; row-gap: 2px; width: 100%; min-height: 64px; padding: 8px 4px 8px 10px; border: 0; background: none; text-align: left; cursor: pointer; }
.card .head .sevi { width: 30px; height: 30px; }
.card .nm b { display: block; font: 600 1.25rem/1.15 var(--font-cond); }
.card .nm span { display: block; color: var(--ink-2); font-size: 0.9rem; }
.card .gust { display: flex; align-items: center; gap: 6px; font: 700 1.6rem/1 var(--font-cond); }
.card .gust svg { width: 28px; height: 28px; }
.card .gust small { font: 500 0.7rem var(--font); color: var(--ink-3); }
.card .chev { width: 44px; height: 44px; display: grid; place-items: center; color: var(--ink-3); transition: transform 0.2s; }
.card[data-open='true'] .chev { transform: rotate(180deg); }
.m-wind .w-bg { fill: var(--surface); stroke: #7b868d; stroke-width: 2; } .m-wind .w-arrow { fill: #8a959c; }
.m-wind.lv-1 .w-bg { stroke: var(--sev-1); } .m-wind.lv-1 .w-arrow { fill: var(--sev-1); }
.m-wind.lv-2 .w-bg { stroke: var(--sev-2); } .m-wind.lv-2 .w-arrow { fill: var(--sev-2); }
.m-wind.lv-3 .w-bg { fill: var(--sev-3); stroke: #ffd9d9; } .m-wind.lv-3 .w-arrow { fill: #fff; }
.m-wind.lv-n .w-bg { stroke-dasharray: 3 3; }

.detail { padding: 4px 14px 14px; border-top: 1px solid var(--line); }
.detail[hidden] { display: none; }
.detail h3 { margin: 14px 0 6px; font-size: 0.95rem; font-weight: 600; color: var(--ink-2); }
.issues { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.issues li { display: grid; grid-template-columns: 24px 1fr; gap: 10px; align-items: start; }
.issues .sevi { width: 22px; height: 22px; margin-top: 1px; }
.issues small { display: block; color: var(--ink-2); }
.strip { display: grid; grid-template-columns: repeat(25, 1fr); gap: 2px; align-items: end; height: 56px; }
.strip i { display: block; border-radius: 2px 2px 0 0; background: #3a464e; }
.strip i.lv-0 { height: 28%; } .strip i.lv-1 { height: 52%; background: var(--sev-1); }
.strip i.lv-2 { height: 76%; background: var(--sev-2); } .strip i.lv-3 { height: 100%; background: var(--sev-3); }
.strip i.lv-n { height: 14%; background: transparent; border: 1px dashed var(--ink-3); }
.stripaxis { position: relative; height: 1.2rem; font-size: 0.78rem; color: var(--ink-3); }
.stripaxis span { position: absolute; transform: translateX(-50%); }
.stripaxis span:first-child { transform: none; } .stripaxis span:last-child { transform: translateX(-100%); }
.peak { margin: 6px 0 0; font-weight: 500; }
.obs { margin: 0; padding: 0; list-style: none; display: grid; gap: 4px; color: var(--ink-2); font-size: 0.92rem; }
.obs b { color: var(--ink); font-weight: 600; }
.tblwrap { overflow-x: auto; }
.tbl { width: 100%; table-layout: fixed; border-collapse: collapse; font-size: 0.88rem; font-variant-numeric: tabular-nums; }
.tbl th, .tbl td { padding: 6px 4px; text-align: left; border-bottom: 1px solid var(--line); }
.tbl th { color: var(--ink-3); font-weight: 500; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.btn { min-height: 44px; padding: 0 14px; border-radius: 22px; border: 1px solid var(--line); background: var(--surface-2); cursor: pointer; }
.btn[aria-pressed='true'] { border-color: var(--accent); }

/* Map tab */
.mapview svg.rw-map { position: absolute; inset: 0; }
.hours { position: absolute; left: 12px; right: 64px; top: 8px; display: flex; gap: 6px; overflow-x: auto; }
.hours button { flex: none; min-height: 44px; min-width: 52px; padding: 0 12px; border-radius: 22px; border: 1px solid #2d373e; background: rgb(12 16 19 / 0.88); color: #f3f5f6; cursor: pointer; font-weight: 600; }
.hours button[aria-pressed='true'] { background: #f3f5f6; color: #0c1013; }
.zoom { position: absolute; right: 12px; top: 8px; display: grid; gap: 6px; }
.zoom button { width: 44px; height: 44px; border-radius: 22px; border: 1px solid #2d373e; background: rgb(12 16 19 / 0.88); color: #f3f5f6; font-size: 1.4rem; line-height: 1; cursor: pointer; }
.sheet { position: absolute; left: 0; right: 0; bottom: 0; padding: 14px 16px 18px; background: var(--surface); border-radius: 16px 16px 0 0; border-top: 1px solid var(--line); box-shadow: 0 -6px 20px rgb(0 0 0 / 0.35); }
.sheet .row1 { display: flex; align-items: center; gap: 12px; }
.sheet .row1 .sevi { width: 30px; height: 30px; flex: none; }
.sheet b { font: 600 1.25rem/1.15 var(--font-cond); display: block; }
.sheet span.sub { color: var(--ink-2); font-size: 0.92rem; }
.sheet .more { margin-top: 10px; }
.sheet p { margin: 0; color: var(--ink-2); }

/* About */
.about h2 { margin: 18px 0 8px; font: 700 1.3rem var(--font-cond); }
.about p { margin: 0 0 10px; color: var(--ink-2); max-width: 60ch; }
.fresh-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.fresh-list li { display: flex; align-items: center; gap: 10px; }
.fresh-list .sevi { width: 22px; height: 22px; }
.credit { font-size: 0.85rem; color: var(--ink-3); }

.tabs { display: grid; grid-template-columns: repeat(3, 1fr); border-top: 1px solid var(--line); background: var(--surface); padding-bottom: env(safe-area-inset-bottom); }
.tabs button { min-height: 56px; border: 0; background: none; color: var(--ink-3); font-weight: 600; cursor: pointer; }
.tabs button[aria-selected='true'] { color: var(--ink); box-shadow: inset 0 3px 0 var(--accent); }

button:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
@media (prefers-reduced-motion: reduce) { .card .chev { transition: none; } }
@media (min-width: 720px) { .view { padding-left: max(16px, calc(50% - 360px)); padding-right: max(16px, calc(50% - 360px)); } }

#view-routes .warnings { margin-left: 0; margin-right: 0; }

.tbl th { font-size: 0.74rem; line-height: 1.15; vertical-align: bottom; overflow-wrap: anywhere; }
.tbl th:nth-child(1) { width: 17%; } .tbl th:nth-child(2), .tbl th:nth-child(3), .tbl th:nth-child(4) { width: 13%; } .tbl th:nth-child(5) { width: 18%; } .tbl th:nth-child(6) { width: 26%; }
.tbl td:last-child { overflow-wrap: anywhere; }
.tbl th, .tbl td { vertical-align: middle; }

/* Road number badges and the closed-roads block (Road 1 and two-digit roads only) */
.shield { display: inline-block; min-width: 24px; margin-right: 6px; padding: 0 6px; border: 1.5px solid var(--ink-3); border-radius: 5px; color: var(--ink); font: 700 0.9rem/1.3 var(--font-cond); font-style: normal; text-align: center; vertical-align: 1px; }
.shield.ring { background: var(--ink); border-color: var(--ink); color: var(--bg); }
.card .nm .st { font-style: normal; font-weight: 600; color: var(--ink); }

.closures[hidden] { display: none; }
.closures h2 { margin: 6px 0 8px; font-size: 0.95rem; font-weight: 600; color: var(--ink-2); display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 10px; }
.closures h2 small { font-weight: 400; color: var(--ink-3); }
.closures .cl { display: grid; grid-template-columns: 28px 1fr; align-items: center; gap: 12px; width: 100%; min-height: 56px; margin-bottom: 8px; padding: 8px 14px; text-align: left; border: 0; border-radius: 12px; background: var(--sev-3); color: var(--sev-3-on); cursor: pointer; }
.closures .cl .sevi .shape { fill: #fff; } .closures .cl .sevi .mark-fill { fill: var(--sev-3); }
.closures .cl b { font: 700 1.25rem/1.15 var(--font-cond); }
.closures .cl b span { font-weight: 500; }
.closures .cl small { display: block; opacity: 0.92; font-size: 0.9rem; }
.closures.none p { display: flex; align-items: center; gap: 10px; margin: 0 0 4px; color: var(--ink-2); font-size: 0.92rem; }

/* Card header: name and wind on the first line, road badges, condition and place on the second. */
.card .head .nm { display: contents; }
.card .head .sevi { grid-column: 1; grid-row: 1 / 3; }
.card .head .nm b { grid-column: 2; grid-row: 1; }
.card .head .nm .sub { grid-column: 2 / 4; grid-row: 2; }
.card .head .gust { grid-column: 3; grid-row: 1; }
.card .head .chev { grid-column: 4; grid-row: 1 / 3; }

/* Region menu */
.topr { display: flex; align-items: center; gap: 8px; min-width: 0; }
.mbtn { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; max-width: 46vw; padding: 0 14px; border: 1px solid var(--line); border-radius: 22px; background: var(--surface); font-weight: 600; cursor: pointer; }
.mbtn[hidden] { display: none; }
.mbtn span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mbtn i { position: relative; flex: none; width: 14px; height: 2px; background: currentColor; border-radius: 1px; }
.mbtn i::before, .mbtn i::after { content: ''; position: absolute; left: 0; width: 14px; height: 2px; background: currentColor; border-radius: 1px; }
.mbtn i::before { top: -5px; } .mbtn i::after { top: 5px; }
.mbtn[aria-expanded='true'] { border-color: var(--accent); color: var(--accent); }
.menu { position: absolute; z-index: 30; top: calc(100% - 2px); left: 16px; right: 16px; max-height: min(72dvh, 640px); overflow-y: auto; padding: 6px; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; box-shadow: 0 12px 32px rgb(0 0 0 / 0.5); }
.menu[hidden] { display: none; }
.menu .mi { display: grid; grid-template-columns: 24px 1fr; align-items: center; gap: 12px; width: 100%; min-height: 52px; padding: 8px 10px; border: 0; border-radius: 10px; background: none; text-align: left; cursor: pointer; }
.menu .mi:hover, .menu .mi:focus-visible { background: var(--surface-2); }
.menu .mi.on { background: var(--surface-2); box-shadow: inset 3px 0 0 var(--accent); }
.menu .mi.on b { color: var(--accent); }
.menu .mi b { display: block; font: 600 1.1rem/1.15 var(--font-cond); }
.menu .mi small { display: block; color: var(--ink-2); font-size: 0.82rem; }
.menu .mi .sevi { width: 22px; height: 22px; }
.menu hr { margin: 4px 8px; border: 0; border-top: 1px solid var(--line); }
@media (min-width: 720px) { .menu { left: auto; width: 400px; right: max(16px, calc(50% - 360px)); } }

/* Region header on the Routes tab */
.rhead { display: grid; grid-template-columns: 30px 1fr auto; align-items: center; gap: 12px; margin: 4px 0 12px; padding: 10px 12px; background: var(--surface); border-radius: 12px; }
.rhead .sevi { width: 30px; height: 30px; }
.rhead b { display: block; font: 700 1.35rem/1.1 var(--font-cond); }
.rhead small { display: block; color: var(--ink-2); }
.rhead .btn { min-height: 40px; }

/* Station and road-report sheet */
.sheet.tall { max-height: 62%; overflow-y: auto; }
.sheet .shead { display: grid; grid-template-columns: 1fr 44px; align-items: start; gap: 8px; }
.sheet .shead .x { width: 44px; height: 44px; margin: -6px -8px 0 0; border: 0; border-radius: 22px; background: none; color: var(--ink-2); font-size: 1.5rem; line-height: 1; cursor: pointer; }
.kv { display: grid; grid-template-columns: repeat(auto-fit, minmax(104px, 1fr)); gap: 8px; margin: 10px 0 0; }
.kv div { padding: 8px 10px; background: var(--surface-2); border-radius: 10px; }
.kv dt { color: var(--ink-3); font-size: 0.78rem; }
.kv dd { margin: 0; font: 700 1.35rem/1.15 var(--font-cond); font-variant-numeric: tabular-nums; }
.kv dd small { font: 500 0.75rem var(--font); color: var(--ink-3); }
.sheet .note { margin: 10px 0 0; font-size: 0.9rem; color: var(--ink-2); }
.sheet .note.warn { color: var(--sev-1); }
.sheet .nroad { display: grid; grid-template-columns: 22px 1fr; gap: 10px; align-items: start; margin-top: 10px; }
.sheet .nroad .sevi { width: 22px; height: 22px; margin-top: 2px; }
.sheet .nroad small { display: block; color: var(--ink-2); font-weight: 400; }
.sheet .nroad b { font: 600 1.05rem/1.2 var(--font-cond); }
.sheet h4 { margin: 12px 0 0; font-size: 0.8rem; font-weight: 600; color: var(--ink-3); text-transform: uppercase; letter-spacing: 0.04em; }

/* Wide screens: the route list on the left, the map on the right; the Map tab is not needed. */
@media (min-width: 1000px) {
  body:not([data-tab='about']) #view-routes { display: block; right: auto; width: 460px; padding-left: 16px; padding-right: 16px; border-right: 1px solid var(--line); }
  body:not([data-tab='about']) #view-map { display: block; left: 460px; padding: 0; overflow: hidden; }
  #tab-map { display: none; }
  .tabs { grid-template-columns: repeat(2, 1fr); }
  .menu { right: 16px; }
}
