:root {
  --ink: #16222e;
  --paper: #fffaf0;
  --accent: #ffd23f;
  --accent-ink: #2a2100;
  --sky: #cfe9ff;
  --r: 18px;
  --shadow: 0 5px 0 var(--ink);
  --gut: 16px;
  --display: 'Bricolage Grotesque', 'Arial Black', system-ui, sans-serif;
  --text: 'Geist', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --mono: 'Geist Mono', ui-monospace, Consolas, monospace;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: var(--sky); color: var(--ink); font-family: var(--text); -webkit-tap-highlight-color: transparent; }
body { overscroll-behavior: none; }
#c { position: fixed; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; cursor: grab; }
#c:active { cursor: grabbing; }
button, a { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--ink); outline-offset: 3px; border-radius: 12px; }

/* top bar */
.top { position: fixed; z-index: 5; top: max(12px, env(safe-area-inset-top)); left: var(--gut); right: var(--gut); display: flex; align-items: center; justify-content: space-between; gap: 12px; pointer-events: none; }
.top > * { pointer-events: auto; }
.brand { display: flex; align-items: center; gap: 10px; padding: 5px 18px 5px 5px; background: var(--paper); border: 3px solid var(--ink); border-radius: 999px; box-shadow: 0 4px 0 var(--ink); min-width: 0; }
.logo { width: 44px; height: 44px; border-radius: 50%; border: 3px solid var(--ink); background: #bfc2c6; object-fit: cover; flex: none; }
.bt { display: flex; flex-direction: column; min-width: 0; line-height: 1.1; }
.bt b { font: 800 22px/1.05 var(--display); letter-spacing: -0.03em; }
.bt span { font-size: 12.5px; opacity: 0.78; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; padding-bottom: 1px; }
.chips { display: flex; gap: 8px; flex: none; }
.chip { display: inline-flex; align-items: center; justify-content: center; gap: 7px; min-height: 44px; padding: 0 16px; background: var(--paper); border: 3px solid var(--ink); border-radius: 999px; box-shadow: 0 4px 0 var(--ink); font: 600 14px/1 var(--text); text-decoration: none; cursor: pointer; white-space: nowrap; transition: transform 0.12s, box-shadow 0.12s; }
.chip .k { font: 600 12px/1 var(--mono); opacity: 0.6; }
.chip.mono .v { font-family: var(--mono); font-size: 13px; }
.chip:hover:not(.soon):not(:disabled) { transform: translateY(-2px); box-shadow: 0 6px 0 var(--ink); }
.chip:active:not(.soon):not(:disabled) { transform: translateY(3px); box-shadow: 0 1px 0 var(--ink); }
.chip.soon, .chip:disabled { opacity: 0.8; cursor: default; }
.chip.off { background: #e9e1cd; }

/* bottom HUD */
.hud { position: fixed; z-index: 5; left: var(--gut); right: var(--gut); bottom: max(16px, env(safe-area-inset-bottom)); display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; pointer-events: none; }
.hud > * { pointer-events: auto; }
.card { background: var(--paper); border: 3px solid var(--ink); border-radius: var(--r); box-shadow: var(--shadow); padding: 14px 18px 14px; }
.stats { display: grid; grid-template-columns: repeat(3, auto); gap: 6px 26px; width: min(460px, 100%); }
.stat { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.stat .n { font: 800 30px/1 var(--display); letter-spacing: -0.03em; font-variant-numeric: tabular-nums; }
.stat .l { font: 600 12px/1.15 var(--mono); letter-spacing: 0.05em; text-transform: uppercase; opacity: 0.7; }
.prog { grid-column: 1 / -1; margin-top: 8px; }
.bar { height: 14px; background: #e9e1cd; border: 3px solid var(--ink); border-radius: 999px; overflow: hidden; }
.bar i { display: block; height: 100%; width: 0; background: var(--accent); border-right: 3px solid var(--ink); transition: width 0.8s cubic-bezier(.2, .8, .2, 1); }
.bar i[style*="width: 0%"] { border-right: 0; }
.meta { display: flex; justify-content: space-between; gap: 10px; margin-top: 8px; font-size: 13px; }
.meta span:first-child { font: 600 12px/1.3 var(--mono); letter-spacing: 0.06em; opacity: 0.7; }
.meta b { font-weight: 700; }

.cta { display: inline-flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; min-height: 72px; padding: 12px 34px 12px; background: var(--accent); color: var(--accent-ink); border: 3px solid var(--ink); border-radius: 24px; box-shadow: 0 7px 0 var(--ink); cursor: pointer; transition: transform 0.12s, box-shadow 0.12s; flex: none; }
.cta span { font: 800 28px/1 var(--display); letter-spacing: -0.03em; white-space: nowrap; }
.cta small { font: 600 12.5px/1.2 var(--text); opacity: 0.75; }
.cta:hover { transform: translateY(-3px); box-shadow: 0 10px 0 var(--ink); }
.cta:active { transform: translateY(5px); box-shadow: 0 2px 0 var(--ink); }

.hint { position: fixed; z-index: 4; left: 50%; bottom: 8px; transform: translateX(-50%); margin: 0; font-size: 12.5px; opacity: 0.0; pointer-events: none; white-space: nowrap; }

/* floating words */
#pops { position: fixed; inset: 0; z-index: 4; pointer-events: none; overflow: hidden; }
.pop { position: absolute; transform: translate(-50%, -50%) rotate(var(--r, 0deg)); font: 800 clamp(30px, 4.4vw, 54px)/1 var(--display); color: #fff; letter-spacing: -0.02em; -webkit-text-stroke: 7px var(--ink); paint-order: stroke fill; text-shadow: 0 4px 0 var(--ink); white-space: nowrap; animation: pop 1s cubic-bezier(.2, 1.2, .3, 1) forwards; padding: 4px 8px; }
@keyframes pop { 0% { transform: translate(-50%, -30%) rotate(var(--r)) scale(0.2); opacity: 0; } 18% { transform: translate(-50%, -60%) rotate(var(--r)) scale(1.25); opacity: 1; } 60% { transform: translate(-50%, -90%) rotate(var(--r)) scale(1); opacity: 1; } 100% { transform: translate(-50%, -130%) rotate(var(--r)) scale(0.95); opacity: 0; } }

#banner { position: fixed; z-index: 6; left: 0; right: 0; top: 22%; display: flex; flex-direction: column; align-items: center; gap: 6px; pointer-events: none; opacity: 0; transform: scale(0.6); text-align: center; }
#banner .k { font: 600 14px/1 var(--mono); letter-spacing: 0.2em; padding: 8px 14px; background: var(--ink); color: var(--accent); border-radius: 999px; }
#banner .t { font: 800 clamp(48px, 10vw, 120px)/1 var(--display); color: var(--accent); letter-spacing: -0.04em; -webkit-text-stroke: 10px var(--ink); paint-order: stroke fill; text-shadow: 0 8px 0 var(--ink); padding: 6px 14px; }
#banner.show { animation: banner 2.6s cubic-bezier(.2, 1.1, .3, 1) forwards; }
@keyframes banner { 0% { opacity: 0; transform: scale(0.5); } 12% { opacity: 1; transform: scale(1.12); } 22% { transform: scale(1); } 80% { opacity: 1; transform: scale(1); } 100% { opacity: 0; transform: scale(1.1) translateY(-20px); } }

#toast { position: fixed; z-index: 7; left: 50%; bottom: 110px; transform: translate(-50%, 20px); padding: 12px 18px; background: var(--ink); color: #fff; border-radius: 999px; font: 600 14px/1 var(--text); opacity: 0; pointer-events: none; transition: 0.25s; }
#toast.show { opacity: 1; transform: translate(-50%, 0); }

#loading { position: fixed; inset: 0; z-index: 20; display: grid; place-items: center; background: var(--sky); transition: opacity 0.6s; }
#loading.hide { opacity: 0; pointer-events: none; }
.ld { display: flex; flex-direction: column; align-items: center; gap: 16px; font: 700 16px var(--text); }
.rk { width: 92px; height: 70px; background: #8d9094; border: 4px solid var(--ink); border-radius: 46% 46% 40% 40% / 58% 58% 42% 42%; position: relative; animation: bob 1.1s ease-in-out infinite; }
.rk::before, .rk::after { content: ''; position: absolute; top: 20px; width: 22px; height: 22px; background: #fff; border: 3px solid var(--ink); border-radius: 50%; }
.rk::before { left: 16px; } .rk::after { right: 16px; }
@keyframes bob { 50% { transform: translateY(-10px) scale(1.04, 0.96); } }

.dev { position: fixed; z-index: 9; left: 8px; top: 74px; display: flex; flex-wrap: wrap; gap: 4px; max-width: 300px; padding: 8px; background: #fffa; border: 2px solid var(--ink); border-radius: 12px; }
.dev button { min-height: 30px; padding: 0 8px; font-size: 12px; }
.dev input { width: 100%; }
body.promo .top, body.promo .hud, body.promo .hint, body.promo #pops, body.promo #banner, body.promo #loading { display: none !important; }

/* ---------- mobile: separate layout, not a shrunken desktop ---------- */
@media (max-width: 760px) {
  :root { --gut: 12px; }
  .top { flex-wrap: wrap; justify-content: flex-start; gap: 8px; }
  .brand { padding-right: 14px; }
  .bt span { display: none; }
  .chips { gap: 6px; margin-left: auto; }
  .chip { min-height: 44px; padding: 0 12px; font-size: 13px; }
  .chip .k { display: none; }
  .hud { flex-direction: column-reverse; align-items: stretch; gap: 12px; }
  .stats { width: 100%; padding: 12px 14px; gap: 4px 14px; grid-template-columns: repeat(3, 1fr); }
  .stat .n { font-size: 24px; }
  .stat .l { font-size: 12px; }
  .cta { width: 100%; min-height: 64px; border-radius: 22px; }
  .cta span { font-size: 26px; }
  #toast { bottom: 190px; }
}
@media (max-width: 400px) {
  .chip#sound .v { display: none; }
  .chip#sound::before { content: '♪'; font-size: 16px; }
}
@media (min-width: 761px) and (max-height: 560px) {
  .stats { padding: 10px 14px; } .stat .n { font-size: 24px; }
}
@media (hover: none) { .hint { display: none; } }
