:root {
  --ink: #2a3038;
  --sky: #74c7ef;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  font-family: Nunito, system-ui, sans-serif;
  color: var(--ink);
  background: #111;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}

canvas.view {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  touch-action: none;
}

.back {
  position: absolute;
  top: 12px;
  left: 12px;
  z-index: 5;
  color: #fff;
  text-decoration: none;
  font-size: 13px;
  font-weight: 800;
  text-shadow: 0 1px 0 #0006;
}

.hud {
  position: absolute;
  top: 10px;
  right: 12px;
  z-index: 5;
  display: flex;
  gap: 8px;
  align-items: center;
}

.coins, .lvl {
  display: flex;
  align-items: center;
  gap: 8px;
  background: #fff8;
  border: 3px solid #fff;
  border-radius: 999px;
  padding: 6px 14px 6px 8px;
  font-family: Fredoka, sans-serif;
  font-size: 22px;
  font-weight: 700;
}

.lvl {
  padding: 6px 12px;
  font-size: 16px;
}

.coins i {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #ffe566, #e2b000);
  border: 2px solid #c49200;
}

.hint {
  position: absolute;
  left: 12px;
  right: 12px;
  bottom: 18px;
  z-index: 5;
  margin: 0;
  text-align: center;
  font-family: Fredoka, sans-serif;
  font-size: 16px;
  font-weight: 600;
  color: #fff;
  text-shadow: 0 2px 0 #0005;
  pointer-events: none;
}

body.till .hint,
body.coil .hint { bottom: 132px; }

.stick {
  position: absolute;
  left: 18px;
  bottom: 22px;
  z-index: 6;
  width: 116px;
  height: 116px;
  border-radius: 50%;
  background: #0004;
  border: 4px solid #fff8;
  touch-action: none;
}

.stick .knob {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 52px;
  height: 52px;
  margin: -26px 0 0 -26px;
  border-radius: 50%;
  background: #fff;
  border: 3px solid #2a3038;
}

.bubbles {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 4;
}

.bubble {
  position: absolute;
  transform: translate(-50%, -120%);
  background: #fff;
  border: 3px solid #2a3038;
  border-radius: 12px;
  padding: 2px 8px;
  font-family: Fredoka, sans-serif;
  font-weight: 700;
  font-size: 14px;
  white-space: nowrap;
}

.overlay {
  position: absolute;
  inset: 0;
  z-index: 8;
  display: grid;
  place-items: center;
  background: #0006;
}

.overlay[hidden] { display: none; }

.card {
  width: min(320px, calc(100% - 32px));
  background: #fff;
  border: 4px solid #2a3038;
  border-radius: 18px;
  padding: 22px 20px 18px;
  text-align: center;
}

.ov-title {
  margin: 0 0 8px;
  font-family: Fredoka, sans-serif;
  font-size: 28px;
}

.ov-body {
  margin: 0 0 16px;
  font-weight: 700;
}

.ov-go {
  appearance: none;
  border: 0;
  background: #3dbe5a;
  color: #fff;
  font-family: Fredoka, sans-serif;
  font-size: 20px;
  font-weight: 700;
  padding: 10px 22px;
  border-radius: 999px;
  cursor: pointer;
}

.pad-tag {
  position: absolute;
  transform: translate(-50%, 8px);
  font-family: Fredoka, sans-serif;
  font-size: 12px;
  font-weight: 700;
  color: #fff;
  text-shadow: 0 1px 0 #0007;
  pointer-events: none;
  text-align: center;
  white-space: nowrap;
}

@media (max-width: 600px) {
  body.coil .hud { left: 64px; gap: 4px; flex-wrap: wrap; justify-content: flex-end; }
  body.coil .lvl { font-size: 12px; padding: 4px 7px; gap: 4px; }
  body.coil .coins { font-size: 16px; padding: 4px 8px; }
  body.coil .coins i { width: 18px; height: 18px; }
}

/* Keep play surfaces clear of controls on phones and short screens. */
canvas.view { top: 80px; bottom: 160px; height: calc(100% - 240px); }
body.curb canvas.view { bottom: 80px; height: calc(100% - 160px); }
.game-name { position:absolute; top:38px; left:12px; z-index:5; color:white; font-weight:800; }
button { cursor:pointer; touch-action:manipulation; font:inherit; }
button:disabled { cursor:default; opacity:.55; }
button:focus-visible, a:focus-visible, summary:focus-visible { outline:3px solid #ffdb4f; outline-offset:3px; }
.pause-banner { position:absolute; inset:80px 0 160px; display:grid; place-items:center; background:#17351bbd; color:white; font-size:22px; z-index:7; text-align:center; padding:20px; }
.pause-banner[hidden] { display:none; }
.hud { gap:5px; }
.hud .lvl { min-height:42px; }
.hint { bottom:16px; font-size:14px; }
body.till .hint { bottom:135px; }
body.coil .hint { bottom:119px; }
.status-strip { position:absolute; top:64px; left:8px; right:8px; z-index:5; text-align:center; color:white; font-size:13px; text-shadow:0 1px 3px #123; }
.station-actions { position:absolute; bottom:76px; left:10px; right:10px; display:flex; gap:6px; z-index:6; justify-content:center; }
.station-actions button { flex:1; max-width:180px; border:2px solid #28442e; border-radius:12px; min-height:54px; background:#fff7db; color:#203723; font-weight:800; }
.station-actions span { display:block; font-size:12px; font-weight:600; }
body.till .stick { width:62px; height:62px; bottom:8px; left:14px; }
body.till .stick .knob { width:30px; height:30px; margin:-15px 0 0 -15px; }
.upgrade-menu { position:absolute; right:14px; bottom:14px; z-index:7; }
.upgrade-menu summary { background:#ffda64; color:#253625; border:2px solid #28442e; border-radius:12px; padding:10px 18px; font-weight:800; cursor:pointer; }
.upgrade-menu[open] { padding:10px; background:#fff7db; border:2px solid #28442e; border-radius:14px; }
.upgrade-menu #upgrade-list { display:grid; grid-template-columns:1fr 1fr; gap:6px; margin-top:8px; }
.upgrade-menu button { min-height:44px; border:1px solid #61714f; border-radius:8px; background:white; padding:8px; }
.keyboard-only { display:none; }
.direction-pad { position:absolute; bottom:12px; left:50%; transform:translateX(-50%); display:grid; grid-template-columns:52px 52px 52px; gap:5px; z-index:6; }
.direction-pad button { height:46px; border:2px solid #25472e; border-radius:12px; background:#fff7db; color:#17351b; font-size:27px; font-weight:800; }
#steer-N { grid-column:2; }
#steer-W { grid-column:1; }
.practice-button { display:block; width:100%; margin-top:12px; min-height:44px; border:2px solid #305c3b; background:#edf6e7; color:#25472e; border-radius:12px; font-weight:800; }
.countdown { position:absolute; left:50%; top:46%; transform:translate(-50%,-50%); z-index:6; padding:14px 20px; background:#18381bee; color:white; border:2px solid white; border-radius:16px; font-size:24px; white-space:nowrap; pointer-events:none; }
.you-marker { position:absolute; z-index:4; color:#16351b; background:#fff; border:2px solid #176a33; padding:1px 5px; border-radius:8px; font-size:10px; font-weight:900; transform:translate(-50%,-100%); pointer-events:none; }
.countdown[hidden], .you-marker[hidden] { display:none; }
@media (max-width:600px) {
  .coins { font-size:17px; padding:5px 8px; gap:4px; }
  .coins i { width:22px; height:22px; }
  .hud .lvl { font-size:13px; padding:5px 8px; }
  body.coil .hud { max-width:calc(100% - 82px); }
  .pad-tag { font-size:10px; background:#234423aa; border-radius:5px; padding:2px 4px; }
  .bubble { font-size:12px; border-width:2px; padding:1px 5px; }
}
@media (max-height:560px) {
  canvas.view { top:58px; bottom:126px; height:calc(100% - 184px); }
  .status-strip { top:50px; }
  .station-actions { bottom:63px; }
  body.till .hint { bottom:120px; font-size:12px; }
  body.coil canvas.view { right:155px; bottom:15px; height:calc(100% - 73px); width:calc(100% - 155px); }
  .direction-pad { left:auto; right:8px; bottom:14px; transform:none; grid-template-columns:42px 42px 42px; }
  body.coil .hint { left:auto; right:10px; width:140px; bottom:122px; }
}

html, body { background:#304d32; }
.hint-button { position:absolute; left:12px; bottom:15px; z-index:6; min-height:44px; padding:8px 18px; border:2px solid #28442e; border-radius:12px; background:#ffda64; font-weight:800; }
body.curb .hint { left:100px; bottom:22px; }
.bus-label { position:absolute; z-index:6; background:#fff2a6; color:#203723; border:2px solid #28442e; border-radius:8px; padding:5px 8px; font-weight:900; font-size:12px; transform:translate(-50%,-120%); pointer-events:none; }
.bus-label[hidden] { display:none; }

.upgrade-help { max-width:260px; margin:8px 0; font-size:12px; line-height:1.4; }
