/* Tusono v2 (Quick Listen, Studio Narration). Same palette and type as the main site. */
:root {
  --bg: #faf6f0; --surface: #ffffff; --surface-2: #f3ede4;
  --ink: #1e1a4d; --ink-2: #5d5870; --ink-3: #8f8a9e; --line: #e6dfd3;
  --accent: #e8502f; --accent-ink: #ffffff; --accent-soft: #fde8df;
  --focus: #3b5bdb; --danger: #c92a2a; --ok: #2b8a3e;
  --shadow: 0 1px 2px rgba(31, 27, 46, .06), 0 8px 24px rgba(31, 27, 46, .06);
  --radius: 16px;
  /* Indian scripts: Inter and Fraunces have none, so the script font (set by i18n.js) fills them in */
  --script-font: ;
  --serif: "Fraunces", var(--script-font) Georgia, "Times New Roman", serif;
  --sans: "Inter", var(--script-font) system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #15131c; --surface: #1e1b28; --surface-2: #262232;
    --ink: #f2eff7; --ink-2: #b6b0c6; --ink-3: #8a849b; --line: #322d40;
    --accent: #f07a52; --accent-ink: #1a1014; --accent-soft: #3a2420;
    --focus: #8ea6ff; --danger: #ff8787; --ok: #69db7c;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 24px rgba(0, 0, 0, .25);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 15px/1.5 var(--sans); }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: none; }
[hidden] { display: none !important; }
h1, h2 { font-family: var(--serif); font-weight: 700; margin: 0; letter-spacing: -.01em; }
h1 { font-size: clamp(26px, 5vw, 34px); }
h2 { font-size: 20px; }

/* header */

.wrap { max-width: 880px; margin: 0 auto; padding: 16px 16px 80px; }

/* tabs */
.intro { margin-bottom: 16px; }
.intro p { color: var(--ink-2); margin: 6px 0 0; max-width: 60ch; }

/* cards */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px; margin-bottom: 16px; }
.card-title { font-size: 17px; margin-bottom: 12px; }

.drop { position: relative; display: grid; justify-items: center; gap: 4px; text-align: center; padding: 26px 16px; border: 2px dashed var(--line); border-radius: 14px; background: var(--surface-2); cursor: pointer; transition: border-color .15s, background .15s; }
.drop:hover, .drop.over { border-color: var(--accent); background: var(--accent-soft); }
.drop svg { width: 32px; height: 32px; color: var(--accent); margin-bottom: 4px; }
.drop strong { font-size: 17px; }
.drop span { color: var(--ink-2); font-size: 13px; }
.drop input { position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; }

.or { display: flex; align-items: center; gap: 10px; color: var(--ink-3); font-size: 13px; margin: 14px 0; }
.or::before, .or::after { content: ""; flex: 1; height: 1px; background: var(--line); }

.link-row { display: flex; gap: 8px; }
.link-row input { flex: 1; min-width: 0; }
input[type="url"], input[type="password"], select, textarea {
  border: 1px solid var(--line); background: var(--surface); border-radius: 10px; padding: 10px 12px; width: 100%;
}
textarea { resize: vertical; margin: 10px 0; }
/* One arrow for every dropdown, the same in every browser, with room around it. */
select {
  appearance: none; -webkit-appearance: none; cursor: pointer; padding-right: 36px; text-overflow: ellipsis;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5l5 5 5-5' fill='none' stroke='%23888' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 13px center; background-size: 11px 8px;
}
select:hover { border-color: var(--ink-3); }
select:disabled { opacity: .55; cursor: not-allowed; }

.btn { display: inline-flex; align-items: center; gap: 6px; border-radius: 10px; padding: 10px 16px; border: 1px solid transparent; font-weight: 600; white-space: nowrap; }
.btn-primary { background: var(--accent); color: var(--accent-ink); }
.btn-ghost { background: var(--surface); border-color: var(--line); }
.btn-ghost:hover { border-color: var(--ink-3); }
.btn-sm { padding: 7px 12px; font-size: 14px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn svg { width: 16px; height: 16px; }

.row { display: flex; gap: 12px; margin-top: 14px; }
.row .field { max-width: 240px; }
.field { display: grid; gap: 6px; font-size: 13px; font-weight: 600; color: var(--ink-2); grid-template-columns: 1fr auto; align-items: center; }
.field > select, .field > input { grid-column: 1 / -1; }
.field .out { font-weight: 500; color: var(--ink-3); font-variant-numeric: tabular-nums; }
.controls { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 14px 18px; }
input[type="range"] { width: 100%; accent-color: var(--accent); }
.check { display: flex; gap: 8px; align-items: center; margin-top: 14px; font-size: 14px; color: var(--ink-2); }
.hint { color: var(--ink-3); font-size: 13px; margin: 10px 0 0; }
.notice { background: var(--accent-soft); border-radius: 12px; padding: 12px 14px; }
.paste summary { cursor: pointer; color: var(--ink-2); font-weight: 500; margin-top: 12px; }

/* status */
.status { display: grid; gap: 8px; padding: 12px 14px; border-radius: 12px; background: var(--surface-2); margin-bottom: 16px; font-size: 14px; }
.status.error { background: color-mix(in srgb, var(--danger) 14%, var(--surface)); color: var(--danger); }
.status.ok { color: var(--ok); }
.status-bar, .gen progress { width: 100%; height: 6px; accent-color: var(--accent); }

/* player */
.player-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.meta { color: var(--ink-3); font-size: 13px; margin: 4px 0 0; }
.gen { display: grid; grid-template-columns: 1fr auto; gap: 10px; align-items: center; font-size: 12px; color: var(--ink-3); margin-top: 12px; }
.transport { display: flex; align-items: center; gap: 10px; margin: 14px 0; flex-wrap: wrap; }
.transport input[type="range"] { flex: 1; min-width: 120px; }
.position { color: var(--ink-3); font-size: 13px; font-variant-numeric: tabular-nums; }
.waiting { color: var(--accent); font-size: 13px; animation: pulse 1.4s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .4; } }
@media (prefers-reduced-motion: reduce) { .waiting { animation: none; } }
.icon-btn { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 50%; border: 1px solid var(--line); background: var(--surface); }
.icon-btn:hover { border-color: var(--ink-3); }
.play-btn { display: grid; place-items: center; width: 54px; height: 54px; border-radius: 50%; border: 0; background: var(--accent); color: var(--accent-ink); box-shadow: var(--shadow); }
.play-btn svg { width: 22px; height: 22px; }
.play-btn svg path { fill: currentColor; stroke: none; }
.play-btn .i-pause, .play-btn.is-playing .i-play { display: none; }
.play-btn.is-playing .i-pause { display: block; }
.controls + .hint { margin-top: 12px; }
.player .controls { padding: 14px 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }

.reader { margin-top: 14px; padding: 4px 4px 4px 0; font-family: var(--serif); font-size: 18px; line-height: 1.75; }
.reader .sentence { scroll-margin: 24px 0; }
/* the text shown as a book: paragraphs, chapter headings, page markers */
.reader .para { margin: 0 0 .9em; }
.reader .chapter-head { font-family: var(--serif, Georgia, serif); font-size: 1.35em; line-height: 1.3; margin: 1.6em 0 .7em; color: var(--ink); }
.reader .chapter-head:first-child { margin-top: 0; }
.reader .page-mark { display: flex; align-items: center; gap: 10px; margin: 1.2em 0; color: var(--ink-3); font: 12px/1 var(--sans);
  letter-spacing: .04em; user-select: none; }
.reader .page-mark::before, .reader .page-mark::after { content: ""; flex: 1; border-top: 1px dashed var(--line); }
.reader .sentence { cursor: pointer; border-radius: 4px; transition: background .2s; }
.reader .sentence:hover { background: var(--surface-2); }
.reader .sentence.current { background: var(--accent-soft); box-shadow: 0 0 0 2px var(--accent-soft); }

.privacy { color: var(--ink-3); font-size: 13px; text-align: center; margin-top: 28px; }

@media (max-width: 560px) {
  .top-link { display: none; }
  .card { padding: 14px; }
  .player-head { flex-direction: column; }
  .reader { font-size: 17px; }
  .row .field { max-width: none; flex: 1; }
}

/* character picker */
.character-row { display: grid; gap: 8px; margin: 4px 0 16px; }
.field-label { font-size: 13px; font-weight: 600; color: var(--ink-2); }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { display: grid; text-align: left; gap: 1px; padding: 8px 12px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface); line-height: 1.25; }
.chip strong { font-size: 14px; font-weight: 600; }
.chip small { font-size: 12px; color: var(--ink-3); }
.chip:hover { border-color: var(--ink-3); }
.chip[aria-checked="true"] { border-color: var(--accent); background: var(--accent-soft); box-shadow: inset 0 0 0 1px var(--accent); }
.chip:disabled { cursor: default; }
.chip:disabled[aria-checked="true"] { opacity: 1; }
.source-characters { margin: 16px 0 0; }
.field-label small { font-weight: 400; color: var(--ink-3); }
@media (max-width: 560px) { .chip { padding: 7px 10px; } .chip small { display: none; } }

/* page picker */
.pager { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin: -4px 0 14px; }
.page-pick { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 600; color: var(--ink-2); }
.page-pick select { width: auto; padding: 6px 30px 6px 10px; font-weight: 500; background-position: right 10px center; }
.page-pick span { font-weight: 400; color: var(--ink-3); }
.pager #sNextSection { margin-left: auto; }

/* ---------- player bar ---------- */
.dock { position: relative; z-index: 5; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; margin: 12px 0; }
.dock { display: flex; flex-direction: column; }
.dock input.dock-progress { align-self: stretch; width: auto; min-width: 0; margin: 10px 14px 0; height: 4px; }
.dock-inner { padding: 10px 12px; display: flex; align-items: center; gap: 14px; }
.dock-buttons { display: flex; align-items: center; gap: 8px; flex: none; }
.where {
  flex: 1; min-width: 0; display: flex; align-items: center; justify-content: space-between; gap: 10px;
  border: 1px solid var(--line); background: var(--surface); border-radius: 12px; padding: 7px 12px; text-align: left;
}
.where:hover, .where[aria-expanded="true"] { border-color: var(--accent); }
.where-text { display: grid; min-width: 0; line-height: 1.3; }
.where-chapter { font-weight: 600; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.where-page, .where-part { font-size: 12px; color: var(--ink-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.where-icon { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 600; color: var(--accent); flex: none; }
.where-icon svg { width: 18px; height: 18px; }
.where .waiting { font-size: 12px; }

.contents {
  position: absolute; right: 0; top: calc(100% + 8px);
  width: min(560px, calc(100vw - 32px)); max-height: min(65vh, 620px); overflow-y: auto;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 4px 16px 16px;
}
.contents-top { position: sticky; top: 0; z-index: 1; background: var(--surface); padding-bottom: 8px; border-bottom: 1px solid var(--line); }
.contents-head { display: flex; justify-content: space-between; align-items: center; padding: 10px 0 6px; }
.contents-head strong { font-family: var(--serif); font-size: 18px; }
.contents-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.toc-hint { margin: 8px 0 4px; }
.toc-block h3 { font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-3); margin: 16px 0 6px; }
.toc { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.toc-item { width: 100%; display: grid; gap: 1px; text-align: left; border: 0; background: transparent; border-radius: 10px; padding: 8px 10px; }
.toc-item:hover { background: var(--surface-2); }
.toc-item.current { background: var(--accent-soft); }
.toc-title { font-weight: 600; font-size: 14px; }
.toc-meta { font-size: 12px; color: var(--ink-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.next-section { margin-top: 12px; }

@media (max-width: 560px) {
  .dock-inner { gap: 10px; padding: 8px 12px; }
  .dock .icon-btn { width: 36px; height: 36px; }
  .dock .play-btn { width: 48px; height: 48px; }
  .where { padding: 6px 10px; }
  .where-icon { font-size: 0; gap: 0; }          /* icon only on phones */
}

/* user menu */

/* ---------- reading layout: only the text scrolls ---------- */
.settings-wrap > summary { cursor: pointer; list-style: none; display: flex; align-items: center; justify-content: space-between; font-weight: 600; }
.settings-wrap > summary::-webkit-details-marker { display: none; }
.settings-wrap > summary::after { content: attr(data-hide); font: 500 13px var(--sans); color: var(--accent); }
.settings-wrap:not([open]) > summary::after { content: attr(data-show); }
.player .settings-wrap { border-top: 1px solid var(--line); padding-top: 12px; margin-top: 4px; }
.player .settings-wrap > summary { font-size: 14px; margin-bottom: 10px; }
.player .settings-wrap:not([open]) > summary { margin-bottom: 0; }
.head-actions { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.open-another { display: none; }

body.reading { height: 100dvh; overflow: hidden; display: flex; flex-direction: column; }
body.reading .appbar { flex: none; }
body.reading .wrap { flex: 1; min-height: 0; width: 100%; display: flex; flex-direction: column; padding-bottom: 12px; }

body.reading #privacyNote { display: none; }
.panel.reading { flex: 1; min-height: 0; display: flex; flex-direction: column; gap: 8px; }
.panel.reading > .intro, .panel.reading > .source { display: none; }
.panel.reading > .card, .panel.reading > .status, .panel.reading > .notice, .panel.reading .player > * { margin: 0; }
.panel.reading .player { display: contents; }
.panel.reading .open-another { display: inline-flex; }
.panel.reading .player-head { order: 1; flex: none; }
.panel.reading .gen { order: 2; flex: none; }
.panel.reading .dock { order: 3; flex: none; }
.panel.reading .settings-wrap { order: 4; flex: none; max-height: 40vh; overflow-y: auto; padding: 10px 14px; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; box-shadow: none; }
.panel.reading .settings-wrap .controls { border: 0; padding: 0; }
/* while reading: one compact row of characters; selects and sliders behind "More settings" */
.more-toggle { display: none; border: 0; background: none; color: var(--accent); font-weight: 600; font-size: 13px; padding: 6px 0 0; }
.panel.reading .more-toggle { display: inline-block; }
.panel.reading .settings-wrap > summary { margin-bottom: 8px; font-size: 14px; }
.panel.reading .settings-wrap:not([open]) > summary { margin-bottom: 0; }
.panel.reading .settings-wrap:not(.more) :is(.controls, .check, .hint, #sGpuRow) { display: none; }
.panel.reading .settings-wrap.more .controls { margin-top: 10px; }
.panel.reading .settings-wrap .character-row { margin: 0; gap: 6px; }
.panel.reading .settings-wrap .field-label { display: none; }
.panel.reading .chips { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: thin; padding-bottom: 2px; }
.panel.reading .chip { flex: none; padding: 6px 12px; }
.panel.reading .chip small { display: none; }
.panel.reading .next-section { order: 5; flex: none; align-self: flex-start; }
.panel.reading > .status, .panel.reading > .notice { order: 6; flex: none; }
.panel.reading .reader {
  order: 7; flex: 1; min-height: 120px; overflow-y: auto; overscroll-behavior: contain;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 18px;
}
@media (max-width: 560px) {
  .panel.reading .player-head { flex-direction: row; align-items: center; }
  .panel.reading .player-head h2 { font-size: 17px; }
  .panel.reading .player-head .meta { display: none; }
  .panel.reading .gen { margin-top: 0; }
  .panel.reading .reader { padding: 10px 12px; }

}

/* news front pages */
.reader .news-section { display: block; font-size: 13px; font-family: var(--sans); font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--accent); margin: 18px 0 6px; }
.reader .news-section:first-child { margin-top: 0; }
.reader .headline { display: block; padding: 4px 0; }
.read-story { margin-left: 6px; border: 1px solid var(--line); background: var(--surface); color: var(--accent); border-radius: 999px; padding: 1px 10px; font: 600 12px var(--sans); vertical-align: middle; white-space: nowrap; }
.read-story:hover { border-color: var(--accent); }

/* ---------- Story telling tab: the phase-1 site in a frame that fills the screen ---------- */
body.frame-tab { height: 100dvh; overflow: hidden; display: flex; flex-direction: column; }
body.frame-tab .wrap { flex: 1; min-height: 0; max-width: none; width: 100%; padding: 0; display: flex; flex-direction: column; }
body.frame-tab #privacyNote { display: none; }
.panel-frame { flex: 1; min-height: 0; display: flex; }
.panel-frame iframe { flex: 1; width: 100%; height: 100%; border: 0; border-top: 1px solid var(--line); background: var(--bg); }
@media (max-width: 560px) {
}

/* ---------- processing window (Studio) ---------- */
.job { display: grid; gap: 10px; }
.job-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.job-file { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.job-pct { font-variant-numeric: tabular-nums; color: var(--ink-2); font-weight: 600; }
.job-bar { height: 10px; border-radius: 999px; background: var(--surface-2); overflow: hidden; }
.job-bar span { display: block; height: 100%; width: 0; background: var(--accent); border-radius: inherit; transition: width .4s ease; }
.job-bar.indeterminate span { width: 30%; animation: slide 1.2s ease-in-out infinite; }
@keyframes slide { from { transform: translateX(-100%); } to { transform: translateX(340%); } }
@media (prefers-reduced-motion: reduce) { .job-bar.indeterminate span { animation: none; width: 100%; opacity: .4; } }
.job-stage { margin: 0; color: var(--ink-2); }
.job .hint { margin: 0; }
.job .btn { justify-self: start; }

/* ---------- one header for the whole app (same sizes as the phase-1 header), tabs below ---------- */
.appbar { position: sticky; top: 0; z-index: 30; background: color-mix(in srgb, var(--bg) 86%, transparent); backdrop-filter: blur(14px); border-bottom: 1px solid var(--line); }
.site-header { border-bottom: 1px solid var(--line); }
.header-inner { max-width: 1120px; margin: 0 auto; padding: 12px 24px; display: flex; align-items: center; gap: 28px; }
.brand { display: flex; align-items: center; gap: 10px; color: var(--ink); text-decoration: none; flex: none; }
.wordmark { display: block; line-height: 0; }
.wordmark img { height: 32px; width: auto; display: block; }
.tagline { font-size: 12px; color: var(--ink-3); padding-left: 12px; margin-left: 2px; border-left: 1px solid var(--line); line-height: 1.2; white-space: nowrap; }
.site-nav { display: flex; gap: 4px; flex: 1; }
.site-nav a { padding: 8px 12px; border-radius: 999px; color: var(--ink-2); font-size: 14px; font-weight: 500; text-decoration: none; white-space: nowrap; }
.site-nav a:hover { background: var(--surface-2); color: var(--ink); }
.header-spacer { flex: 1; }
.bell-wrap { position: relative; }
.bell { position: relative; }
.bell .badge { position: absolute; top: 4px; right: 4px; min-width: 17px; height: 17px; padding: 0 4px; border-radius: 99px; background: var(--accent); color: var(--accent-ink); font-size: 11px; font-weight: 600; display: grid; place-items: center; }
.user-wrap { position: relative; }
.user-chip { display: flex; align-items: center; gap: 8px; padding: 4px 12px 4px 4px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); font-size: 14px; font-weight: 500; }
.user-chip:hover { border-color: var(--accent); }
.lang-pick { display: inline-flex; align-items: center; gap: 6px; color: var(--ink-2); }
.lang-pick svg { width: 18px; height: 18px; }
.lang-pick select { width: auto; border-radius: 999px; padding: 6px 30px 6px 12px; font-size: 14px; background-color: var(--surface); background-position: right 11px center; }
.user-menu { position: absolute; right: 0; top: calc(100% + 6px); z-index: 35; min-width: 190px; padding: 6px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow); display: flex; flex-direction: column; }
.user-menu[hidden] { display: none; }
.user-menu button { text-align: left; border: 0; background: none; padding: 10px 12px; border-radius: 8px; font-size: 14px; }
.user-menu button:hover { background: var(--surface-2); }
.user-menu .danger { color: var(--danger); }
.avatar-slot { --size: 28px; width: var(--size); height: var(--size); border-radius: 50%; flex: none; overflow: hidden; position: relative; display: grid; place-items: center; font-size: calc(var(--size) * .58); line-height: 1; background: var(--surface-2); }
.avatar-slot img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; display: block; }
.notif-panel { position: absolute; right: 0; top: calc(100% + 6px); z-index: 35; width: min(360px, calc(100vw - 24px)); background: var(--surface); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow); }
.notif-head { padding: 12px 14px; border-bottom: 1px solid var(--line); }
.notif-list { list-style: none; margin: 0; padding: 4px; max-height: 420px; overflow-y: auto; }
.notif-list li button { display: flex; gap: 10px; align-items: flex-start; width: 100%; border: 0; background: none; text-align: left; padding: 10px; border-radius: 10px; font-size: 14px; }
.notif-list li button:hover { background: var(--surface-2); }
.notif-list li.unread button { background: color-mix(in srgb, var(--accent) 8%, transparent); }
.notif-list .when { display: block; color: var(--ink-3); font-size: 12px; margin-top: 2px; }
.notif-empty { padding: 22px 14px; color: var(--ink-3); font-size: 14px; text-align: center; }

.tabs { display: grid; grid-template-columns: repeat(2, 1fr); gap: 6px; padding: 5px; background: var(--surface-2); border-radius: 14px; width: min(880px, calc(100% - 32px)); margin: 8px auto; }
.tab-cell { position: relative; display: flex; }
.tabs [role="tab"] { flex: 1; display: flex; align-items: center; justify-content: center; gap: 8px; border: 0; background: transparent; border-radius: 10px; padding: 10px 30px; font-weight: 600; color: var(--ink-2); }
.tabs [role="tab"][aria-selected="true"] { background: var(--surface); color: var(--ink); box-shadow: var(--shadow); }
.tabs [role="tab"][aria-selected="true"] svg { color: var(--accent); }
/* star: the tab Tusono opens on */
.tab-default { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); width: 26px; height: 26px; display: grid; place-items: center; border: 0; background: none; border-radius: 50%; color: var(--ink-3); opacity: 0; transition: opacity .15s; }
.tab-default svg { width: 16px; height: 16px; }
.tab-cell:hover .tab-default, .tab-default:focus-visible, .tab-cell:has([aria-selected="true"]) .tab-default { opacity: .8; }
.tab-default[aria-pressed="true"] { opacity: 1; color: var(--accent); }
.tab-default[aria-pressed="true"] svg { fill: currentColor; }
.tab-default:hover { background: var(--surface-2); opacity: 1; }

.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 60; background: var(--ink); color: var(--bg); padding: 10px 16px; border-radius: 12px; font-size: 14px; box-shadow: var(--shadow); max-width: calc(100vw - 32px); }

body.frame-tab .appbar .tabs { margin-bottom: 8px; }
@media (max-width: 760px) {
  .header-inner { flex-wrap: wrap; gap: 8px 12px; padding: 10px 16px 6px; }
  .brand { margin-right: auto; }
  .site-nav { order: 3; flex-basis: 100%; overflow-x: auto; scrollbar-width: none; margin: 0 -8px; }
  .site-nav::-webkit-scrollbar { display: none; }
  .tagline { display: none; }
  .wordmark img { height: 28px; }
  .header-inner { gap: 8px 10px; }
  .lang-pick svg { display: none; }
  .lang-pick select { padding: 5px 26px 5px 10px; font-size: 13px; max-width: 120px; background-position: right 9px center; }
}
@media (max-width: 560px) {
  .tabs [role="tab"] { font-size: 13px; gap: 5px; padding: 9px 22px 9px 4px; }
  .tabs [role="tab"] svg { width: 16px; height: 16px; }
  .tab-default { right: 2px; }
}
body.frame-tab .appbar { flex: none; }
.site-nav a[aria-current="page"] { color: var(--accent); }

/* intro lead + who it is for */
.intro .lead { font-family: var(--serif); font-size: clamp(18px, 2.6vw, 21px); font-weight: 600; color: var(--ink); margin-top: 8px; }
.uses { list-style: none; display: flex; flex-wrap: wrap; gap: 8px; padding: 0; margin: 14px 0 0; }
.uses li { font-size: 13px; font-weight: 500; color: var(--ink-2); background: var(--surface); border: 1px solid var(--line); border-radius: 999px; padding: 5px 12px; }

/* link suggestions */
.suggest-row { display: flex; align-items: center; gap: 10px; margin-top: 10px; font-size: 13px; color: var(--ink-2); }
.suggest-row select { flex: 1; min-width: 0; max-width: 420px; }

.voice-help summary { cursor: pointer; color: var(--accent); font-weight: 500; }
.voice-help p { margin: 6px 0 0; }
/* signed out: the empty account box takes no space next to "Sign in" */
.user-wrap:not(:has(> .user-chip:not([hidden]))) { display: none; }
/* every label in a settings row starts at the same height (sliders are shorter than dropdowns) */
.controls .field { align-content: start; }

/* natural voices (Gemini, the listener's own key) */
.info-btn { display: inline-grid; place-items: center; width: 18px; height: 18px; margin-left: 6px; border-radius: 50%; border: 1px solid var(--ink-3); background: none; color: var(--ink-2); font: italic 600 11px/1 Georgia, serif; cursor: pointer; vertical-align: 1px; padding: 0; }
.info-btn:hover, .info-btn[aria-expanded="true"] { border-color: var(--accent); color: var(--accent); }
.gemini-box { position: relative; margin-top: 14px; padding: 14px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface-2); font-size: 13px; color: var(--ink-2); }
.gemini-box p { margin: 0 0 10px; }
.gemini-box .link-row input { font-family: ui-monospace, monospace; }
.gemini-links { display: flex; gap: 14px; flex-wrap: wrap; align-items: center; margin-top: 10px !important; }
.gemini-links a { color: var(--accent); font-weight: 500; }
.linklike { border: 0; background: none; padding: 0; color: var(--ink-2); text-decoration: underline; cursor: pointer; font-size: 13px; }
.gemini-status:empty { display: none; }
.gemini-status { margin: 8px 0 0 !important; font-weight: 500; }
.gemini-status.error { color: var(--danger, #c0392b); }
.panel.reading .settings-wrap:not(.more) .gemini-box { display: none; }

/* One page width for both tabs: the header's (and the Story telling page's) 1120px with the same
   side gutters, so the logo, the tabs and the content keep their edges when switching tabs. */
:root { --page: 1120px; --gutter: 24px; }
@media (max-width: 560px) { :root { --gutter: 16px; } }
.header-inner { padding-left: var(--gutter); padding-right: var(--gutter); }
.wrap { max-width: var(--page); padding-left: var(--gutter); padding-right: var(--gutter); }
.tabs { width: min(calc(var(--page) - 2 * var(--gutter)), calc(100% - 2 * var(--gutter))); }
/* the wider page keeps a comfortable line length for reading */
.panel.reading .reader { padding-inline: max(18px, calc((100% - 74ch) / 2)); }
@media (max-width: 560px) { .panel.reading .reader { padding-inline: 12px; } }
.intro p { max-width: 72ch; }
.gemini-box > p:first-of-type { padding-right: 28px; }
.gemini-close { position: absolute; top: 8px; right: 8px; width: 28px; height: 28px; border: 0; border-radius: 50%; background: none; color: var(--ink-2); font-size: 20px; line-height: 1; cursor: pointer; }
.gemini-close:hover { background: var(--surface); color: var(--ink); }

/* ---- sign in on this page (Google's button) */
.signin-dialog { width: min(400px, calc(100vw - 32px)); border: 1px solid var(--line); border-radius: 20px; padding: 28px 24px 20px;
  background: var(--surface); color: var(--ink); box-shadow: 0 24px 64px rgba(20, 16, 40, .28); text-align: center; position: fixed; }
.signin-dialog::backdrop { background: rgba(20, 16, 40, .45); backdrop-filter: blur(2px); }
.signin-dialog .gemini-close { position: absolute; top: 10px; right: 10px; }
.signin-logo { display: block; margin: 0 auto 10px; }
.signin-sub { color: var(--ink-2); margin: 6px 0 18px; }
.gsi-slot { display: flex; justify-content: center; min-height: 44px; }
.gsi-slot:empty { min-height: 0; }
.signin-google { width: 100%; max-width: 320px; justify-content: center; border-radius: 999px; padding: 11px 16px; }
.signin-google .g-logo { width: 18px; height: 18px; }
.signin-legal { color: var(--ink-3); font-size: 12px; margin: 18px 0 0; }
.signin-legal a, .ql-about a { color: var(--ink-2); }
.ql-about { margin: 8px 0 0; font-size: 13px; }
.form-error { color: var(--danger); font-size: 14px; margin: 10px 0 0; }
.btn-danger { background: var(--danger); color: #fff; }

/* ---- web pages: publisher credit and link back */
.source-line { margin: 2px 0 0; font-size: 13px; color: var(--ink-3); }
.source-line a { color: var(--accent); font-weight: 600; text-decoration: none; }
.source-line a::after { content: " ↗"; }
.source-line .src-note { display: block; margin-top: 2px; font-style: italic; }

/* ---- phone number check (SMS code) */
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.phone-dialog .ph-row { display: flex; gap: 8px; }
.phone-dialog select, .phone-dialog input { font: inherit; color: var(--ink); background: var(--bg); border: 1px solid var(--line);
  border-radius: 12px; padding: 11px 12px; min-height: 46px; width: 100%; box-sizing: border-box; }
.phone-dialog .ph-prefix { flex: 0 0 auto; display: flex; align-items: center; padding: 0 12px; border: 1px solid var(--line);
  border-radius: 12px; background: var(--bg); color: var(--ink-2); white-space: nowrap; }
.phone-dialog .ph-number { flex: 1; min-width: 0; }
.phone-dialog .ph-code { text-align: center; font-size: 22px; letter-spacing: .4em; padding-left: calc(12px + .4em); }
.phone-dialog .ph-main { width: 100%; margin-top: 12px; justify-content: center; }
.phone-dialog .ph-sent { margin: 0 0 10px; color: var(--ink-2); }
.phone-dialog .ph-shown { text-align: center; color: var(--ink-2); background: var(--surface); margin-bottom: 10px; cursor: default; }
.phone-dialog .ph-links { display: flex; justify-content: space-between; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
.phone-dialog .link-btn { background: none; border: 0; padding: 4px 0; color: var(--ink-2); font: inherit; font-size: 14px;
  text-decoration: underline; cursor: pointer; }
.phone-dialog .link-btn:disabled { color: var(--ink-3); text-decoration: none; cursor: default; }
.phone-dialog .ph-later { margin-top: 14px; }
.pf-phone h3 { margin: 0 0 4px; font-size: 16px; }
.pf-phone p { margin: 0 0 10px; color: var(--ink-2); }
.pf-phones { list-style: none; margin: 0 0 10px; padding: 0; }
.pf-phones li { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 10px 0; border-bottom: 1px solid var(--line); }
.pf-phones li:last-child { border-bottom: 0; }
.pf-phone-number { font-weight: 600; font-variant-numeric: tabular-nums; }
.pf-verified { display: inline-flex; align-items: center; gap: 4px; color: #1a8f4c; font-size: 13px; font-weight: 600; }
.pf-phone-actions { margin-left: auto; display: flex; gap: 14px; }
.pf-phone .link-btn, .phone-dialog .link-btn { background: none; border: 0; padding: 4px 0; color: var(--ink-2); font: inherit;
  font-size: 14px; text-decoration: underline; cursor: pointer; }

/* ---- Review page (admins) */
.rv-head { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; }
.rv-head h1 { font-size: 26px; }
.rv-count { color: var(--accent); font-weight: 600; }
.rv-states { display: flex; gap: 8px; margin: 14px 0 16px; flex-wrap: wrap; }
.rv-states button { font: inherit; padding: 7px 14px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface);
  color: var(--ink-2); cursor: pointer; }
.rv-states button[aria-pressed="true"] { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.rv-top { display: flex; gap: 14px; align-items: flex-start; }
.rv-cover { width: 84px; height: 84px; border-radius: 12px; object-fit: cover; flex: 0 0 auto; background: var(--surface-2); }
.rv-cover-none { display: grid; place-items: center; font-size: 28px; color: var(--ink-3); }
.rv-info { min-width: 0; }
.rv-info h3 { margin: 0 0 2px; font-family: var(--serif); font-size: 19px; }
.rv-meta { margin: 0 0 6px; color: var(--ink-3); font-size: 13px; }
.rv-synopsis { margin: 0 0 4px; color: var(--ink-2); }
.rv-moral { margin: 0; color: var(--ink-3); font-size: 14px; font-style: italic; }
.rv-why { margin: 12px 0 0; padding: 10px 12px; border-radius: 12px; background: #fff6e5; color: #6b4a00; font-size: 14px; }
.rv-reasons { margin: 4px 0 0; padding-left: 18px; }
.rv-clean { margin: 4px 0 0; }
.rv-audio { width: 100%; margin-top: 12px; }
.rv-actions { display: flex; gap: 10px; margin-top: 12px; }
.rv-admins h2 { font-size: 20px; margin-bottom: 4px; }
.rv-admin-list { list-style: none; margin: 8px 0 12px; padding: 0; }
.rv-admin-list li { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.rv-email { font-weight: 600; word-break: break-all; }
.rv-role { font-size: 12px; padding: 2px 8px; border-radius: 999px; background: var(--surface-2); color: var(--ink-2); }
.rv-role-super { background: var(--accent-soft); color: var(--accent); }
.rv-admin-list .link-btn { margin-left: auto; background: none; border: 0; color: var(--ink-2); text-decoration: underline; cursor: pointer; font: inherit; font-size: 14px; }
.rv-add { display: flex; gap: 8px; flex-wrap: wrap; }
.rv-add input { flex: 1 1 220px; font: inherit; padding: 10px 12px; border-radius: 12px; border: 1px solid var(--line); background: var(--bg); color: var(--ink); }
@media (prefers-color-scheme: dark) { .rv-why { background: #3a2f12; color: #f3d98b; } }

/* ---- Bulk create (super admins) */
.bulk-page h1 { font-size: 26px; }
.bk-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.bk-row + .bk-row, .bk-langs-box + .bk-row { margin-top: 12px; }
.bk-row label.btn { cursor: pointer; }
.bk-row .link-btn { background: none; border: 0; color: var(--ink-2); text-decoration: underline; cursor: pointer; font: inherit; }
.bk-langs-box { border: 1px solid var(--line); border-radius: 12px; margin: 12px 0 0; padding: 8px 12px 10px; }
.bk-langs-box legend { font-size: 13px; color: var(--ink-3); padding: 0 4px; }
.bk-langs { display: flex; flex-wrap: wrap; gap: 8px 18px; }
.bk-lang { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; }
.bk-summary { margin: 10px 0 0; font-weight: 600; }
.bk-publish { margin-top: 12px; flex-wrap: wrap; }
.bk-summary:empty { display: none; }
.bk-table-wrap { overflow-x: auto; margin-top: 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); }
.bk-table { border-collapse: collapse; width: 100%; font-size: 14px; }
.bk-table th, .bk-table td { padding: 8px 10px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; white-space: nowrap; }
.bk-table thead th, .bk-table tfoot th { background: var(--surface-2); font-size: 13px; }
.bk-table .bk-name { max-width: 280px; overflow: hidden; text-overflow: ellipsis; }
.bk-table td small { display: block; color: var(--ink-3); font-size: 12px; white-space: normal; max-width: 220px; }
.bk-table .bk-skip { color: var(--ink-3); }
.bk-table .bk-bad { color: var(--danger); white-space: normal; max-width: 220px; }
.bk-table .bk-none { color: var(--ink-3); }
.bk-table .bk-completed { color: #1a8f4c; font-weight: 600; }
.bk-table .bk-failed { color: var(--danger); white-space: normal; max-width: 220px; }
.bk-table .bk-running { color: var(--accent); }
.bk-table .bk-total { font-weight: 600; }
.bk-where { margin-top: 4px; font-size: 12px; color: var(--ink-2); white-space: normal; }
.bk-where summary { cursor: pointer; color: var(--accent); }
.bk-flags { margin: 4px 0 0; padding-left: 16px; }
.bk-flags .link-btn { background: none; border: 0; padding: 0; color: var(--accent); text-decoration: underline; cursor: pointer; font: inherit; }

/* ---- My profile */
body.profile-open #privacyNote { display: none; }
#panel-profile { padding-top: 16px; }
.pf-head { display: flex; gap: 18px; align-items: center; }
.pf-avatar { --size: 84px; }
.pf-who { min-width: 0; }
.pf-who h1 { font-size: clamp(22px, 4.5vw, 28px); overflow-wrap: anywhere; }
.pf-at { color: var(--ink-3); margin: 2px 0 8px; }
.pf-stats { list-style: none; display: flex; flex-wrap: wrap; gap: 4px 16px; margin: 0 0 8px; padding: 0; color: var(--ink-2); font-size: 14px; }
.pf-stats strong { color: var(--ink); }
.pf-public { font-size: 14px; color: var(--accent); font-weight: 600; }
.pf-photo { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; margin-bottom: 14px; }
.pf-photo .hint { flex-basis: 100%; margin: 0; }
.pf-presets { display: grid; grid-template-columns: repeat(auto-fill, minmax(44px, 1fr)); gap: 8px; margin: 8px 0 16px; max-width: 520px; }
.pf-presets button { aspect-ratio: 1; border-radius: 50%; border: 2px solid transparent; font-size: 22px; line-height: 1; display: grid; place-items: center; }
.pf-presets button[aria-checked="true"] { border-color: var(--accent); box-shadow: 0 0 0 2px var(--surface) inset; }
.pf-field { display: grid; gap: 6px; margin-bottom: 14px; font-size: 13px; font-weight: 600; color: var(--ink-2); max-width: 520px; }
.pf-field em { font-style: normal; font-weight: 400; color: var(--ink-3); float: right; }
.pf-field small { font-weight: 400; color: var(--ink-3); }
.pf-field input, .pf-field textarea { width: 100%; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); font-weight: 400; font-size: 15px; color: var(--ink); }
.pf-field textarea { resize: vertical; }
.pf-handle { display: flex; align-items: center; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); padding-left: 12px; }
.pf-handle span { color: var(--ink-3); font-weight: 400; }
.pf-handle input { border: 0; padding-left: 4px; background: transparent; }
.pf-handle:focus-within { outline: 2px solid var(--focus); outline-offset: 2px; }
.pf-handle input:focus-visible { outline: none; }
.pf-actions { display: flex; gap: 10px; justify-content: flex-end; max-width: 520px; }
.pf-account > summary { cursor: pointer; font-weight: 600; color: var(--ink-2); }
.pf-account[open] > summary { margin-bottom: 12px; }
.pf-account h3 { margin: 0 0 4px; font-size: 16px; color: var(--danger); }
.pf-account p { color: var(--ink-2); margin: 0 0 12px; max-width: 60ch; }
@media (max-width: 560px) {
  .pf-head { flex-direction: column; text-align: center; }
  .pf-stats { justify-content: center; }
  .pf-actions { justify-content: stretch; }
  .pf-actions .btn { flex: 1; justify-content: center; }
}
