:root {
  color-scheme: dark;
  --ink: #f4fff9;
  --muted: #8ea39b;
  --panel: #0c1715;
  --panel-2: #101f1c;
  --accent: #a4ff3f;
  --accent-soft: rgba(164, 255, 63, .16);
  --cyan: #55f5d0;
  --warn: #ffcc47;
  --danger: #ff735d;
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "SF Pro Display", "PingFang SC", sans-serif;
}

* { box-sizing: border-box; }

html, body { margin: 0; min-height: 100%; background: #030807; color: var(--ink); }
body { display: grid; place-items: center; overflow-x: hidden; }
button { color: inherit; font: inherit; }

.app-shell {
  width: min(100%, 450px);
  min-height: 100svh;
  background: var(--panel);
  overflow: hidden;
  position: relative;
  box-shadow: 0 0 80px rgba(0,0,0,.55);
}

.camera-stage {
  height: 62svh;
  min-height: 520px;
  max-height: 720px;
  position: relative;
  overflow: hidden;
  background: linear-gradient(155deg, #172823 0%, #09110f 48%, #101916 100%);
}

#camera, .demo-scene, #poseCanvas { position: absolute; inset: 0; width: 100%; height: 100%; }
#camera { object-fit: cover; display: none; filter: saturate(.72) contrast(1.07) brightness(.72); }
#camera.front-camera { transform: scaleX(-1); }
#poseCanvas { z-index: 4; }
.demo-scene { overflow: hidden; background: radial-gradient(circle at 70% 20%, rgba(88,129,113,.32), transparent 37%); }
.demo-scene::before { content: ""; position: absolute; inset: 0; background: linear-gradient(90deg, rgba(255,255,255,.025) 1px, transparent 1px); background-size: 54px 100%; opacity: .25; }
.demo-scene::after { content: ""; position: absolute; left: -10%; right: -10%; bottom: 0; height: 31%; background: linear-gradient(165deg, transparent 0 19%, rgba(41,61,54,.72) 20% 21%, #09110f 22%); }
.light { position: absolute; filter: blur(18px); border-radius: 50%; opacity: .2; }
.light-a { width: 190px; height: 190px; background: #98ffd5; right: -80px; top: 70px; }
.light-b { width: 120px; height: 120px; background: var(--accent); left: -80px; bottom: 120px; opacity: .1; }
.floor-line { position: absolute; z-index: 1; height: 1px; background: linear-gradient(90deg, transparent, rgba(164,255,63,.24), transparent); transform-origin: center; bottom: 14%; width: 130%; left: -15%; }
.floor-line-a { transform: rotate(-10deg); }.floor-line-b { transform: rotate(12deg); }

.top-bar { position: absolute; z-index: 8; top: 0; left: 0; right: 0; padding: max(22px, env(safe-area-inset-top)) 22px 0; display: flex; align-items: center; justify-content: space-between; }
.top-bar h1 { margin: 2px 0 0; font-size: 26px; letter-spacing: -.8px; }
.top-bar h1 sup { color: #07100f; background: var(--accent); border-radius: 5px; padding: 2px 5px; font-size: 8px; letter-spacing: .7px; vertical-align: top; margin-left: 3px; }
.header-actions { display: flex; gap: 8px; }
.eyebrow { color: var(--accent); font-size: 10px; letter-spacing: 1.4px; text-transform: uppercase; margin: 0; font-weight: 700; }
.live-dot { display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: var(--accent); margin-right: 7px; box-shadow: 0 0 9px var(--accent); animation: pulse 1.5s infinite; }
@keyframes pulse { 50% { opacity: .35; transform: scale(.72); } }
.icon-button { width: 42px; height: 42px; border: 1px solid rgba(255,255,255,.12); background: rgba(3,8,7,.72); border-radius: 50%; display: grid; place-items: center; cursor: pointer; }
.icon-button:disabled { opacity: .38; cursor: not-allowed; }
.camera-icon { width: 17px; height: 13px; border: 1.6px solid var(--ink); border-radius: 3px; position: relative; }
.camera-icon::before { content: ""; position: absolute; width: 5px; height: 5px; border: 1.4px solid var(--ink); border-radius: 50%; left: 4px; top: 2px; }
.camera-icon::after { content: ""; position: absolute; width: 6px; height: 3px; border-radius: 2px 2px 0 0; background: var(--ink); left: 4px; top: -4px; }
.voice-icon { width: 18px; height: 16px; position: relative; color: var(--muted); }
.voice-icon::before { content: ""; position: absolute; left: 0; top: 3px; width: 11px; height: 10px; background: currentColor; clip-path: polygon(0 32%, 38% 32%, 100% 0, 100% 100%, 38% 68%, 0 68%); }
.voice-icon::after { content: ""; position: absolute; right: 0; top: 3px; width: 5px; height: 8px; border-right: 1.5px solid currentColor; border-radius: 50%; }
.record-icon { width: 14px; height: 14px; border: 2px solid #ff7a68; border-radius: 50%; box-shadow: 0 0 8px rgba(255,115,93,.22); }
#recordButton.recording { border-color: rgba(255,115,93,.72); background: rgba(255,115,93,.17); }
#recordButton.recording .record-icon { background: var(--danger); border-radius: 3px; border-color: var(--danger); animation: recordPulse 1s infinite; }
@keyframes recordPulse { 50% { opacity: .45; transform: scale(.82); } }
.icon-button.active { border-color: rgba(164,255,63,.45); background: var(--accent-soft); }
.icon-button.active .voice-icon { color: var(--accent); }
.recording-indicator { position: absolute; z-index: 9; top: 138px; left: 20px; display: flex; align-items: center; gap: 5px; padding: 6px 8px; border-radius: 999px; color: #fff; background: rgba(94,16,11,.84); border: 1px solid rgba(255,115,93,.52); font-size: 9px; letter-spacing: .4px; box-shadow: 0 5px 16px rgba(0,0,0,.25); }
.recording-indicator[hidden] { display: none; }
.recording-indicator i { width: 7px; height: 7px; border-radius: 50%; background: var(--danger); animation: recordPulse 1s infinite; }
.recording-indicator span { min-width: 28px; color: #ffd6cf; font-variant-numeric: tabular-nums; }

.sport-button { position: absolute; z-index: 8; top: 90px; left: 50%; transform: translateX(-50%); height: 34px; min-width: 145px; padding: 0 12px; display: flex; align-items: center; justify-content: center; gap: 8px; border-radius: 11px; border: 1px solid rgba(164,255,63,.2); background: #0a1613; cursor: pointer; box-shadow: 0 8px 20px rgba(0,0,0,.18); }
.sport-button span { color: var(--accent); font-size: 17px; }.sport-button b { font-size: 11px; }.sport-button i { color: var(--muted); font-style: normal; font-size: 10px; }
.mode-switch { position: absolute; z-index: 8; top: 132px; left: 50%; transform: translateX(-50%); border: 1px solid rgba(255,255,255,.1); background: rgba(5,13,11,.88); padding: 3px; border-radius: 999px; display: flex; }
.mode { border: 0; background: transparent; color: #8da098; border-radius: 999px; padding: 7px 18px; font-size: 12px; cursor: pointer; transition: .2s; }
.mode.active { color: #0a120f; background: var(--accent); font-weight: 750; }

.quality-badge { position: absolute; z-index: 7; top: 181px; left: 19px; display: flex; gap: 8px; align-items: center; background: rgba(3,8,7,.76); border: 1px solid rgba(255,255,255,.08); border-radius: 12px; padding: 8px 10px; font-size: 11px; line-height: 1.25; }
.quality-badge b { font-size: 13px; }.quality-badge small { color: var(--muted); font-size: 9px; }
.quality-ring { width: 22px; height: 22px; border-radius: 50%; background: conic-gradient(var(--accent) 94%, rgba(255,255,255,.14) 0); padding: 3px; }
.quality-ring i { display: block; width: 100%; height: 100%; border-radius: 50%; background: #18231f; }
.calibration-badge { position: absolute; z-index: 7; right: 19px; top: 181px; display: flex; align-items: center; gap: 7px; padding: 8px 10px; border-radius: 12px; color: var(--accent); background: rgba(3,8,7,.76); border: 1px solid rgba(255,255,255,.08); text-align: left; cursor: pointer; }
.calibration-badge > span { font-size: 17px; }.calibration-badge div { display: grid; gap: 1px; }.calibration-badge b { font-size: 9px; }.calibration-badge small { color: var(--muted); font-size: 8px; }

.frame-guide { position: absolute; z-index: 3; inset: 180px 48px 106px; opacity: .42; }
.corner { position: absolute; width: 25px; height: 25px; border-color: var(--accent); border-style: solid; }
.tl { left:0;top:0;border-width:1px 0 0 1px }.tr { right:0;top:0;border-width:1px 1px 0 0 }.bl { left:0;bottom:0;border-width:0 0 1px 1px }.br { right:0;bottom:0;border-width:0 1px 1px 0 }

.feedback-card { position: absolute; z-index: 8; left: 20px; right: 20px; bottom: 45px; min-height: 54px; background: rgba(5,14,12,.94); border: 1px solid rgba(164,255,63,.24); border-radius: 16px; display: flex; align-items: center; gap: 12px; padding: 10px 13px; transition: border-color .2s, transform .2s; }
.feedback-card.warning { border-color: rgba(255,204,71,.46); transform: translateY(-2px); }
.feedback-icon { flex: 0 0 31px; width: 31px; height: 31px; border-radius: 10px; display: grid; place-items: center; color: #09110e; background: var(--accent); font-weight: 900; }
.warning .feedback-icon { background: var(--warn); }
.feedback-card p { margin: 0 0 2px; font-weight: 720; font-size: 13px; }.feedback-card small { color: var(--muted); font-size: 10px; }
.demo-label { position: absolute; z-index: 7; bottom: 18px; left: 0; right: 0; text-align: center; color: rgba(255,255,255,.38); letter-spacing: 1.5px; font-size: 8px; margin: 0; }

.dashboard { background: linear-gradient(180deg, #0d1916, #091210); min-height: 38svh; padding: 18px 20px max(18px, env(safe-area-inset-bottom)); border-radius: 24px 24px 0 0; margin-top: -22px; position: relative; z-index: 10; box-shadow: 0 -12px 35px rgba(0,0,0,.28); }
.score-block { display: flex; align-items: center; gap: 18px; }
.score-ring { --score: 92; flex: 0 0 82px; width: 82px; height: 82px; border-radius: 50%; background: conic-gradient(var(--accent) calc(var(--score)*1%), rgba(255,255,255,.08) 0); padding: 5px; transition: background .3s; box-shadow: 0 0 24px rgba(164,255,63,.09); }
.score-ring > div { height: 100%; border-radius: 50%; background: #0e1a17; display: grid; align-content: center; justify-items: center; }
.score-ring strong { font-size: 27px; line-height: .9; }.score-ring span { color: var(--muted); font-size: 8px; margin-top: 5px; }
.rep-block { flex: 1; display: grid; grid-template-columns: 1fr auto; align-items: end; }
.rep-block span { color: var(--muted); font-size: 11px; }.rep-block strong { grid-row: span 2; font-size: 48px; line-height: .85; letter-spacing: -2px; }.rep-block small { font-size: 11px; color: var(--accent); margin-top: 7px; }

.metrics { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 16px 0 18px; }
.metrics article { min-width: 0; background: rgba(255,255,255,.035); border: 1px solid rgba(255,255,255,.055); padding: 10px; border-radius: 12px; display: grid; gap: 4px; }
.metrics span { color: var(--muted); font-size: 9px; white-space: nowrap; }.metrics strong { font-size: 15px; }.meter { height: 2px; border-radius: 2px; background: rgba(255,255,255,.1); margin-top: 3px; overflow: hidden; }.meter b { display: block; height: 100%; width: 60%; background: var(--accent); transition: width .1s, background .2s; }
.insight-row { height: 29px; margin: -8px 0 12px; display: flex; align-items: center; justify-content: space-between; padding: 0 10px; border-radius: 9px; background: rgba(255,255,255,.028); color: #95a79f; font-size: 8px; }
.insight-row span { display: inline-flex; align-items: center; gap: 5px; }.insight-row i { width: 5px; height: 5px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 5px rgba(164,255,63,.5); }.insight-row i.warn { background: var(--warn); box-shadow: 0 0 5px rgba(255,204,71,.5); }

.bottom-actions { display: grid; grid-template-columns: 64px 1fr 64px; align-items: center; gap: 10px; }
.bottom-actions button { border: 0; background: transparent; font-size: 8px; color: var(--muted); cursor: pointer; display: grid; justify-items: center; gap: 4px; }
.bottom-actions button > span { width: 31px; height: 31px; display: grid; place-items: center; border-radius: 50%; border: 1px solid rgba(255,255,255,.1); font-size: 15px; color: var(--ink); }
.bottom-actions .primary { min-height: 45px; border-radius: 14px; background: var(--accent); color: #0a110f; display: flex; justify-content: center; align-items: center; gap: 9px; font-size: 12px; font-weight: 750; }
.bottom-actions .primary span { width: auto; height: auto; border: 0; color: #0a110f; font-size: 13px; }.bottom-actions .primary b { font-weight: 760; }

dialog { width: min(calc(100% - 32px), 410px); max-height: min(760px, calc(100svh - 30px)); overflow-y: auto; background: #10201c; color: var(--ink); border: 1px solid rgba(255,255,255,.12); border-radius: 22px; padding: 25px; box-shadow: 0 20px 70px #000; }
dialog::backdrop { background: rgba(0,0,0,.82); }
dialog h2 { margin: 5px 0 18px; } dialog dl { margin: 0; } dialog dt { font-weight: 700; color: var(--accent); margin-top: 13px; } dialog dd { color: #b1c1bb; font-size: 12px; line-height: 1.55; margin: 3px 0 0; }
.dialog-close { position: absolute; right: 14px; top: 12px; background: transparent; border: 0; color: var(--muted); font-size: 25px; cursor: pointer; }.note { color: #7f938b; font-size: 10px; line-height: 1.55; border-top: 1px solid rgba(255,255,255,.08); padding-top: 14px; margin-bottom: 0; }
.report-summary { display: grid; grid-template-columns: repeat(3, 1fr); gap: 7px; }
.report-summary div { display: grid; justify-items: center; gap: 4px; padding: 12px 5px; border-radius: 12px; background: rgba(255,255,255,.04); border: 1px solid rgba(255,255,255,.05); }.report-summary strong { font-size: 23px; }.report-summary span { color: var(--muted); font-size: 8px; }
.trend-card { margin-top: 12px; padding: 13px; border-radius: 14px; background: #0a1714; }.trend-card header { display: flex; justify-content: space-between; font-size: 10px; }.trend-card header span { color: var(--muted); font-size: 8px; }
.trend-chart { height: 76px; margin-top: 12px; display: flex; align-items: end; gap: 7px; border-bottom: 1px solid rgba(255,255,255,.08); background: repeating-linear-gradient(to top, transparent 0 24px, rgba(255,255,255,.035) 25px); }.trend-chart p { align-self: center; margin: auto; color: var(--muted); font-size: 9px; }.trend-bar { flex: 1; min-width: 10px; max-width: 28px; border-radius: 5px 5px 0 0; background: linear-gradient(var(--accent), rgba(164,255,63,.2)); position: relative; animation: grow .35s ease-out; }.trend-bar::after { content: attr(data-score); position: absolute; left: 50%; top: -14px; transform: translateX(-50%); color: #b9c8c2; font-size: 7px; }
@keyframes grow { from { height: 0; } }
.report-insight { margin: 12px 0; padding: 14px; border-left: 2px solid var(--accent); background: rgba(164,255,63,.05); border-radius: 0 12px 12px 0; }.report-insight h3 { margin: 4px 0; font-size: 14px; }.report-insight > p:last-child { color: var(--muted); font-size: 10px; line-height: 1.5; margin: 0; }
.recommendation-card { margin: 12px 0; padding: 13px; border-radius: 13px; background: #0a1714; border: 1px solid rgba(85,245,208,.12); }
.recommendation-card header { display: flex; justify-content: space-between; align-items: center; font-size: 10px; }
.recommendation-card header span { color: var(--muted); font-size: 8px; }
.recommendation-card ol { margin: 9px 0 0; padding-left: 20px; color: #bdd0c8; font-size: 10px; line-height: 1.55; }
.recommendation-card li + li { margin-top: 6px; }
.rep-history { list-style: none; padding: 0; margin: 0 0 12px; max-height: 115px; overflow: auto; }.rep-history li { display: grid; grid-template-columns: 28px 1fr auto; align-items: center; gap: 8px; padding: 7px 2px; border-bottom: 1px solid rgba(255,255,255,.055); font-size: 10px; }.rep-history li b { width: 24px; height: 24px; display: grid; place-items: center; background: rgba(255,255,255,.05); border-radius: 7px; }.rep-history li span { color: var(--muted); }.rep-history li strong { color: var(--accent); }
.report-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 10px; }
.export-button, .next-set-button { width: 100%; padding: 11px; border: 0; border-radius: 11px; font-weight: 800; font-size: 11px; cursor: pointer; }
.export-button { background: rgba(255,255,255,.08); color: var(--ink); }
.next-set-button { background: var(--accent); color: #08100d; }
.recent-card { margin-top: 12px; padding: 12px; border-radius: 12px; background: rgba(255,255,255,.035); border: 1px solid rgba(255,255,255,.05); }
.recent-card header { display: flex; justify-content: space-between; align-items: center; font-size: 10px; }
.recent-card header span { color: var(--muted); font-size: 8px; }
.recent-sessions { list-style: none; padding: 0; margin: 8px 0 0; display: grid; gap: 6px; }
.recent-sessions li { display: grid; grid-template-columns: 1fr auto; gap: 4px 10px; padding-top: 6px; border-top: 1px solid rgba(255,255,255,.05); font-size: 9px; }
.recent-sessions li span { color: var(--muted); grid-column: 1 / -1; }
.recent-sessions .empty { color: var(--muted); display: block; }
dialog details { margin-top: 12px; color: var(--muted); font-size: 10px; } dialog summary { cursor: pointer; color: #b8c8c1; } dialog details dl { margin-top: 8px; }
.sport-dialog { padding-bottom: 20px; }.sport-list { display: grid; gap: 9px; }.sport-card { width: 100%; border: 1px solid rgba(255,255,255,.06); background: rgba(255,255,255,.035); color: var(--ink); border-radius: 15px; padding: 12px; display: grid; grid-template-columns: 42px 1fr auto; align-items: center; gap: 11px; text-align: left; cursor: pointer; }.sport-card.active { border-color: rgba(164,255,63,.42); background: rgba(164,255,63,.07); }.sport-card > i { width: 42px; height: 42px; display: grid; place-items: center; border-radius: 12px; color: var(--accent); background: var(--accent-soft); font-style: normal; font-size: 20px; }.sport-card div { display: grid; gap: 3px; }.sport-card b { font-size: 12px; }.sport-card small { color: var(--muted); font-size: 8px; line-height: 1.35; }.sport-card em { color: var(--accent); font-size: 8px; font-style: normal; }
.dominant-picker { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: -5px 0 13px; padding: 10px 11px; border-radius: 13px; background: rgba(255,255,255,.035); border: 1px solid rgba(255,255,255,.06); }.dominant-picker div { display: grid; gap: 2px; }.dominant-picker b { font-size: 10px; }.dominant-picker small { color: var(--muted); font-size: 7px; }.dominant-picker > span { display: flex; padding: 2px; border-radius: 9px; background: #091411; }.dominant { border: 0; color: var(--muted); background: transparent; border-radius: 7px; padding: 6px 10px; font-size: 9px; cursor: pointer; }.dominant.active { color: #08100d; background: var(--accent); font-weight: 800; }

.runtime-state { display: flex; gap: 12px; align-items: center; padding: 14px; border-radius: 15px; background: rgba(164,255,63,.07); border: 1px solid rgba(164,255,63,.16); }
.runtime-state > span { width: 36px; height: 36px; display: grid; place-items: center; border-radius: 11px; color: #07100f; background: var(--accent); font-weight: 900; }
.runtime-state div { display: grid; gap: 3px; }.runtime-state b { font-size: 13px; }.runtime-state small { color: var(--muted); font-size: 9px; line-height: 1.4; }
.runtime-state.warning { border-color: rgba(255,204,71,.36); background: rgba(255,204,71,.07); }.runtime-state.warning > span { background: var(--warn); }
.runtime-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 12px 0; }
.runtime-grid div { padding: 11px; border-radius: 12px; background: rgba(255,255,255,.035); border: 1px solid rgba(255,255,255,.055); }
.runtime-grid dt { color: var(--muted); margin: 0 0 4px; font-size: 8px; }.runtime-grid dd { color: var(--ink); margin: 0; font-size: 10px; font-weight: 700; }
.runtime-actions { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.runtime-actions button { border: 0; min-height: 40px; border-radius: 11px; color: #07100f; background: var(--accent); font-size: 10px; font-weight: 800; cursor: pointer; }
.runtime-actions button:disabled { color: var(--muted); background: rgba(255,255,255,.06); cursor: not-allowed; }
.install-guide { margin-top: 12px; padding: 13px; border-radius: 13px; background: #0a1714; }
.install-guide b { font-size: 11px; }.install-guide ol { margin: 8px 0 0; padding-left: 18px; color: var(--muted); font-size: 9px; line-height: 1.7; }
.recording-dialog video { display: block; width: 100%; max-height: 45svh; aspect-ratio: 9 / 14; object-fit: contain; border-radius: 15px; background: #020403; border: 1px solid rgba(255,255,255,.08); }
.recording-summary { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 11px 0; }
.recording-summary div { display: grid; gap: 4px; justify-items: center; padding: 9px 5px; border-radius: 10px; background: rgba(255,255,255,.035); }
.recording-summary span { color: var(--muted); font-size: 8px; }.recording-summary b { font-size: 10px; }
.recording-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.recording-actions button { width: 100%; padding: 11px; border: 0; border-radius: 11px; font-weight: 800; font-size: 11px; cursor: pointer; }

@media (max-width: 390px) {
  .top-bar { padding-left: 16px; padding-right: 16px; }
  .top-bar h1 { font-size: 22px; }
  .header-actions { gap: 6px; }
  .icon-button { width: 39px; height: 39px; }
}

@media (min-width: 700px) {
  body { padding: 28px; background: radial-gradient(circle at 50% 20%, #153128, #020504 50%); }
  .app-shell { min-height: 860px; height: min(900px, calc(100vh - 56px)); border-radius: 35px; border: 1px solid rgba(255,255,255,.1); }
  .camera-stage { height: 570px; min-height: 0; }
  .dashboard { min-height: 290px; }
}
