:root {
  --sky: #7cc9f0;
  --ink: #1d2b3a;
  --panel: rgba(255, 255, 255, 0.94);
  --muted: #5b6b7c;
  --accent: #ff8a3d;
  --accent2: #3db3ff;
  --danger: #ff4d4f;
  --chip: rgba(255, 255, 255, 0.85);
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }
html, body { margin: 0; height: 100%; overflow: hidden; background: var(--sky); color: var(--ink);
  font: 15px/1.45 system-ui, -apple-system, 'Apple SD Gothic Neo', 'Noto Sans KR', sans-serif; }
canvas { position: fixed; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; }
button { font: inherit; cursor: pointer; }

#top { position: fixed; top: calc(8px + env(safe-area-inset-top)); left: 10px; right: 200px; display: flex; gap: 6px;
  align-items: center; flex-wrap: wrap; pointer-events: none; z-index: 5; }
#top .logo { background: var(--chip); padding: 4px 10px; border-radius: 10px; box-shadow: 0 2px 0 rgba(0,0,0,.12); }
.pill { background: var(--chip); padding: 3px 10px; border-radius: 99px; font-size: 13px; box-shadow: 0 2px 0 rgba(0,0,0,.12); }
.pill[data-ready='1'] { background: #4fd18b; color: #fff; }
.pill.btn { pointer-events: auto; border: 0; }

.overlay { position: fixed; inset: 0; display: grid; place-items: center; padding: 16px; z-index: 10;
  background: rgba(124, 201, 240, 0.35); backdrop-filter: blur(3px); }
.panel { width: min(440px, 100%); background: var(--panel); border-radius: 18px; padding: 20px;
  box-shadow: 0 6px 0 rgba(0,0,0,.15), 0 20px 40px rgba(0,0,0,.15); }
.panel h1 { margin: 0 0 4px; font-size: 24px; }
.sub { color: var(--muted); margin: 0 0 14px; }
.field { display: grid; gap: 6px; font-weight: 600; }
.field input { padding: 10px 12px; border-radius: 10px; border: 2px solid #d5e1ec; font: inherit; }
.avatars { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin: 14px 0; }
.avatars button { border: 2px solid #d5e1ec; background: #fff; border-radius: 12px; padding: 6px 0 4px; font-size: 26px; line-height: 1.1; }
.avatars button small { display: block; font-size: 11px; color: var(--muted); }
.avatars button[aria-checked='true'] { border-color: var(--accent); background: #fff4ea; box-shadow: 0 3px 0 var(--accent); }
.actions { display: flex; gap: 8px; }
.actions button { flex: 1; padding: 12px; border-radius: 12px; border: 0; background: #e8eef4; font-weight: 700; box-shadow: 0 3px 0 rgba(0,0,0,.15); }
.actions .primary { background: var(--accent); color: #fff; }
.hint { color: var(--muted); font-size: 12px; margin: 12px 0 0; }

.pill.stage { background: #fff3c4; font-weight: 700; }
.viewctl { position: fixed; top: calc(8px + env(safe-area-inset-top)); right: 10px; display: flex; gap: 4px; z-index: 7; }
.viewctl button { width: 34px; height: 34px; border: 0; border-radius: 10px; background: var(--chip); font-size: 17px;
  box-shadow: 0 2px 0 rgba(0,0,0,.15); }
.viewctl button:active { transform: translateY(2px); box-shadow: none; }
body:has(#side:not([hidden])) .viewctl { right: 280px; }
@media (max-width: 760px) { body:has(#side:not([hidden])) .viewctl { right: 10px; } }
.banner { position: fixed; left: 50%; top: 22%; transform: translateX(-50%); z-index: 8; pointer-events: none;
  background: linear-gradient(#ffe066, #ffb703); color: #3a2400; font-weight: 900; font-size: 24px; text-align: center;
  padding: 12px 22px; border-radius: 16px; box-shadow: 0 5px 0 rgba(0,0,0,.2); white-space: nowrap; }
.banner small { display: block; font-size: 14px; font-weight: 700; }
#hud { position: fixed; inset: 0; pointer-events: none; z-index: 4; }
.stats { position: fixed; top: calc(80px + env(safe-area-inset-top)); left: 10px; display: flex; gap: 6px; flex-wrap: wrap; }
.stats span { background: var(--chip); border-radius: 10px; padding: 3px 10px; font-size: 14px; box-shadow: 0 2px 0 rgba(0,0,0,.12); }
.stats b { font-variant-numeric: tabular-nums; }
.joy { position: fixed; left: calc(22px + env(safe-area-inset-left)); bottom: calc(26px + env(safe-area-inset-bottom));
  width: 136px; height: 136px; border-radius: 50%; background: rgba(255,255,255,.35); border: 3px solid rgba(255,255,255,.75);
  pointer-events: auto; touch-action: none; }
.knob { position: absolute; left: 50%; top: 50%; width: 58px; height: 58px; margin: -29px 0 0 -29px; border-radius: 50%;
  background: #fff; box-shadow: 0 3px 0 rgba(0,0,0,.2); }
.buttons { position: fixed; right: calc(18px + env(safe-area-inset-right)); bottom: calc(26px + env(safe-area-inset-bottom));
  display: flex; gap: 14px; align-items: flex-end; }
.act { pointer-events: auto; touch-action: none; border: 0; border-radius: 50%; color: #fff; font-size: 28px; line-height: 1;
  display: grid; place-items: center; box-shadow: 0 5px 0 rgba(0,0,0,.25); user-select: none; -webkit-user-select: none; }
.act small { font-size: 11px; font-weight: 700; margin-top: -4px; }
.act:active, .act.on { transform: translateY(3px); box-shadow: 0 2px 0 rgba(0,0,0,.25); }
.jump { width: 92px; height: 92px; background: var(--accent2); }
.mine { width: 70px; height: 70px; background: #555e6b; }
.mine:disabled { opacity: .45; }
@media (hover: hover) and (pointer: fine) { .joy, .buttons { opacity: .55; } }

.dead { position: fixed; inset: 0; display: grid; place-content: center; text-align: center; z-index: 6; pointer-events: none;
  color: #fff; text-shadow: 0 3px 0 rgba(0,0,0,.35); font-weight: 800; font-size: 22px; background: rgba(40, 0, 0, .25); }
.dead .big { font-size: 64px; }
.dead .sub { color: #fff; font-size: 16px; }

#side { position: fixed; right: 12px; top: 56px; bottom: 12px; width: 250px; background: var(--panel); border-radius: 16px;
  padding: 12px 14px; overflow: auto; z-index: 4; box-shadow: 0 4px 0 rgba(0,0,0,.12); }
#side h2 { font-size: 15px; margin: 4px 0 6px; }
#rank { margin: 0 0 10px; padding-left: 22px; }
#rank li { padding: 2px 0; display: flex; gap: 6px; }
#rank li .n { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#rank li b { font-variant-numeric: tabular-nums; }
#feed { list-style: none; margin: 0; padding: 0; font-size: 13px; }
#feed li { padding: 3px 0; border-top: 1px solid #e5edf4; }
.joinbox { text-align: center; padding: 4px 0 10px; border-bottom: 1px solid #e5edf4; margin-bottom: 8px; }
.joinbox img { width: 100%; max-width: 200px; height: auto; aspect-ratio: 1; display: block; margin: 0 auto 6px; border-radius: 10px; }
.joinbox p { margin: 0; font-size: 13px; font-weight: 600; }
.joinbox code { font-size: 15px; color: var(--accent); }
@media (max-width: 760px) { #side { display: none; } }
