/* Subtitle Sync setup page.
   One accent, generous spacing, large text and tap targets, light and dark.
   No external fonts, images or scripts. */

:root {
  --bg: #f5f4fb;
  --bg-glow: rgba(139, 109, 255, 0.16);
  --surface: #ffffff;
  --surface-2: #f0eefb;
  --text: #1a1830;
  --muted: #5d5a78;
  --border: #e2dff2;
  --border-strong: #cfcae8;
  --accent: #5b3df0;
  --accent-2: #8b6dff;
  --accent-ink: #ffffff;
  --accent-soft: #eee9ff;
  --ok: #0c8a5a;
  --ok-soft: #e2f6ec;
  --warn: #8a5a00;
  --warn-soft: #fff3d1;
  --err: #c22f3c;
  --err-soft: #fde9ec;
  --shadow: 0 1px 2px rgba(26, 24, 48, 0.05), 0 8px 28px rgba(26, 24, 48, 0.07);
  --shadow-lg: 0 2px 4px rgba(26, 24, 48, 0.06), 0 18px 46px rgba(60, 40, 160, 0.14);
  --radius: 20px;
  --radius-sm: 12px;
  --focus: 0 0 0 3px var(--bg), 0 0 0 6px var(--accent);
  --font: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0e0d19;
    --bg-glow: rgba(139, 109, 255, 0.18);
    --surface: #17162a;
    --surface-2: #1f1e37;
    --text: #edecff;
    --muted: #a4a2c6;
    --border: #2b2949;
    --border-strong: #3a3760;
    --accent: #8f73ff;
    --accent-2: #b3a0ff;
    --accent-ink: #0e0d19;
    --accent-soft: #272052;
    --ok: #39d08f;
    --ok-soft: #10281f;
    --warn: #f0be55;
    --warn-soft: #2c2410;
    --err: #ff7d88;
    --err-soft: #2e1519;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 8px 28px rgba(0, 0, 0, 0.35);
    --shadow-lg: 0 2px 4px rgba(0, 0, 0, 0.4), 0 18px 46px rgba(0, 0, 0, 0.45);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0e0d19;
  --bg-glow: rgba(139, 109, 255, 0.18);
  --surface: #17162a;
  --surface-2: #1f1e37;
  --text: #edecff;
  --muted: #a4a2c6;
  --border: #2b2949;
  --border-strong: #3a3760;
  --accent: #8f73ff;
  --accent-2: #b3a0ff;
  --accent-ink: #0e0d19;
  --accent-soft: #272052;
  --ok: #39d08f;
  --ok-soft: #10281f;
  --warn: #f0be55;
  --warn-soft: #2c2410;
  --err: #ff7d88;
  --err-soft: #2e1519;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 8px 28px rgba(0, 0, 0, 0.35);
  --shadow-lg: 0 2px 4px rgba(0, 0, 0, 0.4), 0 18px 46px rgba(0, 0, 0, 0.45);
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: 17px;
  line-height: 1.55;
  color: var(--text);
  background: var(--bg);
  background-image: radial-gradient(900px 420px at 50% -120px, var(--bg-glow), transparent 70%);
  background-repeat: no-repeat;
  min-height: 100vh;
}
.root { min-height: 100vh; }
.noscript { max-width: 34rem; margin: 4rem auto; padding: 1.2rem; border-radius: var(--radius-sm); background: var(--warn-soft); color: var(--warn); }

h1, h2, h3 { line-height: 1.2; letter-spacing: -0.02em; margin: 0; }
h1 { font-size: clamp(1.7rem, 4.5vw, 2.35rem); font-weight: 780; }
h2 { font-size: clamp(1.4rem, 3.4vw, 1.75rem); font-weight: 750; }
h3 { font-size: 1.1rem; font-weight: 700; letter-spacing: -0.01em; }
p { margin: 0; }
a { color: var(--accent); }
.muted { color: var(--muted); }
.mono { font-family: var(--mono); }
.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; }

:focus { outline: none; }
:focus-visible { box-shadow: var(--focus); border-radius: 10px; }

.skip { position: absolute; left: -999px; top: 0; z-index: 50; background: var(--accent); color: var(--accent-ink); padding: 0.7rem 1rem; border-radius: 0 0 10px 0; }
.skip:focus { left: 0; }

/* ------------------------------------------------------------- header */
.top { position: sticky; top: 0; z-index: 30; backdrop-filter: saturate(1.4) blur(14px); background: color-mix(in srgb, var(--bg) 80%, transparent); border-bottom: 1px solid transparent; transition: border-color 0.2s; }
.top.scrolled { border-bottom-color: var(--border); }
.top__row { max-width: 820px; margin: 0 auto; padding: 0.8rem 1.1rem; display: flex; align-items: center; gap: 0.8rem; }
.brand { display: flex; align-items: center; gap: 0.7rem; min-width: 0; flex: 1; }
.brand img { width: 38px; height: 38px; border-radius: 11px; flex: none; }
.brand b { font-size: 1.02rem; letter-spacing: -0.01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tools { display: flex; align-items: center; gap: 0.5rem; flex: none; }
.seg { display: inline-flex; padding: 3px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--border); }
.seg button { border: 0; background: transparent; color: var(--muted); font: inherit; font-size: 0.9rem; font-weight: 650; padding: 0.35rem 0.8rem; border-radius: 999px; cursor: pointer; min-height: 34px; }
.seg button[aria-pressed="true"] { background: var(--surface); color: var(--text); box-shadow: 0 1px 3px rgba(0, 0, 0, 0.14); }
.icon-btn { width: 40px; height: 40px; border-radius: 999px; border: 1px solid var(--border); background: var(--surface-2); color: var(--muted); display: grid; place-items: center; cursor: pointer; }
.icon-btn:hover { color: var(--text); border-color: var(--border-strong); }

/* --------------------------------------------------------- page frame */
.wrap { max-width: 820px; margin: 0 auto; padding: 0 1.1rem 4rem; }
.hero { padding: 1.6rem 0 0.9rem; }
.hero p { color: var(--muted); font-size: 1.1rem; margin-top: 0.6rem; max-width: 38rem; }

.steps { display: flex; gap: 0.4rem; margin: 1.3rem 0 1.4rem; padding: 0; list-style: none; counter-reset: s; }
.steps li { flex: 1; min-width: 0; }
.chip { width: 100%; display: flex; align-items: center; gap: 0.6rem; padding: 0.55rem 0.7rem; border-radius: 14px; border: 1px solid var(--border); background: var(--surface); color: var(--muted); font: inherit; font-size: 0.93rem; font-weight: 650; cursor: pointer; text-align: left; min-height: 48px; transition: border-color 0.15s, background 0.15s, color 0.15s; }
.chip:hover { border-color: var(--border-strong); color: var(--text); }
.chip__n { flex: none; width: 28px; height: 28px; border-radius: 999px; display: grid; place-items: center; font-size: 0.85rem; background: var(--surface-2); color: var(--muted); }
.chip__t { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chip[aria-current="step"] { border-color: var(--accent); color: var(--text); background: var(--accent-soft); }
.chip[aria-current="step"] .chip__n { background: var(--accent); color: var(--accent-ink); }
.chip.done .chip__n { background: var(--ok); color: #fff; }
@media (max-width: 620px) {
  .chip__t { display: none; }
  .chip { justify-content: center; padding: 0.55rem; }
  .steps { gap: 0.35rem; }
  .brand b { font-size: 0.95rem; }
}
@media (max-width: 430px) {
  /* The name is in the big title right below; a cut-off copy in the bar only looks broken. */
  .brand b { display: none; }
}
.stepnote { color: var(--muted); font-size: 0.95rem; margin: -0.6rem 0 1rem; }

/* Only moving to another step animates. Ticking a box or switching a choice redraws parts of
   the page, and replaying this each time made the whole section flash and slide. */
.panel--enter { animation: rise 0.35s cubic-bezier(0.2, 0.8, 0.2, 1); }
/* A place that content is put into and taken out of, without adding a gap when it is empty. */
.slot { display: contents; }
@keyframes rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

.stack { display: grid; gap: 1.1rem; }
.lead { color: var(--muted); font-size: 1.05rem; margin-top: 0.5rem; }

.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 1.3rem 1.3rem 1.4rem; }
.card__head { display: flex; align-items: center; gap: 0.7rem; flex-wrap: wrap; }
.card__head h3 { flex: 1; min-width: 0; }
.badge { font-size: 0.78rem; font-weight: 700; padding: 0.2rem 0.6rem; border-radius: 999px; background: var(--surface-2); color: var(--muted); border: 1px solid var(--border); white-space: nowrap; }
.badge--accent { background: var(--accent-soft); color: var(--accent); border-color: transparent; }
.badge--ok { background: var(--ok-soft); color: var(--ok); border-color: transparent; }

/* --------------------------------------------------------- buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 0.5rem; font: inherit; font-weight: 700; font-size: 1rem; min-height: 48px; padding: 0.6rem 1.15rem; border-radius: 14px; border: 1px solid var(--border-strong); background: var(--surface); color: var(--text); cursor: pointer; text-decoration: none; transition: transform 0.08s, box-shadow 0.15s, border-color 0.15s, background 0.15s; }
.btn:hover { border-color: var(--accent); }
.btn:active { transform: translateY(1px); }
.btn[disabled], .btn[aria-disabled="true"] { opacity: 0.55; cursor: not-allowed; }
.btn--primary { background: linear-gradient(135deg, var(--accent-2), var(--accent)); color: var(--accent-ink); border-color: transparent; box-shadow: 0 6px 18px color-mix(in srgb, var(--accent) 38%, transparent); }
.btn--primary:hover { border-color: transparent; box-shadow: 0 8px 24px color-mix(in srgb, var(--accent) 50%, transparent); }
.btn--big { min-height: 58px; font-size: 1.1rem; padding: 0.8rem 1.5rem; border-radius: 16px; }
.btn--ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn--ghost:hover { color: var(--text); border-color: var(--border); }
.btn--small { min-height: 40px; padding: 0.35rem 0.85rem; font-size: 0.93rem; border-radius: 12px; }
.btn svg { flex: none; }
.actions { display: flex; align-items: center; gap: 0.7rem; flex-wrap: wrap; margin-top: 1.4rem; }
.actions .spacer { flex: 1; }

/* ---------------------------------------------------------- language chips */
.langs { display: flex; flex-wrap: wrap; gap: 0.55rem; margin-top: 1rem; }
.pill { position: relative; }
.pill input { position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; height: 100%; margin: 0; }
.pill span { display: inline-flex; align-items: center; gap: 0.45rem; min-height: 46px; padding: 0.4rem 1rem; border-radius: 999px; border: 1.5px solid var(--border-strong); background: var(--surface); font-weight: 650; transition: all 0.12s; }
.pill span small { font-weight: 500; color: var(--muted); font-size: 0.85rem; }
.pill input:checked + span { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }
.pill input:checked + span small { color: var(--accent); }
.pill input:focus-visible + span { box-shadow: var(--focus); }
.pill span::before { content: ""; width: 18px; height: 18px; border-radius: 6px; border: 2px solid var(--border-strong); flex: none; background: transparent; transition: all 0.12s; }
.pill input:checked + span::before { background: var(--accent); border-color: var(--accent); background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M3.5 8.5l3 3 6-7' fill='none' stroke='white' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E"); background-size: 14px; background-position: center; background-repeat: no-repeat; }
.search { margin-top: 1rem; }

/* -------------------------------------------------------- choice tiles */
.tiles { display: grid; gap: 0.75rem; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); margin-top: 1rem; }
.tile { position: relative; display: block; }
.tile input { position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; height: 100%; margin: 0; z-index: 1; }
.tile__body { height: 100%; display: flex; flex-direction: column; gap: 0.25rem; padding: 1rem 1.1rem; border-radius: 16px; border: 1.5px solid var(--border-strong); background: var(--surface); transition: all 0.12s; }
.tile__title { font-weight: 720; display: flex; align-items: center; gap: 0.5rem; }
.tile__title::before { content: ""; width: 20px; height: 20px; border-radius: 999px; border: 2px solid var(--border-strong); flex: none; }
.tile__sample { font-size: 1.5rem; font-weight: 650; margin: 0.15rem 0; letter-spacing: -0.01em; }
.tile__hint { color: var(--muted); font-size: 0.93rem; }
.tile input:checked + .tile__body { border-color: var(--accent); background: var(--accent-soft); }
.tile input:checked + .tile__body .tile__title::before { border-color: var(--accent); background: radial-gradient(circle, var(--accent) 0 42%, transparent 46%); }
.tile input:focus-visible + .tile__body { box-shadow: var(--focus); }
/* A tile you can tick together with others (a checkbox) is a rounded square with a tick,
   so it does not look like a choice of one (a radio, a circle). */
.tile input[type="checkbox"] + .tile__body .tile__title::before { border-radius: 6px; }
.tile input[type="checkbox"]:checked + .tile__body .tile__title::before {
  background: var(--accent) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M3.5 8.5l3 3 6-7' fill='none' stroke='white' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / 14px no-repeat;
}

/* --------------------------------------------------------- credentials */
.cred { display: grid; gap: 1.1rem; }
.cred__block { display: grid; gap: 0.5rem; }
.cred__label { font-size: 0.8rem; font-weight: 750; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); }
.cred ol { margin: 0; padding: 0; list-style: none; counter-reset: n; display: grid; gap: 0.6rem; }
.cred ol li { counter-increment: n; display: grid; grid-template-columns: 30px 1fr; gap: 0.75rem; align-items: start; }
.cred ol li::before { content: counter(n); width: 30px; height: 30px; border-radius: 999px; background: var(--accent-soft); color: var(--accent); font-weight: 750; font-size: 0.9rem; display: grid; place-items: center; }
.cred ol li span { padding-top: 0.2rem; }
.sample { font-family: var(--mono); font-size: 0.86rem; padding: 0.65rem 0.8rem; border-radius: 12px; background: var(--surface-2); border: 1px dashed var(--border-strong); word-break: break-all; color: var(--muted); }
.field { display: grid; gap: 0.4rem; }
.field label { font-weight: 700; font-size: 0.97rem; }
.input { width: 100%; min-height: 52px; padding: 0.7rem 0.95rem; font: inherit; color: var(--text); background: var(--surface); border: 1.5px solid var(--border-strong); border-radius: 14px; transition: border-color 0.12s, box-shadow 0.12s; }
.input::placeholder { color: color-mix(in srgb, var(--muted) 70%, transparent); }
.input:hover { border-color: var(--accent-2); }
.input:focus { border-color: var(--accent); box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 22%, transparent); outline: none; }
.input.mono { font-family: var(--mono); font-size: 0.95rem; letter-spacing: 0.01em; }
.input[aria-invalid="true"] { border-color: var(--err); }
.input--ok { border-color: var(--ok); }
.inputrow { display: flex; gap: 0.5rem; align-items: stretch; }
.inputrow .input { flex: 1; min-width: 0; }
.inputrow .btn { flex: none; }
.hint { display: flex; gap: 0.5rem; align-items: flex-start; font-size: 0.95rem; padding: 0.55rem 0.8rem; border-radius: 12px; line-height: 1.4; }
.hint svg { flex: none; margin-top: 2px; }
.hint--ok { background: var(--ok-soft); color: var(--ok); }
.hint--err { background: var(--err-soft); color: var(--err); }
.hint--warn { background: var(--warn-soft); color: var(--warn); }
.hint--info { background: var(--surface-2); color: var(--muted); }
.hint:empty { display: none; }
.notes { color: var(--muted); font-size: 0.9rem; }
.notes:empty { display: none; }
.checkrow { display: grid; gap: 0.6rem; }
.result { min-height: 0; }
.result:empty { display: none; }
.privacy { font-size: 0.9rem; color: var(--muted); display: flex; gap: 0.5rem; align-items: flex-start; padding-top: 0.2rem; border-top: 1px solid var(--border); padding-top: 0.9rem; }
.privacy svg { flex: none; margin-top: 2px; }
.server-ok { display: flex; gap: 0.7rem; align-items: center; padding: 0.9rem 1rem; border-radius: 14px; background: var(--ok-soft); color: var(--ok); font-weight: 650; }
.server-ok__text { flex: 1; min-width: 0; color: var(--text); font-weight: 550; }
.saved-row { display: flex; gap: 0.6rem; align-items: center; flex-wrap: wrap; }
.row { display: flex; gap: 0.6rem; flex-wrap: wrap; }

.spin { width: 18px; height: 18px; border-radius: 50%; border: 2.5px solid color-mix(in srgb, currentColor 30%, transparent); border-top-color: currentColor; animation: spin 0.7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ------------------------------------------------------------ summary */
.summary { list-style: none; margin: 1rem 0 0; padding: 0; display: grid; gap: 0.6rem; }
.summary li { display: flex; gap: 0.7rem; align-items: flex-start; }
.summary li svg { flex: none; margin-top: 3px; color: var(--ok); }
.summary li.is-neutral svg { color: var(--muted); }
.warns { display: grid; gap: 0.6rem; margin-top: 1rem; }

/* ------------------------------------------------------------- install */
.install { display: grid; gap: 1rem; }
.linkbox { display: grid; gap: 0.5rem; }
.linkbox .input { font-family: var(--mono); font-size: 0.85rem; }
details.acc { border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface); }
details.acc + details.acc { margin-top: 0.6rem; }
details.acc summary { cursor: pointer; padding: 0.95rem 1.1rem; font-weight: 700; list-style: none; display: flex; align-items: center; gap: 0.6rem; min-height: 52px; border-radius: var(--radius-sm); }
details.acc summary::-webkit-details-marker { display: none; }
details.acc summary::after { content: ""; margin-left: auto; width: 10px; height: 10px; border-right: 2.5px solid var(--muted); border-bottom: 2.5px solid var(--muted); transform: rotate(45deg); transition: transform 0.15s; flex: none; margin-bottom: 4px; }
details.acc[open] summary::after { transform: rotate(-135deg); margin-bottom: -3px; }
details.acc .acc__body { padding: 0 1.1rem 1.1rem; display: grid; gap: 0.8rem; }
.check { display: flex; gap: 0.8rem; align-items: flex-start; padding: 0.8rem 0; border-top: 1px solid var(--border); }
.check:first-child { border-top: 0; }
.check input[type="checkbox"] { width: 22px; height: 22px; margin-top: 3px; accent-color: var(--accent); flex: none; }
.check label { font-weight: 650; display: block; }
.check small { display: block; color: var(--muted); font-weight: 400; }
.count { display: flex; align-items: center; gap: 0.8rem; padding: 0.8rem 0; border-top: 1px solid var(--border); flex-wrap: wrap; }
.count label { font-weight: 650; flex: 1; min-width: 12rem; }
.count .input { width: 5.5rem; min-height: 46px; text-align: center; }

.banner { padding: 0.9rem 1.1rem; border-radius: var(--radius-sm); background: var(--accent-soft); color: var(--text); border: 1px solid color-mix(in srgb, var(--accent) 30%, transparent); }

.foot { margin-top: 2.6rem; padding-top: 1.4rem; border-top: 1px solid var(--border); color: var(--muted); font-size: 0.88rem; display: grid; gap: 0.3rem; }

@media (max-width: 560px) {
  body { font-size: 16.5px; }
  .card { padding: 1.05rem 1rem 1.15rem; }
  /* The box people paste into gets a whole line, with its buttons underneath. */
  .inputrow { flex-wrap: wrap; }
  .inputrow .input { flex: 1 1 100%; }
  .inputrow .btn { flex: 1 1 0; }
  .actions .btn { flex: 1; }
  .actions .btn--ghost { flex: none; }
}
@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}

/* Spacing and sizing helpers. The page sets no inline styles at all, because its
   security policy forbids them. */
.offscreen { position: fixed; left: -9999px; opacity: 0; }
.small { font-size: 0.9rem; }
.mt { margin-top: 1rem; }
.mt-sm { margin-top: 0.6rem; }
.mb { margin-bottom: 0.8rem; }
.mb-lg { margin-bottom: 1rem; }
.tiles--flush { margin-top: 0; }
/* Four choices sit better as two rows of two than as three and one on its own. */
.tiles--four { grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (max-width: 560px) { .tiles--four { grid-template-columns: 1fr; } }
