/* Layout concept: an airport wayfinding sign you can hold. Quiet surfaces, one signal-yellow panel marks where you are.
   Numbers are set like road and gate signs; reading text is set for tired eyes in bright sun. */
:root {
  --bg: #e9ecf0;
  --surface: #ffffff;
  --surface-2: #f3f5f8;
  --ink: #10141b;
  --muted: #566070;
  --line: #d3d8e0;
  --sign: #ffc800;
  --on-sign: #10141b;
  --on-sign-soft: #4a3f00;
  --board: #14191f;
  --on-board: #f2f4f7;
  --on-board-soft: #9aa5b4;
  --link: #0a4fc4;
  --good: #0b7a48;
  --good-bg: #e2f4ea;
  --warn: #8f5a00;
  --warn-bg: #fdf0d5;
  --bad: #bb1f2a;
  --bad-bg: #fce6e6;
  --info: #24527f;
  --info-bg: #e4edf6;
  --chart-area: rgba(10, 79, 196, 0.12);
  --chart-line: #0a4fc4;
  --display: "Overpass", "Arial Narrow", system-ui, sans-serif;
  --body: "Atkinson Hyperlegible", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "Overpass Mono", ui-monospace, Consolas, monospace;
  --key: clamp(42px, 6.6vh, 60px);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0c1014; --surface: #161b22; --surface-2: #1e242d; --ink: #eef1f5; --muted: #9aa5b4; --line: #2b323d;
    --on-sign-soft: #4a3f00; --board: #1e242d; --link: #84b4ff;
    --good: #4fd08f; --good-bg: #10291d; --warn: #f2b24a; --warn-bg: #2d2210; --bad: #ff7b7b; --bad-bg: #331618; --info: #8fbdeb; --info-bg: #14242f;
    --chart-area: rgba(132, 180, 255, 0.16); --chart-line: #84b4ff;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0c1014; --surface: #161b22; --surface-2: #1e242d; --ink: #eef1f5; --muted: #9aa5b4; --line: #2b323d;
  --on-sign-soft: #4a3f00; --board: #1e242d; --link: #84b4ff;
  --good: #4fd08f; --good-bg: #10291d; --warn: #f2b24a; --warn-bg: #2d2210; --bad: #ff7b7b; --bad-bg: #331618; --info: #8fbdeb; --info-bg: #14242f;
  --chart-area: rgba(132, 180, 255, 0.16); --chart-line: #84b4ff;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { height: 100%; -webkit-text-size-adjust: 100%; padding-block: env(safe-area-inset-top, 0px) env(safe-area-inset-bottom, 0px); }
body {
  height: 100%; margin: 0; overflow: hidden; background: var(--bg); color: var(--ink);
  font: 16px/1.45 var(--body); -webkit-font-smoothing: antialiased; -webkit-tap-highlight-color: transparent;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { background: none; border: 0; padding: 0; cursor: pointer; text-align: left; touch-action: manipulation; }
button:disabled { opacity: 0.35; cursor: default; }
a { color: var(--link); }
h1, h2, h3, h4, h5, p, ul, ol { margin: 0; }
ul, ol { padding: 0; list-style: none; }
:focus-visible { outline: 3px solid var(--link); outline-offset: 2px; border-radius: 4px; }
.ico { flex: none; display: block; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
.muted { color: var(--muted); }
.small { font-size: 13px; line-height: 1.4; }
.center { text-align: center; }
.pad { padding: 16px 0; }
.lead { font-size: 17px; }
[hidden] { display: none !important; }

/* ---------- Shell ---------- */
#app {
  height: 100%; max-width: 520px; margin: 0 auto; display: flex; flex-direction: column; background: var(--bg);
  position: relative; overflow: hidden;
}
@media (min-width: 560px) { #app { box-shadow: 0 0 0 1px var(--line); } }
#app-head {
  flex: none; display: flex; align-items: center; gap: 8px; min-height: 52px; background: var(--bg);
  padding-block: 6px; padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(10px, env(safe-area-inset-right, 0px));
}
.brand { display: flex; align-items: center; gap: 6px; font: 800 19px/1 var(--display); letter-spacing: -0.01em; }
.brand-mark { width: 26px; height: 26px; display: grid; place-items: center; background: var(--sign); color: var(--on-sign); border-radius: 4px; }
.head-place { flex: 1; min-width: 0; display: flex; align-items: center; justify-content: center; gap: 6px; font-size: 13px; line-height: 1.15; font-weight: 700; }
.head-place > span:last-child { min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.head-place small { display: block; font-weight: 400; color: var(--muted); font-size: 11px; }
.head-place .flag { font-size: 18px; }
.head-place .flag.chip { width: 24px; height: 18px; font-size: 10px; }
.head-actions { display: flex; align-items: center; gap: 2px; }
.sos-btn {
  display: flex; align-items: center; gap: 4px; height: 34px; padding: 0 9px; border-radius: 4px; background: var(--bad); color: #fff;
  font: 800 13px/1 var(--display); letter-spacing: 0.04em;
}
:root[data-theme="dark"] .sos-btn { background: #c9252f; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .sos-btn { background: #c9252f; } }
.icon-btn { width: 44px; height: 44px; display: grid; place-items: center; border-radius: 6px; color: var(--muted); flex: none; }
.icon-btn:active { background: var(--surface-2); }

main { flex: 1; min-height: 0; position: relative; }
.view {
  position: absolute; inset: 0; overflow-y: auto; -webkit-overflow-scrolling: touch; overscroll-behavior: contain;
  padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); padding-block: 4px 24px;
  display: flex; flex-direction: column; gap: 12px;
}
.view > * { flex: none; }

#tabbar {
  flex: none; display: grid; grid-template-columns: repeat(4, 1fr); background: var(--surface); border-top: 1px solid var(--line);
  padding-left: env(safe-area-inset-left, 0px); padding-right: env(safe-area-inset-right, 0px);
}
.tab { display: flex; flex-direction: column; align-items: center; gap: 1px; padding: 7px 0 6px; color: var(--muted); font-size: 12px; font-weight: 700; position: relative; }
.tab.on { color: var(--ink); }
.tab.on::before { content: ""; position: absolute; top: -1px; left: 22%; right: 22%; height: 4px; background: var(--sign); }

/* ---------- Flags ---------- */
.flag { font-size: 25px; line-height: 1; width: 34px; text-align: center; flex: none; }
.flag.chip {
  width: 34px; height: 26px; display: inline-grid; place-items: center; background: var(--surface-2); color: var(--ink); border: 1px solid var(--line);
  border-radius: 3px; font: 800 13px/1 var(--display); text-align: center;
}

/* ---------- Converter ---------- */
#view-convert { padding-block: 0; gap: 0; overflow: hidden; }
.conv-bar { flex: none; display: flex; justify-content: space-between; align-items: center; height: 34px; }
.rate-pill { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); height: 34px; }
.rate-pill .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--good); }
.rate-pill.warn .dot { background: var(--warn); }
.text-btn { display: inline-flex; align-items: center; justify-content: center; gap: 5px; color: var(--link); font-size: 14px; font-weight: 700; min-height: 36px; text-decoration: none; }
.text-btn.wide { width: 100%; }
.text-btn.danger { color: var(--bad); }
.cur-list { flex: 1 1 auto; min-height: 0; overflow-y: auto; margin-inline: -4px; padding-inline: 4px; display: flex; flex-direction: column; gap: 4px; overscroll-behavior: contain; }
.cur-row { flex: none; display: flex; align-items: stretch; background: var(--surface); border-radius: 6px; min-height: 56px; position: relative; }
.cur-tap { flex: 1; min-width: 0; display: flex; align-items: center; gap: 10px; padding: 5px 4px 5px 10px; }
.cur-id { flex: none; display: flex; flex-direction: column; min-width: 0; max-width: 42%; }
.cur-id b { font: 800 19px/1.1 var(--display); letter-spacing: 0.01em; }
.cur-id small { font-size: 11.5px; line-height: 1.2; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cur-amt { flex: 1; min-width: 0; text-align: right; display: flex; flex-direction: column; align-items: flex-end; }
.cur-expr { font: 500 12px/1.2 var(--mono); color: var(--muted); max-width: 100%; overflow: hidden; white-space: nowrap; direction: rtl; }
.cur-expr:empty { display: none; }
.cur-val { font: 700 24px/1.15 var(--display); font-variant-numeric: tabular-nums; white-space: nowrap; }
.cur-val.sz-2 { font-size: 21px; } .cur-val.sz-3 { font-size: 18px; } .cur-val.sz-4 { font-size: 15px; }
.cur-chart { width: 40px; height: auto; align-self: stretch; color: var(--muted); }
.cur-row.active { background: var(--sign); color: var(--on-sign); min-height: 66px; }
.cur-row.active .cur-tap { padding-right: 14px; }
.cur-row.active .cur-id small, .cur-row.active .cur-expr { color: var(--on-sign-soft); }
.cur-row.active .cur-val { font-size: 34px; font-weight: 900; letter-spacing: -0.01em; }
.cur-row.active .cur-val.sz-2 { font-size: 28px; } .cur-row.active .cur-val.sz-3 { font-size: 22px; } .cur-row.active .cur-val.sz-4 { font-size: 17px; }
.cur-row.active .flag.chip { background: rgba(0, 0, 0, 0.1); border-color: transparent; color: var(--on-sign); }

.tool-strip { flex: none; display: flex; gap: 6px; padding-block: 6px; }
.tool-chip {
  flex: 1; display: flex; align-items: center; justify-content: center; gap: 6px; min-height: 36px; border-radius: 6px; border: 1px solid var(--line);
  font-size: 13.5px; font-weight: 700; background: transparent;
}
.keypad { flex: none; display: grid; grid-template-columns: repeat(4, 1fr); gap: 5px; padding-bottom: 8px; }
.key {
  height: var(--key); border-radius: 6px; background: var(--surface); text-align: center; font: 700 24px/1 var(--display);
  font-variant-numeric: tabular-nums; box-shadow: 0 1px 0 var(--line); user-select: none;
}
.key:active { background: var(--sign); color: var(--on-sign); }
.k-fn { background: var(--surface-2); font-size: 20px; }
.k-clear { background: var(--surface-2); color: var(--bad); font-size: 20px; }
.k-op { background: var(--board); color: var(--on-board); }
.k-eq { background: var(--sign); color: var(--on-sign); }

/* ---------- Buttons and fields ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 48px; padding: 0 16px; border-radius: 6px;
  background: var(--surface); border: 1px solid var(--line); font-weight: 700; font-size: 15px; text-decoration: none; color: var(--ink); text-align: center;
}
.btn.primary { background: var(--sign); color: var(--on-sign); border-color: transparent; font: 800 17px/1 var(--display); }
.btn.wide { width: 100%; }
.btn.danger { color: #fff; background: var(--bad); border-color: transparent; }
:root[data-theme="dark"] .btn.danger { background: #c9252f; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .btn.danger { background: #c9252f; } }
input[type="text"], input[type="number"], input[type="date"], input[type="search"] {
  width: 100%; min-height: 46px; padding: 8px 12px; border-radius: 6px; border: 1px solid var(--line); background: var(--surface); font-size: 16px;
}
input:focus { outline: 2px solid var(--link); outline-offset: 0; border-color: transparent; }
.field { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.field label, .label-text { font-size: 14px; font-weight: 700; }
.field-pair { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.field-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(90px, 1.1fr) auto; align-items: center; gap: 8px; font-size: 14px; }
.field-row label { font-weight: 700; }
.field-row > span { font-weight: 700; color: var(--muted); }
.field-row.flat { grid-template-columns: auto 1fr; font-size: 18px; }
.search { display: flex; align-items: center; gap: 8px; padding: 0 12px; border-radius: 6px; background: var(--surface); border: 1px solid var(--line); position: sticky; top: 0; z-index: 2; color: var(--muted); }
.search input { border: 0; background: none; min-height: 46px; padding: 0; color: var(--ink); }
.search input:focus { outline: none; }
.label { display: block; font: 700 12px/1.3 var(--mono); letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); }
h3.label { margin-top: 8px; }
.switch { display: flex; align-items: center; gap: 10px; min-height: 44px; font-weight: 700; font-size: 15px; }
.switch input { width: 22px; height: 22px; accent-color: var(--sign); }
.seg { display: flex; background: var(--surface-2); border-radius: 6px; padding: 3px; gap: 3px; flex: none; }
.seg button { flex: 1; min-height: 38px; border-radius: 4px; text-align: center; font-weight: 700; font-size: 14px; color: var(--muted); }
.seg button.on { background: var(--surface); color: var(--ink); box-shadow: 0 1px 2px rgba(0, 0, 0, 0.15); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip-btn { display: inline-flex; align-items: center; gap: 3px; min-height: 38px; padding: 0 12px; border: 1px solid var(--line); border-radius: 6px; background: var(--surface); font-size: 14px; font-weight: 700; }
.chip-btn.on { background: var(--sign); color: var(--on-sign); border-color: transparent; }
.picker-btn { display: flex; align-items: center; gap: 10px; width: 100%; min-height: 54px; padding: 6px 12px; background: var(--surface); border: 1px solid var(--line); border-radius: 6px; }
.picker-btn.small { min-height: 46px; padding: 4px 10px; gap: 6px; font-size: 14px; overflow: hidden; white-space: nowrap; }
.picker-btn.small .flag { font-size: 20px; width: 26px; }
.picker-btn.small .flag.chip { height: 22px; font-size: 11px; }
.pick-row { display: flex; align-items: center; gap: 12px; width: 100%; min-height: 54px; padding: 8px 2px; border-bottom: 1px solid var(--line); }
.pick-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.pick-main b { font-weight: 700; }
.pick-main small { color: var(--muted); font-size: 13px; line-height: 1.3; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pick-main small.wrap { white-space: normal; }

/* ---------- Alerts and cards ---------- */
.alert { padding: 11px 13px; border-radius: 6px; display: flex; flex-direction: column; gap: 3px; align-items: flex-start; font-size: 14.5px; border-left: 5px solid; }
.alert p { line-height: 1.4; }
.alert.info { background: var(--info-bg); border-color: var(--info); }
.alert.warn { background: var(--warn-bg); border-color: var(--warn); }
.alert.bad { background: var(--bad-bg); border-color: var(--bad); }
.card { background: var(--surface); border-radius: 8px; padding: 14px; display: flex; flex-direction: column; gap: 10px; }
.card h2 { font: 800 17px/1.2 var(--display); }
.card-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.card-lite { background: var(--surface); border-radius: 6px; padding: 12px; display: flex; flex-direction: column; gap: 4px; align-items: flex-start; }
.card-lite small { color: var(--muted); font-size: 13px; }
.selectable { user-select: all; }

/* ---------- Trip ---------- */
.example-bar { background: var(--info-bg); border-radius: 6px; padding: 10px 12px; display: flex; align-items: center; gap: 10px; font-size: 13.5px; line-height: 1.35; }
.example-bar p { flex: 1; min-width: 0; }
.example-bar .btn { min-height: 42px; font-size: 15px; white-space: nowrap; padding: 0 12px; flex: none; }
.board { background: var(--board); color: var(--on-board); border-radius: 8px; padding: 12px 14px 10px; display: flex; flex-direction: column; gap: 8px; }
.board-top { display: flex; align-items: center; justify-content: space-between; min-height: 32px; }
.board-place { display: flex; align-items: center; gap: 8px; font: 800 22px/1.1 var(--display); }
.board-place .flag.chip { background: transparent; border-color: var(--on-board-soft); color: var(--on-board); }
.icon-btn.on-dark { color: var(--on-board-soft); margin: -6px -8px -6px 0; }
.board-grid { display: grid; grid-template-columns: 0.8fr 1fr 1.2fr; gap: 8px; }
.board-grid small { display: block; font: 700 11px/1.2 var(--mono); letter-spacing: 0.06em; text-transform: uppercase; color: var(--on-board-soft); }
.board-grid b { font: 800 22px/1.2 var(--display); font-variant-numeric: tabular-nums; white-space: nowrap; }
.board-grid b i { font-style: normal; font-size: 15px; font-weight: 600; color: var(--on-board-soft); }
.status.ok { color: var(--sign); }
.status.late { color: #ff8a8a; }
.mrz { font: 500 12px/1 var(--mono); letter-spacing: 0.02em; color: var(--on-board-soft); white-space: nowrap; overflow: hidden; border-top: 1px dashed rgba(255, 255, 255, 0.2); padding-top: 8px; }
.today { display: flex; align-items: center; justify-content: space-between; gap: 12px; background: var(--sign); color: var(--on-sign); border-radius: 8px; padding: 12px 14px; }
.today .label, .today .muted { color: var(--on-sign-soft); }
.today .muted { font-size: 13px; }
.today-big { font: 900 34px/1.1 var(--display); font-variant-numeric: tabular-nums; }
.add-btn { background: var(--on-sign) !important; color: #fff !important; flex: none; min-height: 52px; padding: 0 12px; white-space: nowrap; font-size: 15px !important; gap: 4px; }
.pace { display: flex; flex-direction: column; gap: 4px; }
.pace-track { position: relative; height: 12px; background: var(--surface-2); border-radius: 3px; }
.pace-fill { position: absolute; inset: 0 auto 0 0; background: var(--chart-line); border-radius: 3px; }
.pace-mark { position: absolute; top: -4px; bottom: -4px; width: 3px; margin-left: -1px; background: var(--ink); }
.pace-legend { display: flex; justify-content: space-between; font-size: 12.5px; color: var(--muted); }
.pace-text { font-size: 14.5px; }
.stat-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.stat-row small { display: block; color: var(--muted); font-size: 12.5px; }
.stat-row b { font: 800 20px/1.2 var(--display); font-variant-numeric: tabular-nums; }
.neg { color: var(--bad); }
.bars { display: flex; flex-direction: column; gap: 8px; }
.bars li { display: grid; grid-template-columns: 108px 1fr auto; align-items: center; gap: 8px; font-size: 13.5px; }
.bar-label { display: flex; align-items: center; gap: 5px; min-width: 0; white-space: nowrap; overflow: hidden; }
.bar-track { height: 9px; background: var(--surface-2); border-radius: 3px; overflow: hidden; }
.bar-fill { display: block; height: 100%; border-radius: 3px; }
.bar-val { font-weight: 700; font-variant-numeric: tabular-nums; }
.chart { width: 100%; height: auto; display: block; }
.chart .tick { font: 11px var(--body); fill: var(--muted); }
.chart .grid { stroke: var(--line); stroke-dasharray: 3 3; }
.chart .line { fill: none; stroke: var(--chart-line); stroke-width: 2.4; stroke-linejoin: round; }
.chart .area { fill: var(--chart-area); }
.chart .end { fill: var(--chart-line); stroke: var(--surface); stroke-width: 2; }
.chart .bar-ok { fill: var(--chart-line); }
.chart .bar-over { fill: var(--bad); }
.chart .target { stroke: var(--ink); stroke-width: 1.2; stroke-dasharray: 4 3; }
.power { font-size: 15px; }
.table-wrap { overflow-x: auto; }
.prices { width: 100%; border-collapse: collapse; font-size: 14px; }
.prices th { font: 700 11px/1.2 var(--mono); text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); text-align: left; padding: 0 4px 6px 0; }
.prices td { padding: 7px 4px 7px 0; border-top: 1px solid var(--line); }
.prices .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.good-t { color: var(--good); font-weight: 700; }
.bad-t { color: var(--bad); font-weight: 700; }
.notes { display: grid; grid-template-columns: repeat(auto-fit, minmax(92px, 1fr)); gap: 6px; }
.note {
  position: relative; overflow: hidden; border-radius: 4px; padding: 8px 9px; color: #fff; background: var(--note);
  display: flex; flex-direction: column; min-height: 72px; justify-content: space-between;
}
.note::after { content: ""; position: absolute; right: -14px; top: -14px; width: 56px; height: 56px; border-radius: 50%; border: 6px double rgba(255, 255, 255, 0.28); }
.note-v { font: 800 19px/1 var(--display); }
.note-c { font-size: 11px; opacity: 0.9; }
.note b { font: 800 15px/1.1 var(--display); }
.spend-list { display: flex; flex-direction: column; }
.spend-row { display: flex; align-items: center; gap: 10px; width: 100%; padding: 9px 0; border-top: 1px solid var(--line); }
.spend-list li:first-child .spend-row { border-top: 0; }
.spend-ico { flex: none; width: 28px; display: grid; place-items: center; }
.spend-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.spend-main b { font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 15px; }
.spend-main small { color: var(--muted); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.spend-amt { flex: none; text-align: right; display: flex; flex-direction: column; font-variant-numeric: tabular-nums; }
.spend-amt b { font: 700 15px/1.2 var(--display); }
.spend-amt small { color: var(--muted); font-size: 12.5px; }
.day-head { display: flex; justify-content: space-between; }
.amount-entry { display: flex; align-items: center; gap: 10px; }
.amount-entry input { font: 800 34px/1 var(--display); text-align: right; min-height: 62px; }
.cur-switch { flex: none; display: flex; align-items: center; gap: 5px; min-height: 62px; padding: 0 10px; background: var(--surface); border: 1px solid var(--line); border-radius: 6px; }
.amount-conv { min-height: 20px; color: var(--muted); font-size: 14px; text-align: right; }
.cat-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.cat-btn { display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 8px 2px; border-radius: 6px; background: var(--surface); border: 1px solid var(--line); font-size: 12.5px; font-weight: 700; text-align: center; line-height: 1.15; min-height: 60px; }
.cat-btn.on { background: var(--sign); color: var(--on-sign); border-color: transparent; }
.budget-opts { display: flex; flex-direction: column; gap: 6px; }
.budget-opt { display: flex; flex-direction: column; padding: 10px 12px; border-radius: 6px; background: var(--surface); border: 1px solid var(--line); }
.budget-opt.on { border: 2px solid var(--ink); padding: 9px 11px; }
.budget-opt small { color: var(--muted); font-size: 13px; }
.budget-opt span { font-size: 13.5px; font-weight: 700; margin-top: 2px; }

/* ---------- Cheat sheet, rate check ---------- */
.thumb { background: var(--sign); color: var(--on-sign); border-radius: 6px; padding: 11px 13px; }
.thumb .label { color: var(--on-sign-soft); margin-bottom: 2px; }
.thumb p { font: 800 18px/1.25 var(--display); }
.cheat-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.cheat { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; font-size: 14.5px; }
.cheat th { font: 700 11px/1 var(--mono); color: var(--muted); padding-bottom: 6px; text-align: right; }
.cheat th:first-child, .cheat td:first-child { text-align: left; }
.cheat td { padding: 6px 0; border-top: 1px solid var(--line); text-align: right; }
.cheat td:last-child { font-weight: 700; }
.verdict { border-radius: 6px; padding: 12px 13px; display: flex; flex-direction: column; gap: 8px; background: var(--surface-2); }
.verdict.good { background: var(--good-bg); } .verdict.warn { background: var(--warn-bg); } .verdict.bad { background: var(--bad-bg); }
.verdict-t { font: 900 24px/1.1 var(--display); }
.verdict.good .verdict-t { color: var(--good); } .verdict.warn .verdict-t { color: var(--warn); } .verdict.bad .verdict-t { color: var(--bad); }
.verdict-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.verdict-grid small { display: block; font-size: 12px; color: var(--muted); }
.verdict-grid b { font: 700 15px/1.2 var(--display); }
.chart-now { font: 800 26px/1.2 var(--display); }
.chart-box { display: flex; flex-direction: column; gap: 6px; }
.edit-list li { display: flex; align-items: center; gap: 6px; padding: 4px 0; border-bottom: 1px solid var(--line); }

/* ---------- Guide ---------- */
.country-btn { display: flex; align-items: center; gap: 10px; width: 100%; padding: 4px 0; flex: none; }
.country-btn b { font: 900 30px/1.05 var(--display); letter-spacing: -0.01em; text-wrap: balance; }
.country-btn .flag { font-size: 34px; width: 44px; }
.country-btn .flag.chip { width: 44px; height: 34px; font-size: 15px; }
.guide-intro { font-size: 15.5px; }
.facts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; }
.fact { background: var(--surface); border-radius: 6px; padding: 8px 10px; display: flex; flex-direction: column; min-width: 0; }
.fact small { font: 700 11px/1.3 var(--mono); letter-spacing: 0.04em; text-transform: uppercase; color: var(--muted); }
.fact b { font: 800 17px/1.2 var(--display); overflow-wrap: anywhere; }
.fact span { font-size: 12px; line-height: 1.25; color: var(--muted); }
.fact.long { grid-column: span 2; }
.fact.long b { font: 700 14.5px/1.3 var(--body); }
.fact-sos { cursor: pointer; }
.fact-sos b { color: var(--bad); }
.tiles { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; }
.tile { display: flex; align-items: center; gap: 9px; padding: 9px 9px; background: var(--surface); border-radius: 6px; min-height: 64px; min-width: 0; }
.tile-ico { flex: none; width: 38px; height: 38px; display: grid; place-items: center; background: var(--board); color: var(--sign); border-radius: 4px; }
.tile-text { min-width: 0; display: flex; flex-direction: column; }
.tile b { font: 800 15px/1.15 var(--display); }
.tile small { font-size: 12px; line-height: 1.2; color: var(--muted); }
.tile-hero { grid-column: span 2; background: var(--sign); color: var(--on-sign); min-height: 70px; }
.tile-hero .tile-ico { width: 46px; height: 46px; background: var(--on-sign); }
.tile-hero b { font-size: 20px; }
.tile-hero small { font-size: 13.5px; color: var(--on-sign-soft); }
.checks { display: flex; flex-direction: column; gap: 6px; }
.check { display: flex; gap: 10px; align-items: flex-start; padding: 10px 11px; background: var(--surface); border-radius: 6px; cursor: pointer; }
.check input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.box { flex: none; width: 26px; height: 26px; border: 2px solid var(--muted); border-radius: 4px; display: grid; place-items: center; color: transparent; }
.check input:checked + .box { background: var(--sign); border-color: var(--sign); color: var(--on-sign); }
.check input:focus-visible + .box { outline: 3px solid var(--link); outline-offset: 2px; }
.check-text { display: flex; flex-direction: column; font-size: 14.5px; }
.check-text b { font-weight: 700; font-size: 15.5px; }
.check input:checked ~ .check-text { color: var(--muted); }
.rule-list, .scam-list, .def-list { display: flex; flex-direction: column; gap: 6px; }
.rule { background: var(--surface); border-radius: 6px; padding: 10px 12px; display: flex; flex-direction: column; gap: 2px; align-items: flex-start; font-size: 14.5px; }
.rule b { font-size: 15.5px; }
.rule-tag { font: 800 11px/1 var(--mono); letter-spacing: 0.05em; text-transform: uppercase; padding: 3px 5px; border-radius: 3px; margin-bottom: 3px; }
.lvl-jail .rule-tag { background: var(--bad-bg); color: var(--bad); }
.lvl-fine .rule-tag { background: var(--warn-bg); color: var(--warn); }
.lvl-respect .rule-tag { background: var(--info-bg); color: var(--info); }
.scam-list li, .def-list li { background: var(--surface); border-radius: 6px; padding: 10px 12px; font-size: 14.5px; display: flex; flex-direction: column; gap: 3px; }
.scam-list b, .def-list b { font-size: 15.5px; }
.avoid { color: var(--ink); }
.avoid span { font: 800 11px/1 var(--mono); letter-spacing: 0.05em; text-transform: uppercase; background: var(--good-bg); color: var(--good); padding: 2px 5px; border-radius: 3px; margin-right: 3px; }
.tip-list { display: flex; flex-direction: column; gap: 8px; font-size: 15px; }
.tip-list li { padding-left: 16px; position: relative; }
.tip-list li::before { content: ""; position: absolute; left: 0; top: 0.5em; width: 8px; height: 8px; background: var(--sign); box-shadow: 0 0 0 1px var(--line); }
.apps { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; }
.app-chip { background: var(--surface); padding: 8px 10px; border-radius: 6px; display: flex; flex-direction: column; }
.app-chip small { font-size: 12.5px; color: var(--muted); line-height: 1.25; }
.phrase-list { display: flex; flex-direction: column; gap: 5px; }
.phrase { display: flex; align-items: center; background: var(--surface); border-radius: 6px; }
.phrase-main { flex: 1; min-width: 0; display: flex; flex-direction: column; padding: 8px 2px 8px 12px; }
.phrase-main small { font-size: 13px; color: var(--muted); }
.phrase-main b { font-size: 21px; line-height: 1.3; font-weight: 600; }
.phrase-main span { font-size: 13.5px; font-family: var(--body); }
.show-big { flex: 1; display: flex; flex-direction: column; gap: 14px; justify-content: center; text-align: center; padding: 24px 0; min-height: 50vh; }
.show-local { font-size: clamp(36px, 12vw, 64px); line-height: 1.25; font-weight: 700; overflow-wrap: anywhere; }
.show-say { font-size: 19px; }
.show-en { color: var(--muted); font-size: 16px; }
.stay-list { display: flex; flex-direction: column; gap: 6px; }
.stay-card { display: flex; flex-direction: column; gap: 2px; padding: 10px 12px; background: var(--surface); border-radius: 6px; width: 100%; }
.stay-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.stay-head b { font-weight: 700; font-size: 15.5px; }
.stay-vibe { font-size: 14px; }
.stay-price { font-size: 13px; font-weight: 700; color: var(--muted); }
.place-list { display: flex; flex-direction: column; }
.link-stack { display: flex; flex-direction: column; gap: 6px; }
.link-stack.two { display: grid; grid-template-columns: 1fr 1fr; }
.link-stack.two .btn { font-size: 13.5px; padding: 0 6px; }
.link-row { display: flex; flex-wrap: wrap; gap: 5px; }

/* ---------- Live content ---------- */
.prose { display: flex; flex-direction: column; gap: 9px; font-size: 15px; line-height: 1.5; overflow-wrap: anywhere; }
.prose h3 { font: 800 18px/1.2 var(--display); margin-top: 8px; }
.prose h4, .prose h5 { font: 800 15.5px/1.25 var(--display); margin-top: 6px; }
.prose ul, .prose ol { display: flex; flex-direction: column; gap: 5px; padding-left: 18px; list-style: disc; }
.prose ol { list-style: decimal; }
.prose table { border-collapse: collapse; font-size: 13.5px; display: block; overflow-x: auto; }
.prose td, .prose th { border: 1px solid var(--line); padding: 4px 6px; vertical-align: top; }
.prose dl { display: flex; flex-direction: column; gap: 4px; }
.prose dt { font-weight: 700; }
.prose dd { margin: 0; }
.acc { background: var(--surface); border-radius: 6px; flex: none; }
.acc > summary { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 12px 13px; font-weight: 700; cursor: pointer; list-style: none; min-height: 48px; }
.acc > summary::-webkit-details-marker { display: none; }
.acc[open] > summary .ico { transform: rotate(180deg); }
.acc > .prose, .acc > .stack { padding: 0 13px 13px; }
.stack { display: flex; flex-direction: column; gap: 10px; }
.source-line { font-size: 13.5px; color: var(--muted); }
.tabs-scroll { display: flex; gap: 5px; overflow-x: auto; flex: none; padding-bottom: 2px; scrollbar-width: none; margin-inline: -2px; padding-inline: 2px; }
.tabs-scroll::-webkit-scrollbar { display: none; }
.tab-chip { flex: none; min-height: 38px; padding: 0 13px; border-radius: 6px; background: var(--surface); font-weight: 700; font-size: 14px; white-space: nowrap; }
.tab-chip.on { background: var(--sign); color: var(--on-sign); }
.listings { display: flex; flex-direction: column; gap: 6px; }
.listing { background: var(--surface); border-radius: 6px; padding: 10px 12px; display: flex; flex-direction: column; gap: 3px; font-size: 14.5px; }
.listing-top { display: flex; justify-content: space-between; gap: 8px; align-items: baseline; }
.listing-top b { font-size: 15.5px; }
.dist { flex: none; font-size: 13px; font-weight: 700; color: var(--muted); }
.listing-price { font-weight: 700; font-size: 14px; }
.listing-links { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 4px; }
.mini { display: inline-flex; align-items: center; gap: 4px; min-height: 34px; padding: 0 10px; border: 1px solid var(--line); border-radius: 5px; font-size: 13px; font-weight: 700; color: var(--ink); text-decoration: none; background: var(--surface); }
.ext { font-weight: 700; }
.intro-clip { font-size: 14px; color: var(--muted); }
.district-list { display: flex; flex-direction: column; }
.source-list { display: flex; flex-direction: column; gap: 8px; font-size: 14px; }

/* ---------- Nearby ---------- */
.where-bar { display: flex; align-items: center; justify-content: space-between; background: var(--surface); border-radius: 6px; padding: 2px 2px 2px 12px; }
.where-text { display: flex; align-items: center; gap: 8px; min-width: 0; }
.where-text span { display: flex; flex-direction: column; min-width: 0; }
.where-text small { font-size: 11.5px; color: var(--muted); line-height: 1.1; }
.where-text b { font: 800 17px/1.2 var(--display); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.where-actions { display: flex; flex: none; }
.kinds { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 5px; }
.kind { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 7px 1px; background: var(--surface); border-radius: 6px; font-size: 11.5px; font-weight: 700; text-align: center; line-height: 1.1; min-height: 54px; }
.kind.on { background: var(--sign); color: var(--on-sign); }
.reco { display: flex; flex-direction: column; gap: 5px; }
.chip-btn.strong { border-color: var(--ink); }
.near-empty { display: flex; flex-direction: column; gap: 10px; padding-top: 4px; }
#near-out { display: flex; flex-direction: column; gap: 10px; }
.near-list { display: flex; flex-direction: column; gap: 5px; }
.near-row { background: var(--surface); border-radius: 6px; padding: 9px 12px; display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 1px 10px; }
.near-main { display: flex; flex-direction: column; min-width: 0; }
.near-main b { font-weight: 700; font-size: 15px; line-height: 1.25; }
.near-main small { font-size: 13px; color: var(--muted); }
.near-meta { font-size: 12.5px; color: var(--muted); text-transform: capitalize; }
.near-meta.hours { text-transform: none; }
.stars { color: var(--warn); letter-spacing: -1px; }
.near-dist { text-align: right; display: flex; flex-direction: column; }
.near-dist b { font: 800 15px/1.2 var(--display); }
.near-dist small { font-size: 11.5px; color: var(--muted); white-space: nowrap; }
.near-row .listing-links { grid-column: 1 / -1; }

/* ---------- Emergency ---------- */
.em-list { display: flex; flex-direction: column; gap: 5px; }
.em-list li { display: flex; align-items: center; gap: 6px; }
.em-call { flex: 1; min-width: 0; display: grid; grid-template-columns: 1fr auto; grid-template-rows: auto auto; align-items: center; padding: 9px 13px; background: var(--bad); color: #fff; border-radius: 6px; text-decoration: none; }
:root[data-theme="dark"] .em-call { background: #c9252f; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .em-call { background: #c9252f; } }
.em-call small { grid-column: 1; font-size: 13px; opacity: 0.95; }
.em-call b { grid-column: 1; font: 900 28px/1.1 var(--display); }
.em-call .ico { grid-column: 2; grid-row: 1 / 3; }

/* ---------- Sheet ---------- */
#scrim { position: absolute; inset: 0; background: rgba(5, 8, 12, 0.5); z-index: 20; }
.sheet {
  position: absolute; left: 0; right: 0; bottom: 0; max-height: 92%; z-index: 21; background: var(--bg); border-radius: 12px 12px 0 0;
  display: flex; flex-direction: column; animation: rise 0.18s ease-out;
}
.sheet.full { top: 0; max-height: none; border-radius: 0; }
@keyframes rise { from { transform: translateY(24px); opacity: 0.6; } to { transform: none; opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .sheet { animation: none; } }
.sheet-head { flex: none; display: flex; align-items: center; gap: 4px; min-height: 52px; padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(6px, env(safe-area-inset-right, 0px)); border-bottom: 1px solid var(--line); }
.sheet-head h2 { flex: 1; min-width: 0; font: 800 19px/1.2 var(--display); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sheet-head .icon-btn:first-child { margin-left: -10px; }
.sheet-body {
  flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; display: flex; flex-direction: column; gap: 12px;
  padding-block: 12px 20px;
  padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px));
}
.sheet-body > * { flex: none; }
#toast {
  position: absolute; left: 16px; right: 16px; bottom: 76px; z-index: 40; background: var(--board); color: var(--on-board);
  padding: 11px 14px; border-radius: 6px; font-size: 14.5px; text-align: center; box-shadow: 0 6px 18px rgba(0, 0, 0, 0.3);
}
.preview-note { flex: none; background: var(--info-bg); font-size: 12.5px; line-height: 1.3; padding-block: 5px; padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); }
