:root {
  /* start.ng's palette. --accent is replaced by the player's own start.ng top colour. */
  --ink: #292a23;
  --paper: #fffefa;
  --cream: #f6f5ee;
  --lime: #d8fd71;
  --accent: #d8fd71;
  --accent-ink: #292a23;
  --muted: #6d6c62;
  --danger: #e5484d;
  font-family: ui-rounded, "SF Pro Rounded", "Nunito", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color: var(--ink);
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: #f3d9a4; }
[hidden] { display: none !important; }
button { font: inherit; }

#scene { position: fixed; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; }

/* ---- player card (start.ng's profile card) */
.card {
  position: fixed; top: max(12px, env(safe-area-inset-top)); left: 12px;
  display: flex; align-items: center; gap: 10px;
  padding: 6px 14px 6px 6px; border-radius: 999px;
  background: var(--ink); color: var(--paper);
  box-shadow: 0 6px 18px rgba(41, 42, 35, .25);
  max-width: calc(100vw - 24px);
}
.face {
  width: 42px; height: 42px; border-radius: 50%; flex: none;
  background: var(--accent) center / cover no-repeat;
  box-shadow: 0 0 0 3px var(--accent);
  display: grid; place-items: center; font-weight: 800; color: var(--accent-ink);
}
.who { min-width: 0; }
.who b { display: block; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.who span { display: block; font-size: 12px; opacity: .7; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chip {
  margin-left: 4px; border: 0; border-radius: 999px; padding: 6px 12px;
  background: var(--lime); color: var(--ink); font-weight: 800; cursor: pointer; flex: none;
}

/* ---- in-game HUD */
.hud {
  position: fixed; top: max(12px, env(safe-area-inset-top)); right: 12px;
  display: flex; align-items: center; gap: 8px; pointer-events: none;
}
.stat, .lives {
  display: flex; align-items: baseline; gap: 6px;
  padding: 8px 12px; border-radius: 14px; background: rgba(255, 254, 250, .92);
  box-shadow: 0 4px 12px rgba(41, 42, 35, .15);
}
.stat b { font-size: 20px; font-variant-numeric: tabular-nums; }
.stat .label { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.coin-dot { width: 12px; height: 12px; border-radius: 50%; background: #f5b82e; box-shadow: inset 0 -2px 0 #c98a12; align-self: center; }
.lives { align-items: center; gap: 4px; }
.heart { width: 16px; height: 16px; background: var(--danger); clip-path: path("M8 15 L1.5 8.5 A3.9 3.9 0 0 1 8 3 A3.9 3.9 0 0 1 14.5 8.5 Z"); }
.heart.lost { background: #d6d3c6; }

.pause {
  position: fixed; bottom: max(14px, env(safe-area-inset-bottom)); right: 14px;
  width: 44px; height: 44px; border-radius: 50%; border: 0;
  background: rgba(41, 42, 35, .85); color: var(--paper); font-weight: 900; letter-spacing: -1px; cursor: pointer;
}

.toast {
  position: fixed; top: 76px; left: 50%; transform: translateX(-50%);
  padding: 8px 14px; border-radius: 999px; background: var(--ink); color: var(--paper);
  font-weight: 700; font-size: 14px; pointer-events: none; white-space: nowrap;
  animation: pop .25s ease-out;
}
@keyframes pop { from { transform: translate(-50%, -6px); opacity: 0; } }

/* ---- touch stick */
.stick {
  position: fixed; width: 110px; height: 110px; margin: -55px 0 0 -55px; border-radius: 50%;
  background: rgba(41, 42, 35, .18); border: 2px solid rgba(255, 254, 250, .6); pointer-events: none;
}
.knob {
  position: absolute; left: 50%; top: 50%; width: 46px; height: 46px; margin: -23px 0 0 -23px;
  border-radius: 50%; background: var(--accent); box-shadow: 0 2px 8px rgba(0, 0, 0, .25);
}

/* ---- overlay screens */
.overlay {
  position: fixed; inset: 0; display: grid; place-items: center; padding: 16px;
  background: linear-gradient(180deg, rgba(41, 42, 35, .15), rgba(41, 42, 35, .45));
  overflow-y: auto;
}
.panel {
  width: min(440px, 100%); padding: 24px 22px 20px; border-radius: 24px;
  background: var(--paper); box-shadow: 0 20px 50px rgba(41, 42, 35, .3);
  text-align: center;
  border-top: 8px solid var(--accent);
}
.kicker { margin: 0 0 4px; font-size: 13px; color: var(--muted); }
.kicker b span { color: #7a9a12; }
h1 { margin: 0 0 8px; font-size: clamp(30px, 8vw, 40px); line-height: 1; letter-spacing: -.02em; }
#message { margin: 0 auto 16px; max-width: 34ch; color: #45463d; line-height: 1.45; }
.result { display: flex; justify-content: center; gap: 10px; margin: 0 0 14px; flex-wrap: wrap; }
.result div { padding: 10px 14px; border-radius: 14px; background: var(--cream); min-width: 92px; }
.result b { display: block; font-size: 24px; font-variant-numeric: tabular-nums; }
.result span { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.result p { flex-basis: 100%; margin: 4px 0 0; font-size: 14px; font-weight: 700; }
.buttons { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; }
.btn {
  border: 0; border-radius: 999px; padding: 12px 26px; cursor: pointer;
  background: var(--ink); color: var(--paper); font-weight: 800; font-size: 16px;
}
.btn:hover { filter: brightness(1.15); }
.btn.ghost { background: var(--lime); color: var(--ink); }
.howto { margin: 14px 0 0; font-size: 12px; color: var(--muted); }

.board { margin-top: 16px; text-align: left; border-top: 1px solid #e8e6da; padding-top: 12px; }
.board h2 { margin: 0 0 8px; font-size: 14px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
.board ol { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.board li {
  display: grid; grid-template-columns: 26px 12px 1fr auto auto; gap: 8px; align-items: center;
  padding: 6px 10px; border-radius: 10px; font-size: 14px;
}
.board li.me { background: var(--cream); font-weight: 800; }
.board .rank { color: var(--muted); font-variant-numeric: tabular-nums; }
.board .dot { width: 10px; height: 10px; border-radius: 50%; }
.board .nm { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.board .num { font-variant-numeric: tabular-nums; }
.board .empty { color: var(--muted); font-size: 14px; padding: 4px 10px; }

body.cover .card, body.cover .hud, body.cover .pause, body.cover .overlay { display: none !important; }

.cover-title {
  position: fixed; left: 5%; bottom: 7%; padding: 22px 34px 24px; border-radius: 28px;
  background: var(--ink); color: var(--paper); box-shadow: 0 18px 40px rgba(41, 42, 35, .35);
  border-left: 14px solid var(--accent);
}
.cover-title b { display: block; font-size: 92px; line-height: 1; letter-spacing: -.03em; }
.cover-title span { display: block; margin-top: 8px; font-size: 32px; color: var(--lime); font-weight: 700; }

@media (max-width: 560px) {
  .hud { top: calc(max(12px, env(safe-area-inset-top)) + 62px); left: 12px; right: auto; }
  .stat, .lives { padding: 6px 10px; }
  .stat b { font-size: 17px; }
}
