/* Shot Tracer — 디자인: Codex 시안("절제된 골프 중계 콘솔" → 3단계 단순화) + Claude 구현 */
:root {
  color-scheme: dark;
  --bg: #0B1210;
  --surface: #121D19;
  --surface-raised: #1A2923;
  --surface-hover: #22372D;
  --video-bg: #050807;

  --border: #30463B;
  --border-control: #617A6D;
  --text: #F2F5F1;
  --text-secondary: #B6C4BA;
  --text-muted: #95AA9C;

  --fairway: #155B3B;
  --accent: #75D6A1;
  --accent-hover: #93E5B7;
  --accent-pressed: #57BD83;
  --on-accent: #0B2115;
  --focus: #B3ECD0;

  --success: #75D6A1;
  --warning: #F2C66D;
  --danger: #FF9790;

  --tracer: #FF501E;
  --brand: #FF501E;               /* 로고는 꼬리색과 별개로 고정 */

  --font-ui: "Noto Sans KR", system-ui, -apple-system, sans-serif;
  --font-display: "Barlow Condensed", "Noto Sans KR", sans-serif;

  --text-xs: 0.75rem;
  --text-sm: 0.875rem;
  --text-base: 1rem;
  --text-lg: 1.25rem;
  --text-title: 1.75rem;
  --text-metric: 2.5rem;

  --space-1: 4px; --space-2: 8px; --space-3: 12px; --space-4: 16px; --space-5: 20px;
  --space-6: 24px; --space-8: 32px; --space-10: 40px; --space-12: 48px;

  --page-max: 1200px;
  --page-padding: 32px;
  --layout-gap: 32px;
  --panel-width: 360px;
  --header-height: 64px;
  --player-max-width: 432px;

  --radius-sm: 4px;
  --radius-control: 10px;
  --radius-panel: 16px;
  --control-height: 48px;
  --touch-target: 44px;
  --swatch-size: 28px;
  --reticle-size: 32px;
  --progress-height: 4px;

  --motion-fast: 120ms;
  --motion-base: 200ms;
  --motion-slow: 320ms;
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; min-height: 100svh;
  background: var(--bg); color: var(--text);
  font: 400 var(--text-base)/1.6 var(--font-ui);
  -webkit-font-smoothing: antialiased;
}
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.num { font-family: var(--font-display); font-variant-numeric: tabular-nums; letter-spacing: 0.01em; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 3px; }
h2[tabindex="-1"]:focus { outline: none; }
h1, h2, p { margin: 0; }
b { font-weight: 600; color: var(--text); }
h1, h2, .lede, .tips, .hint, .help, .sb-note, .dz-sub { word-break: keep-all; overflow-wrap: break-word; }

/* ── 헤더 ─────────────────────────────────────────── */
.topbar {
  position: sticky; top: 0; z-index: 20;
  height: var(--header-height);
  display: flex; align-items: center; gap: var(--space-6);
  padding-inline: max(var(--page-padding), calc((100vw - var(--page-max)) / 2 + var(--page-padding)));
  background: color-mix(in srgb, var(--bg) 92%, transparent);
  border-bottom: 1px solid var(--border);
  backdrop-filter: saturate(1.2) blur(6px);
}
.brand { display: flex; align-items: center; gap: var(--space-2); color: var(--text); text-decoration: none;
  font: 600 1.25rem/1 var(--font-display); letter-spacing: 0.06em; }
.brand b { font-weight: 700; color: var(--brand); margin-left: 2px; }
.brand svg { width: 28px; height: 28px; }
.brand-arc { fill: none; stroke: var(--brand); stroke-width: 3; stroke-linecap: round; }
.brand-ball { fill: #fff; }
.steps { display: flex; gap: var(--space-1); list-style: none; margin: 0 0 0 auto; padding: 0; }
.steps li {
  display: flex; align-items: center; gap: 6px;
  padding: 6px 10px; border-radius: var(--radius-sm);
  color: var(--text-muted); font-size: var(--text-sm);
}
.steps li span { font: 600 var(--text-sm)/1 var(--font-display); letter-spacing: 0.04em; }
.steps li.on { color: var(--text); background: var(--surface-raised); }
.steps li.on span { color: var(--accent); }
.steps li.done { color: var(--text-secondary); }
.steps li.done span { color: var(--accent-pressed); }
.step-mobile { display: none; }

/* ── 버튼 ─────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--space-2);
  min-height: var(--control-height); padding: 0 var(--space-5);
  border-radius: var(--radius-control); border: 1px solid transparent;
  font: 600 var(--text-sm)/1 var(--font-ui); cursor: pointer;
  transition: background var(--motion-fast), border-color var(--motion-fast), color var(--motion-fast);
}
.btn.primary { background: var(--accent); color: var(--on-accent); }
.btn.primary:hover { background: var(--accent-hover); }
.btn.primary:active { background: var(--accent-pressed); }
.btn.ghost { background: transparent; color: var(--text); border-color: var(--border-control); }
.btn.ghost:hover { background: var(--surface-hover); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn.wide { width: 100%; }
.topbar .btn { min-height: 36px; padding: 0 var(--space-4); }

/* ── 업로드 ───────────────────────────────────────── */
main { max-width: var(--page-max); margin: 0 auto; padding: var(--space-10) var(--page-padding) var(--space-12); }
#viewUpload { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr); gap: var(--space-10) var(--layout-gap); align-items: start; }
.hero { padding-top: var(--space-8); }
.eyebrow { font: 600 var(--text-xs)/1 var(--font-display); letter-spacing: 0.16em; color: var(--accent); margin-bottom: var(--space-4); }
.hero h1 { font-size: clamp(1.75rem, 3.2vw, 2.5rem); font-weight: 700; line-height: 1.25; letter-spacing: -0.02em; }
.lede { margin-top: var(--space-4); color: var(--text-secondary); max-width: 32em; font-size: 15px; line-height: 1.75; }
.dropzone {
  grid-row: span 2;
  display: flex; flex-direction: column; align-items: flex-start; justify-content: flex-end; gap: var(--space-2);
  min-height: 360px; padding: var(--space-8);
  background:
    radial-gradient(120% 90% at 85% 0%, rgba(21, 91, 59, 0.55), transparent 60%),
    var(--surface);
  border: 1px dashed var(--border-control); border-radius: var(--radius-panel);
  cursor: pointer; position: relative; overflow: hidden;
  transition: border-color var(--motion-fast), background-color var(--motion-fast);
}
.dropzone::before {           /* 시그니처: 공을 따라 뻗는 한 줄의 빛 */
  content: ""; position: absolute; right: 12%; top: 14%; width: 46%; height: 62%;
  border-top: 3px solid var(--tracer); border-right: 3px solid transparent;
  border-radius: 100% 0 0 0; transform: rotate(8deg);
  filter: drop-shadow(0 0 6px color-mix(in srgb, var(--tracer) 60%, transparent));
  opacity: 0.9;
}
.dropzone:hover, .dropzone.drag { border-style: solid; border-color: var(--accent); background-color: var(--surface-hover); }
.dz-icon svg { width: 40px; height: 40px; fill: none; stroke: var(--accent); stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
.dz-title { font-size: var(--text-lg); font-weight: 600; }
.dz-sub { color: var(--text-secondary); font-size: var(--text-sm); }
.dz-btn { margin-top: var(--space-4); }
.tips { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--space-3); color: var(--text-secondary); font-size: var(--text-sm); }
.tips li { padding-left: var(--space-5); position: relative; }
.tips li::before { content: ""; position: absolute; left: 0; top: 0.7em; width: 8px; height: 2px; background: var(--accent); }
.upload-progress { grid-column: 1 / -1; }
.upload-progress p { display: flex; justify-content: space-between; margin-top: var(--space-2); color: var(--text-secondary); font-size: var(--text-sm); }
.bar { height: var(--progress-height); background: var(--surface-raised); border-radius: 2px; overflow: hidden; }
.bar i { display: block; height: 100%; width: 0; background: var(--accent); transition: width var(--motion-base) linear; }

/* ── 작업 화면 ───────────────────────────────────── */
.work { display: grid; grid-template-columns: minmax(0, var(--player-max-width)) minmax(0, var(--panel-width)); justify-content: center; gap: var(--space-10); align-items: start; }
.stage-col { display: flex; flex-direction: column; align-items: center; gap: var(--space-3); min-width: 0; }
.player {
  position: relative; width: 100%; max-width: var(--player-max-width);
  background: var(--video-bg); border-radius: var(--radius-panel); overflow: hidden;
  border: 1px solid var(--border);
  aspect-ratio: var(--ar, 9 / 16); max-height: calc(100svh - var(--header-height) - 140px);
  max-width: min(var(--player-max-width), calc((100svh - var(--header-height) - 140px) * var(--arn, 0.5625)));
}
.player video, .player > canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.player video { object-fit: contain; }
.player.aiming { cursor: crosshair; touch-action: none; user-select: none; -webkit-user-select: none; }
.player:focus-visible { outline: 2px solid var(--focus); outline-offset: 3px; }
.aim-hint {
  position: absolute; left: 50%; top: var(--space-4); transform: translateX(-50%);
  padding: 6px 12px; border-radius: var(--radius-sm);
  background: rgba(5, 8, 7, 0.78); color: var(--text); font-size: var(--text-sm); font-weight: 500; white-space: nowrap;
  pointer-events: none;
}
.reticle {
  position: absolute; width: var(--reticle-size); height: var(--reticle-size);
  margin: calc(var(--reticle-size) / -2) 0 0 calc(var(--reticle-size) / -2);
  border-radius: 50%; pointer-events: none;
  border: 2px solid #fff; box-shadow: 0 0 0 1.5px rgba(0, 0, 0, 0.75), inset 0 0 0 1.5px rgba(0, 0, 0, 0.75);
  animation: settle var(--motion-base) var(--ease-out);
}
.reticle::before, .reticle::after, .reticle i::before, .reticle i::after {
  content: ""; position: absolute; background: #fff; box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.7);
}
.reticle::before { left: 50%; top: -9px; width: 2px; height: 7px; margin-left: -1px; }
.reticle::after { left: 50%; bottom: -9px; width: 2px; height: 7px; margin-left: -1px; }
.reticle i::before { top: 50%; left: -9px; height: 2px; width: 7px; margin-top: -1px; }
.reticle i::after { top: 50%; right: -9px; height: 2px; width: 7px; margin-top: -1px; }
.reticle.ok { border-color: var(--accent); }
@keyframes settle { from { transform: scale(1.15); opacity: 0.6; } to { transform: scale(1); opacity: 1; } }
.loupe {
  position: absolute; width: 132px; height: 132px; border-radius: 50%; overflow: hidden; pointer-events: none;
  border: 2px solid #fff; box-shadow: 0 0 0 1.5px rgba(0,0,0,.7), 0 8px 24px rgba(0,0,0,.5);
}
.loupe canvas { width: 100%; height: 100%; display: block; }
.loupe i { position: absolute; left: 50%; top: 50%; width: 18px; height: 18px; margin: -9px; border: 1.5px solid #fff; border-radius: 50%; box-shadow: 0 0 0 1px rgba(0,0,0,.7); }
.busy {
  position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: var(--space-3);
  background: rgba(5, 8, 7, 0.72); color: var(--text-secondary); font-size: var(--text-sm);
}
.spinner { width: 28px; height: 28px; border-radius: 50%; border: 3px solid var(--surface-hover); border-top-color: var(--accent); animation: spin 0.9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.transport { display: flex; align-items: center; gap: var(--space-2); width: 100%; max-width: min(var(--player-max-width), calc((100svh - var(--header-height) - 140px) * var(--arn, 0.5625))); }
.icon-btn {
  width: var(--touch-target); height: var(--touch-target); flex: none;
  display: grid; place-items: center; border-radius: var(--radius-control);
  background: var(--surface); border: 1px solid var(--border); color: var(--text); cursor: pointer;
}
.icon-btn:hover { background: var(--surface-hover); }
.icon-btn svg { width: 20px; height: 20px; fill: currentColor; stroke: currentColor; stroke-width: 0; }
#btnPrev svg, #btnNext svg { fill: none; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
.icon-btn .i-pause { display: none; }
.icon-btn.playing .i-pause { display: block; }
.icon-btn.playing .i-play { display: none; }
.time { min-width: 64px; text-align: right; color: var(--text-secondary); font-size: var(--text-base); }

/* 슬라이더 공통 */
input[type="range"] {
  -webkit-appearance: none; appearance: none; flex: 1; min-width: 0; height: var(--touch-target); background: transparent; cursor: pointer;
  --fill: 0%;
}
input[type="range"]::-webkit-slider-runnable-track {
  height: 4px; border-radius: 2px;
  background: linear-gradient(to right, var(--accent) var(--fill), var(--surface-hover) var(--fill));
}
input[type="range"]::-moz-range-track { height: 4px; border-radius: 2px; background: var(--surface-hover); }
input[type="range"]::-moz-range-progress { height: 4px; border-radius: 2px; background: var(--accent); }
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none; width: 16px; height: 16px; margin-top: -6px; border-radius: 50%;
  background: var(--text); border: 0; box-shadow: 0 0 0 3px var(--bg);
}
input[type="range"]::-moz-range-thumb { width: 16px; height: 16px; border-radius: 50%; background: var(--text); border: 0; }

/* ── 패널 ─────────────────────────────────────────── */
.panel {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-panel);
  padding: var(--space-6); position: sticky; top: calc(var(--header-height) + var(--space-6));
}
.pane.result { gap: 0; }
@media (min-width: 960px) {
  .panel:has(#paneResult:not([hidden])) {
    padding: 0; display: grid; max-height: calc(100dvh - var(--header-height) - 48px); overflow: hidden;
  }
  #paneResult:not([hidden]) { display: grid; grid-template-rows: minmax(0, 1fr) auto; min-height: 0; }
  .result-body { overflow-y: auto; padding: var(--space-6); display: grid; grid-auto-rows: max-content; gap: var(--space-6); min-height: 0; scrollbar-width: thin; scrollbar-color: var(--border) transparent; }
  .result .dl-block { padding: var(--space-4) var(--space-5) var(--space-5); border-top: 1px solid var(--border); background: var(--surface); }
}
.pane { display: grid; gap: var(--space-5); animation: fade var(--motion-base) var(--ease-out); }
@keyframes fade { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
.pane h2 { font-size: var(--text-lg); font-weight: 600; }
.hint, .help { color: var(--text-secondary); font-size: var(--text-sm); }
.help { color: var(--text-muted); font-size: var(--text-xs); line-height: 1.55; }
.row { display: flex; gap: var(--space-3); }
.row .btn { flex: 1; padding: 0 var(--space-3); }
.kv { margin: 0; padding: var(--space-3) var(--space-4); background: var(--surface-raised); border-radius: var(--radius-control); }
.kv div { display: flex; justify-content: space-between; align-items: baseline; }
.kv dt { color: var(--text-secondary); font-size: var(--text-sm); }
.kv dd { margin: 0; font-size: var(--text-lg); }

.field { display: grid; gap: var(--space-2); border: 0; margin: 0; padding: 0; min-width: 0; }
.field > label, .field legend { font-size: var(--text-sm); font-weight: 600; padding: 0; margin-bottom: var(--space-2); }
.input-unit {
  display: flex; align-items: center; height: var(--control-height);
  background: var(--surface-raised); border: 1px solid var(--border-control); border-radius: var(--radius-control);
  padding: 0 var(--space-4);
}
.input-unit:focus-within { border-color: var(--accent); }
.input-unit input { flex: 1; min-width: 0; background: none; border: 0; color: var(--text); font: 600 1.375rem/1 var(--font-display); outline: none; }
.input-unit span { color: var(--text-muted); font-size: var(--text-sm); }
.segmented { display: grid; grid-template-columns: repeat(3, 1fr); background: var(--surface-raised); border-radius: var(--radius-control); padding: 3px; gap: 3px; }
.segmented label { position: relative; }
.segmented input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.segmented span {
  display: grid; place-items: center; text-align: center; min-height: 40px; padding: 4px 6px;
  border-radius: 4px; font-size: var(--text-xs); font-weight: 500; color: var(--text-secondary);
  transition: background var(--motion-fast), color var(--motion-fast);
}
.segmented input:checked + span { background: var(--fairway); color: var(--text); font-weight: 600; }
.segmented input:focus-visible + span { outline: 2px solid var(--focus); outline-offset: 1px; }

/* 진행 */
.progress { height: var(--progress-height); background: var(--surface-raised); border-radius: 2px; overflow: hidden; position: relative; }
.progress i { position: absolute; left: 0; top: 0; bottom: 0; width: 0; background: var(--accent); transition: width var(--motion-base) linear; }
.progress.indeterminate i { width: 32%; animation: slide 1.4s var(--ease-out) infinite; }
@keyframes slide { from { left: -32%; } to { left: 100%; } }
.stage-list { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--space-3); font-size: var(--text-sm); }
.stage-list li { display: flex; align-items: center; gap: var(--space-3); color: var(--text-muted); transition: color var(--motion-fast); }
.stage-list li::before {
  content: ""; width: 16px; height: 16px; flex: none; border-radius: 50%; border: 1.5px solid var(--border-control);
}
.stage-list li.on { color: var(--text); }
.stage-list li.on::before { border-color: var(--accent); border-top-color: transparent; animation: spin 0.9s linear infinite; }
.stage-list li.done { color: var(--text-secondary); }
.stage-list li.done::before {
  border-color: var(--accent); background: var(--accent)
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M4 8.2l2.6 2.6L12 5.4' fill='none' stroke='%230B2115' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center/100%;
}

/* 결과: 스타일 */
.block { display: grid; gap: var(--space-4); }
.block + .block { padding-top: var(--space-6); border-top: 1px solid var(--border); }
#paneResult .result-body { display: grid; gap: var(--space-6); }
.result-body > .block + .block { padding-top: var(--space-6); border-top: 1px solid var(--border); }
.swatches { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); justify-items: center; }
.swatch {
  width: 100%; max-width: var(--touch-target); aspect-ratio: 1; min-height: 40px; display: grid; place-items: center;
  border: 0; background: none; padding: 0; cursor: pointer; border-radius: 50%; position: relative;
}
.swatch i {
  width: var(--swatch-size); height: var(--swatch-size); border-radius: 50%; background: var(--c);
  box-shadow: 0 0 0 1px rgba(255,255,255,0.18) inset;
  transition: box-shadow var(--motion-fast);
}
.swatch[aria-checked="true"] i { box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px var(--text); }
.swatch[aria-checked="true"]::after {
  content: ""; position: absolute; width: 10px; height: 6px; border: 2px solid var(--on-dark, #0B1210);
  border-top: 0; border-right: 0; transform: translateY(-1px) rotate(-45deg);
}
.swatch.light[aria-checked="true"]::after { --on-dark: #0B1210; }
.swatch.dark[aria-checked="true"]::after { --on-dark: #fff; }
.swatch-name { font-size: var(--text-xs); color: var(--text-muted); margin-top: calc(var(--space-2) * -1); }
.custom-color { display: flex; gap: var(--space-2); }
.color-btn {
  display: inline-flex; align-items: center; gap: var(--space-2); height: 40px; padding: 0 var(--space-3);
  border: 1px solid var(--border-control); border-radius: var(--radius-control); cursor: pointer; font-size: var(--text-sm); font-weight: 500;
}
.color-btn:hover { background: var(--surface-hover); }
.color-btn input { width: 22px; height: 22px; padding: 0; border: 0; background: none; cursor: pointer; }
.color-btn input::-webkit-color-swatch-wrapper { padding: 0; }
.color-btn input::-webkit-color-swatch { border: 1px solid rgba(255,255,255,.25); border-radius: 50%; }
.hex {
  flex: 1; min-width: 0; height: 40px; padding: 0 var(--space-3);
  background: var(--surface-raised); border: 1px solid var(--border-control); border-radius: var(--radius-control);
  color: var(--text); font-size: var(--text-lg); text-transform: uppercase;
}
.hex:focus { outline: none; border-color: var(--accent); }
.hex.bad { border-color: var(--danger); }
.slider { display: grid; }
.slider-head { display: flex; justify-content: space-between; align-items: baseline; font-size: var(--text-sm); font-weight: 600; }
.slider-head output { color: var(--text-secondary); font-size: var(--text-base); font-weight: 600; }
.switch { display: flex; align-items: center; gap: var(--space-3); font-size: var(--text-sm); cursor: pointer; min-height: var(--touch-target); }
.switch input { position: absolute; opacity: 0; }
.switch .track { width: 40px; height: 24px; border-radius: 12px; background: var(--surface-hover); position: relative; transition: background var(--motion-fast); flex: none; }
.switch .track i { position: absolute; left: 3px; top: 3px; width: 18px; height: 18px; border-radius: 50%; background: var(--text-secondary); transition: transform var(--motion-fast) var(--ease-out), background var(--motion-fast); }
.switch input:checked + .track { background: var(--fairway); }
.switch input:checked + .track i { transform: translateX(16px); background: var(--accent); }
.switch input:focus-visible + .track { outline: 2px solid var(--focus); outline-offset: 2px; }

/* 결과: 스코어보드 */
.scoreboard { gap: 0; background: var(--video-bg); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 0 !important; overflow: hidden; }
.block.scoreboard + .block, .block + .block.scoreboard { border-top: 1px solid var(--border); }
.scoreboard > div { padding: var(--space-4) var(--space-5); }
.scoreboard > div + div { border-top: 1px solid var(--border); }
.sb-main { position: relative; }
.sb-main::before { content: ""; position: absolute; left: 0; top: var(--space-4); bottom: var(--space-4); width: 3px; background: var(--tracer); }
.sb-label { font: 600 var(--text-xs)/1.2 var(--font-display); letter-spacing: 0.10em; color: var(--text-secondary); }
.sb-label em { font-style: normal; color: var(--text-muted); margin-left: 4px; }
.sb-value { display: flex; align-items: baseline; gap: 6px; margin-top: 2px; }
.sb-value .num { font-size: var(--text-metric); font-weight: 600; line-height: 1.1; }
.sb-value.sm .num { font-size: 2rem; }
.sb-value small { font-size: var(--text-sm); color: var(--text-secondary); }
.sb-note { font-size: 13px; line-height: 1.6; color: #A8B9AD; margin-top: 2px; }
.sb-row { display: grid; grid-template-columns: 1fr 1fr; padding: 0 !important; }
.sb-row > div { padding: var(--space-4) var(--space-5); }
.sb-row > div + div { border-left: 1px solid var(--border); }
.sb-total { display: grid; gap: 2px; }
.conf { font-weight: 600; margin-top: 2px; display: flex; align-items: center; gap: var(--space-2); }
.conf::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--c, var(--text-muted)); }
.conf.high { --c: var(--success); }
.conf.mid { --c: var(--warning); }
.conf.low { --c: var(--danger); }

.dl-block { gap: var(--space-3); }
.dl-link {
  display: flex; align-items: center; justify-content: center; min-height: var(--control-height);
  border-radius: var(--radius-control); border: 1px solid var(--accent); color: var(--accent);
  font-size: var(--text-sm); font-weight: 600; text-decoration: none;
}
.dl-link:hover { background: color-mix(in srgb, var(--accent) 12%, transparent); }
.error h2 { color: var(--danger); }
.error p { color: var(--text-secondary); font-size: var(--text-sm); }
.mobile-dl { display: none; }

/* 플레이어 위 데이터 박스 (렌더 결과와 같은 위치·모양) */
.stats-box { position: absolute; pointer-events: none; }

/* ── 모바일 ───────────────────────────────────────── */
@media (max-width: 959px) {
  :root { --page-padding: 16px; --header-height: 56px; }
  .topbar { gap: var(--space-3); }
  .steps { display: none; }
  .step-mobile { display: block; margin-left: auto; font: 600 var(--text-sm)/1 var(--font-display); letter-spacing: 0.06em; color: var(--text-secondary); }
  .step-mobile b { color: var(--accent); }
  main { padding-top: var(--space-6); }
  #viewUpload { grid-template-columns: minmax(0, 1fr); gap: var(--space-6); }
  .hero { padding-top: 0; }
  .hero h1 { font-size: 1.5rem; }
  .dropzone { min-height: 240px; padding: var(--space-6); grid-row: auto; }
  .dropzone::before { top: 20px; right: 20px; width: 132px; height: 44px; opacity: 0.65; filter: none; pointer-events: none; transform: none; }
  .work { grid-template-columns: minmax(0, 1fr); gap: var(--space-4); }
  .stage-col { gap: var(--space-2); }
  .panel, .stage-col { min-width: 0; }
  .player { height: 52svh; max-height: 480px; width: auto; max-width: 100%; }
  .transport { max-width: 100%; }
  .panel { position: static; padding: var(--space-5); }
  body.has-mobile-dl main { padding-bottom: calc(96px + env(safe-area-inset-bottom)); }
  .mobile-dl {
    display: block; position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
    padding: var(--space-3) var(--space-4) calc(var(--space-3) + env(safe-area-inset-bottom));
    background: color-mix(in srgb, var(--bg) 94%, transparent); border-top: 1px solid var(--border);
  }
  .dl-block #btnRender { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.001ms !important; animation-iteration-count: 1 !important; transition-duration: 0.001ms !important; }
}


/* ═════════ 3단계 단순화 (Codex 시안) ═════════ */
.steps li span { width: 20px; height: 20px; display: inline-grid; place-items: center; border-radius: 50%; background: var(--surface-raised); font-size: 12px; }
.steps li.on span { background: var(--accent); color: var(--on-accent); }
.steps li.done span { background: var(--fairway); color: var(--text); }
.btn.text { background: none; border: 0; color: var(--text-secondary); min-height: var(--touch-target); padding: 0 var(--space-3); }
.btn.text:hover { color: var(--text); background: var(--surface-hover); }
.btn.text:disabled { opacity: 0.4; }

/* 1 영상 선택: 가운데 한 덩어리 */
#viewUpload { display: flex !important; flex-direction: column; align-items: center; text-align: center; max-width: 560px; margin: 0 auto; gap: var(--space-4); padding-top: var(--space-8); }
#viewUpload[hidden] { display: none !important; }
#viewUpload h1 { font-size: clamp(1.75rem, 4vw, 2.5rem); font-weight: 700; letter-spacing: -0.02em; line-height: 1.2; }
#viewUpload .lede { margin: 0; color: var(--text-secondary); font-size: var(--text-base); }
.dropzone {
  width: 100%; min-height: 300px; align-items: center; justify-content: center; gap: var(--space-4); margin-top: var(--space-4);
  border-radius: var(--radius-panel); background: radial-gradient(90% 80% at 50% 0%, rgba(21, 91, 59, 0.5), transparent 70%), var(--surface);
}
.dropzone::before { display: none; }
.dz-art svg { width: 132px; height: 88px; fill: none; }
.dz-art path { stroke: var(--brand); stroke-width: 4; stroke-linecap: round; filter: drop-shadow(0 0 6px rgba(255, 80, 30, 0.55)); }
.dz-art circle { fill: #fff; }
.dz-btn { min-width: 180px; font-size: var(--text-base); }
.dz-sub { color: var(--text-muted); font-size: var(--text-sm); }
.upload-progress { width: 100%; text-align: left; }
.tips { width: 100%; text-align: left; color: var(--text-secondary); font-size: var(--text-sm); }
.tips summary { cursor: pointer; color: var(--text-muted); list-style: none; text-align: center; min-height: var(--touch-target); display: grid; place-items: center; }
.tips summary::-webkit-details-marker { display: none; }
.tips ul { margin: var(--space-2) 0 0; padding: var(--space-4) var(--space-5); list-style: none; display: grid; gap: var(--space-2); background: var(--surface); border-radius: var(--radius-control); }

/* 패널: 테두리 줄이고 둥글게 */
.panel { border-color: transparent; }
.player { border: 0; box-shadow: 0 12px 40px rgba(0, 0, 0, 0.45); }
.pane { gap: var(--space-5); }
.pane h2 { font-size: 1.375rem; font-weight: 700; letter-spacing: -0.01em; }
.hint { margin-top: var(--space-1); font-size: 14px; }

/* 접기 행 */
.fold { border-top: 1px solid var(--border); }
.fold summary {
  display: flex; align-items: center; justify-content: space-between; gap: var(--space-3);
  min-height: 48px; cursor: pointer; list-style: none; font-size: 15px; font-weight: 600;
}
.fold summary::-webkit-details-marker { display: none; }
.fold summary::after { content: ""; width: 8px; height: 8px; border-right: 2px solid var(--text-muted); border-bottom: 2px solid var(--text-muted); transform: rotate(45deg) translateY(-2px); transition: transform 180ms var(--ease-out); flex: none; }
.fold[open] summary::after { transform: rotate(-135deg) translateY(-2px); }
.fold summary em { font-style: normal; font-weight: 500; font-size: 13px; color: var(--text-muted); margin-left: auto; }
.fold-body { display: grid; gap: var(--space-4); padding-bottom: var(--space-4); }
.fold.quiet { border-top: 0; }
.fold.quiet summary { min-height: 40px; font-size: 13px; font-weight: 500; color: var(--text-muted); justify-content: center; gap: var(--space-2); }
.fold.quiet summary::after { width: 6px; height: 6px; }

/* 분석 진행 (공 지정 화면 안) */
.analyzing { display: grid; gap: var(--space-2); }
.analyzing p { font-size: 14px; color: var(--text-secondary); }

/* 결과 */
.row-head { display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); }
.chip { font-size: 12px; font-weight: 600; padding: 4px 10px; border-radius: 999px; background: var(--surface-raised); color: var(--text-secondary); display: inline-flex; align-items: center; gap: 6px; }
.chip::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--c, var(--text-muted)); }
.chip.high { --c: var(--success); } .chip.mid { --c: var(--warning); } .chip.low { --c: var(--danger); }
#swatches { grid-template-columns: repeat(3, 56px); justify-content: start; gap: var(--space-2); }
#swatches .swatch { width: 56px; height: 56px; max-width: none; }
#swatches .swatch i { width: 40px; height: 40px; }
#swatchesMore { grid-template-columns: repeat(4, 48px); justify-content: start; gap: var(--space-2); }
#swatchesMore .swatch { width: 48px; height: 48px; max-width: none; }
.swatch[aria-checked="true"] i { box-shadow: 0 0 0 3px var(--surface), 0 0 0 5px #fff; }
.warn { display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); padding: var(--space-3) var(--space-4); border-radius: var(--radius-control); background: rgba(255, 151, 144, 0.1); color: var(--danger); font-size: 14px; }
.stats { margin: 0; display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-3); }
.stats > div { background: var(--surface-raised); border-radius: var(--radius-control); padding: var(--space-3) var(--space-4); }
.stats dt { font-size: 12px; color: var(--text-secondary); }
.stats dt small { color: var(--text-muted); font-size: 11px; }
.stats dd { margin: 2px 0 0; font-size: 14px; color: var(--text-secondary); }
.stats dd .num { font-size: 1.75rem; font-weight: 600; color: var(--text); margin-right: 2px; }
.stats .big { grid-column: 1 / -1; display: flex; align-items: baseline; justify-content: space-between; border-left: 3px solid var(--tracer); }
.stats .big dd .num { font-size: 2.25rem; }
.actions { display: grid; gap: var(--space-2); padding-top: var(--space-2); }
.help.center { text-align: center; }
.help a { color: var(--accent); }
.result .block { gap: var(--space-4); }
.result .block + .block { border-top: 0; padding-top: 0; }

/* 데스크톱 결과 패널: 내부 스크롤 대신 짧게 (접기로 높이 해결) */
@media (min-width: 960px) {
  .panel:has(#paneResult:not([hidden])) { padding: var(--space-6); display: block; max-height: none; overflow: visible; }
  #paneResult:not([hidden]) { display: grid; grid-template-rows: none; }
  .mobile-bar { display: none !important; }
}

/* 모바일: 한 손 — 다음 행동 하나를 하단 고정 */
.mobile-bar { display: none; }
@media (max-width: 959px) {
  .mobile-bar:not([hidden]) {
    display: block; position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
    padding: var(--space-3) var(--space-4) calc(var(--space-3) + env(safe-area-inset-bottom));
    background: color-mix(in srgb, var(--bg) 94%, transparent); border-top: 1px solid var(--border);
  }
  .mobile-bar .btn { min-height: 52px; font-size: var(--text-base); }
  body.has-bar main { padding-bottom: calc(96px + env(safe-area-inset-bottom)); }
  #btnAnalyze, #btnRender { display: none; }
  .steps { display: flex; margin-left: auto; }
  .steps li { padding: 4px 6px; font-size: 12px; }
  .steps li:not(.on) { font-size: 0; gap: 0; }
  .steps li:not(.on) span { font-size: 12px; }
  .player { height: 52svh; max-height: 480px; }
  .panel { padding: var(--space-4) 0; background: none; }
  #viewUpload { padding-top: var(--space-4); }
  .dropzone { min-height: 240px; }
}
@media (max-width: 959px) and (max-height: 700px) { .player { height: 44svh; } }
.steps li, .btn.text, .brand { white-space: nowrap; }
@media (max-width: 959px) { .topbar { gap: var(--space-2); } .topbar .btn.text { padding: 0 var(--space-2); font-size: 13px; } .brand { font-size: 1.1rem; } }

/* ═════════ 랜딩: SHOT TRACER 브랜드 화면 ═════════ */
#viewUpload.landing {
  display: grid !important; grid-template-columns: minmax(0, 1.05fr) minmax(0, 0.95fr); gap: var(--space-8) var(--space-12);
  max-width: var(--page-max); text-align: left; align-items: center; padding-top: var(--space-4); margin: 0 auto;
}
#viewUpload.landing[hidden] { display: none !important; }
body:has(#viewUpload:not([hidden])) {
  background:
    radial-gradient(60% 50% at 78% 18%, rgba(255, 80, 30, 0.10), transparent 70%),
    radial-gradient(70% 60% at 10% 100%, rgba(21, 91, 59, 0.45), transparent 70%),
    var(--bg);
}
.hero-copy { display: grid; gap: var(--space-5); align-content: center; }
.landing .eyebrow { display: inline-flex; align-items: center; gap: 10px; margin: 0; font: 600 13px/1 var(--font-display); letter-spacing: 0.22em; color: var(--accent); }
.landing .eyebrow i { width: 28px; height: 2px; background: var(--brand); box-shadow: 0 0 10px var(--brand); }
.wordmark {
  margin: 0; font: italic 700 clamp(4rem, 9vw, 7.5rem)/0.86 var(--font-display); letter-spacing: -0.01em; text-transform: uppercase;
  color: var(--text);
}
.wordmark span {
  background: linear-gradient(92deg, #FF7A45 0%, var(--brand) 45%, #FF2E4D 100%); -webkit-background-clip: text; background-clip: text; color: transparent;
  filter: drop-shadow(0 0 22px rgba(255, 80, 30, 0.35));
}
.landing .lede { font-size: 17px; line-height: 1.7; color: var(--text-secondary); max-width: 26em; margin: 0; }
.cta { display: flex; align-items: center; gap: var(--space-4); flex-wrap: wrap; cursor: pointer; margin-top: var(--space-2); }
.cta-btn { min-height: 56px; padding: 0 var(--space-8); font-size: 16px; border-radius: 999px; gap: 10px; box-shadow: 0 10px 30px rgba(117, 214, 161, 0.25); }
.cta-btn svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.cta:hover .cta-btn { background: var(--accent-hover); }
.cta:focus-visible { outline: none; }
.cta:focus-visible .cta-btn { outline: 2px solid var(--focus); outline-offset: 3px; }
.cta .dz-sub { color: var(--text-muted); font-size: 14px; }
body.dragging .cta-btn { background: var(--accent-hover); transform: scale(1.04); }
body.dragging::after { content: ""; position: fixed; inset: 12px; border: 2px dashed var(--accent); border-radius: 24px; pointer-events: none; z-index: 50; }
.specs { list-style: none; margin: var(--space-4) 0 0; padding: var(--space-5) 0 0; display: flex; gap: var(--space-8); border-top: 1px solid var(--border); }
.specs li { display: grid; gap: 2px; font-size: 13px; color: var(--text-muted); }
.specs b { font-size: 28px; font-weight: 700; color: var(--text); line-height: 1; }

/* 휴대폰 미리보기 */
.hero-device { margin: 0; display: grid; place-items: center; position: relative; }
.hero-device::before { content: ""; position: absolute; width: 70%; height: 60%; top: 10%; background: radial-gradient(closest-side, rgba(255, 80, 30, 0.22), transparent); filter: blur(30px); }
.device {
  position: relative; width: min(340px, 100%); aspect-ratio: 9 / 16; border-radius: 40px; overflow: hidden;
  background: linear-gradient(160deg, #1d3a2c, #0b1210 70%);
  border: 8px solid #1a1f1d; box-shadow: 0 0 0 1px #2c3430, 0 30px 80px rgba(0, 0, 0, 0.6), inset 0 0 0 1px rgba(255,255,255,0.04);
  transform: rotate(2deg);
}
.device img, .device svg { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.device.noimg img { display: none; }
.device::after { content: ""; position: absolute; inset: 0; background: linear-gradient(to bottom, rgba(0,0,0,0.25), transparent 25%, transparent 60%, rgba(0,0,0,0.55)); pointer-events: none; }
#heroSvg path { fill: none; stroke-linecap: round; stroke-linejoin: round; stroke-dasharray: 1; stroke-dashoffset: 1; }
#heroSvg .t-glow { stroke: #FF6A2E; stroke-width: 26; opacity: 0.55; filter: url(#glow); }
#heroSvg .t-body { stroke: url(#taper); stroke-width: 9; }
#heroSvg .t-core { stroke: #FFE1D2; stroke-width: 3; }
#heroSvg.play path { animation: trace 3.2s cubic-bezier(0.18, 0.7, 0.3, 1) 0.4s infinite; }
@keyframes trace { 0% { stroke-dashoffset: 1; opacity: 1; } 72% { stroke-dashoffset: 0; opacity: 1; } 92% { stroke-dashoffset: 0; opacity: 1; } 100% { stroke-dashoffset: 0; opacity: 0; } }
.lower-third {
  position: absolute; left: 14px; right: 14px; bottom: 18px; z-index: 2; display: grid; grid-template-columns: repeat(3, 1fr);
  background: rgba(8, 12, 11, 0.78); backdrop-filter: blur(8px); border-radius: 12px; overflow: hidden;
  border-left: 4px solid var(--brand); animation: rise 3.2s ease 0.4s infinite both;
}
.lower-third div { padding: 10px 12px; display: grid; grid-template-columns: auto auto; justify-content: start; align-items: baseline; column-gap: 3px; }
.lower-third div + div { border-left: 1px solid rgba(255,255,255,0.08); }
.lower-third span { grid-column: 1 / -1; font: 600 10px/1.2 var(--font-display); letter-spacing: 0.14em; color: #9fb0a5; }
.lower-third b { font-size: 22px; font-weight: 700; color: #fff; line-height: 1.1; }
.lower-third em { font-style: normal; font-size: 11px; color: #9fb0a5; }
.lower-third .hl b { color: #FF8A5C; }
@keyframes rise { 0%, 50% { opacity: 0; transform: translateY(10px); } 62%, 92% { opacity: 1; transform: none; } 100% { opacity: 0; } }
.live { position: absolute; top: 16px; left: 16px; z-index: 2; display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 999px; background: rgba(8,12,11,0.7); font: 700 11px/1 var(--font-display); letter-spacing: 0.16em; color: #fff; }
.live i { width: 7px; height: 7px; border-radius: 50%; background: var(--brand); box-shadow: 0 0 8px var(--brand); animation: blink 1.4s ease-in-out infinite; }
@keyframes blink { 50% { opacity: 0.3; } }

/* 3단계 안내 */
.how { grid-column: 1 / -1; list-style: none; margin: var(--space-6) 0 0; padding: 0; display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--space-4); }
.how li { display: flex; gap: var(--space-4); align-items: flex-start; padding: var(--space-5); border-radius: var(--radius-panel); background: rgba(18, 29, 25, 0.7); border: 1px solid rgba(48, 70, 59, 0.6); }
.how b { font-size: 30px; font-weight: 700; color: var(--brand); line-height: 1; }
.how h3 { margin: 0; font-size: 16px; font-weight: 700; }
.how p { margin: 4px 0 0; font-size: 13px; color: var(--text-muted); }
.landing .tips { grid-column: 1 / -1; max-width: 560px; justify-self: center; }
.landing .upload-progress { max-width: 420px; }

@media (max-width: 959px) {
  #viewUpload.landing { grid-template-columns: minmax(0, 1fr); gap: var(--space-6); text-align: center; padding-top: 0; }
  .hero-copy { justify-items: center; }
  .wordmark { font-size: clamp(3.4rem, 17vw, 5rem); }
  .landing .lede { font-size: 15px; }
  .cta { justify-content: center; flex-direction: column; gap: var(--space-2); }
  .cta-btn { width: 100%; max-width: 320px; }
  .specs { justify-content: center; gap: var(--space-6); }
  .hero-device { order: -1; }
  .device { width: min(240px, 64vw); border-radius: 30px; border-width: 6px; transform: none; }
  .lower-third b { font-size: 17px; }
  .how { grid-template-columns: 1fr; gap: var(--space-2); text-align: left; margin-top: 0; }
  .how li { padding: var(--space-4); }
}
@media (prefers-reduced-motion: reduce) { #heroSvg path { stroke-dashoffset: 0; animation: none !important; } .lower-third { animation: none; opacity: 1; } }
#viewUpload .wordmark { font: italic 700 clamp(4.5rem, 9.5vw, 8rem)/0.86 var(--font-display); letter-spacing: -0.005em; }
#viewUpload .wordmark span { display: inline-block; padding-right: 0.14em; margin-right: -0.14em; }
@media (max-width: 959px) { #viewUpload .wordmark { font-size: clamp(3.6rem, 18vw, 5.2rem); } }

/* Codex 랜딩 리뷰: 절제 — 빛은 궤적에만 */
#viewUpload .wordmark span { background: none; color: #FF663D; filter: none; -webkit-background-clip: border-box; background-clip: border-box; }
.cta-btn { box-shadow: none; border-radius: 14px; }
.device { transform: none; border-width: 4px; border-radius: 24px; box-shadow: 0 16px 40px rgba(0, 0, 0, 0.28); }
.lower-third { animation: none; opacity: 1; transform: none; }
#heroSvg.play path { animation-iteration-count: 1; animation-fill-mode: forwards; }
@keyframes trace { 0% { stroke-dashoffset: 1; } 100% { stroke-dashoffset: 0; } }
@media (max-width: 959px) {
  .hero-copy { order: 0; }
  .hero-device { order: 1; }
  .device { width: min(200px, 52vw); border-radius: 20px; }
}

/* 볼꼬리 색 미리 고르기 (랜딩·공 지정) */
.pick-color { display: flex; align-items: center; justify-content: center; gap: var(--space-3); margin-top: var(--space-4); font-size: 13px; color: var(--text-secondary); }
.pick-color.inline { justify-content: space-between; margin-top: 0; padding: var(--space-2) 0; border-top: 1px solid var(--border); }
.swatches.mini { display: flex; gap: 2px; }
.swatches.mini .swatch { width: 32px; height: 32px; min-height: 32px; max-width: none; }
.swatches.mini .swatch i { width: 20px; height: 20px; }
.swatches.mini .swatch[aria-checked="true"] i { box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px #fff; }
.swatches.mini .swatch[aria-checked="true"]::after { width: 7px; height: 4px; border-width: 1.5px; }
@media (max-width: 959px) { .swatches.mini .swatch { width: 36px; height: 36px; } }

/* 착지 지점 표시 · 구질 4칸 */
.reticle.land { border-color: #FFD45A; }
.reticle.land::before, .reticle.land::after, .reticle.land i::before, .reticle.land i::after { background: #FFD45A; }
.reticle.land span { position: absolute; top: calc(100% + 10px); left: 50%; transform: translateX(-50%); font-size: 11px; font-weight: 700; color: #FFD45A; text-shadow: 0 1px 2px #000; white-space: nowrap; }
.segmented.four { grid-template-columns: repeat(4, 1fr); }
#btnLand.active { border-color: #FFD45A; color: #FFD45A; }
.field small { color: var(--text-muted); font-weight: 500; margin-left: 4px; }

#look { margin-top: var(--space-3, 12px); }
/* 랜딩 미리보기: 중계 띠 모양이면 글로우·심선 없이 넓은 반투명 띠 */
#heroSvg.flat .t-glow, #heroSvg.flat .t-core { display: none; }
#heroSvg.flat .t-body { stroke-width: 22; opacity: 0.78; }
#heroSvg.line .t-glow, #heroSvg.line .t-core { display: none; }
#heroSvg.line .t-body { stroke-width: 6; opacity: 0.96; }
