:root {
    --bg: #0f1117;
    --surface: #171a23;
    --surface-2: #1e2230;
    --border: #2a2f40;
    --text: #e6e8ee;
    --muted: #9aa1b1;
    --accent: #4ade80;
    --accent-dim: #22c55e;
    --danger: #f87171;
    --radius: 12px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

.site-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px;
    max-width: 860px;
    width: 100%;
    margin: 0 auto;
}

.brand { font-size: 20px; font-weight: 700; color: var(--text); }
.brand span { color: var(--accent); }
.brand:hover { text-decoration: none; }

.site-nav a { color: var(--muted); margin-left: 20px; font-size: 14px; }

.page-main {
    flex: 1;
    width: 100%;
    max-width: 860px;
    margin: 0 auto;
    padding: 0 24px 64px;
}

.hero { text-align: center; padding: 32px 0 24px; }
.hero h1 { font-size: 40px; line-height: 1.2; margin-bottom: 12px; }
.lede { color: var(--muted); font-size: 17px; max-width: 560px; margin: 0 auto; }

.dropzone {
    border: 2px dashed var(--border);
    border-radius: var(--radius);
    background: var(--surface);
    padding: 56px 24px;
    text-align: center;
    cursor: pointer;
    transition: border-color .15s, background .15s;
}
.dropzone:hover, .dropzone:focus { border-color: var(--accent); outline: none; }
.dropzone.drag { border-color: var(--accent); background: var(--surface-2); }
.dropzone.busy { opacity: .5; pointer-events: none; }

.dz-title { font-size: 19px; font-weight: 600; }
.dz-hint { color: var(--muted); font-size: 14px; margin-top: 6px; }

.panel { margin-top: 24px; }
.hidden { display: none; }

.progress-label { font-size: 14px; color: var(--muted); margin-bottom: 8px; }
.bar { height: 8px; background: var(--surface-2); border-radius: 999px; overflow: hidden; }
.bar-fill {
    height: 100%;
    width: 0;
    background: var(--accent);
    border-radius: 999px;
    transition: width .3s ease;
}

.error {
    margin-top: 16px;
    padding: 12px 16px;
    border-radius: 8px;
    background: rgba(248, 113, 113, .12);
    border: 1px solid rgba(248, 113, 113, .3);
    color: var(--danger);
    font-size: 14px;
}

.result-actions { display: flex; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }

.btn {
    display: inline-block;
    background: var(--accent-dim);
    color: #08130c;
    font-weight: 600;
    font-size: 14px;
    padding: 9px 16px;
    border-radius: 8px;
    border: none;
    cursor: pointer;
}
.btn:hover { background: var(--accent); text-decoration: none; }
.btn.ghost { background: transparent; color: var(--text); border: 1px solid var(--border); }

.transcript {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px;
    max-height: 480px;
    overflow-y: auto;
}

.seg { display: flex; gap: 12px; padding: 6px 0; align-items: baseline; }
.seg-time { color: var(--muted); font-variant-numeric: tabular-nums; font-size: 13px; flex-shrink: 0; }
.seg-speaker {
    color: var(--accent);
    font-weight: 600;
    font-size: 13px;
    flex-shrink: 0;
    min-width: 72px;
}
.seg-text { flex: 1; }

.extension, .how, .faq { margin-top: 56px; }
.extension h2, .how h2, .faq h2 { font-size: 22px; margin-bottom: 12px; }
.extension p, .how li { color: var(--muted); }
.extension .btn { margin-top: 14px; }
.how ol { padding-left: 20px; }
.how li { margin-bottom: 8px; }

.faq details {
    border-bottom: 1px solid var(--border);
    padding: 12px 0;
}
.faq summary { cursor: pointer; font-weight: 600; }
.faq details p { color: var(--muted); margin-top: 8px; }

.site-footer {
    border-top: 1px solid var(--border);
    padding: 24px;
    text-align: center;
    font-size: 13px;
    color: var(--muted);
}
.site-footer .muted { margin-top: 6px; opacity: .7; }

@media (max-width: 600px) {
    .hero h1 { font-size: 30px; }
    .seg { flex-wrap: wrap; gap: 6px; }
    .seg-speaker { min-width: 0; }

    /* A fixed 480px transcript is most of a phone screen, and it scrolls inside
       a page that also scrolls — two nested scroll areas fighting each other. */
    .transcript { max-height: 60vh; }

    .dropzone { padding: 36px 16px; }

    /* 28px of padding on each side of a 360px screen leaves the number input
       and the name fields uncomfortably narrow. */
    #speakerDialog, #namesDialog { padding: 20px; }

    /* Stacked full-width buttons: thumb-sized targets beat a ragged wrap. */
    .dialog-actions { flex-direction: column; align-items: stretch; }
    .dialog-actions .btn { width: 100%; }
}

.hint {
    margin-top: 10px;
    font-size: 13px;
    color: var(--muted);
    max-width: 620px;
}

#speakerDialog, #namesDialog {
    /* The global `* { margin: 0 }` reset kills the UA's `margin: auto`, which is
       what centers an open modal — without this it sticks to the top-left. */
    margin: auto;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
    color: var(--text);
    padding: 28px;
    max-width: 440px;
    width: calc(100% - 32px);
}
#speakerDialog::backdrop, #namesDialog::backdrop { background: rgba(0, 0, 0, .6); }
#speakerDialog h2, #namesDialog h2 { font-size: 20px; margin-bottom: 10px; }
.dialog-hint { color: var(--muted); font-size: 14px; margin-bottom: 18px; }
.dialog-actions { display: flex; gap: 10px; align-items: center; margin-top: 16px; flex-wrap: wrap; }

#namesDialog { max-width: 480px; max-height: 80vh; overflow-y: auto; }

.name-row {
    padding-top: 14px;
    margin-top: 14px;
    border-top: 1px solid var(--border);
}
.name-row:first-child { border-top: none; margin-top: 0; padding-top: 0; }
.name-quote { font-style: italic; margin: 4px 0 8px; }
.name-row input {
    width: 100%;
    background: var(--surface-2);
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 9px 10px;
    font-size: 14px;
}

#askSpeakers {
    width: 84px;
    background: var(--surface-2);
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 9px 10px;
    font-size: 14px;
}

.dialog-file { font-size: 14px; margin-bottom: 12px; word-break: break-all; }

.file-info {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 6px 16px;
    font-size: 14px;
    margin-bottom: 20px;
}
.file-info dt { color: var(--muted); }
.file-info dd { word-break: break-all; }

.dialog-options {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding-bottom: 18px;
    margin-bottom: 18px;
    border-bottom: 1px solid var(--border);
}
.dialog-options select {
    background: var(--surface-2);
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 8px 10px;
    font-size: 14px;
}
.dialog-options .checkbox {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    margin-top: 4px;
}

.ask-label { display: block; font-size: 14px; font-weight: 600; }
.ask-label + .dialog-hint { margin: 6px 0 10px; }

.btn:disabled {
    opacity: .4;
    cursor: not-allowed;
}

.legal h2 { font-size: 19px; margin-top: 32px; margin-bottom: 10px; }
.legal p, .legal li { color: var(--muted); }
.legal ul { padding-left: 20px; margin-bottom: 12px; }
.legal li { margin-bottom: 8px; }
.legal strong, .legal em { color: var(--text); }
