:root { --sky-top: #7fb2d9; --sky-mid: #b9d6ea; --haze: #e4ecef; --ink: #1d2a33; --muted: #5b6b76; --accent: #e0404f; --card: rgba(255, 255, 255, 0.9); }
html, body { margin: 0; height: 100%; overflow: hidden; color: var(--ink); font: 14px/1.4 system-ui, -apple-system, "Segoe UI", sans-serif;
  background: linear-gradient(to bottom, var(--sky-top) 0%, var(--sky-mid) 30%, var(--haze) 52%, var(--haze) 100%); }
#view { position: fixed; inset: 0; touch-action: none; }
button { font: inherit; cursor: pointer; }
a { color: #b4303d; }

.start { position: fixed; inset: 0; z-index: 10; display: flex; align-items: center; justify-content: center; padding: 16px;
  padding-top: calc(16px + env(safe-area-inset-top, 0px)); padding-bottom: calc(16px + env(safe-area-inset-bottom, 0px));
  background: rgba(200, 222, 236, 0.35); box-sizing: border-box; }
.start[hidden] { display: none; }
.card { width: min(520px, 100%); max-height: 100%; overflow: auto; box-sizing: border-box; background: var(--card); border-radius: 16px;
  padding: 20px 22px; box-shadow: 0 12px 40px rgba(30, 50, 70, 0.25); }
.card .top { display: flex; align-items: center; }
.card h1 { margin: 0; font-size: 34px; letter-spacing: -0.02em; color: var(--accent); font-weight: 800; font-style: italic; }
.lang { margin-left: auto; border: 1px solid #c9d3da; background: #fff; border-radius: 6px; padding: 3px 8px; font-size: 12px; color: var(--muted); }
.tag { margin: 6px 0 14px; color: var(--muted); }
.card h2 { margin: 0 0 8px; font-size: 16px; }
.search { position: relative; }
.search input { width: 100%; box-sizing: border-box; padding: 11px 12px; border-radius: 10px; border: 1px solid #c3ced6; background: #fff;
  color: var(--ink); font: 16px system-ui, sans-serif; }
.search input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(224, 64, 79, 0.15); }
.sugg { position: absolute; top: calc(100% + 6px); left: 0; right: 0; z-index: 25; background: #fff; border: 1px solid #c9d3da; border-radius: 10px;
  box-shadow: 0 8px 28px rgba(30, 50, 70, 0.25); font-size: 13px; overflow: hidden; }
.sugg ul { list-style: none; margin: 0; padding: 4px 0; max-height: min(45vh, 340px); overflow: auto; }
.sugg li { display: flex; align-items: baseline; gap: 8px; padding: 7px 12px; cursor: pointer; }
.sugg li[aria-selected="true"], .sugg li:hover { background: #fbe3e5; }
.sugg li b { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sugg li small { margin-left: auto; color: var(--muted); font-size: 11px; white-space: nowrap; }
.sugg-note { margin: 0; padding: 5px 12px 7px; border-top: 1px solid #e3e8ec; color: var(--muted); font: 11px ui-monospace, monospace; }
.sugg-note:empty { display: none; }
.spots { display: flex; flex-wrap: wrap; gap: 6px; margin: 12px 0 4px; }
.spots button { border: 0; border-radius: 999px; padding: 7px 12px; background: #eef2f4; color: var(--ink); }
.spots button:hover { background: #fbe3e5; }
.status { min-height: 1.4em; margin: 8px 0 0; color: var(--muted); font-size: 13px; }
.summary { margin: 6px 0 0; padding: 8px 10px; border-radius: 8px; background: #fff4e0; font-weight: 600; }
.keys { margin: 10px 0 0; color: var(--muted); font-size: 12px; }
.credit { margin: 8px 0 0; color: var(--muted); font-size: 11px; }

.hud[hidden] { display: none; }
.hud-tl, .hud-tr, .speed, .legend { position: fixed; z-index: 5; }
.hud-tl { top: calc(10px + env(safe-area-inset-top, 0px)); left: 10px; max-width: calc(100vw - 190px); }
.back { border: 0; border-radius: 8px; padding: 6px 10px; background: rgba(255, 255, 255, 0.85); color: var(--ink); font-size: 12px; box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15); }
.road { margin-top: 8px; padding: 6px 10px; border-radius: 8px; background: rgba(29, 42, 51, 0.78); color: #fff; display: inline-flex; flex-direction: column; max-width: 100%; }
.road b { font-size: 17px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.road span { font-size: 12px; color: #cfdbe3; }
.road span:empty { display: none; }
.place { margin-top: 4px; font-size: 12px; color: var(--ink); text-shadow: 0 1px 2px rgba(255, 255, 255, 0.9); }
.hud-tr { top: calc(10px + env(safe-area-inset-top, 0px)); right: 10px; text-align: right; padding: 6px 10px; border-radius: 8px;
  background: rgba(255, 255, 255, 0.82); font-size: 13px; box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12); }
.hud-tr .sub { font-size: 12px; color: var(--muted); }
.hud-tr .load:empty { display: none; }
.speed { left: 50%; transform: translateX(-50%); bottom: calc(16px + env(safe-area-inset-bottom, 0px)); color: #fff; text-align: center;
  text-shadow: 0 2px 6px rgba(0, 0, 0, 0.45); pointer-events: none; }
.speed b { display: block; font-size: 46px; line-height: 1; font-weight: 800; font-variant-numeric: tabular-nums; }
.speed span { font-size: 12px; letter-spacing: 0.1em; }
.speed small { display: block; margin-top: 2px; font-size: 11px; opacity: 0.92; }
.legend { left: 10px; bottom: calc(10px + env(safe-area-inset-bottom, 0px)); display: flex; flex-wrap: wrap; gap: 4px 8px; max-width: 34vw;
  font-size: 11px; color: var(--ink); background: rgba(255, 255, 255, 0.75); padding: 4px 8px; border-radius: 8px; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 3px; vertical-align: -1px; border: 1px solid rgba(0, 0, 0, 0.15); }
.seasons { display: flex; flex-wrap: wrap; gap: 6px; margin: 10px 0 0; }
.seasons button { border: 1px solid #d4dadf; border-radius: 999px; padding: 4px 10px; background: #fff; color: var(--muted); font-size: 12px; }
.seasons button[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: #fff; }
.hud-seasons { position: fixed; z-index: 5; right: 10px; bottom: calc(10px + env(safe-area-inset-bottom, 0px)); margin: 0; }
.hud-seasons button { background: rgba(255, 255, 255, 0.85); }

.touch { display: none; }
@media (pointer: coarse), (max-width: 700px) {
  .touch { display: block; }
  .pad { position: fixed; z-index: 6; bottom: calc(18px + env(safe-area-inset-bottom, 0px)); display: flex; gap: 10px; }
  .pad.left { left: 12px; }
  .pad.right { right: 12px; }
  .pad button { width: 64px; height: 64px; border-radius: 50%; border: 0; background: rgba(255, 255, 255, 0.55); color: var(--ink); font-size: 22px;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.2); touch-action: none; user-select: none; -webkit-user-select: none; }
  .pad button.on { background: rgba(255, 255, 255, 0.9); }
  .pad button.gas { background: rgba(224, 64, 79, 0.8); color: #fff; font-size: 14px; font-weight: 800; }
  .pad button.gas.on { background: rgba(224, 64, 79, 1); }
  .speed { bottom: calc(96px + env(safe-area-inset-bottom, 0px)); }
  .speed b { font-size: 36px; }
  .hud-tl { max-width: calc(100vw - 20px); }
  .hud-tr { top: calc(112px + env(safe-area-inset-top, 0px)); font-size: 12px; }
  .legend { bottom: auto; top: calc(112px + env(safe-area-inset-top, 0px)); max-width: 46vw; font-size: 10px; }
  .hud-seasons { bottom: auto; top: calc(186px + env(safe-area-inset-top, 0px)); max-width: 46vw; justify-content: flex-end; }
}
