/* AQC voice studio: warm paper and copper, right to left, phone first, as few words on screen as can be. */
:root {
  --bg: #f4efe6;
  --bg2: #ebe3d6;
  --card: #fffdf9;
  --ink: #1f1a14;
  --muted: #6b6152;
  --line: #e0d6c6;
  --accent: #b5522b;
  --accent-ink: #ffffff;
  --accent-soft: #f7e4d9;
  --rec: #d23a2f;
  --rec-soft: #fbe3df;
  --ok: #2f7a4b;
  --warn: #9a6512;
  --warn-soft: #f8ecd2;
  --bad: #b3261e;
  --bad-soft: #f9dedc;
  --bar: #1f1a14;
  --bar-ink: #f4efe6;
  --shadow: 0 1px 2px rgba(40, 30, 20, .06), 0 8px 24px rgba(40, 30, 20, .07);
  --radius: 16px;
  --prompt-scale: 1;
  --font: "Segoe UI", "SF Arabic", "Geeza Pro", "Noto Sans Arabic", "Noto Naskh Arabic", Tahoma, system-ui, sans-serif;
  --mono: ui-monospace, "SF Mono", Consolas, "Cascadia Mono", monospace;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #14110d;
    --bg2: #221d17;
    --card: #1c1813;
    --ink: #f2ebe0;
    --muted: #a69c8c;
    --line: #342d24;
    --accent: #e07a4b;
    --accent-ink: #1a120c;
    --accent-soft: #3a241a;
    --rec: #ff5a4d;
    --rec-soft: #3d1c19;
    --ok: #5fbf85;
    --warn: #e2b053;
    --warn-soft: #3a2d14;
    --bad: #ff8077;
    --bad-soft: #3d1b19;
    --bar: #0d0b08;
    --bar-ink: #f2ebe0;
    --shadow: 0 1px 2px rgba(0, 0, 0, .4), 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: 16px/1.6 var(--font); -webkit-tap-highlight-color: transparent; }
h1, h2 { line-height: 1.35; margin: 0 0 10px; }
h1 { font-size: 22px; }
h2 { font-size: 18px; }
p { margin: 0 0 10px; }
hr { border: 0; border-top: 1px solid var(--line); margin: 18px 0; }
a { color: var(--accent); }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; border-radius: 8px; }
[hidden] { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: 14px; }
.center { text-align: center; }
.icon { width: 20px; height: 20px; fill: currentColor; flex: none; }
.gap { height: 10px; }
.gap-top { margin-top: 10px; }

/* --- boot */
.boot { min-height: 100vh; display: grid; place-items: center; }
.boot-msg { color: var(--muted); text-align: center; padding: 24px; }

/* --- top bar */
.topbar { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 8px; padding: 8px 14px; background: var(--bar); color: var(--bar-ink); }
.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--bar-ink); text-decoration: none; font-weight: 700; white-space: nowrap; }
.brand .icon { width: 32px; height: 32px; padding: 6px; border-radius: 50%; background: var(--accent); color: #fff; }
.topbar-spacer { flex: 1; }
.topbar .btn-ghost { color: var(--bar-ink); border-color: transparent; }
.topbar .btn-ghost:hover { background: rgba(255, 255, 255, .08); }
.topbar .btn-ghost .icon { width: 24px; height: 24px; }
.pending-badge { font-size: 13px; padding: 3px 10px; border-radius: 999px; white-space: nowrap; font-family: var(--mono); }
.pending-badge:empty { display: none; }
.pending-badge.busy { background: #6b4b12; color: #fde9c4; }
.pending-badge.bad { background: #7a1f19; color: #ffe1de; }
.banner { background: var(--warn-soft); color: var(--warn); padding: 8px 14px; font-size: 14px; }

/* --- layout */
.main { max-width: 1100px; margin: 0 auto; padding: 16px 14px 60px; }
.main-wide { max-width: 1320px; }
.narrow { max-width: 440px; margin: 6vh auto; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow); margin-bottom: 14px; }

/* --- buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 44px; padding: 9px 16px; border: 1px solid var(--line); border-radius: 12px; background: var(--card); color: var(--ink); font: inherit; font-weight: 600; text-decoration: none; cursor: pointer; transition: background .15s, border-color .15s, transform .05s; }
.btn:hover { border-color: var(--muted); }
.btn:active { transform: translateY(1px); }
.btn[disabled] { opacity: .35; cursor: default; }
.btn-primary { background: var(--accent); color: var(--accent-ink); border-color: transparent; }
.btn-primary:hover { filter: brightness(1.05); border-color: transparent; }
.btn-ghost { background: transparent; border-color: transparent; }
.btn-ghost:hover { background: var(--bg2); border-color: transparent; }
.btn-small { min-height: 38px; padding: 5px 12px; font-size: 14px; border-radius: 10px; }
.btn-icon { width: 44px; height: 44px; min-height: 44px; padding: 0; border-radius: 50%; }
.icon-end { flex-direction: row-reverse; }

/* --- forms */
.field { display: block; margin: 0 0 14px; }
.field-label { display: block; font-weight: 600; margin-bottom: 6px; }
.field-help { display: block; color: var(--muted); font-size: 13px; margin-top: 4px; }
input, select, textarea { width: 100%; font: inherit; font-size: 16px; color: var(--ink); background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 11px 13px; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
input[type="checkbox"] { width: 20px; height: 20px; padding: 0; accent-color: var(--accent); flex: none; }
textarea { resize: vertical; line-height: 1.7; }
.edit-ar { font-size: 20px; font-weight: 600; }
.more { margin: 8px 0 12px; }
.more summary { cursor: pointer; color: var(--accent); font-weight: 600; padding: 4px 0; }
.form-error { background: var(--bad-soft); color: var(--bad); padding: 10px 12px; border-radius: 10px; margin-top: 10px; }
.warn-box { background: var(--warn-soft); color: var(--warn); padding: 10px 12px; border-radius: 10px; }
.toggle { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; white-space: nowrap; }
.select { flex: 1; min-width: 0; }
.form .btn[type="submit"] { width: 100%; margin-top: 6px; }

/* --- sign in */
.login { text-align: center; padding: 28px 22px; }
.login .field { text-align: start; }
.login-mark { width: 72px; height: 72px; margin: 0 auto 12px; border-radius: 50%; background: var(--accent); color: #fff; display: grid; place-items: center; }
.login-mark .icon { width: 36px; height: 36px; }

/* --- the characters */
.voice-grid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); }
.voice-card { display: flex; align-items: center; gap: 14px; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; box-shadow: var(--shadow); color: var(--ink); text-decoration: none; transition: transform .08s, border-color .15s; }
.voice-card:hover { border-color: var(--accent); }
.voice-card:active { transform: scale(.99); }
.vc-body { display: flex; flex-direction: column; gap: 2px; flex: 1; min-width: 0; line-height: 1.4; }
.vc-body strong { font-size: 18px; }
.vc-kind { color: var(--muted); font-size: 14px; }
.vc-count { color: var(--muted); font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.avatar { width: 52px; height: 52px; border-radius: 50%; display: grid; place-items: center; font-size: 24px; font-weight: 700; color: #fff; background: #7b6a55; flex: none; }
[data-group="plain"] .avatar { background: #2f6f8f; }
[data-group="character"] .avatar { background: #8a4fb0; }
[data-group="courier"] .avatar { background: #2f8f6f; }
[data-group="shop"] .avatar { background: #b5522b; }
[data-group="radio"] .avatar { background: #a17a1f; }
[data-group="narrator"] .avatar { background: #5b5148; }
[data-group="crew"] .avatar { background: #b03a5b; }
.bar { display: block; height: 6px; background: var(--bg2); border-radius: 999px; overflow: hidden; margin-top: 4px; }
.bar-fill { display: block; height: 100%; width: 0; background: var(--ok); border-radius: 999px; transition: width .4s; }

/* --- one character */
.voice-head { display: flex; align-items: center; gap: 12px; margin: 0 0 8px; }
.voice-head .avatar { width: 48px; height: 48px; font-size: 22px; }
.vh-text { flex: 1; min-width: 0; }
.vh-text h1 { margin: 0; font-size: 22px; }
.direction { color: var(--muted); font-size: 14px; margin: 0 0 14px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; cursor: pointer; }
.direction.open { display: block; -webkit-line-clamp: unset; overflow: visible; }
.voice-body { display: grid; gap: 14px; grid-template-columns: minmax(0, 1fr); }
.voice-view, .side { min-width: 0; }
@media (min-width: 980px) {
  .voice-body { grid-template-columns: minmax(0, 1fr) 360px; align-items: start; }
  .side { position: sticky; top: 72px; max-height: calc(100vh - 88px); display: flex; flex-direction: column; }
  .side .line-list { overflow: auto; flex: 1; max-height: none; }
}
@media (max-width: 640px) { .voice-head .roomless { display: none; } }
.side { padding: 12px; }
.filters { display: flex; gap: 10px; align-items: center; margin-bottom: 8px; }
.search { padding: 9px 12px; }
.line-list { list-style: none; margin: 0; padding: 0; max-height: 56vh; overflow: auto; }
.line-btn { display: flex; align-items: center; gap: 10px; width: 100%; text-align: start; font: inherit; color: var(--ink); background: transparent; border: 0; border-radius: 10px; padding: 9px 8px; cursor: pointer; }
.line-btn:hover { background: var(--bg2); }
.line-row.current .line-btn { background: var(--accent-soft); }
.dot { width: 10px; height: 10px; border-radius: 50%; border: 2px solid var(--muted); flex: none; }
.line-row.some .dot { border-color: var(--warn); background: var(--warn); }
.line-row.done .dot { border-color: var(--ok); background: var(--ok); }
.line-text { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 15px; }
.line-meta { font-size: 12px; color: var(--muted); font-family: var(--mono); white-space: nowrap; }
.panel { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow); min-width: 0; }
.panel-top { display: flex; align-items: center; gap: 10px; }
.situation { color: var(--muted); font-size: 14px; }
.prompt { font-size: calc(30px * var(--prompt-scale)); line-height: 1.75; font-weight: 700; margin: 14px 0 8px; }
.prompt-sound { font-style: italic; color: var(--muted); font-weight: 600; }
mark { background: var(--accent-soft); color: var(--accent); border-radius: 6px; padding: 0 4px; }
.hint { color: var(--muted); font-size: 14px; margin: 0 0 8px; }
.tag { display: inline-block; font-size: 13px; padding: 2px 10px; border-radius: 999px; background: var(--bg2); color: var(--ink); white-space: nowrap; }
.tag-shout { background: var(--rec-soft); color: var(--rec); font-weight: 700; }
.tag-warn { background: var(--warn-soft); color: var(--warn); }
.seg { display: inline-flex; border-radius: 12px; padding: 3px; gap: 3px; margin: 4px 0; background: var(--bg2); }
.seg-btn { font: inherit; font-weight: 600; padding: 7px 20px; border: 0; border-radius: 9px; background: transparent; color: var(--ink); cursor: pointer; }
.seg-btn.on { background: var(--card); color: var(--accent); box-shadow: 0 1px 3px rgba(0, 0, 0, .12); }

/* --- the record button, pinned to the foot of a phone's screen */
.rec-dock { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 16px 0; padding: 14px; background: var(--bg); border: 1px solid var(--line); border-radius: 20px; }
@media (max-width: 979px) {
  .rec-dock { position: sticky; bottom: 0; z-index: 10; margin: 16px -8px; box-shadow: 0 -6px 18px rgba(0, 0, 0, .12); background: var(--card); padding-bottom: calc(14px + env(safe-area-inset-bottom)); }
}
.nav-btn { width: 52px; height: 52px; border-radius: 50%; background: var(--bg2); }
.nav-btn .icon { width: 24px; height: 24px; }
.rec-center { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 8px; min-width: 0; }
.rec-btn { width: 84px; height: 84px; flex: none; border-radius: 50%; border: 0; background: var(--rec); color: #fff; display: grid; place-items: center; cursor: pointer; box-shadow: 0 4px 14px rgba(210, 58, 47, .35); transition: transform .08s; }
.rec-btn .icon { width: 38px; height: 38px; }
.rec-btn:active { transform: scale(.96); }
.rec-btn.on { animation: pulse 1.2s ease-in-out infinite; }
.rec-dock.shout .rec-btn { box-shadow: 0 0 0 6px var(--rec-soft), 0 4px 14px rgba(210, 58, 47, .35); }
@keyframes pulse { 0%, 100% { box-shadow: 0 0 0 0 rgba(210, 58, 47, .55); } 50% { box-shadow: 0 0 0 16px rgba(210, 58, 47, 0); } }
@media (prefers-reduced-motion: reduce) { .rec-btn.on { animation: none; } .bar-fill { transition: none; } }
.meter { display: block; width: 100%; max-width: 260px; height: 10px; border-radius: 999px; background: var(--bg2); overflow: hidden; }
.meter-fill { display: block; height: 100%; width: 100%; transform: scaleX(0); transform-origin: right center; background: var(--ok); transition: transform 60ms linear; }
.meter-fill.warm { background: #d9a223; }
.meter-fill.hot { background: var(--rec); }
.rec-timer { font-family: var(--mono); font-size: 15px; min-height: 22px; }
.is-recording .side { opacity: .5; pointer-events: none; }

/* --- takes */
.take { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; padding: 8px 10px; margin: 8px 0; border: 1px solid var(--line); border-radius: 14px; background: var(--bg); }
.take.waiting { border-style: dashed; }
.take.failed { background: var(--bad-soft); border-color: var(--bad); }
.take-ms { font-family: var(--mono); font-weight: 700; }
.take-who { color: var(--muted); font-size: 14px; flex: 1; min-width: 0; }
.play { background: var(--accent-soft); color: var(--accent); border-color: transparent; }
.play.on { background: var(--accent); color: var(--accent-ink); }
.next-missing { width: 100%; margin-top: 6px; }

/* --- dialogs and messages */
.overlay { position: fixed; inset: 0; z-index: 50; background: rgba(15, 10, 6, .5); display: flex; align-items: center; justify-content: center; padding: 16px; }
.modal { background: var(--card); border-radius: 18px; width: 100%; max-width: 520px; max-height: 92vh; overflow: auto; box-shadow: 0 20px 60px rgba(0, 0, 0, .35); }
.modal-head { display: flex; align-items: center; gap: 10px; padding: 12px 16px 0; }
.modal-head h2 { flex: 1; margin: 0; }
.modal-body { padding: 12px 16px; }
.modal-actions { display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-end; padding: 0 16px 16px; }
.set-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin: 10px 0; }
.set-label { font-weight: 600; }
.set-meter { max-width: none; margin: 4px 0 14px; }
.size-value { font-family: var(--mono); min-width: 48px; text-align: center; }
.set-links { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.toast { position: fixed; z-index: 60; left: 50%; bottom: 24px; transform: translate(-50%, 20px); opacity: 0; pointer-events: none; display: flex; align-items: center; gap: 12px; max-width: min(92vw, 560px); background: var(--bar); color: var(--bar-ink); padding: 12px 16px; border-radius: 14px; box-shadow: var(--shadow); transition: opacity .2s, transform .2s; }
.toast.show { opacity: 1; transform: translate(-50%, 0); pointer-events: auto; }
.toast-ok { background: var(--ok); color: #fff; }
.toast-error { background: var(--bad); color: #fff; }
.toast-warn { background: #8a5a0e; color: #fff; }
.toast-action { font: inherit; font-weight: 700; color: inherit; background: rgba(255, 255, 255, .18); border: 0; border-radius: 9px; padding: 5px 12px; cursor: pointer; }

/* --- downloads and the check */
.downloads .set-links { margin: 0 0 14px; }
.export-grid { display: grid; gap: 6px; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); }
.export-grid .btn { justify-content: flex-start; }
.table { width: 100%; border-collapse: collapse; }
.table td { text-align: start; padding: 9px 6px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.health tr.ok .icon { color: var(--ok); }
.health tr.bad .icon { color: var(--bad); }
.health tr.warn .icon { color: var(--warn); }
.health tr.bad td { background: var(--bad-soft); }
.log { white-space: pre-wrap; font-family: var(--mono); font-size: 12px; max-height: 320px; overflow: auto; background: var(--bg2); border-radius: 10px; padding: 10px; }
