:root {
  --bg: #FAF8F5;
  --surface: #FFFFFF;
  --surface-2: #F0ECE4;
  --text: #1F1E1C;
  --muted: #6E6A63;
  --accent: #0A84FF;
  --danger: #FF453A;
  --success: #30D158;
  --warn: #FF9F0A;
  --border: rgba(0, 0, 0, 0.09);
  --font-family: Georgia, "Iowan Old Style", "Times New Roman", serif;
  --font-size: 19px;
  --line-height: 1.65;
  --letter-spacing: 0em;
  --padding-x: 20px;
  --text-align: left;
}

[data-theme="sepia"] {
  --bg: #F4ECD8;
  --surface: #FBF6E9;
  --surface-2: #E8DEC5;
  --text: #3B2E1E;
  --muted: #7C6A52;
  --accent: #B5651D;
  --border: rgba(59, 46, 30, 0.14);
}

[data-theme="dark"] {
  --bg: #1C1C1E;
  --surface: #2C2C2E;
  --surface-2: #3A3A3C;
  --text: #EAEAEA;
  --muted: #9E9EA4;
  --accent: #0A84FF;
  --border: rgba(255, 255, 255, 0.12);
}

[data-theme="oled"] {
  --bg: #000000;
  --surface: #121214;
  --surface-2: #1E1E22;
  --text: #D9D9DC;
  --muted: #8E8E93;
  --accent: #30D158;
  --border: rgba(255, 255, 255, 0.14);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", sans-serif;
  transition: background 0.2s ease, color 0.2s ease;
  min-height: 100%;
}

.hidden { display: none !important; }

/* ===== Topbar ===== */
.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  padding: calc(10px + env(safe-area-inset-top)) 12px 10px;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border);
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  flex: 1;
}

.brand-title {
  font-size: 18px;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.book-meta-btn {
  appearance: none;
  border: none;
  background: transparent;
  color: var(--text);
  text-align: left;
  padding: 2px 4px;
  min-width: 0;
  cursor: pointer;
  display: flex;
  flex-direction: column;
}
.book-meta-title {
  font-size: 13px;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 145px;
}
.book-meta-page {
  font-size: 11px;
  color: var(--muted);
  font-weight: 600;
}

.top-actions {
  display: flex;
  gap: 5px;
  flex-shrink: 0;
}

.icon-btn {
  appearance: none;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  border-radius: 10px;
  padding: 7px 10px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  white-space: nowrap;
}

.icon-btn.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.icon-btn.active-accent {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 18%, var(--surface));
  color: var(--accent);
}

.icon-btn.danger-text {
  color: var(--danger);
}

.badge {
  background: var(--accent);
  color: #fff;
  font-size: 11px;
  padding: 1px 6px;
  border-radius: 999px;
  min-width: 18px;
  text-align: center;
}

/* ===== Library View ===== */
.library-wrap {
  max-width: 720px;
  margin: 0 auto;
  padding: 18px 16px calc(60px + env(safe-area-inset-bottom));
}

.import-card {
  background: var(--surface);
  border: 1.5px dashed color-mix(in srgb, var(--accent) 45%, var(--border));
  border-radius: 18px;
  padding: 20px 16px;
  text-align: center;
  margin-bottom: 18px;
}
.import-card h2 {
  margin: 0 0 6px;
  font-size: 17px;
}
.import-card p {
  margin: 0 0 14px;
  font-size: 13px;
  color: var(--muted);
  line-height: 1.45;
}
.import-actions {
  display: flex;
  gap: 8px;
  justify-content: center;
  flex-wrap: wrap;
}

.progress-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 14px 16px;
  margin-bottom: 18px;
}
.progress-text {
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 8px;
  display: flex;
  justify-content: space-between;
}
.progress-track {
  height: 7px;
  border-radius: 999px;
  background: var(--surface-2);
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  width: 0%;
  background: var(--accent);
  transition: width 0.15s ease;
}

.section-label {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  margin: 18px 0 10px;
}

.book-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.book-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 14px 15px;
  display: flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
}

.book-cover-icon {
  width: 44px;
  height: 58px;
  border-radius: 9px;
  background: linear-gradient(150deg, var(--accent), color-mix(in srgb, var(--accent) 45%, #111));
  color: #fff;
  font-family: Georgia, serif;
  font-size: 20px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.book-card-info {
  flex: 1;
  min-width: 0;
}
.book-card-title {
  font-size: 15px;
  font-weight: 700;
  margin-bottom: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.book-card-sub {
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 7px;
}
.book-card-progress {
  height: 4px;
  border-radius: 99px;
  background: var(--surface-2);
  overflow: hidden;
}
.book-card-progress-fill {
  height: 100%;
  background: var(--accent);
}

.book-card-del {
  appearance: none;
  border: none;
  background: var(--surface-2);
  color: var(--muted);
  width: 32px;
  height: 32px;
  border-radius: 9px;
  font-size: 14px;
  cursor: pointer;
  flex-shrink: 0;
}

.empty-state {
  text-align: center;
  padding: 26px 14px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.5;
}

/* ===== Reader View ===== */
.reader-wrap {
  max-width: 720px;
  margin: 0 auto;
  padding: 20px var(--padding-x) calc(52vh + env(safe-area-inset-bottom));
}

.reader-content {
  font-family: var(--font-family);
  font-size: var(--font-size);
  line-height: var(--line-height);
  letter-spacing: var(--letter-spacing);
  text-align: var(--text-align);
  -webkit-user-select: text;
  user-select: text;
  overflow-wrap: break-word;
}

.reader-content h1 {
  font-size: 0.9em;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0 0 8px;
  font-weight: 600;
}

.reader-content h2 {
  font-size: 1.32em;
  line-height: 1.3;
  margin: 8px 0 20px;
  font-weight: 700;
}

.reader-content p {
  margin: 0 0 1.02em;
  text-indent: 1.1em;
}

.reader-content p:first-of-type {
  text-indent: 0;
}

.fn-ref {
  appearance: none;
  border: none;
  background: var(--surface-2);
  color: var(--accent);
  font-family: -apple-system, BlinkMacSystemFont, sans-serif;
  font-size: 0.62em;
  font-weight: 700;
  vertical-align: super;
  line-height: 1;
  padding: 2px 5px;
  margin: 0 2px;
  border-radius: 5px;
  cursor: pointer;
}

.page-nav {
  margin-top: 32px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.page-nav-btn {
  appearance: none;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  border-radius: 12px;
  padding: 11px 16px;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  min-width: 115px;
}
.page-nav-btn:disabled {
  opacity: 0.35;
  cursor: default;
}
.page-nav-info {
  font-size: 13px;
  color: var(--muted);
  font-weight: 600;
  text-align: center;
}

/* Focus guide line */
.focus-guide {
  position: fixed;
  left: 0;
  right: 0;
  top: 34vh;
  height: calc(var(--font-size) * var(--line-height));
  background: color-mix(in srgb, var(--accent) 10%, transparent);
  border-top: 1px solid color-mix(in srgb, var(--accent) 28%, transparent);
  border-bottom: 1px solid color-mix(in srgb, var(--accent) 28%, transparent);
  pointer-events: none;
  z-index: 15;
  opacity: 0;
  transition: opacity 0.2s ease;
}
.focus-guide.visible { opacity: 1; }

/* Auto-scroll floating dock */
.scroll-dock {
  position: fixed;
  left: 12px;
  right: 12px;
  bottom: calc(12px + env(safe-area-inset-bottom));
  z-index: 25;
  max-width: 460px;
  margin: 0 auto;
  background: color-mix(in srgb, var(--surface) 94%, transparent);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 8px 10px 10px;
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.22);
  transform: translateY(160%);
  opacity: 0;
  pointer-events: none;
  transition: transform 0.22s ease, opacity 0.22s ease;
}
.scroll-dock.visible {
  transform: translateY(0);
  opacity: 1;
  pointer-events: auto;
}
.scroll-dock-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}
.dock-btn {
  appearance: none;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  border-radius: 10px;
  min-width: 36px;
  height: 36px;
  padding: 0 10px;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.dock-btn.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  min-width: 44px;
}
.dock-status {
  flex: 1;
  text-align: center;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.step-progress-track {
  height: 3px;
  background: var(--surface-2);
  border-radius: 99px;
  margin-top: 7px;
  overflow: hidden;
  display: none;
}
.step-progress-track.active { display: block; }
.step-progress-fill {
  height: 100%;
  width: 0%;
  background: var(--accent);
  border-radius: 99px;
}

/* Bottom Save Selection Bar */
.save-bar {
  position: fixed;
  left: 12px;
  right: 12px;
  bottom: calc(12px + env(safe-area-inset-bottom));
  z-index: 35;
  max-width: 680px;
  margin: 0 auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 10px 12px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.25);
  display: flex;
  flex-direction: column;
  gap: 8px;
  transform: translateY(170%);
  opacity: 0;
  pointer-events: none;
  transition: transform 0.22s ease, opacity 0.22s ease;
}
.save-bar.visible {
  transform: translateY(0);
  opacity: 1;
  pointer-events: auto;
}
.save-bar-top {
  display: flex;
  align-items: center;
  gap: 10px;
}
.save-preview {
  flex: 1;
  min-width: 0;
  font-size: 13px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.save-btn {
  appearance: none;
  border: none;
  background: var(--accent);
  color: #fff;
  font-size: 14px;
  font-weight: 700;
  padding: 9px 15px;
  border-radius: 11px;
  cursor: pointer;
  white-space: nowrap;
}
.save-tags-row {
  display: flex;
  gap: 6px;
}
.tag-chip {
  appearance: none;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  padding: 5px 10px;
  border-radius: 999px;
  cursor: pointer;
}
.tag-chip.active {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 18%, var(--surface));
  color: var(--accent);
}

/* ===== Sheets & Backdrop ===== */
.backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.44);
  z-index: 40;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease, background 0.2s ease;
}
.backdrop.open { opacity: 1; pointer-events: auto; }
.backdrop.transparent { background: transparent; }

.sheet {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 50;
  max-width: 720px;
  margin: 0 auto;
  background: var(--surface);
  color: var(--text);
  border-top: 1px solid var(--border);
  border-top-left-radius: 20px;
  border-top-right-radius: 20px;
  padding: 12px 16px calc(20px + env(safe-area-inset-bottom));
  max-height: 84vh;
  max-height: 84dvh;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  transform: translateY(106%);
  transition: transform 0.24s ease;
  box-shadow: 0 -8px 30px rgba(0, 0, 0, 0.2);
}

.sheet.half {
  max-height: 46vh;
  max-height: 46dvh;
  padding-top: 8px;
}

.sheet.open { transform: translateY(0); }

.sheet-handle-row {
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  height: 22px;
  margin-bottom: 8px;
}
.sheet-handle {
  width: 38px;
  height: 4px;
  border-radius: 99px;
  background: color-mix(in srgb, var(--muted) 35%, transparent);
}
.sheet-close-corner {
  position: absolute;
  right: 0;
  top: -2px;
  appearance: none;
  border: none;
  background: var(--surface-2);
  color: var(--text);
  border-radius: 999px;
  width: 26px;
  height: 26px;
  font-size: 13px;
  cursor: pointer;
}

.sheet-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}
.sheet-title { font-size: 16px; font-weight: 700; }
.close-btn {
  appearance: none;
  border: none;
  background: var(--surface-2);
  color: var(--text);
  border-radius: 999px;
  width: 28px;
  height: 28px;
  font-size: 14px;
  cursor: pointer;
}

/* Controls */
.control-group { margin-bottom: 12px; }
.control-group:last-child { margin-bottom: 2px; }
.control-label {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 5px;
  font-weight: 600;
}

input[type="range"] {
  width: 100%;
  accent-color: var(--accent);
  margin: 2px 0;
}

.text-input {
  width: 100%;
  padding: 10px 12px;
  border-radius: 11px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  outline: none;
}

.pill-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
}
.pill-row.two { grid-template-columns: repeat(2, 1fr); }
.pill-row.three { grid-template-columns: repeat(3, 1fr); }
.pill-row.five { grid-template-columns: repeat(5, 1fr); }

.pill {
  appearance: none;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  padding: 8px 4px;
  border-radius: 9px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}
.pill.active {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 18%, var(--surface));
  color: var(--accent);
}

.toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 10px;
  background: var(--surface-2);
  border-radius: 10px;
  margin-bottom: 8px;
  font-size: 13px;
  font-weight: 500;
}
.toggle-row input[type="checkbox"] {
  width: 20px;
  height: 20px;
  accent-color: var(--accent);
  margin: 0;
}

.scroll-cta-row {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
}
.scroll-start-btn {
  flex: 1;
  appearance: none;
  border: none;
  background: var(--accent);
  color: #fff;
  padding: 10px 14px;
  border-radius: 11px;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
}

/* TOC & Search Lists */
.list-item-btn {
  width: 100%;
  text-align: left;
  appearance: none;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  border-radius: 11px;
  padding: 10px 12px;
  margin-bottom: 7px;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}
.list-item-btn.current {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 15%, var(--surface));
}
.list-item-title {
  font-size: 13px;
  font-weight: 600;
  line-height: 1.35;
}
.list-item-meta {
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
}

.search-row {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
}
.search-snippet {
  font-size: 13px;
  line-height: 1.4;
  color: var(--text);
}
.search-snippet mark {
  background: color-mix(in srgb, var(--accent) 30%, transparent);
  color: var(--text);
  border-radius: 3px;
  padding: 0 2px;
}

/* Notes & Flashcards */
.segmented {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  margin-bottom: 12px;
}

.export-row {
  display: flex;
  gap: 6px;
  margin-bottom: 10px;
  flex-wrap: wrap;
}

.raw-export-box {
  width: 100%;
  min-height: 110px;
  margin-bottom: 12px;
  padding: 10px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12px;
  display: none;
}
.raw-export-box.visible { display: block; }

.note-item {
  background: var(--surface-2);
  border-radius: 13px;
  padding: 12px;
  margin-bottom: 10px;
}
.note-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
}
.note-tag-pill {
  font-size: 11px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--accent) 18%, var(--surface));
  color: var(--accent);
}
.note-text {
  font-family: var(--font-family);
  font-size: 15px;
  line-height: 1.45;
  margin-bottom: 8px;
}
.note-comment-input {
  width: 100%;
  padding: 7px 9px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-size: 13px;
  margin-bottom: 8px;
}
.note-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12px;
  color: var(--muted);
  gap: 8px;
}
.note-jump-btn {
  appearance: none;
  border: none;
  background: transparent;
  color: var(--accent);
  font-size: 12px;
  font-weight: 600;
  padding: 0;
  cursor: pointer;
  text-align: left;
}
.del-btn {
  appearance: none;
  border: none;
  background: transparent;
  color: var(--danger);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}

/* Flashcard Study Mode */
.flashcard {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 22px 18px;
  min-height: 190px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  margin-bottom: 12px;
  cursor: pointer;
}
.flashcard-front {
  font-family: var(--font-family);
  font-size: 18px;
  line-height: 1.5;
  text-align: center;
  margin: 14px 0;
}
.flashcard-back {
  border-top: 1px dashed var(--border);
  padding-top: 12px;
  margin-top: 10px;
  font-size: 14px;
  line-height: 1.45;
  color: var(--muted);
  text-align: center;
}
.flashcard-actions {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

/* Toast */
.toast {
  position: fixed;
  top: calc(58px + env(safe-area-inset-top));
  left: 50%;
  transform: translateX(-50%) translateY(-16px);
  background: #111;
  color: #fff;
  padding: 8px 14px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s, transform 0.2s;
  z-index: 70;
  max-width: 90vw;
  text-align: center;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ===== Tryb czytania dla dziecka (Voice-Guided Reading — iOS i Android) ===== */
html.child-mode-active,
body.child-mode-active {
  overscroll-behavior: none;
  overscroll-behavior-y: none;
}

body.child-mode-active #readerView {
  touch-action: none;
}

body.child-mode-active .reader-content {
  -webkit-user-select: none;
  user-select: none;
}

body.child-mode-active .page-nav,
body.child-mode-active .save-bar,
body.child-mode-active .scroll-dock {
  display: none !important;
}

body.child-mode-active #backToLibBtn,
body.child-mode-active #openSearchBtn,
body.child-mode-active #openScrollBtn,
body.child-mode-active #openNotesBtn {
  opacity: 0.3;
  pointer-events: none;
}

body.child-mode-active #openTocBtn {
  pointer-events: none;
}

.cw {
  border-radius: 5px;
  transition: background 0.16s ease, color 0.16s ease;
}
.cw.read {
  color: color-mix(in srgb, var(--text) 45%, var(--bg));
}
.cw.current {
  background: color-mix(in srgb, var(--accent) 26%, transparent);
  color: var(--text);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 18%, transparent);
}

.child-status-banner {
  border-radius: 11px;
  padding: 9px 11px;
  font-size: 12px;
  line-height: 1.4;
  margin-bottom: 12px;
  font-weight: 500;
}
.child-status-banner.ok {
  background: color-mix(in srgb, var(--success) 16%, var(--surface-2));
  color: var(--text);
  border: 1px solid color-mix(in srgb, var(--success) 40%, transparent);
}
.child-status-banner.warn {
  background: color-mix(in srgb, var(--warn) 18%, var(--surface-2));
  color: var(--text);
  border: 1px solid color-mix(in srgb, var(--warn) 45%, transparent);
}

.scroll-start-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

/* Dolny panel HUD w trybie dziecka */
.child-hud {
  position: fixed;
  left: 12px;
  right: 12px;
  bottom: calc(12px + env(safe-area-inset-bottom));
  z-index: 36;
  max-width: 520px;
  margin: 0 auto;
  background: color-mix(in srgb, var(--surface) 95%, transparent);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 10px 12px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.25);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.child-hud-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.mic-indicator {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 13px;
  font-weight: 700;
}

.mic-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--muted);
  flex-shrink: 0;
}
.mic-dot.listening {
  background: var(--success);
  box-shadow: 0 0 0 0 rgba(48, 209, 88, 0.7);
  animation: micPulse 1.4s infinite;
}
.mic-dot.restarting {
  background: var(--warn);
}

@keyframes micPulse {
  0% { box-shadow: 0 0 0 0 rgba(48, 209, 88, 0.65); }
  70% { box-shadow: 0 0 0 8px rgba(48, 209, 88, 0); }
  100% { box-shadow: 0 0 0 0 rgba(48, 209, 88, 0); }
}

.child-progress-label {
  font-size: 12px;
  font-weight: 700;
  color: var(--accent);
}

.child-progress-track {
  height: 5px;
  border-radius: 99px;
  background: var(--surface-2);
  overflow: hidden;
}
.child-progress-fill {
  height: 100%;
  width: 0%;
  background: var(--success);
  transition: width 0.2s ease;
}

.child-transcript {
  font-size: 12px;
  color: var(--muted);
  background: var(--surface-2);
  border-radius: 9px;
  padding: 6px 9px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.child-hud-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.hold-exit-btn {
  position: relative;
  overflow: hidden;
  flex: 1;
  appearance: none;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  border-radius: 10px;
  height: 36px;
  padding: 0 10px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
}
.hold-exit-fill {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 0%;
  background: color-mix(in srgb, var(--danger) 35%, transparent);
  pointer-events: none;
}
.hold-exit-label {
  position: relative;
  z-index: 1;
}
