:root {
  --bg: #07060d; --panel: rgba(16, 14, 28, 0.82); --line: rgba(255, 255, 255, 0.12); --text: #f2f0fa; --dim: #a8a3bd;
  --pink: #ff3d7f; --cyan: #2ec4ff; --violet: #b14bff; --yellow: #fff36b; --blue: #4d7dff;
  --safe-b: env(safe-area-inset-bottom, 0px); --safe-t: env(safe-area-inset-top, 0px);
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; overflow: hidden; background: var(--bg); color: var(--text); font: 15px/1.5 "Pretendard", -apple-system, "Segoe UI", "Malgun Gothic", "Apple SD Gothic Neo", sans-serif; overscroll-behavior: none; }
button { font: inherit; color: inherit; cursor: pointer; border: 0; background: none; }
#c { position: fixed; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; z-index: 1; }
/* 클럽 대형 스크린: 3D 화면 위 층에 원근을 맞춰 올린다. 유튜브는 덮인 플레이어의 재생을 막아서 캔버스 뒤에 둘 수 없다. */
.css3d { position: fixed; inset: 0; z-index: 2; pointer-events: none; overflow: hidden; }
#bigwrap { width: 640px; height: 360px; background: #000; }
#bigwrap iframe, #bigyt { width: 100%; height: 100%; border: 0; display: block; }
[hidden] { display: none !important; }

/* 상단 */
#hud { position: fixed; top: calc(10px + var(--safe-t)); left: 10px; max-width: calc(100% - 230px); pointer-events: none; z-index: 5; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 8px 10px; backdrop-filter: blur(6px); }
.brand { display: flex; align-items: center; gap: 8px; }
.brand b { font-size: 18px; letter-spacing: -0.02em; text-shadow: 0 0 12px rgba(177, 75, 255, 0.9); }
.mood { font-size: 12px; font-weight: 700; padding: 2px 9px; border-radius: 999px; border: 1px solid; white-space: nowrap; }
.mood.dance { color: #ff6a95; border-color: #ff6a95; background: rgba(255, 61, 127, 0.15); }
.mood.ballad { color: #8fb0ff; border-color: #8fb0ff; background: rgba(77, 125, 255, 0.18); }
#sub { font-size: 12px; color: var(--dim); margin-top: 3px; }
#now { margin-top: 6px; padding-top: 6px; border-top: 1px solid var(--line); font-size: 13px; font-weight: 600; }
#now small { display: block; color: var(--dim); font-weight: 400; font-size: 12px; }

/* 유튜브 플레이어는 정책상 200x200 이상으로 보이게 둔다 */
#tv { position: fixed; top: calc(10px + var(--safe-t)); right: 10px; width: 200px; height: 200px; border-radius: 12px; overflow: hidden; background: #000; border: 2px solid rgba(46, 196, 255, 0.6); box-shadow: 0 0 24px rgba(46, 196, 255, 0.35); z-index: 5; }
#tv iframe, #yt { width: 100%; height: 100%; display: block; }
@media (min-width: 760px) { #tv { width: 356px; height: 200px; } #hud { max-width: calc(100% - 390px); } }
#tvctl { position: fixed; top: calc(216px + var(--safe-t)); right: 10px; z-index: 6; display: flex; gap: 6px; }
body.tv-off #tv { display: none; }
body.tv-off #tvctl { top: calc(10px + var(--safe-t)); }
body.tv-off #hud { max-width: calc(100% - 220px); }
.round { min-height: 36px; padding: 6px 14px; border-radius: 999px; background: var(--panel); border: 1px solid var(--line); font-size: 13px; font-weight: 600; }
#sound.off { border-color: var(--pink); color: #ff8db0; }

/* 이벤트 줄 */
#feed { position: fixed; left: 10px; bottom: calc(150px + var(--safe-b)); width: min(60%, 320px); display: flex; flex-direction: column; gap: 4px; pointer-events: none; z-index: 4; }
#feed div { font-size: 12.5px; background: rgba(10, 8, 20, 0.55); border-radius: 8px; padding: 3px 9px; width: fit-content; max-width: 100%; animation: fadeout 7s forwards; }
@keyframes fadeout { 0%, 75% { opacity: 1; } 100% { opacity: 0; } }

/* 요청 받기 */
#asks { position: fixed; top: calc(60px + var(--safe-t)); left: 50%; transform: translateX(-50%); width: min(92%, 380px); display: flex; flex-direction: column; gap: 8px; z-index: 20; }
@media (max-width: 759px) { #asks { top: calc(222px + var(--safe-t)); } body.tv-off #asks { top: calc(60px + var(--safe-t)); } }
.ask { background: rgba(24, 18, 44, 0.96); border: 1px solid var(--violet); border-radius: 14px; padding: 12px 14px 0; box-shadow: 0 8px 30px rgba(0, 0, 0, 0.5); overflow: hidden; }
.ask p { margin: 0 0 10px; font-size: 15px; }
.ask p b { color: var(--yellow); }
.ask .row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 10px; }
.ask .row button { min-height: 42px; border-radius: 10px; font-weight: 700; border: 1px solid var(--line); }
.ask .row .yes { background: var(--violet); border-color: var(--violet); }
.ask i { display: block; height: 3px; background: var(--violet); transform-origin: left; animation: shrink 12s linear forwards; margin: 0 -14px; }
@keyframes shrink { to { transform: scaleX(0); } }

#notice { position: fixed; left: 50%; bottom: calc(160px + var(--safe-b)); transform: translateX(-50%); background: rgba(0, 0, 0, 0.8); border-radius: 999px; padding: 8px 16px; font-size: 14px; z-index: 30; white-space: nowrap; }
#banner { position: fixed; left: 0; right: 0; top: 40%; text-align: center; font-size: 42px; font-weight: 800; letter-spacing: -0.03em; pointer-events: none; z-index: 8; animation: banner 3.2s forwards; }
#banner.dance { color: #fff; text-shadow: 0 0 18px var(--pink), 0 0 40px var(--pink); }
#banner.ballad { color: #dfe7ff; text-shadow: 0 0 18px var(--blue), 0 0 40px var(--blue); }
#banner small { display: block; font-size: 15px; font-weight: 600; letter-spacing: 0; opacity: 0.85; }
@keyframes banner { 0% { opacity: 0; transform: scale(0.9); } 12%, 75% { opacity: 1; transform: scale(1); } 100% { opacity: 0; transform: scale(1.05); } }

#moment { position: fixed; left: 50%; bottom: calc(160px + var(--safe-b)); transform: translateX(-50%); background: rgba(40, 8, 30, 0.92); border: 2px solid var(--pink); border-radius: 16px; padding: 10px 12px 0; display: flex; align-items: center; gap: 12px; z-index: 12; overflow: hidden; box-shadow: 0 0 30px rgba(255, 61, 127, 0.5); }
#moment b { font-size: 16px; white-space: nowrap; }
#moment button { min-height: 44px; padding: 0 18px; border-radius: 12px; background: var(--pink); font-weight: 800; margin-bottom: 10px; }
#moment b { margin-bottom: 10px; }
#momentBar { position: absolute; left: 0; bottom: 0; height: 3px; width: 100%; background: var(--yellow); transform-origin: left; }

/* 아래 동작 막대 */
#bar { position: fixed; left: 0; right: 0; bottom: 0; padding: 8px 8px calc(8px + var(--safe-b)); background: linear-gradient(to top, rgba(7, 6, 13, 0.95) 70%, rgba(7, 6, 13, 0)); z-index: 10; }
.chips { display: flex; gap: 8px; overflow-x: auto; padding: 4px 2px 10px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip { flex: 0 0 auto; min-height: 44px; min-width: 64px; padding: 0 14px; border-radius: 12px; background: rgba(255, 255, 255, 0.08); border: 1px solid var(--line); font-weight: 600; font-size: 14px; display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.chip:active { transform: scale(0.96); background: rgba(177, 75, 255, 0.35); }
.chip.hot { border-color: var(--pink); background: rgba(255, 61, 127, 0.18); }
.chip svg { width: 18px; height: 18px; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.chip .dot { width: 8px; height: 8px; border-radius: 50%; }
.hint { color: var(--dim); font-size: 13px; align-self: center; white-space: nowrap; padding: 0 4px; }
.tabs { display: grid; grid-template-columns: repeat(5, 1fr); gap: 4px; }
.tabs button { min-height: 40px; border-radius: 10px; font-size: 14px; font-weight: 600; color: var(--dim); }
.tabs button.on { color: var(--text); background: rgba(255, 255, 255, 0.1); }

/* 시트 */
#sheetWrap { position: fixed; inset: 0; z-index: 40; }
#sheetBg { position: absolute; inset: 0; background: rgba(0, 0, 0, 0.45); }
#sheet { position: absolute; left: 0; right: 0; bottom: 0; max-height: calc(100% - 230px - var(--safe-t)); overflow: auto; background: #120f22; border-top: 1px solid var(--line); border-radius: 18px 18px 0 0; padding: 14px 16px calc(18px + var(--safe-b)); animation: up 0.18s ease-out; }
@media (min-width: 760px) { #sheet { max-height: 70vh; left: 50%; width: 440px; transform: translateX(-50%); bottom: 20px; border-radius: 18px; border: 1px solid var(--line); animation: none; } }
@keyframes up { from { transform: translateY(30px); opacity: 0.5; } }
#sheet h2 { margin: 0 0 2px; font-size: 19px; }
#sheet .sub { color: var(--dim); font-size: 13px; margin: 0 0 12px; }
#sheet .acts { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
#sheet .acts button { min-height: 52px; border-radius: 12px; background: rgba(255, 255, 255, 0.07); border: 1px solid var(--line); font-weight: 700; font-size: 15px; display: flex; align-items: center; justify-content: center; gap: 8px; }
#sheet .acts button:disabled { opacity: 0.35; }
#sheet .acts button.main { background: var(--violet); border-color: var(--violet); }
#sheet .acts svg { width: 20px; height: 20px; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
#sheet .block { margin-top: 12px; width: 100%; min-height: 40px; color: var(--dim); font-size: 13px; border: 1px dashed var(--line); border-radius: 10px; }
#sheet .close { position: absolute; right: 10px; top: 8px; width: 40px; height: 40px; font-size: 22px; color: var(--dim); }
.songs h3 { font-size: 13px; color: var(--dim); margin: 14px 0 6px; font-weight: 600; }
.songs button { display: flex; justify-content: space-between; gap: 10px; width: 100%; min-height: 44px; text-align: left; padding: 8px 10px; border-radius: 10px; border-bottom: 1px solid var(--line); }
.songs button:active { background: rgba(255, 255, 255, 0.08); }
.songs button span { color: var(--dim); font-size: 13px; white-space: nowrap; }
.songs button.queued span { color: var(--yellow); }
.queue { font-size: 13px; background: rgba(255, 243, 107, 0.08); border: 1px solid rgba(255, 243, 107, 0.3); border-radius: 10px; padding: 8px 10px; }

/* 입장 화면 */
#entry { position: fixed; inset: 0; z-index: 50; overflow: auto; background: radial-gradient(circle at 50% 0%, rgba(177, 75, 255, 0.35), transparent 60%), radial-gradient(circle at 80% 100%, rgba(46, 196, 255, 0.25), transparent 50%), rgba(7, 6, 13, 0.9); backdrop-filter: blur(4px); }
.entry-in { max-width: 420px; margin: 0 auto; padding: calc(28px + var(--safe-t)) 20px calc(30px + var(--safe-b)); }
.eyebrow { color: var(--cyan); font-size: 13px; font-weight: 700; letter-spacing: 0.08em; margin: 0; }
#entry h1 { font-size: 46px; margin: 2px 0 6px; letter-spacing: -0.04em; text-shadow: 0 0 16px var(--violet), 0 0 36px var(--pink); }
.desc { color: #d8d3ea; margin: 0 0 18px; }
.pick label { display: block; font-size: 13px; color: var(--dim); margin: 14px 0 6px; font-weight: 600; }
.grid6 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.grid6 button { min-height: 54px; border-radius: 12px; background: rgba(255, 255, 255, 0.06); border: 2px solid transparent; font-weight: 700; display: flex; align-items: center; justify-content: center; gap: 8px; }
.grid6 button i { width: 22px; height: 22px; border-radius: 50%; display: inline-block; border: 2px solid rgba(255, 255, 255, 0.4); }
.grid6 button.on { border-color: var(--yellow); background: rgba(255, 243, 107, 0.1); }
.swatches { display: flex; gap: 8px; flex-wrap: wrap; }
.swatches button { width: 38px; height: 38px; border-radius: 50%; border: 3px solid transparent; outline: 1px solid rgba(255, 255, 255, 0.25); }
.swatches button.on { border-color: var(--yellow); }
.namebox { display: flex; align-items: center; justify-content: space-between; gap: 10px; background: rgba(255, 255, 255, 0.06); border-radius: 12px; padding: 6px 6px 6px 14px; }
.namebox b { font-size: 18px; }
.namebox button { min-height: 40px; padding: 0 14px; border-radius: 10px; background: rgba(255, 255, 255, 0.1); font-weight: 600; font-size: 14px; }
.primary { width: 100%; min-height: 56px; margin-top: 22px; border-radius: 14px; font-size: 18px; font-weight: 800; background: linear-gradient(90deg, var(--pink), var(--violet)); box-shadow: 0 0 30px rgba(255, 61, 127, 0.45); }
.primary:disabled { opacity: 0.5; }
.fine { color: var(--dim); font-size: 12.5px; margin-top: 12px; }
body.tv-off #sheet { max-height: calc(100% - 60px - var(--safe-t)); }
.npc { display: inline-block; font-size: 11px; font-weight: 700; color: #e9d9ff; background: rgba(120, 60, 190, 0.5); border-radius: 6px; padding: 0 5px; margin: 0 3px; vertical-align: 1px; }
#feed b { color: var(--yellow); font-weight: 700; margin-right: 4px; }
.wish { margin: 6px 0 14px; padding: 10px; border: 1px solid var(--line); border-radius: 12px; background: rgba(255, 255, 255, 0.04); }
.wish h3 { margin: 0 0 2px !important; }
.wishrow { display: grid; grid-template-columns: 1fr 1.4fr; gap: 6px; margin: 8px 0; }
.wish input { min-height: 44px; padding: 0 10px; border-radius: 10px; border: 1px solid var(--line); background: rgba(0, 0, 0, 0.35); color: var(--text); font: inherit; font-size: 16px; min-width: 0; }
.wish button { width: 100%; min-height: 44px; border-radius: 10px; font-weight: 700; background: var(--violet); }
.halls { display: flex; flex-direction: column; gap: 8px; }
.hall { text-align: left; width: 100%; padding: 10px 12px; border-radius: 12px; background: rgba(255, 255, 255, 0.06); border: 2px solid transparent; display: flex; flex-direction: column; gap: 2px; min-height: 64px; }
.hall.on { border-color: var(--yellow); background: rgba(255, 243, 107, 0.08); }
.hall-top { display: flex; justify-content: space-between; gap: 8px; align-items: baseline; }
.hall-name { font-size: 15px; }
.hall-n { font-size: 12px; color: var(--dim); white-space: nowrap; }
.hall-desc { font-size: 12.5px; color: var(--dim); }
.hall-now { font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hall-now b { color: #ffd1ec; font-weight: 600; }
.hall-now .dim { color: var(--dim); }
