* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: #10131a; color: #eef1f6; font-family: "Segoe UI", system-ui, -apple-system, sans-serif; }
#view { position: fixed; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; }
[hidden] { display: none !important; }
button { font: inherit; cursor: pointer; }
kbd { display: inline-block; min-width: 1.6em; padding: 1px 5px; margin: 0 1px; border-radius: 5px; background: rgba(255,255,255,.14); font-family: inherit; font-size: .9em; text-align: center; }
small { display: block; font-size: 12px; color: #b8c0cc; letter-spacing: .02em; }

.start { position: fixed; inset: 0; display: flex; overflow-y: auto; padding: 20px;
  background: radial-gradient(circle at 30% 20%, #2b3346 0%, #12151c 70%); }
.start-card { width: min(460px, 100%); margin: auto; display: grid; gap: 12px; }
.start-card h1 { margin: 0; font-size: clamp(32px, 6vw, 44px); line-height: 1.05; letter-spacing: -.02em; }
.start-card p { margin: 0; line-height: 1.5; color: #d3d9e2; }
.eyebrow { font-size: 13px; font-weight: 700; text-transform: uppercase; letter-spacing: .12em; color: #ffc53d !important; }
.primary, .secondary { min-height: 52px; border-radius: 14px; border: 0; font-size: 17px; font-weight: 700; padding: 0 20px; }
.primary { background: #ffc53d; color: #1d1606; }
.primary:hover { background: #ffd469; }
.secondary { background: rgba(255,255,255,.1); color: #eef1f6; border: 1px solid rgba(255,255,255,.18); }
.secondary:hover { background: rgba(255,255,255,.16); }
button:disabled { opacity: .55; cursor: progress; }
.start-status { min-height: 1.5em; font-weight: 600; }
.start-status.error { color: #ff9aa9 !important; }
.search { display: grid; gap: 8px; }
.search label { font-size: 14px; color: #c7ced8; }
.search div { display: flex; gap: 8px; }
.search input { flex: 1; min-width: 0; min-height: 48px; padding: 0 14px; border-radius: 12px; border: 1px solid rgba(255,255,255,.2); background: rgba(255,255,255,.06); color: #eef1f6; font: inherit; font-size: 16px; }
.search input:focus { outline: 2px solid #ffc53d; outline-offset: 1px; }
.search .secondary { min-height: 48px; font-size: 15px; }
.places { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.places button { width: 100%; min-height: 44px; padding: 8px 12px; text-align: left; border-radius: 10px; border: 1px solid rgba(255,255,255,.14); background: rgba(255,255,255,.06); color: #eef1f6; font-size: 14px; line-height: 1.35; }
.places button:hover { background: rgba(255,255,255,.12); }
.geo-help { display: grid; gap: 10px; padding: 14px 16px; border-radius: 14px; background: rgba(255,255,255,.07); border: 1px solid rgba(255,255,255,.14); }
.geo-help strong { font-size: 16px; }
.geo-help ol { margin: 0; padding-left: 22px; display: grid; gap: 6px; line-height: 1.45; color: #dfe4ea; }
.fine { font-size: 13px; color: #9aa4b2 !important; }

.bar { position: fixed; top: 12px; left: 12px; right: 236px; display: flex; flex-wrap: wrap; gap: 10px; pointer-events: none; }
.bar > div, .side, .turn, .keys-help, .toast { background: rgba(14,17,24,.78); backdrop-filter: blur(8px); border: 1px solid rgba(255,255,255,.08); border-radius: 14px; }
.bar > div { padding: 10px 14px; }
.place strong { font-size: 15px; }
.land strong { font-size: 24px; font-variant-numeric: tabular-nums; color: #ffc53d; margin-right: 8px; }
.land span { font-size: 13px; color: #c7ced8; }
.trail { min-width: 220px; display: grid; gap: 8px; align-content: center; font-size: 14px; font-weight: 600; }
.meter { height: 8px; border-radius: 4px; background: rgba(255,255,255,.12); overflow: hidden; }
#trail-fill { height: 100%; width: 0; background: #ffc53d; transition: width .2s linear; }
#trail-fill.danger { background: #ff5c6c; }
.fuel { min-width: 190px; display: grid; gap: 8px; align-content: center; font-size: 14px; font-weight: 600; }
#fuel-fill { height: 100%; width: 100%; background: #3ccf7a; transition: width .3s linear; }
#fuel-fill.low { background: #ff9f3d; }
#fuel-fill.empty { background: #ff5c6c; }

.side { position: fixed; top: 12px; right: 12px; width: 212px; padding: 10px; display: grid; gap: 10px; }
.board { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; font-size: 14px; }
.board li { display: grid; grid-template-columns: 12px 1fr auto; gap: 8px; align-items: center; padding: 5px 6px; border-radius: 8px; }
.board li.me { background: rgba(255,197,61,.14); font-weight: 700; }
.board i { width: 12px; height: 12px; border-radius: 50%; }
.board small { display: inline; font-size: 11px; }
.board b { font-variant-numeric: tabular-nums; font-weight: 600; }
#mini-map { width: 100%; aspect-ratio: 1; border-radius: 10px; background: rgba(255,255,255,.04); }
.side-tools { display: flex; gap: 6px; }
.side-tools button { min-width: 44px; min-height: 44px; border-radius: 10px; border: 1px solid rgba(255,255,255,.14); background: rgba(255,255,255,.08); color: #eef1f6; font-size: 20px; }
.side-tools .text { flex: 1; font-size: 14px; }

.turn { position: fixed; left: 50%; bottom: 64px; transform: translateX(-50%); margin: 0; padding: 10px 18px; font-weight: 700; font-size: 15px; }
.keys-help { position: fixed; left: 50%; bottom: 14px; transform: translateX(-50%); margin: 0; padding: 7px 14px; font-size: 13px; color: #c7ced8; white-space: nowrap; }
.toast { position: fixed; left: 50%; top: 96px; transform: translateX(-50%); margin: 0; padding: 12px 20px; font-size: 17px; font-weight: 700; max-width: min(560px, calc(100vw - 32px)); text-align: center; }
.loading-cells { position: fixed; left: 50%; top: 150px; transform: translateX(-50%); margin: 0; padding: 6px 14px; font-size: 13px; font-weight: 600; color: #c7ced8; background: rgba(14,17,24,.7); border-radius: 999px; pointer-events: none; }
.recenter { position: fixed; left: 50%; bottom: 112px; transform: translateX(-50%); min-height: 44px; padding: 0 18px; border-radius: 999px; border: 0; background: #ffc53d; color: #1d1606; font-size: 15px; font-weight: 700; box-shadow: 0 4px 16px rgba(0,0,0,.35); }
.recenter:hover { background: #ffd469; }
@media (max-width: 760px), (pointer: coarse) { .recenter { top: 120px; bottom: auto; left: auto; right: 12px; transform: none; } }
.world-map { position: fixed; inset: 0; z-index: 20; background: radial-gradient(circle at 50% 45%, #1b2740 0%, #070a12 75%); }
.world-map canvas { width: 100%; height: 100%; display: block; touch-action: none; cursor: grab; }
.world-map canvas:active { cursor: grabbing; }
.world-bar { position: absolute; top: 12px; left: 12px; right: 12px; display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 10px 14px; border-radius: 14px; background: rgba(14,17,24,.78); border: 1px solid rgba(255,255,255,.08); }
.world-bar div { display: grid; gap: 2px; }
.world-bar strong { font-size: 17px; }
.world-bar span { font-size: 13px; color: #c7ced8; }
.world-bar .secondary { min-height: 44px; font-size: 15px; }
.pick-panel { position: absolute; left: 50%; bottom: 24px; transform: translateX(-50%); display: flex; align-items: center; gap: 14px; padding: 10px 10px 10px 16px; border-radius: 16px; background: rgba(14,17,24,.85); border: 1px solid rgba(255,255,255,.1); font-weight: 600; white-space: nowrap; }
.pick-panel .primary { min-height: 46px; }
.toast.good { border-color: rgba(126,217,87,.6); }
.toast.bad { border-color: rgba(255,92,108,.7); color: #ffd3d8; }

.touch { position: fixed; left: 0; right: 0; bottom: 16px; display: flex; justify-content: center; gap: 12px; padding: 0 12px; }
.touch button { width: 68px; height: 68px; border-radius: 50%; border: 1px solid rgba(255,255,255,.2); background: rgba(14,17,24,.72); color: #fff; font-size: 24px; touch-action: none; }
.touch button:active { background: rgba(255,197,61,.4); }
.touch .gas { width: 84px; height: 84px; margin-left: 8px; background: rgba(255,197,61,.85); color: #1d1606; border-color: transparent; }
.touch .gas:active { background: #ffd469; }
.touch { align-items: center; -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }

.credits { position: fixed; left: 12px; bottom: 12px; display: flex; gap: 10px; font-size: 12px; }
.credits a { color: #dfe4ea; background: rgba(14,17,24,.6); padding: 3px 7px; border-radius: 6px; text-decoration: none; }
.credits a:hover { text-decoration: underline; }
/* No map is shown on the start screen, so the map credits wait for the game. */
body:has(#start:not([hidden])) .credits { display: none; }

@media (max-width: 760px), (pointer: coarse) {
  .bar { right: 12px; }
  .bar .place { display: none; }
  .trail { min-width: 0; flex: 1; }
  .side { top: auto; bottom: 100px; width: 150px; padding: 8px; }
  .board { display: none; }
  .side-tools #reset { display: none; }
  .keys-help { display: none; }
  .turn { bottom: 152px; font-size: 13px; left: 12px; transform: none; }
  .credits { bottom: 96px; flex-direction: column; align-items: flex-start; gap: 4px; font-size: 11px; }
  .credits a:last-child { display: none; }
}
