*{box-sizing:border-box;margin:0;padding:0}
html,body{width:100%;height:100%;overflow:hidden;background:#bfe6ff;font-family:Jua,system-ui,sans-serif;color:#4a3a36;touch-action:none;user-select:none;-webkit-user-select:none}
#gl{position:fixed;inset:0;width:100%;height:100%;display:block}
#hud{position:fixed;inset:0;pointer-events:none;z-index:5}
.top{position:absolute;top:max(10px,env(safe-area-inset-top));left:10px;right:10px;display:flex;justify-content:space-between;align-items:flex-start;gap:8px;flex-wrap:wrap}
.title-pill{background:#fffaf0;border:3px solid #6b4f45;border-radius:999px;padding:6px 16px;font-size:22px;box-shadow:0 4px 0 #6b4f45;color:#6b4f45}
.title-pill b{font-weight:400;color:#e2627f}
#labels{position:absolute;inset:0;overflow:hidden}
.lbl{position:absolute;transform:translate(-50%,-100%);background:rgba(255,255,255,.85);border-radius:10px;padding:1px 8px;font-size:13px;white-space:nowrap;color:#4a3a36}
.lbl.me{background:#ffe27a}
.lbl .fcb{display:inline-block;margin-right:5px;padding:0 6px;border-radius:8px;background:#6b4a3a;color:#fff;font-size:11px;font-weight:700;vertical-align:1px}
.bub{position:absolute;transform:translate(-50%,-100%);font-size:30px;animation:pop .25s}
@keyframes pop{from{transform:translate(-50%,-60%) scale(.3)}to{transform:translate(-50%,-100%) scale(1)}}
#emotes{position:absolute;right:12px;bottom:max(14px,env(safe-area-inset-bottom));display:flex;gap:6px;pointer-events:auto}
#emotes button{font-size:24px;width:48px;height:48px;border-radius:50%;border:3px solid #6b4f45;background:#fffaf0;box-shadow:0 3px 0 #6b4f45;cursor:pointer}
#emotes button:active{transform:translateY(2px);box-shadow:0 1px 0 #6b4f45}
#hint{position:absolute;left:12px;bottom:max(14px,env(safe-area-inset-bottom));background:rgba(255,255,255,.75);border-radius:10px;padding:4px 10px;font-size:13px}
@media (pointer:coarse){#hint{display:none}}
#dpad{position:fixed;left:0;top:0;width:124px;height:124px;margin:-62px 0 0 -62px;border-radius:50%;pointer-events:none;z-index:11;opacity:0;transform:scale(.7);background:radial-gradient(circle,rgba(107,79,69,.35),rgba(107,79,69,.5));border:3px solid rgba(255,255,255,.8)}
#dpad.show{opacity:.85;transform:scale(1);transition:opacity .12s,transform .12s}
#dpad .pa{position:absolute;width:0;height:0;border:14px solid transparent}
#dpad .pa-u{left:50%;top:7px;margin-left:-14px;border-top:0;border-bottom:19px solid #fff}
#dpad .pa-d{left:50%;bottom:7px;margin-left:-14px;border-bottom:0;border-top:19px solid #fff}
#dpad .pa-l{top:50%;left:7px;margin-top:-14px;border-left:0;border-right:19px solid #fff}
#dpad .pa-r{top:50%;right:7px;margin-top:-14px;border-right:0;border-left:19px solid #fff}
#dpad .knob{position:absolute;left:50%;top:50%;width:40px;height:40px;margin:-20px 0 0 -20px;border-radius:50%;background:#ffe27a;border:3px solid #6b4f45}
#toast{position:fixed;left:50%;top:70px;transform:translateX(-50%);background:rgba(74,58,54,.9);color:#fff;padding:8px 16px;border-radius:14px;font-size:15px;opacity:0;transition:opacity .3s;z-index:30;pointer-events:none}
#toast.on{opacity:1}

.title-pill small{font-size:13px;margin-left:8px;opacity:.75}
.title-pill small:empty{display:none}
#gl{touch-action:none}

#emotes .touch{display:none}@media (pointer:coarse){#emotes .touch{display:block}}
#dash{position:absolute;left:50%;bottom:max(18px,env(safe-area-inset-bottom));transform:translateX(-50%);width:120px;height:8px;border-radius:5px;background:rgba(107,79,69,.35);opacity:0;transition:opacity .3s}#dash.on{opacity:1}#dash i{display:block;height:100%;width:100%;border-radius:5px;background:#ffb84a}

/* ---------- start screen v5: premium title card (방울신당 pastel toon) ---------- */
body:not(.playing) #hud{opacity:0;pointer-events:none}
#hud{transition:opacity .5s}
#start{position:fixed;inset:0;z-index:20;display:flex;align-items:center;justify-content:flex-end;padding:24px max(24px,6vw) 24px 24px;animation:stIn .7s ease-out both}
#start.hide{display:none}
@keyframes stIn{from{opacity:0}to{opacity:1}}
.st-shade{position:absolute;inset:0;pointer-events:none;background:
  radial-gradient(120% 90% at 22% 60%,rgba(255,255,255,0) 40%,rgba(74,48,60,.18) 100%),
  linear-gradient(90deg,rgba(255,240,246,0) 38%,rgba(255,240,246,.38) 62%,rgba(255,236,244,.62) 100%)}
body[data-period=night] .st-shade{background:radial-gradient(120% 90% at 22% 60%,rgba(0,0,0,0) 40%,rgba(10,10,40,.35) 100%),linear-gradient(90deg,rgba(20,24,60,0) 38%,rgba(20,24,60,.3) 70%,rgba(20,24,60,.45) 100%)}
.st-brand{position:absolute;left:max(24px,4vw);bottom:max(22px,env(safe-area-inset-bottom));font-size:13px;letter-spacing:.42em;color:rgba(255,255,255,.92);text-shadow:0 1px 0 rgba(107,79,69,.55),0 0 12px rgba(107,79,69,.25)}
.st-brand::before{content:"";display:inline-block;width:38px;height:2px;margin-right:12px;vertical-align:middle;background:rgba(255,255,255,.85);border-radius:2px}
#start .card{position:relative;width:min(400px,100%);padding:26px 26px 18px;border-radius:30px;text-align:center;color:#5a443d;
  background:linear-gradient(180deg,rgba(255,252,246,.94),rgba(255,247,240,.9));border:3px solid #6b4f45;
  box-shadow:0 7px 0 #6b4f45,0 24px 60px rgba(90,50,60,.28),inset 0 0 0 5px rgba(255,214,226,.55);
  -webkit-backdrop-filter:blur(10px) saturate(1.2);backdrop-filter:blur(10px) saturate(1.2);animation:cardIn .7s cubic-bezier(.2,1.2,.4,1) .1s both}
@keyframes cardIn{from{opacity:0;transform:translateY(24px) scale(.96)}to{opacity:1;transform:none}}
.langs{position:absolute;top:14px;right:14px;display:flex;padding:3px;gap:2px;border-radius:999px;background:#f3e6e0;border:2px solid #e2cfc7}
.langs button{font:inherit;font-size:12px;padding:3px 9px;border:0;border-radius:999px;background:transparent;color:#8a7068;cursor:pointer;transition:background .2s,color .2s}
.langs button.on{background:#fff;color:#e2627f;box-shadow:0 1px 3px rgba(107,79,69,.25)}
.logo{margin-top:8px}
.emblem{width:78px;height:78px;display:block;margin:0 auto 4px;filter:drop-shadow(0 4px 0 rgba(107,79,69,.25));animation:bob 3.2s ease-in-out infinite}
@keyframes bob{50%{transform:translateY(-4px) rotate(-2deg)}}
#start h1{font-weight:400;font-size:44px;line-height:1.05;color:#e2627f;letter-spacing:.02em;
  text-shadow:0 2px 0 #fff,0 4px 0 #f6b3c4,0 7px 12px rgba(226,98,127,.25)}
#start h1 span{color:#ff8a5c}
#start .sub{margin:6px 0 10px;font-size:15px;color:#8a7068}
.live{display:inline-block;font-size:12.5px;padding:4px 12px;margin-bottom:16px;border-radius:999px;background:#eef6ff;color:#4f6a8a;border:1.5px solid #cfe1f3}
body[data-period=evening] .live{background:#fff1e8;color:#a0603f;border-color:#f6d2bd}
body[data-period=night] .live{background:#eceefc;color:#4a4f8a;border-color:#d3d6f2}
.nick{display:block;text-align:left;margin-bottom:14px}
.nick span{display:block;font-size:13px;color:#a08a82;margin:0 0 5px 6px}
.nick input{font:inherit;font-size:19px;width:100%;padding:10px 14px;border:2.5px solid #d9c6be;border-radius:16px;background:#fff;color:#4a3a36;text-align:center;outline:none;transition:border-color .2s,box-shadow .2s}
.nick input:focus{border-color:#e2627f;box-shadow:0 0 0 4px rgba(226,98,127,.15)}
.pick{display:flex;gap:10px;margin-bottom:10px}
.ch{flex:1;font:inherit;display:flex;flex-direction:column;align-items:center;gap:2px;padding:12px 6px 10px;border-radius:18px;border:2.5px solid #e3d4cd;background:#fff;color:#4a3a36;cursor:pointer;transition:transform .15s,border-color .2s,background .2s,box-shadow .2s}
.ch:hover{transform:translateY(-2px)}
.ch b{font-weight:400;font-size:19px}.ch small{font-size:12px;color:#a08a82}
.gi{width:40px;height:40px;border-radius:50%;display:grid;place-items:center;margin-bottom:3px;background:#eef2f8}
.gi svg{width:22px;height:22px;fill:none;stroke:#8a9ab0;stroke-width:2.4;stroke-linecap:round;stroke-linejoin:round}
.ch.on{border-color:#e2627f;background:linear-gradient(#fff,#fff2f5);box-shadow:0 4px 0 #e2627f}
.ch.on .gi-m{background:#dcecff}.ch.on .gi-m svg{stroke:#4a8ad8}
.ch.on .gi-f{background:#ffe0ea}.ch.on .gi-f svg{stroke:#e2627f}
.mine{display:flex;align-items:center;justify-content:center;gap:8px;margin:4px 0 16px;font-size:13px;color:#a08a82}
.mine b{font-weight:400;font-size:14px;color:#fff;background:#6b4a3a;padding:2px 10px;border-radius:999px}
#reroll{font:inherit;font-size:12.5px;display:inline-flex;align-items:center;gap:4px;padding:3px 10px;border-radius:999px;border:1.5px solid #e3d4cd;background:#fff;color:#8a7068;cursor:pointer}
#reroll svg{width:13px;height:13px;fill:none;stroke:currentColor;stroke-width:2.6;stroke-linecap:round;stroke-linejoin:round}
#reroll:hover{color:#e2627f;border-color:#f3b7c6}
#go{font:inherit;width:100%;display:flex;align-items:center;justify-content:center;gap:10px;font-size:22px;padding:13px 20px;border-radius:999px;cursor:pointer;color:#fff;
  border:3px solid #6b4f45;background:linear-gradient(180deg,#ff9bb3,#e2627f);box-shadow:0 5px 0 #6b4f45,inset 0 2px 0 rgba(255,255,255,.45);text-shadow:0 1px 0 rgba(140,40,70,.45);transition:filter .2s}
#go svg{width:22px;height:22px;fill:none;stroke:#fff;stroke-width:3;stroke-linecap:round;stroke-linejoin:round;transition:transform .2s}
#go:hover{filter:brightness(1.05)}#go:hover svg{transform:translateX(3px)}
#go:active{transform:translateY(3px);box-shadow:0 2px 0 #6b4f45,inset 0 2px 0 rgba(255,255,255,.45)}
.foot{margin-top:12px;font-size:11.5px;color:#b29d95}
@media (max-width:700px),(orientation:portrait){
  #start{align-items:flex-end;justify-content:center;padding:12px 12px max(12px,env(safe-area-inset-bottom))}
  .st-shade{background:linear-gradient(180deg,rgba(255,240,246,0) 30%,rgba(255,236,244,.55) 100%)}
  .st-brand{top:max(16px,env(safe-area-inset-top));bottom:auto;left:50%;transform:translateX(-50%);white-space:nowrap}
  #start .card{padding:18px 18px 12px}
  .emblem{width:56px;height:56px}#start h1{font-size:34px}#start .sub{font-size:13px;margin:4px 0 8px}
  .live{margin-bottom:10px}.nick{margin-bottom:10px}.nick input{padding:8px 12px;font-size:17px}
  .ch{padding:8px 4px 7px}.gi{width:32px;height:32px}.mine{margin:2px 0 10px}#go{padding:10px 16px;font-size:20px}.foot{display:none}
}
.chips{display:flex;gap:6px;flex-wrap:wrap;justify-content:flex-end}
.chip{background:rgba(255,255,255,.88);border:2px solid #6b4f45;border-radius:999px;padding:4px 12px;font-size:15px}
.chip+.chip{margin-left:0}
@media (max-width:700px),(orientation:portrait){.langs{position:static;justify-content:center;width:max-content;margin:0 auto 6px}.logo{margin-top:0}}
@media (max-width:700px),(orientation:portrait){.emblem{display:none}#start h1{font-size:32px}.live{margin-bottom:8px}.pick .gi{display:none}}

.roomBtn{cursor:pointer;font:inherit;border:inherit;pointer-events:auto}
.roomPop{position:fixed;top:56px;right:12px;z-index:60;width:min(260px,calc(100vw - 24px));max-height:min(60vh,420px);display:flex;flex-direction:column;background:#fffaf0;border:3px solid #6b4f45;border-radius:18px;box-shadow:0 4px 0 #6b4f45,0 10px 24px rgba(0,0,0,.18);color:#4a3530;pointer-events:auto}
.roomPop[hidden]{display:none}
.rpHead{display:flex;align-items:center;gap:6px;padding:10px 12px;border-bottom:2px dashed #e2cfc0}.rpHead b{flex:1;font-size:15px}
.rpHead button{width:32px;height:32px;border-radius:50%;border:2px solid #6b4f45;background:#fff;color:#6b4f45;font-size:15px;cursor:pointer}
.rpList{overflow:auto;padding:8px;display:grid;gap:6px}
.rpList button{display:flex;justify-content:space-between;align-items:center;min-height:42px;padding:8px 12px;border-radius:12px;border:2px solid #e2cfc0;background:#fff;color:#4a3530;font:inherit;font-size:14px;cursor:pointer}
.rpList button.cur{border-color:#ef7f9b;background:#ffe9ef;font-weight:700}
.rpList button:disabled{opacity:.45;cursor:not-allowed;background:#f1ece8}
.rpList .rpMsg{text-align:center;padding:12px;font-size:13px;color:#8a7068}
/* touch-fix: buttons must never start browser gestures; .down mirrors :active (iOS skips :active for non-primary touches) */
#emotes,#emotes button{touch-action:none;-webkit-touch-callout:none;-webkit-tap-highlight-color:transparent}
#emotes button.down{transform:translateY(2px);box-shadow:0 1px 0 #6b4f45}
