:root {
  --sky: #bfeaff;
  --sand: #f6dc9a;
  --sea: #3fa9e0;
  --ink: #2b2340;
  --muted: #5a5375;
  --card: #ffffff;
  --go: #2f9e44;
  --go-dark: #237a34;
  --seek: #e8590c;
  --seek-dark: #b8460a;
  --line: #2b2340;
  --sun: #ffd93d;
}
* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0; display: flex; flex-direction: column; min-height: 100%;
  background: linear-gradient(180deg, var(--sky) 0%, var(--sky) 55%, var(--sea) 55%, var(--sea) 62%, var(--sand) 62%) fixed;
  color: var(--ink);
  font-family: Fredoka, ui-rounded, "Arial Rounded MT Bold", system-ui, sans-serif;
  font-weight: 500;
  -webkit-tap-highlight-color: transparent;
}
a { color: var(--ink); text-underline-offset: 3px; }
button, input { font: inherit; color: inherit; }
:focus-visible { outline: 4px solid var(--ink); outline-offset: 3px; }

/* Every game: a way back to the others, and who's signed in. */
.bar {
  display: flex; justify-content: space-between; align-items: center; gap: 16px;
  padding: 8px 16px; padding-top: max(8px, env(safe-area-inset-top));
  background: rgba(255, 255, 255, 0.6); font-size: 15px;
  position: relative; z-index: 5;
}
.bar .home { color: var(--muted); text-decoration: none; }
.bar .home:hover { color: var(--ink); }
.bar .account { color: var(--muted); text-align: right; }
.bar .account strong { color: var(--ink); }

main { flex: 1; display: flex; position: relative; }
.screen {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 16px; padding: 24px 16px calc(24px + env(safe-area-inset-bottom)); text-align: center;
}
.screen[hidden] { display: none; }

h1 {
  font-size: clamp(48px, 13vw, 96px); line-height: 1; margin: 0; font-weight: 700;
  color: #fff; -webkit-text-stroke: 3px var(--ink); paint-order: stroke fill;
  text-shadow: 0 6px 0 var(--ink);
}
h1 span { color: #4dd4c6; }
h2 { font-size: clamp(26px, 6vw, 36px); margin: 0; font-weight: 700; }
.lead { font-size: 20px; margin: 0; color: var(--muted); }
.hello { font-size: 26px; margin: 0; font-weight: 600; }
.error { color: #c92a2a; font-size: 18px; min-height: 1.4em; margin: 0; font-weight: 600; }

.buttons { display: flex; flex-wrap: wrap; justify-content: center; gap: 14px; }
.big {
  border: 3px solid var(--line); border-radius: 22px; background: var(--card);
  font-size: 24px; font-weight: 600; padding: 14px 26px; min-height: 64px; cursor: pointer;
  box-shadow: 0 5px 0 var(--line); transition: transform 0.08s;
}
.big:active { transform: translateY(4px); box-shadow: 0 1px 0 var(--line); }
.big.go { background: var(--go); color: #fff; }
.big.seek { background: var(--seek); }
.big:disabled { opacity: 0.45; cursor: default; transform: none; }
.small {
  border: 2px solid var(--muted); border-radius: 14px; background: transparent;
  color: var(--muted); font-size: 17px; padding: 8px 18px; cursor: pointer;
}

.name, .join { display: flex; flex-direction: column; align-items: center; gap: 8px; font-size: 20px; }
.join .row { display: flex; gap: 10px; }
input {
  border: 3px solid var(--line); border-radius: 18px; background: #fff;
  font-size: 26px; padding: 10px 16px; width: min(320px, 80vw); text-align: center;
}
#code { width: 150px; letter-spacing: 6px; }
.lead { max-width: 560px; }

.code {
  font-size: clamp(64px, 20vw, 110px); font-weight: 700; letter-spacing: 10px; margin: 0;
  background: #fff; border: 4px solid var(--line); border-radius: 28px; padding: 4px 28px 4px 38px;
}

.players { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; }
.players li {
  background: #fff; border: 3px solid var(--line); border-radius: 18px; padding: 6px 14px; font-size: 20px; font-weight: 600;
}
.players .away { color: var(--muted); }
.dot {
  display: inline-block; width: 16px; height: 16px; border-radius: 50%;
  border: 2px solid var(--line); vertical-align: -2px; margin-right: 6px;
}
.how {
  list-style: none; margin: 0; padding: 12px 18px; text-align: left; font-size: 18px;
  background: rgba(255, 255, 255, 0.85); border: 3px solid var(--line); border-radius: 20px; max-width: 520px;
}
.how li { margin: 4px 0; }

/* The game: the 3D world fills the screen, with big friendly overlays. */
.screen.game { padding: 0; position: relative; overflow: hidden; }
#world { position: absolute; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; }
.hud {
  position: absolute; top: 8px; left: 50%; transform: translateX(-50%);
  width: min(720px, calc(100% - 16px)); pointer-events: none;
  display: flex; flex-direction: column; align-items: center; gap: 6px;
}
.scores { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; }
.chip {
  background: #fff; border: 3px solid var(--line); border-radius: 16px; padding: 3px 10px;
  font-size: clamp(14px, 3.6vw, 19px); font-weight: 600; white-space: nowrap; box-shadow: 0 3px 0 var(--line);
}
.chip.me { background: #fff6c4; }
.chip.out { opacity: 0.7; }
.chip.clock { background: var(--sun); }
.pearl {
  display: inline-block; width: 0.85em; height: 0.85em; border-radius: 50%; vertical-align: -0.08em;
  background: radial-gradient(circle at 35% 30%, #fff 0 25%, #ece6f5 45%, #c9bfdc 100%); border: 2px solid var(--line);
}
.banner {
  margin: 0; background: #fff; border: 3px solid var(--line); border-radius: 20px;
  padding: 8px 16px; font-size: clamp(18px, 4.4vw, 24px); font-weight: 600; box-shadow: 0 4px 0 var(--line);
}
.banner[hidden] { display: none; }
.bubble {
  position: absolute; left: 50%; top: 24%; transform: translate(-50%, -50%);
  margin: 0; background: #fff; border: 4px solid var(--line); border-radius: 30px;
  padding: 12px 26px; font-size: clamp(30px, 8vw, 46px); font-weight: 700; pointer-events: none;
  animation: pop 0.3s ease-out;
}
@keyframes pop { from { transform: translate(-50%, -50%) scale(0.4); } }
.shell {
  position: absolute; bottom: calc(22px + env(safe-area-inset-bottom)); left: 50%; transform: translateX(-50%);
  border: 4px solid var(--line); border-radius: 50px; background: #ff8fc7;
  font-size: clamp(22px, 5vw, 28px); font-weight: 700; padding: 12px 28px; box-shadow: 0 6px 0 var(--line); cursor: pointer;
  white-space: nowrap;
}
.shell.ready { animation: glow 0.8s ease-in-out infinite alternate; }
@keyframes glow { to { background: #ffd93d; } }
.shell:active { transform: translate(-50%, 4px); box-shadow: 0 2px 0 var(--line); }
.sound {
  position: absolute; right: 12px; bottom: calc(14px + env(safe-area-inset-bottom));
  width: 52px; height: 52px; border-radius: 50%; border: 3px solid var(--line); background: #fff;
  font-size: 24px; cursor: pointer;
}
.quit { right: auto; left: 12px; }
.storm {
  position: absolute; left: 50%; top: 52%; transform: translate(-50%, -50%); pointer-events: none;
  margin: 0; text-align: center; color: #fff; font-size: clamp(24px, 6vw, 36px); font-weight: 700;
  -webkit-text-stroke: 2px var(--ink); paint-order: stroke fill;
}
.storm p { margin: 0; }
.storm .number { font-size: clamp(110px, 32vw, 200px); line-height: 1; -webkit-text-stroke: 5px var(--ink); }
.over {
  position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 10px; padding: 16px; text-align: center; font-size: 22px; background: rgba(191, 234, 255, 0.7); overflow: auto;
}
.eyes { font-size: 80px; margin: 0; line-height: 1; }
.over h2 { font-size: clamp(40px, 11vw, 66px); color: #fff; -webkit-text-stroke: 3px var(--ink); paint-order: stroke fill; }
.over > p:not(.eyes) { margin: 0; background: #fff; border: 3px solid var(--line); border-radius: 18px; padding: 6px 18px; }
.table {
  margin: 0; padding: 8px 18px 8px 40px; background: #fff; border: 3px solid var(--line); border-radius: 18px;
  text-align: left; min-width: min(360px, 90vw);
}
.table li { margin: 4px 0; }
.storm[hidden], .over[hidden], .bubble[hidden], .shell[hidden] { display: none; }

@media (prefers-reduced-motion: reduce) {
  .bubble, .shell.ready { animation: none; }
}

/* Buy me a coffee: the same badge on every game (see ADDING_A_GAME.md in mrkyle7/cheetahmoongames). */
.bmc {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 12px; border-radius: 999px;
  background: #ffdd00; color: #0d0c22;
  font: 600 14px/1.2 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  text-decoration: none; white-space: nowrap;
}
.bmc:hover { background: #ffe74d; }
.bmc:focus-visible { outline: 3px solid #fff; outline-offset: 2px; }
.bmc svg { width: 18px; height: 18px; flex: none; }
.bmc-row { margin: 24px 0 0; text-align: center; }
