/* SmartVideoEditor — public site styles. Keep under 30KB (PROJECT.md §13). */

:root {
  --brand: #4f46e5;
  --bg: #ffffff;
  --bg-soft: #f6f7fb;
  --surface: #ffffff;
  --text: #14161f;
  --muted: #5d6275;
  --border: #e3e5ee;
  --danger: #c62f3b;
  --success: #17824f;
  --radius: 14px;
  --shadow: 0 1px 2px rgb(20 22 31 / 6%), 0 8px 24px rgb(20 22 31 / 6%);
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0e1016;
    --bg-soft: #151821;
    --surface: #181b25;
    --text: #eceef5;
    --muted: #9aa0b4;
    --border: #2a2e3b;
    --danger: #ff6b76;
    --success: #4cd391;
    --shadow: 0 1px 2px rgb(0 0 0 / 30%), 0 8px 24px rgb(0 0 0 / 25%);
    color-scheme: dark;
  }
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.6;
  color: var(--text);
  background: var(--bg);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}
img { max-width: 100%; height: auto; }
a { color: var(--brand); }
h1, h2, h3 { line-height: 1.2; letter-spacing: -0.01em; }
h1 { font-size: clamp(1.9rem, 4.5vw, 2.8rem); margin: 0 0 .5rem; }
h2 { font-size: 1.45rem; margin: 2rem 0 .75rem; }
code { font-family: var(--mono); font-size: .9em; background: var(--bg-soft); padding: .1em .35em; border-radius: 6px; }
hr { border: 0; border-top: 1px solid var(--border); margin: 1.25rem 0; }

.container { width: 100%; max-width: 1080px; margin: 0 auto; padding: 0 16px; }
.narrow { max-width: 760px; }
.muted { color: var(--muted); }
.lead { font-size: 1.15rem; color: var(--muted); margin: 0 0 1.5rem; }

.skip-link { position: absolute; left: -9999px; }
.skip-link:focus { left: 16px; top: 16px; z-index: 10; background: var(--surface); padding: .5rem 1rem; border-radius: 8px; }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .4rem;
  padding: .65rem 1.15rem; border-radius: 10px; border: 1px solid var(--border);
  background: var(--surface); color: var(--text); font: inherit; font-weight: 600;
  text-decoration: none; cursor: pointer; transition: transform .05s, opacity .15s;
}
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn:focus-visible, a:focus-visible, input:focus-visible, summary:focus-visible { outline: 3px solid color-mix(in srgb, var(--brand) 45%, transparent); outline-offset: 2px; }

/* Announcement + header */
.announcement { background: var(--announcement, var(--brand)); color: #fff; text-align: center; font-size: .92rem; padding: .5rem 16px; }
.announcement a { color: inherit; font-weight: 600; text-decoration: none; }
.site-header { border-bottom: 1px solid var(--border); background: var(--bg); position: sticky; top: 0; z-index: 5; }
.header-inner { display: flex; align-items: center; justify-content: space-between; gap: 1rem; min-height: 64px; flex-wrap: wrap; }
.brand { display: inline-flex; align-items: center; gap: .5rem; font-weight: 800; font-size: 1.1rem; color: var(--text); text-decoration: none; }
.brand-mark { display: inline-grid; place-items: center; width: 30px; height: 30px; border-radius: 9px; background: var(--brand); color: #fff; font-size: .8rem; }
.main-nav { display: flex; gap: .25rem; overflow-x: auto; scrollbar-width: none; }
.main-nav a { padding: .45rem .7rem; border-radius: 8px; color: var(--muted); text-decoration: none; font-weight: 600; font-size: .95rem; white-space: nowrap; }
.main-nav a:hover, .main-nav a[aria-current="page"] { color: var(--text); background: var(--bg-soft); }

.site-main { flex: 1; padding-bottom: 3rem; }

/* Home + tools */
.hero, .tool-hero { padding: 3.5rem 0 2rem; text-align: center; }
.tool-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 1rem; }
.tool-grid--compact { grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); }
.tool-card {
  display: flex; flex-direction: column; gap: .35rem; padding: 1.25rem;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  color: var(--text); text-decoration: none; box-shadow: var(--shadow); transition: border-color .15s, transform .15s;
}
.tool-card:hover { border-color: var(--brand); transform: translateY(-2px); }
.tool-icon { font-size: 1.6rem; }

.tool-panel { background: var(--surface); border: 1px solid var(--border); border-radius: calc(var(--radius) + 4px); box-shadow: var(--shadow); padding: 1rem; text-align: left; }
.tool-panel--off { text-align: center; color: var(--muted); }
.dropzone {
  display: flex; flex-direction: column; align-items: center; gap: .5rem; padding: 2.5rem 1rem;
  border: 2px dashed var(--border); border-radius: var(--radius); text-align: center;
}
.dropzone.is-over { border-color: var(--brand); background: color-mix(in srgb, var(--brand) 6%, transparent); }
.dropzone-icon { font-size: 2.2rem; }
.dropzone .btn { margin-top: .5rem; }

/* Content */
.prose { padding-top: 1.5rem; }
.prose ul, .prose ol { padding-left: 1.25rem; }
.prose li { margin: .3rem 0; }
.page h1 { margin-top: 2rem; }
.faq details { border: 1px solid var(--border); border-radius: 12px; padding: .2rem 1rem; margin: .6rem 0; background: var(--surface); }
.faq summary { cursor: pointer; font-weight: 600; padding: .6rem 0; }
.faq details p { margin: 0 0 .8rem; color: var(--muted); }
.related { padding-top: 1rem; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: .95rem; }
th, td { text-align: left; padding: .6rem .5rem; border-bottom: 1px solid var(--border); }

.error-page { text-align: center; padding: 5rem 16px; }
.error-code { font-size: 3.5rem; font-weight: 800; margin: 0; color: var(--brand); }

/* Footer */
.site-footer { border-top: 1px solid var(--border); background: var(--bg-soft); padding: 2rem 0 1rem; font-size: .95rem; }
.footer-inner { display: grid; grid-template-columns: 2fr 1fr 1fr; gap: 1.5rem; }
.footer-inner p { margin: .3rem 0 0; }
.footer-nav { display: flex; flex-direction: column; gap: .35rem; }
.footer-nav a { color: var(--muted); text-decoration: none; }
.footer-nav a:hover { color: var(--text); }
.footer-bottom { margin-top: 1.5rem; font-size: .85rem; }

/* Forms + alerts (installer, auth) */
.form { display: grid; gap: .9rem; }
.form label { display: grid; gap: .3rem; font-weight: 600; font-size: .95rem; }
.form input, .form select, .form textarea {
  font: inherit; padding: .65rem .8rem; border-radius: 10px; border: 1px solid var(--border);
  background: var(--bg); color: var(--text);
}
.form-actions { display: flex; justify-content: space-between; gap: .75rem; margin-top: .5rem; }
.alert { padding: .75rem 1rem; border-radius: 10px; border: 1px solid; }
.alert-error { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 40%, transparent); background: color-mix(in srgb, var(--danger) 8%, transparent); }

/* Header user links */
.user-nav { display: flex; align-items: center; gap: .5rem; }
.user-nav a:not(.btn) { color: var(--muted); text-decoration: none; font-weight: 600; font-size: .95rem; padding: .4rem .5rem; border-radius: 8px; }
.user-nav a:not(.btn):hover, .user-nav a[aria-current="page"] { color: var(--text); }
.btn-sm { padding: .4rem .75rem; font-size: .88rem; border-radius: 8px; }
.btn-danger { background: var(--danger); border-color: var(--danger); color: #fff; }

/* Tool panel */
.quota-line { margin: .75rem 0 0; font-size: .92rem; text-align: center; }
.quota-line a { font-weight: 600; text-decoration: none; }
.file-info { display: flex; flex-direction: column; gap: .15rem; padding: .25rem .25rem 1rem; border-bottom: 1px solid var(--border); margin-bottom: 1rem; word-break: break-word; }
.preview { width: 100%; max-height: 340px; border-radius: 12px; background: #000; margin-bottom: 1rem; }
.tool-settings { display: grid; gap: 1rem; }
.tool-settings fieldset { border: 0; padding: 0; margin: 0; }
.tool-settings legend, .field { font-weight: 600; font-size: .95rem; margin-bottom: .4rem; }
.field { display: grid; gap: .35rem; }
.field input, .field select, .presets select {
  font: inherit; font-weight: 400; padding: .6rem .75rem; border-radius: 10px; border: 1px solid var(--border);
  background: var(--bg); color: var(--text); width: 100%;
}
.segmented { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: .5rem; }
.segmented label { position: relative; cursor: pointer; }
.segmented input { position: absolute; opacity: 0; pointer-events: none; }
.segmented span { display: flex; flex-direction: column; gap: .1rem; padding: .65rem .8rem; border: 1px solid var(--border); border-radius: 10px; font-weight: 600; }
.segmented small { font-weight: 400; color: var(--muted); font-size: .8rem; }
.segmented input:checked + span { border-color: var(--brand); background: color-mix(in srgb, var(--brand) 9%, transparent); }
.segmented input:focus-visible + span { outline: 3px solid color-mix(in srgb, var(--brand) 45%, transparent); }
.range-row { display: grid; grid-template-columns: 1fr auto; gap: .5rem; align-items: end; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: .75rem; }
.presets { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; margin-top: 1rem; }
.presets select { width: auto; flex: 1; min-width: 160px; }
.tool-actions { display: flex; justify-content: space-between; gap: .75rem; margin-top: 1.25rem; flex-wrap: wrap; }
.status { font-weight: 600; margin: .25rem 0 .75rem; }
.progress { height: 10px; border-radius: 99px; background: var(--bg-soft); overflow: hidden; border: 1px solid var(--border); }
.progress-bar { height: 100%; width: 0; background: var(--brand); transition: width .25s ease; }
.result-title { font-size: 1.15rem; font-weight: 700; color: var(--success); margin: .25rem 0; }
.result-preview { display: block; max-width: 100%; max-height: 320px; margin: .75rem auto 0; border-radius: 10px; }
.result audio { width: 100%; margin-top: .75rem; }
.warn { color: #b26b00; }
.small { font-size: .88rem; }
.center { text-align: center; }
.alert-ok { color: var(--success); border-color: color-mix(in srgb, var(--success) 40%, transparent); background: color-mix(in srgb, var(--success) 8%, transparent); }
.ad-slot { max-width: 760px; margin: 1.5rem auto; padding: 0 16px; text-align: center; min-height: 90px; }

/* Modal */
.modal { position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; padding: 16px; }
.modal[hidden] { display: none; }
.modal-backdrop { position: absolute; inset: 0; background: rgb(10 12 20 / 55%); }
.modal-card { position: relative; width: 100%; max-width: 440px; max-height: calc(100vh - 32px); overflow: auto; background: var(--surface); border: 1px solid var(--border); border-radius: 18px; padding: 1.5rem; box-shadow: var(--shadow); }
.modal-card h2 { margin: 0 2rem .5rem 0; font-size: 1.3rem; }
.modal-close { position: absolute; top: .6rem; right: .75rem; border: 0; background: none; color: var(--muted); font-size: 1.6rem; cursor: pointer; line-height: 1; }
.modal-open { overflow: hidden; }
.perks { list-style: none; padding: 0; margin: .5rem 0 1rem; display: grid; gap: .2rem; color: var(--success); font-weight: 600; font-size: .95rem; }
.consent { display: flex !important; grid-template-columns: none; gap: .6rem; align-items: flex-start; font-weight: 400 !important; font-size: .9rem; margin: .25rem 0 1rem; }
.consent input { margin-top: .25rem; flex: none; }
.google-btn { display: flex; justify-content: center; min-height: 44px; }
.divider { display: flex; align-items: center; gap: .75rem; color: var(--muted); font-size: .85rem; margin: .9rem 0; }
.divider::before, .divider::after { content: ""; flex: 1; border-top: 1px solid var(--border); }
.tabs { display: flex; gap: .25rem; background: var(--bg-soft); padding: .25rem; border-radius: 10px; margin-bottom: .9rem; }
.tabs button { flex: 1; border: 0; background: none; padding: .5rem; border-radius: 8px; font: inherit; font-weight: 600; color: var(--muted); cursor: pointer; }
.tabs button.is-active { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }
.hp { position: absolute !important; left: -9999px !important; width: 1px; height: 1px; opacity: 0; }

/* Auth + account */
.auth-wrap { display: grid; place-items: center; padding-top: 3rem; }
.auth-card { width: 100%; max-width: 440px; background: var(--surface); border: 1px solid var(--border); border-radius: 18px; padding: 1.75rem; box-shadow: var(--shadow); }
.auth-card h1 { font-size: 1.6rem; }
.big-icon { font-size: 2.5rem; margin: 0; }
.account { padding-top: 2rem; display: grid; gap: 1rem; }
.account-head { display: flex; justify-content: space-between; align-items: center; gap: 1rem; }
.account-head h1 { margin: 0; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.25rem; }
.card h2 { margin: 0 0 .75rem; font-size: 1.15rem; }
.card-warn { border-color: #e0a100; background: color-mix(in srgb, #e0a100 8%, var(--surface)); }
.card-warn p { margin: .25rem 0 .75rem; }
.stat-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 1rem; }
.stat-row > div { display: flex; flex-direction: column; }
.stat { font-size: 1.4rem; font-weight: 800; }
.badge { display: inline-block; padding: .1rem .5rem; border-radius: 99px; font-size: .8rem; font-weight: 600; background: var(--bg-soft); }
.badge-completed { color: var(--success); }
.badge-failed { color: var(--danger); }
.plain-list { list-style: none; padding: 0; margin: 0; display: grid; gap: .35rem; }
.danger-zone summary { cursor: pointer; font-weight: 600; color: var(--danger); }

/* Installer */
.install { background: var(--bg-soft); align-items: center; padding: 2rem 16px; }
.install-card { width: 100%; max-width: 560px; background: var(--surface); border: 1px solid var(--border); border-radius: 18px; box-shadow: var(--shadow); padding: 1.75rem; }
.install-title { font-size: 1.6rem; }
.install-steps { display: flex; gap: .5rem; list-style: none; padding: 0; margin: 0 0 1.5rem; counter-reset: step; flex-wrap: wrap; }
.install-steps li { counter-increment: step; font-size: .85rem; color: var(--muted); padding: .3rem .7rem; border-radius: 99px; background: var(--bg-soft); }
.install-steps li::before { content: counter(step) ". "; }
.install-steps li.is-current { background: var(--brand); color: #fff; }
.install-steps li.is-done { color: var(--success); }
.checklist { list-style: none; padding: 0; margin: 0 0 1.25rem; }
.checklist li { display: flex; justify-content: space-between; gap: 1rem; padding: .5rem 0; border-bottom: 1px solid var(--border); }
.checklist .ok span { color: var(--success); }
.checklist .fail span { color: var(--danger); }
.next-steps li { margin: .4rem 0; }

@media (max-width: 720px) {
  .header-inner { padding-top: .5rem; padding-bottom: .5rem; }
  .main-nav { width: 100%; }
  .hero, .tool-hero { padding-top: 2rem; }
  .footer-inner { grid-template-columns: 1fr; }
  .user-nav { margin-left: auto; }
  .grid-2, .range-row { grid-template-columns: 1fr; }
  .tool-actions .btn { flex: 1; }
  .form-actions { flex-direction: column-reverse; }
}

/* Admin sign-in screens (rendered with this stylesheet) */
.admin-auth .brand { margin: 0 0 1rem; }
.qr { width: 200px; height: 200px; margin: .5rem auto; background: #fff; border-radius: 10px; padding: 6px; }
.qr svg { width: 100%; height: 100%; display: block; }
.secret { font-size: 1rem; letter-spacing: .05em; }
.recovery-codes { display: grid; grid-template-columns: 1fr 1fr; gap: .4rem; list-style: none; padding: 0; }
.recovery-codes code { display: block; text-align: center; padding: .4rem; font-size: .95rem; }
