:root {
  --bg: #f6f3ee; --surface: #ffffff; --surface-2: #efeae2; --ink: #1d2427; --muted: #5d686d;
  --line: #e2dbd0; --accent: #0e6b63; --accent-ink: #ffffff; --accent-soft: #dfeeea;
  --warm: #b4621f; --warm-soft: #f7e7d6; --danger: #b3261e; --ok: #2e7d4f;
  --radius: 16px; --shadow: 0 1px 2px rgba(29,36,39,.06), 0 6px 20px rgba(29,36,39,.06);
  --font: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  --tabs-h: 64px; --player-h: 0px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #131819; --surface: #1c2326; --surface-2: #232c2f; --ink: #e9eeed; --muted: #9eaaae;
    --line: #2c3639; --accent: #5cc2b2; --accent-ink: #082220; --accent-soft: #1c3431;
    --warm: #e7a25e; --warm-soft: #3a2a1b; --danger: #f2827a; --ok: #6fcf97;
    --shadow: 0 1px 2px rgba(0,0,0,.3); color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #131819; --surface: #1c2326; --surface-2: #232c2f; --ink: #e9eeed; --muted: #9eaaae;
  --line: #2c3639; --accent: #5cc2b2; --accent-ink: #082220; --accent-soft: #1c3431;
  --warm: #e7a25e; --warm-soft: #3a2a1b; --danger: #f2827a; --ok: #6fcf97;
  --shadow: 0 1px 2px rgba(0,0,0,.3); color-scheme: dark;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink); font: 16px/1.55 var(--font);
  padding-bottom: calc(var(--tabs-h) + var(--player-h) + env(safe-area-inset-bottom) + 24px);
  -webkit-tap-highlight-color: transparent;
}
body.has-player { --player-h: 68px; }
a { color: var(--accent); }
button { font: inherit; color: inherit; }
svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.skip { position: absolute; left: -999px; }
.skip:focus { left: 8px; top: 8px; background: var(--surface); padding: 8px; z-index: 50; }

.topbar {
  position: sticky; top: 0; z-index: 10; display: flex; align-items: center; gap: 8px;
  padding: calc(10px + env(safe-area-inset-top)) 16px 10px; background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); border-bottom: 1px solid transparent;
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 650; letter-spacing: -.01em; min-width: 0; }
.brand span:last-child { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.logo {
  display: grid; place-items: center; width: 30px; height: 30px; border-radius: 9px; background: var(--accent);
  color: var(--accent-ink); font-size: 12px; font-weight: 800; letter-spacing: .02em; flex: none;
}
.back { border: 0; background: none; padding: 6px; margin-left: -6px; border-radius: 10px; cursor: pointer; display: grid; }
.net { margin-left: auto; font-size: 12px; padding: 2px 8px; border-radius: 99px; background: var(--warm-soft); color: var(--warm); }

main { max-width: 680px; margin: 0 auto; padding: 8px 16px 0; outline: none; }
.loading, .empty { color: var(--muted); padding: 40px 0; text-align: center; }

h1 { font: 700 28px/1.2 var(--serif); letter-spacing: -.01em; margin: 6px 0 4px; }
h2 { font-size: 13px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin: 28px 0 10px; font-weight: 650; }
h3 { font-size: 18px; margin: 18px 0 6px; }
.kicker { color: var(--muted); font-size: 14px; }

.hero {
  background: var(--surface); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow);
  border: 1px solid var(--line); margin-top: 8px;
}
.hero .module { font-size: 13px; color: var(--accent); font-weight: 650; text-transform: uppercase; letter-spacing: .06em; }
.hero .focus { font: 600 21px/1.25 var(--serif); margin: 4px 0 8px; }
.progress { height: 6px; background: var(--surface-2); border-radius: 99px; overflow: hidden; margin-top: 12px; }
.progress span { display: block; height: 100%; background: var(--accent); border-radius: 99px; }
.meta { display: flex; justify-content: space-between; font-size: 13px; color: var(--muted); margin-top: 6px; }

.cards { display: grid; gap: 12px; }
.card {
  display: block; text-decoration: none; color: inherit; background: var(--surface); border-radius: var(--radius);
  padding: 16px; border: 1px solid var(--line); box-shadow: var(--shadow); position: relative;
}
.card:active { transform: scale(.99); }
.card .title { font-weight: 650; font-size: 17px; line-height: 1.3; margin: 6px 0 4px; }
.card .sum { color: var(--muted); font-size: 15px; }
.card .row { display: flex; align-items: center; gap: 10px; margin-top: 10px; flex-wrap: wrap; }
.tag {
  display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 650; letter-spacing: .04em;
  text-transform: uppercase; color: var(--accent);
}
.tag.warm { color: var(--warm); }
.pill { font-size: 12px; padding: 3px 9px; border-radius: 99px; background: var(--surface-2); color: var(--muted); }
.pill.ok { background: var(--accent-soft); color: var(--accent); }
.pill.warn { background: var(--warm-soft); color: var(--warm); }
.playbtn {
  display: inline-flex; align-items: center; gap: 8px; border: 0; background: var(--accent); color: var(--accent-ink);
  border-radius: 99px; padding: 9px 16px 9px 12px; font-weight: 650; cursor: pointer; font-size: 15px;
}
.playbtn svg { width: 20px; height: 20px; fill: currentColor; stroke: none; }

.article { background: var(--surface); border-radius: var(--radius); padding: 20px 18px; border: 1px solid var(--line); margin-top: 8px; }
.prose { font: 18px/1.65 var(--serif); }
.prose p { margin: 0 0 14px; }
.prose ul { padding-left: 22px; margin: 0 0 14px; }
.prose li { margin-bottom: 6px; }
.prose h3 { font-family: var(--font); font-size: 17px; margin-top: 22px; }
.box { border-radius: 14px; padding: 14px 16px; margin: 16px 0; background: var(--accent-soft); }
.box.warm { background: var(--warm-soft); }
.box .label { font-size: 12px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; margin-bottom: 4px; color: var(--accent); }
.box.warm .label { color: var(--warm); }
.box ul { margin: 6px 0 0; padding-left: 20px; }

.sources { list-style: none; padding: 0; margin: 0; display: grid; gap: 10px; }
.sources li { padding: 12px 14px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; font-size: 15px; }
.sources a { font-weight: 600; text-decoration: none; }
.ev { display: inline-block; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; padding: 2px 7px; border-radius: 6px; margin-bottom: 4px; }
.ev.forte { background: var(--accent-soft); color: var(--accent); }
.ev.media { background: var(--surface-2); color: var(--ink); }
.ev.debole { background: var(--warm-soft); color: var(--warm); }

.transcript { display: grid; gap: 12px; }
.turn { display: grid; gap: 2px; }
.turn b { font-size: 13px; color: var(--accent); }
.turn.s1 b { color: var(--warm); }
.turn.s2 b { color: var(--muted); }
details.more { margin-top: 18px; }
details.more summary { cursor: pointer; font-weight: 650; padding: 8px 0; }

.bigplayer { display: flex; align-items: center; gap: 12px; margin: 14px 0 6px; flex-wrap: wrap; }

form.answer { display: grid; gap: 10px; margin-top: 12px; }
textarea {
  width: 100%; min-height: 180px; resize: vertical; border-radius: 14px; border: 1px solid var(--line);
  background: var(--surface); color: var(--ink); padding: 14px; font: 16px/1.5 var(--font);
}
textarea:focus, input:focus, button:focus-visible, a:focus-visible { outline: 3px solid color-mix(in srgb, var(--accent) 45%, transparent); outline-offset: 2px; }
.btn {
  border: 0; border-radius: 12px; padding: 12px 18px; font-weight: 650; cursor: pointer; background: var(--accent);
  color: var(--accent-ink); text-decoration: none; display: inline-flex; align-items: center; justify-content: center; gap: 8px;
}
.btn.ghost { background: var(--surface-2); color: var(--ink); }
.btns { display: flex; gap: 10px; flex-wrap: wrap; }
.hint { font-size: 14px; color: var(--muted); }
.char { display: grid; grid-template-columns: 52px 1fr; gap: 12px; align-items: center; }
.avatar { width: 52px; height: 52px; border-radius: 16px; display: grid; place-items: center; font-weight: 800; font-size: 18px; background: var(--warm-soft); color: var(--warm); }
.prompt { white-space: pre-wrap; font: 14px/1.5 ui-monospace, SFMono-Regular, Menlo, monospace; background: var(--surface-2); border-radius: 12px; padding: 14px; max-height: 220px; overflow: auto; }

.score { display: flex; gap: 4px; }
.score i { width: 22px; height: 8px; border-radius: 99px; background: var(--surface-2); }
.score i.on { background: var(--accent); }

.radar { width: 100%; max-width: 520px; height: auto; display: block; margin: 0 auto; }
.radar text { font: 13px var(--font); fill: var(--muted); stroke: none; }
.modules { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; }
.modules li { display: grid; grid-template-columns: 34px 1fr; gap: 10px; padding: 12px; border-radius: 14px; background: var(--surface); border: 1px solid var(--line); }
.modules .n { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; font-weight: 750; background: var(--surface-2); color: var(--muted); }
.modules li.now { border-color: var(--accent); }
.modules li.now .n { background: var(--accent); color: var(--accent-ink); }
.modules li.done .n { background: var(--accent-soft); color: var(--accent); }
.modules small { color: var(--muted); display: block; }

.player {
  position: fixed; left: 8px; right: 8px; bottom: calc(var(--tabs-h) + env(safe-area-inset-bottom) + 6px); z-index: 20;
  display: flex; align-items: center; gap: 8px; padding: 8px 10px; border-radius: 16px; background: var(--ink); color: var(--bg);
  box-shadow: 0 8px 30px rgba(0,0,0,.2); max-width: 664px; margin: 0 auto;
}
.pbtn { border: 0; background: none; color: inherit; cursor: pointer; border-radius: 10px; padding: 6px; font-size: 13px; font-weight: 700; min-width: 36px; min-height: 36px; }
.pbtn.play { width: 42px; height: 42px; border-radius: 50%; background: var(--bg); color: var(--ink); display: grid; place-items: center; }
.pbtn.play svg { width: 20px; height: 20px; fill: currentColor; stroke: none; }
.pinfo { flex: 1; min-width: 0; }
.ptitle { color: inherit; text-decoration: none; font-size: 14px; font-weight: 650; display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pbar { display: flex; align-items: center; gap: 8px; font-size: 11px; opacity: .8; }
.pbar input { flex: 1; accent-color: var(--accent); min-width: 0; }
@media (max-width: 380px) { #pFwd { display: none; } }

.tabs {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 15; display: grid; grid-template-columns: repeat(5, 1fr);
  height: calc(var(--tabs-h) + env(safe-area-inset-bottom)); padding-bottom: env(safe-area-inset-bottom);
  background: color-mix(in srgb, var(--surface) 92%, transparent); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  border-top: 1px solid var(--line);
}
.tabs a { display: grid; place-items: center; align-content: center; gap: 2px; color: var(--muted); text-decoration: none; font-size: 11px; font-weight: 600; }
.tabs a.on { color: var(--accent); }

.toast {
  position: fixed; left: 50%; bottom: calc(var(--tabs-h) + var(--player-h) + 24px); transform: translateX(-50%) translateY(20px);
  background: var(--ink); color: var(--bg); padding: 10px 16px; border-radius: 12px; font-size: 14px; opacity: 0;
  pointer-events: none; transition: .25s; z-index: 30; max-width: calc(100% - 32px);
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.list-date { font-size: 13px; color: var(--muted); margin: 18px 2px 8px; }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
