/* ---- 연습 플레이어 ---- */
/* 화면 아래에 붙는 도크. 사이트와 같은 serif·무채색에, 켜짐/반복 같은 '활성' 상태만 accent 로 표시한다. */

.has-dock {
  padding-bottom: var(--dock-h, 0px);
}

/* 곡 패널 탭 줄 오른쪽의 '연습' 버튼 */
.viewbar__practice {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 2px 7px;
  font-family: var(--serif);
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--accent);
  background: none;
  border: 0;
  border-bottom: 3px solid transparent;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: border-color 0.16s ease;
}
.viewbar__practice:hover,
.viewbar__practice:focus-visible {
  border-bottom-color: var(--accent);
  outline: none;
}
.icon {
  display: inline-grid;
  place-items: center;
}
.icon svg {
  width: 1em;
  height: 1em;
  fill: currentColor;
}
.viewbar__practice .icon svg {
  width: 0.75em;
  height: 0.75em;
}

.dock {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 20;
  background: var(--bg);
  border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom);
  font-family: var(--serif);
  color: var(--ink);
  /* 채널 카드·버튼 hover 바탕 */
  --sunken: #f4f4f4;
  --press: #e9e9e9;
}
.dock[hidden] {
  display: none;
}
.dock__inner {
  max-width: 640px;
  margin: 0 auto;
  padding: 6px clamp(16px, 4vw, 28px) 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.dock button {
  font-family: inherit;
  -webkit-tap-highlight-color: transparent;
}
.dock button:disabled {
  opacity: 0.35;
  cursor: default;
}
.dock button:focus-visible,
.dock input:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 2px;
}

/* 제목 줄 */
.dock__head {
  display: flex;
  align-items: center;
  gap: 6px;
  min-height: 36px;
}
.dock__title {
  flex: 1;
  min-width: 0;
  padding: 4px 0;
  text-align: left;
  background: none;
  border: 0;
  color: inherit;
  cursor: pointer;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.dock__name {
  font-weight: 900;
  font-size: 1.05rem;
}
.dock__artist {
  margin-left: 0.45em;
  font-weight: 700;
  font-size: 0.9rem;
  color: var(--muted);
}
.dock__title:hover .dock__name {
  color: var(--accent);
}
.dock__icon {
  flex: none;
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  padding: 0;
  background: none;
  border: 0;
  color: var(--muted);
  font-size: 20px;
  cursor: pointer;
  transition: color 0.16s ease, transform 0.2s ease;
}
.dock__icon:hover {
  color: var(--accent);
}
.dock--folded .dock__fold {
  transform: rotate(180deg);
}

/* 파형 타임라인 */
.tl {
  position: relative;
  height: 52px;
}
.tl__wave {
  display: block;
  width: 100%;
  height: 100%;
  touch-action: none;
  cursor: pointer;
}
.tl__wave:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 2px;
}
.tl__status {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: var(--bg);
  font-size: 0.85rem;
  color: var(--muted);
}
.tl__status[hidden],
.tl__bar[hidden],
.dock [hidden] {
  display: none;
}
.tl__bar {
  width: min(240px, 60%);
  height: 2px;
  background: var(--line);
  overflow: hidden;
}
.tl__fill {
  display: block;
  height: 100%;
  background: var(--accent);
  transform-origin: left;
  transform: scaleX(0);
  transition: transform 0.2s ease;
}

/* 재생 줄 · 도구 줄 */
.dock__row {
  display: flex;
  align-items: center;
  gap: 6px;
}
.tbtn {
  flex: none;
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: none;
  color: var(--ink);
  font-size: 22px;
  cursor: pointer;
  transition: background-color 0.16s ease, color 0.16s ease;
}
.tbtn:hover:not(:disabled) {
  color: var(--accent);
}
.tbtn--play {
  background: var(--ink);
  color: #fff;
}
.tbtn--play:hover:not(:disabled) {
  background: var(--accent);
  color: #fff;
}
.dock__time {
  margin-left: 4px;
  font-size: 0.9rem;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.dock__dur {
  color: var(--muted);
}
.chip {
  flex: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  height: 36px;
  min-width: 36px;
  padding: 0 12px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: var(--bg);
  color: var(--ink);
  font-size: 0.82rem;
  font-weight: 700;
  white-space: nowrap;
  cursor: pointer;
  transition: background-color 0.16s ease, color 0.16s ease,
    border-color 0.16s ease, transform 0.1s ease;
}
.chip:hover:not(:disabled) {
  border-color: var(--accent);
  color: var(--accent);
}
.chip.is-set {
  border-color: var(--accent);
  color: var(--accent);
}
.chip.is-on,
.chip.is-on:hover:not(:disabled) {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}
.dock__row--tools .chip--more {
  margin-left: auto;
}
.ui-icon {
  flex: none;
  display: inline-grid;
  place-items: center;
}
.ui-icon svg {
  display: block;
  width: 15px;
  height: 15px;
}

/* 누를 때 살짝 눌리는 느낌(단독 버튼). 묶음 안 버튼은 바탕색으로 */
.tbtn:active:not(:disabled),
.dock__icon:active:not(:disabled),
.chip:active:not(:disabled) {
  transform: scale(0.94);
}
.group > .chip:active:not(:disabled) {
  transform: none;
}

/* 한 덩어리 버튼 묶음: 테두리 하나에 칸막이 선 — A·B·반복, 배속 */
.group {
  flex: none;
  display: flex;
  height: 36px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  overflow: hidden;
  background: var(--bg);
}
.group > button {
  height: 100%;
  border: 0;
  border-radius: 0;
  background: none;
  color: var(--ink);
  cursor: pointer;
}
.group > button + button {
  border-left: 1px solid var(--line);
}
.group > button:hover:not(:disabled) {
  background: var(--sunken);
  color: var(--accent);
}
.group > button:active:not(:disabled) {
  background: var(--press);
}
.loopctl {
  margin-left: auto;
}
.loopctl .chip--ab {
  width: 36px;
  padding: 0;
}
.loopctl .chip--loop {
  padding: 0 12px 0 10px;
}
.loopctl .chip.is-set {
  color: var(--accent);
}
.loopctl .chip.is-on,
.loopctl .chip.is-on:hover:not(:disabled) {
  background: var(--accent);
  color: #fff;
}

.speed__btn {
  width: 34px;
  padding: 0;
  font-size: 1.1rem;
}
.speed__val {
  min-width: 50px;
  padding: 0 4px;
  font-size: 0.82rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.speed.is-changed .speed__val {
  color: var(--accent);
}

/* 믹서: 악기마다 옅은 회색 카드 한 장 — [아이콘 + 이름] 아래 붙어 있는 Mute | Solo */
.mixer {
  --gap: 6px;
  display: grid;
  grid-template-columns: repeat(var(--n, 5), minmax(0, 1fr)) 28px;
  gap: var(--gap);
}
.strip {
  display: grid;
  grid-template-rows: 1fr auto;
  gap: 6px;
  min-width: 0;
  padding: 7px var(--pad, 5px) var(--pad, 5px);
  border-radius: 10px;
  background: var(--sunken);
  container-type: inline-size;
}
.strip__label {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  min-width: 0;
  min-height: 20px;
  font-size: 0.78rem;
  font-weight: 700;
  line-height: 1.1;
  color: var(--ink);
  transition: color 0.16s ease;
}
/* 뮤트됐거나 다른 악기 솔로 때문에 안 들리는 채널 */
.strip__label.is-silent {
  color: var(--muted);
}
.strip__name {
  min-width: 0;
}
.inst-icon {
  flex: none;
  display: grid;
  place-items: center;
}
.inst-icon svg {
  display: block;
  width: 15px;
  height: 15px;
  fill: currentColor;
}
.strip__btns {
  display: grid;
  grid-template-columns: 1fr 1fr;
  height: 30px;
  border: 1px solid var(--line-strong);
  border-radius: 7px;
  overflow: hidden;
  background: var(--bg);
}
.strip__btn {
  min-width: 0;
  height: 100%;
  padding: 0;
  border: 0;
  background: none;
  color: var(--ink);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  cursor: pointer;
  transition: background-color 0.16s ease, color 0.16s ease;
}
.strip__btn + .strip__btn {
  border-left: 1px solid var(--line);
}
.strip__btn:hover:not(:disabled) {
  background: var(--sunken);
  color: var(--accent);
}
.strip__btn:active:not(:disabled) {
  background: var(--press);
}
/* 켜짐: Mute = 먹색, Solo = accent — 한눈에 구분되게 */
.strip__btn--mute.is-on,
.strip__btn--mute.is-on:hover:not(:disabled) {
  background: var(--ink);
  color: #fff;
}
.strip__btn--solo.is-on,
.strip__btn--solo.is-on:hover:not(:disabled) {
  background: var(--accent);
  color: #fff;
}
/* 카드 안쪽 폭이 좁으면(폰) M / S, 넉넉하면 Mute / Solo */
.strip__full {
  display: none;
}
@container (min-width: 74px) {
  .strip__full {
    display: inline;
  }
  .strip__abbr {
    display: none;
  }
}
/* 폰: 아이콘·글자를 줄여 [아이콘 이름] 한 줄 유지 */
@container (max-width: 56px) {
  .strip__label {
    gap: 3px;
    font-size: 0.68rem;
  }
  .inst-icon svg {
    width: 12px;
    height: 12px;
  }
}
/* 그래도 안 들어가는 아주 좁은 카드(악기 6개 + 작은 폰)만 아이콘을 이름 위로 */
@container (max-width: 44px) {
  .strip__label {
    flex-direction: column;
    justify-content: flex-start;
    gap: 2px;
    text-align: center;
  }
  .strip__name {
    overflow-wrap: anywhere;
  }
}
/* 좁은 화면: 카드 사이·안쪽 여백을 줄여 버튼 폭을 확보 */
@media (max-width: 440px) {
  .mixer {
    --gap: 4px;
    --pad: 3px;
  }
  .strip {
    border-radius: 8px;
  }
}
.mixer__reset {
  align-self: end;
  display: grid;
  place-items: center;
  width: 28px;
  height: 30px;
  padding: 0;
  border: 0;
  border-radius: 7px;
  background: none;
  color: var(--muted);
  cursor: pointer;
  transition: color 0.16s ease, background-color 0.16s ease;
}
.mixer__reset .ui-icon svg {
  width: 16px;
  height: 16px;
}
.mixer__reset:hover:not(:disabled) {
  background: var(--sunken);
  color: var(--accent);
}
/* 풀 게 없으면 자리만 두고 숨긴다 */
.mixer__reset:disabled {
  visibility: hidden;
}

/* 설정 패널 */
.more {
  display: grid;
  gap: 16px;
  max-height: 42vh;
  padding-top: 10px;
  border-top: 1px solid var(--line);
  overflow-y: auto;
  overscroll-behavior: contain;
}
.more__sec {
  display: grid;
  gap: 8px;
  justify-items: start;
}
.more__label {
  font-size: 0.9rem;
  font-weight: 700;
}
.more__sub {
  margin-left: 8px;
  font-size: 0.78rem;
  font-weight: 400;
  color: var(--muted);
}
.more__line {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 8px;
}
.more__key {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--muted);
}
.more__hint {
  margin: 0;
  font-size: 0.78rem;
  line-height: 1.6;
  color: var(--muted);
}
.more .chip {
  height: 32px;
  font-size: 0.8rem;
}

.seg {
  display: inline-flex;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  overflow: hidden;
}
.seg__btn {
  height: 32px;
  padding: 0 12px;
  border: 0;
  background: none;
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 700;
  cursor: pointer;
}
.seg__btn + .seg__btn {
  border-left: 1px solid var(--line);
}
.seg__btn:hover {
  background: var(--sunken);
  color: var(--accent);
}
.seg__btn[aria-checked="true"],
.seg__btn[aria-checked="true"]:hover {
  background: var(--ink);
  color: #fff;
}
.dock__versions .seg__btn {
  height: 28px;
  padding: 0 10px;
}

.stepper {
  display: inline-flex;
  align-items: center;
  height: 32px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  overflow: hidden;
}
.stepper__btn {
  width: 32px;
  height: 30px;
  padding: 0;
  border: 0;
  background: none;
  color: var(--ink);
  font-size: 1rem;
  cursor: pointer;
}
.stepper__btn:hover {
  background: var(--sunken);
  color: var(--accent);
}
.stepper__btn:active {
  background: var(--press);
}
.stepper__val {
  align-self: stretch;
  display: grid;
  place-items: center;
  border-left: 1px solid var(--line);
  border-right: 1px solid var(--line);
  min-width: 58px;
  text-align: center;
  font-size: 0.82rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.bpm {
  width: 64px;
  height: 32px;
  padding: 0 6px;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  font: inherit;
  font-size: 0.9rem;
  font-weight: 700;
  text-align: center;
  color: var(--ink);
  background: var(--bg);
}
.check {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 32px;
  font-size: 0.82rem;
  cursor: pointer;
}
.check input {
  width: 16px;
  height: 16px;
  accent-color: var(--accent);
}

/* 접힘: 제목 + 재생 줄만 */
.dock--folded .tl,
.dock--folded .dock__row--tools,
.dock--folded .mixer,
.dock--folded .more {
  display: none;
}

/* 짧게 뜨는 안내 */
.dock__hint {
  position: absolute;
  left: 50%;
  bottom: calc(100% + 10px);
  max-width: calc(100% - 32px);
  padding: 8px 14px;
  border-radius: 999px;
  background: var(--ink);
  color: #fff;
  font-size: 0.82rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  pointer-events: none;
  opacity: 0;
  transform: translate(-50%, 6px);
  transition: opacity 0.2s ease, transform 0.2s ease;
}
.dock__hint--show {
  opacity: 1;
  transform: translate(-50%, 0);
}

/* 카운트인 숫자 — 보면대 위 폰에서도 보이게 크게 */
.countin {
  position: fixed;
  left: 0;
  right: 0;
  top: 0;
  bottom: var(--dock-h, 0px);
  z-index: 19;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.15s ease;
}
.countin--show {
  opacity: 1;
}
.countin__num {
  font-family: var(--serif);
  font-weight: 900;
  font-size: clamp(7rem, 34vw, 14rem);
  line-height: 1;
  color: var(--accent);
  text-shadow: 0 0 24px #fff, 0 0 48px #fff, 0 0 72px #fff;
}
.countin__sub {
  min-height: 1.4em;
  font-family: var(--serif);
  font-weight: 700;
  color: var(--muted);
  text-shadow: 0 0 12px #fff;
}
.countin--pulse .countin__num {
  animation: count-pulse 0.25s ease-out;
}
@keyframes count-pulse {
  from {
    transform: scale(1.18);
    opacity: 0.5;
  }
  to {
    transform: scale(1);
    opacity: 1;
  }
}

@media (max-width: 400px) {
  .dock__time {
    font-size: 0.82rem;
  }
  .chip {
    padding: 0 10px;
  }
  /* 폰에선 '반복' 글자만 */
  .loopctl .chip--loop {
    padding: 0 10px;
  }
  .loopctl .chip--loop .ui-icon {
    display: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  .dock *,
  .countin,
  .dock__hint {
    transition: none !important;
  }
  .countin--pulse .countin__num {
    animation: none;
  }
}
