* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; overflow: hidden; background: #04121f; color: #eaf6ff;
  font-family: Bahnschrift, "Segoe UI", system-ui, sans-serif; user-select: none; }
#gl { position: fixed; inset: 0; width: 100%; height: 100%; display: block; }
.hidden { display: none !important; }

#underwater { position: fixed; inset: 0; pointer-events: none; opacity: 0;
  background: radial-gradient(ellipse at center, rgba(30,150,190,.22), rgba(3,40,85,.78)); }

/* ---------- race HUD ---------- */
#hud { position: fixed; inset: 0; pointer-events: none; font-style: italic; font-weight: 700;
  text-shadow: 0 2px 0 rgba(0,20,40,.55), 0 0 12px rgba(0,30,60,.35); }
.hud-tl { position: absolute; left: 26px; top: 18px; }
#pos b { font-size: 84px; line-height: .9; color: #ffe14d; }
#pos i { font-size: 34px; color: #ffe14d; }
#pos span { font-size: 24px; opacity: .8; margin-left: 6px; }
#lap { font-size: 24px; letter-spacing: 1px; margin-top: 4px; }
#time { font-size: 22px; opacity: .9; font-variant-numeric: tabular-nums; }
.hud-tr { position: absolute; right: 22px; top: 16px; text-align: right; }
#mini { display: block; width: 170px; height: 170px; background: rgba(4,26,48,.38);
  border: 2px solid rgba(160,225,255,.35); border-radius: 14px; }
#clams { font-size: 24px; margin-top: 8px; color: #ffe9a8; }
#clams::before { content: "🐚 "; font-style: normal; }
.hud-bl { position: absolute; left: 26px; bottom: 22px; }
#speed b { font-size: 68px; line-height: 1; font-variant-numeric: tabular-nums; }
#speed span { font-size: 20px; margin-left: 6px; opacity: .85; }
.hud-bc { position: absolute; left: 50%; bottom: 24px; transform: translateX(-50%); width: 380px; }
.bar { display: flex; align-items: center; gap: 10px; margin-top: 7px; }
.bar label { font-size: 13px; letter-spacing: 2px; width: 54px; text-align: right; opacity: .9; }
.bar .track { flex: 1; height: 14px; background: rgba(4,26,48,.55); border: 2px solid rgba(255,255,255,.55);
  border-radius: 8px; overflow: hidden; transform: skewX(-14deg); }
.bar .track > div { height: 100%; width: 50%; }
.hull { width: 260px; }
#hullbar { background: linear-gradient(90deg, #ff5a5a, #ffb14d 45%, #5dff9b); }
#boostbar { background: linear-gradient(90deg, #ff8a1f, #ffe14d); }
#boostbar.on { background: linear-gradient(90deg, #fff, #ffe14d); box-shadow: 0 0 14px #ffe14d; }
#breathbar { background: linear-gradient(90deg, #2aa8ff, #9be8ff); }
#breathwrap { opacity: 0; transition: opacity .2s; }
#breathwrap.on { opacity: 1; }
#streak { display: flex; justify-content: center; gap: 7px; height: 16px; }
#streak i { width: 26px; height: 10px; border-radius: 3px; transform: skewX(-20deg);
  background: rgba(4,26,48,.55); border: 2px solid rgba(255,255,255,.5); }
#streak i.on { background: #5dff9b; border-color: #fff; box-shadow: 0 0 10px #5dff9b; }
#buoyhint { position: absolute; top: 20px; left: 50%; transform: translateX(-50%); font-size: 26px;
  padding: 6px 22px; border-radius: 30px; opacity: 0; transition: opacity .15s; white-space: nowrap; }
#buoyhint.red { background: rgba(225,45,45,.88); opacity: 1; }
#buoyhint.yel { background: rgba(240,190,20,.92); color: #20160a; text-shadow: none; opacity: 1; }
#warn { position: absolute; top: 31%; left: 50%; transform: translateX(-50%); font-size: 34px; color: #ff6b5a;
  letter-spacing: 2px; white-space: nowrap; }
#pops { position: fixed; left: 0; right: 0; top: 22%; pointer-events: none; text-align: center;
  font-style: italic; font-weight: 700; }
.pop { font-size: 36px; color: #fff; text-shadow: 0 3px 0 rgba(0,25,50,.6), 0 0 18px rgba(0,160,255,.6);
  animation: pop 1.5s ease-out forwards; }
.pop.good { color: #5dff9b; } .pop.gold { color: #ffe14d; font-size: 46px; } .pop.bad { color: #ff6b5a; }
.pop.hint { font-size: 25px; color: #fff; background: rgba(5,24,46,.72); display: inline-block; padding: 8px 22px;
  border-radius: 12px; animation: hint 4.3s ease-out forwards; text-shadow: none; }
@keyframes hint { 0% { opacity: 0; } 6% { opacity: 1; } 88% { opacity: 1; } 100% { opacity: 0; } }
.pop small { font-size: .55em; opacity: .9; margin-left: 8px; }
@keyframes pop { 0% { transform: scale(.4); opacity: 0; } 12% { transform: scale(1.18); opacity: 1; }
  22% { transform: scale(1); } 75% { opacity: 1; } 100% { transform: translateY(-34px); opacity: 0; } }
#count { position: fixed; left: 0; right: 0; top: 24%; text-align: center; line-height: 1; pointer-events: none;
  font-size: 170px; font-style: italic; font-weight: 700; color: #ffe14d;
  text-shadow: 0 8px 0 rgba(0,25,50,.6), 0 0 50px rgba(255,200,40,.5); }
#count.go { color: #5dff9b; }
#racecard { position: fixed; left: 50%; top: 12%; transform: translateX(-50%); pointer-events: none; text-align: center;
  background: rgba(5,24,46,.78); border: 2px solid rgba(140,220,255,.45); border-radius: 16px; padding: 14px 34px;
  opacity: 0; transition: opacity .5s; }
#racecard.on { opacity: 1; }
#racecard h3 { font-size: 34px; font-style: italic; letter-spacing: 2px; color: #ffe14d; }
#racecard p { font-size: 17px; margin-top: 4px; opacity: .92; }

/* ---------- menus ---------- */
#ui { position: fixed; inset: 0; display: none; }
#ui.on { display: block; }
.screen { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 18px; background: linear-gradient(180deg, rgba(3,18,36,.50), rgba(3,18,36,.80)); overflow: auto; }
.panel { background: rgba(6,28,52,.90); border: 2px solid rgba(120,210,255,.38); border-radius: 20px;
  padding: 22px 28px; max-width: 1120px; width: 100%; box-shadow: 0 18px 60px rgba(0,0,0,.45); }
.panel.narrow { max-width: 720px; }
h1.logo { font-size: 118px; font-style: italic; letter-spacing: 6px; line-height: 1; color: #fff;
  text-shadow: 0 7px 0 #0b84c9, 0 14px 0 rgba(0,30,60,.5), 0 0 60px rgba(60,190,255,.6); }
h2.sub { font-size: 30px; font-style: italic; letter-spacing: 14px; color: #ffe14d; margin: 6px 0 14px;
  text-shadow: 0 3px 0 rgba(0,30,60,.6); }
.tag { font-size: 18px; max-width: 640px; text-align: center; opacity: .92; line-height: 1.45; margin-bottom: 20px; }
h2.head { font-size: 30px; font-style: italic; letter-spacing: 2px; color: #ffe14d; }
h3.sec { font-size: 15px; letter-spacing: 3px; opacity: .7; margin: 16px 0 8px; }
p.body { font-size: 17px; line-height: 1.5; margin: 10px 0; opacity: .95; }
.row { display: flex; gap: 14px; flex-wrap: wrap; align-items: stretch; justify-content: center; }
.spread { display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap; }
.btn { font: inherit; font-size: 19px; font-weight: 700; font-style: italic; letter-spacing: 1px; color: #062038;
  background: linear-gradient(180deg, #ffe97a, #ffc530); border: 0; border-radius: 12px; padding: 12px 26px;
  cursor: pointer; box-shadow: 0 5px 0 #b77a00; transition: transform .08s, filter .1s; }
.btn:hover { filter: brightness(1.1); transform: translateY(-1px); }
.btn:active { transform: translateY(3px); box-shadow: 0 2px 0 #b77a00; }
.btn.big { font-size: 28px; padding: 16px 48px; }
.btn.alt { background: linear-gradient(180deg, #5cd3ff, #1f9fe0); box-shadow: 0 5px 0 #0b5f94; }
.btn.ghost { background: rgba(255,255,255,.08); color: #dff3ff; box-shadow: none; border: 2px solid rgba(160,225,255,.4); }
.btn:disabled { filter: grayscale(.9) brightness(.6); cursor: not-allowed; transform: none; }
.keys { display: grid; grid-template-columns: repeat(4, auto); gap: 8px 22px; margin-top: 26px; font-size: 15px;
  background: rgba(5,24,46,.72); padding: 14px 22px; border-radius: 14px; border: 1px solid rgba(140,220,255,.3); }
.keys b { color: #ffe14d; margin-right: 8px; }
.record { margin-top: 14px; font-size: 15px; opacity: .8; }

.runbar { display: flex; gap: 20px; align-items: center; flex-wrap: wrap; font-size: 19px; font-weight: 700; }
.runbar .hearts { color: #ff5a7a; letter-spacing: 3px; font-size: 22px; }
.runbar .hearts i { opacity: .25; font-style: normal; }
.runbar .cash { color: #ffe9a8; }
.runbar .perks { display: flex; gap: 5px; flex-wrap: wrap; font-size: 22px; }
.runbar .perks span { cursor: help; background: rgba(255,255,255,.08); border-radius: 8px; padding: 1px 5px; }
.meter { display: inline-block; width: 120px; height: 12px; border-radius: 6px; background: rgba(0,0,0,.4);
  border: 1px solid rgba(255,255,255,.4); overflow: hidden; vertical-align: middle; margin-left: 6px; }
.meter > i { display: block; height: 100%; background: linear-gradient(90deg, #ff5a5a, #ffb14d 45%, #5dff9b); }

/* map */
.mapwrap { margin-top: 12px; background: linear-gradient(180deg, rgba(10,60,100,.5), rgba(6,36,66,.5));
  border-radius: 14px; border: 1px solid rgba(140,220,255,.25); }
.mapwrap svg { display: block; width: 100%; height: auto; }
.edge { stroke: rgba(170,225,255,.28); stroke-width: 3; fill: none; stroke-dasharray: 2 9; stroke-linecap: round; }
.edge.live { stroke: #ffe14d; stroke-dasharray: none; stroke-width: 3.5; opacity: .9; }
.edge.done { stroke: #5dff9b; stroke-dasharray: none; opacity: .55; }
.node circle { fill: #0b2c4c; stroke: rgba(170,225,255,.5); stroke-width: 3; }
.node text { font-size: 24px; text-anchor: middle; dominant-baseline: central; pointer-events: none; }
.node.rival circle { stroke: #ff6b5a; } .node.shop circle { stroke: #5dff9b; }
.node.event circle { stroke: #c79bff; } .node.garage circle { stroke: #ffa94d; }
.node.final circle { stroke: #ffe14d; fill: #3b2a05; }
.node.visited { opacity: .4; }
.node.cur circle { fill: #1f9fe0; stroke: #fff; }
.node.reach { cursor: pointer; }
.node.reach circle { stroke: #ffe14d; stroke-width: 4; fill: #17466f; animation: pulse 1.1s ease-in-out infinite; }
.node.reach:hover circle { fill: #ffe14d; }
@keyframes pulse { 50% { stroke-width: 8; stroke-opacity: .55; } }
.nodeinfo { min-height: 28px; margin-top: 10px; font-size: 17px; text-align: center; opacity: .95; }
.legend { display: flex; gap: 18px; justify-content: center; flex-wrap: wrap; font-size: 14px; opacity: .78; margin-top: 6px; }

/* cards */
.card { width: 232px; background: linear-gradient(180deg, #0f3a62, #0a2947); border: 2px solid rgba(140,220,255,.4);
  border-radius: 16px; padding: 16px 16px 14px; text-align: center; display: flex; flex-direction: column; gap: 6px;
  cursor: pointer; transition: transform .1s, border-color .1s; font: inherit; color: inherit; }
.card:hover:not(.off) { transform: translateY(-5px); border-color: #ffe14d; }
.card.off { opacity: .45; cursor: not-allowed; }
.card.sold { opacity: .25; pointer-events: none; }
.card .ico { font-size: 46px; line-height: 1.1; }
.card .nm { font-size: 20px; font-weight: 700; font-style: italic; }
.card .ds { font-size: 14.5px; line-height: 1.4; opacity: .9; flex: 1; }
.card .rar { font-size: 11px; letter-spacing: 3px; opacity: .65; }
.card.rare { border-color: rgba(199,155,255,.75); background: linear-gradient(180deg, #33206a, #171a4a); }
.card.rare .rar { color: #d9bbff; opacity: 1; }
.card .price { font-size: 18px; font-weight: 700; color: #ffe9a8; }

table.res { width: 100%; border-collapse: collapse; margin: 12px 0; font-size: 18px; }
table.res td { padding: 6px 10px; border-bottom: 1px solid rgba(140,220,255,.16); }
table.res tr.me td { color: #ffe14d; font-weight: 700; background: rgba(255,225,77,.08); }
table.res td:first-child { width: 60px; font-style: italic; font-weight: 700; }
table.res td:last-child { text-align: right; font-variant-numeric: tabular-nums; }
.pay { font-size: 17px; line-height: 1.7; }
.pay b { color: #ffe9a8; } .pay .bad { color: #ff7a6a; } .pay .good { color: #5dff9b; }
.choices { display: flex; flex-direction: column; gap: 10px; margin-top: 14px; }
.choices .btn { text-align: left; font-size: 18px; }
.choices .btn small { display: block; font-size: 13.5px; font-weight: 400; opacity: .78; letter-spacing: 0; margin-top: 2px; }
.bigico { font-size: 64px; }
#fatal { position: fixed; inset: 0; display: flex; align-items: center; justify-content: center; text-align: center;
  background: #04121f; font-size: 20px; padding: 40px; line-height: 1.6; }
