:root {
  --bg: #07040e;
  --panel: rgba(18, 11, 30, .82);
  --panel-solid: #140c22;
  --line: rgba(255, 255, 255, .13);
  --text: #f6f1ff;
  --muted: #b5a9cc;
  --pink: #ff2e88;
  --cyan: #16c7ff;
  --yellow: #ffd21f;
  --safe-b: env(safe-area-inset-bottom, 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-family: 'Noto Sans KR', system-ui, sans-serif; }
button, input { font: inherit; color: inherit; }
button { cursor: pointer; }
button:focus-visible, input:focus-visible, a:focus-visible { outline: 2px solid var(--cyan); outline-offset: 2px; }
kbd { padding: 0 5px; border: 1px solid var(--line); border-radius: 4px; background: rgba(255,255,255,.08); font-family: inherit; font-size: .9em; }

#canvasContainer { position: fixed; inset: 0; touch-action: none; }
#canvasContainer canvas { display: block; }
#labels { position: fixed; inset: 0; overflow: hidden; pointer-events: none; }
.label { position: absolute; left: 0; top: 0; padding: 1px 8px; border-radius: 99px; background: rgba(5,2,12,.62); font-size: 12px; font-weight: 500; white-space: nowrap; will-change: transform; }
.label.me { background: var(--pink); font-weight: 700; }
.float-emoji { position: absolute; left: 50%; bottom: 100%; font-size: 30px; animation: floatUp 1.6s ease-out forwards; }
@keyframes floatUp { from { opacity: 1; transform: translate(-50%, 0) scale(.7); } 25% { transform: translate(-50%, -22px) scale(1.15); } to { opacity: 0; transform: translate(-50%, -90px) scale(1); } }

.hud { position: fixed; left: 0; right: 0; z-index: 5; pointer-events: none; }
.hud > * { pointer-events: auto; }
.top { top: 0; display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; padding: 12px; }
.pill { display: flex; align-items: center; gap: 12px; min-height: 42px; padding: 5px 14px; border: 1px solid var(--line); border-radius: 99px; background: var(--panel); backdrop-filter: blur(10px); }
.brand strong { font-family: 'Black Han Sans', sans-serif; font-weight: 400; font-size: 17px; letter-spacing: .4px; background: linear-gradient(90deg, var(--pink), var(--yellow)); -webkit-background-clip: text; background-clip: text; color: transparent; white-space: nowrap; }
.now { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); white-space: nowrap; }
.now i { animation: spin 3s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.stat { font-size: 13px; white-space: nowrap; }
.icon-btn { width: 32px; height: 32px; padding: 0; border: 0; border-radius: 50%; background: transparent; }
.icon-btn:hover { background: rgba(255,255,255,.1); }
.icon-btn.on { color: var(--yellow); }
.volume { width: 84px; accent-color: var(--pink); }

.shout-banner { position: fixed; z-index: 6; top: 66px; left: 50%; display: flex; align-items: center; gap: 8px; max-width: min(92vw, 640px); padding: 8px 16px; border: 1px solid var(--yellow); border-radius: 12px; background: rgba(20,10,30,.92); opacity: 0; pointer-events: none; transform: translate(-50%, -14px); transition: .25s; font-size: 15px; }
.shout-banner.show { opacity: 1; transform: translate(-50%, 0); }
.shout-banner i, .shout-banner b { flex: none; color: var(--yellow); }
.shout-banner span { overflow-wrap: anywhere; }

.bottom { bottom: 0; display: none; flex-direction: column; align-items: center; gap: 4px; padding: 0 8px calc(8px + var(--safe-b)); }
body.in-club .bottom { display: flex; }
.actions { display: flex; max-width: 100%; gap: 3px; padding: 5px; overflow-x: auto; scrollbar-width: none; border: 1px solid var(--line); border-radius: 18px; background: var(--panel); backdrop-filter: blur(10px); }
.actions::-webkit-scrollbar { display: none; }
.action { display: flex; flex: none; flex-direction: column; align-items: center; justify-content: center; gap: 1px; width: 62px; height: 54px; border: 0; border-radius: 13px; background: transparent; font-size: 11.5px; font-weight: 500; }
.action .ico { font-size: 21px; line-height: 1.15; }
.action:hover { background: rgba(255,255,255,.09); }
.action.on, .action[aria-expanded="true"] { background: linear-gradient(135deg, rgba(255,46,136,.55), rgba(124,77,255,.55)); }
.hint { margin: 0; color: rgba(255,255,255,.72); font-size: 11.5px; text-shadow: 0 1px 3px #000; text-align: center; }
.hint a { color: inherit; }

.sheet { position: fixed; z-index: 7; left: 50%; bottom: calc(92px + var(--safe-b)); width: min(94vw, 480px); max-height: 56vh; padding: 14px; overflow-y: auto; border: 1px solid var(--line); border-radius: 18px; background: var(--panel-solid); opacity: 0; visibility: hidden; transform: translate(-50%, 12px); transition: .16s; }
.sheet.open { opacity: 1; visibility: visible; transform: translate(-50%, 0); }
.sheet h2 { margin: 0 0 10px; font-size: 15px; }
.choices { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 7px; }
.choice { display: flex; align-items: center; justify-content: space-between; gap: 7px; min-height: 44px; padding: 7px 11px; border: 1px solid var(--line); border-radius: 11px; background: rgba(255,255,255,.05); font-size: 13.5px; text-align: left; }
.choice:hover { background: rgba(255,255,255,.12); }
.choice.active { border-color: var(--pink); background: rgba(255,46,136,.28); }
.choice .ico { font-size: 18px; }
.choice small { color: var(--muted); font-size: 11px; }
.choice .dot { flex: none; order: 2; width: 13px; height: 13px; border-radius: 50%; box-shadow: 0 0 9px currentColor; }
.emoji-grid { grid-template-columns: repeat(4, 1fr); }
.choice.emoji { justify-content: center; font-size: 25px; }
.wide-btn { flex: 1; width: 100%; min-height: 44px; margin-top: 9px; border: 0; border-radius: 11px; background: var(--pink); font-weight: 700; }
.wide-btn.ghost { border: 1px solid var(--line); background: transparent; font-weight: 500; }
.held { display: flex; gap: 8px; }
.shout-form { display: flex; gap: 7px; }
.shout-form input { flex: 1; min-width: 0; height: 44px; padding: 0 12px; border: 1px solid var(--line); border-radius: 11px; background: rgba(255,255,255,.07); font-size: 16px; }
.shout-form button { flex: none; padding: 0 17px; border: 0; border-radius: 11px; background: var(--yellow); color: #181022; font-weight: 800; }

.joystick { position: fixed; z-index: 5; left: 20px; bottom: calc(112px + var(--safe-b)); display: none; width: 112px; height: 112px; border: 1px solid var(--line); border-radius: 50%; background: rgba(18,11,30,.45); touch-action: none; }
.knob { position: absolute; left: 31px; top: 31px; width: 48px; height: 48px; border-radius: 50%; background: rgba(255,255,255,.55); }
@media (pointer: coarse) { body.in-club .joystick { display: block; } .hint { display: none; } }

.modal { position: fixed; z-index: 10; inset: 0; display: flex; align-items: center; justify-content: center; padding: 14px; overflow-y: auto; background: linear-gradient(180deg, rgba(5,2,12,.22), rgba(5,2,12,.72)); }
.modal.hidden { display: none; }
.card { width: min(100%, 470px); max-height: 100%; margin: auto; padding: 22px; overflow-y: auto; border: 1px solid var(--line); border-radius: 22px; background: rgba(15,9,25,.9); backdrop-filter: blur(14px); box-shadow: 0 0 60px rgba(255,46,136,.22); }
.eyebrow { margin: 0 0 6px; color: var(--yellow); font-size: 12.5px; font-weight: 700; }
.join-card h1 { margin: 0; font-family: 'Black Han Sans', sans-serif; font-size: clamp(30px, 8vw, 40px); font-weight: 400; line-height: 1.13; }
.sub { margin: 7px 0 13px; color: var(--muted); font-size: 14px; }
.look-picker { display: grid; grid-template-columns: 136px 1fr; gap: 12px; align-items: center; }
.preview { width: 136px; min-height: 142px; border-radius: 14px; background: radial-gradient(circle at 50% 45%, rgba(124,77,255,.45), rgba(255,46,136,.06) 72%); }
.preview canvas { display: block; }
.costume-list { display: flex; flex-wrap: wrap; gap: 5px; }
.chip { min-height: 32px; padding: 3px 10px; border: 1px solid var(--line); border-radius: 99px; background: rgba(255,255,255,.05); font-size: 12.5px; }
.chip:hover { background: rgba(255,255,255,.12); }
.chip.active { border-color: var(--pink); background: var(--pink); font-weight: 700; }
.color-list { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 10px; }
.swatch { width: 27px; height: 27px; padding: 0; border: 2px solid rgba(255,255,255,.22); border-radius: 50%; }
.swatch.active { border-color: #fff; box-shadow: 0 0 0 2px var(--pink); }
.join-form { display: flex; gap: 8px; margin-top: 14px; }
.join-form input { flex: 1; min-width: 0; height: 48px; padding: 0 13px; border: 1px solid var(--line); border-radius: 12px; background: rgba(255,255,255,.07); font-size: 16px; }
.join-form button { flex: none; padding: 0 19px; border: 0; border-radius: 12px; background: linear-gradient(135deg, var(--pink), #ff7a18); font-weight: 800; }
.join-form button:disabled { opacity: .55; }
.join-error { min-height: 1.3em; margin: 6px 0 0; color: #ff8fa6; font-size: 13px; }
.foot { margin: 2px 0 0; color: var(--muted); font-size: 12.5px; }
.foot b { color: var(--text); }
.maker { display: inline-block; margin-top: 5px; color: var(--muted); font-size: 12px; }
.wardrobe-card h2 { margin: 0 0 13px; font-size: 18px; }
.wardrobe-actions { display: flex; gap: 8px; margin-top: 8px; }

.toast { position: fixed; z-index: 20; left: 50%; bottom: calc(118px + var(--safe-b)); max-width: 90vw; padding: 8px 15px; border-radius: 99px; background: rgba(0,0,0,.84); font-size: 13.5px; opacity: 0; pointer-events: none; transform: translateX(-50%); transition: opacity .2s; }
.toast.show { opacity: 1; }
.noscript-intro { position: fixed; z-index: 30; inset: 0; padding: 3rem; background: var(--bg); }

@media (max-width: 620px) {
  .top { padding: 8px; }
  .pill { gap: 8px; min-height: 38px; padding: 3px 10px; }
  .now { display: none; }
  .volume { width: 58px; }
  .actions { width: 100%; justify-content: space-between; gap: 0; padding: 4px 2px; overflow-x: visible; }
  .action { flex: 1 1 0; width: auto; min-width: 0; height: 50px; font-size: 10px; letter-spacing: -.4px; }
  .action .ico { font-size: 18px; }
  .toast { bottom: calc(236px + var(--safe-b)); }
  .shout-banner { top: 54px; font-size: 13.5px; }
  .sheet { bottom: calc(76px + var(--safe-b)); }
  .card { padding: 16px; }
  .look-picker { grid-template-columns: 104px 1fr; gap: 9px; }
  .preview { width: 104px; min-height: 109px; }
  .chip { padding: 2px 8px; font-size: 12px; }
}
@media (prefers-reduced-motion: reduce) {
  .now i { animation: none; }
  .sheet, .shout-banner { transition: none; }
}

/* 계정·메뉴·채팅 */
.mini-btn { min-height: 34px; padding: 4px 11px; border: 1px solid var(--line); border-radius: 9px; background: rgba(255,255,255,.06); font-size: 12.5px; white-space: nowrap; }
.mini-btn:hover:not(:disabled) { background: rgba(255,255,255,.14); }
.mini-btn:disabled, .wide-btn:disabled { opacity: .45; cursor: default; }
.mini-btn.active { border-color: var(--pink); background: rgba(255,46,136,.3); }
.mini-btn.danger { color: #ff9db0; }
.join-login { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 6px 10px; min-height: 44px; margin-top: 12px; }
.join-login[hidden] { display: none; }
.join-login small { flex: 1 1 150px; color: var(--muted); font-size: 11.5px; }
.chip.locked { color: var(--muted); }
.menu-card { display: flex; flex-direction: column; width: min(100%, 520px); height: min(100%, 620px); padding: 0; overflow: hidden; }
.menu-head { display: flex; align-items: center; justify-content: space-between; gap: 6px; padding: 10px 10px 8px 14px; border-bottom: 1px solid var(--line); }
.menu-tabs { display: flex; gap: 2px; min-width: 0; overflow-x: auto; scrollbar-width: none; }
.menu-tabs button { flex: none; min-height: 38px; padding: 4px 11px; border: 0; border-radius: 9px; background: transparent; color: var(--muted); font-weight: 700; font-size: 14px; }
.menu-tabs button[hidden] { display: none; }
.menu-tabs button.active { background: rgba(255,46,136,.28); color: var(--text); }
.menu-body { flex: 1; padding: 14px; overflow-y: auto; }
.menu-body h3 { margin: 16px 0 7px; font-size: 14px; }
.menu-body > .shout-form { margin-top: 10px; }
.menu-note { margin: 8px 0; color: var(--muted); font-size: 13px; line-height: 1.5; }
.menu-row { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.list-row .menu-row { margin-top: 0; flex: none; }
.coin-card { display: flex; align-items: baseline; justify-content: space-between; flex-wrap: wrap; gap: 4px 10px; padding: 12px 14px; border-radius: 13px; background: linear-gradient(120deg, rgba(255,46,136,.3), rgba(124,77,255,.3)); }
.coin-card b { color: var(--yellow); font-size: 22px; }
.coin-card span { color: var(--muted); font-size: 12px; }
.list-row { display: flex; align-items: center; justify-content: space-between; gap: 9px; min-height: 42px; padding: 5px 2px; border-bottom: 1px solid rgba(255,255,255,.07); font-size: 13.5px; overflow-wrap: anywhere; }
.list-row small { flex: none; color: var(--muted); font-size: 11.5px; }
.list-row .grow { flex: 1; }
.list-row .rank { flex: none; width: 24px; color: var(--yellow); text-align: center; }
.list-row .online { color: #5ff0bd; font-weight: 700; }
.list-row .plus { color: #5ff0bd; }
.list-row .minus { color: #ff9db0; }
.menu-details { margin-top: 12px; font-size: 13.5px; }
.menu-details summary { min-height: 34px; line-height: 34px; cursor: pointer; }
.report-card { margin-top: 9px; padding: 11px; border: 1px solid var(--line); border-radius: 12px; font-size: 13px; overflow-wrap: anywhere; }
.report-card p { margin: 5px 0; }
.report-card small { color: var(--muted); }
.report-card blockquote { margin: 7px 0 0; padding: 6px 9px; border-left: 3px solid var(--pink); background: rgba(255,255,255,.05); }
.chat-sheet { display: flex; flex-direction: column; height: min(56vh, 440px); }
.chat-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.chat-head h2 { margin: 0; }
.chat-list { flex: 1; min-height: 0; margin-bottom: 9px; overflow-y: auto; font-size: 13.5px; }
.chat-line { display: flex; align-items: flex-start; gap: 6px; padding: 3px 0; line-height: 1.45; overflow-wrap: anywhere; }
.chat-line .text { flex: 1; min-width: 0; }
.chat-line b { margin-right: 5px; color: #ffa8cf; }
.chat-line.mine b { color: var(--yellow); }
.chat-line .flag { flex: none; padding: 0 4px; border: 0; background: transparent; color: var(--muted); font-size: 11px; opacity: .65; }
.chat-line .flag:hover { opacity: 1; color: #ff9db0; }
.action { position: relative; }
.action.unread::after { content: ''; position: absolute; top: 6px; right: 13px; width: 8px; height: 8px; border-radius: 50%; background: var(--yellow); }
.chat-bubble { position: absolute; left: 50%; bottom: 100%; width: max-content; max-width: 200px; margin-bottom: 4px; padding: 4px 9px; border-radius: 11px; background: #fff; color: #171022; font-size: 12.5px; white-space: normal; overflow-wrap: anywhere; text-align: center; transform: translateX(-50%); }
