/* Owlscribe website. Works from phone width up; light and dark follow the device. */
:root {
  --bg: #f6f3ee;
  --surface: #ffffff;
  --surface-2: #efebe4;
  --text: #1f1d1a;
  --muted: #6d675e;
  --line: #e2dcd2;
  --accent: #9a6b16;        /* owl gold */
  --accent-text: #ffffff;
  --accent-soft: #f4e7cc;
  --green: #2f8a4c;
  --green-soft: #dff1e5;
  --orange: #b4560d;
  --orange-soft: #fbe6d4;
  --blue: #2a64b3;
  --blue-soft: #dfe9f8;
  --cyan: #0f8193;
  --red: #b3261e;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(0,0,0,.05), 0 2px 10px rgba(0,0,0,.04);
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #161513;
    --surface: #211f1c;
    --surface-2: #2b2925;
    --text: #efebe4;
    --muted: #a59e92;
    --line: #38352f;
    --accent: #d9a441;
    --accent-text: #1b1406;
    --accent-soft: #3a2f19;
    --green: #5cc27d;
    --green-soft: #1d3326;
    --orange: #f0954a;
    --orange-soft: #3a2616;
    --blue: #7aa7ec;
    --blue-soft: #1c2a40;
    --cyan: #4fc6d6;
    --red: #f2827a;
    --shadow: none;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 16px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 1.6rem; line-height: 1.25; margin: 0 0 .25rem; }
h2 { font-size: 1.15rem; margin: 2rem 0 .75rem; }
h3 { font-size: 1rem; margin: 0; }
p { margin: .4rem 0; }
.muted { color: var(--muted); }
.small { font-size: .875rem; }

/* layout */
.top {
  position: sticky; top: 0; z-index: 10; background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); border-bottom: 1px solid var(--line);
}
.top-inner { max-width: 980px; margin: 0 auto; padding: 10px 16px; display: flex; align-items: center; gap: 12px; }
.brand { display: flex; align-items: center; gap: 8px; font-weight: 700; color: var(--text); font-size: 1.1rem; }
.brand img { width: 30px; height: 30px; border-radius: 7px; }
.brand:hover { text-decoration: none; }
@media (max-width: 420px) { .brand-name { display: none; } .top nav .btn { padding: 0 10px; } }
.top nav { margin-left: auto; display: flex; align-items: center; gap: 8px; }
main { max-width: 980px; margin: 0 auto; padding: 24px 16px 80px; }
.crumbs { font-size: .9rem; color: var(--muted); margin-bottom: 6px; }
.row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.spacer { flex: 1; }
.stack > * + * { margin-top: 12px; }

/* buttons and fields */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 44px; padding: 0 16px; border-radius: 10px; border: 1px solid var(--line);
  background: var(--surface); color: var(--text); font: inherit; font-weight: 600; cursor: pointer;
  text-decoration: none !important; white-space: nowrap;
}
.btn:hover { background: var(--surface-2); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }
.btn.primary:hover { filter: brightness(1.06); }
.btn.danger { color: var(--red); }
.btn.small { min-height: 36px; padding: 0 12px; font-size: .9rem; }
.btn[disabled] { opacity: .45; cursor: default; }
label { display: block; font-weight: 600; margin-bottom: 6px; }
.field + .field { margin-top: 16px; }
.hint { font-size: .85rem; color: var(--muted); margin-top: 4px; font-weight: 400; }
input[type=text], input[type=search], select {
  width: 100%; min-height: 44px; padding: 8px 12px; border-radius: 10px; border: 1px solid var(--line);
  background: var(--surface); color: var(--text); font: inherit;
}
input:focus-visible, .btn:focus-visible, select:focus-visible, .drop:focus-within {
  outline: 3px solid color-mix(in srgb, var(--accent) 45%, transparent); outline-offset: 1px;
}
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 640px) { .grid2 { grid-template-columns: 1fr; } }

/* surfaces */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); }
.list { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.list > a, .list > div { display: flex; align-items: center; gap: 12px; padding: 12px 16px; color: var(--text); min-height: 56px; }
.list > * + * { border-top: 1px solid var(--line); }
.list > a:hover { background: var(--surface-2); text-decoration: none; }
.list .title { font-weight: 600; }
.chev { color: var(--muted); margin-left: auto; }
.empty { text-align: center; padding: 40px 16px; }
.empty img { width: 88px; height: 88px; border-radius: 20px; margin-bottom: 12px; }

/* chips */
.chip { display: inline-flex; align-items: center; gap: 4px; padding: 2px 10px; border-radius: 999px; font-size: .8rem; font-weight: 600; background: var(--surface-2); color: var(--muted); white-space: nowrap; }
.chip.stat { background: var(--blue-soft); color: var(--blue); }
.chip.notice { background: var(--orange-soft); color: var(--orange); white-space: normal; }
.chip.timed { background: var(--orange-soft); color: var(--orange); }
.chip.premium { background: color-mix(in srgb, var(--cyan) 15%, transparent); color: var(--cyan); }
.chip.custom, .chip.name { background: var(--accent-soft); color: var(--accent); }
.chip.done { background: var(--green-soft); color: var(--green); }
.chip.running, .chip.queued, .chip.uploading { background: var(--blue-soft); color: var(--blue); }
.chip.failed { background: color-mix(in srgb, var(--red) 14%, transparent); color: var(--red); }
.chip.who { background: var(--green-soft); color: var(--green); }

/* choice cards */
.cards > * + * { margin-top: 14px; }
.choice .head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 10px; }
.choice .prompt { font-weight: 650; }
.choice .prompt.none { color: var(--muted); }
.opt { display: flex; gap: 10px; padding: 8px 0; align-items: flex-start; }
.opt + .opt { border-top: 1px dashed var(--line); }
.mark { flex: none; width: 22px; height: 22px; border-radius: 50%; border: 2px solid var(--line); margin-top: 1px; display: grid; place-items: center; }
.mark.on { background: var(--green); border-color: var(--green); color: #fff; }
.mark.on::after { content: "✓"; font-size: 13px; font-weight: 800; line-height: 1; }
.mark.untried { border-style: dashed; }
.opt .text { font-weight: 500; }
.opt.picked .text { font-weight: 700; }
.opt.untried .text { color: var(--muted); }
.opt .meta { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 4px; align-items: center; }
.warn { color: var(--orange); font-size: .9rem; margin-top: 8px; }
.banner-row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; padding: 0 4px; }
.banner-row .spark { color: var(--muted); }

/* tabs */
.tabs { display: inline-flex; background: var(--surface-2); border-radius: 10px; padding: 3px; gap: 2px; }
.tabs button { min-height: 38px; border: 0; background: transparent; color: var(--muted); font: inherit; font-weight: 600; padding: 0 14px; border-radius: 8px; cursor: pointer; }
.tabs button[aria-selected=true] { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }
[hidden] { display: none !important; }

/* transcript and live feed */
.lines { font-size: .95rem; }
.line { display: grid; grid-template-columns: 58px 1fr; gap: 12px; padding: 4px 0; }
.line .t { font: .78rem/1.9 ui-monospace, SFMono-Regular, Menlo, monospace; color: var(--muted); text-align: right; }
.line .who { font-weight: 700; margin-right: 6px; }
.line.narration .body { font-style: italic; color: var(--muted); }
.line.notice .body { color: var(--orange); font-weight: 600; }
.line.stat .body { color: var(--blue); font-weight: 600; }
.line .opts { margin: 4px 0 0; padding: 0; list-style: none; }
.line .opts li::before { content: "○ "; color: var(--muted); }
.line .opts li.picked { font-weight: 700; color: var(--green); }
.line .opts li.picked::before { content: "✓ "; }
.feed { max-height: 55vh; overflow: auto; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 14px; }

/* progress */
.bar { height: 10px; background: var(--surface-2); border-radius: 999px; overflow: hidden; }
.bar > span { display: block; height: 100%; background: var(--accent); border-radius: 999px; width: 0; transition: width .4s; }
.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) { .bar.indeterminate > span { animation: none; width: 100%; opacity: .4; } }

/* upload */
.drop { border: 2px dashed var(--line); border-radius: var(--radius); padding: 28px 16px; text-align: center; background: var(--surface); }
.drop.over { border-color: var(--accent); background: var(--accent-soft); }
.drop input[type=file] { position: absolute; width: 1px; height: 1px; opacity: 0; }
.parts { margin-top: 12px; }
.parts .part { display: flex; gap: 8px; align-items: center; padding: 8px 12px; }
.parts .part .name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
details summary { cursor: pointer; font-weight: 600; min-height: 32px; }
.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: var(--text); color: var(--bg); padding: 10px 16px; border-radius: 10px; font-weight: 600; z-index: 50; }
@media (max-width: 560px) { .hide-narrow { display: none !important; } }

/* fixing mistakes */
.edit-only { display: none !important; }
body.editing .edit-only { display: inline-flex !important; }
.pencil { float: right; margin-left: 8px; width: 32px; height: 32px; border-radius: 8px; border: 1px solid var(--line);
  background: var(--surface); color: var(--muted); cursor: pointer; align-items: center; justify-content: center; font-size: 15px; }
.pencil:hover { color: var(--accent); border-color: var(--accent); }
body.editing .line { border-radius: 8px; }
body.editing .line:hover { background: var(--surface-2); }
.editor { background: var(--surface); border: 1px solid var(--accent); border-radius: var(--radius); padding: 12px; margin: 4px 0; font-style: normal; color: var(--text); }
.editor label.small { font-weight: 600; margin-bottom: 4px; }
.editor textarea { width: 100%; padding: 8px 12px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface); color: var(--text); font: inherit; resize: vertical; }
.opt-edit { margin: 6px 0; flex-wrap: nowrap; }
.opt-edit input[type=radio] { width: 20px; height: 20px; flex: none; }
.edit-help { margin-bottom: 14px; border-color: var(--accent); background: var(--accent-soft); }
@keyframes flash { from { background: var(--accent-soft); } to { background: transparent; } }
.line.flash { animation: flash 2.4s ease-out; }
