/* =========================================================================
 * Reels Subtitle Timing Checker — styles. Animated modern UI.
 * Accent: rose #7f1d3d / #5f0a1e (verified unique across all tools).
 * All motion disabled under prefers-reduced-motion.
 * ========================================================================= */
:root {
  --bg: #f6f7fb;
  --surface: #ffffff;
  --surface-2: #eef1f8;
  --ink: #141a2e;
  --ink-soft: #4b5573;
  --ink-faint: #8a93ad;
  --line: #e2e7f2;
  --brand: #7f1d3d;
  --brand-2: #5f0a1e;
  --brand-soft: #fdf2f5;
  --ok: #0f9d58;
  --ok-soft: #e5f6ec;
  --warn: #b45309;
  --warn-soft: #fef3e2;
  --err: #dc2626;
  --err-soft: #fdecec;
  --radius: 16px;
  --shadow: 0 10px 30px rgba(20, 26, 46, 0.08);
  --shadow-lg: 0 18px 50px rgba(127, 29, 61, 0.16);
  --font: ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    "Helvetica Neue", Arial, "Noto Sans", sans-serif;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: var(--font);
  background: var(--bg);
  color: var(--ink);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

.wrap { max-width: 1080px; margin: 0 auto; padding: 0 20px; }
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.skip-link {
  position: absolute; left: 16px; top: -60px; z-index: 100;
  background: var(--ink); color: #fff; padding: 10px 16px; border-radius: 10px;
  text-decoration: none; font-weight: 700; transition: top 0.2s;
}
.skip-link:focus { top: 12px; }

/* ---------------- header ---------------- */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: rgba(255, 255, 255, 0.86);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}
.site-header .wrap {
  display: flex; align-items: center; justify-content: space-between;
  height: 64px;
}
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--ink); font-weight: 800; font-size: 1.05rem; }
.brand-mark {
  width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center;
  background: linear-gradient(135deg, var(--brand), var(--brand-2));
  box-shadow: var(--shadow);
}
.brand-mark svg { width: 20px; height: 20px; fill: none; stroke: #fff; stroke-width: 2; }
.nav { display: flex; gap: 4px; }
.nav a {
  color: var(--ink-soft); text-decoration: none; font-weight: 600; font-size: 0.92rem;
  padding: 8px 12px; border-radius: 10px; transition: background 0.18s, color 0.18s;
}
.nav a:hover, .nav a:focus-visible { background: var(--surface-2); color: var(--ink); outline: none; }

/* ---------------- hero ---------------- */
.hero {
  padding: 26px 0 10px;
  background:
    radial-gradient(600px 300px at 15% 0%, rgba(127, 29, 61, 0.10), transparent 60%),
    radial-gradient(700px 320px at 90% 10%, rgba(95, 10, 30, 0.10), transparent 60%);
}
.hero h1 {
  font-size: clamp(1.65rem, 3.4vw, 2.25rem);
  line-height: 1.15; letter-spacing: -0.02em; margin: 0 0 6px; max-width: none;
}
.hero h1 .grad {
  background: linear-gradient(120deg, var(--brand), var(--brand-2));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.lede { font-size: 1rem; color: var(--ink-soft); max-width: none; margin: 0 0 12px; }
.trust-row { display: flex; flex-wrap: wrap; gap: 8px; margin: 0; padding: 0; list-style: none; }
.trust-row li {
  display: inline-flex; align-items: center; gap: 7px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 999px;
  padding: 5px 11px; font-size: 0.82rem; font-weight: 600; color: var(--ink-soft);
  box-shadow: 0 2px 8px rgba(20, 26, 46, 0.05);
}
.trust-row .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 0 3px var(--ok-soft); }

/* ---------------- tool card ---------------- */
.tool-section { padding: 8px 0 32px; }
.tool-card {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: 22px; box-shadow: var(--shadow-lg);
  padding: clamp(18px, 3vw, 28px);
}
.tool-layout { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 0.85fr); gap: 24px; align-items: start; }
.tool-main { min-width: 0; }
.tool-side { min-width: 0; }
.tool-side .settings {
  background: #fffbfc; border: 1px solid var(--line); border-radius: var(--radius);
  padding: 16px 18px;
}
.step-title { font-weight: 800; margin: 0 0 10px; font-size: 1rem; }

/* settings */
.settings { border: 0; margin: 0 0 4px; padding: 0; }
.settings legend { font-weight: 800; margin-bottom: 10px; padding: 0; }
.format-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px; margin-bottom: 14px;
}
.format {
  position: relative; display: block; cursor: pointer;
  border: 2px solid var(--line); border-radius: var(--radius);
  padding: 14px 14px 12px; background: var(--surface);
  transition: border-color 0.2s, transform 0.2s, box-shadow 0.2s;
}
.format:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.format input { position: absolute; opacity: 0; pointer-events: none; }
.format .f-name { font-weight: 800; font-size: 1.05rem; display: block; }
.format .f-desc { font-size: 0.84rem; color: var(--ink-soft); margin-top: 2px; display: block; }
.format .f-check {
  position: absolute; top: 12px; right: 12px; width: 22px; height: 22px;
  border-radius: 50%; background: var(--brand); display: none; place-items: center;
}
.format .f-check svg { width: 13px; height: 13px; stroke: #fff; stroke-width: 3; fill: none; }
.format:has(input:checked) { border-color: var(--brand); background: var(--brand-soft); }
.format:has(input:checked) .f-check { display: grid; }
.format:has(input:focus-visible) { outline: 3px solid rgba(127, 29, 61, 0.35); outline-offset: 2px; }

.setting-row { margin: 14px 0; }
.setting-row label { font-weight: 700; display: flex; justify-content: space-between; gap: 12px; }
.setting-row output { font-weight: 800; color: var(--brand); }
.setting-row input[type="range"] { width: 100%; accent-color: var(--brand); margin-top: 6px; }
.setting-row select {
  width: 100%; padding: 9px 10px; border: 1px solid var(--line); border-radius: 10px;
  font: inherit; font-size: 0.95rem; background: var(--surface); color: var(--ink);
}
.setting-note { font-size: 0.85rem; color: var(--ink-soft); margin: 4px 0 0; }
.setting-label { font-weight: 700; display: block; margin-bottom: 8px; }
.check-row { display: flex; align-items: center; gap: 8px; font-weight: 600; cursor: pointer; margin: 8px 0; }
.check-row input { accent-color: var(--brand); width: 17px; height: 17px; }

/* dropzone */
.dropzone {
  border: 2px dashed #c9cfe0; border-radius: var(--radius);
  padding: 26px 20px; text-align: center; cursor: pointer;
  background: linear-gradient(180deg, #fffbfc, #fdf2f5);
  transition: border-color 0.2s, background 0.2s, transform 0.2s, box-shadow 0.2s;
}
.dropzone:hover, .dropzone:focus-visible { border-color: var(--brand); outline: none; box-shadow: var(--shadow); }
.dropzone.drag {
  border-color: var(--brand); background: var(--brand-soft);
  transform: scale(1.01); box-shadow: var(--shadow-lg);
  animation: dz-pulse 1.1s ease-in-out infinite;
}
@keyframes dz-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(127, 29, 61, 0.22); }
  50% { box-shadow: 0 0 0 12px rgba(127, 29, 61, 0.0); }
}
.dz-icon { width: 52px; height: 52px; margin: 0 auto 8px; border-radius: 14px; display: grid; place-items: center; background: linear-gradient(135deg, var(--brand), var(--brand-2)); }
.dz-icon svg { width: 28px; height: 28px; stroke: #fff; stroke-width: 2; fill: none; }
.dz-title { font-weight: 800; font-size: 1.08rem; margin: 0 0 4px; }
.dz-sub { color: var(--ink-soft); margin: 0 0 16px; font-size: 0.92rem; }

/* buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: 1px solid transparent; border-radius: 12px; cursor: pointer;
  font: inherit; font-weight: 700; font-size: 0.92rem; text-decoration: none;
  padding: 10px 18px; transition: transform 0.15s, box-shadow 0.15s, background 0.15s;
}
.btn-primary { background: linear-gradient(135deg, var(--brand), var(--brand-2)); color: #fff; box-shadow: 0 6px 18px rgba(127, 29, 61, 0.35); }
.btn-primary:hover:not(:disabled) { transform: translateY(-1px); }
.btn-primary:disabled { opacity: 0.45; cursor: not-allowed; box-shadow: none; }
.btn-ghost { background: var(--surface); border-color: var(--line); color: var(--ink); }
.btn-ghost:hover:not(:disabled) { background: var(--surface-2); }
.btn-ghost:disabled { opacity: 0.45; cursor: not-allowed; }
.btn-small { padding: 7px 13px; font-size: 0.85rem; border-radius: 10px; }
.btn:focus-visible { outline: 3px solid rgba(127, 29, 61, 0.4); outline-offset: 2px; }

/* paste area */
.paste-wrap { margin-top: 16px; }
.paste-wrap textarea {
  width: 100%; min-height: 130px; resize: vertical;
  border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px;
  font: 0.9rem/1.5 ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  color: var(--ink); background: var(--surface);
}
.paste-wrap textarea:focus-visible { outline: 3px solid rgba(127, 29, 61, 0.35); outline-offset: 1px; border-color: var(--brand); }
.paste-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.parse-error {
  background: var(--err-soft); color: var(--err); border-radius: 10px;
  font-size: 0.88rem; font-weight: 600; padding: 10px 12px; margin: 12px 0 0;
}
.parse-error:empty { display: none; }

/* ---------------- results ---------------- */
.results { margin-top: 22px; }
.results[hidden] { display: none; }
.score-row { display: flex; gap: 16px; align-items: center; flex-wrap: wrap; }
.score-ring {
  width: 84px; height: 84px; border-radius: 50%; flex: none;
  display: grid; place-items: center; text-align: center;
  background: conic-gradient(var(--brand) calc(var(--score, 100) * 1%), var(--surface-2) 0);
  position: relative;
}
.score-ring::before {
  content: ""; position: absolute; inset: 8px; border-radius: 50%; background: #fff;
}
.score-ring b { position: relative; font-size: 1.5rem; line-height: 1; }
.score-ring span { position: relative; display: block; font-size: 0.68rem; color: var(--ink-faint); font-weight: 700; }
.score-text { min-width: 0; flex: 1; }
.score-text h3 { margin: 0 0 2px; font-size: 1.1rem; }
.score-text p { margin: 0; color: var(--ink-soft); font-size: 0.92rem; }
.count-chips { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.chip {
  border-radius: 999px; padding: 4px 12px; font-size: 0.85rem; font-weight: 700;
  background: var(--surface-2); color: var(--ink-soft);
}
.chip.err { background: var(--err-soft); color: var(--err); }
.chip.warn { background: var(--warn-soft); color: var(--warn); }
.chip.ok { background: var(--ok-soft); color: var(--ok); }

.table-wrap { overflow-x: auto; margin-top: 16px; border: 1px solid var(--line); border-radius: 14px; }
.issue-table { width: 100%; border-collapse: collapse; font-size: 0.9rem; min-width: 560px; }
.issue-table th, .issue-table td { padding: 10px 12px; text-align: left; vertical-align: top; border-bottom: 1px solid var(--line); }
.issue-table tr:last-child th, .issue-table tr:last-child td { border-bottom: 0; }
.issue-table th { background: var(--surface-2); font-size: 0.82rem; text-transform: uppercase; letter-spacing: 0.03em; color: var(--ink-soft); }
.issue-table tbody tr { cursor: pointer; }
.issue-table tbody tr:hover { background: var(--brand-soft); }
.issue-table tbody tr.active { background: var(--brand-soft); outline: 2px solid var(--brand); outline-offset: -2px; }
.sev {
  display: inline-block; border-radius: 999px; padding: 2px 10px;
  font-size: 0.78rem; font-weight: 800; white-space: nowrap;
}
.sev-error { background: var(--err-soft); color: var(--err); }
.sev-warning { background: var(--warn-soft); color: var(--warn); }
.issue-fix { color: var(--ink-soft); font-size: 0.86rem; }
.tc { font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; font-size: 0.82rem; white-space: nowrap; }
.no-issues {
  margin-top: 16px; background: var(--ok-soft); color: var(--ok);
  border-radius: 12px; padding: 14px 16px; font-weight: 700;
}
.no-issues p { margin: 4px 0 0; font-weight: 400; color: var(--ink-soft); font-size: 0.9rem; }

.download-bar { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 16px; }
.download-bar .btn { flex: 1 1 auto; }

/* ---------------- phone preview ---------------- */
.preview-grid { display: grid; grid-template-columns: minmax(0, 300px) minmax(0, 1fr); gap: 22px; margin-top: 20px; align-items: start; }
.phone-col { min-width: 0; }
.phone {
  position: relative; width: 100%; max-width: 300px; margin: 0 auto;
  aspect-ratio: 9 / 16; border-radius: 28px; overflow: hidden;
  background: linear-gradient(160deg, #3b1d2e, #171231 55%, #0f1420);
  border: 6px solid #141a2e; box-shadow: var(--shadow-lg);
}
.phone-video {
  position: absolute; inset: 0; display: grid; place-items: center;
  color: rgba(255, 255, 255, 0.55); font-weight: 700; font-size: 0.85rem; text-align: center; padding: 0 24px;
}
.phone-caption {
  position: absolute; left: 6%; right: 6%; text-align: center;
  color: #fff; font-weight: 700; font-size: 15px; line-height: 1.35;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.9), 0 0 8px rgba(0, 0, 0, 0.6);
  background: rgba(0, 0, 0, 0.45); border-radius: 8px; padding: 4px 8px;
  overflow-wrap: anywhere;
}
.phone-caption:empty { display: none; }
.ui-layer { position: absolute; inset: 0; pointer-events: none; }
.ui-top {
  position: absolute; top: 0; left: 0; right: 0; height: 9%;
  display: flex; align-items: center; justify-content: center; gap: 18px;
  color: rgba(255, 255, 255, 0.9); font-size: 11px; font-weight: 700;
  background: linear-gradient(180deg, rgba(0, 0, 0, 0.45), transparent);
}
.ui-top .active-tab { border-bottom: 2px solid #fff; padding-bottom: 2px; }
.ui-rail {
  position: absolute; right: 4%; top: 38%; display: flex; flex-direction: column; gap: 14px; align-items: center;
}
.ui-rail .rail-btn {
  width: 30px; height: 30px; border-radius: 50%;
  background: rgba(255, 255, 255, 0.22); border: 1.5px solid rgba(255, 255, 255, 0.7);
  display: grid; place-items: center; color: #fff; font-size: 13px; font-weight: 800;
}
.ui-rail .rail-ava { border-radius: 50%; background: linear-gradient(135deg, var(--brand), var(--brand-2)); border: 2px solid #fff; }
.ui-rail .rail-label { font-size: 9px; color: #fff; font-weight: 700; margin-top: -10px; }
.ui-bottom {
  position: absolute; left: 0; right: 0; bottom: 0; height: 25%;
  background: linear-gradient(0deg, rgba(0, 0, 0, 0.65), transparent);
  padding: 10px 12px; color: #fff;
}
.ui-bottom .ui-user { font-size: 12px; font-weight: 800; }
.ui-bottom .ui-cap { font-size: 11px; line-height: 1.4; opacity: 0.92; margin-top: 3px; }
.ui-bottom .ui-sound { font-size: 10px; opacity: 0.75; margin-top: 6px; }
.ui-progress { position: absolute; left: 0; right: 0; bottom: 0; height: 3px; background: rgba(255, 255, 255, 0.3); }
.ui-progress i { display: block; height: 100%; width: 32%; background: #fff; }
.crop-guide {
  position: absolute; left: 0; right: 0; border-top: 2px dashed #fbbf24;
  display: flex; justify-content: flex-end;
}
.crop-guide span {
  background: #fbbf24; color: #141a2e; font-size: 9px; font-weight: 800;
  padding: 1px 6px; border-radius: 0 0 0 6px;
}
.crop-guide.top { top: 14.84%; }
.crop-guide.bottom { top: 85.16%; }
.phone-meta { text-align: center; font-size: 0.85rem; color: var(--ink-soft); margin-top: 10px; }
.placement-verdict { margin-top: 12px; border-radius: 12px; padding: 12px 14px; font-size: 0.9rem; }
.placement-verdict.ok { background: var(--ok-soft); color: var(--ok); font-weight: 700; }
.placement-verdict.bad { background: var(--err-soft); color: var(--err); font-weight: 700; }
.placement-verdict p { margin: 4px 0 0; font-weight: 400; color: var(--ink-soft); font-size: 0.86rem; }

.cue-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; max-height: 520px; overflow-y: auto; }
.cue-list li {
  border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px;
  cursor: pointer; background: var(--surface);
}
.cue-list li:hover { border-color: var(--brand); }
.cue-list li.active { border-color: var(--brand); background: var(--brand-soft); }
.cue-list li.has-issue { border-left: 4px solid var(--err); }
.cue-list li.has-warning { border-left: 4px solid var(--warn); }
.cue-list .cue-tc { font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; font-size: 0.8rem; color: var(--ink-faint); }
.cue-list .cue-text { font-weight: 600; font-size: 0.92rem; margin-top: 2px; overflow-wrap: anywhere; }
.cue-list .cue-stats { font-size: 0.8rem; color: var(--ink-soft); margin-top: 2px; }

/* privacy */
.privacy { padding: 8px 0 44px; }
.privacy-card {
  background: linear-gradient(135deg, #2b0a16, #4a0f24);
  color: #e8e4f7; border-radius: 22px; padding: clamp(22px, 3vw, 36px);
  box-shadow: var(--shadow-lg);
}
.privacy-card h2 { color: #fff; margin: 0 0 10px; font-size: 1.4rem; }
.privacy-card p { margin: 0 0 16px; }
.net-meter {
  display: inline-flex; align-items: center; gap: 10px;
  background: rgba(255, 255, 255, 0.1); border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 999px; padding: 9px 16px; font-weight: 700; color: #fff;
}
.net-meter b { font-size: 1.15rem; }
.pulse { width: 10px; height: 10px; border-radius: 50%; background: #34d399; animation: pulse 1.8s ease-in-out infinite; }
@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(52, 211, 153, 0.5); }
  50% { box-shadow: 0 0 0 7px rgba(52, 211, 153, 0); }
}
.verify-steps { margin: 16px 0 0; padding-left: 20px; }
.verify-steps li { margin: 6px 0; }
kbd {
  background: rgba(255, 255, 255, 0.14); border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: 6px; padding: 1px 7px; font: inherit; font-size: 0.85em;
}
.tool-card kbd, .content kbd {
  background: var(--surface-2); border-color: var(--line); color: var(--ink);
}

/* content */
.content { padding: 20px 0 44px; }
.content h2 { font-size: 1.5rem; letter-spacing: -0.01em; margin: 0 0 12px; }
.content h3 { font-size: 1.08rem; margin: 26px 0 8px; }
.content p, .content li { color: var(--ink-soft); }
.content ol, .content ul { padding-left: 22px; }
.content li { margin: 6px 0; }
.limits-table { width: 100%; border-collapse: collapse; font-size: 0.92rem; margin-top: 10px; }
.limits-table th, .limits-table td { border: 1px solid var(--line); padding: 8px 10px; text-align: left; }
.limits-table th { background: var(--surface-2); }
.table-scroll { overflow-x: auto; }
.prose-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 14px; margin-top: 14px; }
.prose-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; }
.prose-card h3 { margin: 0 0 6px; }
.prose-card p { margin: 0; font-size: 0.93rem; }

.faq details {
  background: var(--surface); border: 1px solid var(--line); border-radius: 14px;
  padding: 14px 18px; margin: 10px 0;
}
.faq summary { font-weight: 700; cursor: pointer; }
.faq summary:focus-visible { outline: 3px solid rgba(127, 29, 61, 0.35); outline-offset: 2px; border-radius: 6px; }
.faq details p { margin: 10px 0 2px; }

/* footer — one small, quiet line */
.site-footer { border-top: 1px solid var(--line); padding: 18px 0 26px; color: var(--ink-faint); font-size: 0.85rem; }
.site-footer .wrap { display: flex; flex-wrap: wrap; gap: 4px 16px; align-items: baseline; justify-content: space-between; }
.site-footer p { margin: 0; }
.site-footer .footer-note { color: var(--ink-faint); }

/* responsive */
@media (max-width: 860px) {
  .tool-layout { grid-template-columns: 1fr; }
  .tool-side .settings { padding: 14px 16px; }
  .preview-grid { grid-template-columns: 1fr; }
  .cue-list { max-height: 320px; }
}
@media (max-width: 640px) {
  .nav { display: none; }
  .hero { padding: 20px 0 8px; }
  .paste-actions { display: grid; grid-template-columns: 1fr; }
  .paste-actions .btn { width: 100%; }
  .download-bar { flex-direction: column; }
  .download-bar .btn { width: 100%; }
  .score-row { flex-direction: column; align-items: flex-start; }
  .site-footer .wrap { flex-direction: column; gap: 2px; }
}

/* reduced motion: kill every animation */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  html { scroll-behavior: auto; }
}
