/* Verse TTS (2026-10-17): speech made visible.
   A light page set in indigo ink. Every take is drawn as its voiceprint (a spectrogram of the real audio, the picture
   phoneticians have read since Bell Labs' sound spectrograph). On-air red is the one live colour: it marks only what is
   happening now (the playhead and the ink still hot behind it, the word being said, the recording dot). One typeface,
   Atkinson Hyperlegible Next, from the Braille Institute: text to speech began as reading machines for blind readers. */

:root {
    --sheet: #F7F7FA;
    --white: #FFFFFF;
    --booth: #E8E9F1;
    --ink: #1F2147;
    --ink-hover: #2E3166;
    --ink-soft: #565A7E;
    --rule: #D5D7E3;
    --rule-strong: #B4B7CC;
    --red: #E5352A;
    --error: #B42318;
    --font: 'Atkinson Hyperlegible Next', 'Atkinson Hyperlegible', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
    --gutter: 40px;

    /* the site menu button, themed through its own custom properties */
    --menu-button-bg: #1F2147;
    --menu-button-bg-hover: #2E3166;
    --menu-button-fg: #FFFFFF;
    --menu-button-radius: 10px;
    --menu-button-font: var(--font);
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
    margin: 0;
    min-height: 100vh;
    background: var(--sheet);
    color: var(--ink);
    font: 400 16px/1.5 var(--font);
}
h1, h2, h3, p { margin: 0; }
button, input, select, textarea { font: inherit; color: inherit; }
svg { width: 20px; height: 20px; flex: none; }
:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }
.sr-only {
    position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
    overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
[hidden] { display: none !important; }

/* ── the bar ── the site menu button sits at its left, the home pill at its right */
.bar {
    display: flex;
    align-items: center;
    gap: 16px;
    min-height: 68px;
    padding: 0 84px 0 148px;
}
.mark { font-size: 21px; font-weight: 750; letter-spacing: -0.01em; }
.bar-link {
    margin-left: auto;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-height: 44px;
    padding: 0 12px;
    border-radius: 10px;
    color: var(--ink-soft);
    text-decoration: none;
    font-size: 15px;
}
.bar-link:hover { color: var(--ink); background: var(--booth); }

/* ── the desk: the script, and the voice column beside it ── */
.desk {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 300px;
    column-gap: 56px;
    max-width: 1280px;
    margin: 0 auto;
    padding: 4px var(--gutter) 0;
}
.script { min-width: 0; padding-bottom: 32px; }
.script-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 14px; }

.modes { display: inline-flex; padding: 3px; border-radius: 999px; background: var(--booth); }
.mode { position: relative; }
.mode input { position: absolute; inset: 0; opacity: 0; margin: 0; cursor: pointer; }
.mode span {
    display: block;
    padding: 8px 18px;
    border-radius: 999px;
    font-size: 15px;
    color: var(--ink-soft);
    pointer-events: none;
}
.mode input:checked + span { background: var(--white); color: var(--ink); font-weight: 650; box-shadow: 0 1px 2px rgba(31, 33, 71, 0.14); }
.mode input:focus-visible + span { outline: 2px solid var(--ink); outline-offset: 2px; }
.mode:hover input:not(:checked) + span { color: var(--ink); }

#vtScript {
    display: block;
    width: 100%;
    height: clamp(170px, 26vh, 360px);
    min-height: 160px;
    resize: vertical;
    padding: 22px 26px;
    border: 1px solid var(--rule);
    border-radius: 14px;
    background: var(--white);
    font-size: 22px;
    line-height: 1.55;
}
#vtScript::placeholder { color: var(--ink-soft); opacity: 1; }
#vtScript:focus { outline: none; border-color: var(--ink); box-shadow: 0 0 0 1px var(--ink); }
#vtScript[aria-invalid="true"] { border-color: var(--error); box-shadow: 0 0 0 1px var(--error); }

.starters { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 12px; }
.starters-lead { font-size: 14px; color: var(--ink-soft); margin-right: 2px; }
.starter {
    min-height: 36px;
    padding: 0 14px;
    border: 1px solid var(--rule-strong);
    border-radius: 999px;
    background: transparent;
    font-size: 14px;
    cursor: pointer;
}
.starter:hover { background: var(--white); border-color: var(--ink-soft); }

.field-error { margin-top: 10px; color: var(--error); font-size: 15px; font-weight: 600; }

.script-foot { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 20px; margin-top: 16px; }
.count, .estimate, .keys { font-size: 14px; color: var(--ink-soft); }
.count { font-variant-numeric: tabular-nums; }
.count.over { color: var(--error); font-weight: 650; }
kbd {
    display: inline-block;
    padding: 0 6px;
    border: 1px solid var(--rule-strong);
    border-bottom-width: 2px;
    border-radius: 5px;
    background: var(--white);
    font: 600 13px/1.5 var(--font);
    color: var(--ink);
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 44px;
    padding: 0 18px;
    border: 1px solid transparent;
    border-radius: 10px;
    background: none;
    font-size: 16px;
    font-weight: 650;
    line-height: 1;
    white-space: nowrap;
    cursor: pointer;
}
.btn svg { width: 18px; height: 18px; }
.btn-primary { background: var(--ink); color: #FFFFFF; }
.btn-primary:hover:not(:disabled) { background: var(--ink-hover); }
.btn-quiet { border-color: var(--rule-strong); color: var(--ink); }
.btn-quiet:hover:not(:disabled) { background: var(--white); border-color: var(--ink-soft); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn-speak { margin-left: auto; min-height: 52px; padding: 0 28px 0 24px; border-radius: 999px; font-size: 17px; }
.btn-speak svg { width: 20px; height: 20px; }
.btn-speak.is-running { background: var(--white); color: var(--ink); border-color: var(--ink); }

.run-note { margin-top: 12px; font-size: 15px; color: var(--ink-soft); min-height: 1.5em; }
.run-note[data-tone="error"] { color: var(--error); font-weight: 600; }

/* ── the voice column ── */
.cast { min-width: 0; padding: 6px 0 32px 32px; border-left: 1px solid var(--rule); }
.cast h2, .lang label { display: block; font-size: 16px; font-weight: 700; }
.voices { margin: 8px -10px 0; padding: 2px; max-height: 360px; overflow-y: auto; }
.voices-loading { padding: 10px; color: var(--ink-soft); font-size: 15px; }
.voice-group { margin: 12px 10px 4px; font-size: 14px; color: var(--ink-soft); }
.voice-group:first-child { margin-top: 2px; }
.voice-none { margin: 0 10px 6px; font-size: 14px; color: var(--ink-soft); }
.voice { display: flex; align-items: center; gap: 2px; }
.voice label {
    flex: 1;
    min-width: 0;
    display: flex;
    align-items: center;
    gap: 12px;
    min-height: 44px;
    padding: 0 10px;
    border-radius: 10px;
    cursor: pointer;
}
.voice label:hover { background: var(--booth); }
.voice input {
    appearance: none;
    -webkit-appearance: none;
    flex: none;
    display: grid;
    place-content: center;
    width: 18px;
    height: 18px;
    margin: 0;
    border: 2px solid var(--ink-soft);
    border-radius: 50%;
    cursor: pointer;
}
.voice input:checked { border-color: var(--ink); }
.voice input:checked::before { content: ''; width: 8px; height: 8px; border-radius: 50%; background: var(--ink); }
.voice-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.voice input:checked ~ .voice-name { font-weight: 700; }
.voice-hear {
    flex: none;
    display: grid;
    place-content: center;
    width: 40px;
    height: 40px;
    border: 0;
    border-radius: 50%;
    background: none;
    color: var(--ink-soft);
    cursor: pointer;
}
.voice-hear svg { width: 18px; height: 18px; }
.voice-hear:hover { background: var(--booth); color: var(--ink); }
.voice-hear[aria-pressed="true"] { color: var(--red); }
.cast-note { margin-top: 8px; font-size: 14px; color: var(--ink-soft); }
.btn-add { margin-top: 12px; width: 100%; }
.lang { margin-top: 26px; }
.lang label { margin-bottom: 8px; }
select {
    width: 100%;
    min-height: 44px;
    padding: 0 40px 0 14px;
    border: 1px solid var(--rule-strong);
    border-radius: 10px;
    background: var(--white) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5l5 5 5-5' fill='none' stroke='%231F2147' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") no-repeat right 15px center;
    font-size: 16px;
    appearance: none;
    -webkit-appearance: none;
    cursor: pointer;
}

/* ── the deck: the take, its voiceprint, the caption and the takes ── */
.deck { background: var(--booth); border-top: 1px solid var(--rule); }
.deck-inner { max-width: 1280px; margin: 0 auto; padding: 20px var(--gutter) 48px; }
.deck-head { display: flex; align-items: center; flex-wrap: wrap; gap: 12px 18px; }
.play {
    flex: none;
    display: grid;
    place-content: center;
    width: 56px;
    height: 56px;
    border: 0;
    border-radius: 50%;
    background: var(--ink);
    color: #FFFFFF;
    cursor: pointer;
}
.play svg { width: 22px; height: 22px; }
.play:hover:not(:disabled) { background: var(--ink-hover); }
.play:disabled { background: var(--rule-strong); cursor: default; }
.deck-id { min-width: 0; }
.deck-id h2 { font-size: 21px; font-weight: 700; line-height: 1.25; }
.deck-id p { margin-top: 2px; font-size: 14px; color: var(--ink-soft); }
.clock { font-size: 16px; color: var(--ink-soft); font-variant-numeric: tabular-nums; }
.clock #vtNow { color: var(--ink); font-weight: 650; }
.deck-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-left: auto; }
.deck.no-take .clock { visibility: hidden; }

.print-wrap {
    display: grid;
    grid-template-columns: 52px minmax(0, 1fr);
    grid-template-rows: auto 26px;
    margin-top: 16px;
}
.print-axis { position: relative; grid-row: 1; grid-column: 1; font-size: 12px; color: var(--ink-soft); font-variant-numeric: tabular-nums; }
.print-axis span { position: absolute; right: 10px; transform: translateY(-50%); white-space: nowrap; line-height: 1; }
.print {
    position: relative;
    grid-row: 1;
    grid-column: 2;
    height: 176px;
    border-radius: 6px;
    background-color: var(--sheet);
    /* guide lines at 2, 4 and 6 kHz */
    background-image:
        linear-gradient(to bottom, transparent calc(25% - 0.5px), var(--rule) calc(25% - 0.5px), var(--rule) calc(25% + 0.5px), transparent calc(25% + 0.5px)),
        linear-gradient(to bottom, transparent calc(50% - 0.5px), var(--rule) calc(50% - 0.5px), var(--rule) calc(50% + 0.5px), transparent calc(50% + 0.5px)),
        linear-gradient(to bottom, transparent calc(75% - 0.5px), var(--rule) calc(75% - 0.5px), var(--rule) calc(75% + 0.5px), transparent calc(75% + 0.5px));
    overflow: hidden;
}
.deck:not([data-state="ready"]) .print { background-image: none; }   /* the guide lines come with a print */
.print:has(#vtSeek:focus-visible) { outline: 2px solid var(--ink); outline-offset: 3px; }
#vtCanvas { position: absolute; inset: 0; width: 100%; height: 100%; }
#vtSeek {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    margin: 0;
    opacity: 0;
    cursor: pointer;
}
#vtSeek:disabled { cursor: default; display: none; }
.print-message {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 6px;
    padding: 0 32px;
    max-width: 680px;
}
.print-main { font-size: 19px; font-weight: 700; }
.print-sub { font-size: 15px; color: var(--ink-soft); }
.deck[data-state="ready"] .print-message { display: none; }
.deck[data-state="making"] #vtCanvas { opacity: 0.18; }
.deck[data-state="making"] .print-message { padding-left: 32px; }

.print-time { position: relative; grid-row: 2; grid-column: 2; font-size: 12px; color: var(--ink-soft); font-variant-numeric: tabular-nums; }
.print-time span { position: absolute; top: 7px; transform: translateX(-50%); white-space: nowrap; line-height: 1; }
.print-time span:first-child { transform: none; }
.print-time span::before { content: ''; position: absolute; left: 50%; top: -7px; width: 1px; height: 4px; background: var(--rule-strong); }
.print-time span:first-child::before { left: 0; }

.caption {
    min-height: 3em;
    max-width: 62ch;
    margin: 14px 0 0 52px;
    font-size: 21px;
    line-height: 1.5;
}
.caption:empty { min-height: 0; }
.w { cursor: pointer; }
.caption.live .w { color: var(--ink-soft); }
.caption.live .w.said { color: var(--ink); }
/* the word being said is thickened with a stroke, not a heavier weight, so the line never reflows */
.caption .w.now {
    color: var(--ink);
    -webkit-text-stroke: 0.045em currentColor;
    background: linear-gradient(var(--red), var(--red)) no-repeat 0 100% / 100% 3px;
}

.takes { margin-top: 30px; }
.takes-head { display: flex; align-items: baseline; flex-wrap: wrap; gap: 6px 16px; }
.takes-head h3 { font-size: 16px; font-weight: 700; }
.link-btn {
    padding: 4px 2px;
    border: 0;
    background: none;
    color: var(--ink-soft);
    font-size: 14px;
    text-decoration: underline;
    text-underline-offset: 3px;
    cursor: pointer;
}
.link-btn:hover { color: var(--ink); }
.link-btn-strong { color: var(--error); font-weight: 650; }
.forget-confirm { display: inline-flex; flex-wrap: wrap; align-items: baseline; gap: 4px 12px; font-size: 14px; }
.take-list {
    display: flex;
    gap: 12px;
    margin: 10px -8px 0;
    padding: 4px 8px 12px;
    list-style: none;
    overflow-x: auto;
    scroll-snap-type: x proximity;
}
.take { flex: 0 0 192px; scroll-snap-align: start; }
.take button {
    display: block;
    width: 100%;
    padding: 8px;
    border: 1px solid transparent;
    border-radius: 10px;
    background: none;
    text-align: left;
    cursor: pointer;
}
.take button:hover { background: var(--sheet); }
.take button[aria-current="true"] { background: var(--sheet); border-color: var(--ink); }
.take-print { display: block; width: 100%; height: 44px; border-radius: 4px; background: var(--sheet); object-fit: fill; }
.take-no { display: block; margin-top: 8px; font-size: 13px; font-weight: 700; }
.take-text {
    display: -webkit-box;
    margin-top: 2px;
    overflow: hidden;
    font-size: 14px;
    line-height: 1.35;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}
.take-meta { display: block; margin-top: 4px; font-size: 13px; color: var(--ink-soft); }
.takes-empty { margin-top: 8px; font-size: 14px; color: var(--ink-soft); }

/* ── Add your voice ── */
.voice-dialog {
    width: min(580px, calc(100vw - 32px));
    max-height: calc(100dvh - 32px);
    padding: 0;
    border: 0;
    border-radius: 18px;
    background: var(--sheet);
    color: var(--ink);
    box-shadow: 0 30px 80px rgba(20, 22, 52, 0.35);
}
.voice-dialog::backdrop { background: rgba(31, 33, 71, 0.5); }
.dlg { padding: 22px 28px 24px; }
.dlg-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.dlg-head h2 { font-size: 24px; font-weight: 750; }
.icon-btn {
    display: grid;
    place-content: center;
    width: 44px;
    height: 44px;
    margin-right: -10px;
    border: 0;
    border-radius: 50%;
    background: none;
    cursor: pointer;
}
.icon-btn:hover { background: var(--booth); }
.dlg-lede { margin-top: 8px; font-size: 15px; color: var(--ink-soft); }
.dlg-tabs { display: flex; gap: 4px; margin-top: 18px; border-bottom: 1px solid var(--rule); }
.dlg-tab {
    min-height: 44px;
    padding: 0 14px;
    border: 0;
    border-bottom: 3px solid transparent;
    margin-bottom: -1px;
    background: none;
    color: var(--ink-soft);
    font-weight: 650;
    cursor: pointer;
}
.dlg-tab[aria-selected="true"] { color: var(--ink); border-bottom-color: var(--ink); }
.dlg-panel { padding-top: 16px; }
.passage-lead { font-size: 14px; color: var(--ink-soft); }
.passage {
    margin: 8px 0 0;
    padding: 14px 18px;
    border-left: 3px solid var(--ink);
    background: var(--white);
    border-radius: 0 10px 10px 0;
    font-size: 18px;
    line-height: 1.55;
}
.rec { display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: center; gap: 12px 16px; margin-top: 16px; }
.rec-btn {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    min-height: 48px;
    padding: 0 20px 0 16px;
    border: 1px solid var(--rule-strong);
    border-radius: 999px;
    background: var(--white);
    font-weight: 650;
    cursor: pointer;
}
.rec-btn:hover { border-color: var(--ink-soft); }
.rec-dot { width: 14px; height: 14px; border-radius: 50%; background: var(--red); transition: border-radius 0.2s; }
.rec-btn[aria-pressed="true"] { border-color: var(--red); }
.rec-btn[aria-pressed="true"] .rec-dot { border-radius: 3px; }
.rec-time { display: flex; align-items: center; gap: 12px; min-width: 0; }
.rec-clock { font-size: 16px; font-weight: 650; font-variant-numeric: tabular-nums; min-width: 2.6em; }
.rec-track { position: relative; flex: 1; height: 6px; border-radius: 3px; background: var(--rule); }
.rec-track i { position: absolute; top: 0; bottom: 0; border-radius: 3px; }
.rec-good { left: 16.667%; width: 33.333%; background: #C3C6DD; }   /* 10 to 30 seconds of 60 */
.rec-min { left: 10%; width: 2px; top: -3px !important; bottom: -3px !important; background: var(--ink-soft); border-radius: 1px !important; }   /* 6 seconds */
.rec-fill { left: 0; width: 0; background: var(--ink); }
.rec-print {
    grid-column: 1 / -1;
    position: relative;
    height: 88px;
    border: 1px solid var(--rule);
    border-radius: 8px;
    background: var(--white);
    overflow: hidden;
}
#vtRecCanvas { position: absolute; inset: 0; width: 100%; height: 100%; }
.drop {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 30px 20px;
    border: 2px dashed var(--rule-strong);
    border-radius: 14px;
    background: var(--white);
    text-align: center;
    cursor: pointer;
}
.drop svg { width: 26px; height: 26px; color: var(--ink-soft); }
.drop:hover, .drop.over { border-color: var(--ink); }
.drop:has(+ input:focus-visible) { outline: 2px solid var(--ink); outline-offset: 2px; }
.drop-main { font-weight: 650; }
.drop-sub { font-size: 14px; color: var(--ink-soft); }
.sample { margin-top: 16px; }
.sample audio { width: 100%; height: 40px; }
.sample-info { margin-top: 4px; font-size: 14px; color: var(--ink-soft); }
.dlg-field { margin-top: 18px; }
.dlg-field label { display: block; margin-bottom: 6px; font-weight: 700; }
.dlg-field input {
    width: 100%;
    min-height: 44px;
    padding: 0 14px;
    border: 1px solid var(--rule-strong);
    border-radius: 10px;
    background: var(--white);
}
.dlg-field input:focus { outline: none; border-color: var(--ink); box-shadow: 0 0 0 1px var(--ink); }
.consent { display: flex; align-items: flex-start; gap: 10px; margin-top: 14px; font-size: 15px; cursor: pointer; }
.consent input { flex: none; width: 18px; height: 18px; margin: 3px 0 0; accent-color: var(--ink); cursor: pointer; }
.dlg-status { min-height: 1.5em; margin-top: 12px; font-size: 15px; color: var(--ink-soft); }
.dlg-status[data-tone="error"] { color: var(--error); font-weight: 600; }
.dlg-foot { display: flex; justify-content: flex-end; gap: 10px; margin-top: 6px; }

.toast {
    position: fixed;
    left: 20px;
    bottom: 20px;
    z-index: 60;
    max-width: 360px;
    padding: 12px 16px;
    border-radius: 10px;
    background: var(--ink);
    color: #FFFFFF;
    font-size: 15px;
    opacity: 0;
    transform: translateY(8px);
    transition: opacity 0.2s, transform 0.2s;
    pointer-events: none;
}
.toast.on { opacity: 1; transform: none; }

/* ── narrower screens ── */
@media (max-width: 1099px) {
    :root { --gutter: 28px; }
    .desk { grid-template-columns: minmax(0, 1fr) 270px; column-gap: 36px; }
    .cast { padding-left: 24px; }
}
@media (max-width: 899px) {
    .desk { grid-template-columns: minmax(0, 1fr); }
    .script { padding-bottom: 20px; }
    .cast { padding: 20px 0 28px; border-left: 0; border-top: 1px solid var(--rule); }
    .voices { max-height: 280px; }
    .btn-add { width: auto; }
    .deck-actions { margin-left: 0; width: 100%; }
}
@media (max-width: 599px) {
    :root { --gutter: 16px; }
    .bar { min-height: 68px; padding: 0 70px 0 136px; gap: 8px; }
    .mark { font-size: 19px; }
    .bar-link { padding: 0 10px; }
    .bar-link-text { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
    .modes { width: 100%; }
    .mode { flex: 1; }
    .mode span { padding: 8px 10px; text-align: center; font-size: 14px; }
    #vtScript { height: 220px; padding: 16px 18px; font-size: 19px; }
    .btn-speak { width: 100%; margin-left: 0; }
    .deck-inner { padding-top: 20px; padding-bottom: 96px; }
    .deck-head { gap: 10px 14px; }
    .play { width: 52px; height: 52px; }
    .deck-actions .btn { flex: 1; padding: 0 12px; }
    .print-wrap { grid-template-columns: 40px minmax(0, 1fr); }
    .print-axis { font-size: 11px; }
    .print-axis span { right: 6px; }
    .print { height: 132px; }
    .print-message { padding: 0 16px; }
    .print-main { font-size: 17px; }
    .print-sub { font-size: 14px; }
    .caption { margin-left: 0; font-size: 19px; }
    .take { flex-basis: 164px; }
    .dlg { padding: 18px 18px 20px; }
    .passage { font-size: 17px; }
    .toast { left: 16px; right: 16px; max-width: none; }
}
@media (hover: none) {
    .keys { display: none; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { transition-duration: 0.01ms !important; animation: none !important; }
}
