/* =====================================================================
 * hapi — lofi café 스타일
 *  색과 크기는 :root 변수로 모아 두었다. 분위기를 바꾸고 싶으면 여기부터.
 * ===================================================================== */
:root {
  --bg-dark: #1b130e;          /* 장면 뒤 바탕 (그림이 늦게 뜰 때 보이는 색) */
  --cream: #fbf3e6;            /* 기본 글자색 */
  --cream-dim: rgba(251, 243, 230, 0.72);
  --accent: #ffc98a;           /* 강조 (따뜻한 조명색) */
  --accent-strong: #ffb067;
  --sakura: #f7b6c8;           /* 벚꽃 포인트 */
  --glass: rgba(34, 24, 18, 0.48);      /* 반투명 유리 패널 */
  --glass-strong: rgba(30, 21, 16, 0.78);
  --glass-line: rgba(255, 235, 210, 0.16);
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
  --radius: 18px;
  --gutter: 16px;              /* 화면 가장자리 여백 */
  --menu-bg: #f6eee2;          /* 아래 메뉴 영역 배경 */
  --menu-ink: #3b2a20;
  --font: 'Gowun Dodum', 'Apple SD Gothic Neo', 'Malgun Gothic', system-ui, sans-serif;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--bg-dark);
  color: var(--cream);
  font-family: var(--font);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

button {
  font: inherit;
  color: inherit;
  cursor: pointer;
}

[hidden] {
  display: none !important;
}

/* 반투명 유리 느낌 공통 */
.glass {
  background: var(--glass);
  border: 1px solid var(--glass-line);
  -webkit-backdrop-filter: blur(14px) saturate(1.2);
  backdrop-filter: blur(14px) saturate(1.2);
  box-shadow: var(--shadow);
}

/* =====================================================================
 * 첫 화면
 * ===================================================================== */
.hero {
  position: relative;
  height: 100vh;
  height: 100svh; /* 모바일 주소창 높이를 뺀 실제 화면 높이 */
  min-height: 420px;
  overflow: hidden;
  background: var(--bg-dark);
  isolation: isolate;
}

.stage {
  position: absolute;
  inset: 0;
  overflow: hidden;
  touch-action: pan-y; /* 세로 스크롤은 브라우저에 맡기고 가로 끌기는 직접 처리 */
}

.hero.pannable .stage {
  cursor: grab;
}

/* ---------- 장면 ---------- */
.scene {
  position: absolute;
  transition: transform 0.85s cubic-bezier(0.65, 0, 0.35, 1), opacity 0.85s ease;
  will-change: transform;
  user-select: none;
  -webkit-user-select: none;
}

/* 장면 넘기기 애니메이션 */
.scene.from-right { transform: translateX(100vw); }
.scene.from-left { transform: translateX(-100vw); }
.scene.leaving { pointer-events: none; }
.scene.leaving.to-left { transform: translateX(-100vw); }
.scene.leaving.to-right { transform: translateX(100vw); }

/* 배경 2장: 앞에 있는 것만 보이고, 계절 바꿀 때 서서히 교차 */
.scene-bg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  transition: opacity 1.2s ease;
  pointer-events: none;
}
.scene-bg.front {
  opacity: 1;
}

/* 영상 공통: 가장자리를 흐릿하게 섞어서 배경과 경계가 안 보이게 */
.scene-clip {
  position: absolute;
  object-fit: fill;
  pointer-events: none;
  --feather: 15%;
  -webkit-mask-image:
    linear-gradient(to right, transparent 0, #000 var(--feather), #000 calc(100% - var(--feather)), transparent 100%),
    linear-gradient(to bottom, transparent 0, #000 var(--feather), #000 calc(100% - var(--feather)), transparent 100%);
  -webkit-mask-composite: source-in;
  mask-image:
    linear-gradient(to right, transparent 0, #000 var(--feather), #000 calc(100% - var(--feather)), transparent 100%),
    linear-gradient(to bottom, transparent 0, #000 var(--feather), #000 calc(100% - var(--feather)), transparent 100%);
  mask-composite: intersect;
}

/* 반복 영상: 첫 장면이 준비되면 나타남 */
.scene-loop {
  opacity: 0;
  transition: opacity 0.6s ease;
}
.scene-loop.ready {
  opacity: 1;
}

/* 클릭 영상: 평소엔 숨김 → 재생 시작하면 빠르게 나타나고, 끝날 땐 천천히 사라짐 */
.scene-oneshot {
  opacity: 0;
  transition: opacity var(--fade-out, 0.6s) ease;
}
.scene-oneshot.playing {
  opacity: 1;
  transition: opacity 0.18s ease;
}

/* 소품 그림 (인형): 누르면 통 튀고, 노래가 나오는 동안 살랑살랑 */
.scene-prop {
  position: absolute;
  pointer-events: none;
  user-select: none;
  transform-origin: 50% 92%;
}
.scene-prop.playing {
  animation: prop-sway 2.4s ease-in-out infinite;
}
.scene-prop.bounce {
  animation: prop-bounce 0.55s ease;
}
.scene-prop.playing.bounce {
  animation: prop-bounce 0.55s ease, prop-sway 2.4s ease-in-out 0.55s infinite;
}
@keyframes prop-bounce {
  0% { transform: none; }
  25% { transform: scale(1.07, 0.93); }
  55% { transform: translateY(-9%) scale(0.97, 1.04); }
  80% { transform: translateY(0) scale(1.02, 0.98); }
  100% { transform: none; }
}
@keyframes prop-sway {
  0%, 100% { transform: rotate(0deg); }
  25% { transform: rotate(-2.5deg); }
  75% { transform: rotate(2.5deg); }
}
@media (prefers-reduced-motion: reduce) {
  .scene-prop { animation: none !important; }
}

/* 실내 색감: 날씨에 따라 방 전체를 살짝 어둡게/차갑게 (곱하기 합성) */
.room-tint {
  position: absolute;
  inset: 0;
  pointer-events: none;
  mix-blend-mode: multiply;
  background: rgb(255, 255, 255);
  opacity: 0;
  transition: background-color 1.8s ease, opacity 1.8s ease;
}
.scene[data-weather='cloudy'] .room-tint { background: rgb(214, 214, 226); opacity: 1; }
.scene[data-weather='rain'] .room-tint { background: rgb(176, 182, 204); opacity: 1; }
.scene[data-weather='storm'] .room-tint { background: rgb(140, 146, 176); opacity: 1; }
.scene[data-weather='snow'] .room-tint { background: rgb(214, 222, 238); opacity: 1; }

/* 효과 캔버스 */
.fx-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}
.fx-glow {
  mix-blend-mode: screen; /* 빛은 '더하기'처럼 밝게 */
}

/* ---------- 클릭 영역 ---------- */
.hotspots {
  position: absolute;
  inset: 0;
}

.hotspot {
  position: absolute;
  padding: 0;
  border: 0;
  background: transparent;
  border-radius: 40%;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

/* 마우스를 올리면 은은한 빛 테두리 */
.hotspot::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  box-shadow: 0 0 0 0 rgba(255, 214, 160, 0), inset 0 0 0 0 rgba(255, 214, 160, 0);
  background: radial-gradient(closest-side, rgba(255, 220, 170, 0.16), rgba(255, 220, 170, 0));
  opacity: 0;
  transition: opacity 0.25s ease;
}
.hotspot:hover::before,
.hotspot:focus-visible::before {
  opacity: 1;
}
.hotspot:focus-visible {
  outline: 2px dashed rgba(255, 220, 170, 0.8);
  outline-offset: 2px;
}

/*
 * 누를 수 있는 곳 표시용 흰 점
 *  --dx, --dy : 영역 안에서 점의 위치(%) — sceneView.js 가 scenes.js 의 dot 값으로 넣어 줌
 */
.hotspot-dot {
  position: absolute;
  left: var(--dx, 50%);
  top: var(--dy, 50%);
  width: 12px;
  height: 12px;
  margin: -6px 0 0 -6px;
  border-radius: 50%;
  background: #fff;
  /* 얇은 어두운 테두리(밝은 배경에서도 보이게) + 은은한 빛 */
  box-shadow: 0 0 0 1.5px rgba(70, 40, 20, 0.35), 0 0 10px 2px rgba(255, 244, 225, 0.85);
  pointer-events: none;
  animation: breathe 3s ease-in-out infinite;
  transition: opacity 0.4s ease;
}
/* 점에서 퍼져 나가는 물결 고리 */
.hotspot-dot::after {
  content: '';
  position: absolute;
  inset: -2px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.9);
  animation: ripple 3s ease-out infinite;
  animation-delay: inherit;
}
/* 마우스를 올리면 점이 또렷하게 */
.hotspot:hover .hotspot-dot,
.hotspot:focus-visible .hotspot-dot {
  animation: none;
  opacity: 1;
  transform: scale(1.3);
}

@keyframes breathe {
  0%, 100% { opacity: 0.8; transform: scale(0.9); }
  50% { opacity: 1; transform: scale(1); }
}
@keyframes ripple {
  0% { transform: scale(1); opacity: 0.9; }
  70%, 100% { transform: scale(2.8); opacity: 0; }
}

/* 이름표: 흰 점 바로 위에 뜸 */
.hotspot-label {
  position: absolute;
  left: var(--dx, 50%);
  top: var(--dy, 50%);
  transform: translate(-50%, calc(-100% - 10px));
  white-space: nowrap;
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 13px;
  color: var(--cream);
  background: var(--glass-strong);
  border: 1px solid var(--glass-line);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
}
.hotspot:hover .hotspot-label,
.hotspot:focus-visible .hotspot-label {
  opacity: 1;
  transform: translate(-50%, calc(-100% - 14px));
}

/* 소리가 켜진 곳: 흰 점 자리에 음표 배지가 대신 뜸 */
.hotspot::after {
  content: '♪';
  position: absolute;
  left: var(--dx, 50%);
  top: var(--dy, 50%);
  width: 22px;
  height: 22px;
  margin: -11px 0 0 -11px;
  display: grid;
  place-items: center;
  font-size: 13px;
  border-radius: 50%;
  color: #2a1a10;
  background: var(--accent);
  box-shadow: 0 0 12px rgba(255, 190, 110, 0.8);
  opacity: 0;
  transform: scale(0.6);
  transition: opacity 0.3s ease, transform 0.3s ease;
  pointer-events: none;
}
.hotspot.on::after {
  opacity: 1;
  transform: scale(1);
  animation: bob 2.4s ease-in-out infinite;
}
.hotspot.on .hotspot-dot {
  opacity: 0;
  animation: none;
}

/* 처음 입장할 때(또는 💡 버튼으로 다시 켤 때) 이름표를 몇 초 보여 줌 */
.scene.hinting .hotspot:not(.hotspot-hidden) .hotspot-label {
  opacity: 1;
  transform: translate(-50%, calc(-100% - 14px));
}
.scene.hinting .hotspot:not(.hotspot-hidden)::before {
  opacity: 1;
  animation: pulse 1.6s ease-in-out infinite;
}

/*
 * 숨은 소리 (흰 점 없는 사물)
 *  - 마우스를 올리면 아주 은은한 빛 + 작은 이름표만 → 눌러 보며 찾는 재미
 *  - 영역이 넓어서 빛은 주요 사물보다 더 옅게
 */
.hotspot-hidden::before {
  background: radial-gradient(closest-side, rgba(255, 230, 190, 0.1), rgba(255, 230, 190, 0));
}
.hotspot-hidden .hotspot-label {
  font-size: 12px;
  padding: 4px 10px;
  transform: translate(-50%, calc(-50% + 4px));
}
.hotspot-hidden:hover .hotspot-label,
.hotspot-hidden:focus-visible .hotspot-label {
  transform: translate(-50%, -50%);
}
/* 모바일(마우스 없음)에선 숨은 소리 이름표를 띄우지 않음 — 누르면 소리로 알 수 있게 */
@media (hover: none) {
  .hotspot-hidden .hotspot-label {
    display: none;
  }
}

/* 누른 자리에 퍼지는 작은 물결 */
.tap-ripple {
  position: absolute;
  width: 14px;
  height: 14px;
  margin: -7px 0 0 -7px;
  border-radius: 50%;
  border: 2px solid rgba(255, 248, 235, 0.9);
  box-shadow: 0 0 10px rgba(255, 236, 200, 0.6);
  pointer-events: none;
  animation: tap-ripple 0.7s ease-out forwards;
}
@keyframes tap-ripple {
  0% { transform: scale(0.4); opacity: 1; }
  100% { transform: scale(3.2); opacity: 0; }
}

/* 💡 버튼으로 표시를 끄면 점·이름표·음표 배지를 모두 숨겨 그림만 보이게 (마우스 올림 표시는 유지) */
.hero.hide-marks .hotspot-dot,
.hero.hide-marks .hotspot::after {
  opacity: 0 !important;
  animation: none !important;
}
.hero.hide-marks .scene.hinting .hotspot-label,
.hero.hide-marks .scene.hinting .hotspot::before {
  opacity: 0;
  animation: none;
}

@keyframes pulse {
  0%, 100% { opacity: 0.25; }
  50% { opacity: 1; }
}
@keyframes bob {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-4px); }
}

/* =====================================================================
 * 상단 막대
 * ===================================================================== */
.topbar {
  position: absolute;
  z-index: 10;
  top: calc(var(--gutter) + env(safe-area-inset-top, 0px));
  left: var(--gutter);
  right: var(--gutter);
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  pointer-events: none; /* 막대 빈 곳은 아래 장면이 눌리도록 */
}
.topbar > * {
  pointer-events: auto;
}

.logo {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  border-radius: 999px;
  color: var(--cream);
  text-decoration: none;
  background: var(--glass);
  border: 1px solid var(--glass-line);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
}
.logo-mark {
  font-size: 18px;
}
.logo-text {
  font-size: 20px;
  letter-spacing: 0.08em;
}

.controls {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  align-items: center;
  gap: 8px;
}

.pill-group {
  display: flex;
  gap: 4px;
  padding: 4px;
  border-radius: 999px;
  background: var(--glass);
  border: 1px solid var(--glass-line);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 12px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--cream-dim);
  font-size: 14px;
  transition: background 0.2s ease, color 0.2s ease;
}
.pill:hover {
  color: var(--cream);
  background: rgba(255, 240, 220, 0.1);
}
.pill.active {
  color: #2a1a10;
  background: var(--accent);
}

.icon-btn {
  width: 40px;
  height: 40px;
  display: inline-grid;
  place-items: center;
  border-radius: 50%;
  border: 1px solid var(--glass-line);
  background: transparent;
  font-size: 17px;
  line-height: 1;
}
.icon-btn.glass {
  background: var(--glass);
}
.icon-btn:hover {
  background: rgba(255, 240, 220, 0.16);
}
/* 💡 표시를 끈 상태: 흐리게 */
.icon-btn.off {
  opacity: 0.5;
  filter: grayscale(1);
}
.icon-btn[aria-expanded='true'] {
  background: var(--accent);
  color: #2a1a10;
}

/* =====================================================================
 * 장면 넘기기
 * ===================================================================== */
.scene-arrow {
  position: absolute;
  z-index: 9;
  top: 50%;
  width: 46px;
  height: 46px;
  margin-top: -23px;
  border-radius: 50%;
  font-size: 28px;
  line-height: 1;
  display: grid;
  place-items: center;
}
.scene-arrow.prev { left: var(--gutter); }
.scene-arrow.next { right: var(--gutter); }

.scene-dots {
  position: absolute;
  z-index: 9;
  left: 50%;
  bottom: 74px;
  transform: translateX(-50%);
  display: flex;
  gap: 8px;
}
.dot {
  width: 9px;
  height: 9px;
  padding: 0;
  border-radius: 50%;
  border: 0;
  background: rgba(255, 240, 220, 0.4);
}
.dot.active {
  width: 22px;
  border-radius: 999px;
  background: var(--accent);
}

/* =====================================================================
 * 재생 중 음악 표시 (왼쪽 아래)
 * ===================================================================== */
.now-playing {
  position: absolute;
  z-index: 9;
  left: var(--gutter);
  bottom: calc(var(--gutter) + env(safe-area-inset-bottom, 0px));
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 4px 4px 4px 6px;
  border-radius: 999px;
  opacity: 0;
  transform: translateY(12px);
  pointer-events: none;
  transition: opacity 0.4s ease, transform 0.4s ease;
}
.now-playing.show {
  opacity: 1;
  transform: none;
  pointer-events: auto;
}
.np-open {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 6px 10px;
  border: 0;
  background: transparent;
  font-size: 14px;
}
.np-toggle {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 0;
  background: rgba(255, 240, 220, 0.12);
  font-size: 12px;
}
/* 작은 이퀄라이저 막대 (재생 중일 때만 움직임) */
.np-eq {
  display: inline-flex;
  align-items: flex-end;
  gap: 2px;
  height: 14px;
}
.np-eq i {
  width: 3px;
  height: 4px;
  border-radius: 2px;
  background: var(--accent);
}
.now-playing.playing .np-eq i {
  animation: eq 1s ease-in-out infinite;
}
.now-playing.playing .np-eq i:nth-child(2) { animation-delay: 0.2s; }
.now-playing.playing .np-eq i:nth-child(3) { animation-delay: 0.4s; }
@keyframes eq {
  0%, 100% { height: 4px; }
  50% { height: 14px; }
}

/* =====================================================================
 * 위로받기 (오른쪽 아래) + 자막
 * ===================================================================== */
.cheer-btn {
  position: absolute;
  z-index: 9;
  right: var(--gutter);
  bottom: calc(var(--gutter) + env(safe-area-inset-bottom, 0px));
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 44px;
  padding: 0 16px 0 14px;
  border-radius: 999px;
  font-size: 14px;
  opacity: 0;
  transform: translateY(12px);
  pointer-events: none;
  transition: opacity 0.6s ease 0.9s, transform 0.6s ease 0.9s, background 0.3s ease;
}
/* 입장한 뒤에만 보임 */
.hero.entered .cheer-btn {
  opacity: 1;
  transform: none;
  pointer-events: auto;
}
.cheer-btn:hover {
  background: rgba(70, 50, 36, 0.62);
}
.cheer-icon {
  font-size: 16px;
  line-height: 1;
}
/* 말하는 동안: 조명색으로 빛나며 숨 쉬듯 퍼짐 */
.cheer-btn.speaking {
  background: var(--accent);
  color: #2a1a10;
  animation: cheer-glow 1.6s ease-in-out infinite;
}
@keyframes cheer-glow {
  0%, 100% { box-shadow: var(--shadow), 0 0 0 0 rgba(255, 201, 138, 0.55); }
  50% { box-shadow: var(--shadow), 0 0 0 9px rgba(255, 201, 138, 0); }
}

/* 자막 (알림 메시지보다 위쪽) */
.cheer-caption {
  position: absolute;
  z-index: 30;
  left: 50%;
  bottom: calc(136px + env(safe-area-inset-bottom, 0px));
  transform: translate(-50%, 10px);
  width: max-content;
  max-width: min(560px, calc(100% - 32px));
  padding: 12px 22px;
  border-radius: var(--radius);
  font-size: 17px;
  line-height: 1.5;
  text-align: center;
  word-break: keep-all;
  color: var(--cream);
  background: var(--glass-strong);
  border: 1px solid var(--glass-line);
  box-shadow: var(--shadow);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.4s ease, transform 0.4s ease;
}
.cheer-caption.show {
  opacity: 1;
  transform: translate(-50%, 0);
}
/* 말하는 사람 이름 ("화니:") — 조명색으로 살짝 구분 */
.cheer-who {
  margin-right: 8px;
  color: var(--accent);
}

/* =====================================================================
 * 소리 패널 (오른쪽)
 * ===================================================================== */
.panel {
  z-index: 20;
}

.mixer {
  position: absolute;
  top: calc(var(--gutter) + 56px + env(safe-area-inset-top, 0px));
  right: var(--gutter);
  width: 330px;
  max-height: calc(100% - 140px);
  overflow-y: auto;
  padding: 16px;
  border-radius: var(--radius);
  background: var(--glass-strong);
  opacity: 0;
  transform: translateX(24px);
  pointer-events: none;
  transition: opacity 0.3s ease, transform 0.3s ease;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 230, 200, 0.3) transparent;
}
.mixer.open {
  opacity: 1;
  transform: none;
  pointer-events: auto;
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}
.panel-title {
  margin: 0;
  font-size: 17px;
  font-weight: 400;
}

.mix-master {
  display: grid;
  grid-template-columns: auto auto 1fr;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  margin-bottom: 6px;
  border-radius: 14px;
  background: rgba(255, 240, 220, 0.07);
}
.mix-mute {
  border: 0;
  background: transparent;
  font-size: 18px;
  padding: 0;
}
.mix-master-label {
  font-size: 14px;
  color: var(--cream-dim);
}

.mix-group-title {
  margin: 14px 4px 6px;
  font-size: 12px;
  font-weight: 400;
  letter-spacing: 0.1em;
  color: var(--accent);
}

.mix-row {
  display: grid;
  grid-template-columns: 1fr 110px;
  align-items: center;
  gap: 10px;
  padding: 4px 4px 4px 0;
  border-radius: 12px;
}
.mix-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  padding: 8px 10px;
  border: 1px solid transparent;
  border-radius: 12px;
  background: transparent;
  color: var(--cream-dim);
  text-align: left;
  transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}
.mix-toggle:hover {
  background: rgba(255, 240, 220, 0.08);
}
.mix-row.on .mix-toggle {
  color: var(--cream);
  background: rgba(255, 201, 138, 0.16);
  border-color: rgba(255, 201, 138, 0.4);
}
.mix-icon {
  width: 22px;
  text-align: center;
}
.mix-name {
  flex: 1;
  font-size: 14px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.mix-badge {
  font-size: 11px;
  color: var(--cream-dim);
}
.mix-badge:empty {
  display: none;
}
.mix-row.unavailable {
  opacity: 0.45;
}
/* 꺼진 소리의 슬라이더는 흐리게 */
.mix-row:not(.on) .range {
  opacity: 0.45;
}

.btn-ghost {
  width: 100%;
  margin-top: 14px;
  padding: 10px;
  border-radius: 12px;
  border: 1px solid var(--glass-line);
  background: transparent;
  color: var(--cream-dim);
  font-size: 14px;
}
.btn-ghost:hover {
  color: var(--cream);
  background: rgba(255, 240, 220, 0.08);
}

/* ---------- 볼륨 슬라이더 ---------- */
.range {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 22px;
  background: transparent;
  --val: 50%;
}
.range::-webkit-slider-runnable-track {
  height: 4px;
  border-radius: 4px;
  background: linear-gradient(to right, var(--accent) var(--val), rgba(255, 240, 220, 0.2) var(--val));
}
.range::-moz-range-track {
  height: 4px;
  border-radius: 4px;
  background: linear-gradient(to right, var(--accent) var(--val), rgba(255, 240, 220, 0.2) var(--val));
}
.range::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 14px;
  height: 14px;
  margin-top: -5px;
  border-radius: 50%;
  background: var(--cream);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.4);
}
.range::-moz-range-thumb {
  width: 14px;
  height: 14px;
  border: 0;
  border-radius: 50%;
  background: var(--cream);
}

/* =====================================================================
 * 전축 (음악 선택 창)
 * ===================================================================== */
.music-modal {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  padding: var(--gutter);
  background: rgba(10, 6, 4, 0.45);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}
.music-modal.open {
  opacity: 1;
  pointer-events: auto;
}
.music-card {
  width: min(460px, 100%);
  max-height: calc(100% - 20px);
  overflow-y: auto;
  padding: 20px;
  border-radius: 22px;
  background: var(--glass-strong);
  border: 1px solid var(--glass-line);
  -webkit-backdrop-filter: blur(18px);
  backdrop-filter: blur(18px);
  box-shadow: var(--shadow);
  transform: translateY(10px) scale(0.98);
  transition: transform 0.3s ease;
}
.music-modal.open .music-card {
  transform: none;
}

/* ---- 턴테이블 ----
 * --tt: 레코드 받침(플래터) 지름. 톤암 길이·각도는 이 크기에 맞춰 계산해 둠
 * (재생 중 38도 → 바늘이 레코드 홈 위, 쉴 때 2도 → 레코드 밖) */
.deck {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  margin: 8px 0 18px;
}
.turntable {
  --tt: 168px;
  position: relative;
  flex: none;
  width: calc(var(--tt) + 84px);
  padding: 14px;
  border-radius: 16px;
  background:
    repeating-linear-gradient(100deg, rgba(255, 220, 180, 0.035) 0 2px, transparent 2px 9px),
    linear-gradient(145deg, #74492b, #4a2c19);
  box-shadow:
    inset 0 1px 0 rgba(255, 230, 200, 0.18),
    inset 0 -2px 0 rgba(0, 0, 0, 0.25),
    0 10px 22px rgba(0, 0, 0, 0.35);
}
/* 받침: 비어 있으면 펠트 매트가 보임 */
.tt-platter {
  position: relative;
  width: var(--tt);
  height: var(--tt);
  border-radius: 50%;
  background: radial-gradient(circle, #3b3431 0 62%, #2a2523 63% 100%);
  box-shadow: inset 0 0 0 3px #1c1816, 0 2px 4px rgba(0, 0, 0, 0.4);
}
.tt-drop {
  position: absolute;
  inset: 3%;
  opacity: 0;
  transform: scale(0.92);
  transition: opacity 0.35s ease, transform 0.35s ease;
}
.turntable.has-record .tt-drop {
  opacity: 1;
  transform: none;
}
.tt-drop.dropping {
  animation: tt-drop 0.6s cubic-bezier(0.3, 0.7, 0.4, 1);
}
@keyframes tt-drop {
  0% { opacity: 0; transform: translateY(-14px) scale(1.06); }
  60% { opacity: 1; transform: translateY(0) scale(0.99); }
  100% { transform: none; }
}

/* 레코드판 공통: 촘촘한 홈 + 가운데 색 라벨 (--rec) */
.tt-record,
.sleeve-disc {
  position: absolute;
  border-radius: 50%;
  background:
    radial-gradient(circle, transparent 0 34%, rgba(255, 255, 255, 0.07) 34.5% 35.5%, transparent 36%),
    radial-gradient(circle, transparent 0 88%, rgba(255, 255, 255, 0.06) 88.5% 89.5%, transparent 90%),
    repeating-radial-gradient(circle, #171211 0 1.2px, #241c1a 1.2px 2.6px);
  box-shadow: inset 0 0 0 2px #0d0908, 0 3px 8px rgba(0, 0, 0, 0.45);
}
.tt-record {
  inset: 0;
  animation: tt-spin 1.8s linear infinite;
  animation-play-state: paused;
}
.turntable.playing .tt-record {
  animation-play-state: running;
}
@keyframes tt-spin {
  to { transform: rotate(360deg); }
}
.disc-label {
  position: absolute;
  inset: 33%;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background:
    radial-gradient(circle at 34% 28%, rgba(255, 255, 255, 0.28), transparent 58%),
    var(--rec, #8a6a4a);
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.25);
}
.disc-icon {
  font-size: calc(var(--tt) * 0.1);
  transform: translateY(-38%);
}
/* 돌지 않는 빛 반사 (레코드가 돌아도 빛은 제자리라 진짜처럼 보임) */
.tt-sheen {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  pointer-events: none;
  background: conic-gradient(
    from 20deg,
    transparent 0 6%,
    rgba(255, 240, 220, 0.13) 11%,
    transparent 18% 50%,
    rgba(255, 240, 220, 0.09) 61%,
    transparent 68%
  );
  -webkit-mask: radial-gradient(circle, transparent 0 33%, #000 34%);
  mask: radial-gradient(circle, transparent 0 33%, #000 34%);
}
.tt-spindle {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 8px;
  height: 8px;
  margin: -4px 0 0 -4px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #fff, #a9a196 70%);
}
/* 톤암: 오른쪽 위 축을 중심으로 돌아 레코드 위로 내려옴 */
.tt-arm-base {
  position: absolute;
  right: 13px;
  top: 13px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: radial-gradient(circle at 38% 32%, #f1ebe0, #8f877b 75%);
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.45);
}
.tt-arm {
  position: absolute;
  right: 22.5px;
  top: 25px;
  width: 5px;
  height: calc(var(--tt) * 0.62);
  border-radius: 3px;
  background: linear-gradient(90deg, #a69e92, #f4eee4 45%, #9b9386);
  box-shadow: 2px 3px 5px rgba(0, 0, 0, 0.35);
  transform-origin: 50% 0;
  transform: rotate(2deg);
  transition: transform 0.9s cubic-bezier(0.45, 0, 0.25, 1);
}
.turntable.playing .tt-arm {
  transform: rotate(38deg);
}
.tt-arm-head {
  position: absolute;
  left: 50%;
  bottom: -10px;
  width: 11px;
  height: 17px;
  border-radius: 2px 2px 3px 3px;
  background: linear-gradient(#3a3330, #1f1a18);
  transform: translateX(-50%) rotate(-24deg);
}

/* 턴테이블 옆: 장르·곡 제목·조작 */
.deck-info {
  width: 100%;
  text-align: center;
}
.deck-genre {
  margin: 0;
  font-size: 15px;
  color: var(--cream);
}
.deck-info .music-now {
  margin: 4px 0 0;
}
.deck-info .music-now:empty {
  display: block;
}
.music-ctrl {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin: 12px 0 10px;
}
.deck-vol {
  width: 100%;
}
.round-btn {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: 0;
  background: var(--accent);
  color: #2a1a10;
  font-size: 14px;
}
.round-btn + .round-btn {
  background: rgba(255, 240, 220, 0.14);
  color: var(--cream);
}

/* ---- 레코드장: 앨범 커버 위로 레코드가 살짝 삐져나와 있음 ---- */
.crate-title {
  margin: 0 0 10px;
  font-size: 13px;
  color: var(--cream-dim);
}
.crate {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px 10px;
}
.sleeve {
  position: relative;
  aspect-ratio: 1 / 1.2;
  padding: 0;
  border: 0;
  background: none;
  color: var(--cream);
  cursor: pointer;
}
.sleeve-disc {
  left: 12%;
  top: 0;
  width: 76%;
  aspect-ratio: 1;
  transform: translateY(6%);
  transition: transform 0.35s cubic-bezier(0.3, 0.7, 0.4, 1), opacity 0.35s ease;
}
.sleeve-disc .disc-label {
  inset: 34%;
}
.sleeve:hover .sleeve-disc,
.sleeve:focus-visible .sleeve-disc {
  transform: translateY(-6%);
}
/* 턴테이블에 올라간 레코드는 커버에서 빠져 있음 */
.sleeve.active .sleeve-disc {
  opacity: 0;
  transform: translateY(-30%);
}
.sleeve-cover {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  aspect-ratio: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 6px 4px;
  border-radius: 6px;
  background:
    linear-gradient(to bottom, transparent 55%, rgba(0, 0, 0, 0.32)),
    radial-gradient(circle at 30% 22%, rgba(255, 255, 255, 0.22), transparent 55%),
    var(--rec);
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.12),
    inset 0 0 0 5px rgba(0, 0, 0, 0.08),
    0 4px 10px rgba(0, 0, 0, 0.35);
  transition: transform 0.25s ease, box-shadow 0.25s ease;
}
.sleeve:hover .sleeve-cover {
  transform: translateY(-2px);
}
.sleeve.active .sleeve-cover {
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.12),
    0 0 0 2px var(--accent),
    0 4px 14px rgba(255, 201, 138, 0.3);
}
.sleeve-icon {
  font-size: 22px;
}
.sleeve.playing .sleeve-icon {
  animation: bob 1.6s ease-in-out infinite;
}
.sleeve-name {
  font-size: 12px;
  line-height: 1.25;
  text-align: center;
  word-break: keep-all;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.45);
}
.genre-badge {
  font-size: 10px;
  color: var(--cream-dim);
}
.genre-badge:empty {
  display: none;
}
.sleeve.unavailable {
  opacity: 0.5;
}

@media (max-width: 420px) {
  .turntable {
    --tt: 150px;
  }
  .sleeve-icon {
    font-size: 18px;
  }
  .sleeve-name {
    font-size: 11px;
  }
}
@media (prefers-reduced-motion: reduce) {
  .tt-record {
    animation: none;
  }
}

/* 지금 나오는 곡 제목 */
.music-now {
  margin: 12px 0 0;
  min-height: 1.4em;
  font-size: 14px;
  color: var(--accent);
}
.music-now:empty {
  display: none;
}

/* 음악 출처 (CC BY 4.0 표시) */
.music-credit {
  margin: 12px 0 0;
  font-size: 11px;
  color: var(--cream-dim);
}
.music-credit a {
  color: inherit;
}

/* =====================================================================
 * 입장 화면
 * ===================================================================== */
.intro {
  position: absolute;
  z-index: 30;
  inset: 0;
  display: grid;
  place-items: center;
  padding: var(--gutter);
  background: radial-gradient(ellipse at center, rgba(20, 12, 8, 0.35), rgba(20, 12, 8, 0.75));
  -webkit-backdrop-filter: blur(3px);
  backdrop-filter: blur(3px);
  transition: opacity 0.9s ease;
}
.intro.hide {
  opacity: 0;
  pointer-events: none;
}
.intro-card {
  text-align: center;
  max-width: 420px;
}
.intro-logo {
  margin: 0 0 6px;
  font-size: clamp(48px, 10vw, 76px);
  letter-spacing: 0.12em;
  color: var(--cream);
  text-shadow: 0 4px 24px rgba(255, 170, 90, 0.45);
}
.intro-sub {
  margin: 0 0 26px;
  font-size: 17px;
  line-height: 1.7;
  color: var(--cream-dim);
}
.enter-btn {
  padding: 14px 32px;
  border: 0;
  border-radius: 999px;
  font-size: 17px;
  color: #2a1a10;
  background: linear-gradient(135deg, var(--accent), var(--accent-strong));
  box-shadow: 0 8px 28px rgba(255, 170, 90, 0.4);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.enter-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 34px rgba(255, 170, 90, 0.55);
}
.intro-note {
  margin: 18px 0 0;
  font-size: 13px;
  color: var(--cream-dim);
}

/* =====================================================================
 * 알림 메시지
 * ===================================================================== */
.toast {
  position: absolute;
  z-index: 40;
  left: 50%;
  bottom: 84px;
  transform: translate(-50%, 10px);
  max-width: calc(100% - 32px);
  padding: 10px 18px;
  border-radius: 999px;
  font-size: 14px;
  background: var(--glass-strong);
  border: 1px solid var(--glass-line);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease, transform 0.3s ease;
}
.toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}

/* =====================================================================
 * 하피와 화니의 책 (js/ui/book.js)
 *  --pw / --ph : 한 쪽의 너비·높이 (화면 크기에 맞춰 JS 가 정함)
 * ===================================================================== */
html.book-open {
  overflow: hidden;
}
.book-overlay {
  --paper: #f8efdf;
  --paper-edge: #eadbc2;
  --ink: #3b2a20;
  --ink-soft: #9a7656;
  --leather: #5a3320;
  --gold: #e2bf7d;
  position: fixed;
  inset: 0;
  z-index: 60;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 22px;
  padding: 56px 16px calc(20px + env(safe-area-inset-bottom, 0px));
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.5s ease;
}
.book-overlay.show {
  opacity: 1;
  pointer-events: auto;
}
.book-backdrop {
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at 50% 45%, rgba(40, 26, 18, 0.62), rgba(12, 8, 5, 0.88));
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
}
.book-close {
  position: absolute;
  z-index: 2;
  top: calc(var(--gutter) + env(safe-area-inset-top, 0px));
  right: var(--gutter);
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 1px solid var(--glass-line);
  background: var(--glass);
  font-size: 16px;
}
.book-close:hover {
  background: rgba(255, 240, 220, 0.16);
}

/* 책이 놓이는 자리 (원근감) */
.book-stage {
  position: relative;
  z-index: 1;
  width: 100%;
  height: var(--ph);
  perspective: 2400px;
}
/* 열릴 때 아래에서 살짝 떠오름 */
.book-lift {
  position: absolute;
  inset: 0;
  transform: translateY(28px) scale(0.96);
  transition: transform 0.7s cubic-bezier(0.2, 0.8, 0.2, 1);
  transform-style: preserve-3d;
}
.book-overlay.show .book-lift {
  transform: none;
}
/* 책: 왼쪽 끝이 책등. 덮였을 땐 표지를 가운데, 펼치면 책등을 가운데로 */
.book {
  position: absolute;
  left: 50%;
  top: 0;
  width: var(--pw);
  height: var(--ph);
  transform: translateX(-50%);
  transform-style: preserve-3d;
  transition: transform 0.8s cubic-bezier(0.645, 0.045, 0.355, 1);
}
.book.open:not(.single) {
  transform: translateX(0);
}

/* 낱장: 책등을 축으로 -180도 돌면 넘어감 */
.leaf {
  position: absolute;
  inset: 0;
  transform-origin: left center;
  transform-style: preserve-3d;
  transition: transform 0.9s cubic-bezier(0.645, 0.045, 0.355, 1), opacity 0.3s ease 0.55s;
  cursor: pointer;
}
.leaf.flipped {
  transform: rotateY(-180deg);
}
/* 한 쪽씩 볼 때: 넘긴 장은 넘어간 뒤 사라짐 */
.book.single .leaf.flipped {
  opacity: 0;
  pointer-events: none;
}
.book.instant .leaf,
.book.instant {
  transition: none !important;
}
.face {
  position: absolute;
  inset: 0;
  overflow: hidden;
  -webkit-backface-visibility: hidden;
  backface-visibility: hidden;
  border-radius: 3px 10px 10px 3px;
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.35);
}
.face.back {
  transform: rotateY(180deg);
  border-radius: 10px 3px 3px 10px;
}

/* ---- 쪽 공통 ---- */
.page {
  position: absolute;
  inset: 0;
  color: var(--ink);
  font-family: 'Gowun Batang', 'Gowun Dodum', serif;
}
/* 종이: 책등 쪽 그림자 + 은은한 얼룩 */
.paper {
  background:
    radial-gradient(ellipse at 80% 15%, rgba(255, 255, 255, 0.5), transparent 55%),
    radial-gradient(ellipse at 20% 90%, rgba(196, 160, 112, 0.14), transparent 60%),
    var(--paper);
}
.front .paper {
  box-shadow: inset 18px 0 22px -14px rgba(90, 60, 30, 0.35), inset -1px 0 0 var(--paper-edge);
}
.back .paper {
  box-shadow: inset -18px 0 22px -14px rgba(90, 60, 30, 0.35), inset 1px 0 0 var(--paper-edge);
}
.page-num {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 4.5%;
  text-align: center;
  font-size: calc(var(--pw) * 0.03);
  color: var(--ink-soft);
}

/* ---- 표지 ---- */
.cover {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: calc(var(--pw) * 0.03);
  text-align: center;
  color: var(--gold);
  background:
    radial-gradient(ellipse at 30% 20%, rgba(255, 210, 160, 0.16), transparent 60%),
    linear-gradient(135deg, #6e4029, var(--leather) 55%, #432414);
  box-shadow: inset 14px 0 18px -10px rgba(0, 0, 0, 0.5);
}
/* 금박 테두리 두 줄 */
.cover::before,
.cover::after {
  content: '';
  position: absolute;
  border-radius: 4px;
  pointer-events: none;
}
.cover::before {
  inset: 5%;
  border: 1.5px solid rgba(226, 191, 125, 0.8);
}
.cover::after {
  inset: 6.5%;
  border: 1px solid rgba(226, 191, 125, 0.35);
}
.cover-emblem {
  font-family: var(--font);
  font-size: calc(var(--pw) * 0.034);
  letter-spacing: 0.3em;
  opacity: 0.8;
}
.cover-title {
  margin: 0;
  font-size: calc(var(--pw) * 0.1);
  font-weight: 700;
  letter-spacing: 0.06em;
  text-shadow: 0 1px 0 rgba(0, 0, 0, 0.4);
}
.cover-rule {
  width: 34%;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--gold), transparent);
}
.cover-volume {
  margin: 0;
  font-size: calc(var(--pw) * 0.042);
  opacity: 0.9;
}

/* ---- 속지 ---- */
.dedication {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
}
.dedication p {
  margin: 0.4em 0;
  font-size: calc(var(--pw) * 0.05);
}
.dedication p + p {
  font-size: calc(var(--pw) * 0.038);
  color: var(--ink-soft);
}

/* ---- 차례 ---- */
.toc {
  padding: 13% 11% 12%;
}
.toc-title {
  margin: 0 0 6%;
  text-align: center;
  font-size: calc(var(--pw) * 0.06);
  letter-spacing: 0.3em;
}
.toc-list {
  margin: 0;
  padding: 0;
  list-style: none;
}
.toc-item {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  width: 100%;
  padding: calc(var(--pw) * 0.012) 0;
  border: 0;
  border-bottom: 1px dotted rgba(154, 118, 86, 0.4);
  background: transparent;
  color: var(--ink);
  font-family: inherit;
  font-size: calc(var(--pw) * 0.034);
  text-align: left;
}
.toc-item:hover .toc-name {
  color: #b5652b;
}
.toc-date {
  flex: none;
  color: var(--ink-soft);
}

/* ---- 이야기 쪽 ---- */
.chapter {
  display: flex;
  flex-direction: column;
  padding: 12% 11% 13%;
}
.page-icon {
  position: absolute;
  top: 7%;
  right: 9%;
  font-size: calc(var(--pw) * 0.08);
  opacity: 0.9;
  transform: rotate(8deg);
}
.page-meta {
  margin: 0;
  font-size: calc(var(--pw) * 0.032);
  letter-spacing: 0.08em;
  color: var(--ink-soft);
}
.page-title {
  margin: 0.35em 0 0;
  font-size: calc(var(--pw) * 0.062);
  font-weight: 700;
}
.page-rule {
  display: block;
  width: 22%;
  height: 2px;
  margin: 5% 0 6%;
  border-radius: 2px;
  background: linear-gradient(90deg, #d9a66b, transparent);
}
.page-body {
  flex: 1;
  min-height: 0;
  overflow: hidden;
  font-size: calc(var(--pw) * 0.038);
  line-height: 1.85;
  word-break: keep-all;
}
.page-body p {
  margin: 0 0 0.75em;
}

/* ---- 마지막 쪽 ---- */
.ending {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  text-align: center;
}
.ending-mark {
  font-size: calc(var(--pw) * 0.08);
  color: var(--ink-soft);
}
.ending-text {
  margin: 0;
  font-size: calc(var(--pw) * 0.042);
  color: var(--ink-soft);
}

/* ---- 아래 버튼 ---- */
.book-controls {
  position: relative;
  z-index: 1;
  min-height: 46px;
  display: flex;
  justify-content: center;
}
.book-start,
.book-nav {
  display: flex;
  align-items: center;
  gap: 12px;
}
.book-btn {
  height: 44px;
  padding: 0 22px;
  border-radius: 999px;
  border: 1px solid var(--glass-line);
  background: var(--glass);
  font-size: 15px;
}
.book-btn.primary {
  border: 0;
  background: linear-gradient(135deg, var(--accent), var(--accent-strong));
  color: #2a1a10;
  box-shadow: 0 8px 24px rgba(255, 176, 103, 0.3);
}
.book-arrow {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 1px solid var(--glass-line);
  background: var(--glass);
  font-size: 22px;
  line-height: 1;
}
.book-arrow:disabled {
  opacity: 0.35;
  cursor: default;
}
.book-count {
  min-width: 64px;
  text-align: center;
  font-size: 14px;
  color: var(--cream-dim);
}

/* =====================================================================
 * 아래 영역: 사이트 서명 + 소리 출처
 * ===================================================================== */
.menu {
  background: var(--menu-bg);
  color: var(--menu-ink);
}
.footer {
  padding: 72px var(--gutter) 40px;
  text-align: center;
  font-size: 13px;
  color: rgba(59, 42, 32, 0.55);
}
.footer p {
  margin: 12px 0 0;
}
/* 사이트 서명 — 아래 영역의 주인공 */
.footer-sign {
  margin: 0 0 40px !important;
  font-family: 'Gowun Batang', serif;
  font-size: clamp(17px, 2.6vw, 21px);
  letter-spacing: 0.02em;
  color: rgba(59, 42, 32, 0.72);
}
.footer-sign::before {
  content: '☕';
  display: block;
  margin-bottom: 14px;
  font-size: 0.8em;
}
.footer-sign b {
  font-weight: 700;
  color: #a0603a;
}
.footer-year {
  font-size: 12px;
}

/* 소리 출처 (접었다 펼치기) */
.credits {
  max-width: 720px;
  margin: 0 auto;
  text-align: left;
}
.credits summary {
  cursor: pointer;
  text-align: center;
}
.credits-body {
  margin-top: 12px;
  padding: 16px 20px;
  border-radius: 14px;
  background: rgba(59, 42, 32, 0.05);
  font-size: 12px;
  line-height: 1.7;
}
.credits-list {
  margin: 0 0 10px;
  padding-left: 18px;
  columns: 2;
}
.credits-note {
  margin: 8px 0 0;
}
.credits-note a {
  color: inherit;
  word-break: break-all;
}
@media (max-width: 760px) {
  .credits-list {
    columns: 1;
  }
}

/* =====================================================================
 * 좁은 화면 (모바일)
 * ===================================================================== */
@media (max-width: 760px) {
  .topbar {
    flex-direction: column;
    align-items: stretch;
  }
  .logo {
    align-self: flex-start;
  }
  .controls {
    justify-content: flex-start;
  }
  /* 날씨 버튼은 아이콘만 */
  .pill .pill-text {
    display: none;
  }
  .pill {
    padding: 7px 8px;
  }
  /* 버튼이 한 줄에 들어가도록 조금 작게 */
  .controls {
    gap: 6px;
  }
  .icon-btn {
    width: 36px;
    height: 36px;
    font-size: 15px;
  }

  /* 소리 패널은 아래에서 올라오는 시트 */
  .mixer {
    top: auto;
    left: 0;
    right: 0;
    bottom: 0;
    width: auto;
    max-height: 70%;
    border-radius: 22px 22px 0 0;
    padding-bottom: calc(16px + env(safe-area-inset-bottom, 0px));
    transform: translateY(24px);
  }
  .mix-row {
    grid-template-columns: 1fr 120px;
  }

  /* 좁은 화면에선 이름표를 항상 위쪽에 짧게 */
  .hotspot-label {
    font-size: 12px;
    padding: 5px 10px;
  }

  /* 모바일(특히 아이폰)은 전체화면을 지원하지 않거나 줄바꿈을 만들어서 숨김 */
  #fullscreenBtn {
    display: none;
  }

  .scene-arrow {
    width: 40px;
    height: 40px;
    margin-top: -20px;
  }

  /* 좁은 화면에선 재생 중인 곡 표시와 겹치지 않게 한 줄 위로 */
  .cheer-btn {
    bottom: calc(var(--gutter) + 54px + env(safe-area-inset-bottom, 0px));
    height: 40px;
    padding: 0 13px 0 11px;
    gap: 6px;
    font-size: 13px;
  }
  /* 알림 메시지가 두 줄이 되어도 겹치지 않게 더 위로 */
  .cheer-caption {
    bottom: calc(176px + env(safe-area-inset-bottom, 0px));
    font-size: 15px;
    padding: 10px 18px;
  }
}

/* 아주 좁은 폰(360px 안팎): 상단 버튼을 한 줄에 맞추기 위해 더 촘촘하게 */
@media (max-width: 380px) {
  .controls {
    gap: 4px;
  }
  .pill-group {
    gap: 2px;
    padding: 3px;
  }
  .pill {
    padding: 6px 6px;
  }
  .icon-btn {
    width: 34px;
    height: 34px;
    font-size: 14px;
  }
  /* 위로받기 버튼은 💬 아이콘만 */
  .cheer-btn {
    width: 40px;
    padding: 0;
  }
  .cheer-text {
    display: none;
  }
}

/* 움직임 줄이기 설정 존중 */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
  }
}
