/* ShootLab Web — mobile first. Colours follow the iOS app (one_motion theme: deep #0E2152, glow #FFB21A). */
:root {
  --bg: #081430;
  --bg-deep: #0e2152;
  --card: rgba(255, 255, 255, 0.06);
  --card-strong: rgba(255, 255, 255, 0.1);
  --line: rgba(255, 255, 255, 0.12);
  --text: #f4f6fb;
  --muted: rgba(244, 246, 251, 0.62);
  --faint: rgba(244, 246, 251, 0.4);
  --accent: #ffb21a;
  --accent-ink: #1a1200;
  --danger: #ff6b5e;
  --ok: #30d158;
  --radius: 16px;
  --gutter: 16px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
  color-scheme: dark;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100dvh;
  background: var(--bg);
  background-image: radial-gradient(120% 60% at 50% -10%, rgba(255, 178, 26, 0.18), transparent 60%),
                    linear-gradient(180deg, var(--bg-deep) 0%, var(--bg) 55%);
  background-attachment: fixed;
  color: var(--text);
  font: 16px/1.55 -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans CJK SC", sans-serif;
}
button, input { font: inherit; color: inherit; }
a { color: var(--accent); text-decoration: none; }
img, video { display: block; max-width: 100%; }

#app { max-width: 560px; margin: 0 auto; padding: calc(var(--safe-t) + 12px) var(--gutter) calc(var(--safe-b) + 24px); }

/* ------------------------------------------------ type */
h1, h2, h3 { margin: 0; line-height: 1.3; }
.title { font-size: 26px; font-weight: 800; letter-spacing: 0.01em; }
.subtitle { color: var(--muted); font-size: 14px; margin-top: 4px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.center { text-align: center; }
.brand { font-weight: 900; font-size: 40px; letter-spacing: 0.08em; line-height: 1; }
.brand span { color: var(--accent); }
.eyebrow { font-size: 12px; letter-spacing: 0.2em; color: var(--accent); font-weight: 700; text-transform: uppercase; }

/* ------------------------------------------------ layout */
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 48px; margin-bottom: 12px; }
.topbar .title { font-size: 22px; }
.stack > * + * { margin-top: 12px; }
.row { display: flex; align-items: center; gap: 12px; }
.spacer { flex: 1; }
.hero { padding: 48px 0 28px; }
.section { margin-top: 24px; }
.section-title { font-size: 15px; font-weight: 700; margin-bottom: 10px; display: flex; align-items: center; justify-content: space-between; }

/* ------------------------------------------------ controls */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 48px; padding: 0 20px; border-radius: 14px; border: 0;
  background: var(--card-strong); color: var(--text); font-weight: 600; font-size: 16px;
  cursor: pointer; transition: transform .08s ease, opacity .2s; text-align: center;
}
.btn:active { transform: scale(0.98); }
.btn[disabled] { opacity: 0.45; pointer-events: none; }
.btn.primary { background: var(--accent); color: var(--accent-ink); }
.btn.ghost { background: transparent; border: 1px solid var(--line); }
.btn.danger { background: transparent; color: var(--danger); border: 1px solid rgba(255, 107, 94, 0.4); }
.btn.block { display: flex; width: 100%; }
.btn svg { width: 18px; height: 18px; flex: none; }
.btn.small { min-height: 36px; padding: 0 14px; font-size: 14px; border-radius: 10px; }
.icon-btn { width: 44px; height: 44px; border-radius: 22px; border: 0; background: var(--card); display: inline-flex; align-items: center; justify-content: center; cursor: pointer; }
.icon-btn svg { width: 22px; height: 22px; }
.link-btn { background: none; border: 0; color: var(--accent); padding: 8px 0; cursor: pointer; font-size: 15px; }

.field { display: block; }
.field > span { display: block; font-size: 13px; color: var(--muted); margin-bottom: 6px; }
.input {
  width: 100%; height: 50px; padding: 0 14px; border-radius: 12px;
  border: 1px solid var(--line); background: rgba(0, 0, 0, 0.25);
  font-size: 17px; /* ≥16px: iOS does not zoom in on focus */ outline: none;
}
.input:focus { border-color: var(--accent); }
.input.code { letter-spacing: 0.18em; text-transform: uppercase; font-weight: 700; text-align: center; font-size: 20px; }
.hint { font-size: 13px; color: var(--muted); margin-top: 6px; }
.error { color: var(--danger); font-size: 14px; min-height: 20px; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 999px; background: var(--card-strong); font-size: 13px; }
.chip.ok { background: rgba(48, 209, 88, 0.16); color: var(--ok); }

.steps { display: flex; gap: 8px; margin: 18px 0 20px; }
.steps i { flex: 1; height: 4px; border-radius: 2px; background: var(--line); }
.steps i.on { background: var(--accent); }

/* ------------------------------------------------ cards */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; }
.report-card { display: flex; gap: 12px; align-items: stretch; padding: 12px; cursor: pointer; color: inherit; }
.report-card .thumb { width: 96px; height: 72px; flex: none; border-radius: 10px; background: rgba(0, 0, 0, 0.35) center/cover no-repeat; position: relative; overflow: hidden; }
.report-card .thumb .spinner { position: absolute; inset: 0; margin: auto; }
.report-card .meta { flex: 1; min-width: 0; display: flex; flex-direction: column; justify-content: center; gap: 4px; }
.report-card .when { font-weight: 600; }
.report-card .stats { color: var(--muted); font-size: 13px; }
.report-card .score { font-size: 28px; font-weight: 800; color: var(--accent); align-self: center; min-width: 48px; text-align: right; }
.report-card .score small { display: block; font-size: 11px; color: var(--faint); font-weight: 500; text-align: right; }
.report-card.failed .when { color: var(--danger); }
.report-card .side { display: flex; flex-direction: column; align-items: flex-end; justify-content: space-between; margin: -6px -6px -2px 0; }
.card-delete { width: 40px; height: 40px; border: 0; border-radius: 20px; background: transparent; color: var(--faint); display: inline-flex; align-items: center; justify-content: center; cursor: pointer; flex: none; }
.card-delete svg { width: 20px; height: 20px; }
.card-delete:hover, .card-delete:active { color: var(--danger); background: rgba(255, 107, 94, 0.12); }
.progress { height: 6px; border-radius: 3px; background: var(--line); overflow: hidden; }
.progress > i { display: block; height: 100%; width: 0; background: var(--accent); border-radius: 3px; transition: width .4s ease; }

.empty { text-align: center; padding: 40px 16px; border: 1px dashed var(--line); border-radius: var(--radius); color: var(--muted); }
.empty .big { font-size: 40px; margin-bottom: 8px; }
.notice { background: rgba(255, 178, 26, 0.1); border: 1px solid rgba(255, 178, 26, 0.3); border-radius: 12px; padding: 12px 14px; font-size: 14px; }

/* ------------------------------------------------ upload */
.tips { list-style: none; margin: 0; padding: 0; counter-reset: tip; }
.tips li { counter-increment: tip; display: flex; gap: 12px; align-items: flex-start; padding: 10px 0; border-bottom: 1px solid var(--line); }
.tips li:last-child { border-bottom: 0; }
.tips li::before { content: counter(tip); flex: none; width: 24px; height: 24px; border-radius: 12px; background: var(--accent); color: var(--accent-ink); font-size: 13px; font-weight: 800; display: inline-flex; align-items: center; justify-content: center; margin-top: 1px; }
.picker { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; min-height: 160px; border: 2px dashed rgba(255, 178, 26, 0.5); border-radius: var(--radius); background: rgba(255, 178, 26, 0.06); cursor: pointer; text-align: center; padding: 20px; }
.picker svg { width: 40px; height: 40px; color: var(--accent); }
.picker input { display: none; }
.file-info { display: flex; gap: 12px; align-items: center; }
.file-info video { width: 72px; height: 72px; object-fit: cover; border-radius: 10px; background: #000; }

/* ------------------------------------------------ report */
.player { margin: 0 calc(-1 * var(--gutter)); background: #000; }
.player video { width: 100%; max-height: 62vh; background: #000; }
@media (min-width: 600px) { .player { margin: 0; border-radius: var(--radius); overflow: hidden; } }
.phase-bar { display: flex; gap: 8px; overflow-x: auto; padding: 12px 0 4px; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
.phase-bar::-webkit-scrollbar { display: none; }
.phase-bar button { flex: none; min-height: 36px; padding: 0 12px; border-radius: 18px; border: 1px solid var(--line); background: var(--card); font-size: 14px; cursor: pointer; display: inline-flex; align-items: center; gap: 6px; }
.phase-bar button.active { border-color: var(--accent); color: var(--accent); }
.dot { width: 8px; height: 8px; border-radius: 4px; display: inline-block; flex: none; }
.summary { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 12px; }
.summary div { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 10px; text-align: center; }
.summary b { display: block; font-size: 24px; font-weight: 800; }
.summary b.accent { color: var(--accent); }
.summary span { font-size: 12px; color: var(--muted); }
.tabs { display: flex; background: var(--card); border-radius: 12px; padding: 4px; margin-top: 20px; position: sticky; top: calc(var(--safe-t) + 4px); z-index: 2; backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); }
.tabs button { flex: 1; min-height: 40px; border: 0; border-radius: 9px; background: transparent; font-weight: 600; cursor: pointer; color: var(--muted); }
.tabs button.on { background: var(--card-strong); color: var(--text); }

.md h2 { font-size: 19px; margin: 22px 0 8px; }
.md h3 { font-size: 16px; margin: 18px 0 6px; color: var(--accent); }
.md p { margin: 8px 0; }
.md ul { margin: 8px 0; padding-left: 20px; }
.md li { margin: 4px 0; }
.md blockquote { margin: 10px 0; padding: 10px 12px; border-left: 3px solid var(--accent); background: var(--card); border-radius: 0 10px 10px 0; color: var(--text); }
.md blockquote p { margin: 0; }
.seek-link { display: inline-flex; align-items: center; gap: 6px; border: 0; background: rgba(255, 178, 26, 0.14); color: var(--accent); border-radius: 999px; padding: 6px 12px; font-size: 14px; cursor: pointer; margin: 4px 0; }

.phase-card { margin-top: 12px; }
.phase-card header { display: flex; align-items: center; gap: 8px; cursor: pointer; }
.phase-card header h3 { font-size: 17px; flex: 1; }
.badge { font-size: 12px; font-weight: 700; padding: 3px 9px; border-radius: 999px; }
.frames { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 12px; }
.frames figure { margin: 0; }
.frames img { width: 100%; aspect-ratio: 748 / 800; object-fit: cover; border-radius: 10px; background: rgba(0, 0, 0, 0.3); }
.frames figcaption { font-size: 12px; color: var(--muted); margin-top: 4px; text-align: center; }
.frames figcaption b { color: var(--text); font-weight: 600; }
.phase-card p { margin: 10px 0 0; font-size: 15px; }

.download-bar { position: sticky; bottom: 0; margin: 24px calc(-1 * var(--gutter)) 0; padding: 12px var(--gutter) calc(var(--safe-b) + 12px); background: linear-gradient(180deg, rgba(8, 20, 48, 0), rgba(8, 20, 48, 0.94) 30%); display: flex; gap: 10px; z-index: 3; }
.download-bar .btn { flex: 1; }
.download-bar .btn.ghost { background: #16213f; }

/* ------------------------------------------------ misc */
.spinner { width: 28px; height: 28px; border-radius: 50%; border: 3px solid var(--line); border-top-color: var(--accent); animation: spin 0.9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.analyzing { text-align: center; padding: 40px 0 20px; }
.analyzing .spinner { width: 56px; height: 56px; border-width: 4px; margin: 0 auto 20px; }
.analyzing .msg { min-height: 26px; font-size: 17px; transition: opacity .3s; }
.list-menu { border-radius: var(--radius); overflow: hidden; border: 1px solid var(--line); }
.list-menu > * { display: flex; align-items: center; justify-content: space-between; width: 100%; min-height: 54px; padding: 0 16px; background: var(--card); border: 0; border-bottom: 1px solid var(--line); text-align: left; cursor: pointer; font-size: 16px; color: var(--text); }
.list-menu > *:last-child { border-bottom: 0; }
.list-menu .danger { color: var(--danger); }
#toast { position: fixed; left: 50%; bottom: calc(var(--safe-b) + 90px); transform: translateX(-50%); max-width: calc(100% - 32px); background: rgba(20, 24, 36, 0.96); border: 1px solid var(--line); padding: 10px 16px; border-radius: 12px; font-size: 14px; z-index: 50; box-shadow: 0 8px 30px rgba(0, 0, 0, 0.4); }
.sheet-backdrop { position: fixed; inset: 0; background: rgba(0, 0, 0, 0.6); z-index: 40; display: flex; align-items: flex-end; justify-content: center; }
.sheet { width: 100%; max-width: 560px; background: #121c38; border-radius: 20px 20px 0 0; padding: 20px var(--gutter) calc(var(--safe-b) + 20px); }
.sheet h3 { font-size: 18px; margin-bottom: 8px; }
.sheet .arrow { position: fixed; top: calc(var(--safe-t) + 8px); right: 18px; font-size: 40px; color: var(--accent); }
