/* ---------- 색상 & 기본 ---------- */
:root {
  --bg: #FAF6F0;
  --fg: #2B2118;
  --fg-muted: #7A6A5C;
  --accent: #3F7D5A;
  --accent-fg: #FFFFFF;
  --accent-soft: #DCEBE1;
  --line: #E6DDD2;
  --ghost: #D9CFC3;
  --skin: #F4DFC8;
  --skin-dent: #E0BE9C;
  --skin-crease: #B98A66;
  --skin-light: rgba(255, 255, 255, .6);
  --danger: #C2443A;
  --radius: 18px;
  --pad: clamp(18px, 5vw, 28px);
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #17140F;
    --fg: #F3EDE4;
    --fg-muted: #B3A697;
    --accent: #6FB48A;
    --accent-fg: #0F1A13;
    --accent-soft: #24382C;
    --line: #35302A;
    --ghost: #3E3730;
    --skin: #4A3A2E;
    --skin-dent: #3A2B21;
    --skin-crease: #221810;
    --skin-light: rgba(255, 255, 255, .12);
    --danger: #F08A80;
  }
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", Pretendard,
    "Noto Sans KR", "Malgun Gothic", system-ui, sans-serif;
  line-height: 1.4;
  word-break: keep-all;
  overflow-wrap: anywhere;
  -webkit-tap-highlight-color: transparent;
}

#app {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-height: 100dvh;
  max-width: 480px;
  margin: 0 auto;
}

/* ---------- 상단 바 ---------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px var(--pad);
  padding-top: calc(10px + env(safe-area-inset-top, 0px));
  background: var(--bg);
}
.topbar-right {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-left: auto;
}
.icon-btn {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--fg);
  font: inherit;
  font-size: 1.4rem;
  line-height: 1;
  width: 44px;
  height: 44px;
  border-radius: 12px;
  cursor: pointer;
}
.icon-btn:active { background: var(--accent-soft); }
.icon-btn[disabled] { visibility: hidden; }

.progress {
  display: flex;
  gap: 6px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.progress li {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: var(--line);
}
.progress li.done { background: var(--accent); opacity: .45; }
.progress li.active { background: var(--accent); transform: scale(1.35); }

.clock {
  font-variant-numeric: tabular-nums;
  font-size: 1rem;
  font-weight: 700;
  color: var(--fg-muted);
  padding: 4px 8px;
  border-radius: 8px;
}
.clock.over { color: var(--danger); background: color-mix(in srgb, var(--danger) 12%, transparent); }

/* ---------- 화면 ---------- */
main { display: flex; flex: 1; flex-direction: column; }
.screen {
  display: flex;
  flex: 1;
  flex-direction: column;
  padding: var(--pad);
  padding-bottom: calc(var(--pad) + env(safe-area-inset-bottom, 0px));
  gap: 16px;
}
.content {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 6px;
}
.actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: center;
}

h1 {
  margin: 0 0 12px;
  font-size: clamp(1.55rem, 6.6vw, 1.95rem);
  font-weight: 800;
  line-height: 1.35;
  letter-spacing: -0.01em;
  outline: none;
}
h1.big {
  font-size: clamp(2.1rem, 9.5vw, 3rem);
  line-height: 1.15;
  letter-spacing: -0.02em;
}
h1.home-title { font-size: clamp(1.9rem, 8.4vw, 2.7rem); }
.eyebrow {
  margin: 0;
  font-size: .95rem;
  font-weight: 700;
  letter-spacing: .04em;
  color: var(--fg-muted);
}
.eyebrow span { margin-left: 8px; color: var(--accent); }
.lead {
  margin: 8px 0 0;
  font-size: clamp(1.2rem, 5.2vw, 1.4rem);
  line-height: 1.5;
}
.lead strong, .sub strong { color: var(--accent); }
.lead em { font-style: normal; font-weight: 800; letter-spacing: .08em; }
.sub {
  margin: 6px 0 0;
  font-size: 1.05rem;
  color: var(--fg-muted);
}
.sub.warn { color: var(--danger); font-weight: 600; }
.note {
  margin: 4px 0 0;
  font-size: .95rem;
  line-height: 1.5;
  color: var(--fg-muted);
}
.note strong { color: var(--danger); }
.hero-emoji { font-size: 4.5rem; line-height: 1; margin-bottom: 12px; }

/* ---------- 버튼 ---------- */
.btn {
  appearance: none;
  width: 100%;
  min-height: 68px;
  padding: 14px 20px;
  border: 0;
  border-radius: var(--radius);
  font: inherit;
  font-size: 1.35rem;
  font-weight: 800;
  cursor: pointer;
  transition: transform .08s ease, box-shadow .3s ease;
}
.btn:active { transform: scale(.98); }
.btn-primary { background: var(--accent); color: var(--accent-fg); }
.btn-primary.is-ready { box-shadow: 0 0 0 6px var(--accent-soft); }
.btn-secondary { background: var(--accent-soft); color: var(--fg); }
.btn-link {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--fg-muted);
  font: inherit;
  font-size: 1.05rem;
  min-height: 44px;
  padding: 10px 18px;
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}
.links {
  display: flex;
  justify-content: center;
  gap: 16px;
}

/* ---------- 그림 ---------- */
.illust {
  position: relative;
  width: min(72vw, 300px);
  margin: 8px 0;
}
.illust svg { width: 100%; height: auto; display: block; }
.illust svg .lo, .illust svg .hi, .illust svg .ghost {
  fill: none;
  stroke-width: 5;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.illust svg .lo { stroke: var(--ghost); }
.illust svg .hi { stroke: var(--accent); }
.illust svg .person { stroke-width: 7; }
.illust svg .ghost { stroke: var(--ghost); stroke-dasharray: 4 7; opacity: .8; }

.lean-arrow { stroke-width: 4; stroke-dasharray: 7 6; }

/* 힘 빼기: 턱·어깨·항문 표시 점 */
.spot {
  fill: var(--accent);
  transform-box: fill-box;
  transform-origin: center;
  animation: pulse 1.6s ease-in-out infinite;
}
.spot-label {
  fill: var(--fg);
  font-size: 12px;
  font-weight: 700;
}
@keyframes pulse {
  0%, 100% { transform: scale(1); opacity: .55; }
  50% { transform: scale(1.5); opacity: 1; }
}
.arrow-head { fill: var(--accent); }

.rocking {
  transform-origin: 112px 126px;
  animation: rock 1.4s ease-in-out infinite alternate;
}
@keyframes rock {
  from { transform: rotate(-9deg); }
  to   { transform: rotate(8deg); }
}

/* ---------- 타이머 링 ---------- */
.ring {
  position: relative;
  width: 160px;
  height: 160px;
  margin: 12px 0;
}
.ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.ring-bg { fill: none; stroke: var(--line); stroke-width: 10; }
.ring-fg {
  fill: none;
  stroke: var(--accent);
  stroke-width: 10;
  stroke-linecap: round;
  stroke-dasharray: 439.82;
  stroke-dashoffset: 0;
}
.ring-num {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-size: 2.6rem;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}
.ring-mini {
  position: absolute;
  right: -12px;
  top: -4px;
  width: 72px;
  height: 72px;
  margin: 0;
  background: var(--bg);
  border-radius: 50%;
}
.ring-mini .ring-num { font-size: 1.3rem; }
.ring-mini .ring-bg, .ring-mini .ring-fg { stroke-width: 14; }

/* ---------- 호흡 ---------- */
.breath {
  position: relative;
  width: 240px;
  height: 240px;
  margin: 8px 0;
  display: grid;
  place-items: center;
}
.breath-ring {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 2px dashed var(--line);
}
.breath-core {
  width: 240px;
  height: 240px;
  border-radius: 50%;
  background: var(--accent);
  transform: scale(.55);
  transition: transform 1s ease-in-out;
  will-change: transform;
}
.breath-label {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: var(--accent-fg);
  font-size: 1.35rem;
  font-weight: 800;
  pointer-events: none;
}

/* ---------- 마사지 ---------- */
.belly {
  position: relative;
  width: 220px;
  height: 220px;
  margin: 8px 0;
}
.belly svg { width: 100%; height: 100%; display: block; }
.belly-skin { fill: var(--skin); }
.navel-dent { fill: var(--skin-dent); }
.navel-crease { fill: var(--skin-crease); }
.navel-light { fill: var(--skin-light); }
.track { fill: none; stroke: var(--accent); stroke-width: 4; stroke-dasharray: 6 12; opacity: .5; }
.arc { fill: none; stroke: var(--accent); stroke-width: 12; stroke-linecap: round; }
.arrow { fill: var(--accent); }
.spin {
  transform-origin: 100px 100px;
  transform-box: view-box;
  animation: spin 4.5s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- 성공 ---------- */
.bounce { animation: bounce 1.1s ease-in-out infinite; }
@keyframes bounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-16px); }
}
.confetti {
  position: fixed;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
  z-index: 5;
}
.confetti span {
  position: absolute;
  top: -24px;
  border-radius: 2px;
  opacity: 0;
  animation: fall 3s ease-in forwards;
}
@keyframes fall {
  0%   { transform: translate(0, 0) rotate(0deg); opacity: 1; }
  60%  { transform: translate(var(--sway), 60vh) rotate(420deg); opacity: 1; }
  100% { transform: translate(calc(var(--sway) * -.6), 105vh) rotate(720deg); opacity: 0; }
}

/* ---------- 팁 ---------- */
.tips-title {
  margin: 20px 0 6px;
  font-size: 1rem;
  font-weight: 700;
  color: var(--fg-muted);
}
.tips {
  list-style: none;
  margin: 8px 0 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 100%;
  max-width: 340px;
  text-align: left;
}
.tips li {
  padding: 12px 16px;
  border-radius: 14px;
  background: var(--accent-soft);
  font-size: 1.1rem;
  font-weight: 600;
}
.tips li strong { color: var(--accent); }

/* ---------- 접근성 / 모션 ---------- */
@media (prefers-reduced-motion: reduce) {
  .rocking { animation-duration: 3s; }
  .spin { animation-duration: 9s; }
  .spot { animation: none; }
  .btn { transition: none; }
  .bounce { animation: none; }
  .confetti { display: none; }
}
@media (max-height: 720px) {
  .hero-emoji { font-size: 3.2rem; margin-bottom: 4px; }
  .illust { width: min(60vw, 230px); }
  .breath, .breath-core { width: 190px; height: 190px; }
  .belly { width: 180px; height: 180px; }
  .ring:not(.ring-mini) { width: 130px; height: 130px; margin: 6px 0; }
}
