:root {
  --bg: #1b1410;
  --ink: #f4e9d8;
  --accent: #e8a33d;
}
* { box-sizing: border-box; }
html, body {
  height: 100%;
  margin: 0;
  overflow: hidden; /* 스크롤 없음 */
  overscroll-behavior: none;
  background: var(--bg);
  color: var(--ink);
  font-family: system-ui, sans-serif;
}
/* 캔버스가 화면 전체(동적 뷰포트: 모바일 주소창 대응) */
main { position: fixed; inset: 0; height: 100dvh; }
canvas { display: block; width: 100%; height: 100%; touch-action: none; }

.hud, .hint {
  position: fixed;
  left: 0;
  right: 0;
  z-index: 1;
  pointer-events: none;
  text-shadow: 0 1px 4px #000c;
}
.hud { top: 0; display: flex; gap: 1rem; align-items: center; padding: .6rem 1rem; background: linear-gradient(#000a, transparent); }
.hud h1 { margin: 0; font: inherit; font-weight: 700; line-height: 1; font-size: 1.1rem; color: var(--accent); letter-spacing: .08em; text-transform: uppercase; }
.hud small { font-size: .7rem; opacity: .7; }
.hud .switch { pointer-events: auto; color: var(--ink); font-size: .8rem; opacity: .8; }
.hud button {
  pointer-events: auto;
  cursor: pointer;
  font: inherit;
  font-size: .8rem;
  color: var(--ink);
  background: #0006;
  border: 1px solid #f4e9d855;
  border-radius: 999px;
  padding: .15rem .7rem;
}
.hud .cam { display: inline-flex; gap: .25rem; }
.hud .cam button { padding: .15rem .5rem; min-width: 2rem; touch-action: none; }
.hud button:hover, .hud button:focus-visible { border-color: var(--accent); outline: none; }
#status { opacity: .75; font-size: .85rem; }
.hint { bottom: 0; margin: 0; padding: .5rem; text-align: center; font-size: .8rem; opacity: .65; padding-bottom: max(.5rem, env(safe-area-inset-bottom)); }

/* 춤 신청 UI */
#dance-ui {
  position: fixed;
  left: 0;
  right: 0;
  bottom: max(6.4rem, calc(env(safe-area-inset-bottom) + 5.8rem));
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .5rem;
  pointer-events: none;
}
.card {
  pointer-events: auto;
  display: flex;
  align-items: center;
  gap: .6rem;
  flex-wrap: wrap;
  justify-content: center;
  max-width: calc(100vw - 1.5rem);
  padding: .5rem .8rem;
  background: #1b1410ee;
  border: 1px solid #d9a44188;
  border-radius: 12px;
  box-shadow: 0 8px 30px #000a;
  font-size: .9rem;
}
.card[hidden] { display: none; }
.card .label { opacity: .65; font-size: .8rem; }
.card button {
  cursor: pointer;
  font: inherit;
  color: var(--ink);
  background: #f4e9d814;
  border: 1px solid #f4e9d855;
  border-radius: 999px;
  padding: .25rem .8rem;
}
.card button:hover:not(:disabled), .card button:focus-visible { border-color: var(--accent); outline: none; }
.card button.primary, .card button[aria-pressed="true"] { background: var(--accent); color: #1b1410; border-color: var(--accent); font-weight: 600; }
.card button:disabled { opacity: .45; cursor: not-allowed; }
#move-buttons { display: inline-flex; gap: .4rem; flex-wrap: wrap; justify-content: center; }

#dev-badge { font-size: .7rem; padding: .1rem .5rem; border-radius: 999px; background: #e8a33d33; border: 1px solid #e8a33d88; color: var(--accent); }
#dev-badge[hidden] { display: none; }

/* 캐릭터 설정: 박스(카드) 없이 화면 전체를 쓰고, 입장 버튼은 항상 맨 아래에 고정 */
#picker { position: fixed; inset: 0; z-index: 10; background: radial-gradient(#2a1a10, #0b0605); display: flex; justify-content: center; }
#picker[hidden] { display: none; }
.picker-wrap { width: min(820px, 100%); height: 100dvh; display: flex; flex-direction: column; padding: 1rem 1.2rem 0; }
.picker-head { flex: none; display: flex; align-items: baseline; gap: .8rem; flex-wrap: wrap; }
.picker-head h2 { margin: 0; font-size: 1.5rem; color: var(--accent); letter-spacing: .06em; text-transform: uppercase; }
.picker-sub { margin: 0; opacity: .75; font-size: .95rem; }
.picker-body { flex: 1; min-height: 0; display: flex; gap: 1.4rem; margin-top: .8rem; overflow-y: auto; align-items: flex-start; padding: 4px; margin-inline: -4px; }
#picker-preview { width: 240px; height: 300px; border-radius: 14px; flex: none; position: sticky; top: 0; }
.picker-controls { flex: 1 1 300px; min-width: 0; display: grid; gap: .7rem; align-content: start; padding-bottom: .5rem; }
.tabs { display: flex; gap: .3rem; border-bottom: 1px solid #f4e9d833; }
.tabs button { font: inherit; font-size: .9rem; color: var(--ink); opacity: .7; background: none; border: 0; border-bottom: 3px solid transparent; padding: .45rem .9rem; cursor: pointer; }
.tabs button[aria-selected="true"] { opacity: 1; color: var(--accent); border-bottom-color: var(--accent); font-weight: 600; }
.tabs button:hover { opacity: 1; }
.tabs button:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.panel { display: grid; gap: .8rem; align-content: start; }
.panel[hidden], #outfit-set[hidden], #outfit-mix[hidden] { display: none; }
#outfit-set, #outfit-mix { display: grid; gap: .8rem; }
.picker-controls .field { display: grid; gap: .25rem; font-size: .85rem; opacity: .9; }
.picker-controls input { font: inherit; padding: .45rem .6rem; border-radius: 8px; border: 1px solid #f4e9d855; background: #0006; color: var(--ink); }
.picker-controls input:focus-visible { outline: 2px solid var(--accent); }
.picker-controls fieldset { border: 0; padding: 0; margin: 0; min-width: 0; }
.picker-controls legend { font-size: .8rem; opacity: .7; padding: 0; margin-bottom: .3rem; }
.picker-foot { flex: none; padding: .7rem 0 max(.8rem, env(safe-area-inset-bottom)); border-top: 1px solid #f4e9d822; display: flex; }
.picker-foot .go { flex: 1; }
/* 폰: 미리보기를 위에 작게, 컨트롤은 아래에서 스크롤 — 입장 버튼은 항상 보인다 */
@media (max-width: 640px) {
  .picker-body { flex-direction: column; align-items: stretch; gap: .6rem; }
  #picker-preview { position: static; width: 150px; height: 188px; align-self: center; }
}
.chips { display: flex; flex-wrap: wrap; gap: .35rem; }
.chip { display: inline-flex; align-items: center; gap: .35rem; font: inherit; font-size: .8rem; color: var(--ink); background: #f4e9d814; border: 1px solid #f4e9d855; border-radius: 999px; padding: .25rem .65rem; cursor: pointer; }
.chip:hover, .chip:focus-visible { border-color: var(--accent); outline: none; }
.chip[aria-pressed="true"] { background: var(--accent); color: #1b1410; border-color: var(--accent); font-weight: 600; }
.swatch { width: .8rem; height: .8rem; border-radius: 50%; border: 1px solid #0008; display: inline-block; }
.go { font: inherit; font-weight: 700; font-size: 1rem; padding: .75rem 1rem; border-radius: 999px; border: 0; background: var(--accent); color: #1b1410; cursor: pointer; margin-top: .2rem; }
.go:hover, .go:focus-visible { filter: brightness(1.1); outline: 2px solid #fff8; }

/* 음악·옷: 아이콘만, 테두리 없이 */
.hud button.icon { border: 0; background: none; font-size: 1.35rem; line-height: 1; padding: .1rem .3rem; border-radius: 8px; }
.hud button.icon:hover { background: #f4e9d822; }
.hud button.icon:focus-visible { outline: 2px solid var(--accent); }

/* 폰(터치 기기): 키보드 안내와 상단 카메라 버튼은 필요 없다 (드래그·핀치로 조작) */
@media (hover: none) and (pointer: coarse) {
  .hint, .hud .cam { display: none; }
  /* 좁은 화면: 상단 줄을 한 줄로 */
  .hud { flex-wrap: nowrap; white-space: nowrap; gap: .5rem; padding: .5rem .7rem; }
  .hud h1 { font-size: .95rem; }
  #dev-badge { font-size: .6rem; padding: .05rem .35rem; }
  #status { overflow: hidden; text-overflow: ellipsis; min-width: 0; }
}

/* 이미지(SVG) 아이콘 */
.ic { width: 1.35rem; height: 1.35rem; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; display: block; }
.hud .cam button .ic { width: 1.05rem; height: 1.05rem; }
.hud .cam button { display: inline-grid; place-items: center; }
.hud button.icon { display: inline-grid; place-items: center; }

/* 상태 표시줄은 알릴 것이 있을 때만 */
#status:empty { display: none; }

/* 빈티지 필름 느낌: 따뜻한 베일 + 비네팅 + 필름 그레인 (장면 위에 겹치는 가벼운 레이어) */
#vintage { position: fixed; inset: 0; z-index: 0; pointer-events: none; }
#vintage::before { content: ''; position: absolute; inset: 0; opacity: .16; mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E"); }
#vintage::after { content: ''; position: absolute; inset: 0;
  background: radial-gradient(ellipse at center, rgba(255, 230, 185, 0) 52%, rgba(40, 20, 8, .5) 100%), rgba(255, 224, 168, .08); }


/* 맨 아래 줄: 기분 표현 · 스윙댄스 배우기. 같은 크기, 같은 줄.
   폰: 기분 표현은 왼쪽, 스윙댄스 배우기는 오른쪽 정렬. PC: 두 개를 붙여 가운데에 둔다. */
#bottom-bar {
  position: fixed; left: 0; right: 0; bottom: max(.5rem, env(safe-area-inset-bottom)); z-index: 4;
  display: flex; justify-content: space-between; align-items: flex-end; gap: .6rem;
  padding-inline: max(.7rem, env(safe-area-inset-left)) max(.7rem, env(safe-area-inset-right)); pointer-events: none;
}
#bottom-bar > * { pointer-events: auto; }
@media (hover: hover) and (min-width: 720px) { #bottom-bar { justify-content: center; } }
.bar-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .45rem; min-width: 9.6rem; height: 2.4rem; padding: 0 .95rem;
  font: inherit; font-size: .9rem; font-weight: 600; border-radius: 999px; cursor: pointer; text-decoration: none; white-space: nowrap;
}
#emote-ui { position: relative; }
#emote-toggle { color: var(--ink); background: #1b1410dd; border: 1px solid #f4e9d844; }
#emote-toggle:hover, #emote-toggle:focus-visible, #emote-toggle[aria-expanded="true"] { border-color: var(--accent); outline: none; }
body.seated #emote-toggle { border-color: #e8a33d99; background: #2a1c10ee; }
#brand { color: #1b1410; background: var(--accent); border: 1px solid var(--accent); box-shadow: 0 2px 10px #0006; }
#brand:hover, #brand:focus-visible { filter: brightness(1.1); outline: 2px solid #fff8; outline-offset: 2px; }
#emote-panel { position: absolute; left: 0; bottom: calc(100% + .45rem); width: min(21rem, calc(100vw - 1.4rem)); max-height: 52vh; overflow-y: auto; padding: .6rem; background: #1b1410f2; border: 1px solid #e8a33d66; border-radius: 14px; box-shadow: 0 8px 30px #000a; }
#emote-panel[hidden], #emote-seated-wrap[hidden] { display: none; }
.emote-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: .35rem; }
.emote-title { margin: .6rem 0 .3rem; font-size: .75rem; color: var(--accent); opacity: .9; }
.emote-btn { display: grid; justify-items: center; gap: .1rem; font: inherit; color: var(--ink); background: #f4e9d812; border: 1px solid #f4e9d822; border-radius: 10px; padding: .4rem .2rem; cursor: pointer; }
.emote-btn:hover, .emote-btn:focus-visible { border-color: var(--accent); background: #f4e9d822; outline: none; }
.emote-emoji { font-size: 1.5rem; line-height: 1.1; }
.emote-label { font-size: .7rem; opacity: .8; }
@media (hover: hover) { .hint { bottom: 3.3rem; } }

/* 색 고르기 칩: 글자 없이 동그란 색 */
.chip.chip-color { width: 1.8rem; height: 1.8rem; padding: 0; border-radius: 50%; border: 2px solid #0006; }
.chip.chip-color[aria-pressed="true"] { border-color: #fff; box-shadow: 0 0 0 2px var(--accent); }

/* 칩 묶음 제목(짧은 머리 / 긴 머리) */
.chip-group { flex-basis: 100%; font-size: .75rem; opacity: .6; margin-top: .2rem; }
.chip-group:first-child { margin-top: 0; }

/* 상단: 음악·설정 아이콘은 오른쪽 끝 */
.hud .hud-right { margin-left: auto; display: inline-flex; align-items: center; gap: .15rem; }

/* 상단 오른쪽 음악·설정 아이콘: 회색빛, 같은 크기, 넉넉한 간격 */
.hud .hud-right { gap: .9rem; }
.hud .hud-right button.icon { width: 2.1rem; height: 2.1rem; padding: 0; color: #b4aea3; }
.hud .hud-right button.icon .ic { width: 1.35rem; height: 1.35rem; }
.hud .hud-right button.icon:hover, .hud .hud-right button.icon:focus-visible { color: var(--ink); }
#count { color: #c4bdb1; }

/* 동작 박스: 투명, 테두리 없음 (버튼만 보인다) */
#moves-card, #solo-card { background: transparent; border: 0; box-shadow: none; padding: 0; }
#moves-card button, #solo-card button { background: #1b1410bb; text-shadow: 0 1px 3px #000a; }
#moves-card button[aria-pressed="true"], #solo-card button[aria-pressed="true"] { background: var(--accent); text-shadow: none; }
#solo-buttons { display: inline-flex; gap: .4rem; flex-wrap: wrap; justify-content: center; }

/* 안내 문구가 길어도 제목·인원수는 접히지 않고, 문구가 줄어든다 */
.hud h1, #count, .hud .cam, #dev-badge, .hud .hud-right { flex: none; white-space: nowrap; }
#status { flex: 0 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
