/* Nala PT — Wave 1.5 "iOS 28" chrome.
   Glass surfaces, deep radii (24-32px), spring motion, huge tight type.
   Rich dark palette with the orange/teal highlight system; light mode
   gets the same treatment with white glass. */
:root {
  color-scheme: dark;
  --bg: #0a141a;
  --panel: #14262d;
  --glass: rgba(24, 42, 51, .62);
  --glass-border: rgba(255, 255, 255, .10);
  --shadow: 0 18px 40px rgba(0, 0, 0, .45), 0 2px 8px rgba(0, 0, 0, .35);
  --teal: #2dd4bf;
  --orange: #ff9a3d;
  --plant: #35d0c2;
  --text: #eef6f7;
  --muted: #a7bfc6;
  --spring: cubic-bezier(.34, 1.45, .64, 1);
}
@media (prefers-color-scheme: light) {
  :root {
    color-scheme: light;
    --bg: #e9f2f2;
    --panel: #ffffff;
    --glass: rgba(255, 255, 255, .66);
    --glass-border: rgba(16, 34, 42, .10);
    --shadow: 0 18px 40px rgba(23, 54, 66, .16), 0 2px 8px rgba(23, 54, 66, .10);
    --teal: #0f766e;
    --orange: #b94a00;
    --plant: #006f68;
    --text: #10222a;
    --muted: #47636c;
  }
}
* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: -apple-system, "SF Pro Display", system-ui, sans-serif;
  letter-spacing: -.011em;
  color: var(--text);
  font-size: 17px;
  padding: max(16px, env(safe-area-inset-top)) 16px 110px;
  background:
    radial-gradient(620px 420px at 12% -6%, rgba(45, 212, 191, .20), transparent 62%),
    radial-gradient(560px 420px at 96% 4%, rgba(255, 154, 61, .15), transparent 60%),
    radial-gradient(800px 600px at 50% 115%, rgba(45, 212, 191, .10), transparent 65%),
    var(--bg);
  background-attachment: fixed;
  min-height: 100vh;
}
h1 { font-size: 34px; font-weight: 800; letter-spacing: -.03em; margin: 10px 0 2px; }
h2 { font-size: 24px; font-weight: 750; letter-spacing: -.02em; margin-top: 28px; }
h3 { font-size: 19px; letter-spacing: -.015em; }
.sub, .note, .fineprint { color: var(--muted); }
.fineprint { font-size: 13px; line-height: 1.45; }
.streak { font-weight: 700; color: var(--teal); margin: 6px 0 0; }
.glass {
  background: var(--glass);
  -webkit-backdrop-filter: blur(20px) saturate(1.5);
  backdrop-filter: blur(20px) saturate(1.5);
  border: 1px solid var(--glass-border);
  box-shadow: var(--shadow);
}
button {
  background: var(--glass);
  -webkit-backdrop-filter: blur(14px) saturate(1.4);
  backdrop-filter: blur(14px) saturate(1.4);
  color: var(--text);
  border: 1px solid var(--glass-border);
  border-radius: 18px;
  padding: 12px 18px;
  font-size: 17px; font-weight: 600;
  margin: 4px 4px 4px 0;
  cursor: pointer;
  transition: transform .35s var(--spring), background .18s ease, box-shadow .18s ease;
  box-shadow: 0 6px 18px rgba(0, 0, 0, .18);
}
button:active { transform: scale(.94); background: var(--teal); color: #06231e; }
section { max-width: 640px; margin: 0 auto; }
main, #lock-screen { max-width: 640px; margin: 0 auto; }
label { display: block; margin: 10px 0; font-size: 15px; color: var(--muted); }
input, select, textarea { width: 100%; margin-top: 4px; padding: 12px; font-size: 17px; border-radius: 14px; border: 1px solid var(--glass-border); background: var(--panel); color: var(--text); }
.grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 12px; }
.row { display: flex; flex-wrap: wrap; gap: 4px; }

/* ---------- Home: three visual doors ---------- */
#doors { display: grid; grid-template-columns: 1fr; gap: 14px; margin-top: 18px; }
.door { position: relative; }
.door-main {
  display: block; width: 100%; text-align: left; margin: 0;
  border-radius: 28px; padding: 16px 18px 14px;
}
.door-art { display: block; }
.door-art .fig { height: 118px; width: auto; max-width: 100%; margin: 0 auto; }
.door-row { display: flex; align-items: center; justify-content: space-between; margin-top: 8px; }
.door-name { font-size: 30px; font-weight: 800; letter-spacing: -.03em; }
.door-meta { display: block; color: var(--muted); font-weight: 600; font-size: 15.5px; margin-top: 2px; }
.door-ring { width: 42px; height: 42px; transform: rotate(-90deg); }
.door-ring circle { fill: none; stroke-width: 4.5; }
.dr-bg { stroke: var(--glass-border); }
.dr-fg { stroke: var(--teal); stroke-linecap: round; }
.door-chip {
  position: absolute; top: 12px; right: 12px; margin: 0;
  border-radius: 999px; padding: 8px 14px; font-size: 14.5px; font-weight: 700;
  background: var(--orange); color: #231203; border: none;
}
.quiet-links { display: flex; gap: 8px; margin-top: 14px; }
.quiet-links button { flex: 1; border-radius: 20px; font-size: 15.5px; color: var(--muted); box-shadow: none; }

/* ---------- Figures (visuals.js) + Wave 1.5 motion ---------- */
.fig { width: 100%; height: auto; display: block; color: var(--text); }
.fig-wall { stroke: var(--text); stroke-width: 7; }
.fig-floor { stroke: var(--muted); stroke-width: 2; opacity: .5; }
.fig-torso { stroke: var(--text); stroke-width: 13; fill: none; stroke-linecap: round; stroke-linejoin: round; }
.fig-leg { stroke: var(--text); stroke-width: 12; fill: none; stroke-linecap: round; stroke-linejoin: round; }
.fig-leg.work { stroke: var(--orange); }
.fig-arm { stroke: var(--text); stroke-width: 9; fill: none; stroke-linecap: round; }
.fig-foot { stroke: var(--text); stroke-width: 7; fill: none; stroke-linecap: round; }
.fig-foot.planted { stroke: var(--plant); }
.fig-head { fill: var(--text); }
.fig-joint { fill: var(--bg); stroke: var(--text); stroke-width: 2; }
.fig-arrow { fill: none; stroke: var(--text); stroke-width: 3.5; stroke-linecap: round; animation: figArrow 2.6s ease-in-out infinite; }
.fig-arrow-head { fill: var(--text); stroke: none; animation: figArrow 2.6s ease-in-out infinite; }
.fig-lab { font-size: 12.5px; font-weight: 800; fill: var(--text); letter-spacing: .02em; }
.fig-strap { stroke: #d7a400; stroke-width: 5; fill: none; stroke-linecap: round; }
.fig-band { stroke: var(--orange); stroke-width: 4; fill: none; stroke-dasharray: 6 4; }
.fig-prop { stroke: var(--text); stroke-width: 4; }
.fig-bell { fill: var(--orange); }
.fig-limb, .fig-upper, .fig-all { transform-box: view-box; }
/* Dynamic moves loop their real motion (~3-4s). */
.motion-swing .fig-limb.is-work { animation: figSwing 3.2s ease-in-out infinite; }
@keyframes figSwing { 0%, 100% { transform: rotate(0deg); } 50% { transform: rotate(-11deg); } }
.motion-press .fig-upper { animation: figPress 3.8s ease-in-out infinite; }
@keyframes figPress { 0%, 100% { transform: rotate(0deg); } 50% { transform: rotate(-6deg); } }
.motion-squat .fig-upper { animation: figSquat 3s ease-in-out infinite; }
.motion-squat .fig-limb.is-work { animation: figSquatBend 3s ease-in-out infinite; }
@keyframes figSquat { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(8px); } }
@keyframes figSquatBend { 0%, 100% { transform: rotate(0deg); } 50% { transform: rotate(5deg); } }
.motion-sway { animation: figSway 4.6s ease-in-out infinite; }
@keyframes figSway { 0%, 100% { transform: rotate(-1.3deg); } 50% { transform: rotate(1.3deg); } }
.motion-open .fig-limb.lg0 { animation: figOpen0 3.6s ease-in-out infinite; }
.motion-open .fig-limb.lg1 { animation: figOpen1 3.6s ease-in-out infinite; }
@keyframes figOpen0 { 0%, 100% { transform: rotate(0deg); } 50% { transform: rotate(6deg); } }
@keyframes figOpen1 { 0%, 100% { transform: rotate(0deg); } 50% { transform: rotate(-6deg); } }
/* Holds breathe; the target leg/area pulses. */
.motion-breathe { animation: figBreathe 4.2s ease-in-out infinite; }
@keyframes figBreathe { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.018); } }
.motion-breathe .fig-leg.work, .motion-sway .fig-leg.work, .motion-open .fig-leg.work { animation: figPulse 2.6s ease-in-out infinite; }
@keyframes figPulse { 0%, 100% { stroke-width: 12; } 50% { stroke-width: 15.5; } }
@keyframes figArrow { 0%, 100% { opacity: .45; } 50% { opacity: 1; } }

/* ---------- Cards / library / finishers ---------- */
.vcard, .seq-card, .trend-card {
  background: var(--glass);
  -webkit-backdrop-filter: blur(18px) saturate(1.45);
  backdrop-filter: blur(18px) saturate(1.45);
  border: 1px solid var(--glass-border);
  border-radius: 26px; padding: 16px; margin: 12px 0; box-shadow: var(--shadow);
}
.vcard-tag, .tag { color: var(--muted); font-size: 14px; font-weight: 600; }
.cues { margin: 8px 0; padding-left: 20px; font-size: 16px; line-height: 1.45; }
.feel-line { font-size: 17.5px; font-weight: 700; line-height: 1.4; margin: 10px 0; }
.mini-card { display: block; width: 100%; text-align: left; padding: 12px; border-radius: 24px; }
.mini-card span { display: block; font-weight: 700; font-size: 16px; margin-top: 6px; }
.mini-card .mini-tag { font-weight: 500; font-size: 13px; color: var(--muted); }
#library-cards, #finisher-cards { display: grid; grid-template-columns: 1fr; gap: 8px; }
.cue-chip {
  display: inline-block; padding: 8px 16px; border-radius: 999px;
  background: var(--teal); color: #06231e;
  font-size: 16.5px; font-weight: 800; letter-spacing: -.01em;
}
.mini-btn { border-radius: 999px; padding: 8px 14px; font-size: 14.5px; margin-left: 8px; }

/* ---------- Session player ---------- */
.player { border-radius: 32px; padding: 20px 18px 16px; margin-top: 14px; }
.player-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.player-top h2 { margin: 0; font-size: 21px; }
.player-tools { display: flex; gap: 6px; }
.player-tools button { margin: 0; border-radius: 999px; padding: 9px 15px; }
#voice-toggle { font-size: 18px; padding: 7px 13px; }
.step-visual { margin-top: 10px; }
.step-visual .fig { max-height: 34vh; }
.step-in { animation: stepIn .55s var(--spring) both; }
@keyframes stepIn { from { opacity: 0; transform: translateX(34px) scale(.975); } to { opacity: 1; transform: none; } }
.ring-wrap { position: relative; width: min(236px, 62vw); margin: 6px auto 0; }
#ring { width: 100%; height: auto; display: block; transform: rotate(-90deg); }
#ring circle { fill: none; stroke-width: 11; }
.ring-bg { stroke: var(--glass-border); }
.ring-fg { stroke: var(--teal); stroke-linecap: round; stroke-dasharray: 553; stroke-dashoffset: 0; transition: stroke-dashoffset .95s linear; }
#clock {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  font-size: 64px; font-weight: 800; letter-spacing: -.03em; margin: 0;
  font-variant-numeric: tabular-nums; pointer-events: none;
}
#step-name { font-size: 27px; font-weight: 800; letter-spacing: -.025em; text-align: center; margin: 12px 0 0; }
#step-count { text-align: center; margin: 2px 0 8px; }
.player p:has(.cue-chip), #step-feel { text-align: center; }
#step-feel { margin: 8px 0 4px; }
.player-controls { justify-content: center; margin-top: 10px; }
.player-controls button { border-radius: 999px; padding: 14px 22px; font-size: 18px; }
#start-pause { background: var(--teal); color: #06231e; border: none; min-width: 128px; }
.next-up {
  display: flex; align-items: center; gap: 12px; margin-top: 14px;
  background: var(--glass); border: 1px solid var(--glass-border);
  border-radius: 22px; padding: 8px 14px 8px 8px;
}
.next-thumb { display: block; width: 96px; flex: none; }
.next-thumb .fig { width: 100%; }
.next-meta strong { display: block; font-size: 17.5px; }
.vs-label { display: block; font-size: 12.5px; font-weight: 800; letter-spacing: .07em; text-transform: uppercase; color: var(--muted); }

/* ---------- Coach sheet ---------- */
#coach-sheet { position: fixed; inset: 0; z-index: 60; }
#coach-sheet[hidden] { display: none; }
.sheet-backdrop { position: absolute; inset: 0; background: rgba(4, 12, 15, .5); -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px); }
.sheet {
  position: absolute; left: 50%; transform: translateX(-50%);
  bottom: 0; width: min(680px, 100%); max-height: 88vh; overflow-y: auto;
  border-radius: 30px 30px 0 0; padding: 18px 18px 34px;
  animation: sheetUp .5s var(--spring) both;
}
@keyframes sheetUp { from { transform: translate(-50%, 46px); opacity: .4; } to { transform: translate(-50%, 0); opacity: 1; } }
.sheet-head { display: flex; align-items: center; justify-content: space-between; }
.sheet-head h2 { margin: 0; }
#step-list { margin: 10px 0 0; padding-left: 22px; line-height: 1.5; }
#step-list li.done { color: var(--muted); text-decoration: line-through; }
#step-list li.current { color: var(--teal); font-weight: 700; }

/* ---------- Session pill ---------- */
#session-pill {
  position: fixed; left: 50%; transform: translateX(-50%);
  bottom: max(14px, env(safe-area-inset-bottom)); z-index: 50;
  display: flex; gap: 6px; align-items: stretch;
  background: var(--glass);
  -webkit-backdrop-filter: blur(20px) saturate(1.5);
  backdrop-filter: blur(20px) saturate(1.5);
  border: 1px solid var(--glass-border); box-shadow: var(--shadow);
  border-radius: 999px; padding: 6px;
  animation: pillIn .5s var(--spring) both;
  max-width: calc(100vw - 24px);
}
#session-pill[hidden] { display: none; }
@keyframes pillIn { from { transform: translate(-50%, 24px); opacity: 0; } to { transform: translate(-50%, 0); opacity: 1; } }
#session-pill button { margin: 0; box-shadow: none; border: none; background: transparent; border-radius: 999px; white-space: nowrap; }
#session-pill button:active { background: var(--teal); }
#pill-label { font-weight: 700; }
#pill-time { font-weight: 800; color: var(--teal); font-variant-numeric: tabular-nums; }
#pill-toggle { background: var(--teal); color: #06231e; font-weight: 800; padding: 10px 18px; }

/* ---------- Gym Mode (iPhone: compact, one screen, one-handed) ---------- */
#gym-view { max-width: 520px; }
.gym-set { font-size: 19px; font-weight: 800; margin: 2px 0; }
.gym-visual {
  background: var(--glass); border: 1px solid var(--glass-border);
  border-radius: 26px; padding: 10px; box-shadow: var(--shadow);
}
.gym-visual .fig { max-height: 21vh; }
.gym-vs { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 12px 0 4px; }
.vs-num { font-size: 16.5px; font-weight: 700; line-height: 1.3; }
#gym-view .feel-line { margin: 6px 0; font-size: 16.5px; }
.gym-report { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 6px; }
.gym-nums { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin-top: 4px; }
.rep-btn { font-size: 21px; font-weight: 800; padding: 15px 0; margin: 0; border-radius: 20px; }
.rep-btn.picked { background: var(--teal); color: #06231e; }
.rep-custom { grid-column: 1 / -1; margin-top: 0; }
.gym-gate { margin-top: 12px; }
.gym-gate summary { font-weight: 700; padding: 8px 0; }

/* ---------- Summary ---------- */
.summary-line { font-size: 18px; font-weight: 600; line-height: 1.4; background: var(--glass); border: 1px solid var(--glass-border); border-radius: 20px; padding: 13px 15px; margin: 8px 0; animation: stepIn .45s var(--spring) both; }
.summary-line:nth-child(2) { animation-delay: .07s; } .summary-line:nth-child(3) { animation-delay: .14s; }
.summary-line:nth-child(4) { animation-delay: .21s; } .summary-line:nth-child(5) { animation-delay: .28s; }
.purpose-line { font-size: 16px; color: var(--muted); font-style: italic; margin: 16px 0 8px; }
.spark-svg { width: 100%; height: auto; }
.spark { fill: none; stroke-width: 2.5; }
.spark.hips { stroke: var(--teal); } .spark-dot.hips { fill: var(--teal); }
.spark.back { stroke: var(--orange); } .spark-dot.back { fill: var(--orange); }

/* ---------- Wide screens: iPad Stretch Station (floor distance) ---------- */
@media (min-width: 900px) {
  section, main, #lock-screen { max-width: 1180px; }
  #doors { grid-template-columns: 1fr 1fr 1fr; }
  .door-art .fig { height: 150px; }
  #timer-view { max-width: 1060px; }
  .player { padding: 26px 30px 22px; }
  .step-visual .fig { max-height: 46vh; }
  .ring-wrap { width: 300px; }
  #clock { font-size: 84px; }
  #step-name { font-size: 42px; }
  #timer-view .feel-line { font-size: 23px; }
  #timer-view .cue-chip { font-size: 19px; }
  #library-cards, #finisher-cards { grid-template-columns: 1fr 1fr; }
}

/* ---------- Reduced motion: everything rests ---------- */
@media (prefers-reduced-motion: reduce) {
  .fig *, .fig-all, .fig-limb, .fig-upper { animation: none !important; }
  .step-in, .sheet, #session-pill, .summary-line { animation: none !important; }
  button { transition: none; }
  .ring-fg { transition: none; }
}
