:root {
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --ui-bg: rgba(12, 16, 28, .78);
  --ui-fg: #eef2fa;
  --accent: #ffd34d;
  font-family: 'Apple SD Gothic Neo', 'Noto Sans KR', 'Malgun Gothic', sans-serif;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; } /* display 를 지정한 요소(#score 등)도 hidden 이면 숨김 */
html, body { margin: 0; height: 100dvh; overflow: hidden; background: #000; color: var(--ui-fg); touch-action: none; user-select: none; }
#scene { position: fixed; inset: 0; display: block; }
#hud-top { position: fixed; top: calc(8px + var(--safe-top)); left: 10px; display: flex; gap: 10px; font-size: 14px; }
#hud-top span { background: var(--ui-bg); padding: 4px 10px; border-radius: 12px; }
#hud-top span:empty { display: none; }
/* 3D ↔ 일반(텍스트) 전환 — 오른쪽 위 (운영자 12-06 「3D에서 일반으로 전환이 안돼」) */
#hud-mode { position: fixed; top: calc(8px + var(--safe-top)); right: 10px; display: flex; gap: 6px; font-size: 13px; z-index: 5; }
#hud-mode a { background: var(--ui-bg); color: #fff; text-decoration: none; padding: 5px 11px; border-radius: 12px; border: 1px solid rgba(255,255,255,.25); white-space: nowrap; }
@media (max-width: 480px) { #hud-mode a { min-height: 44px; display: inline-flex; align-items: center; } }
#hud-mode a:hover { border-color: #4cc9f0; color: #4cc9f0; }
#stick { position: fixed; left: 20px; bottom: calc(20px + var(--safe-bottom)); width: 130px; height: 130px; border-radius: 50%; background: rgba(255, 255, 255, .15); border: 2px solid rgba(255, 255, 255, .3); touch-action: none; }
#knob { position: absolute; left: 50%; top: 50%; width: 54px; height: 54px; margin: -27px 0 0 -27px; border-radius: 50%; background: rgba(255, 255, 255, .7); pointer-events: none; }
#chat { position: fixed; right: 10px; bottom: calc(14px + var(--safe-bottom)); width: min(340px, 52vw); }
#chatHead { font-size: 12px; font-weight: bold; text-shadow: 0 1px 2px #000; margin-bottom: 3px; }
#chatLog { max-height: 26vh; overflow-y: auto; font-size: 13px; text-shadow: 0 1px 2px #000; margin-bottom: 6px; }
#chatForm { display: flex; gap: 6px; }
#chatInput { flex: 1; min-width: 0; padding: 8px 10px; border-radius: 10px; border: 0; background: var(--ui-bg); color: var(--ui-fg); font-size: 15px; }
#chatForm button, #panelClose { min-height: 44px; min-width: 44px; border: 0; border-radius: 10px; background: var(--accent); color: #1a1300; font-weight: bold; }
#panel { position: fixed; left: 50%; top: calc(50px + var(--safe-top)); transform: translateX(-50%); width: min(520px, 94vw); max-height: 70dvh; overflow: auto; background: var(--ui-bg); border-radius: 14px; padding: 10px 14px; }
#panel header { display: flex; justify-content: space-between; align-items: center; }
#panelList { list-style: none; padding: 0; margin: 8px 0 0; font-size: 15px; }
#panelList li { padding: 8px 4px; border-bottom: 1px solid rgba(255, 255, 255, .08); }
#panelList li.live { color: #ffb0b0; }
#toast { position: fixed; left: 50%; top: 40%; transform: translateX(-50%); background: var(--ui-bg); padding: 8px 14px; border-radius: 10px; }
#help { position: fixed; top: calc(64px + var(--safe-top)); right: 10px; font-size: 12px; background: var(--ui-bg); padding: 4px 10px; border-radius: 10px; max-width: 46vw; }
@media (max-width: 600px) { #help { display: none; } }

#score { position: fixed; top: calc(10px + var(--safe-top)); left: 50%; transform: translateX(-50%); display: flex; gap: 10px; align-items: center; background: rgba(8,10,24,.85); border: 2px solid #38e1ff; border-radius: 999px; padding: 6px 18px; font-size: 18px; box-shadow: 0 0 18px rgba(56,225,255,.35); }
#score .b b { color: #6fa8ff; font-size: 24px; } #score .r b { color: #ff6b8a; font-size: 24px; } #score .sep { opacity: .6; }
#goal { position: fixed; top: 28%; left: 50%; transform: translateX(-50%); font: 900 44px/1.1 'Arial Black', sans-serif; padding: 14px 28px; border-radius: 18px; background: rgba(8,10,24,.8); text-shadow: 0 0 24px currentColor; animation: pop .5s ease-out; }
#goal.blue { color: #8fc1ff; border: 3px solid #4f8cff; } #goal.red { color: #ff9ab0; border: 3px solid #ff3f6c; }
@keyframes pop { from { transform: translateX(-50%) scale(.4); opacity: 0; } to { transform: translateX(-50%) scale(1); opacity: 1; } }
#kickBtn { position: fixed; right: 18px; bottom: calc(120px + var(--safe-bottom)); width: 86px; height: 86px; border-radius: 50%; border: 3px solid rgba(255,255,255,.35); background: rgba(8,10,24,.7); color: #fff; font-weight: 900; font-size: 15px; touch-action: none; }
#kickBtn.ready { border-color: #ffc857; box-shadow: 0 0 18px rgba(255,200,87,.6); background: rgba(60,40,8,.85); }

#atkBtn { position: fixed; right: 18px; bottom: calc(120px + var(--safe-bottom)); width: 92px; height: 92px; border-radius: 50%; border: 3px solid #ff3f5a; background: rgba(40,6,14,.85); color: #fff; font-weight: 900; font-size: 16px; box-shadow: 0 0 18px rgba(255,63,90,.55); touch-action: none; }
#atkBtn:active { transform: scale(.92); }
#hp { position: fixed; top: calc(10px + var(--safe-top)); left: 50%; transform: translateX(-50%); width: min(320px, 70vw); background: rgba(14,6,10,.85); border: 2px solid #ff3f5a; border-radius: 12px; padding: 6px 10px; font-weight: 900; }
#hp .bar { height: 12px; background: rgba(255,255,255,.12); border-radius: 6px; overflow: hidden; margin-top: 4px; }
#hpFill { height: 100%; width: 100%; background: #3ddc6a; transition: width .2s; } #hpFill.mid { background: #ffc94a; } #hpFill.low { background: #ff4a5c; }
#hurt { position: fixed; inset: 0; pointer-events: none; box-shadow: inset 0 0 120px 40px rgba(255,30,50,.55); animation: hurt .35s ease-out; }
@keyframes hurt { from { opacity: 1; } to { opacity: 0; } }

/* 실제 경기 골 배너(맵 전체) */
#rgoal { position: fixed; top: calc(110px + var(--safe-top)); left: 50%; transform: translateX(-50%); max-width: 94vw; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; background: linear-gradient(90deg, rgba(60,8,20,.95), rgba(20,10,40,.95)); border: 2px solid #ffd34d; border-radius: 14px; padding: 8px 18px; font-size: 18px; font-weight: 800; box-shadow: 0 0 24px rgba(255,211,77,.5); animation: pop .5s ease-out; pointer-events: none; }
#rgoal b { color: #ffd34d; margin-right: 6px; }

/* 경기 패널 탭 · 일정 날짜 머리 */
#panelTabs { display: flex; gap: 6px; margin-top: 8px; }
#panelTabs button { flex: 1; min-height: 40px; border: 0; border-radius: 10px; background: rgba(255,255,255,.08); color: var(--ui-fg); font-weight: bold; font-size: 15px; }
#panelTabs button.on { background: var(--accent); color: #1a1300; }
#panel[data-kind="tv"] #panelTabs { display: none; }
#panelList li.day { position: sticky; top: -10px; background: rgba(20,26,44,.97); color: var(--accent); font-weight: bold; border-bottom: 0; }
#panelList li.major { color: #fff; }
#panelList li.minor { color: #aeb6c8; }
#panel:not([hidden]) ~ #help { display: none; } /* 패널 닫기 버튼을 가리지 않게 */
#points { color: #ffd34d; font-weight: bold; }
#points.gain { animation: ptgain .9s ease-out; }
@keyframes ptgain { 0% { transform: scale(1.6); box-shadow: 0 0 18px #ffd34d; } 100% { transform: scale(1); } }
/* ── 3D 입장 닉네임 모달 ── */
#entry { position: fixed; inset: 0; z-index: 100; display: flex; align-items: center; justify-content: center; padding: 16px; background: rgba(6, 9, 18, .72); overflow-y: auto; touch-action: auto; user-select: auto; }
#entryForm { width: min(360px, 100%); max-height: 100%; background: #141a2c; border: 1px solid #2c3550; border-radius: 14px; padding: 20px 18px; display: flex; flex-direction: column; gap: 8px; }
#entryForm h1 { margin: 0 0 6px; font-size: 20px; text-align: center; color: var(--accent); }
#entryForm label { font-size: 13px; color: #aeb6c8; }
#entryName { height: 44px; font-size: 16px; padding: 0 12px; border-radius: 10px; border: 1px solid #3a4566; background: #0c1020; color: var(--ui-fg); width: 100%; }
#entryMsg { margin: 0; min-height: 18px; font-size: 13px; color: #ff8a8a; }
#entryGo { height: 44px; font-size: 16px; font-weight: bold; border: 0; border-radius: 10px; background: var(--accent); color: #1a1a1a; cursor: pointer; }
#entryGo:disabled { opacity: .6; }
#entryForm .note { margin: 4px 0 0; font-size: 12px; color: #8f98b0; line-height: 1.5; text-align: center; }

/* 모습 고르기(입장 모달·꾸미기 패널 공용) */
.lookChars { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.lookChar { min-height: 44px; border-radius: 10px; border: 2px solid #3a4566; background: #0c1020; color: var(--ui-fg); font-size: 12px; font-weight: bold; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; cursor: pointer; }
.lookChar::before { content: ''; width: 16px; height: 16px; border-radius: 50%; background: var(--dot, #888); border: 1px solid rgba(255,255,255,.6); }
.lookChar.on { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.lookColors { display: grid; grid-template-columns: repeat(8, 1fr); gap: 6px; margin-top: 6px; }
.lookColor { min-height: 36px; border-radius: 50%; border: 3px solid #fff; cursor: pointer; padding: 0; }
.lookColor.on { outline: 3px solid var(--accent); outline-offset: 1px; }
#lookBtn { position: fixed; left: 10px; top: calc(56px + var(--safe-top)); min-height: 44px; min-width: 44px; padding: 0 12px; border: 0; border-radius: 10px; background: var(--ui-bg); color: var(--ui-fg); font-weight: bold; font-size: 14px; z-index: 5; }
#lookPanel { position: fixed; left: 10px; top: calc(106px + var(--safe-top)); width: min(340px, calc(100vw - 20px)); background: var(--ui-bg); border-radius: 14px; padding: 10px 14px 14px; z-index: 6; }
#lookPanel header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
#lookClose { min-height: 44px; min-width: 44px; border: 0; border-radius: 10px; background: var(--accent); color: #1a1300; font-weight: bold; }

/* 🙌 응원: 꾸미기 버튼 아래. 누르면 가로로 4종 팝 */
#cheerBtn { position: fixed; left: 10px; top: calc(108px + var(--safe-top)); min-height: 44px; min-width: 44px; padding: 0 12px; border: 0; border-radius: 10px; background: var(--ui-bg); color: var(--ui-fg); font-weight: bold; font-size: 14px; z-index: 5; }
#cheerBtn.cool { opacity: .55; }
#cheerPop { position: fixed; left: 10px; top: calc(160px + var(--safe-top)); display: flex; gap: 6px; padding: 6px; border-radius: 12px; background: var(--ui-bg); z-index: 6; }
#cheerPop[hidden] { display: none; }
#cheerPop button { width: 44px; height: 44px; border: 0; border-radius: 10px; background: rgba(255,255,255,.12); color: #fff; font-size: 22px; line-height: 1; }
#cheerPop button:active { transform: scale(.92); }
