:root {
  --court: #075d3b;
  --court-deep: #043f2a;
  --court-light: #0b7650;
  --lime: #d8ff52;
  --white: #f7fff9;
  --ink: #0b2419;
  --muted: #b9d6c8;
  --line: rgba(255,255,255,.82);
  --panel: rgba(246,255,249,.96);
  --shadow: 8px 8px 0 rgba(1,37,23,.55);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  min-height: 100vh;
  color: var(--white);
  background: var(--court);
  font-family: Inter, "Noto Sans TC", system-ui, -apple-system, sans-serif;
  overflow-x: hidden;
}
button, input { font: inherit; }
button { cursor: pointer; }

.court-lines {
  position: fixed;
  inset: 0;
  z-index: -1;
  opacity: .16;
  background:
    linear-gradient(90deg, transparent 8%, var(--line) 8% 8.25%, transparent 8.25% 50%, var(--line) 50% 50.25%, transparent 50.25% 91.75%, var(--line) 91.75% 92%, transparent 92%),
    linear-gradient(transparent 16%, var(--line) 16% 16.35%, transparent 16.35% 49.8%, var(--line) 49.8% 50.15%, transparent 50.15% 83.65%, var(--line) 83.65% 84%, transparent 84%);
}
.site-header {
  width: min(1180px, calc(100% - 40px));
  margin: 0 auto;
  padding: 24px 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.brand { color: inherit; text-decoration: none; display: flex; align-items: center; gap: 12px; }
.brand-mark {
  display: grid; place-items: center; width: 46px; height: 46px;
  color: var(--ink); background: var(--lime); border: 3px solid var(--white);
  box-shadow: 4px 4px 0 var(--court-deep); font-weight: 950;
}
.brand strong, .brand small { display: block; letter-spacing: .12em; }
.brand small { margin-top: 2px; color: var(--muted); font-size: 10px; }
.version-tag, .hero-badge, .soon-tag { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
.version-tag { padding: 8px 10px; border: 1px solid rgba(255,255,255,.5); color: var(--muted); font-size: 11px; }
main { width: min(1040px, calc(100% - 40px)); margin: 0 auto 80px; }
.hero { padding: 72px 0 58px; }
.eyebrow { color: var(--lime); font-weight: 800; letter-spacing: .16em; font-size: 12px; }
.hero h1 { margin: 18px 0; font-size: clamp(42px, 7vw, 76px); line-height: 1.04; letter-spacing: -.045em; }
.hero h1 span { color: var(--lime); }
.hero-copy { max-width: 620px; color: #d6ebdf; font-size: 18px; line-height: 1.8; }
.hero-badge { display: inline-block; margin-top: 18px; padding: 9px 12px; color: var(--ink); background: var(--white); font-size: 11px; font-weight: 800; box-shadow: 4px 4px 0 var(--court-deep); }
.panel { margin-top: 26px; padding: clamp(24px, 4vw, 42px); color: var(--ink); background: var(--panel); border: 3px solid var(--white); box-shadow: var(--shadow); }
.step-heading { display: flex; align-items: center; gap: 16px; margin-bottom: 28px; }
.step-heading > span { color: var(--white); background: var(--court); border: 2px solid var(--ink); padding: 10px; font-weight: 900; box-shadow: 3px 3px 0 var(--ink); }
.step-heading p { margin: 0 0 4px; color: #4c6e5e; font: 700 11px/1 ui-monospace, monospace; letter-spacing: .14em; }
.step-heading h2 { margin: 0; font-size: 24px; }
.motion-grid, .input-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.motion-card {
  position: relative; min-height: 168px; padding: 22px; text-align: left;
  color: var(--ink); background: #e8f4ed; border: 2px solid #8aab9c; transition: .16s ease;
}
.motion-card:hover { transform: translateY(-3px); border-color: var(--court); }
.motion-card.is-selected { color: var(--white); background: var(--court); border-color: var(--ink); box-shadow: 5px 5px 0 var(--ink); }
.motion-card strong, .motion-card small { display: block; }
.motion-card strong { margin-top: 18px; font-size: 21px; }
.motion-card small { margin-top: 5px; opacity: .7; font: 700 10px/1 ui-monospace, monospace; letter-spacing: .08em; }
.motion-card em { position: absolute; right: 15px; top: 13px; font-style: normal; font: 700 11px ui-monospace, monospace; opacity: .55; }
.pixel-icon { display: grid; place-items: center; width: 42px; height: 42px; color: var(--court); background: var(--lime); border: 2px solid currentColor; font-weight: 950; font-size: 22px; }
.input-grid { grid-template-columns: 1.35fr 1fr; }
.upload-zone, .camera-card { position: relative; min-height: 285px; padding: 32px; border: 2px dashed #799889; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; }
.upload-zone.is-dragging { background: #e7f9ec; border-color: var(--court); }
.camera-card { border-style: solid; background: #edf3ef; }
.upload-glyph, .camera-glyph { display: grid; place-items: center; width: 54px; height: 54px; color: var(--white); background: var(--court); border: 2px solid var(--ink); box-shadow: 4px 4px 0 var(--ink); font-size: 26px; font-weight: 900; }
.upload-zone h3, .camera-card h3 { margin: 20px 0 4px; }
.upload-zone p, .camera-card p { margin: 4px 0 18px; color: #567063; font-size: 14px; }
.upload-zone small, .camera-card small { margin-top: 13px; color: #748d81; font-size: 11px; }
.secondary-button { padding: 11px 16px; color: var(--court); background: transparent; border: 2px solid var(--court); font: 800 11px ui-monospace, monospace; letter-spacing: .08em; }
.secondary-button:hover { color: var(--white); background: var(--court); }
.soon-tag { position: absolute; top: 12px; right: 12px; padding: 5px 7px; color: var(--ink); background: var(--lime); font-size: 9px; font-weight: 900; }
.file-bar { margin-top: 16px; padding: 14px 16px; align-items: center; justify-content: space-between; background: #deeee5; border: 2px solid #719381; }
.file-bar:not([hidden]) { display: flex; }
.file-bar > div { display: grid; grid-template-columns: auto 1fr; column-gap: 10px; align-items: center; }
.file-dot { grid-row: 1 / 3; width: 10px; height: 10px; background: var(--lime); border: 2px solid var(--court); }
.file-bar strong { overflow-wrap: anywhere; font-size: 13px; }
.file-bar small { color: #607a6d; font-size: 11px; }
.file-bar button { border: 0; background: none; font-size: 24px; }
.analyze-button { width: 100%; margin-top: 18px; padding: 18px 22px; display: flex; align-items: center; justify-content: space-between; color: var(--ink); background: var(--lime); border: 3px solid var(--ink); box-shadow: 5px 5px 0 var(--ink); font-weight: 950; }
.analyze-button small { font-weight: 750; }
.analyze-button:disabled { cursor: not-allowed; filter: grayscale(1); opacity: .42; box-shadow: none; }
.pipeline { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; }
.pipeline div { position: relative; display: grid; justify-items: center; gap: 9px; color: #809488; font: 700 10px ui-monospace, monospace; }
.pipeline div:not(:last-child)::after { content: ""; position: absolute; left: 58%; right: -42%; top: 8px; height: 3px; background: #c6d5cd; }
.pipeline i { z-index: 1; width: 18px; height: 18px; background: #c6d5cd; border: 3px solid #809488; }
.pipeline .active i { background: var(--lime); border-color: var(--court); animation: pulse 1s steps(2) infinite; }
.pipeline .done i, .pipeline .done::after { background: var(--court) !important; border-color: var(--court); }
.pipeline .done { color: var(--court); }
.status-message { margin: 24px 0 0; padding: 12px; text-align: center; color: var(--white); background: var(--court); font-size: 13px; }
.toast { position: fixed; z-index: 5; right: 24px; bottom: 24px; max-width: 380px; padding: 14px 18px; color: var(--white); background: #291b17; border: 2px solid #ffb59d; box-shadow: 5px 5px 0 rgba(0,0,0,.35); }
footer { width: min(1180px, calc(100% - 40px)); margin: 0 auto; padding: 24px 0 34px; display: flex; justify-content: space-between; color: var(--muted); border-top: 1px solid rgba(255,255,255,.25); font: 700 10px ui-monospace, monospace; letter-spacing: .1em; }
@keyframes pulse { 50% { transform: scale(.72); } }
@media (max-width: 740px) {
  .version-tag { display: none; }
  .hero { padding-top: 42px; }
  .motion-grid, .input-grid { grid-template-columns: 1fr; }
  .motion-card { min-height: 130px; }
  .pipeline span { font-size: 8px; }
  .panel { padding: 23px 18px; }
  footer { gap: 12px; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { scroll-behavior: auto !important; animation: none !important; transition: none !important; } }

/* Camera Recording V1.1 */
.camera-modal { position: fixed; inset: 0; z-index: 100; padding: 24px; overflow-y: auto; background: rgba(2,27,17,.86); backdrop-filter: blur(8px); }
.camera-modal:not([hidden]) { display: grid; place-items: center; }
.camera-dialog { width: min(920px, 100%); padding: clamp(18px, 3vw, 30px); color: var(--ink); background: var(--panel); border: 3px solid var(--white); box-shadow: 10px 10px 0 var(--court-deep); }
.camera-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; }
.camera-header p { margin: 0 0 5px; color: #567063; font: 800 10px ui-monospace, monospace; letter-spacing: .12em; }
.camera-header h2 { margin: 0; font-size: 27px; }
.camera-header button { width: 42px; height: 42px; color: var(--ink); background: #e3eee8; border: 2px solid var(--ink); font-size: 25px; }
.camera-motion-confirm { margin: 20px 0 14px; padding: 13px 15px; display: grid; grid-template-columns: auto 1fr; gap: 4px 13px; align-items: center; background: var(--lime); border: 2px solid var(--ink); }
.camera-motion-confirm span { font: 800 10px ui-monospace, monospace; }
.camera-motion-confirm strong { font-size: 14px; }
.camera-motion-confirm small { grid-column: 2; color: #395145; }
.camera-stage { position: relative; aspect-ratio: 16 / 9; overflow: hidden; background: #06140e; border: 3px solid var(--ink); }
.camera-stage video { width: 100%; height: 100%; object-fit: cover; background: #06140e; }
.capture-guide { position: absolute; inset: 0; pointer-events: none; }
.court-guide, .pose-guide { position: absolute; inset: 0; }
.court-guide img { width: 100%; height: 100%; object-fit: contain; object-position: center bottom; opacity: .84; transform: translateY(-11%); }
.court-guide span, .pose-guide span { position: absolute; left: 50%; bottom: 4%; width: max-content; max-width: 88%; padding: 6px 9px; color: var(--ink); background: rgba(216,255,82,.94); transform: translateX(-50%); font-size: 11px; font-weight: 850; text-align: center; }
.pose-guide { display: none; }
.pose-guide-frame { position: absolute; left: 50%; bottom: 5%; width: 55%; height: 90%; border: 3px solid rgba(255,255,255,.62); transform: translateX(-50%); }
.pose-guide img { position: absolute; left: 50%; bottom: 5%; width: auto; height: 86%; object-fit: contain; opacity: .48; transform: translateX(-50%) scale(var(--guide-scale, 1)); transform-origin: center bottom; transition: opacity .18s ease; }
.pose-guide img.is-changing { opacity: .12; }
.guide-serve .court-guide, .guide-clear .court-guide { display: none; }
.guide-serve .pose-guide, .guide-clear .pose-guide { display: block; }
.guide-clear .pose-guide-frame { bottom: 3%; height: 94%; }
.guide-clear .pose-guide img { bottom: 3%; height: 88%; }
.countdown { position: absolute; inset: 0; display: grid; place-items: center; color: var(--lime); background: rgba(3,40,25,.62); text-shadow: 7px 7px 0 var(--court-deep); font: 950 clamp(90px, 18vw, 180px)/1 ui-monospace, monospace; }
.recording-badge { position: absolute; top: 14px; left: 14px; padding: 7px 10px; align-items: center; gap: 8px; color: var(--white); background: rgba(55,8,8,.82); font: 800 11px ui-monospace, monospace; }
.recording-badge:not([hidden]) { display: flex; }
.recording-badge i { width: 10px; height: 10px; background: #ff4e4e; animation: rec-blink 1s steps(1) infinite; }
.capture-quality { margin: 13px 0 0; display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.quality-item { min-height: 54px; padding: 9px 10px; display: grid; grid-template-columns: auto 1fr; gap: 2px 8px; align-items: center; color: #486256; background: #e4eee9; border: 2px solid #a8bdb2; transition: border-color .2s ease, background .2s ease, color .2s ease; }
.quality-item i { grid-row: 1 / 3; width: 15px; height: 15px; background: #a8bdb2; border: 2px solid var(--ink); }
.quality-item span { font-size: 12px; font-weight: 850; }
.quality-item strong { color: #71877c; font: 800 9px ui-monospace, monospace; }
.quality-item.is-pass { color: var(--ink); background: rgba(216,255,82,.72); border-color: var(--court); }
.quality-item.is-pass i { background: var(--lime); }
.quality-item.is-pass strong { color: var(--court); }
.quality-item.is-fail { background: #f4e6df; border-color: #c58c72; }
.quality-item.is-fail i { background: #db8e68; }
.quality-item.is-unavailable { filter: grayscale(.7); opacity: .75; }
.capture-quality-note { margin: 9px 0 0; color: #567063; font-size: 11px; text-align: center; }
.camera-tips { margin: 10px 0 0; padding: 0; display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; list-style: none; }
.camera-tips li { padding: 9px; text-align: center; color: #486256; background: #e4eee9; border: 1px solid #a8bdb2; font-size: 12px; }
.camera-status { min-height: 22px; margin: 13px 0; color: #567063; text-align: center; font-size: 13px; }
.camera-actions { display: flex; justify-content: center; gap: 10px; }
.camera-button { padding: 12px 17px; border: 2px solid var(--ink); font-weight: 900; }
.camera-button.primary { color: var(--ink); background: var(--lime); box-shadow: 4px 4px 0 var(--ink); }
.camera-button.ghost { color: var(--court); background: transparent; border-color: var(--court); }
.camera-button.stop { color: var(--white); background: #a62d2d; }
.camera-button:disabled { cursor: not-allowed; filter: grayscale(1); opacity: .5; }
body.camera-open { overflow: hidden; }
body.camera-open .mobile-bottom-nav,
body.camera-open .mobile-more-layer { display: none !important; }
@keyframes rec-blink { 50% { opacity: .25; } }
@media (max-width: 620px) { .camera-modal { padding: 8px; } .camera-dialog { padding: 15px; } .camera-motion-confirm { grid-template-columns: 1fr; } .camera-motion-confirm small { grid-column: auto; } .capture-quality, .camera-tips { grid-template-columns: 1fr; } .pose-guide-frame { width: 62%; } }

.countdown[hidden] { display: none; }

.capture-guide[hidden] { display: none; }

.motion-guard {
  margin-top: 16px;
  padding: 13px 16px;
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 4px 13px;
  align-items: center;
  color: var(--ink);
  background: #e6f0eb;
  border: 2px solid #719381;
  border-left: 8px solid var(--lime);
}

.motion-guard[hidden] {
  display: none;
}

.motion-guard span {
  font: 800 10px ui-monospace, monospace;
  letter-spacing: .08em;
}

.motion-guard strong {
  font-size: 14px;
}

.motion-guard small {
  grid-column: 2;
  color: #567063;
}


/* Homepage Combined Motion Input V2 */

.hero-actions {
  margin-top: 22px;
  display: flex;
  align-items: stretch;
  flex-wrap: wrap;
  gap: 14px;
}

.hero-actions .hero-badge {
  margin-top: 0;
  display: inline-flex;
  align-items: center;
}

.summary-link {
  display: inline-flex;
  align-items: center;
  padding: 10px 15px;
  color: var(--lime);
  background: var(--court-deep);
  border: 2px solid var(--lime);
  box-shadow: 4px 4px 0 var(--court-deep);
  font: 800 11px/1 ui-monospace, monospace;
  letter-spacing: .07em;
  text-decoration: none;
}

.summary-link:hover,
.summary-link:focus-visible {
  color: var(--ink);
  background: var(--lime);
  border-color: var(--ink);
  outline: none;
}

.motion-grid {
  margin-bottom: 28px;
}

.motion-card {
  min-height: 116px;
  padding: 17px 19px;
}

.motion-card strong {
  margin-top: 8px;
  font-size: 18px;
}

.motion-card small {
  margin-top: 4px;
}

.motion-card .pixel-icon {
  width: 34px;
  height: 34px;
  font-size: 17px;
}

.input-subheading {
  margin: 2px 0 18px;
  padding-top: 23px;
  border-top: 4px solid var(--court);
}

.input-subheading p {
  margin: 0 0 5px;
  color: #4c6e5e;
  font: 700 11px/1 ui-monospace, monospace;
  letter-spacing: .14em;
}

.input-subheading h3 {
  margin: 0;
  font-size: 21px;
}

.upload-zone,
.camera-card {
  min-height: 215px;
  padding: 24px;
}

.upload-glyph,
.camera-glyph {
  width: 46px;
  height: 46px;
  font-size: 22px;
}

.upload-zone h3,
.camera-card h3 {
  margin-top: 15px;
}

@media (max-width: 740px) {
  main,
  .site-header {
    width: min(100% - 24px, 1040px);
  }

  .hero {
    padding: 38px 0 34px;
  }

  .hero h1 {
    font-size: clamp(34px, 9.5vw, 47px);
    line-height: 1.08;
  }

  .hero-copy {
    font-size: 15px;
    line-height: 1.65;
  }

  .hero-actions {
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .hero-actions .hero-badge,
  .summary-link {
    justify-content: center;
    text-align: center;
  }

  .motion-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 7px;
    margin-bottom: 22px;
  }

  .motion-card {
    min-width: 0;
    min-height: 82px;
    padding: 11px 8px;
    text-align: center;
  }

  .motion-card .pixel-icon {
    width: 28px;
    height: 28px;
    margin: 0 auto;
    font-size: 14px;
  }

  .motion-card strong {
    margin-top: 8px;
    font-size: 15px;
  }

  .motion-card small {
    display: none;
  }

  .motion-card em {
    right: 7px;
    top: 6px;
    font-size: 8px;
  }

  .input-grid {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .upload-zone,
  .camera-card {
    min-height: 155px;
    padding: 18px 14px;
  }

  .upload-glyph,
  .camera-glyph {
    width: 38px;
    height: 38px;
    font-size: 19px;
  }

  .upload-zone h3,
  .camera-card h3 {
    margin: 11px 0 2px;
    font-size: 17px;
  }

  .upload-zone p,
  .camera-card p {
    margin: 3px 0 11px;
    font-size: 12px;
  }

  .upload-zone small,
  .camera-card small {
    margin-top: 9px;
    font-size: 10px;
  }

  .analyze-button {
    padding: 15px;
  }
}

/* Human Action Window V1 */

.annotation-state {
  margin-top: 16px;
  padding: 13px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  color: var(--court);
  background: #deeee5;
  border: 2px solid #719381;
  border-left: 8px solid var(--lime);
}

.annotation-state[hidden] {
  display: none;
}

.annotation-state span {
  font-weight: 900;
}

.annotation-state strong {
  font: 800 12px ui-monospace, monospace;
}

.analysis-actions {
  margin-top: 18px;
  display: grid;
  grid-template-columns: minmax(220px, .72fr) minmax(300px, 1.28fr);
  gap: 14px;
}

.adjust-window-button,
.analysis-actions .analyze-button {
  width: 100%;
  margin-top: 0;
  min-height: 72px;
  padding: 16px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-weight: 950;
}

.adjust-window-button {
  color: var(--court);
  background: #e6f0eb;
  border: 3px solid var(--court);
}

.adjust-window-button:hover:not(:disabled),
.adjust-window-button:focus-visible {
  color: var(--lime);
  background: var(--court);
  outline: none;
}

.adjust-window-button small {
  font-weight: 800;
}

.adjust-window-button:disabled {
  cursor: not-allowed;
  filter: grayscale(1);
  opacity: .42;
}

@media (max-width: 680px) {
  .analysis-actions {
    grid-template-columns: 1fr;
  }

  .annotation-state {
    align-items: flex-start;
    flex-direction: column;
  }
}

/* Camera UX Optimization V1 — camera-first controls */
.camera-dialog {
  position: relative;
}

.camera-stage {
  isolation: isolate;
}

.camera-stage video {
  display: block;
  object-fit: contain;
}

.camera-top-overlay,
.camera-bottom-overlay {
  position: absolute;
  left: 0;
  right: 0;
  z-index: 7;
  pointer-events: none;
}

.camera-top-overlay {
  top: 0;
  padding: 12px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  background: linear-gradient(to bottom, rgba(0, 20, 12, .74), rgba(0, 20, 12, 0));
}

.camera-bottom-overlay {
  bottom: 0;
  padding: 54px 14px 14px;
  background: linear-gradient(to top, rgba(0, 20, 12, .82), rgba(0, 20, 12, 0));
}

.camera-motion-chip {
  flex: 0 1 auto;
  min-width: 0;
  padding: 6px 8px;
  color: var(--white);
  background: rgba(2, 27, 17, .66);
  border: 1px solid rgba(255, 255, 255, .34);
  backdrop-filter: blur(4px);
}

.camera-motion-chip span {
  display: block;
  margin-bottom: 2px;
  font: 800 8px ui-monospace, monospace;
  letter-spacing: .08em;
  opacity: .74;
}

.camera-motion-chip strong {
  display: block;
  overflow: hidden;
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.camera-top-overlay .capture-quality {
  margin: 0;
  display: flex;
  justify-content: flex-end;
  gap: 6px;
}

.camera-top-overlay .quality-item {
  min-height: 0;
  width: auto;
  padding: 6px 7px;
  display: flex;
  gap: 5px;
  color: rgba(255,255,255,.82);
  background: rgba(2, 27, 17, .60);
  border: 1px solid rgba(255,255,255,.24);
  backdrop-filter: blur(4px);
}

.camera-top-overlay .quality-item i {
  width: 9px;
  height: 9px;
  flex: 0 0 9px;
  border: 1px solid rgba(255,255,255,.8);
}

.camera-top-overlay .quality-item span {
  font-size: 9px;
  line-height: 1;
  white-space: nowrap;
}

.camera-top-overlay .quality-item strong {
  display: none;
}

.camera-top-overlay .quality-item.is-pass {
  color: var(--white);
  background: rgba(31, 101, 67, .76);
  border-color: rgba(216,255,82,.8);
}

.camera-top-overlay .quality-item.is-fail {
  color: var(--white);
  background: rgba(112, 45, 28, .78);
  border-color: rgba(255,183,151,.76);
}

.camera-top-overlay .quality-item.is-unavailable {
  color: rgba(255,255,255,.68);
  background: rgba(44, 55, 49, .72);
}

.camera-status {
  min-height: 0;
  margin: 0 0 8px;
  color: rgba(255,255,255,.88);
  text-shadow: 0 1px 2px rgba(0,0,0,.6);
  font-size: 11px;
}

.camera-actions {
  pointer-events: auto;
}

.camera-button.record-control {
  min-width: 112px;
  min-height: 52px;
  padding: 7px 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  color: var(--white);
  background: rgba(2,27,17,.66);
  border-color: rgba(255,255,255,.88);
  box-shadow: none;
  backdrop-filter: blur(4px);
}

.record-control-dot {
  width: 25px;
  height: 25px;
  border-radius: 50%;
  background: #ff4e4e;
  box-shadow: 0 0 0 3px rgba(255,255,255,.9);
}

.record-control-stop {
  width: 23px;
  height: 23px;
  border-radius: 3px;
  background: #ff4e4e;
  box-shadow: 0 0 0 3px rgba(255,255,255,.9);
}

.record-control-label {
  font-size: 11px;
  font-weight: 900;
}

.camera-stage[data-mode="recording"] .camera-top-overlay .capture-quality,
.camera-stage[data-mode="review"] .camera-top-overlay,
.camera-stage[data-mode="review"] .recording-badge {
  display: none;
}

.camera-stage[data-mode="recording"] .camera-motion-chip {
  opacity: .72;
}

.camera-stage[data-mode="review"] .camera-bottom-overlay {
  padding-top: 68px;
}

.capture-quality-note {
  margin: 9px 0 0;
}

@media (max-width: 620px) {
  .camera-modal {
    padding: 0;
    overflow: hidden;
  }

  .camera-dialog {
    width: 100%;
    min-height: 100dvh;
    padding: 0;
    display: grid;
    place-items: center;
    background: #06140e;
    border: 0;
    box-shadow: none;
  }

  .camera-header {
    position: absolute;
    top: max(8px, env(safe-area-inset-top));
    right: max(8px, env(safe-area-inset-right));
    z-index: 12;
    pointer-events: none;
  }

  .camera-header > div {
    display: none;
  }

  .camera-header button {
    width: 36px;
    height: 36px;
    color: var(--white);
    background: rgba(2,27,17,.66);
    border: 1px solid rgba(255,255,255,.58);
    border-radius: 50%;
    pointer-events: auto;
  }

  .camera-stage {
    width: 100vw;
    height: 100dvh;
    aspect-ratio: auto;
    border: 0;
  }

  .camera-top-overlay {
    padding: max(10px, env(safe-area-inset-top)) max(52px, calc(env(safe-area-inset-right) + 44px)) 10px max(10px, env(safe-area-inset-left));
  }

  .camera-motion-chip {
    max-width: 36vw;
  }

  .camera-top-overlay .capture-quality {
    flex-wrap: wrap;
    max-width: 58vw;
  }

  .camera-bottom-overlay {
    padding: 62px max(12px, env(safe-area-inset-right)) max(14px, env(safe-area-inset-bottom)) max(12px, env(safe-area-inset-left));
  }

  .capture-quality-note {
    display: none;
  }

  .court-guide span,
  .pose-guide span {
    bottom: 16%;
    max-width: 78%;
    font-size: 10px;
  }

  .record-control-label {
    display: none;
  }

  .camera-button.record-control {
    min-width: 56px;
    min-height: 56px;
    width: 56px;
    height: 56px;
    padding: 0;
    border-radius: 50%;
  }

  .camera-button.ghost,
  .camera-button.primary:not(.record-control) {
    color: var(--white);
    background: rgba(2,27,17,.66);
    border-color: rgba(255,255,255,.8);
    box-shadow: none;
    backdrop-filter: blur(4px);
  }
}

@media (orientation: landscape) and (max-height: 620px) {
  .camera-modal {
    padding: 0;
    overflow: hidden;
  }

  .camera-dialog {
    width: 100vw;
    height: 100dvh;
    padding: 0;
    background: #06140e;
    border: 0;
    box-shadow: none;
  }

  .camera-header {
    position: absolute;
    top: max(8px, env(safe-area-inset-top));
    right: max(8px, env(safe-area-inset-right));
    z-index: 12;
    pointer-events: none;
  }

  .camera-header > div {
    display: none;
  }

  .camera-header button {
    width: 34px;
    height: 34px;
    color: var(--white);
    background: rgba(2,27,17,.66);
    border: 1px solid rgba(255,255,255,.58);
    border-radius: 50%;
    pointer-events: auto;
  }

  .camera-stage {
    width: 100vw;
    height: 100dvh;
    aspect-ratio: auto;
    border: 0;
  }

  .camera-top-overlay {
    padding: max(8px, env(safe-area-inset-top)) max(50px, calc(env(safe-area-inset-right) + 42px)) 8px max(10px, env(safe-area-inset-left));
  }

  .camera-motion-chip {
    max-width: 27vw;
  }

  .camera-top-overlay .capture-quality {
    flex-wrap: nowrap;
  }

  .camera-bottom-overlay {
    padding: 48px max(12px, env(safe-area-inset-right)) max(8px, env(safe-area-inset-bottom)) max(12px, env(safe-area-inset-left));
  }

  .capture-quality-note {
    display: none;
  }

  .court-guide span,
  .pose-guide span {
    bottom: 14%;
  }

  .record-control-label {
    display: none;
  }

  .camera-button.record-control {
    min-width: 54px;
    min-height: 54px;
    width: 54px;
    height: 54px;
    padding: 0;
    border-radius: 50%;
  }

  .recording-badge {
    top: auto;
    left: max(10px, env(safe-area-inset-left));
    bottom: max(10px, env(safe-area-inset-bottom));
  }
}

/* V1 state polish */
.camera-stage[data-mode="recording"] .camera-motion-chip {
  display: none;
}

.camera-stage[data-mode="recording"] .camera-top-overlay .capture-quality {
  display: flex;
  margin-left: auto;
}

.camera-stage[data-mode="review"] .camera-bottom-overlay {
  bottom: 38px;
}

@media (max-width: 620px), (orientation: landscape) and (max-height: 620px) {
  .camera-stage[data-mode="review"] .camera-bottom-overlay {
    bottom: 42px;
  }
}


/* Upload V2 Phase 4A.2 — truthful progress UX */
.analysis-progress {
  margin-top: 22px;
  display: grid;
  gap: 16px;
}

.progress-block {
  padding: 13px 14px;
  background: #e6f0eb;
  border: 2px solid #719381;
}

.progress-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}

.progress-meta span {
  color: #486256;
  font: 800 11px ui-monospace, monospace;
  letter-spacing: .06em;
}

.progress-meta strong {
  color: var(--court);
  font: 950 14px ui-monospace, monospace;
}

.progress-track {
  height: 13px;
  overflow: hidden;
  background: #c6d5cd;
  border: 2px solid var(--ink);
}

.progress-track i {
  display: block;
  width: 0;
  height: 100%;
  background: var(--lime);
  transition: width .28s ease;
}

.progress-detail {
  display: block;
  margin-top: 8px;
  color: #567063;
  font-size: 11px;
  line-height: 1.5;
}

@media (max-width: 740px) {
  .analysis-progress {
    gap: 12px;
  }

  .progress-block {
    padding: 11px 12px;
  }
}

/* MOBILE PREPROCESS V1 */
.video-preprocess-modal {
  position: fixed;
  inset: 0;
  z-index: 1200;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(4, 12, 8, 0.78);
  backdrop-filter: blur(10px);
}

.video-preprocess-modal[hidden] {
  display: none;
}

.video-preprocess-dialog {
  width: min(680px, 100%);
  max-height: 92vh;
  overflow: auto;
  border: 1px solid rgba(123, 255, 171, 0.28);
  border-radius: 22px;
  padding: 20px;
  background: #0d1712;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.48);
}

.video-preprocess-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.video-preprocess-head p {
  margin: 0 0 4px;
  opacity: 0.62;
  font-size: 12px;
  letter-spacing: 0.16em;
}

.video-preprocess-head h3 {
  margin: 0;
}

.video-preprocess-head button {
  width: 42px;
  height: 42px;
  border: 1px solid rgba(255,255,255,.16);
  border-radius: 12px;
  background: transparent;
  color: inherit;
  font-size: 26px;
}

.video-preprocess-copy {
  margin: 14px 0;
  opacity: 0.78;
}

.video-preprocess-video-wrap {
  position: relative;
  overflow: hidden;
  border-radius: 14px;
  background: #000;
}

.video-preprocess-dialog video {
  display: block;
  width: 100%;
  max-height: 46vh;
  background: #000;
}

.video-preprocess-processing {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 9px;
  padding: 24px;
  color: #fff;
  text-align: center;
  background: rgba(5, 15, 10, .82);
  backdrop-filter: blur(5px);
}

.video-preprocess-processing[hidden] {
  display: none;
}

.video-preprocess-processing strong {
  font-size: clamp(20px, 4vw, 28px);
  letter-spacing: .04em;
}

.video-preprocess-processing small {
  min-height: 1.4em;
  color: rgba(255, 255, 255, .82);
  font-size: 13px;
}

.video-preprocess-spinner {
  width: 38px;
  height: 38px;
  border: 4px solid rgba(255, 255, 255, .25);
  border-top-color: #7bffab;
  border-radius: 50%;
  animation: video-preprocess-spin .8s linear infinite;
}

.video-preprocess-processing-track {
  width: min(280px, 74vw);
  height: 7px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(255, 255, 255, .2);
}

.video-preprocess-processing-track > span {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: #7bffab;
  transition: width .12s linear;
}

@keyframes video-preprocess-spin {
  to { transform: rotate(360deg); }
}

.video-preprocess-meta,
.video-preprocess-status {
  margin-top: 12px;
  font-size: 14px;
  opacity: 0.82;
  white-space: pre-wrap;
}

.video-segment-picker {
  margin-top: 18px;
  padding: 14px;
  border: 1px solid rgba(255,255,255,.1);
  border-radius: 14px;
  background: rgba(255,255,255,.035);
}

.video-segment-labels,
.video-segment-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  font-size: 13px;
}

.video-segment-labels strong {
  color: #7bffab;
  font-size: 13px;
}

.video-segment-track {
  position: relative;
  height: 46px;
  margin: 8px 10px 4px;
}

.video-segment-track::before {
  content: "";
  position: absolute;
  top: 21px;
  left: 0;
  right: 0;
  height: 4px;
  border-radius: 999px;
  background: rgba(255,255,255,.14);
}

.video-segment-selection {
  position: absolute;
  top: 21px;
  height: 4px;
  border-radius: 999px;
  background: #7bffab;
  pointer-events: none;
}

.video-segment-range {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 46px;
  margin: 0;
  appearance: none;
  -webkit-appearance: none;
  background: transparent;
  pointer-events: none;
}

.video-segment-range::-webkit-slider-thumb {
  width: 26px;
  height: 26px;
  border: 3px solid #0d1712;
  border-radius: 50%;
  appearance: none;
  -webkit-appearance: none;
  background: #7bffab;
  box-shadow: 0 0 0 2px rgba(123,255,171,.35);
  pointer-events: auto;
  cursor: grab;
}

.video-segment-range::-moz-range-thumb {
  width: 22px;
  height: 22px;
  border: 3px solid #0d1712;
  border-radius: 50%;
  background: #7bffab;
  box-shadow: 0 0 0 2px rgba(123,255,171,.35);
  pointer-events: auto;
  cursor: grab;
}

.video-segment-range-start {
  z-index: 3;
}

.video-segment-range-end {
  z-index: 4;
}

.video-segment-summary {
  margin-top: 4px;
}

.video-segment-summary span[data-valid="true"] {
  color: #7bffab;
}

.video-segment-summary span[data-valid="false"] {
  color: #ffb4a8;
}

.video-segment-preview-button {
  width: 100%;
  min-height: 44px;
  margin: 0;
}

.video-preprocess-range {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) minmax(84px, .72fr);
  gap: 12px;
  margin-top: 16px;
}

.video-preprocess-range label,
.video-preprocess-preview-control {
  display: grid;
  gap: 7px;
}

.video-preprocess-range span,
.video-preprocess-preview-control > span {
  font-size: 13px;
  opacity: 0.72;
}

.video-preprocess-range input {
  width: 100%;
  min-height: 44px;
  padding: 10px 12px;
  border: 1px solid rgba(255,255,255,.16);
  border-radius: 12px;
  background: rgba(255,255,255,.05);
  color: inherit;
  font: inherit;
}

.video-preprocess-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-top: 18px;
}

.video-preprocess-actions button {
  min-height: 46px;
}

@media (max-width: 560px) {
  .video-preprocess-dialog {
    padding: 16px;
    border-radius: 18px;
  }

  .video-preprocess-actions {
    grid-template-columns: 1fr;
  }

  .video-preprocess-range {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) minmax(76px, .72fr);
    gap: 8px;
  }

  .video-preprocess-range input,
  .video-segment-preview-button {
    padding-inline: 8px;
  }
}
