:root {
  --ink: #f6f2ea;
  --muted: #9ba8af;
  --faint: #6b7880;
  --line: rgba(220, 230, 232, 0.12);
  --surface: #202d39;
  --surface-2: #243440;
  --surface-3: #1b2732;
  --night: #101923;
  --accent: #ff6b35;
  --accent-soft: rgba(255, 107, 53, 0.14);
  --ice: #b8d9dc;
  --positive: #b7d7a8;
  --warning: #e9ba87;
  --radius-lg: 26px;
  --radius-md: 18px;
  --radius-sm: 12px;
  --shadow: 0 18px 48px rgba(0, 0, 0, 0.22);
}

* { box-sizing: border-box; }
html { background: #111a23; }
body {
  margin: 0;
  min-width: 320px;
  background: radial-gradient(circle at 75% -5%, rgba(87, 121, 137, 0.22), transparent 34%), var(--night);
  color: var(--ink);
  font-family: 'Sora', system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
}
button { font: inherit; }
button:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.app-shell { min-height: 100vh; padding-bottom: calc(90px + env(safe-area-inset-bottom)); }
.page { width: min(100%, 560px); margin: 0 auto; padding: 26px 18px 28px; }
.eyebrow, .mono { font-family: 'Space Mono', monospace; letter-spacing: 0.08em; }
.eyebrow { color: var(--muted); font-size: 10px; text-transform: uppercase; }
.mono { font-size: 11px; }
.header-row { display: flex; justify-content: space-between; align-items: center; gap: 16px; }
.brand-mark { display: flex; align-items: center; gap: 10px; }
.mark { width: 32px; height: 32px; border-radius: 11px; display: grid; place-items: center; background: var(--accent); color: #1a2025; font-weight: 800; font-size: 14px; letter-spacing: -0.08em; }
.brand-name { font-size: 15px; font-weight: 700; letter-spacing: -0.04em; }
.icon-button { border: 0; width: 42px; height: 42px; display: grid; place-items: center; border-radius: 50%; color: var(--ink); background: rgba(255,255,255,.08); cursor: pointer; }
.icon-button:hover { background: rgba(255,255,255,.14); }
.icon-button svg { width: 18px; height: 18px; }
.music-button.active { color: var(--accent); background: var(--accent-soft); }
.dynamic-island { position: fixed; top: max(10px, env(safe-area-inset-top)); left: 50%; z-index: 32; display: flex; align-items: center; gap: 8px; width: min(calc(100% - 32px), 290px); min-height: 44px; padding: 6px 7px 6px 11px; border: 1px solid rgba(255,255,255,.1); border-radius: 999px; background: rgba(7,13,19,.94); box-shadow: 0 14px 32px rgba(0,0,0,.28), inset 0 1px rgba(255,255,255,.05); transform: translateX(-50%); backdrop-filter: blur(18px); }
.dynamic-island.is-live { border-color: rgba(255,107,53,.28); }
.island-pulse { width: 7px; height: 7px; flex: 0 0 auto; border-radius: 50%; background: var(--accent); box-shadow: 0 0 12px var(--accent); }
.is-live .island-pulse { animation: pulse 1.7s ease-in-out infinite; }
.island-copy { min-width: 0; flex: 1; }
.island-copy strong, .island-copy span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.island-copy strong { color: var(--ink); font-size: 10px; }
.island-copy span { margin-top: 2px; color: var(--muted); font: 9px 'Space Mono', monospace; }
.island-action { width: 30px; height: 30px; display: grid; place-items: center; flex: 0 0 auto; border: 0; border-radius: 50%; color: var(--muted); background: rgba(255,255,255,.07); cursor: pointer; }
.island-action svg { width: 14px; height: 14px; }
.island-action.active { color: var(--accent); background: rgba(255,107,53,.14); }
.hero { padding: 33px 0 26px; }
.hero h1 { margin: 9px 0 11px; max-width: 430px; font-size: clamp(30px, 8vw, 44px); line-height: 1.03; letter-spacing: -0.075em; }
.hero h1 span { color: var(--accent); }
.hero p { max-width: 410px; margin: 0; color: var(--muted); font-size: 13px; line-height: 1.65; }
.section-head { display: flex; justify-content: space-between; align-items: end; margin: 12px 0 12px; }
.section-head h2 { margin: 0; font-size: 16px; letter-spacing: -0.04em; }
.section-head button { border: 0; background: transparent; color: var(--accent); font-size: 11px; cursor: pointer; padding: 0; }
.hero-card { position: relative; overflow: hidden; border: 1px solid rgba(255,255,255,.11); border-radius: var(--radius-lg); padding: 19px; background: linear-gradient(135deg, #283844, #1c2934 65%, #18232d); box-shadow: var(--shadow); }
.hero-card::after { content: ''; position: absolute; width: 170px; height: 170px; border: 1px solid rgba(255,107,53,.22); border-radius: 50%; right: -55px; top: -65px; box-shadow: 0 0 0 24px rgba(255,107,53,.035), 0 0 0 48px rgba(255,107,53,.025); }
.card-topline { display: flex; justify-content: space-between; align-items: center; position: relative; z-index: 1; }
.status-chip { display: inline-flex; align-items: center; gap: 6px; border-radius: 999px; padding: 6px 9px; color: var(--ice); background: rgba(183,217,220,.1); font-size: 10px; }
.status-chip .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 12px var(--accent); }
.hero-card h3 { position: relative; z-index: 1; margin: 25px 0 3px; font-size: 25px; letter-spacing: -0.06em; }
.hero-card p { position: relative; z-index: 1; margin: 0; color: var(--muted); font-size: 12px; }
.progress-track { height: 7px; border-radius: 999px; background: rgba(255,255,255,.09); overflow: hidden; }
.progress-track > span { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--accent), #ffa161); transition: width .4s ease; }
.hero-progress { margin: 20px 0 15px; position: relative; z-index: 1; }
.hero-progress-label { display: flex; justify-content: space-between; margin-bottom: 8px; color: var(--muted); font-size: 10px; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 48px; border: 0; border-radius: 14px; padding: 0 16px; cursor: pointer; font-weight: 700; font-size: 12px; transition: transform .18s ease, background .18s ease, opacity .18s ease; }
.btn svg { width: 15px; height: 15px; flex: 0 0 auto; }
.btn:active { transform: translateY(1px) scale(.99); }
.btn-primary { color: #18222e; background: var(--accent); box-shadow: 0 9px 20px rgba(255,107,53,.2); }
.btn-primary:hover { background: #ff8052; }
.btn-secondary { color: var(--ink); background: rgba(255,255,255,.09); }
.btn-secondary:hover { background: rgba(255,255,255,.14); }
.btn-quiet { color: var(--muted); background: transparent; border: 1px solid var(--line); }
.btn-full { width: 100%; }
.metric-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 11px 0 25px; }
.metric { min-height: 82px; padding: 13px 12px; border: 1px solid var(--line); border-radius: var(--radius-md); background: rgba(255,255,255,.04); }
.metric strong { display: block; margin-top: 10px; font-size: 22px; letter-spacing: -0.08em; }
.metric small { color: var(--muted); font-size: 10px; }
.routine-list { display: grid; gap: 9px; }
.routine-item { display: grid; grid-template-columns: 40px 1fr auto; align-items: center; gap: 11px; min-height: 72px; padding: 11px 12px; border: 1px solid var(--line); border-radius: var(--radius-md); background: var(--surface-3); }
.routine-item.completed { opacity: .56; }
.routine-item.completed .exercise-index { background: rgba(183,215,168,.16); color: var(--positive); }
.exercise-index { width: 38px; height: 38px; display: grid; place-items: center; border-radius: 12px; background: var(--accent-soft); color: var(--accent); font: 700 11px 'Space Mono', monospace; }
.routine-item h4 { margin: 0 0 4px; font-size: 12px; letter-spacing: -0.025em; }
.routine-item p { margin: 0; color: var(--muted); font-size: 10px; }
.item-status { color: var(--faint); font-size: 17px; }
.routine-item.completed .item-status { color: var(--positive); }
.streak-banner { display: flex; align-items: center; gap: 12px; margin: 24px 0 0; padding: 13px; border: 1px solid rgba(255,107,53,.2); border-radius: var(--radius-md); background: linear-gradient(90deg, rgba(255,107,53,.12), rgba(255,255,255,.03)); }
.flame { width: 34px; height: 34px; display: grid; place-items: center; border-radius: 11px; background: var(--accent); color: #1b2530; font-size: 16px; }
.streak-banner strong { display: block; font-size: 12px; }
.streak-banner p { margin: 3px 0 0; color: var(--muted); font-size: 10px; }
.bottom-nav { position: fixed; bottom: 0; left: 50%; z-index: 20; width: min(100%, 560px); transform: translateX(-50%); display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; padding: 10px 12px calc(10px + env(safe-area-inset-bottom)); border-top: 1px solid rgba(255,255,255,.08); background: rgba(16,25,35,.9); backdrop-filter: blur(18px); }
.nav-item { display: grid; place-items: center; gap: 4px; min-height: 44px; border: 0; color: var(--faint); background: transparent; cursor: pointer; font-size: 9px; }
.nav-item.active { color: var(--ink); }
.nav-item.active svg { color: var(--accent); }
.nav-item svg { width: 18px; height: 18px; }
.page-title { padding: 30px 0 20px; }
.page-title h1 { margin: 7px 0 0; font-size: 29px; letter-spacing: -0.07em; }
.training-callout { padding: 17px; border-radius: var(--radius-lg); background: linear-gradient(135deg, rgba(255,107,53,.15), rgba(255,255,255,.04)); border: 1px solid rgba(255,107,53,.21); }
.training-callout h3 { margin: 0 0 6px; font-size: 17px; }
.training-callout p { margin: 0; color: var(--muted); font-size: 11px; line-height: 1.6; }
.exercise-detail { padding: 18px; border: 1px solid var(--line); border-radius: var(--radius-lg); background: var(--surface-3); }
.exercise-detail + .exercise-detail { margin-top: 10px; }
.detail-top { display: flex; justify-content: space-between; gap: 12px; }
.detail-top h3 { margin: 0; font-size: 15px; }
.detail-top p { margin: 6px 0 0; color: var(--muted); font-size: 10px; }
.detail-badge { color: var(--ice); font: 10px 'Space Mono', monospace; }
.detail-copy { margin: 15px 0 0; color: var(--muted); font-size: 11px; line-height: 1.65; }
.detail-copy strong { color: var(--ink); }
.progress-card { padding: 17px; border: 1px solid var(--line); border-radius: var(--radius-lg); background: var(--surface-3); }
.progress-card h3 { margin: 0; font-size: 14px; }
.chart { display: flex; align-items: end; gap: 10px; height: 120px; margin-top: 21px; padding: 0 4px 20px; border-bottom: 1px solid var(--line); }
.bar-wrap { flex: 1; height: 100%; display: flex; align-items: end; justify-content: center; position: relative; }
.bar { width: 100%; max-width: 28px; min-height: 10px; border-radius: 6px 6px 2px 2px; background: rgba(255,255,255,.12); }
.bar.active { background: linear-gradient(180deg, #ff9b74, var(--accent)); }
.bar-label { position: absolute; bottom: -19px; color: var(--faint); font: 9px 'Space Mono', monospace; }
.chart-caption { display: flex; justify-content: space-between; margin-top: 16px; color: var(--muted); font-size: 10px; }
.preference { display: flex; justify-content: space-between; align-items: center; padding: 15px 0; border-bottom: 1px solid var(--line); }
.preference:last-child { border-bottom: 0; }
.preference strong { display: block; font-size: 12px; }
.preference p { margin: 5px 0 0; color: var(--muted); font-size: 10px; line-height: 1.5; }
.toggle { width: 44px; height: 24px; padding: 3px; border: 0; border-radius: 999px; background: #4a5961; cursor: pointer; }
.toggle span { display: block; width: 18px; height: 18px; border-radius: 50%; background: #d7dfdd; transition: transform .2s ease; }
.toggle.on { background: var(--accent); }
.toggle.on span { transform: translateX(20px); background: #fff1ea; }
.workout-shell { min-height: 100vh; padding: 18px 18px 28px; background: #0d151d; }
.workout-top { width: min(100%, 560px); margin: 0 auto; display: flex; justify-content: space-between; align-items: center; }
.workout-top .icon-button { background: rgba(255,255,255,.06); }
.workout-progress { width: min(100%, 560px); margin: 18px auto 14px; }
.camera-card { position: relative; width: min(100%, 560px); height: min(58vh, 470px); min-height: 340px; margin: 0 auto; overflow: hidden; border: 1px solid rgba(184,217,220,.18); border-radius: 28px; background: radial-gradient(circle at 50% 26%, rgba(88,110,122,.38), transparent 23%), linear-gradient(165deg, #263844, #111b25 70%); box-shadow: 0 24px 60px rgba(0,0,0,.28); }
.camera-card video { width: 100%; height: 100%; display: none; object-fit: cover; transform: scaleX(-1); }
.camera-card.video-on video { display: block; }
.camera-card.video-on .camera-placeholder { display: none; }
.camera-placeholder { position: absolute; inset: 0; display: grid; place-items: center; color: rgba(232,242,237,.8); }
.camera-placeholder::before { content: ''; position: absolute; width: 150px; height: 255px; border: 1px dashed rgba(184,217,220,.42); border-radius: 48% 48% 35% 35%; }
.placeholder-person { position: relative; width: 92px; height: 210px; opacity: .65; }
.placeholder-person::before { content: ''; position: absolute; top: 0; left: 28px; width: 36px; height: 36px; border: 2px solid var(--ice); border-radius: 50%; }
.placeholder-person::after { content: ''; position: absolute; top: 46px; left: 15px; width: 64px; height: 133px; border: 2px solid var(--ice); border-radius: 40px 40px 24px 24px; }
.camera-tag { position: absolute; top: 14px; left: 14px; display: inline-flex; align-items: center; gap: 7px; padding: 7px 9px; border-radius: 999px; color: #eaf1ef; background: rgba(12,21,28,.65); backdrop-filter: blur(10px); font: 9px 'Space Mono', monospace; }
.camera-tag .live { width: 6px; height: 6px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 10px var(--accent); animation: pulse 1.7s ease-in-out infinite; }
.camera-guide { position: absolute; inset: 34px 28px; border: 1px solid rgba(184,217,220,.34); border-radius: 22px; pointer-events: none; }
.camera-guide::before, .camera-guide::after { content: ''; position: absolute; width: 18px; height: 18px; border-color: var(--accent); border-style: solid; }
.camera-guide::before { left: -1px; top: -1px; border-width: 2px 0 0 2px; border-radius: 9px 0 0 0; }
.camera-guide::after { right: -1px; bottom: -1px; border-width: 0 2px 2px 0; border-radius: 0 0 9px 0; }
.pose-status { position: absolute; bottom: 14px; left: 14px; right: 14px; display: flex; justify-content: space-between; gap: 8px; padding: 10px 11px; border-radius: 13px; background: rgba(12,21,28,.72); backdrop-filter: blur(10px); }
.pose-status strong { display: block; color: var(--positive); font-size: 11px; }
.pose-status p { margin: 3px 0 0; color: var(--muted); font-size: 9px; }
.workout-info { width: min(100%, 560px); margin: 17px auto 0; }
.workout-info h1 { margin: 8px 0 5px; font-size: 25px; letter-spacing: -0.07em; }
.workout-info p { margin: 0; color: var(--muted); font-size: 11px; }
.cue-row { display: flex; align-items: center; gap: 10px; margin: 16px 0; padding: 11px 12px; border-radius: var(--radius-md); border: 1px solid rgba(183,215,168,.18); background: rgba(183,215,168,.08); }
.cue-row svg { flex: 0 0 auto; color: var(--positive); }
.cue-row span { color: #d8ead2; font-size: 11px; line-height: 1.4; }
.workout-actions { display: grid; grid-template-columns: 1fr 1.7fr 1fr; gap: 8px; }
.workout-actions .btn { min-height: 50px; padding: 0 8px; }
.camera-note { width: min(100%, 560px); margin: 15px auto 0; color: var(--faint); font: 9px/1.5 'Space Mono', monospace; text-align: center; }
.modal-backdrop { position: fixed; inset: 0; z-index: 40; display: grid; place-items: end center; padding: 16px; background: rgba(6,11,16,.75); backdrop-filter: blur(10px); }
.modal { width: min(100%, 520px); padding: 20px; border: 1px solid var(--line); border-radius: 25px; background: #1b2732; box-shadow: var(--shadow); animation: rise .24s ease-out; }
.modal h2 { margin: 2px 0 9px; font-size: 21px; letter-spacing: -0.06em; }
.modal p { margin: 0 0 15px; color: var(--muted); font-size: 11px; line-height: 1.65; }
.modal-actions { display: grid; gap: 8px; }
.modal .privacy-line { display: flex; align-items: center; gap: 8px; margin: 14px 0; padding: 10px; border-radius: 12px; color: var(--ice); background: rgba(184,217,220,.08); font: 9px/1.5 'Space Mono', monospace; }
.install-banner { display: none; position: fixed; left: 14px; right: 14px; bottom: calc(83px + env(safe-area-inset-bottom)); z-index: 19; align-items: center; gap: 11px; padding: 12px; border: 1px solid rgba(255,107,53,.3); border-radius: 17px; background: rgba(28,40,50,.96); box-shadow: var(--shadow); }
.install-banner.show { display: flex; }
.install-banner p { flex: 1; margin: 0; color: var(--muted); font-size: 10px; line-height: 1.4; }
.install-banner p strong { display: block; color: var(--ink); margin-bottom: 2px; }
.install-banner .btn { min-height: 35px; padding: 0 10px; font-size: 10px; }
.empty-state { padding: 30px 12px; color: var(--muted); text-align: center; font-size: 12px; line-height: 1.6; }
.toast { position: fixed; top: 16px; left: 50%; z-index: 60; width: max-content; max-width: calc(100% - 32px); padding: 11px 14px; border: 1px solid rgba(255,255,255,.15); border-radius: 12px; color: var(--ink); background: #243440; box-shadow: var(--shadow); opacity: 0; pointer-events: none; transform: translate(-50%, -10px); transition: opacity .2s ease, transform .2s ease; font-size: 11px; text-align: center; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
@keyframes pulse { 50% { opacity: .42; transform: scale(.8); } }
@keyframes rise { from { opacity: 0; transform: translateY(15px); } to { opacity: 1; transform: translateY(0); } }
@media (min-width: 700px) {
  .page { padding-top: 44px; }
  .modal-backdrop { place-items: center; }
  .install-banner { left: calc(50% - 280px); right: auto; width: 532px; }
}
