:root { --y: #f6c514; --yd: #c99a00; --ink: #1d1a14; --red: #e0352b; --blue: #2a6fd6; }
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; overflow: hidden; background: #0b0d14; color: #fff;
  font-family: "Pretendard", "Apple SD Gothic Neo", "Noto Sans KR", system-ui, sans-serif;
  touch-action: none; user-select: none; -webkit-user-select: none; position: fixed; inset: 0; }
canvas#c { position: fixed; inset: 0; width: 100%; height: 100%; display: block; }
button { font: inherit; cursor: pointer; border: 0; }
[hidden] { display: none !important; }

.big { display: block; width: 100%; padding: 16px 18px; border-radius: 16px; font-size: 19px; font-weight: 800;
  background: var(--y); color: var(--ink); box-shadow: 0 5px 0 var(--yd), 0 10px 24px rgba(0,0,0,.35); }
.big:active { transform: translateY(3px); box-shadow: 0 2px 0 var(--yd); }
.big.y { background: #fff; box-shadow: 0 5px 0 #c8c8c8, 0 10px 24px rgba(0,0,0,.3); }
.ghost { background: rgba(0,0,0,.35); color: #fff; padding: 9px 14px; border-radius: 999px; font-size: 14px;
  border: 1px solid rgba(255,255,255,.25); }

/* belt chip */
.bdot { display: inline-block; width: 26px; height: 9px; border-radius: 3px; background: #f4f4f0;
  box-shadow: inset 0 0 0 1px rgba(0,0,0,.35); vertical-align: middle; }
.bname { margin: 0 6px; }
.stamps { letter-spacing: 1px; font-size: 14px; }

/* title */
#title { position: fixed; inset: 0; display: grid; place-items: end center; padding: 0 20px calc(28px + env(safe-area-inset-bottom));
  background: linear-gradient(180deg, rgba(8,10,18,0) 30%, rgba(8,10,18,.82) 62%); z-index: 20; }
.t-inner { width: min(400px, 100%); text-align: center; }
.t-van { font-size: 46px; animation: vanbob 1.4s ease-in-out infinite; }
@keyframes vanbob { 50% { transform: translateY(-5px); } }
h1 { margin: 2px 0 2px; font-size: 54px; font-weight: 900; letter-spacing: -2px; color: #fff;
  text-shadow: 0 4px 0 #000, 0 0 30px rgba(246,197,20,.35); }
h1 span { color: var(--y); }
.t-sub { margin: 0 0 14px; opacity: .85; font-size: 15px; }
.t-name { display: flex; justify-content: center; margin-bottom: 10px; }
.t-name input { width: 180px; font: inherit; font-size: 17px; padding: 8px 10px; border-radius: 10px; border: 0;
  text-align: center; background: rgba(255,255,255,.12); color: #fff; outline: 1px solid rgba(255,255,255,.25); }
.t-belt { margin: 0 0 14px; font-size: 15px; font-weight: 700; }
.t-mic { display: flex; align-items: center; justify-content: center; gap: 8px; margin-top: 12px; font-size: 14px; font-weight: 700; cursor: pointer; }
.t-mic small { opacity: .7; font-weight: 500; }
.t-mic input { display: none; }
.t-mic .sw { width: 40px; height: 22px; border-radius: 11px; background: rgba(255,255,255,.22); position: relative; transition: background .2s; }
.t-mic .sw::after { content: ""; position: absolute; left: 3px; top: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: left .2s; }
.t-mic input:checked + .sw { background: var(--y); }
.t-mic input:checked + .sw::after { left: 21px; }
.go-row { display: flex; gap: 10px; align-items: stretch; }
.go-row #go { flex: 1.6; }
#go-skip { flex: 1; font-size: 13px; line-height: 1.25; padding: 8px 6px; }
#gate { margin-top: 26px; }
.gate-m { position: relative; height: 22px; border-radius: 11px; background: rgba(255,255,255,.14); overflow: visible; border: 1px solid rgba(255,255,255,.2); }
.gate-m i { position: absolute; left: 0; top: 0; bottom: 0; width: 0; border-radius: 11px; background: linear-gradient(90deg, #2a6fd6, #3db86a 45%, #f6c514 70%, #e0352b); transition: width .06s linear; }
.gate-m .cut { position: absolute; top: -6px; bottom: -6px; width: 4px; margin-left: -2px; background: #fff; border-radius: 2px; box-shadow: 0 0 8px rgba(255,255,255,.8); }
.gate-m .cutl { position: absolute; top: -22px; transform: translateX(-50%); font-size: 11px; font-weight: 800; color: #fff; white-space: nowrap; }
#gate-t { margin-top: 8px; font-size: 14px; font-weight: 800; }
#gate.live #gate-t { color: var(--y); animation: gpulse .8s ease-in-out infinite; }
#gate.pass .gate-m i { background: var(--y); }
@keyframes gpulse { 50% { opacity: .55; } }
.t-foot { margin: 10px 0 0; font-size: 12px; opacity: .6; }
#gender { display: flex; gap: 8px; justify-content: center; margin: 0 0 10px; }
#gender button { min-width: 92px; padding: 8px 14px; border-radius: 999px; font-size: 15px; font-weight: 800; background: rgba(255,255,255,.12); color: #fff; border: 1px solid rgba(255,255,255,.25); }
#gender button.on { background: var(--y); color: var(--ink); border-color: var(--y); }
#name-chips { display: flex; gap: 6px; justify-content: center; margin: -2px 0 12px; flex-wrap: wrap; }
#name-chips button { background: rgba(255,255,255,.14); color: #fff; padding: 6px 11px; border-radius: 999px; font-size: 13px; border: 1px solid rgba(255,255,255,.22); }
#name-chips button:active { background: var(--y); color: var(--ink); }
#invite { margin: 0 0 12px; padding: 10px 12px; border-radius: 12px; background: rgba(246,197,20,.16);
  border: 1px solid rgba(246,197,20,.5); font-size: 14px; }

/* hud */
#hud { position: fixed; left: 0; right: 0; top: 0; display: flex; justify-content: space-between; align-items: center;
  padding: calc(10px + env(safe-area-inset-top)) 12px 0; z-index: 10; pointer-events: none; }
#hud > * { pointer-events: auto; }
.belt-chip { background: rgba(0,0,0,.45); padding: 7px 12px; border-radius: 999px; font-size: 14px; font-weight: 700; }

/* caption */
#cap { position: fixed; left: 50%; top: calc(58px + env(safe-area-inset-top)); transform: translateX(-50%);
  width: min(92vw, 520px); text-align: center; font-size: 16px; font-weight: 700; z-index: 9; pointer-events: none;
  text-shadow: 0 2px 6px #000; opacity: 0; transition: opacity .3s; }
#cap.on { opacity: 1; }

/* speech bubbles */
#bubbles { position: fixed; inset: 0; pointer-events: none; z-index: 8; }
.bub { position: absolute; transform: translate(-50%, -100%); width: max-content; max-width: min(72vw, 300px); background: #fff; color: var(--ink);
  padding: 9px 13px; border-radius: 16px; font-size: 15px; font-weight: 700; line-height: 1.35; text-align: center;
  box-shadow: 0 6px 18px rgba(0,0,0,.35); animation: bubin .22s ease-out; }
.bub::after { content: ""; position: absolute; left: 50%; bottom: -8px; margin-left: -8px; border: 8px solid transparent;
  border-top-color: #fff; border-bottom: 0; }
.bub .who { display: block; font-size: 11px; color: #8a7a40; margin-bottom: 1px; }
.bub.y { background: var(--y); } .bub.y::after { border-top-color: var(--y); }
@keyframes bubin { from { transform: translate(-50%, -88%) scale(.85); opacity: 0; } }

/* action area */
#act { position: fixed; left: 0; right: 0; bottom: 0; padding: 12px 16px calc(18px + env(safe-area-inset-bottom)); z-index: 12;
  display: flex; flex-direction: column; align-items: center; gap: 10px;
  background: linear-gradient(180deg, rgba(0,0,0,0), rgba(0,0,0,.6) 40%); }
#act-title { font-size: 17px; font-weight: 800; text-align: center; text-shadow: 0 2px 6px #000; }
#act-body { width: min(440px, 100%); display: flex; flex-direction: column; align-items: center; gap: 10px; }
.row { display: flex; gap: 10px; width: 100%; justify-content: center; }
.pad { flex: 1; max-width: 120px; height: 86px; border-radius: 20px; background: #fff; color: var(--ink); font-size: 30px;
  font-weight: 900; box-shadow: 0 6px 0 #bbb; display: grid; place-items: center; line-height: 1; }
.pad small { display: block; font-size: 12px; font-weight: 700; margin-top: 4px; }
.pad:active, .pad.hit { transform: translateY(4px); box-shadow: 0 2px 0 #bbb; background: var(--y); }
.pad.red { background: #fff3f2; }
.pad.lit { background: var(--y); box-shadow: 0 6px 0 var(--yd), 0 0 24px rgba(246,197,20,.9); transform: scale(1.08); }
.pad.wrong { background: #ffb3ad; }
.kihap { width: 100%; height: 96px; border-radius: 22px; background: var(--red); color: #fff; font-size: 38px; font-weight: 900;
  box-shadow: 0 7px 0 #8d1d17; letter-spacing: 4px; }
.kihap:active, .kihap.hit { transform: translateY(5px); box-shadow: 0 2px 0 #8d1d17; }
.meter { width: 100%; height: 16px; border-radius: 9px; background: rgba(255,255,255,.18); overflow: hidden; position: relative; }
.meter i { position: absolute; left: 0; top: 0; bottom: 0; width: 0; background: linear-gradient(90deg, #2a6fd6, #f6c514, #e0352b); }
.meter b { position: absolute; top: -3px; bottom: -3px; width: 4px; background: #fff; border-radius: 2px; }
.score { font-size: 15px; font-weight: 800; opacity: .9; }
.seq { display: flex; gap: 8px; justify-content: center; min-height: 54px; }
.seq span { width: 50px; height: 50px; border-radius: 12px; background: rgba(255,255,255,.15); display: grid; place-items: center;
  font-size: 26px; transition: transform .15s, background .15s; }
.seq span.on { background: var(--y); transform: scale(1.12); }
.seq span.ok { background: #3db86a; } .seq span.ng { background: var(--red); }

/* timing ring for kicks */
#ring { position: fixed; left: 50%; top: 44%; width: 0; height: 0; z-index: 11; pointer-events: none; }
#ring .r { position: absolute; left: 0; top: 0; border-radius: 50%; transform: translate(-50%, -50%); }
#ring .outer { border: 5px solid #fff; box-shadow: 0 0 18px rgba(255,255,255,.6); }
#ring .inner { width: 86px; height: 86px; border: 3px dashed rgba(246,197,20,.95); display: grid; place-items: center;
  font-size: 40px; font-weight: 900; color: var(--y); text-shadow: 0 2px 6px #000; }

/* flash */
#flash { position: fixed; left: 50%; top: 36%; transform: translate(-50%, -50%) scale(.6); z-index: 15; pointer-events: none;
  font-size: 58px; font-weight: 900; color: var(--y); text-shadow: 0 5px 0 #000, 0 0 24px rgba(0,0,0,.6); opacity: 0;
  white-space: nowrap; text-align: center; }
#flash.on { animation: flash .9s ease-out forwards; }
#flash small { display: block; font-size: 20px; color: #fff; margin-top: 4px; }
@keyframes flash { 0% { opacity: 0; transform: translate(-50%, -50%) scale(.5); } 18% { opacity: 1; transform: translate(-50%, -50%) scale(1.12); }
  30% { transform: translate(-50%, -50%) scale(1); } 80% { opacity: 1; } 100% { opacity: 0; transform: translate(-50%, -60%) scale(1); } }

/* end card */
#end { position: fixed; inset: 0; z-index: 25; overflow-y: auto; touch-action: pan-y; background: rgba(8,10,18,.86);
  display: flex; justify-content: center; padding: calc(24px + env(safe-area-inset-top)) 18px calc(24px + env(safe-area-inset-bottom)); }
.e-inner { width: min(420px, 100%); text-align: center; }
#e-head { margin: 0 0 8px; font-size: 26px; font-weight: 900; }
#e-stats { list-style: none; padding: 0; margin: 0 0 14px; display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
#e-stats li { background: rgba(255,255,255,.08); border-radius: 12px; padding: 10px 6px; font-size: 13px; opacity: .95; }
#e-stats li b { display: block; font-size: 20px; color: var(--y); }
#e-cert { width: 100%; border-radius: 10px; margin-bottom: 14px; box-shadow: 0 10px 30px rgba(0,0,0,.5); }
.e-btns { display: flex; flex-direction: column; gap: 14px; align-items: center; }
.e-btns .ghost { margin-top: 4px; }
#e-note { font-size: 13px; opacity: .75; min-height: 18px; }

#fade { position: fixed; inset: 0; background: #000; opacity: 0; pointer-events: none; transition: opacity .35s; z-index: 30; }
#fade.on { opacity: 1; }
