/* 숨 */
:root {
  --accent: #9fd8ff;
  --gold: #ffd59a;
  --ghost: #b4b0ff;
  --sat: env(safe-area-inset-top, 0px);
  --sab: env(safe-area-inset-bottom, 0px);
  --sal: env(safe-area-inset-left, 0px);
  --sar: env(safe-area-inset-right, 0px);
}

html { background: #070910; }
body {
  background: radial-gradient(130% 95% at 50% 42%, #121a2c 0%, #0e1424 32%, #0a0d18 62%, #070910 100%);
  background-color: #070910;
}

canvas.stage { -webkit-touch-callout: none; touch-action: none; }
/* 3D 연못 (./scene.js) 이 뜨면 2D 캔버스는 쉼 */
canvas.stage3d { opacity: 0; animation: breath-in3d 1.2s ease 0.1s forwards; }
html.breath-3d #stage { visibility: hidden; }
/* 첫 화면: 3D 연못 위에 반투명한 어두운 판을 깔아 글자가 장면과 겹치지 않게 */
html.breath-3d #intro { background: radial-gradient(ellipse 70% 62% at 50% 50%, rgba(6, 8, 15, 0.86) 0%, rgba(6, 8, 15, 0.7) 60%, rgba(6, 8, 15, 0.25) 100%); }
@keyframes breath-in3d { to { opacity: 1; } }

.screen {
  padding: calc(var(--bar-h) + 20px + var(--sat)) calc(24px + var(--sar)) calc(28px + var(--sab)) calc(24px + var(--sal));
}

/* ───────── 인트로 ───────── */
.intro .title { text-shadow: 0 0 38px rgba(159, 216, 255, 0.35); margin-bottom: 2px; }
.intro .live { margin: 4px 0 2px; }
.live:empty { visibility: hidden; }
.how-steps {
  list-style: none; padding: 0; max-width: 25em; margin: 4px 0 2px; text-align: left;
  display: flex; flex-direction: column; gap: 6px; font-size: 14px; line-height: 1.6; color: var(--dim); word-break: keep-all;
}
.how-steps li { counter-increment: how; padding-left: 1.4em; text-indent: -1.4em; }
.how-steps li::before { content: counter(how) '. '; color: var(--gold); }
.intro .stack { margin-top: 10px; }
.intro .note { margin-top: 12px; max-width: 24em; }
.intro .note + .note { margin-top: 0; }

/* ───────── 방 ───────── */
.hud-top {
  position: absolute; left: 0; right: 0;
  top: calc(var(--bar-h) + 48px + var(--sat));
  padding: 0 20px; text-align: center;
}
@media (min-width: 720px) { .hud-top { top: calc(var(--bar-h) + 16px + var(--sat)); padding: 0 200px; } }
.hud-count { font-size: 14px; color: var(--dim); letter-spacing: 0.02em; word-break: keep-all; line-height: 1.5; min-height: 1.5em; }
.hud-together { margin-top: 2px; font-size: 14px; color: var(--accent); line-height: 1.5; min-height: 1.5em; transition: opacity 0.8s ease; }
.hud-together:empty { opacity: 0; }
.hud-ghost {
  margin-top: 4px; font-size: 12px; line-height: 1.5;
  color: rgba(190, 186, 255, 0.62); letter-spacing: 0.02em; word-break: keep-all;
  transition: opacity 1.2s ease;
}
.hud-ghost.off { opacity: 0; }

.guide { position: absolute; left: 50%; top: 44%; width: 0; height: 0; }
.guide .word {
  position: absolute; left: 0; top: 0; transform: translate(-50%, -50%); white-space: nowrap;
  font-size: 14px; letter-spacing: 0.5em; padding-left: 0.5em;
  color: rgba(228, 242, 255, 0.9); text-shadow: 0 0 18px rgba(159, 216, 255, 0.55);
  opacity: 0; transition: opacity 0.5s ease;
}
.guide .word.on { opacity: 1; transition-delay: 0.5s; } /* 앞 글자가 다 사라진 뒤에 나타남: 두 글자가 겹쳐 보이지 않게 */
.guide .sub {
  position: absolute; left: 0; top: 22px; transform: translateX(-50%); white-space: nowrap;
  font-size: 11.5px; letter-spacing: 0.04em; color: var(--faint); transition: opacity 2s ease;
}
.guide .sub.off { opacity: 0; }

.hud-bottom {
  position: absolute; left: 0; right: 0; bottom: 0;
  padding: 0 calc(16px + var(--sar)) calc(16px + var(--sab)) calc(16px + var(--sal));
  display: flex; flex-direction: column; align-items: center; gap: 12px;
}
.room-hint { max-width: 24em; min-height: 1.6em; text-align: center; font-size: 13px; line-height: 1.6; color: var(--faint); word-break: keep-all; }
.room-hint.warn { color: var(--gold); }

/* 누르고 있는 동안 들이쉬기: 큰 둥근 버튼. 누르는 동안 빛이 차오름 (transform·opacity만) */
.hold {
  appearance: none; cursor: pointer; position: relative;
  width: 132px; height: 132px; border-radius: 50%;
  font: inherit; font-size: 14px; line-height: 1.35; color: var(--ink); padding: 0 16px;
  border: 1px solid rgba(159, 216, 255, 0.5);
  background: radial-gradient(circle at 50% 45%, rgba(159, 216, 255, 0.22), rgba(159, 216, 255, 0.05) 70%);
  box-shadow: 0 0 36px rgba(159, 216, 255, 0.12);
  touch-action: none; -webkit-touch-callout: none; user-select: none; -webkit-user-select: none;
  transition: transform 1.6s cubic-bezier(.3, .6, .3, 1), box-shadow 1.6s ease, background 0.6s ease;
}
.hold span { position: relative; word-break: keep-all; }
.hold.is-in {
  transform: scale(1.12);
  box-shadow: 0 0 60px rgba(159, 216, 255, 0.4);
  background: radial-gradient(circle at 50% 45%, rgba(159, 216, 255, 0.42), rgba(159, 216, 255, 0.1) 72%);
}
.hold:focus-visible { outline: 1px solid rgba(159, 216, 255, 0.8); outline-offset: 6px; }

.actions { display: flex; gap: 8px; }
/* 첫 화면·방 공통 아래 줄 (소리 단추 + 끝내기). 화면 위에 고정이라 들어갈 때 자리가 그대로예요 */
.dock {
  position: fixed; left: 0; right: 0; bottom: calc(16px + var(--sab)); z-index: 11;
  justify-content: center; pointer-events: none;
}
.dock > * { pointer-events: auto; }
.dock.is-intro #end { visibility: hidden; }
.dock[hidden] { display: none; }
/* 방: 아래 줄이 고정 막대로 빠졌으니 그 높이(44px + 간격)만큼 위로 비워 둠 */
.hud-bottom { padding-bottom: calc(16px + var(--sab) + 56px); }
/* 첫 화면: 내용이 길어 스크롤돼도 마지막 줄이 소리 단추에 가리지 않게 */
.intro { padding-bottom: calc(32px + 60px + var(--sab)); }
.actions .btn.off { color: var(--faint); }

/* ───────── 결과 ───────── */
.result { gap: 12px; }
.r-thanks { font-size: 14px; color: var(--dim); letter-spacing: 0.14em; padding-left: 0.14em; }
.card {
  display: block;
  width: max(200px, min(80vw, 360px, calc((100vh - 330px) * 0.8)));
  width: max(200px, min(80vw, 360px, calc((100svh - 330px) * 0.8)));
  height: auto; aspect-ratio: 1080 / 1350; border-radius: 18px; margin: 4px 0;
  box-shadow: 0 28px 70px rgba(0, 0, 0, 0.55), 0 0 0 1px rgba(255, 255, 255, 0.06), 0 0 80px rgba(159, 216, 255, 0.08);
}
.r-stay { font-size: 13px; color: var(--faint); letter-spacing: 0.02em; min-height: 1.4em; }
.r-short { max-width: 24em; margin-top: -4px; }
.r-actions { margin-top: 4px; }
.r-actions .btn { min-width: 132px; }
.r-again { background: transparent; border-color: transparent; color: var(--faint); backdrop-filter: none; -webkit-backdrop-filter: none; }
.r-again:hover { background: rgba(243, 239, 230, 0.06); color: var(--dim); }

@media (max-height: 640px) {
  .hold { width: 108px; height: 108px; font-size: 13px; }
  .intro .note { margin-top: 6px; }
}
@media (prefers-reduced-motion: reduce) {
  .hold, .hold.is-in { transition: none; transform: none; }
}
