:root {
  --bg: #f6f4ef;
  --surface: #ffffff;
  --surface-2: #f0ede6;
  --text: #22201c;
  --muted: #6d675d;
  --border: #e2ddd2;
  --accent: #2f5d8a;
  --accent-text: #ffffff;
  --accent-soft: #e5eef7;
  --focus: #2f5d8a55;
  --shadow: 0 6px 24px rgba(30, 25, 15, 0.12);
  --talk-size: 18px;
  --comment-bg: rgba(47, 93, 138, 0.14);
  --comment-line: #6d675d;
  --bar-muted: #8f8a80;
  --warn: #b26b12;
  --sans: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --serif: "Source Serif 4", Georgia, "Times New Roman", serif;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #17171a;
    --surface: #1f1f23;
    --surface-2: #27272c;
    --text: #ebe8e1;
    --muted: #a19c92;
    --border: #34343a;
    --accent: #7fb0e0;
    --accent-text: #10161d;
    --accent-soft: #22303d;
    --focus: #7fb0e055;
    --shadow: 0 6px 24px rgba(0, 0, 0, 0.45);
    --comment-bg: rgba(127, 176, 224, 0.18);
    --comment-line: #a19c92;
    --bar-muted: #6b6b74;
    --warn: #e0a24a;
  }
}
:root[data-theme="dark"] {
  --bg: #17171a; --surface: #1f1f23; --surface-2: #27272c; --text: #ebe8e1;
  --muted: #a19c92; --border: #34343a; --accent: #7fb0e0; --accent-text: #10161d;
  --accent-soft: #22303d; --focus: #7fb0e055; --shadow: 0 6px 24px rgba(0, 0, 0, 0.45);
  --comment-bg: rgba(127, 176, 224, 0.18); --comment-line: #a19c92; --bar-muted: #6b6b74; --warn: #e0a24a;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg);
  color: var(--text);
  font: 15px/1.5 var(--sans);
  display: flex;
  flex-direction: column;
}
button, input, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 1px; }
[hidden] { display: none !important; }
.muted { color: var(--muted); }

/* ---------- top bar ---------- */
.topbar {
  display: flex; align-items: center; gap: 16px;
  padding: 10px 16px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}
.brand { font-family: var(--serif); font-weight: 600; font-size: 20px; cursor: pointer; }
.modes { display: flex; background: var(--surface-2); border-radius: 999px; padding: 3px; }
.modes button {
  border: 0; background: transparent; padding: 6px 14px; border-radius: 999px; color: var(--muted);
}
.modes button[aria-selected="true"] { background: var(--surface); color: var(--text); box-shadow: 0 1px 3px rgba(0,0,0,.12); }
.tools { margin-left: auto; display: flex; gap: 8px; align-items: center; }
.btn, .icon-btn {
  border: 1px solid var(--border); background: var(--surface); border-radius: 8px;
  padding: 6px 12px; min-height: 36px;
}
.icon-btn { min-width: 40px; padding: 6px 8px; }
.btn:hover, .icon-btn:hover { background: var(--surface-2); }
.btn.primary { background: var(--accent); color: var(--accent-text); border-color: var(--accent); }
.btn.primary:hover { filter: brightness(1.08); }
.link-btn { border: 0; background: none; color: var(--accent); padding: 0; text-decoration: underline; }
.menu-wrap { position: relative; }
.menu {
  position: absolute; right: 0; top: calc(100% + 4px); z-index: 20;
  background: var(--surface); border: 1px solid var(--border); border-radius: 8px;
  box-shadow: var(--shadow); padding: 4px; min-width: 200px;
}
.menu button { display: block; width: 100%; text-align: left; border: 0; background: none; padding: 8px 10px; border-radius: 6px; }
.menu button:hover { background: var(--surface-2); }

/* ---------- start screen ---------- */
.start { max-width: 920px; width: 100%; margin: 0 auto; padding: 32px 16px 48px; overflow-y: auto; }
.hero h1 { font-family: var(--serif); font-weight: 600; font-size: 34px; margin: 0 0 4px; }
.hero p { color: var(--muted); margin: 0 0 24px; }
.hero .start-note { color: var(--text); background: var(--accent-soft); border-radius: 8px; padding: 8px 12px; margin-top: -12px; }
.mode-cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-bottom: 28px; }
.mode-card {
  text-align: left; background: var(--surface); border: 1px solid var(--border); border-radius: 12px;
  padding: 16px; display: flex; flex-direction: column; gap: 6px;
}
.mode-card.selected { border-color: var(--accent); box-shadow: 0 0 0 2px var(--focus); }
.mc-title { font-weight: 600; font-size: 16px; }
.mc-desc { color: var(--muted); font-size: 14px; }
.add-talk { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 20px; }
.add-talk h2 { margin: 0 0 14px; font-size: 18px; }
.add-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-bottom: 18px; }
.dropzone {
  border: 2px dashed var(--border); border-radius: 12px; padding: 24px; text-align: center;
  display: flex; flex-direction: column; justify-content: center; gap: 4px; cursor: pointer; min-height: 140px;
}
.dropzone.over { border-color: var(--accent); background: var(--accent-soft); }
.dz-title { font-weight: 600; }
.dz-sub { color: var(--muted); font-size: 13px; }
.add-col { display: flex; flex-direction: column; gap: 6px; }
.field-label { font-weight: 500; font-size: 14px; display: block; margin-bottom: 6px; }
.row { display: flex; gap: 8px; }
.row.end { justify-content: flex-end; margin-top: 8px; }
.row input { flex: 1; min-width: 0; }
input[type="url"], #pasteInput, .chat-form textarea {
  border: 1px solid var(--border); border-radius: 8px; padding: 8px 10px; background: var(--surface); width: 100%;
}
#pasteInput { resize: vertical; }
.hint { color: var(--muted); font-size: 13px; margin: 2px 0; }
.samples { display: flex; flex-direction: column; gap: 4px; }
.samples button { text-align: left; border: 0; background: none; color: var(--accent); padding: 2px 0; font-size: 14px; }
.samples button:hover { text-decoration: underline; }
.status { min-height: 1.5em; margin: 10px 0 0; color: var(--muted); }
.status.error { color: #b3261e; }

/* ---------- workspace ---------- */
.workspace {
  flex: 1; min-height: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  grid-template-rows: minmax(0, 1fr);
}
.editor-pane { overflow-y: auto; padding: 24px 24px 64px 8px; }
.talk-head { padding-left: 80px; max-width: 860px; }
.talk-title, .talk-speaker { border: 0; background: transparent; width: 100%; padding: 2px 0; }
.talk-title { font-family: var(--serif); font-size: 28px; font-weight: 600; }
.talk-speaker { color: var(--muted); font-size: 15px; margin-bottom: 8px; }
.talk-title:focus, .talk-speaker:focus { outline: none; border-bottom: 1px dashed var(--border); }
.audience-row { padding-left: 80px; display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin: 4px 0 10px; }
.field-label.inline { margin: 0; }
.small { font-size: 12px; }
.seg { display: inline-flex; background: var(--surface-2); border-radius: 999px; padding: 3px; }
.seg button { border: 0; background: transparent; padding: 4px 12px; border-radius: 999px; color: var(--muted); font-size: 14px; }
.seg button[aria-checked="true"] { background: var(--accent); color: var(--accent-text); }
.legend .aud { color: var(--muted); font-size: 11px; }
.fundamentals {
  margin: 0 0 16px 80px; max-width: 780px; background: var(--surface); border: 1px solid var(--border);
  border-radius: 12px; padding: 14px 16px;
}
.fund-head { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; }
.check-btn { margin-left: auto; align-self: center; }
.btn:disabled { opacity: .6; cursor: default; filter: none; }
.check-status { margin: 4px 0 0; font-size: 13px; color: var(--muted); min-height: 0; }
.check-status:empty { display: none; }
.check-status.error { color: #b3261e; }
.rest-note { display: block; font-style: italic; font-size: 14px; color: var(--text); background: var(--accent-soft); border-radius: 8px; padding: 8px 12px; }
.fund-note { display: block; font-size: 13px; margin-top: 3px; padding-left: 8px; border-left: 3px solid var(--border); }
.fund-note.met { border-left-color: var(--accent); }
.fund-note.partial { border-left-color: #c9822b; }
.fund-note.missing { border-left-color: var(--muted); }
.fund-head h2 { margin: 0; font-size: 16px; }
.fund-progress { font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; }
.fundamentals p { margin: 2px 0 8px; }
.fundamentals ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.fund-row { display: grid; grid-template-columns: 30px 1fr; gap: 8px; padding: 6px 4px; border-radius: 8px; }
.tri {
  width: 24px; height: 24px; margin-top: 1px; padding: 0; border-radius: 6px; border: 2px solid var(--border);
  background: var(--surface); font-weight: 700; font-size: 16px; line-height: 1; color: var(--muted);
}
.tri:hover { border-color: var(--accent); }
.tri.partial { border-color: #c9822b; color: #c9822b; }
.tri.met { border-color: var(--accent); background: var(--accent); color: var(--accent-text); }
.fund-title { font-weight: 600; }
.fund-desc { display: block; color: var(--muted); font-size: 13px; }
.fundamentals li.lvl-met .fund-title { color: var(--accent); }
.legend-toggle { padding-left: 80px; display: flex; gap: 12px; align-items: baseline; font-size: 13px; margin-bottom: 12px; flex-wrap: wrap; }
.legend { margin: 0 0 16px 80px; max-width: 780px; display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 6px 16px; font-size: 13px; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 12px; }
.legend h4 { grid-column: 1 / -1; margin: 6px 0 0; font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.legend div { display: flex; gap: 8px; }

.paragraphs { max-width: 860px; }
.para { display: grid; grid-template-columns: 80px minmax(0, 1fr) 40px; gap: 0; position: relative; }
.gutter {
  display: flex; flex-wrap: wrap; align-content: flex-start; justify-content: flex-end; gap: 2px;
  padding: 6px 10px 0 0; border-right: 2px solid transparent;
}
.para:focus-within .gutter, .para:hover .gutter { border-right-color: var(--border); }
.gutter .rx {
  border: 0; background: none; padding: 0; font-size: 18px; line-height: 1; width: 26px; height: 26px; border-radius: 6px;
}
.gutter .rx:hover { background: var(--surface-2); }
.gutter .rx.coach { box-shadow: inset 0 -2px 0 var(--accent); }
.gutter .add-rx {
  width: 26px; height: 26px; border-radius: 6px; border: 1px dashed var(--border); background: var(--surface);
  color: var(--muted); font-size: 15px; line-height: 1; padding: 0; opacity: 0;
}
.para:hover .add-rx, .para:focus-within .add-rx, .add-rx:focus-visible { opacity: 1; }
.para-num { position: absolute; left: 4px; top: 8px; font-size: 11px; color: var(--muted); opacity: .6; }
/* textarea over a backdrop that draws comment highlights; both must match exactly */
.text-wrap { position: relative; border-radius: 6px; }
.text-wrap:focus-within { background: var(--surface); }
.para textarea, .backdrop {
  font-family: var(--serif); font-size: var(--talk-size); line-height: 1.6;
  padding: 4px 8px 14px 14px; margin: 0; border: 0; letter-spacing: normal;
  white-space: pre-wrap; overflow-wrap: break-word; word-break: normal; tab-size: 4;
}
.para textarea {
  position: relative; z-index: 1; background: transparent; resize: none; overflow: hidden;
  width: 100%; display: block;
}
.para textarea:focus { outline: none; }
.backdrop { position: absolute; inset: 0; color: transparent; pointer-events: none; overflow: hidden; }
.backdrop mark {
  color: transparent; background: var(--comment-bg); border-radius: 2px;
  text-decoration: underline dotted var(--comment-line); text-decoration-thickness: 2px; text-underline-offset: 4px;
}
.para.heading textarea, .para.heading .backdrop { font-family: var(--sans); font-weight: 700; font-size: calc(var(--talk-size) * 1.15); padding-top: 14px; }
.para.backmatter textarea { color: var(--muted); }
.backmatter-divider { margin: 14px 0 4px 80px; padding-top: 10px; border-top: 1px dashed var(--border); font-size: 12px; color: var(--muted); }
.chips { display: flex; flex-direction: column; align-items: center; gap: 4px; padding-top: 8px; }
.chip {
  width: 24px; height: 24px; border-radius: 999px; border: 1px solid var(--border); background: var(--surface);
  font-size: 12px; font-weight: 600; padding: 0; color: var(--text); font-variant-numeric: tabular-nums;
}
.chip:hover { background: var(--surface-2); }
.chip.coach { border-color: var(--accent); color: var(--accent); }

.editor-tools { padding-left: 80px; display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.small-btn { min-height: 30px; padding: 3px 10px; font-size: 13px; }
.btn.danger { color: #b3261e; }
.length-warn { align-self: center; font-size: 13px; color: #b3261e; font-weight: 600; }
.btn.stop-mode { background: var(--surface); color: #b3261e; border: 2px solid #b3261e; opacity: 1; }
.ctx-menu {
  position: fixed; z-index: 45; background: var(--surface); border: 1px solid var(--border);
  border-radius: 8px; box-shadow: var(--shadow); padding: 4px; min-width: 170px;
}
.ctx-menu button { display: block; width: 100%; text-align: left; border: 0; background: none; padding: 7px 10px; border-radius: 6px; }
.ctx-menu button:hover, .ctx-menu button:focus { background: var(--surface-2); outline: none; }
.bubble {
  position: fixed; z-index: 44; width: 300px; background: var(--surface); border: 1px solid var(--border);
  border-radius: 12px; box-shadow: var(--shadow); padding: 12px; display: flex; flex-direction: column; gap: 8px;
}
.bub-head { font-size: 13px; }
.bub-quote { font-family: var(--serif); font-style: italic; font-size: 13px; color: var(--muted); border-left: 3px solid var(--comment-line); padding-left: 8px; }
.bub-body { white-space: pre-wrap; }
.bubble textarea { width: 100%; border: 1px solid var(--border); border-radius: 8px; padding: 6px 8px; background: var(--surface); resize: vertical; }
.bub-actions { display: flex; gap: 12px; justify-content: flex-end; align-items: center; font-size: 13px; }

/* palette */
.palette {
  position: fixed; z-index: 30; background: var(--surface); border: 1px solid var(--border);
  border-radius: 12px; box-shadow: var(--shadow); padding: 10px; width: 300px;
}
.palette h4 { margin: 6px 4px 4px; font-size: 11px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.palette .grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; }
.palette .grid button {
  font-size: 20px; border: 0; background: none; border-radius: 8px; height: 36px;
}
.palette .grid button:hover { background: var(--surface-2); }
.palette .grid button.on { background: var(--accent-soft); box-shadow: inset 0 0 0 2px var(--accent); }
.palette .pal-name { min-height: 2.6em; font-size: 13px; color: var(--muted); padding: 6px 4px 0; }
.palette .pal-name strong { color: var(--text); }

.tooltip {
  position: fixed; z-index: 40; pointer-events: none; max-width: 260px;
  background: var(--text); color: var(--bg); padding: 6px 9px; border-radius: 6px; font-size: 13px;
}

/* chat */
.chat-pane {
  grid-row: 1 / 2; grid-column: 2;
  border-left: 1px solid var(--border); background: var(--surface);
  display: flex; flex-direction: column; min-height: 0;
}
.chat-head { display: flex; align-items: center; gap: 8px; padding: 12px 14px; border-bottom: 1px solid var(--border); }
.chat-title { font-weight: 600; }
.badge { font-size: 11px; background: var(--surface-2); color: var(--muted); padding: 2px 8px; border-radius: 999px; }
.chat-log { flex: 1; overflow-y: auto; padding: 14px; display: flex; flex-direction: column; gap: 10px; }
.msg { max-width: 90%; padding: 8px 12px; border-radius: 12px; white-space: pre-wrap; }
.msg.coach { background: var(--surface-2); align-self: flex-start; border-bottom-left-radius: 4px; }
.msg.error { background: transparent; border: 1px solid #b3261e; color: var(--text); }
.badge.on { background: var(--accent-soft); color: var(--accent); }
.msg.user { background: var(--accent); color: var(--accent-text); align-self: flex-end; border-bottom-right-radius: 4px; }
.msg .quote { display: block; font-family: var(--serif); font-style: italic; opacity: .85; margin-top: 4px; font-size: 13px; }
.suggestions { display: flex; flex-wrap: wrap; gap: 6px; margin: -2px 0 4px; }
.suggestion {
  border: 1px solid var(--accent); color: var(--accent); background: var(--surface);
  border-radius: 999px; padding: 5px 12px; font-size: 13px; text-align: left;
}
.suggestion:hover { background: var(--accent-soft); }
.suggest-hint { flex-basis: 100%; font-size: 12px; color: var(--muted); }
.chat-pane.flash { animation: chat-flash 1s ease-in-out 2; }
@keyframes chat-flash {
  0%, 100% { box-shadow: inset 0 0 0 0 transparent; }
  50% { box-shadow: inset 0 0 0 3px var(--accent), 0 0 24px var(--focus); background: var(--accent-soft); }
}
@media (prefers-reduced-motion: reduce) {
  .chat-pane.flash { animation: none; box-shadow: inset 0 0 0 3px var(--accent); }
}
.cta {
  display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap;
  background: var(--accent-soft); border: 2px solid var(--accent); border-radius: 14px; padding: 18px 20px;
}
.cta-copy { flex: 1 1 320px; }
.cta-kicker { margin: 0; font-weight: 600; font-size: 17px; }
.cta-text { margin: 4px 0 0; color: var(--text); }
.cta-btn { font-size: 17px; font-weight: 600; padding: 12px 22px; min-height: 48px; border-radius: 999px; box-shadow: 0 4px 14px var(--focus); }
.cta-actions { display: flex; flex-direction: column; gap: 10px; align-items: stretch; }
.cta-analyze { background: var(--surface); color: var(--accent); border: 2px solid var(--accent); font-weight: 600; }
.fund-cta { display: flex; justify-content: flex-end; gap: 10px; flex-wrap: wrap; margin-top: 12px; }
.strengths-btn { border: 2px solid var(--accent); color: var(--accent); font-weight: 600; }
.msg.typing { color: var(--muted); display: flex; align-items: center; gap: 8px; }
.dots { display: inline-flex; gap: 3px; }
.dots i { width: 6px; height: 6px; border-radius: 50%; background: var(--muted); animation: dot 1.2s infinite ease-in-out; }
.dots i:nth-child(2) { animation-delay: .15s; }
.dots i:nth-child(3) { animation-delay: .3s; }
@keyframes dot { 0%, 80%, 100% { opacity: .25; transform: translateY(0); } 40% { opacity: 1; transform: translateY(-3px); } }
@media (prefers-reduced-motion: reduce) { .dots i { animation: none; opacity: .6; } }
.chat-form { display: flex; gap: 8px; padding: 10px; border-top: 1px solid var(--border); align-items: flex-end; }
.chat-form textarea { resize: none; }

/* header additions */
.new-talk { font-weight: 600; }
#aboutBtn.active, #myTalksBtn.active { background: var(--accent-soft); border-color: var(--accent); }

/* meeting / speaker info */
.info-boxes { padding-left: 80px; max-width: 860px; display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin: 4px 0 14px; }
.info-box { display: flex; flex-direction: column; }
.info-box .field-label { font-size: 12px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); margin-bottom: 4px; }
.info-box textarea {
  border: 1px solid var(--border); border-radius: 8px; padding: 8px 10px; background: var(--surface);
  resize: none; overflow: hidden; min-height: 56px; font-size: 14px; line-height: 1.45;
}

/* report and My Talks views */
.report { flex: 1; min-height: 0; overflow-y: auto; }
.report-inner { max-width: 960px; margin: 0 auto; padding: 28px 16px 64px; display: flex; flex-direction: column; gap: 18px; }
.report-head h1 { font-family: var(--serif); font-size: 30px; margin: 0; }
.report-head p { margin: 2px 0 10px; }
.audience-row.flush { padding-left: 0; margin: 0; }
.stat-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.stat-cards .stat { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 12px 14px; }
.stat-cards .speed-stat { grid-column: span 2; }
.panel { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 14px 16px; }
.panel h2 { margin: 0 0 10px; font-size: 16px; }
.fundamentals.panel { margin: 0; max-width: none; }
/* attention over time: one line, recessive grid */
.attn-chart { margin: 8px 0 4px; border-radius: 8px; }
.attn-chart:focus-visible { outline: 3px solid var(--focus); }
.attn-svg { display: block; width: 100%; overflow: visible; }
.attn-grid { stroke: var(--border); stroke-width: 1; }
.attn-thresh { stroke: var(--muted); stroke-width: 1; stroke-dasharray: 3 4; opacity: .6; }
.attn-tick { fill: var(--muted); font-size: 11px; font-family: var(--sans); }
.attn-line { fill: none; stroke: var(--accent); stroke-width: 2; stroke-linejoin: round; }
.attn-area { fill: var(--accent); opacity: .12; }
.attn-cross { stroke: var(--muted); stroke-width: 1; }
.attn-dot { fill: var(--accent); stroke: var(--surface); stroke-width: 2; }
.attn-hit { fill: transparent; cursor: pointer; }
.attn-emoji { font-size: 12px; }
.para.flash-para .text-wrap { animation: para-flash 1.6s ease-out; }
@keyframes para-flash { 0%, 40% { background: var(--accent-soft); } 100% { background: transparent; } }
@media (prefers-reduced-motion: reduce) { .para.flash-para .text-wrap { animation: none; background: var(--accent-soft); } }
/* talk type bar chart: one hue for the top type, gray for the rest */
.type-target { margin-left: auto; font-size: 13px; color: var(--muted); display: flex; gap: 6px; align-items: center; }
.type-target select { border: 1px solid var(--border); border-radius: 8px; padding: 4px 6px; background: var(--surface); color: var(--text); }
.type-chart { display: grid; gap: 6px; margin: 10px 0 6px; }
.type-row { display: grid; grid-template-columns: 170px 1fr; align-items: center; gap: 10px; padding: 3px 4px; border-radius: 6px; cursor: default; }
.type-row:hover, .type-row:focus-visible { background: var(--surface-2); outline: none; }
.type-name { font-size: 14px; color: var(--text); display: flex; flex-direction: column; line-height: 1.2; }
.type-row.top .type-name { font-weight: 600; }
.type-tag { font-size: 11px; color: var(--muted); }
.type-track { position: relative; height: 18px; margin-right: 34px;
  background: linear-gradient(to right, transparent calc(50% - 0.5px), var(--border) calc(50% - 0.5px), var(--border) calc(50% + 0.5px), transparent calc(50% + 0.5px)); }
.type-bar { position: absolute; left: 0; top: 0; bottom: 0; background: var(--bar-muted); border-radius: 0 4px 4px 0; }
.type-row.top .type-bar { background: var(--accent); }
.type-row.target .type-bar { box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px var(--accent); }
.type-val { position: absolute; top: 50%; transform: translateY(-50%); font-size: 13px; font-weight: 600; color: var(--text); font-variant-numeric: tabular-nums; }
.type-axis { display: grid; grid-template-columns: 170px 1fr; gap: 10px; padding: 0 4px; }
.type-ticks { display: flex; justify-content: space-between; margin-right: 34px; font-size: 11px; color: var(--muted); }
.type-ticks i { font-style: normal; }
.type-warn, .type-note { margin: 8px 0 0; padding: 8px 12px; border-radius: 8px; font-size: 14px; }
.type-warn { border: 1px solid var(--warn); color: var(--text); }
.type-note { background: var(--accent-soft); color: var(--text); }
.type-table { margin-top: 8px; font-size: 13px; }
.type-table summary { cursor: pointer; color: var(--accent); }
.type-table table { width: 100%; border-collapse: collapse; margin-top: 6px; }
.type-table th, .type-table td { text-align: left; padding: 5px 8px; border-bottom: 1px solid var(--border); vertical-align: top; }
.type-table td:nth-child(2) { font-variant-numeric: tabular-nums; }
.rx-breakdown { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 6px 18px; }
.rx-count { display: grid; grid-template-columns: 28px 1fr auto; align-items: center; gap: 8px; padding: 4px 0; border-bottom: 1px solid var(--border); }
.rx-emoji { font-size: 18px; }
.about-text p { margin: 0 0 14px; font-size: 16px; line-height: 1.6; max-width: 70ch; }
.about-text .disclaimer { margin: 18px 0 0; padding-top: 14px; border-top: 1px solid var(--border); font-size: 14px; color: var(--muted); }
.feedback-btn { display: inline-block; text-decoration: none; padding: 10px 18px; font-weight: 600; }
.lib-list { display: flex; flex-direction: column; gap: 8px; }
.lib-row {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 12px 16px;
}
.lib-row.current { border-color: var(--accent); }
.lib-info { display: flex; flex-direction: column; gap: 2px; align-items: flex-start; min-width: 0; }
.lib-title { border: 0; background: none; padding: 0; font-family: var(--serif); font-size: 18px; font-weight: 600; text-align: left; }
.lib-title:hover { text-decoration: underline; }
.lib-actions { display: flex; gap: 8px; }

.stat { display: flex; flex-direction: column; min-width: 96px; }
.stat-label { font-size: 11px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.stat-val { font-size: 18px; font-weight: 600; font-variant-numeric: tabular-nums; }
.stat-sub { font-size: 11px; color: var(--muted); }
.stat.muted .stat-val { color: var(--muted); }
.speed-stat { flex-direction: row; align-items: center; gap: 10px; }
.speed { display: flex; align-items: stretch; gap: 2px; height: 66px; }
.speed input[type="range"] {
  writing-mode: vertical-lr; direction: rtl; /* bottom = slow, top = fast */
  width: 18px; height: 100%; margin: 0; accent-color: var(--accent); cursor: pointer;
}
.speed-marks { display: flex; flex-direction: column; justify-content: space-between; }
.speed-marks button { border: 0; background: none; padding: 0; font-size: 15px; line-height: 1; opacity: .45; height: 20px; }
.speed-marks button.on { opacity: 1; }
.speed-mid { height: 20px; }
.speed-text { display: flex; flex-direction: column; }

/* ---------- small screens ---------- */
@media (max-width: 820px) {
  .add-grid { grid-template-columns: 1fr; }
  .workspace { grid-template-columns: 1fr; grid-template-rows: minmax(0, 1fr) 40vh; }
  .chat-pane { grid-column: 1; grid-row: 2; border-left: 0; border-top: 1px solid var(--border); }
  .info-boxes { grid-template-columns: 1fr; padding-left: 56px; }
  .stat-cards .speed-stat { grid-column: span 1; }
  .type-row, .type-axis { grid-template-columns: 110px 1fr; }
  .editor-pane { padding: 16px 16px 32px 0; }
  .talk-head, .legend-toggle, .audience-row, .editor-tools { padding-left: 56px; }
  .legend, .fundamentals { margin-left: 16px; }
  .para { grid-template-columns: 56px minmax(0, 1fr) 34px; }
  .tools .btn { padding: 6px 8px; }
  .gutter .add-rx { opacity: 1; }
  .btn, .icon-btn, .gutter .rx, .gutter .add-rx { min-height: 44px; min-width: 44px; }
}
