/* Light = "Sandstone", dark = "Neon night" (the two looks from the mockup). */
:root {
  --page: #efe7da; --bg: #fbf7f0; --ink: #2a2118; --muted: #7a6a58; --line: #e4d8c6;
  --accent: #b5532a; --accent2: #2f6b5a; --chip: #f3eadc; --card: #ffffff; --glow: none;
  --sos: #c62e2e; --driver: linear-gradient(160deg, #b5532a, #7a2c12);
  --head: 'Fraunces', Georgia, serif; --body: 'Inter', system-ui, -apple-system, sans-serif;
  --mono: 'Inter', system-ui, sans-serif; --radius: 16px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --page: #05060c; --bg: #0b0e1a; --ink: #e9f1ff; --muted: #8b93b8; --line: #1d2340;
    --accent: #ff2e88; --accent2: #18e0ff; --chip: #141a30; --card: #10152a; --glow: 0 0 16px rgba(24,224,255,.35);
    --sos: #ff2e88; --driver: linear-gradient(160deg, #ff2e88, #6b19ff);
    --head: 'Space Grotesk', system-ui, sans-serif; --mono: 'JetBrains Mono', monospace; --radius: 14px;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --page: #05060c; --bg: #0b0e1a; --ink: #e9f1ff; --muted: #8b93b8; --line: #1d2340;
  --accent: #ff2e88; --accent2: #18e0ff; --chip: #141a30; --card: #10152a; --glow: 0 0 16px rgba(24,224,255,.35);
  --sos: #ff2e88; --driver: linear-gradient(160deg, #ff2e88, #6b19ff);
  --head: 'Space Grotesk', system-ui, sans-serif; --mono: 'JetBrains Mono', monospace; --radius: 14px;
  color-scheme: dark;
}
/* The display fonts are Latin-only: other scripts use the body stack, Khmer uses Kantumruy Pro. */
html:is([lang="zh"], [lang="zh-TW"], [lang="ja"], [lang="ko"], [lang="th"], [lang="lo"], [lang="hi"], [lang="ar"], [lang="ru"], [lang="uk"], [lang="el"], [lang="mn"], [lang="he"], [lang="fa"], [lang="ur"], [lang="bn"], [lang="ta"], [lang="ne"], [lang="my"]) { --head: var(--body); }
html[lang="km"], [lang="km"] { --body: 'Kantumruy Pro', system-ui, sans-serif; --head: 'Kantumruy Pro', system-ui, sans-serif; }
[lang="my"] { line-height: 1.7; }
[lang="km"] { font-family: 'Kantumruy Pro', system-ui, sans-serif; line-height: 1.6; }

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { background: var(--page); }
body { color: var(--ink); font: 15px/1.45 var(--body); -webkit-font-smoothing: antialiased; }
button, select { font: inherit; color: inherit; }
a { color: inherit; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

.app { max-width: 520px; min-height: 100vh; margin: 0 auto; background: var(--bg); display: flex; flex-direction: column; }
@media (min-width: 560px) { .app { border-left: 1px solid var(--line); border-right: 1px solid var(--line); } }

.bar { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: calc(10px + env(safe-area-inset-top)) 16px 10px; background: var(--bg); border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 9px; min-width: 0; }
.brand .name { font: 700 16px var(--head); white-space: nowrap; }
.brand .tagline { font-size: 11px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 190px; }
.tools { display: flex; gap: 6px; align-items: center; }
.lang select { max-width: 118px; text-overflow: ellipsis; appearance: none; background: var(--chip); border: 1px solid var(--line); border-radius: 999px; padding: 7px 12px; font-size: 13px; font-weight: 600; cursor: pointer; }
.icon-btn { width: 34px; height: 34px; border-radius: 50%; border: 1px solid var(--line); background: var(--chip); cursor: pointer; font-size: 16px; }

main { flex: 1; padding: 14px 16px 100px; }
h2 { font: 700 25px/1.15 var(--head); margin: 2px 0 4px; }
h3 { font: 700 17px var(--head); margin: 22px 0 8px; }
.sub { color: var(--muted); font-size: 13px; }

.locline { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 8px; font-size: 12px; color: var(--muted); }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; border: 0; border-radius: 999px; padding: 9px 14px; font-weight: 600; font-size: 13px; cursor: pointer; text-decoration: none; background: var(--accent); color: #fff; }
.btn.ghost { background: var(--chip); color: var(--ink); border: 1px solid var(--line); }
.btn.small { padding: 6px 11px; font-size: 12px; white-space: nowrap; }
.btn.wide { width: 100%; padding: 12px; }

.heat { margin-top: 12px; padding: 10px 12px; border-radius: 12px; background: var(--chip); border-inline-start: 3px solid var(--accent); font-size: 13px; }

.chips { display: flex; gap: 6px; margin: 14px 0 12px; flex-wrap: wrap; }
.chip { background: var(--chip); border: 1px solid var(--line); font-size: 12.5px; font-weight: 600; padding: 7px 12px; border-radius: 999px; cursor: pointer; }
.chip.on { background: var(--accent); color: #fff; border-color: var(--accent); box-shadow: var(--glow); }

#map { height: 210px; border-radius: var(--radius); border: 1px solid var(--line); overflow: hidden; z-index: 1; }
:root[data-theme="dark"] #map .leaflet-tile-pane { filter: invert(1) hue-rotate(200deg) brightness(.85) contrast(.9); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) #map .leaflet-tile-pane { filter: invert(1) hue-rotate(200deg) brightness(.85) contrast(.9); } }

.card { width: 100%; text-align: start; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 11px 12px; margin-top: 8px; display: flex; gap: 11px; align-items: center; cursor: pointer; }
.thumb { width: 60px; height: 60px; border-radius: 12px; flex: none; background: linear-gradient(135deg, var(--accent), var(--accent2)); background-size: cover; background-position: center; color: #fff; display: grid; place-items: center; font: 700 17px var(--head); position: relative; }
.thumb.photo span { position: absolute; top: -6px; inset-inline-start: -6px; width: 22px; height: 22px; border-radius: 50%; background: var(--accent); color: #fff; font: 700 12px/22px var(--body); text-align: center; box-shadow: 0 0 0 2px var(--bg); }
.hero { display: block; width: 100%; aspect-ratio: 16 / 10; object-fit: cover; border-radius: 16px; background: var(--chip); }
.credit { font-size: 10.5px; color: var(--muted); margin: 5px 0 10px; }
.credit a { color: var(--muted); }
.credits { margin-top: 14px; font-size: 11px; color: var(--muted); }
.credits summary { cursor: pointer; text-align: center; }
.credits p { margin-top: 4px; }
.card .t { font-weight: 700; font-size: 14px; }
.card .m { color: var(--muted); font-size: 12px; margin-top: 2px; }
.dist { margin-inline-start: auto; direction: ltr; unicode-bidi: isolate; font: 600 12px var(--mono); color: var(--accent2); white-space: nowrap; }

.dish { display: flex; align-items: center; gap: 12px; padding: 9px 0; border-bottom: 1px solid var(--line); font-size: 13px; }
.dish b { display: block; font-size: 14px; }
.dish .grow { flex: 1; }
.dish .thumb { width: 52px; height: 52px; }
.dish .m { color: var(--muted); }
.dish .p { font: 600 12px var(--mono); color: var(--accent2); white-space: nowrap; }

.featured { display: block; margin-top: 22px; padding: 14px; border: 1.5px dashed var(--line); border-radius: var(--radius); text-align: center; color: var(--muted); font-size: 13px; text-decoration: none; }

.timeline { margin-top: 12px; margin-inline-start: 6px; border-inline-start: 2px solid var(--line); padding-inline-start: 16px; }
.stop { position: relative; padding: 0 0 15px; cursor: default; }
.stop.link { cursor: pointer; }
.stop:before { content: ""; position: absolute; inset-inline-start: -23px; top: 4px; width: 12px; height: 12px; border-radius: 50%; background: var(--accent); box-shadow: var(--glow); }
.stop .time { font: 600 12px var(--mono); color: var(--accent2); }
.stop .t { font-weight: 700; font-size: 14px; }
.stop.link .t { text-decoration: underline; text-decoration-color: var(--line); text-underline-offset: 3px; }
.stop .m { color: var(--muted); font-size: 12px; }

.phr { display: flex; align-items: center; gap: 12px; padding: 11px 0; border-bottom: 1px solid var(--line); }
.phr .say { font: 700 16px var(--head); }
.phr .mean { color: var(--muted); font-size: 13px; }
.play { width: 38px; height: 38px; border-radius: 50%; flex: none; border: 0; background: var(--accent2); color: var(--bg); display: grid; place-items: center; font-size: 13px; cursor: pointer; box-shadow: var(--glow); }
.kmline { font-family: 'Kantumruy Pro', system-ui, sans-serif; font-size: 15px; line-height: 1.6; }
.trbox { margin-top: 12px; display: grid; gap: 8px; }
.trbox textarea { width: 100%; resize: vertical; min-height: 84px; padding: 12px; border-radius: 14px; border: 1px solid var(--line); background: var(--card); color: var(--ink); font: 15px/1.45 var(--body); }
.trbox textarea:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
.btn[disabled] { opacity: .6; cursor: wait; }
.err { margin-top: 10px; color: var(--sos); font-size: 13px; }
.trout { margin-top: 12px; padding: 14px; border-radius: var(--radius); background: var(--card); border: 1px solid var(--line); }
.kmbig { font: 600 24px/1.6 'Kantumruy Pro', system-ui, sans-serif; }
.roman { color: var(--accent2); font-size: 13px; margin-top: 4px; }
.trout .mean { color: var(--muted); font-size: 13px; margin-top: 4px; }

.price { display: flex; justify-content: space-between; gap: 10px; font-size: 13.5px; padding: 8px 0; border-bottom: 1px dashed var(--line); }
.price b { font-family: var(--mono); color: var(--accent2); white-space: nowrap; }
.note { color: var(--muted); font-size: 12px; margin-top: 8px; }
.scam { padding: 10px 12px; margin-top: 8px; background: var(--chip); border-radius: 12px; font-size: 13px; }

.grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 12px; }
.tile { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 12px; font-size: 12.5px; color: var(--muted); }
.tile b { display: block; color: var(--ink); font-size: 14px; margin-bottom: 4px; }
.sos { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 10px; }
.sos a { border-radius: 14px; padding: 12px 4px; text-align: center; background: var(--sos); color: #fff; font-size: 12px; font-weight: 600; text-decoration: none; }
:root[data-theme="dark"] .sos a { background: transparent; border: 1.5px solid var(--sos); color: #ff6fb0; box-shadow: 0 0 14px rgba(255,46,136,.3); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .sos a { background: transparent; border: 1.5px solid var(--sos); color: #ff6fb0; box-shadow: 0 0 14px rgba(255,46,136,.3); } }
.sos b { display: block; font: 700 24px var(--mono); }
.stack { display: grid; gap: 8px; margin-top: 10px; }
.foot { text-align: center; color: var(--muted); font-size: 11.5px; margin-top: 26px; }

.tabs { position: fixed; bottom: 0; left: 50%; transform: translateX(-50%); width: 100%; max-width: 520px; z-index: 30;
  display: flex; justify-content: space-around; background: var(--bg); border-top: 1px solid var(--line); padding: 8px 4px calc(10px + env(safe-area-inset-bottom)); }
.tabs button { flex: 1; border: 0; background: none; color: var(--muted); font-size: 11px; font-weight: 600; cursor: pointer; display: flex; flex-direction: column; align-items: center; gap: 2px; }
.tabs i { font-style: normal; font-size: 18px; width: 34px; height: 26px; border-radius: 9px; display: grid; place-items: center; }
.tabs button.on { color: var(--accent); }
.tabs button.on i { background: var(--chip); box-shadow: var(--glow); }

.sheet { position: fixed; inset: 0; z-index: 50; background: rgba(0,0,0,.45); display: flex; align-items: flex-end; justify-content: center; }
.sheet[hidden], .driver[hidden] { display: none; }
.sheet .panel { width: 100%; max-width: 520px; max-height: 88vh; overflow: auto; background: var(--bg); border-radius: 22px 22px 0 0; padding: 10px 18px calc(22px + env(safe-area-inset-bottom)); }
.grab { width: 40px; height: 4px; border-radius: 4px; background: var(--line); margin: 0 auto 12px; }
.meta { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 14px 0; }
.meta div { background: var(--chip); border-radius: 12px; padding: 9px; font-size: 11.5px; color: var(--muted); }
.meta b { display: block; color: var(--ink); font-size: 13.5px; }
.tip { background: var(--chip); border-inline-start: 3px solid var(--accent); border-radius: 10px; padding: 10px 12px; font-size: 13.5px; }
.tip b { color: var(--accent); }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 14px; }

.driver { position: fixed; inset: 0; z-index: 60; background: var(--driver); color: #fff; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 24px; gap: 14px; }
.driver .lead { font-size: 15px; opacity: .85; }
.driver .kh { font-size: 40px; font-weight: 700; line-height: 1.3; }
.driver .kh.empty { font-size: 14px; font-weight: 600; border: 2px dashed rgba(255,255,255,.6); border-radius: 12px; padding: 18px 22px; }
.driver .en { font: 700 26px var(--head); }
.driver .btn { background: rgba(255,255,255,.18); margin-top: 18px; }
