/* 온리누들 음악실 — 포털과 같은 팔레트·타이포 (같은 가게의 다른 방).
   unslop-ui 규칙: 이모지 아이콘·필 라디우스·장식 글로우·호버 확대 없음.
   예외는 판정선 발광 — 리듬게임에서 타이밍을 알려주는 기능적 요소다. */
:root {
  --broth:    #17100D;
  --nori:     #0C0806;
  --noodle:   #F3E5C7;
  --steam:    #A2937E;
  --lamp:     #FFB63C;
  --chili:    #C7381F;
  --scallion: #86C06A;
  --line:     rgba(243, 229, 199, 0.16);

  --display: 'Black Han Sans', 'Apple SD Gothic Neo', sans-serif;
  --body: 'IBM Plex Sans KR', 'Apple SD Gothic Neo', sans-serif;
  --mono: 'IBM Plex Mono', ui-monospace, monospace;

  --r: 10px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  background: var(--broth);
  color: var(--noodle);
  font-family: var(--body);
  font-weight: 300;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior: none;
}

.wrap {
  width: 100%; max-width: 820px;
  margin: 0 auto;
  padding: 0 clamp(16px, 5vw, 28px);
}

.mono { font-family: var(--mono); font-size: 0.72rem; letter-spacing: 0.06em; }
.muted { color: var(--steam); }
.hint { color: var(--steam); font-size: 0.8rem; line-height: 1.6; }
.spacer { flex: 1; }
[hidden] { display: none !important; }

/* 상단 */
.top {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 16px;
  padding: clamp(28px, 6vh, 48px) 0 clamp(18px, 4vh, 28px);
  flex-wrap: wrap;
}
.brand h1 {
  font-family: var(--display); font-weight: 400;
  font-size: clamp(1.8rem, 7vw, 2.4rem);
  line-height: 1.1;
}
.brand .sub { color: var(--steam); font-size: 0.86rem; margin-top: 6px; }

.clockbox {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: var(--r);
  color: var(--steam);
  white-space: nowrap;
}
.dot { width: 7px; height: 7px; border-radius: 50%; background: var(--steam); flex: 0 0 auto; }
.dot.ok { background: var(--scallion); }
.dot.bad { background: var(--chili); }

/* 카드 */
.card {
  border: 1px solid var(--line);
  border-radius: var(--r);
  background: var(--nori);
  padding: clamp(16px, 3.5vw, 22px);
  margin-bottom: 16px;
}
.cardhead {
  display: flex; align-items: baseline; justify-content: space-between;
  gap: 12px; margin-bottom: 14px;
}
.card h2 {
  font-family: var(--display); font-weight: 400;
  font-size: 1.12rem; letter-spacing: 0.01em;
}

.row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }

.field { margin-bottom: 14px; }
.field label { display: block; font-size: 0.8rem; color: var(--steam); margin-bottom: 6px; }
.field input[type="text"] {
  width: 100%;
  padding: 11px 13px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: rgba(243, 229, 199, 0.04);
  color: var(--noodle);
  font-family: var(--body); font-size: 0.95rem;
}
.field input:focus { outline: 2px solid var(--lamp); outline-offset: 2px; }
.field .hint { margin-top: 6px; }

/* 버튼 */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  padding: 11px 20px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: transparent;
  color: var(--noodle);
  font-family: var(--body); font-weight: 600; font-size: 0.92rem;
  cursor: pointer;
  transition: background .2s, border-color .2s;
}
.btn.primary { background: var(--lamp); color: #241503; border-color: transparent; }
.btn.primary:hover { background: #ffc75f; }
.btn.ghost:hover { border-color: rgba(255, 182, 60, 0.6); background: rgba(255, 182, 60, 0.06); }
.btn:disabled { opacity: 0.4; cursor: not-allowed; }

select, input[type="range"] { accent-color: var(--lamp); }
select {
  padding: 7px 9px;
  border: 1px solid var(--line); border-radius: 5px;
  background: var(--broth); color: var(--noodle);
  font-family: var(--body); font-size: 0.82rem;
}

/* 진행 바 */
.bar {
  height: 5px; border-radius: 3px;
  background: rgba(243, 229, 199, 0.1);
  overflow: hidden; margin-bottom: 14px;
}
.barfill { height: 100%; width: 0; background: var(--lamp); }

.vol { display: inline-flex; align-items: center; gap: 8px; font-size: 0.8rem; color: var(--steam); }
.vol input[type="range"] { width: 110px; }

/* ── 연주 화면 (리듬게임) ── */
.stage {
  position: relative;
  border: 1px solid var(--line);
  border-radius: var(--r);
  background: #090605;
  overflow: hidden;
  margin-bottom: 16px;
}
#lanes { display: block; width: 100%; height: auto; touch-action: none; }

.hud {
  position: absolute; top: 12px; left: 14px; right: 14px;
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 12px; pointer-events: none;
}
.hud-combo {
  font-family: var(--display); font-weight: 400;
  font-size: clamp(1.6rem, 6vw, 2.4rem);
  line-height: 1;
  color: var(--lamp);
}
.hud-combo small { display: block; font-family: var(--mono); font-size: 0.6rem; color: var(--steam); letter-spacing: 0.12em; }
.hud-right { text-align: right; font-family: var(--mono); font-size: 0.74rem; color: var(--steam); }
.hud-right b { color: var(--noodle); font-weight: 500; }

.hud-judge {
  position: absolute; left: 0; right: 0; top: 46%;
  text-align: center;
  font-family: var(--display); font-weight: 400;
  font-size: clamp(1.4rem, 5vw, 2rem);
  pointer-events: none;
  opacity: 0;
}
.hud-judge.show { animation: judgePop .5s ease-out; }
@keyframes judgePop {
  0%   { opacity: 0; transform: scale(1.25); }
  18%  { opacity: 1; transform: scale(1); }
  100% { opacity: 0; }
}
.j-PERFECT { color: var(--lamp); }
.j-GREAT   { color: var(--scallion); }
.j-GOOD    { color: #7fc4e8; }
.j-MISS    { color: var(--chili); }

.keyhints {
  display: flex; gap: 6px; justify-content: center;
  padding: 10px 0 0;
}
.keyhints span {
  flex: 1 1 0; max-width: 90px;
  text-align: center;
  padding: 7px 0;
  border: 1px solid var(--line); border-radius: 5px;
  font-family: var(--mono); font-size: 0.7rem; color: var(--steam);
}
.keyhints span.hit { background: rgba(255, 182, 60, 0.18); color: var(--noodle); }

/* 파트 목록 */
.parts, .peers { list-style: none; }

.part {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 6px 14px;
  padding: 14px 0;
  border-top: 1px solid var(--line);
}
.parts li:first-child .part { border-top: 0; }
.part.mine { background: rgba(255, 182, 60, 0.06); }

.part-name { font-size: 0.98rem; }
.part-meta { color: var(--steam); font-size: 0.76rem; font-family: var(--mono); }
.part-owner { font-size: 0.78rem; color: var(--lamp); text-align: right; }
.part-owner.other { color: var(--steam); }

.part-ctrl {
  grid-column: 1 / -1;
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding-top: 4px;
}
.part-ctrl input[type="range"] { width: 96px; }
.part-ctrl .lbl { font-size: 0.74rem; color: var(--steam); }
.chip {
  padding: 5px 10px;
  border: 1px solid var(--line); border-radius: 5px;
  background: transparent; color: var(--noodle);
  font-family: var(--body); font-size: 0.78rem; cursor: pointer;
}
.chip.on { background: var(--chili); border-color: transparent; color: #fff; }

/* 참가자 / 순위 */
.peers li {
  display: grid;
  grid-template-columns: 1fr auto auto;
  align-items: baseline; gap: 12px;
  padding: 9px 0;
  border-top: 1px solid var(--line);
  font-size: 0.9rem;
}
.peers li:first-child { border-top: 0; }
.peers .me { color: var(--lamp); }
.peers .stat { font-family: var(--mono); font-size: 0.74rem; color: var(--steam); }
.peers .stat b { color: var(--noodle); font-weight: 500; }

/* 카운트다운 */
.countdown {
  position: fixed; inset: 0; z-index: 50;
  display: grid; place-items: center;
  background: rgba(12, 8, 6, 0.85);
  pointer-events: none;
}
.countdown span {
  font-family: var(--display); font-weight: 400;
  font-size: clamp(5rem, 26vw, 12rem);
  color: var(--lamp);
  line-height: 1;
}

/* 발 */
.foot {
  border-top: 1px solid var(--line);
  margin-top: 8px;
  padding: 26px 0 44px;
  color: var(--steam); font-size: 0.8rem;
  display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap;
}
.foot a { color: var(--noodle); text-decoration: none; border-bottom: 1px solid var(--line); }
.foot a:hover { color: var(--lamp); border-color: var(--lamp); }

:focus-visible { outline: 2px solid var(--lamp); outline-offset: 3px; border-radius: 3px; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: .001ms !important; animation-duration: .001ms !important; }
}
