:root {
  color-scheme: light;
  --ink: #161616;
  --muted: #6d6a64;
  --paper: #f7f4ec;
  --panel: #fffdf7;
  --line: #ddd4c3;
  --accent: #d9352c;
  --accent-dark: #9d251f;
  --reader-anchor: rgba(188, 49, 41, 0.76);
  --title-red: rgba(125, 47, 42, 0.68);
  --speed-fill: rgba(213, 55, 48, 0.9);
  --speed-track: rgba(206, 205, 199, 0.86);
  --progress-fill-soft: rgba(62, 135, 123, 0.88);
  --progress-track-soft: rgba(219, 211, 197, 0.86);
  --green: #24745a;
  --blue: #284f7a;
  --teal: #2d756b;
  --shadow: 0 20px 60px rgba(40, 36, 28, 0.12);
  --ui-font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Inter", "Segoe UI", sans-serif;
  --reading-font: Georgia, "Times New Roman", serif;
  --screen-pad-top: max(14px, env(safe-area-inset-top));
  --screen-pad-right: max(16px, env(safe-area-inset-right));
  --screen-pad-bottom: max(16px, env(safe-area-inset-bottom));
  --screen-pad-left: max(16px, env(safe-area-inset-left));
  --top-control-size: 48px;
  --top-icon-size: 25px;
  --top-corner-inset: clamp(4px, 1.25vw, 8px);
  --bottom-control-size: 42px;
  --play-control-size: 60px;
  --progress-height: 6px;
  --progress-meta-size: clamp(0.76rem, 2.25vw, 0.9rem);
  --menu-icon-size: 54px;
  --menu-row-min-height: 86px;
  --ui-press-scale: 0.965;
  --motion-fast: 150ms cubic-bezier(0.2, 0.78, 0.26, 1);
  --motion-standard: 180ms ease;
  --focus-width: min(620px, 100%);
  --context-gap: 18px;
  --context-font-size: clamp(0.88rem, 1.35vw, 1.06rem);
  --ebook-font-size: clamp(1.14rem, 4.25vw, 1.48rem);
}

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

[hidden] {
  display: none !important;
}

button,
.controls,
.progress-track,
.reader-panel,
.focus-stage,
.word-display,
.context-line,
.context-focus-row,
.context-token,
.ebook-reader,
.ebook-page,
.ebook-word {
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  user-select: none;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--ui-font);
  touch-action: manipulation;
}

html.is-mobile-landscape,
html.is-mobile-landscape body {
  overflow: hidden;
  background: var(--paper);
}

html.is-mobile-landscape .app-shell,
html.is-mobile-landscape .input-panel,
html.is-mobile-landscape .chapter-panel,
html.is-mobile-landscape .onboarding-overlay {
  visibility: hidden !important;
  pointer-events: none !important;
}

html.is-mobile-landscape body::before,
html.is-mobile-landscape body::after {
  position: fixed;
  left: 50%;
  z-index: 1000;
  width: min(82vw, 360px);
  color: rgba(22, 22, 22, 0.86);
  text-align: center;
  transform: translateX(-50%);
}

html.is-mobile-landscape body::before {
  content: "Portrait only";
  top: 36%;
  font-family: var(--ui-font);
  font-size: clamp(1.3rem, 5vw, 2rem);
  font-weight: 690;
}

html.is-mobile-landscape body::after {
  content: "Rotate your phone upright to keep the reading point stable.";
  top: calc(36% + 48px);
  color: rgba(91, 87, 80, 0.72);
  font-size: clamp(0.88rem, 2.6vw, 1rem);
  line-height: 1.35;
}

html.onboarding-primed body {
  background:
    radial-gradient(circle at 50% 44%, rgba(255, 254, 250, 0.96), rgba(248, 245, 238, 0.93) 46%, rgba(239, 232, 219, 0.94)),
    var(--paper);
}

html.onboarding-primed .app-shell {
  opacity: 0;
  transform: scale(0.992);
}

html.onboarding-revealing .app-shell {
  animation: app-shell-onboarding-reveal 520ms cubic-bezier(0.2, 0.78, 0.26, 1) both;
}

.icon-sprite {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
}

.icon-sprite symbol {
  fill: none;
  stroke: currentColor;
  stroke-width: 1.75;
  stroke-linecap: round;
  stroke-linejoin: round;
  vector-effect: non-scaling-stroke;
}

body.reader-size-0 {
  --reader-font-size: clamp(2.3rem, 9vw, 4rem);
  --context-focus-font-size: clamp(1.1rem, 2.4vw, 2rem);
}

body.reader-size-1 {
  --reader-font-size: clamp(2.8rem, 11vw, 4.8rem);
  --context-focus-font-size: clamp(1.35rem, 3vw, 2.5rem);
}

body.reader-size-2 {
  --reader-font-size: clamp(3.2rem, 13vw, 5.6rem);
  --context-focus-font-size: clamp(1.6rem, 3.7vw, 3.1rem);
}

body.reader-size-3 {
  --reader-font-size: clamp(3.7rem, 15vw, 6.5rem);
  --context-focus-font-size: clamp(2rem, 4.6vw, 3.8rem);
}

body,
body.reader-size-4 {
  --reader-font-size: clamp(4.2rem, 17vw, 7.8rem);
  --context-focus-font-size: clamp(2.55rem, 6.5vw, 5.5rem);
}

body.reader-size-5 {
  --reader-font-size: clamp(4.8rem, 19vw, 9rem);
  --context-focus-font-size: clamp(2.9rem, 7.6vw, 6.4rem);
}

body.reader-size-6 {
  --reader-font-size: clamp(5.2rem, 21vw, 10.2rem);
  --context-focus-font-size: clamp(3.25rem, 8.6vw, 7.2rem);
}

body.reader-size-7 {
  --reader-font-size: clamp(5.6rem, 23vw, 11.4rem);
  --context-focus-font-size: clamp(3.6rem, 9.6vw, 8rem);
}

button,
textarea,
input {
  font: inherit;
}

button {
  border: 0;
  cursor: pointer;
  touch-action: manipulation;
  user-select: none;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.46;
}

.app-shell {
  width: 100%;
  min-height: 100dvh;
  margin: 0;
  display: block;
  padding: 0;
}

.reader-panel {
  min-height: 100dvh;
  padding:
    var(--screen-pad-top)
    var(--screen-pad-right)
    var(--screen-pad-bottom)
    var(--screen-pad-left);
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  gap: clamp(10px, 2vh, 18px);
  background: var(--paper);
}

body.ebook-mode .reader-panel {
  pointer-events: none;
}

.input-panel {
  position: fixed;
  inset: 0;
  z-index: 70;
  display: none;
  min-height: 100dvh;
  padding:
    max(18px, env(safe-area-inset-top))
    max(16px, env(safe-area-inset-right))
    max(18px, env(safe-area-inset-bottom))
    max(16px, env(safe-area-inset-left));
  overflow: auto;
  background:
    radial-gradient(circle at 12% 0%, rgba(255, 255, 255, 0.8), transparent 36%),
    linear-gradient(150deg, rgba(250, 246, 238, 0.98), rgba(239, 231, 217, 0.96));
  color: var(--ink);
}

.input-panel.is-open {
  display: block;
}

.input-panel.is-settings-screen {
  background:
    radial-gradient(circle at 50% -10%, rgba(255, 255, 255, 0.72), transparent 38%),
    linear-gradient(180deg, rgba(250, 246, 238, 0.98), rgba(242, 235, 223, 0.98));
}

.input-panel.is-settings-screen .menu-card {
  width: min(560px, 100%);
  padding-top: max(22px, env(safe-area-inset-top));
}

.input-panel.is-settings-screen .menu-close {
  display: none;
}

.top-bar {
  position: relative;
  z-index: 40;
  display: grid;
  grid-template-columns: var(--top-control-size) minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  min-height: var(--top-control-size);
}

.brand-block {
  position: absolute;
  top: 50%;
  left: 50%;
  z-index: 1;
  min-width: 0;
  width: min(58vw, 380px);
  max-width: calc(100% - 144px);
  display: grid;
  gap: 2px;
  justify-items: center;
  overflow: hidden;
  color: rgba(22, 22, 22, 0.58);
  text-align: center;
  transform: translate(-50%, -50%);
}

.title-chapter-button {
  appearance: none;
  border: 0;
  border-radius: 999px;
  padding: 6px 14px 7px;
  background: transparent;
  box-shadow: none;
  cursor: default;
  transition:
    background var(--motion-standard),
    box-shadow var(--motion-standard),
    color var(--motion-standard),
    opacity var(--motion-standard),
    transform var(--motion-standard);
}

.title-chapter-button::after {
  content: "";
  width: 4px;
  height: 4px;
  margin-top: 1px;
  border-radius: 50%;
  display: block;
  background: rgba(217, 53, 44, 0.46);
  opacity: 0;
  transform: scale(0.8);
  transition:
    opacity var(--motion-standard),
    transform var(--motion-standard);
}

.has-chapters .title-chapter-button {
  background: rgba(255, 253, 247, 0.28);
  box-shadow:
    inset 0 0 0 1px rgba(222, 214, 201, 0.2),
    0 7px 18px rgba(40, 36, 28, 0.025);
  cursor: pointer;
}

.has-chapters .title-chapter-button::after {
  opacity: 1;
}

.has-chapters .title-chapter-button:hover,
.has-chapters .title-chapter-button[aria-expanded="true"] {
  background: rgba(255, 253, 247, 0.58);
  box-shadow:
    inset 0 0 0 1px rgba(217, 53, 44, 0.12),
    0 8px 20px rgba(40, 36, 28, 0.04);
}

.title-chapter-button:active {
  transform: translate(-50%, -50%) scale(var(--ui-press-scale));
}

.title-chapter-button:disabled {
  cursor: default;
  opacity: 1;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--accent-dark);
  font-size: 0.8rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.brand-block span {
  margin: 0;
  max-width: 100%;
  overflow: hidden;
  font-family: var(--ui-font);
  font-size: clamp(0.8rem, 2.8vw, 0.94rem);
  font-weight: 690;
  letter-spacing: 0.04em;
  text-overflow: ellipsis;
  white-space: nowrap;
}

body:not(.has-loaded-text) .brand-block span {
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.brand-block small {
  max-width: 100%;
  overflow: hidden;
  color: rgba(91, 87, 80, 0.56);
  font-family: var(--reading-font);
  font-size: clamp(0.75rem, 2.35vw, 0.86rem);
  font-weight: 500;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.top-actions,
.ebook-actions {
  position: relative;
  z-index: 2;
  grid-column: 3;
  display: flex;
  gap: 4px;
  flex-wrap: nowrap;
  justify-content: flex-end;
  align-items: center;
  flex: 0 0 auto;
  color: var(--muted);
  font-size: 0.95rem;
}

.top-icon-button,
.top-mode-button {
  position: relative;
  z-index: 2;
  width: var(--top-control-size);
  min-width: var(--top-control-size);
  height: var(--top-control-size);
  border-radius: 50%;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background:
    linear-gradient(180deg, rgba(255, 253, 247, 0.82), rgba(237, 229, 216, 0.62));
  color: rgba(22, 22, 22, 0.56);
  box-shadow:
    0 10px 20px rgba(45, 38, 28, 0.08),
    inset 0 1px 1px rgba(255, 255, 255, 0.96),
    inset 0 -1px 2px rgba(129, 108, 82, 0.08);
  transition:
    background var(--motion-standard),
    color var(--motion-standard),
    opacity var(--motion-standard),
    transform var(--motion-standard);
}

.top-bar > .top-icon-button,
.ebook-top-bar > .top-icon-button {
  margin-inline-start: var(--top-corner-inset);
}

.top-actions .top-mode-button,
.ebook-actions .top-mode-button {
  margin-inline-end: var(--top-corner-inset);
}

.top-icon-button:hover,
.top-mode-button:hover {
  background:
    linear-gradient(180deg, rgba(255, 253, 247, 0.92), rgba(235, 226, 212, 0.74));
}

.top-icon-button:active,
.top-mode-button:active,
.text-size-button:active,
.bottom-mode-button:active,
.chapter-icon-button:active,
.settings-action:active,
.menu-row-button:active {
  transform: translateY(1px) scale(var(--ui-press-scale));
  box-shadow:
    0 3px 9px rgba(45, 38, 28, 0.08),
    inset 0 2px 5px rgba(80, 63, 43, 0.14),
    inset 0 1px 0 rgba(255, 255, 255, 0.56);
}

button.is-tactile-press {
  transform: translateY(1px) scale(var(--ui-press-scale));
  box-shadow:
    0 3px 9px rgba(45, 38, 28, 0.08),
    inset 0 2px 6px rgba(80, 63, 43, 0.14),
    inset 0 1px 0 rgba(255, 255, 255, 0.58);
}

button.title-chapter-button.is-tactile-press {
  transform: translate(-50%, -50%) scale(var(--ui-press-scale));
}

.chapter-button {
  color: rgba(22, 22, 22, 0.5);
}

.chapter-button:disabled {
  color: rgba(91, 87, 80, 0.28);
  opacity: 1;
}

.focus-stage {
  position: relative;
  min-height: 390px;
  display: grid;
  place-items: center;
  outline: 0;
  touch-action: none;
  caret-color: transparent;
  overflow: hidden;
  padding-block: 0;
}

.reader-panel.is-playing .top-bar,
.reader-panel.is-playing .bottom-dock {
  opacity: 0.42;
}

.focus-stage:focus-visible {
  box-shadow: none;
}

body.is-coaching-context-open .focus-stage::after {
  content: "";
  position: absolute;
  inset: clamp(8px, 2.2vw, 14px);
  z-index: 9;
  border: 2px solid rgba(168, 57, 51, 0.66);
  border-radius: 30px;
  box-shadow:
    0 0 0 1px rgba(255, 253, 247, 0.9),
    0 0 0 8px rgba(168, 57, 51, 0.07),
    0 12px 36px rgba(168, 57, 51, 0.1);
  opacity: 0;
  pointer-events: none;
  animation: context-tap-perimeter 1320ms cubic-bezier(0.22, 0.72, 0.22, 1) infinite both;
}

.context-hint {
  position: absolute;
  top: clamp(10px, 2.6vh, 24px);
  left: 50%;
  z-index: 3;
  transform: translateX(-50%);
  display: none;
  align-items: center;
  gap: 7px;
  max-width: min(88%, 320px);
  padding: 5px 11px 5px 5px;
  border-radius: 999px;
  background: rgba(223, 216, 203, 0.42);
  color: rgba(22, 22, 22, 0.52);
  font-size: clamp(0.68rem, 2.35vw, 0.8rem);
  font-weight: 700;
  white-space: nowrap;
  pointer-events: none;
}

.reader-panel.is-playing .context-hint,
.focus-stage:has(.word-display.has-context) .context-hint {
  opacity: 0;
}

.context-hint-icon {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: inline-grid;
  place-items: center;
  background: rgba(232, 223, 207, 0.86);
  color: rgba(22, 22, 22, 0.58);
  flex: 0 0 auto;
}

.tap-symbol {
  position: relative;
  width: 12px;
  height: 15px;
  display: block;
  border: 2px solid currentColor;
  border-radius: 7px 7px 5px 5px;
}

.tap-symbol::before {
  content: "";
  position: absolute;
  left: 50%;
  top: 2px;
  width: 2px;
  height: 6px;
  border-radius: 2px;
  background: currentColor;
  transform: translateX(-50%);
}

.word-display {
  position: relative;
  z-index: 1;
  width: var(--focus-width);
  min-width: 0;
  min-height: 100%;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  font-family: var(--reading-font);
  font-size: var(--reader-font-size);
  line-height: 1;
  letter-spacing: 0;
  color: var(--ink);
  overflow-wrap: normal;
  white-space: nowrap;
  word-break: keep-all;
}

.word-pivot {
  position: relative;
}

.word-display.has-context {
  width: min(760px, 100%);
  min-width: 0;
  height: 100%;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: clamp(2px, 0.4vh, 6px);
  align-items: center;
  justify-content: center;
  justify-items: center;
  overflow: hidden;
  --context-column-width: min(560px, calc(100vw - 44px), 100%);
}

.word-display.has-chapter-title {
  width: min(620px, 100%);
  display: grid;
  grid-template-columns: 1fr;
  place-items: center;
  white-space: normal;
}

.speed-chapter-card {
  display: grid;
  gap: clamp(8px, 1.4vh, 14px);
  justify-items: center;
  padding-inline: clamp(16px, 6vw, 42px);
  color: rgba(22, 22, 22, 0.82);
  text-align: center;
}

.speed-chapter-card span {
  color: rgba(125, 47, 42, 0.66);
  font-family: var(--ui-font);
  font-size: clamp(0.72rem, 2.6vw, 0.92rem);
  font-weight: 760;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.speed-chapter-card strong {
  max-width: min(100%, 12ch);
  color: var(--ink);
  font-family: var(--reading-font);
  font-size: clamp(2.1rem, 11vw, 5.5rem);
  font-weight: 400;
  line-height: 1.02;
  text-wrap: balance;
}

.speed-chapter-card small {
  color: rgba(109, 106, 100, 0.62);
  font-family: var(--ui-font);
  font-size: clamp(0.72rem, 2.5vw, 0.86rem);
  font-weight: 600;
}

.word-display.has-context.is-context-exiting {
  opacity: 0;
  filter: none;
  pointer-events: none;
}

.word-display.has-context::before,
.word-display.has-context::after {
  content: none;
  position: absolute;
  left: 50%;
  z-index: 2;
  width: var(--context-column-width);
  height: 34px;
  pointer-events: none;
  opacity: 0;
  transform: translateX(-50%);
  transition:
    opacity 140ms ease,
    transform 140ms ease;
}

.word-display.has-context::before {
  top: 0;
  background: linear-gradient(to bottom, rgba(217, 53, 44, 0.14), transparent);
}

.word-display.has-context::after {
  bottom: 0;
  background: linear-gradient(to top, rgba(217, 53, 44, 0.14), transparent);
}

.word-display.has-context.context-edge-prev::before,
.word-display.has-context.context-edge-next::after {
  opacity: 1;
}

.word-display.has-context.context-edge-prev.context-edge-push::before {
  transform: translate(-50%, 5px);
}

.word-display.has-context.context-edge-next.context-edge-push::after {
  transform: translate(-50%, -5px);
}

.context-line {
  width: var(--context-column-width);
  min-height: 1.12em;
  flex: 0 1 auto;
  display: block;
  box-sizing: border-box;
  padding-inline: 6px;
  overflow-x: visible;
  overflow-y: hidden;
  white-space: nowrap;
  color: var(--ink);
  font-size: var(--context-font-size);
  font-weight: 480;
  line-height: 1.14;
  text-align: left;
  opacity: 0.58;
  transition:
    background-color 120ms ease,
    box-shadow 120ms ease,
    opacity 140ms ease;
}

.context-line.is-empty {
  visibility: hidden;
}

.context-line.is-current-line {
  border-radius: 0.38em;
  background: rgba(121, 112, 98, 0.06);
  box-shadow: inset 0 0 0 1px rgba(121, 112, 98, 0.035);
  color: var(--ink);
  opacity: 1;
}

.context-line.is-near-line {
  color: var(--ink);
  opacity: 1;
}

.context-line.is-mid-line {
  color: var(--ink);
  opacity: 0.82;
}

.context-line.is-far-line {
  color: var(--ink);
  opacity: 0.58;
}

#contextButton {
  touch-action: none;
}

.context-token {
  position: relative;
  border: 0;
  background: transparent;
  color: inherit;
  display: inline-block;
  max-width: 100%;
  min-height: 0;
  padding: 0.025em 0.15em;
  border-radius: 0.28em;
  font: inherit;
  touch-action: manipulation;
  cursor: pointer;
  transition:
    background-color 80ms ease,
    box-shadow 120ms ease,
    color 80ms ease,
    opacity 160ms ease,
    text-shadow 120ms ease;
}

.context-token:hover,
.context-token:focus-visible {
  background: transparent;
  color: inherit;
  outline: 0;
}

.context-token-pivot {
  color: inherit;
}

.context-token.is-current .context-token-pivot {
  color: var(--reader-anchor);
}

.context-token.is-near {
  color: inherit;
}

.context-token.is-current-sentence {
  font-weight: inherit;
  color: inherit;
  opacity: 1;
  text-shadow: none;
}

.context-token.is-current {
  background: rgba(255, 231, 148, 0.5);
  box-shadow:
    inset 0 0 0 1px rgba(217, 53, 44, 0.18),
    0 0 0 3px rgba(255, 224, 132, 0.12),
    0 5px 14px rgba(217, 53, 44, 0.08);
  color: var(--ink);
  text-shadow: 0.012em 0 0 rgba(22, 22, 22, 0.42);
}

.word-display.has-context.is-context-exiting .context-token.is-current {
  color: var(--ink);
  opacity: 1;
}

.word-display.has-context.is-context-entering .context-token.is-current {
  opacity: 0;
}

.word-display.has-context.is-context-entering .context-token:not(.is-current) {
  opacity: 1;
}

.word-display.has-context.is-context-entering .context-token.is-current-sentence:not(.is-current) {
  opacity: 1;
}

.word-display.has-context.is-context-landing .context-token:not(.is-current) {
  opacity: 1;
}

.word-display.has-context.is-context-landing .context-token.is-current-sentence {
  opacity: 1;
}

.word-display.has-context.is-context-landing .context-token.is-current {
  animation: contextLandingGlow 720ms ease-out both;
}

.word-display.has-context.is-context-landing .context-token.is-current::after {
  content: "";
  position: absolute;
  inset: -0.16em -0.22em;
  z-index: -1;
  border-radius: 0.42em;
  border: 1px solid rgba(217, 53, 44, 0.24);
  background: rgba(255, 224, 132, 0.2);
  pointer-events: none;
  animation: contextLandingRipple 720ms ease-out both;
}

.context-token.is-distance-current {
  color: inherit;
}

.context-token.is-distance-1 {
  color: inherit;
}

.context-token.is-distance-2 {
  color: inherit;
}

.context-token.is-distance-3 {
  color: inherit;
}

.context-token.is-distance-far {
  color: inherit;
}

.context-token.is-current-sentence {
  color: inherit;
  opacity: 1;
}

.context-flight-word {
  position: fixed;
  z-index: 80;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  box-sizing: border-box;
  padding: 0;
  border-radius: 0;
  font-family: var(--reading-font);
  font-weight: 400;
  line-height: 1;
  color: var(--ink);
  background: transparent;
  pointer-events: none;
  transform-origin: center center;
  will-change: transform, opacity;
}

@keyframes contextLandingGlow {
  0% {
    background: rgba(255, 224, 132, 0.62);
    box-shadow:
      inset 0 0 0 1px rgba(217, 53, 44, 0.18),
      0 0 0 0 rgba(217, 53, 44, 0.18),
      0 10px 24px rgba(217, 53, 44, 0.14);
  }

  60% {
    background: rgba(255, 216, 96, 0.56);
    box-shadow:
      inset 0 0 0 1.5px rgba(217, 53, 44, 0.22),
      0 0 0 7px rgba(217, 53, 44, 0),
      0 7px 18px rgba(217, 53, 44, 0.1);
  }

  100% {
    background: rgba(255, 216, 96, 0.48);
    box-shadow:
      inset 0 0 0 1.5px rgba(217, 53, 44, 0.2),
      0 0 0 3px rgba(255, 224, 132, 0.2),
      0 7px 18px rgba(217, 53, 44, 0.12);
  }
}

@keyframes contextLandingRipple {
  0% {
    opacity: 0.95;
    transform: scale(0.86);
  }

  100% {
    opacity: 0;
    transform: scale(1.5);
  }
}

@keyframes context-tap-perimeter {
  0% {
    opacity: 0;
    transform: scale(0.985);
  }

  18% {
    opacity: 1;
    transform: scale(1);
  }

  58% {
    opacity: 0.72;
  }

  100% {
    opacity: 0;
    transform: scale(1.012);
  }
}

.word-left {
  text-align: right;
  white-space: nowrap;
}

.word-pivot {
  color: var(--reader-anchor);
  text-align: center;
  white-space: nowrap;
}

.word-right {
  text-align: left;
  white-space: nowrap;
}

.muted {
  grid-column: 1 / -1;
  padding: clamp(18px, 5vw, 34px) clamp(22px, 8vw, 46px);
  border-radius: 999px;
  color: rgba(91, 87, 80, 0.72);
  font-family: var(--reading-font);
  font-size: clamp(1.95rem, 8vw, 3.35rem);
  font-weight: 500;
  line-height: 1.08;
  text-align: center;
  text-wrap: balance;
}

.empty-reader-state {
  grid-column: 1 / -1;
  width: min(360px, 100%);
  justify-self: center;
  display: grid;
  justify-items: center;
  gap: clamp(16px, 3vh, 22px);
  text-align: center;
}

.empty-reader-title {
  margin: 0;
  color: rgba(91, 87, 80, 0.74);
  font-family: var(--reading-font);
  font-size: clamp(2.05rem, 9vw, 3.35rem);
  font-weight: 500;
  line-height: 1.02;
  text-wrap: balance;
}

.empty-reader-actions,
.ebook-empty-actions {
  width: min(292px, calc(100vw - 44px));
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  justify-content: center;
  gap: 9px;
}

.empty-reader-action,
.ebook-empty-load {
  width: 100%;
  min-height: 42px;
  padding: 0 10px;
  border-radius: 999px;
  background: rgba(255, 253, 247, 0.82);
  color: rgba(22, 22, 22, 0.78);
  font-family: var(--ui-font);
  font-size: 0.9rem;
  font-weight: 680;
  box-shadow:
    0 12px 26px rgba(40, 36, 28, 0.1),
    inset 0 0 0 1px rgba(221, 212, 195, 0.54),
    inset 0 1px 0 rgba(255, 255, 255, 0.76);
}

.empty-reader-action.is-primary,
.ebook-empty-load:not(.is-secondary) {
  background: rgba(22, 22, 22, 0.9);
  color: rgba(255, 253, 247, 0.96);
  box-shadow:
    0 14px 28px rgba(40, 36, 28, 0.16),
    inset 0 1px 0 rgba(255, 255, 255, 0.14);
}

.progress-wrap {
  display: grid;
  gap: 8px;
  padding-block: 2px 0;
  touch-action: none;
}

.bottom-dock {
  display: grid;
  gap: 9px;
  padding-top: 8px;
  padding-bottom: max(48px, calc(env(safe-area-inset-bottom) + 32px));
  border-top: 1px solid rgba(216, 204, 186, 0.66);
  transition: opacity var(--motion-standard);
}

.progress-track {
  height: var(--progress-height);
  overflow: hidden;
  border-radius: 999px;
  background: var(--progress-track-soft);
  cursor: pointer;
  touch-action: none;
}

.progress-track.is-scrubbing {
  outline: 3px solid rgba(62, 135, 123, 0.18);
}

.progress-fill {
  width: 0%;
  height: 100%;
  background: var(--progress-fill-soft);
  transition: width 120ms linear;
}

.progress-track.is-scrubbing .progress-fill {
  transition: none;
}

.progress-meta {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  color: rgba(91, 87, 80, 0.72);
  font-family: var(--ui-font);
  font-size: var(--progress-meta-size);
  font-weight: 450;
  letter-spacing: 0.01em;
}

.controls,
.input-actions {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

.input-actions {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 5px;
}

.input-actions button {
  min-width: 0;
  min-height: 36px;
  padding-inline: 6px;
  font-size: clamp(0.68rem, 2.35vw, 0.78rem);
  white-space: nowrap;
}

.controls {
  width: min(560px, 100%);
  max-width: 100%;
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: center;
  gap: 12px;
  justify-self: center;
  flex-wrap: nowrap;
}

.transport-controls {
  grid-column: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: clamp(226px, 56vw, 258px);
  gap: 16px;
  padding: 8px 10px;
  border: 1px solid rgba(255, 255, 255, 0.62);
  border-radius: 999px;
  background:
    radial-gradient(circle at 50% 0%, rgba(255, 255, 255, 0.86), rgba(255, 255, 255, 0.22) 42%, transparent 64%),
    linear-gradient(180deg, rgba(248, 244, 236, 0.94), rgba(223, 214, 199, 0.82));
  box-shadow:
    0 18px 34px rgba(43, 36, 27, 0.17),
    0 2px 4px rgba(255, 255, 255, 0.92),
    inset 0 1px 2px rgba(255, 255, 255, 0.96),
    inset 0 -3px 8px rgba(103, 83, 58, 0.12);
  backdrop-filter: blur(14px);
}

.controls > .text-size-button {
  grid-column: 1;
  justify-self: start;
}

.controls > .bottom-mode-button {
  grid-column: 3;
  justify-self: end;
}

.text-size-button {
  width: var(--bottom-control-size);
  min-width: var(--bottom-control-size);
  min-height: var(--bottom-control-size);
  padding-inline: 0;
  gap: 2px;
  border-radius: 50%;
  aspect-ratio: 1;
  touch-action: none;
  overflow: visible;
  box-shadow:
    0 12px 28px rgba(40, 36, 28, 0.14),
    inset 0 1px 1px rgba(255, 255, 255, 1),
    inset 0 0 0 999px rgba(255, 255, 255, 0.58);
}

.bottom-mode-button {
  width: var(--bottom-control-size);
  min-width: var(--bottom-control-size);
  min-height: var(--bottom-control-size);
  padding-inline: 0;
  background: #ffffff;
  color: rgba(10, 10, 10, 0.72);
  border: 0;
  border-radius: 50%;
  aspect-ratio: 1;
  box-shadow:
    0 12px 28px rgba(40, 36, 28, 0.14),
    inset 0 1px 1px rgba(255, 255, 255, 1),
    inset 0 0 0 999px rgba(255, 255, 255, 0.58);
}

.top-actions #ebookModeButton,
.ebook-actions #ebookSpeedModeButton {
  color: rgba(22, 22, 22, 0.6);
}

body.ebook-mode #ebookSpeedModeButton {
  transform: translateY(1px) scale(var(--ui-press-scale));
  background:
    linear-gradient(180deg, rgba(226, 218, 205, 0.96), rgba(246, 240, 229, 0.9));
  color: rgba(22, 22, 22, 0.76);
  box-shadow:
    0 5px 14px rgba(45, 38, 28, 0.1),
    inset 0 3px 8px rgba(77, 60, 39, 0.14),
    inset 0 -1px 1px rgba(255, 255, 255, 0.72);
}

.font-size-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 2px;
  line-height: 1;
  color: rgba(10, 10, 10, 0.92);
  transform: translateX(1px);
}

.font-size-mark-a {
  font-family: var(--reading-font);
  font-size: 1.02rem;
  font-weight: 700;
  letter-spacing: 0;
}

.font-size-mark-signs {
  display: inline-grid;
  grid-template-rows: 1fr 1fr;
  gap: 0;
  margin-top: -1px;
  font-family: var(--ui-font);
  font-size: 0.62rem;
  font-weight: 850;
  line-height: 0.76;
  text-align: center;
}

.primary-button,
.ghost-button,
.icon-button,
.file-picker span {
  min-height: 44px;
  border-radius: 8px;
  padding: 0 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  transition:
    transform 120ms ease,
    background-color 120ms ease,
    box-shadow 120ms ease,
    filter 120ms ease;
}

.primary-button {
  background: transparent;
  color: var(--ink);
  min-width: 66px;
}

#playButton {
  width: var(--play-control-size);
  min-width: var(--play-control-size);
  min-height: var(--play-control-size);
  position: relative;
  overflow: hidden;
  background:
    radial-gradient(circle at 50% 24%, rgba(255, 255, 255, 1), rgba(255, 253, 247, 0.96) 42%, rgba(229, 219, 204, 0.9) 100%);
  color: rgba(10, 10, 10, 0.96);
  box-shadow:
    0 16px 24px rgba(45, 38, 28, 0.23),
    0 5px 8px rgba(45, 38, 28, 0.1),
    inset 0 2px 2px rgba(255, 255, 255, 1),
    inset 0 -5px 9px rgba(105, 82, 55, 0.13),
    inset 0 0 0 1px rgba(255, 255, 255, 0.7);
}

#playButton::before {
  content: "";
  position: absolute;
  inset: 5px;
  border-radius: inherit;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.58), transparent 42%),
    radial-gradient(circle at 50% 100%, rgba(111, 91, 64, 0.1), transparent 56%);
  pointer-events: none;
}

#playButton .control-symbol {
  position: relative;
  z-index: 1;
}

#playButton:active {
  transform: translateY(3px) scale(0.976);
  box-shadow:
    0 7px 14px rgba(45, 38, 28, 0.14),
    inset 0 5px 10px rgba(77, 60, 39, 0.18),
    inset 0 -1px 2px rgba(255, 255, 255, 0.72);
}

#playButton.is-paused {
  background:
    radial-gradient(circle at 50% 32%, rgba(238, 230, 217, 0.98), rgba(248, 243, 233, 0.94) 64%, rgba(222, 211, 194, 0.9) 100%);
  box-shadow:
    0 8px 16px rgba(45, 38, 28, 0.13),
    inset 0 5px 12px rgba(77, 60, 39, 0.18),
    inset 0 -1px 2px rgba(255, 255, 255, 0.72),
    inset 0 0 0 1px rgba(170, 145, 111, 0.12);
  transform: translateY(2px) scale(0.986);
}

.compact-control {
  width: var(--play-control-size);
  min-width: var(--play-control-size);
  padding-inline: 0;
}

#playButton {
  border-radius: 50%;
  aspect-ratio: 1;
  min-height: var(--play-control-size);
  padding: 0;
}

#textPanelButton {
  border-radius: 50%;
  aspect-ratio: 1;
  min-height: var(--top-control-size);
  padding: 0;
}

#playButton {
  min-height: var(--play-control-size);
}

#textSizeButton {
  border-radius: 50%;
  aspect-ratio: 1;
  min-height: var(--bottom-control-size);
  padding: 0;
}

.text-size-button {
  background:
    linear-gradient(180deg, rgba(255, 255, 252, 0.98), rgba(239, 231, 218, 0.86));
  color: rgba(10, 10, 10, 0.96);
}

.text-size-button.is-open {
  background: #fff;
  box-shadow:
    0 10px 26px rgba(40, 36, 28, 0.16),
    inset 0 1px 1px rgba(255, 255, 255, 1);
}

.font-size-popover {
  position: absolute;
  left: 0;
  right: auto;
  bottom: calc(100% + 10px);
  z-index: 12;
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 7px;
  border-radius: 999px;
  background: rgba(255, 255, 252, 0.94);
  box-shadow:
    0 16px 38px rgba(40, 36, 28, 0.16),
    inset 0 0 0 1px rgba(255, 255, 255, 0.88);
  backdrop-filter: blur(18px);
}

.font-size-option {
  width: 31px;
  height: 31px;
  min-height: 31px;
  padding: 0;
  border-radius: 50%;
  display: inline-grid;
  place-items: center;
  background: rgba(238, 232, 221, 0.66);
  color: rgba(35, 32, 28, 0.82);
  font-family: var(--reading-font);
  font-size: calc(1rem * var(--option-scale));
  font-weight: 700;
}

.font-size-option.is-active {
  background: rgba(22, 22, 22, 0.9);
  color: #fff;
}

.round-side-button {
  width: var(--bottom-control-size);
  min-width: var(--bottom-control-size);
  min-height: var(--bottom-control-size);
  border-radius: 50%;
  padding: 0;
  background:
    radial-gradient(circle at 50% 18%, rgba(255, 255, 255, 0.82), rgba(241, 235, 224, 0.9) 48%, rgba(221, 211, 196, 0.86) 100%);
  color: rgba(67, 63, 57, 0.94);
  line-height: 1;
  box-shadow:
    0 8px 15px rgba(40, 36, 28, 0.1),
    inset 0 2px 2px rgba(255, 255, 255, 0.9),
    inset 0 -3px 6px rgba(129, 108, 82, 0.11);
}

.icon-control {
  gap: 0;
}

.play-symbol,
.book-symbol,
.upload-symbol,
.chapter-symbol,
.speed-reader-symbol,
.sliders-symbol {
  width: var(--top-icon-size);
  height: var(--top-icon-size);
  display: inline-block;
  position: relative;
  color: currentColor;
}

.ui-symbol {
  fill: none;
  stroke: currentColor;
  stroke-width: 1.75;
  stroke-linecap: round;
  stroke-linejoin: round;
  overflow: visible;
}

.font-size-symbol {
  width: 23px;
  height: 23px;
}

.control-symbol {
  width: 22px;
  height: 22px;
  display: block;
  color: currentColor;
  pointer-events: none;
}

.arrow-symbol {
  width: 21px;
  height: 21px;
  stroke-width: 2.7;
}

#playButton .play-symbol {
  width: 29px;
  height: 29px;
}

#playButton .pause-icon {
  display: none;
  stroke-width: 2.9;
}

#playButton.is-paused .play-icon {
  display: none;
}

#playButton.is-paused .pause-icon {
  display: block;
}

.ui-symbol::before,
.ui-symbol::after {
  content: none !important;
  display: none !important;
}

.ghost-button,
.icon-button {
  background: #eee6d8;
  color: var(--ink);
}

.ghost-button.round-side-button {
  background: rgba(234, 228, 217, 0.86);
  color: rgba(67, 63, 57, 0.94);
}

.ghost-button.is-active,
.ghost-button.is-scrubbing,
.text-size-button.is-scrubbing {
  background: var(--accent);
  color: #fffdf7;
}

#contextButton.is-active {
  background: #f4ddd8;
  color: var(--accent-dark);
  box-shadow: inset 0 0 0 2px rgba(217, 53, 44, 0.8);
}

#contextButton.is-scrubbing {
  background: var(--accent);
  color: #fffdf7;
  box-shadow: none;
}

.context-button-hidden {
  display: none;
}

.icon-button {
  width: 48px;
  aspect-ratio: 1;
  border-radius: 50%;
  padding: 0;
  font-size: 1.35rem;
  font-weight: 900;
}

.primary-button:hover,
.ghost-button:hover,
.icon-button:hover,
.file-picker:hover span {
  filter: brightness(0.95);
}

.round-side-button,
.round-side-button:hover,
.round-side-button:focus,
.round-side-button:focus-visible,
.round-side-button:active,
.ghost-button.round-side-button,
.ghost-button.round-side-button:hover,
.ghost-button.round-side-button:focus,
.ghost-button.round-side-button:focus-visible,
.ghost-button.round-side-button:active {
  background:
    radial-gradient(circle at 50% 18%, rgba(255, 255, 255, 0.82), rgba(241, 235, 224, 0.9) 48%, rgba(221, 211, 196, 0.86) 100%);
  color: rgba(67, 63, 57, 0.94);
  filter: none;
  outline: none;
  transform: none;
  box-shadow:
    0 8px 15px rgba(40, 36, 28, 0.1),
    inset 0 2px 2px rgba(255, 255, 255, 0.9),
    inset 0 -3px 6px rgba(129, 108, 82, 0.11);
}

.slider-row {
  display: grid;
  grid-template-columns: auto minmax(160px, 1fr);
  align-items: center;
  gap: 12px;
  color: rgba(91, 87, 80, 0.82);
  font-family: var(--reading-font);
  font-size: clamp(0.92rem, 2.55vw, 1.16rem);
  font-weight: 500;
}

.speed-control {
  display: grid;
  grid-template-columns: minmax(120px, 1fr) max-content;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  min-height: 36px;
  background: transparent;
  accent-color: var(--speed-fill);
}

input[type="range"]::-webkit-slider-runnable-track {
  height: 4px;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--speed-fill) 0 var(--speed-percent, 25%), var(--speed-track) var(--speed-percent, 25%) 100%);
}

input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 32px;
  height: 20px;
  margin-top: -8px;
  border: 1px solid rgba(180, 174, 162, 0.42);
  border-radius: 999px;
  background: rgba(255, 253, 247, 0.96);
  box-shadow:
    0 4px 12px rgba(40, 36, 28, 0.18),
    inset 0 1px 0 rgba(255, 255, 255, 0.95);
}

input[type="range"]::-moz-range-track {
  height: 4px;
  border-radius: 999px;
  background: var(--speed-track);
}

input[type="range"]::-moz-range-progress {
  height: 4px;
  border-radius: 999px;
  background: var(--speed-fill);
}

input[type="range"]::-moz-range-thumb {
  width: 32px;
  height: 20px;
  border: 1px solid rgba(180, 174, 162, 0.42);
  border-radius: 999px;
  background: rgba(255, 253, 247, 0.96);
  box-shadow:
    0 4px 12px rgba(40, 36, 28, 0.18),
    inset 0 1px 0 rgba(255, 255, 255, 0.95);
}

output {
  color: rgba(22, 22, 22, 0.86);
  min-width: 84px;
  text-align: right;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(0.92rem, 2.55vw, 1.16rem);
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.control-helper {
  display: none;
  margin: -2px 0 0;
  color: rgba(109, 106, 100, 0.72);
  font-size: clamp(0.72rem, 2.5vw, 0.84rem);
  text-align: center;
}

.menu-card {
  position: relative;
  width: min(430px, 100%);
  min-height: calc(100dvh - max(18px, env(safe-area-inset-top)) - max(18px, env(safe-area-inset-bottom)));
  margin-inline: auto;
  padding: clamp(54px, 8.2vh, 86px) clamp(18px, 5vw, 30px) max(22px, env(safe-area-inset-bottom));
  display: grid;
  align-content: start;
  gap: clamp(14px, 2vh, 22px);
}

.menu-main {
  display: grid;
  gap: clamp(18px, 2.5vh, 26px);
}

.menu-close {
  position: fixed;
  top: var(--screen-pad-top);
  left: var(--screen-pad-left);
  z-index: 2;
  width: var(--top-control-size);
  height: var(--top-control-size);
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: rgba(255, 253, 247, 0.72);
  color: rgba(22, 22, 22, 0.62);
  box-shadow:
    inset 0 0 0 1px rgba(222, 214, 201, 0.38),
    0 10px 26px rgba(40, 36, 28, 0.08);
}

.menu-close span,
.menu-close span::after {
  width: 17px;
  height: 2px;
  border-radius: 999px;
  background: currentColor;
}

.menu-close span {
  position: relative;
  display: block;
  transform: rotate(45deg);
}

.menu-close span::after {
  content: "";
  position: absolute;
  inset: 0;
  transform: rotate(90deg);
}

.menu-hero h2 {
  margin: 0 0 6px;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(1.9rem, 7.5vw, 2.5rem);
  font-weight: 500;
  letter-spacing: 0;
  line-height: 1.08;
}

.menu-hero p {
  margin: 0;
  color: rgba(91, 87, 80, 0.82);
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(1rem, 4vw, 1.18rem);
}

.menu-section {
  display: grid;
  gap: 10px;
}

.menu-section-label {
  margin: 0;
  color: rgba(91, 87, 80, 0.78);
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.menu-list {
  display: grid;
  gap: 9px;
}

.add-text-list {
  overflow: hidden;
  gap: 0;
  border: 1px solid rgba(221, 212, 195, 0.74);
  border-radius: 14px;
  background: rgba(255, 253, 247, 0.74);
  box-shadow:
    0 18px 38px rgba(40, 36, 28, 0.08),
    inset 0 1px 0 rgba(255, 255, 255, 0.76);
}

.menu-row,
.premium-card {
  width: 100%;
  min-height: var(--menu-row-min-height);
  padding: 12px 15px;
  display: grid;
  grid-template-columns: var(--menu-icon-size) minmax(0, 1fr) auto;
  column-gap: 15px;
  align-items: center;
  border: 1px solid rgba(221, 212, 195, 0.74);
  border-radius: 14px;
  background: rgba(255, 253, 247, 0.74);
  color: var(--ink);
  box-shadow:
    0 14px 30px rgba(40, 36, 28, 0.07),
    inset 0 1px 0 rgba(255, 255, 255, 0.76);
  text-align: left;
}

.add-text-list .menu-row {
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

.add-text-list .menu-file-row {
  border-top: 1px solid rgba(221, 212, 195, 0.62);
}

.menu-row:disabled {
  cursor: default;
  opacity: 1;
}

.menu-row-icon {
  width: var(--menu-icon-size);
  height: var(--menu-icon-size);
  border-radius: 15px;
  display: grid;
  place-items: center;
  color: #fffdf7;
  background: transparent;
  box-shadow: none;
  overflow: hidden;
}

.menu-row-icon span {
  position: relative;
  width: 22px;
  height: 22px;
  display: block;
}

.menu-icon-svg {
  width: 32px;
  height: 32px;
  display: block;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.75;
  stroke-linecap: round;
  stroke-linejoin: round;
  filter: none;
}

.menu-icon-img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: contain;
  border-radius: inherit;
}

.menu-icon-heart {
  stroke-width: 1.75;
}

.menu-icon-paste {
  background-color: #ef7d72;
}

.menu-icon-upload {
  background-color: #79a0e5;
}

.menu-icon-library {
  background-color: #68a99a;
}

.menu-icon-settings {
  background-color: #937add;
}

.menu-icon-premium {
  background-color: #ec7d72;
}

.menu-icon-stats {
  color: rgba(255, 253, 247, 0.96);
  background:
    radial-gradient(circle at 72% 18%, rgba(255, 255, 255, 0.34), transparent 18%),
    linear-gradient(145deg, rgba(93, 171, 154, 0.94), rgba(42, 117, 104, 0.98));
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.38),
    inset 0 -1px 0 rgba(16, 76, 66, 0.2);
}

.menu-icon-stats .menu-icon-svg {
  width: 34px;
  height: 34px;
  stroke-width: 1.9;
}

.menu-icon-paste span {
  border: 2px solid currentColor;
  border-radius: 3px;
}

.menu-icon-paste span::before {
  content: "";
  position: absolute;
  top: 4px;
  left: 5px;
  width: 8px;
  height: 2px;
  background: currentColor;
  box-shadow: 0 5px 0 currentColor;
}

.menu-icon-upload span::before {
  content: "";
  position: absolute;
  left: 9px;
  top: 3px;
  width: 3px;
  height: 13px;
  border-radius: 999px;
  background: currentColor;
}

.menu-icon-upload span::after {
  content: "";
  position: absolute;
  left: 5px;
  top: 3px;
  width: 10px;
  height: 10px;
  border-top: 3px solid currentColor;
  border-left: 3px solid currentColor;
  transform: rotate(45deg);
  box-shadow: 7px 7px 0 -4px currentColor;
}

.menu-icon-library span {
  border: 2px solid currentColor;
  border-radius: 3px;
}

.menu-icon-library span::before,
.menu-icon-library span::after {
  content: "";
  position: absolute;
  top: 2px;
  bottom: 2px;
  width: 2px;
  border-radius: 999px;
  background: currentColor;
}

.menu-icon-library span::before {
  left: 6px;
}

.menu-icon-library span::after {
  right: 6px;
}

.menu-icon-settings span::before {
  content: "";
  position: absolute;
  inset: 4px;
  border: 3px solid currentColor;
  border-radius: 50%;
  box-shadow:
    0 -7px 0 -5px currentColor,
    0 7px 0 -5px currentColor,
    -7px 0 0 -5px currentColor,
    7px 0 0 -5px currentColor;
}

.menu-icon-premium span::before,
.menu-icon-premium span::after {
  content: "";
  position: absolute;
  left: 5px;
  top: 5px;
  width: 9px;
  height: 14px;
  border-radius: 9px 9px 0 0;
  background: currentColor;
  transform: rotate(-45deg);
  transform-origin: 50% 100%;
}

.menu-icon-premium span::after {
  left: 9px;
  transform: rotate(45deg);
}

.menu-row-copy {
  min-width: 0;
  display: grid;
  gap: 3px;
}

.menu-row-copy strong {
  overflow: hidden;
  color: rgba(22, 22, 22, 0.92);
  font-size: 0.98rem;
  font-weight: 620;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.menu-row-copy small {
  color: rgba(91, 87, 80, 0.76);
  font-size: 0.82rem;
  font-weight: 430;
  line-height: 1.25;
}

.menu-chevron {
  width: 9px;
  height: 9px;
  border-top: 2px solid rgba(91, 87, 80, 0.66);
  border-right: 2px solid rgba(91, 87, 80, 0.66);
  transform: rotate(45deg);
}

.menu-file-row {
  cursor: pointer;
}

.menu-file-row input {
  position: absolute;
  inline-size: 1px;
  block-size: 1px;
  opacity: 0;
}

.paste-editor {
  padding: 12px;
  display: grid;
  gap: 10px;
  border: 1px solid rgba(221, 212, 195, 0.64);
  border-radius: 14px;
  background: rgba(255, 253, 247, 0.68);
  box-shadow:
    0 12px 26px rgba(40, 36, 28, 0.06),
    inset 0 1px 0 rgba(255, 255, 255, 0.72);
}

.add-text-list .paste-editor {
  margin: 0 10px 10px;
  border-radius: 13px;
}

.paste-editor[hidden] {
  display: none;
}

.premium-card {
  border: 1px solid rgba(217, 132, 113, 0.34);
  border-radius: 14px;
  background:
    linear-gradient(135deg, rgba(255, 253, 247, 0.34), rgba(246, 225, 215, 0.16)),
    rgba(246, 225, 215, 0.52);
  opacity: 1;
}

.premium-card:disabled {
  cursor: default;
  opacity: 1;
}

.collection-view,
.settings-view,
.stats-view,
.help-view {
  display: grid;
  gap: 18px;
}

.collection-view[hidden],
.settings-view[hidden],
.stats-view[hidden],
.help-view[hidden] {
  display: none;
}

.collection-header {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr);
  gap: 14px;
  align-items: center;
}

.collection-header h2 {
  margin: 0;
  overflow: hidden;
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Inter", "Segoe UI", sans-serif;
  font-size: clamp(1.12rem, 4.2vw, 1.35rem);
  font-weight: 650;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.collection-header p {
  margin: 3px 0 0;
  color: rgba(91, 87, 80, 0.72);
  font-size: 0.9rem;
}

.collection-back {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: rgba(255, 253, 247, 0.72);
  color: rgba(22, 22, 22, 0.62);
  box-shadow:
    inset 0 0 0 1px rgba(222, 214, 201, 0.38),
    0 10px 24px rgba(40, 36, 28, 0.07);
}

.collection-back::before {
  content: "";
  width: 12px;
  height: 12px;
  border-left: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: translateX(2px) rotate(45deg);
}

.collection-list {
  display: grid;
  gap: 10px;
}

.collection-item {
  width: 100%;
  min-height: 86px;
  padding: 8px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 40px;
  gap: 8px;
  align-items: center;
  border: 1px solid rgba(221, 212, 195, 0.68);
  border-radius: 14px;
  background: rgba(255, 253, 247, 0.72);
  color: var(--ink);
  box-shadow: 0 12px 26px rgba(40, 36, 28, 0.06);
}

.collection-open {
  min-width: 0;
  min-height: 70px;
  padding: 2px;
  display: grid;
  grid-template-columns: 56px minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  background: transparent;
  color: inherit;
  text-align: left;
}

.collection-cover {
  width: 56px;
  height: 66px;
  overflow: hidden;
  border-radius: 7px;
  display: grid;
  place-items: center;
  background:
    linear-gradient(145deg, rgba(81, 135, 125, 0.84), rgba(37, 92, 83, 0.92));
  color: rgba(255, 253, 247, 0.92);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.6rem;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.3);
}

.collection-cover.has-image {
  background: rgba(229, 222, 210, 0.78);
}

.collection-cover img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
}

.collection-copy {
  min-width: 0;
  display: grid;
  gap: 5px;
}

.collection-copy strong {
  overflow: hidden;
  font-size: 1rem;
  font-weight: 620;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.collection-copy small,
.collection-meta,
.collection-empty {
  color: rgba(91, 87, 80, 0.74);
  font-size: 0.82rem;
}

.collection-progress {
  height: 4px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(219, 211, 197, 0.8);
}

.collection-progress span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: rgba(62, 135, 123, 0.88);
}

.collection-meta {
  align-self: end;
  padding-bottom: 8px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.collection-delete {
  width: 36px;
  height: 36px;
  min-height: 36px;
  padding: 0;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: rgba(238, 232, 221, 0.72);
  color: rgba(142, 91, 74, 0.82);
}

.collection-delete span {
  position: relative;
  width: 16px;
  height: 17px;
  display: block;
  border: 2px solid currentColor;
  border-top: 0;
  border-radius: 0 0 3px 3px;
}

.collection-delete span::before,
.collection-delete span::after {
  content: "";
  position: absolute;
  background: currentColor;
}

.collection-delete span::before {
  left: -2px;
  right: -2px;
  top: -5px;
  height: 2px;
  border-radius: 999px;
}

.collection-delete span::after {
  left: 5px;
  top: -8px;
  width: 6px;
  height: 2px;
  border-radius: 999px;
}

.collection-empty {
  margin: 12px 0 0;
  padding: 22px;
  border: 1px dashed rgba(151, 141, 123, 0.42);
  border-radius: 14px;
  text-align: center;
}

.collection-limit {
  margin: 2px 2px 0;
  padding: 11px 13px;
  border-radius: 13px;
  color: rgba(91, 87, 80, 0.72);
  background: rgba(255, 253, 247, 0.48);
  box-shadow: inset 0 0 0 1px rgba(221, 212, 195, 0.42);
  font-size: 0.78rem;
  line-height: 1.3;
}

.collection-limit.is-full {
  color: rgba(125, 47, 42, 0.76);
  background: rgba(246, 225, 215, 0.42);
  box-shadow: inset 0 0 0 1px rgba(217, 132, 113, 0.28);
}

.settings-stack {
  display: grid;
  gap: 22px;
  padding-bottom: 4px;
}

.settings-group {
  display: grid;
  gap: 8px;
}

.settings-label {
  margin: 0 0 0 5px;
  color: rgba(91, 87, 80, 0.74);
  font-size: 0.76rem;
  font-weight: 760;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.settings-list-card,
.settings-advanced {
  overflow: hidden;
  border: 1px solid rgba(221, 212, 195, 0.68);
  border-radius: 16px;
  background: rgba(255, 253, 247, 0.78);
  box-shadow:
    0 14px 30px rgba(40, 36, 28, 0.055),
    inset 0 1px 0 rgba(255, 255, 255, 0.7);
}

.settings-control,
.settings-toggle-row,
.settings-action {
  width: 100%;
  min-height: 74px;
  padding: 15px 16px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--ink);
  text-align: left;
  box-shadow: none;
}

.settings-control + .settings-control,
.settings-toggle-row + .settings-toggle-row,
.settings-advanced-body .settings-control + .settings-control,
.settings-advanced-body .settings-control + .settings-action,
.settings-advanced-body .settings-action + .settings-control,
.settings-advanced-body .settings-action + .settings-action {
  border-top: 1px solid rgba(221, 212, 195, 0.62);
}

.settings-action {
  cursor: pointer;
}

.settings-action:disabled {
  cursor: default;
  opacity: 0.58;
}

.settings-action-danger strong {
  color: rgba(142, 58, 47, 0.92);
}

.settings-copy {
  min-width: 0;
  display: grid;
  gap: 4px;
}

.settings-copy strong {
  overflow: hidden;
  color: rgba(22, 22, 22, 0.9);
  font-size: 1rem;
  font-weight: 640;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.settings-copy small {
  color: rgba(91, 87, 80, 0.72);
  font-size: 0.8rem;
  font-weight: 430;
  line-height: 1.28;
}

.settings-value {
  color: rgba(91, 87, 80, 0.76);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 0.84rem;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.settings-control input[type="range"] {
  grid-column: 1 / -1;
  width: 100%;
  height: 22px;
  margin: 2px 0 0;
  accent-color: rgba(190, 62, 54, 0.86);
}

.settings-mode-control,
.settings-size-control {
  margin: 0;
}

.settings-size-stack {
  grid-column: 1 / -1;
  display: grid;
  gap: 10px;
  padding-top: 2px;
}

.settings-mini-control {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 7px 12px;
  color: rgba(91, 87, 80, 0.82);
  font-size: 0.84rem;
  font-weight: 650;
}

.settings-mini-control input[type="range"] {
  grid-column: 1 / -1;
  width: 100%;
  height: 20px;
  margin: -2px 0 0;
  accent-color: rgba(190, 62, 54, 0.86);
}

.settings-segmented {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 4px;
  padding: 4px;
  border-radius: 999px;
  background: rgba(229, 222, 210, 0.64);
  box-shadow:
    inset 0 1px 3px rgba(40, 36, 28, 0.08),
    inset 0 0 0 1px rgba(177, 168, 153, 0.12);
}

.settings-segmented label {
  min-width: 0;
  cursor: pointer;
}

.settings-segmented input {
  position: absolute;
  inline-size: 1px;
  block-size: 1px;
  opacity: 0;
  pointer-events: none;
}

.settings-segmented span {
  min-height: 34px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  color: rgba(91, 87, 80, 0.72);
  font-size: 0.86rem;
  font-weight: 650;
  transition:
    background 160ms ease,
    color 160ms ease,
    box-shadow 160ms ease;
}

.settings-segmented input:checked + span {
  background: rgba(255, 253, 247, 0.92);
  color: rgba(22, 22, 22, 0.84);
  box-shadow:
    0 7px 14px rgba(40, 36, 28, 0.08),
    inset 0 1px 0 rgba(255, 255, 255, 0.84);
}

.settings-toggle-row {
  cursor: pointer;
}

.settings-toggle-row input {
  position: absolute;
  inline-size: 1px;
  block-size: 1px;
  opacity: 0;
  pointer-events: none;
}

.settings-switch {
  position: relative;
  width: 46px;
  height: 28px;
  border-radius: 999px;
  background: rgba(218, 211, 199, 0.9);
  box-shadow:
    inset 0 1px 3px rgba(40, 36, 28, 0.12),
    inset 0 0 0 1px rgba(177, 168, 153, 0.18);
  transition:
    background 160ms ease,
    box-shadow 160ms ease;
}

.settings-switch::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: rgba(255, 253, 247, 0.98);
  box-shadow:
    0 4px 10px rgba(40, 36, 28, 0.16),
    inset 0 1px 0 rgba(255, 255, 255, 0.9);
  transition: transform 160ms ease;
}

.settings-toggle-row input:checked + .settings-switch {
  background: rgba(62, 135, 123, 0.8);
  box-shadow:
    inset 0 1px 3px rgba(19, 74, 65, 0.18),
    inset 0 0 0 1px rgba(39, 111, 98, 0.14);
}

.settings-toggle-row input:checked + .settings-switch::after {
  transform: translateX(18px);
}

.settings-advanced summary {
  min-height: 74px;
  padding: 15px 16px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  cursor: pointer;
  list-style: none;
}

.settings-advanced summary::-webkit-details-marker {
  display: none;
}

.settings-advanced summary .menu-chevron {
  transition: transform 160ms ease;
}

.settings-advanced[open] summary .menu-chevron {
  transform: rotate(135deg);
}

.settings-advanced-body {
  border-top: 1px solid rgba(221, 212, 195, 0.62);
  background: rgba(247, 244, 236, 0.35);
}

.settings-advanced-body .settings-action {
  min-height: 70px;
}

.stats-tabs {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 3px;
  padding: 4px;
  border-radius: 999px;
  background: rgba(238, 232, 221, 0.56);
  box-shadow: inset 0 0 0 1px rgba(221, 212, 195, 0.44);
}

.stats-tab {
  min-width: 0;
  min-height: 36px;
  padding: 0 4px;
  position: relative;
  background: transparent;
  color: rgba(91, 87, 80, 0.76);
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 560;
  text-align: center;
}

.stats-tab::after {
  content: "";
  position: absolute;
  left: 12px;
  right: 12px;
  bottom: -1px;
  height: 2px;
  border-radius: 999px;
  background: transparent;
  transition:
    background 160ms ease,
    opacity 160ms ease;
}

.stats-tab.is-active {
  color: rgba(22, 22, 22, 0.9);
  background: rgba(255, 253, 247, 0.86);
  box-shadow:
    0 6px 14px rgba(40, 36, 28, 0.06),
    inset 0 1px 0 rgba(255, 255, 255, 0.8);
}

.stats-tab.is-active::after {
  background: transparent;
}

.stats-stack {
  display: grid;
  gap: 12px;
  padding-bottom: 4px;
}

.stats-card,
.stats-insight-card {
  border: 1px solid rgba(221, 212, 195, 0.56);
  border-radius: 18px;
  background: rgba(255, 253, 247, 0.82);
  box-shadow:
    0 16px 34px rgba(40, 36, 28, 0.052),
    inset 0 1px 0 rgba(255, 255, 255, 0.72);
}

.stats-card {
  padding: 16px;
}

.stats-speed-card {
  background:
    radial-gradient(circle at 86% 18%, rgba(62, 135, 123, 0.14), transparent 36%),
    linear-gradient(135deg, rgba(255, 253, 247, 0.9), rgba(247, 244, 236, 0.7));
}

.stats-card-heading,
.stats-speed-body,
.stats-wide-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.stats-card-heading {
  margin-bottom: 12px;
  color: rgba(22, 22, 22, 0.86);
  font-size: 0.86rem;
  font-weight: 620;
}

.stats-card-heading strong {
  padding: 5px 9px;
  border-radius: 999px;
  background: rgba(70, 153, 102, 0.12);
  color: rgba(47, 125, 75, 0.92);
  font-size: 0.78rem;
  font-weight: 720;
}

.stats-primary-number {
  margin: 0;
  display: flex;
  align-items: baseline;
  gap: 8px;
  color: rgba(22, 22, 22, 0.92);
  font-family: var(--ui-font);
  font-size: clamp(2.1rem, 9.5vw, 3.15rem);
  font-weight: 430;
  letter-spacing: 0;
  line-height: 1;
}

.stats-primary-number small {
  color: rgba(91, 87, 80, 0.74);
  font-size: 0.76rem;
  font-weight: 650;
  letter-spacing: 0.04em;
}

.stats-muted,
.stats-mini-card small,
.stats-wide-card small {
  margin: 0;
  color: rgba(91, 87, 80, 0.72);
  font-size: 0.78rem;
  line-height: 1.28;
}

.stats-muted span {
  color: rgba(47, 125, 75, 0.92);
  font-weight: 680;
}

.stats-sparkline {
  width: min(132px, 36vw);
  height: 72px;
  display: flex;
  align-items: end;
  gap: 5px;
  padding-top: 8px;
}

.stats-sparkline span {
  flex: 1;
  min-width: 4px;
  border-radius: 999px 999px 4px 4px;
  background: linear-gradient(180deg, rgba(88, 161, 101, 0.92), rgba(62, 135, 123, 0.82));
  opacity: 0.72;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.stats-mini-card {
  min-height: 146px;
  display: grid;
  align-content: start;
  gap: 7px;
}

.stats-mini-card > span:not(.stats-mini-icon),
.stats-wide-card span {
  color: rgba(22, 22, 22, 0.86);
  font-size: 0.86rem;
  font-weight: 620;
}

.stats-mini-card strong,
.stats-wide-card strong {
  color: rgba(22, 22, 22, 0.92);
  font-family: var(--ui-font);
  font-size: clamp(1.55rem, 7vw, 2.05rem);
  font-weight: 460;
  letter-spacing: 0;
  line-height: 1.05;
}

.stats-mini-icon {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: rgba(62, 135, 123, 0.92);
}

.stats-mini-icon::before {
  content: "";
  width: 16px;
  height: 16px;
  display: block;
}

.stats-mini-icon-time::before {
  border: 2px solid currentColor;
  border-radius: 50%;
  background:
    linear-gradient(currentColor, currentColor) 50% 30% / 2px 5px no-repeat,
    linear-gradient(currentColor, currentColor) 58% 56% / 6px 2px no-repeat;
}

.stats-mini-icon-pages::before,
.stats-mini-icon-books::before {
  border: 2px solid currentColor;
  border-radius: 3px;
  box-shadow: inset -5px 0 0 rgba(62, 135, 123, 0.16);
}

.stats-mini-icon-streak::before {
  border-radius: 50% 50% 48% 48%;
  background: currentColor;
  clip-path: polygon(50% 0, 74% 34%, 66% 62%, 50% 100%, 34% 62%, 26% 34%);
}

.stats-wide-card {
  align-items: stretch;
}

.stats-wide-card > div:first-child {
  min-width: 0;
  display: grid;
  align-content: center;
  gap: 6px;
}

.stats-week-bars {
  width: min(150px, 38vw);
  min-height: 74px;
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 5px;
  align-items: end;
}

.stats-week-bars span {
  min-width: 0;
  display: grid;
  align-items: end;
  justify-items: center;
  gap: 4px;
}

.stats-week-bars i {
  width: 100%;
  min-height: 9px;
  border-radius: 999px 999px 4px 4px;
  background: rgba(62, 135, 123, 0.82);
}

.stats-week-bars small {
  color: rgba(91, 87, 80, 0.56);
  font-size: 0.56rem;
  font-style: normal;
}

.stats-insight-card {
  padding: 14px;
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  gap: 12px;
  align-items: start;
  background:
    linear-gradient(135deg, rgba(232, 247, 241, 0.72), rgba(255, 253, 247, 0.66)),
    rgba(255, 253, 247, 0.78);
}

.stats-insight-icon {
  width: 30px;
  height: 30px;
  border: 2px solid rgba(62, 135, 123, 0.78);
  border-radius: 50%;
  position: relative;
}

.stats-insight-icon::before,
.stats-insight-icon::after {
  content: "";
  position: absolute;
  background: rgba(62, 135, 123, 0.78);
}

.stats-insight-icon::before {
  left: 13px;
  top: 4px;
  width: 2px;
  height: 18px;
  border-radius: 999px;
}

.stats-insight-icon::after {
  left: 6px;
  top: 12px;
  width: 16px;
  height: 2px;
  border-radius: 999px;
}

.stats-insight-card strong {
  display: block;
  margin-bottom: 3px;
  color: rgba(34, 91, 79, 0.95);
  font-size: 0.92rem;
  font-weight: 690;
}

.stats-insight-card p {
  margin: 0;
  color: rgba(54, 87, 80, 0.78);
  font-size: 0.82rem;
  line-height: 1.34;
}

.stats-achievements-card {
  display: grid;
  gap: 10px;
}

.stats-achievements-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.stats-achievement {
  min-width: 0;
  min-height: 128px;
  padding: 12px 11px;
  display: grid;
  align-content: start;
  gap: 6px;
  border-radius: 14px;
  background: rgba(247, 244, 236, 0.52);
  box-shadow: inset 0 0 0 1px rgba(221, 212, 195, 0.42);
}

.stats-achievement.is-locked {
  color: rgba(91, 87, 80, 0.72);
}

.stats-achievement-icon {
  width: 30px;
  height: 30px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  color: rgba(62, 135, 123, 0.92);
  background: rgba(62, 135, 123, 0.1);
}

.stats-achievement-icon::before {
  content: "";
  width: 17px;
  height: 17px;
  display: block;
}

.stats-achievement-icon-shoe::before {
  border-bottom: 3px solid currentColor;
  border-left: 3px solid currentColor;
  border-radius: 2px 2px 6px 7px;
  transform: skewX(-14deg);
}

.stats-achievement-icon-gauge::before {
  border: 2px solid currentColor;
  border-bottom-color: transparent;
  border-radius: 50% 50% 0 0;
  background: linear-gradient(currentColor, currentColor) 52% 70% / 8px 2px no-repeat;
  transform: rotate(-20deg);
}

.stats-achievement-icon-book::before {
  border: 2px solid currentColor;
  border-radius: 3px;
  box-shadow: inset -6px 0 0 rgba(62, 135, 123, 0.16);
}

.stats-achievement-icon-calendar::before {
  border: 2px solid currentColor;
  border-radius: 4px;
  background:
    linear-gradient(currentColor, currentColor) 0 34% / 100% 2px no-repeat,
    radial-gradient(circle at 35% 68%, currentColor 0 2px, transparent 2px);
}

.stats-achievement-icon-clock::before {
  border: 2px solid currentColor;
  border-radius: 50%;
  background:
    linear-gradient(currentColor, currentColor) 50% 24% / 2px 7px no-repeat,
    linear-gradient(currentColor, currentColor) 56% 56% / 7px 2px no-repeat;
}

.stats-achievement-icon-trophy::before {
  border: 2px solid currentColor;
  border-top-width: 4px;
  border-radius: 4px 4px 8px 8px;
  box-shadow:
    -5px 2px 0 -3px currentColor,
    5px 2px 0 -3px currentColor,
    0 9px 0 -6px currentColor;
}

.stats-achievement strong {
  overflow: hidden;
  color: rgba(22, 22, 22, 0.9);
  font-size: 0.86rem;
  font-weight: 670;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.stats-achievement small {
  min-height: 2.4em;
  color: rgba(91, 87, 80, 0.72);
  font-size: 0.74rem;
  line-height: 1.22;
}

.stats-achievement-progress {
  height: 4px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(219, 211, 197, 0.8);
}

.stats-achievement-progress span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: rgba(62, 135, 123, 0.82);
}

.stats-achievement em {
  color: rgba(91, 87, 80, 0.66);
  font-size: 0.7rem;
  font-style: normal;
  font-weight: 620;
}

.stats-achievement.is-unlocked {
  background:
    linear-gradient(135deg, rgba(232, 247, 241, 0.62), rgba(255, 253, 247, 0.78)),
    rgba(255, 253, 247, 0.78);
}

.stats-achievement.is-unlocked em {
  color: rgba(47, 125, 75, 0.92);
}

.stats-locked-card {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr);
  gap: 12px;
  background:
    radial-gradient(circle at 0 0, rgba(217, 53, 44, 0.1), transparent 36%),
    linear-gradient(135deg, rgba(255, 253, 247, 0.9), rgba(246, 225, 215, 0.28)),
    rgba(255, 253, 247, 0.78);
}

.stats-lock-orb {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: rgba(125, 47, 42, 0.72);
  background: rgba(246, 225, 215, 0.64);
  box-shadow:
    inset 0 0 0 1px rgba(217, 132, 113, 0.22),
    0 10px 22px rgba(125, 47, 42, 0.08);
}

.stats-lock-orb::before {
  content: "";
  width: 14px;
  height: 12px;
  border: 2px solid currentColor;
  border-radius: 3px;
  background: linear-gradient(currentColor, currentColor) 50% 55% / 2px 4px no-repeat;
  box-shadow: 0 -8px 0 -5px currentColor;
}

.stats-locked-copy {
  min-width: 0;
}

.stats-locked-kicker {
  display: block;
  margin-bottom: 4px;
  color: rgba(157, 37, 31, 0.7);
  font-size: 0.7rem;
  font-weight: 780;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.stats-locked-card strong {
  display: block;
  margin-bottom: 4px;
  color: rgba(22, 22, 22, 0.9);
  font-size: 1rem;
  font-weight: 690;
}

.stats-locked-card p {
  margin: 0;
  color: rgba(91, 87, 80, 0.76);
  font-size: 0.82rem;
  line-height: 1.34;
}

.stats-locked-grid {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.stats-locked-grid span {
  padding: 10px 11px;
  border-radius: 13px;
  display: grid;
  gap: 4px;
  background: rgba(247, 244, 236, 0.64);
  box-shadow: inset 0 0 0 1px rgba(221, 212, 195, 0.48);
}

.stats-locked-grid small {
  color: rgba(91, 87, 80, 0.66);
  font-size: 0.68rem;
  font-weight: 650;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.stats-locked-grid strong {
  margin: 0;
  overflow: hidden;
  font-family: var(--ui-font);
  font-size: 0.94rem;
  font-weight: 560;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.stats-premium-feature-list {
  grid-column: 1 / -1;
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.stats-premium-feature-list span {
  padding: 6px 9px;
  border-radius: 999px;
  color: rgba(91, 87, 80, 0.74);
  background: rgba(255, 253, 247, 0.58);
  box-shadow: inset 0 0 0 1px rgba(221, 212, 195, 0.46);
  font-size: 0.72rem;
  font-weight: 620;
}

.stats-premium-button {
  min-height: 54px;
  padding: 0 20px;
  border-radius: 999px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  background: linear-gradient(135deg, rgba(22, 22, 22, 0.94), rgba(58, 54, 48, 0.96));
  color: rgba(255, 253, 247, 0.96);
  font-size: 0.98rem;
  font-weight: 690;
  box-shadow:
    0 16px 32px rgba(40, 36, 28, 0.18),
    inset 0 1px 0 rgba(255, 255, 255, 0.14);
}

.stats-premium-button:disabled {
  cursor: default;
  opacity: 0.92;
}

.stats-premium-button span {
  width: 9px;
  height: 9px;
  border-top: 2px solid currentColor;
  border-right: 2px solid currentColor;
  transform: rotate(45deg);
}

.help-stack {
  display: grid;
  gap: 12px;
}

.help-card {
  padding: 17px 16px;
  border: 1px solid rgba(221, 212, 195, 0.68);
  border-radius: 16px;
  background: rgba(255, 253, 247, 0.78);
  box-shadow:
    0 14px 30px rgba(40, 36, 28, 0.055),
    inset 0 1px 0 rgba(255, 255, 255, 0.7);
}

.help-card h3 {
  margin: 0 0 8px;
  color: rgba(22, 22, 22, 0.92);
  font-size: 1rem;
  font-weight: 660;
}

.help-card p,
.help-card li {
  color: rgba(91, 87, 80, 0.78);
  font-size: 0.9rem;
  line-height: 1.45;
}

.help-card p {
  margin: 0;
}

.help-card ul {
  margin: 0;
  padding-left: 1.1rem;
}

.help-card li + li {
  margin-top: 5px;
}

.onboarding-overlay {
  position: fixed;
  inset: 0;
  z-index: 60;
  padding:
    max(18px, env(safe-area-inset-top))
    max(18px, env(safe-area-inset-right))
    max(22px, env(safe-area-inset-bottom))
    max(18px, env(safe-area-inset-left));
  display: grid;
  place-items: center;
  background:
    radial-gradient(circle at 50% 44%, rgba(255, 254, 250, 0.96), rgba(248, 245, 238, 0.93) 46%, rgba(239, 232, 219, 0.94)),
    var(--paper);
  color: var(--ink);
  transition:
    opacity 420ms ease,
    visibility 420ms ease;
  touch-action: none;
  animation: onboarding-arrive 520ms ease both;
}

.onboarding-overlay[hidden] {
  display: none;
}

.onboarding-overlay.is-leaving {
  opacity: 0;
  visibility: hidden;
}

.onboarding-speed {
  width: min(620px, 100%);
  min-height: min(620px, 76dvh);
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto auto;
  align-items: center;
  justify-items: center;
  gap: clamp(18px, 4vh, 32px);
  text-align: center;
}

.onboarding-kicker {
  align-self: start;
  margin: 0;
  color: rgba(125, 47, 42, 0.56);
  font-size: clamp(0.74rem, 2.5vw, 0.9rem);
  font-weight: 680;
  letter-spacing: 0.4em;
  text-transform: uppercase;
}

.onboarding-word {
  width: min(560px, 100%);
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: baseline;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(3.5rem, 17vw, 8.2rem);
  font-weight: 400;
  line-height: 0.95;
  opacity: 0;
  color: rgba(18, 18, 17, 0.9);
  transform: translateY(10px) scale(0.982);
  transition:
    opacity 240ms ease,
    transform 300ms cubic-bezier(0.2, 0.78, 0.26, 1);
}

.onboarding-word.is-visible {
  opacity: 1;
  transform: translateY(0) scale(1);
}

.onboarding-progress {
  width: min(180px, 42vw);
  height: 2px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(219, 211, 197, 0.52);
}

.onboarding-progress span {
  display: block;
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background: rgba(125, 47, 42, 0.38);
  transition: width 340ms ease;
}

.onboarding-hint {
  max-width: 280px;
  margin: 0;
  color: rgba(91, 87, 80, 0.52);
  font-family: var(--ui-font);
  font-size: clamp(0.78rem, 2.6vw, 0.9rem);
  font-weight: 470;
  line-height: 1.35;
}

/* First-use coaching popups */
.coach-layer {
  position: fixed;
  inset: 0;
  z-index: 75;
  pointer-events: none;
  opacity: 0;
  transition: opacity 180ms ease;
}

.coach-layer::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 50% 48%, rgba(45, 38, 29, 0.035), rgba(30, 25, 19, 0.14)),
    rgba(34, 29, 23, 0.09);
  backdrop-filter: blur(0.7px);
  pointer-events: auto;
}

.coach-layer[data-tip="play"]::before {
  backdrop-filter: none;
  pointer-events: none;
}

.coach-layer[data-tip="context-open"]::before {
  background: transparent;
  backdrop-filter: none;
  pointer-events: none;
}

.coach-layer[data-tip="context-use"]::before {
  background: transparent;
  backdrop-filter: none;
  pointer-events: none;
}

.coach-layer[data-tip="context-resume"]::before {
  background: transparent;
  backdrop-filter: none;
  pointer-events: none;
}

.coach-layer[data-tip="ebook-switch"]::before {
  pointer-events: none;
}

.coach-layer[data-tip="ebook-arrived"]::before {
  pointer-events: none;
}

.coach-layer[data-tip="context-open"],
.coach-layer[data-tip="context-use"],
.coach-layer[data-tip="context-resume"] {
  z-index: 82;
}

body:has(.coach-layer[data-tip="context-open"].is-visible) .focus-stage {
  position: relative;
  z-index: 76;
}

body.is-coaching-context-open .focus-stage {
  position: relative;
  z-index: 76;
}

body.is-coaching-context-use .focus-stage {
  position: relative;
  z-index: 76;
}

body.is-coaching-context-resume .focus-stage {
  position: relative;
  z-index: 76;
}

body.is-coaching-ebook-switch #ebookModeButton {
  position: relative;
  z-index: 76;
  opacity: 1;
  color: rgba(32, 30, 27, 0.82);
  filter: none;
}

body.is-coaching-ebook-switch #ebookModeButton::after {
  content: "";
  position: absolute;
  inset: -10px;
  border-radius: 999px;
  background: rgba(255, 253, 247, 0.62);
  box-shadow:
    0 14px 34px rgba(54, 42, 28, 0.16),
    0 0 0 1px rgba(168, 143, 115, 0.18);
  z-index: -1;
}

body.is-coaching-play .bottom-dock {
  position: relative;
  z-index: 76;
}

body.is-coaching-play .bottom-dock > :not(.controls),
body.is-coaching-play .text-size-button,
body.is-coaching-play .round-side-button,
body.is-coaching-play .control-helper {
  filter: blur(1.2px);
  opacity: 0.55;
}

body.is-coaching-play #playButton {
  filter: none;
  opacity: 1;
  box-shadow:
    0 16px 34px rgba(40, 36, 28, 0.22),
    inset 0 1px 0 rgba(255, 255, 255, 0.74);
}

.coach-layer[hidden] {
  display: none;
}

.coach-layer.is-visible {
  opacity: 1;
}

.coach-card {
  position: absolute;
  width: min(350px, calc(100vw - 48px));
  min-height: 166px;
  padding: 27px 54px 34px 28px;
  border: 1px solid rgba(156, 134, 108, 0.11);
  border-radius: 24px;
  background: rgba(255, 253, 247, 0.94);
  color: rgba(30, 28, 25, 0.9);
  box-shadow:
    0 26px 72px rgba(54, 42, 28, 0.2),
    inset 0 1px 0 rgba(255, 255, 255, 0.72);
  backdrop-filter: blur(20px);
  pointer-events: auto;
  transform: translateY(6px) scale(0.985);
  transition: transform 220ms cubic-bezier(0.2, 0.78, 0.26, 1);
}

.coach-layer[data-tip="context-use"] .coach-card,
.coach-layer[data-tip="context-resume"] .coach-card {
  width: min(318px, calc(100vw - 32px));
  min-height: 0;
  padding: 16px 48px 34px 18px;
  border-radius: 19px;
  background: rgba(255, 253, 247, 0.97);
  box-shadow:
    0 16px 42px rgba(54, 42, 28, 0.13),
    inset 0 1px 0 rgba(255, 255, 255, 0.78);
  backdrop-filter: blur(8px);
}

.coach-layer[data-tip="context-use"] .coach-symbol,
.coach-layer[data-tip="context-resume"] .coach-symbol {
  width: 30px;
  height: 30px;
  margin-bottom: 10px;
}

.coach-layer[data-tip="context-use"] .coach-card strong,
.coach-layer[data-tip="context-resume"] .coach-card strong {
  margin-bottom: 5px;
  font-size: clamp(0.98rem, 3.7vw, 1.12rem);
}

.coach-layer[data-tip="context-use"] .coach-card span,
.coach-layer[data-tip="context-resume"] .coach-card span {
  font-size: clamp(0.84rem, 3.1vw, 0.94rem);
  line-height: 1.36;
}

.coach-layer.is-visible .coach-card {
  transform: translateY(0) scale(1);
}

.coach-card strong,
.coach-card span {
  display: block;
}

.coach-card strong {
  margin-bottom: 9px;
  font-size: clamp(1.08rem, 4.2vw, 1.34rem);
  font-weight: 780;
  letter-spacing: 0.01em;
}

.coach-card span {
  color: rgba(80, 74, 65, 0.78);
  font-size: clamp(0.92rem, 3.4vw, 1.02rem);
  font-weight: 520;
  line-height: 1.45;
}

.coach-step {
  position: absolute;
  left: 28px;
  bottom: 16px;
  color: rgba(101, 94, 82, 0.5);
  font-size: 0.76rem;
  font-style: normal;
  font-weight: 650;
  letter-spacing: 0.08em;
}

.coach-dismiss {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 30px;
  height: 30px;
  border-radius: 999px;
  background: rgba(238, 232, 220, 0.82);
}

.coach-dismiss::before,
.coach-dismiss::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 12px;
  height: 1.7px;
  border-radius: 999px;
  background: rgba(75, 71, 65, 0.58);
}

.coach-dismiss::before {
  transform: translate(-50%, -50%) rotate(45deg);
}

.coach-dismiss::after {
  transform: translate(-50%, -50%) rotate(-45deg);
}

.coach-card-play {
  left: 50%;
  top: 50%;
  transform-origin: 50% 100%;
  translate: -50% -50%;
}

.coach-card-context-open {
  left: 50%;
  bottom: calc(env(safe-area-inset-bottom) + 92px);
  width: min(318px, calc(100vw - 56px));
  min-height: 0;
  padding: 18px 50px 36px 20px;
  translate: -50% 0;
}

.coach-card-context {
  left: 50%;
  bottom: calc(env(safe-area-inset-bottom) + 112px);
  translate: -50% 0;
}

.coach-card-ebook {
  left: 50%;
  bottom: calc(env(safe-area-inset-bottom) + 136px);
  translate: -50% 0;
}

.coach-card-ebook-switch {
  right: 22px;
  top: calc(env(safe-area-inset-top) + 86px);
}

.coach-symbol {
  width: 42px;
  height: 42px;
  margin-bottom: 18px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  background: rgba(235, 225, 208, 0.74);
  color: rgba(125, 47, 42, 0.75);
}

.coach-symbol-book .book-symbol {
  width: 22px;
  height: 22px;
}

.coach-symbol-play span {
  width: 0;
  height: 0;
  margin-left: 3px;
  border-top: 9px solid transparent;
  border-bottom: 9px solid transparent;
  border-left: 14px solid currentColor;
}

.coach-symbol-tap {
  position: relative;
}

.coach-symbol-tap::before {
  content: "";
  width: 17px;
  height: 22px;
  border: 2px solid currentColor;
  border-radius: 9px 9px 11px 11px;
  transform: translateY(2px);
}

.coach-symbol-tap span {
  position: absolute;
  top: 10px;
  left: 20px;
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: currentColor;
  opacity: 0.5;
}

.coach-symbol.is-pulsing span {
  animation: coachTapPulse 1250ms ease-in-out infinite;
}

@keyframes coachTapPulse {
  0%,
  100% {
    opacity: 0.18;
    transform: scale(0.72);
  }
  45% {
    opacity: 0.72;
    transform: scale(1.45);
  }
}

@keyframes onboarding-arrive {
  from {
    opacity: 0;
    filter: blur(8px);
  }
  to {
    opacity: 1;
    filter: blur(0);
  }
}

@keyframes app-shell-onboarding-reveal {
  from {
    opacity: 0;
    transform: scale(0.992);
    filter: blur(5px);
  }
  to {
    opacity: 1;
    transform: scale(1);
    filter: blur(0);
  }
}

.premium-pill {
  padding: 10px 14px;
  border-radius: 10px;
  background: rgba(255, 253, 247, 0.78);
  color: rgba(22, 22, 22, 0.86);
  font-size: 0.92rem;
  font-weight: 650;
}

.ebook-reader {
  position: fixed;
  inset: 0;
  z-index: 65;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  gap: clamp(7px, 1.45vh, 14px);
  padding:
    var(--screen-pad-top)
    var(--screen-pad-right)
    var(--screen-pad-bottom)
    var(--screen-pad-left);
  background:
    radial-gradient(circle at 50% 8%, rgba(255, 253, 247, 0.55), transparent 34%),
    var(--paper);
  color: var(--ink);
  touch-action: none;
  overflow: hidden;
}

.ebook-reader[hidden] {
  display: none;
}

.ebook-top-bar {
  position: relative;
  z-index: 66;
  display: grid;
  grid-template-columns: var(--top-control-size) minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  min-height: var(--top-control-size);
}

.ebook-icon-button {
  width: var(--top-control-size);
  min-width: var(--top-control-size);
  height: var(--top-control-size);
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: rgba(22, 22, 22, 0.5);
  background: rgba(255, 253, 247, 0.46);
  box-shadow:
    inset 0 0 0 1px rgba(222, 214, 201, 0.42),
    0 8px 22px rgba(40, 36, 28, 0.06);
}

.ebook-back-symbol {
  width: 13px;
  height: 13px;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: translateY(-2px) rotate(45deg);
}

.ebook-title-block {
  position: absolute;
  top: 50%;
  left: 50%;
  z-index: 1;
  min-width: 0;
  width: min(58vw, 380px);
  max-width: calc(100% - 144px);
  display: grid;
  gap: 2px;
  justify-items: center;
  color: rgba(22, 22, 22, 0.58);
  text-align: center;
  transform: translate(-50%, -50%);
}

.ebook-title-block span {
  margin: 0;
  max-width: 100%;
  overflow: hidden;
  font-family: var(--ui-font);
  font-size: clamp(0.8rem, 2.8vw, 0.94rem);
  font-weight: 690;
  letter-spacing: 0.04em;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ebook-title-block small {
  max-width: 100%;
  overflow: hidden;
  color: rgba(91, 87, 80, 0.56);
  font-family: var(--reading-font);
  font-size: clamp(0.75rem, 2.35vw, 0.86rem);
  font-weight: 500;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ebook-page-shell {
  position: relative;
  min-height: 0;
  display: grid;
  align-items: stretch;
  justify-items: center;
  width: 100%;
  overflow: hidden;
}

.ebook-page {
  width: min(640px, 100%);
  height: 100%;
  min-height: 0;
  padding:
    clamp(16px, 2.8vh, 30px)
    clamp(20px, 7.4vw, 50px)
    clamp(18px, 3vh, 32px);
  overflow: hidden;
  font-family: var(--reading-font);
  font-size: var(--ebook-font-size);
  line-height: 1.58;
  color: rgba(22, 22, 22, 0.92);
  text-align: left;
  text-rendering: optimizeLegibility;
}

.ebook-page-ghost {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 50%;
  z-index: 2;
  pointer-events: none;
  transform: translateX(-50%);
}

.ebook-page.is-entering-next {
  animation: ebook-page-enter-next var(--motion-fast) both;
}

.ebook-page.is-entering-prev {
  animation: ebook-page-enter-prev var(--motion-fast) both;
}

.ebook-page-ghost.is-exiting-next {
  animation: ebook-page-exit-next var(--motion-fast) forwards;
}

.ebook-page-ghost.is-exiting-prev {
  animation: ebook-page-exit-prev var(--motion-fast) forwards;
}

@keyframes ebook-page-enter-next {
  from {
    opacity: 0.72;
    transform: translate3d(12px, 0, 0);
  }

  to {
    opacity: 1;
    transform: translate3d(0, 0, 0);
  }
}

@keyframes ebook-page-enter-prev {
  from {
    opacity: 0.72;
    transform: translate3d(-12px, 0, 0);
  }

  to {
    opacity: 1;
    transform: translate3d(0, 0, 0);
  }
}

@keyframes ebook-page-exit-next {
  0% {
    opacity: 1;
    transform: translateX(-50%);
  }

  58% {
    opacity: 0;
  }

  100% {
    opacity: 0;
    transform: translateX(calc(-50% - 18px));
  }
}

@keyframes ebook-page-exit-prev {
  0% {
    opacity: 1;
    transform: translateX(-50%);
  }

  58% {
    opacity: 0;
  }

  100% {
    opacity: 0;
    transform: translateX(calc(-50% + 18px));
  }
}

@media (prefers-reduced-motion: reduce) {
  .ebook-page.is-entering-next,
  .ebook-page.is-entering-prev,
  .ebook-page-ghost.is-exiting-next,
  .ebook-page-ghost.is-exiting-prev {
    animation: none;
  }
}

.ebook-measure-page {
  position: fixed;
  top: 0;
  left: -10000px;
  min-height: 0;
  visibility: hidden;
  pointer-events: none;
  contain: layout style paint;
}

.ebook-page-title {
  margin: 0 0 clamp(16px, 3vh, 28px);
  color: rgba(125, 47, 42, 0.7);
  font-family: var(--ui-font);
  font-size: clamp(0.86rem, 2.85vw, 1rem);
  font-weight: 740;
  letter-spacing: 0.18em;
  line-height: 1.35;
  text-align: center;
  text-transform: uppercase;
}

.ebook-paragraph {
  margin: 0 0 0.78em;
}

.ebook-paragraph:last-child {
  margin-bottom: 0;
}

.ebook-word {
  position: relative;
  border-radius: 0.24em;
  box-decoration-break: clone;
  -webkit-box-decoration-break: clone;
  transition:
    background 140ms ease,
    box-shadow 140ms ease,
    color 140ms ease;
  white-space: nowrap;
}

.ebook-word.is-current {
  color: rgba(150, 38, 32, 0.98);
  background: rgba(217, 53, 44, 0.085);
  box-shadow:
    0 0 0 0.13em rgba(217, 53, 44, 0.07),
    inset 0 -0.07em 0 rgba(217, 53, 44, 0.28);
  font-weight: inherit;
}

.ebook-word.is-current::after {
  content: "";
  position: absolute;
  left: 0.08em;
  right: 0.08em;
  bottom: -0.08em;
  height: 0.045em;
  border-radius: 999px;
  background: rgba(217, 53, 44, 0.16);
  pointer-events: none;
}

.ebook-bottom-bar {
  width: min(640px, 100%);
  justify-self: center;
  display: flex;
  flex-direction: column;
  gap: 6px;
  color: rgba(91, 87, 80, 0.72);
  padding: 0 clamp(10px, 3vw, 22px);
}

.ebook-progress-row {
  order: 2;
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font-family: var(--ui-font);
  font-size: var(--progress-meta-size);
  font-weight: 450;
  letter-spacing: 0.01em;
  font-variant-numeric: tabular-nums;
}

.ebook-progress-track {
  order: 1;
  height: var(--progress-height);
  overflow: hidden;
  border-radius: 999px;
  background: var(--progress-track-soft);
}

.ebook-progress-fill {
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background: var(--progress-fill-soft);
  transition: width 120ms linear;
}

.ebook-helper {
  order: 3;
  margin: 2px 0 0;
  color: rgba(109, 106, 100, 0.48);
  font-size: clamp(0.68rem, 2.15vw, 0.78rem);
  text-align: center;
}

.ebook-page.is-empty {
  display: grid;
  place-items: center;
  padding: clamp(24px, 5vh, 44px) clamp(22px, 8vw, 48px);
}

.ebook-empty-state {
  width: min(380px, 100%);
  display: grid;
  justify-items: center;
  gap: 14px;
  color: rgba(91, 87, 80, 0.72);
  text-align: center;
}

.ebook-empty-mark {
  width: 68px;
  height: 68px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: rgba(255, 253, 247, 0.78);
  color: rgba(91, 87, 80, 0.54);
  box-shadow:
    0 16px 32px rgba(40, 36, 28, 0.07),
    inset 0 0 0 1px rgba(221, 212, 195, 0.58),
    inset 0 1px 0 rgba(255, 255, 255, 0.78);
}

.ebook-empty-mark .book-symbol {
  opacity: 0.75;
}

.ebook-empty-state h2 {
  margin: 4px 0 0;
  color: rgba(22, 22, 22, 0.92);
  font-family: var(--reading-font);
  font-size: clamp(1.75rem, 7vw, 2.36rem);
  font-weight: 500;
  line-height: 1.05;
}

.ebook-empty-state p {
  margin: 0;
  max-width: 30ch;
  font-family: var(--ui-font);
  font-size: 0.92rem;
  line-height: 1.38;
}

.ebook-empty-load {
  min-height: 44px;
  padding-inline: 18px;
}

.chapter-panel {
  position: fixed;
  inset: 0;
  z-index: 120;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 0;
  background: rgba(31, 27, 22, 0.24);
  color: var(--ink);
  touch-action: none;
}

.chapter-panel[hidden] {
  display: none;
}

.chapter-sheet {
  width: 100%;
  height: calc(100dvh - max(156px, calc(env(safe-area-inset-top) + 126px)));
  max-height: 700px;
  padding:
    18px max(18px, env(safe-area-inset-right))
    max(14px, env(safe-area-inset-bottom))
    max(18px, env(safe-area-inset-left));
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr) auto;
  gap: 16px;
  overflow: hidden;
  border: 1px solid rgba(222, 214, 201, 0.54);
  border-right: 0;
  border-bottom: 0;
  border-left: 0;
  border-radius: 28px 28px 0 0;
  background:
    radial-gradient(circle at 50% -4%, rgba(255, 255, 255, 0.78), transparent 42%),
    linear-gradient(180deg, rgba(250, 246, 238, 0.99), rgba(241, 234, 221, 0.99));
  box-shadow:
    0 -18px 54px rgba(40, 34, 25, 0.11),
    inset 0 1px 0 rgba(255, 255, 255, 0.9);
  touch-action: pan-y;
}

.chapter-menu-header {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) 42px;
  align-items: center;
  gap: 10px;
  margin-bottom: 2px;
}

.chapter-menu-header > [hidden] {
  display: block !important;
  visibility: hidden;
  pointer-events: none;
}

.chapter-menu-header h2 {
  margin: 0;
  color: rgba(45, 39, 31, 0.84);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Inter", "Segoe UI", sans-serif;
  font-size: clamp(0.94rem, 2.75vw, 1.06rem);
  font-weight: 720;
  letter-spacing: 0.01em;
  text-align: center;
}

.chapter-icon-button {
  width: 40px;
  height: 40px;
  min-height: 40px;
  padding: 0;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: rgba(255, 253, 247, 0.74);
  color: rgba(52, 46, 38, 0.58);
  box-shadow:
    0 9px 18px rgba(40, 36, 28, 0.06),
    inset 0 1px 0 rgba(255, 255, 255, 0.86);
}

.chapter-icon-button:disabled {
  opacity: 0.72;
}

.chapter-close-button span,
.chapter-close-button span::after {
  width: 18px;
  height: 2px;
  border-radius: 999px;
  background: currentColor;
}

.chapter-close-button span {
  position: relative;
  display: block;
  transform: rotate(45deg);
}

.chapter-close-button span::after {
  content: "";
  position: absolute;
  inset: 0;
  transform: rotate(90deg);
}

.chapter-sort-button span {
  position: relative;
  width: 22px;
  height: 18px;
  display: block;
}

.chapter-sort-button span::before,
.chapter-sort-button span::after {
  content: "";
  position: absolute;
  left: 2px;
  right: 2px;
  height: 2px;
  border-radius: 999px;
  background: currentColor;
  box-shadow: 0 7px 0 currentColor, 0 14px 0 currentColor;
}

.chapter-sort-button span::after {
  left: auto;
  right: 4px;
  width: 4px;
  height: 4px;
  top: -1px;
  box-shadow: -8px 7px 0 currentColor, 0 14px 0 currentColor;
}

.chapter-book-summary {
  display: grid;
  grid-template-columns: 56px minmax(0, 1fr);
  gap: 15px;
  align-items: center;
  padding: 2px 8px 6px;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

.chapter-book-cover {
  width: 56px;
  height: 76px;
  overflow: hidden;
  border-radius: 9px;
  display: grid;
  place-items: center;
  background:
    linear-gradient(145deg, rgba(112, 151, 139, 0.94), rgba(221, 209, 188, 0.96));
  color: rgba(255, 253, 247, 0.96);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.68rem;
  box-shadow:
    0 10px 22px rgba(40, 36, 28, 0.13),
    inset 0 1px 0 rgba(255, 255, 255, 0.28);
}

.chapter-book-cover.has-image {
  background: rgba(238, 232, 221, 0.7);
}

.chapter-book-cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.chapter-book-copy {
  min-width: 0;
  display: grid;
  gap: 7px;
}

.chapter-book-copy strong {
  overflow: hidden;
  color: rgba(32, 28, 23, 0.9);
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(1.08rem, 3.9vw, 1.3rem);
  font-weight: 650;
  line-height: 1.15;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chapter-book-copy small {
  color: rgba(91, 82, 70, 0.66);
  font-size: 0.86rem;
  font-weight: 470;
}

.chapter-list {
  display: grid;
  gap: 0;
  overflow: auto;
  padding: 0;
  border: 1px solid rgba(214, 204, 187, 0.48);
  border-radius: 20px;
  background: rgba(255, 252, 244, 0.66);
  box-shadow:
    0 14px 30px rgba(40, 34, 25, 0.045),
    inset 0 1px 0 rgba(255, 255, 255, 0.84);
  scrollbar-width: none;
}

.chapter-list::-webkit-scrollbar {
  display: none;
}

.chapter-option {
  min-height: 64px;
  border: 0;
  border-bottom: 1px solid rgba(219, 209, 192, 0.34);
  border-radius: 0;
  padding: 11px 12px 11px 16px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 28px;
  gap: 12px;
  align-items: center;
  background: rgba(255, 253, 248, 0.22);
  color: var(--ink);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.7);
  text-align: left;
  transition:
    background 140ms ease,
    border-color 140ms ease,
    transform 140ms ease,
    box-shadow 140ms ease;
}

.chapter-option:first-child {
  border-radius: 17px 17px 0 0;
}

.chapter-option:last-child {
  border-bottom: 0;
  border-radius: 0 0 17px 17px;
}

.chapter-option:only-child {
  border-radius: 17px;
}

.chapter-option:active {
  transform: scale(0.992);
}

.chapter-option.is-current {
  background: rgba(217, 53, 44, 0.085);
  box-shadow:
    inset 3px 0 0 rgba(217, 53, 44, 0.36),
    inset 0 1px 0 rgba(255, 255, 255, 0.78);
}

.chapter-option-copy {
  min-width: 0;
  display: grid;
  gap: 4px;
}

.chapter-option-copy strong {
  overflow: hidden;
  color: rgba(22, 22, 22, 0.86);
  font-family: var(--ui-font);
  font-size: 0.92rem;
  font-weight: 620;
  letter-spacing: 0.002em;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chapter-option-copy small {
  color: rgba(91, 87, 80, 0.62);
  font-size: 0.74rem;
  font-weight: 480;
}

.chapter-option-progress {
  width: min(180px, 54%);
  height: 3px;
  margin-top: 4px;
  overflow: hidden;
  border-radius: 999px;
  display: block;
  background: rgba(222, 214, 201, 0.5);
}

.chapter-option-progress span {
  display: block;
  width: var(--chapter-progress, 0%);
  height: 100%;
  border-radius: inherit;
  background: rgba(62, 135, 123, 0.66);
  transition: width 180ms ease;
}

.chapter-option:not(.is-current):not(.is-complete) .chapter-option-progress {
  opacity: 0.38;
}

.chapter-option-status {
  width: 21px;
  height: 21px;
  justify-self: end;
  border: 1.5px solid rgba(151, 141, 123, 0.28);
  border-radius: 50%;
}

.chapter-option.is-complete .chapter-option-status {
  border-color: rgba(62, 135, 123, 0.52);
  background: rgba(62, 135, 123, 0.08);
}

.chapter-option.is-complete .chapter-option-status::before {
  content: "";
  display: block;
  width: 9px;
  height: 5px;
  margin: 5px auto 0;
  border-left: 2px solid rgba(62, 135, 123, 0.82);
  border-bottom: 2px solid rgba(62, 135, 123, 0.82);
  transform: rotate(-45deg);
}

.chapter-option.is-current .chapter-option-status {
  position: relative;
  border-color: transparent;
  background: transparent;
}

.chapter-option.is-current .chapter-option-status::before {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: rgba(217, 53, 44, 0.82);
  box-shadow: 0 0 0 4px rgba(217, 53, 44, 0.08);
  transform: translate(-50%, -50%);
}

.chapter-go-page {
  min-height: 42px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  background: rgba(255, 253, 247, 0.52);
  color: rgba(91, 87, 80, 0.48);
  font-size: 0.84rem;
  font-weight: 620;
  box-shadow:
    inset 0 0 0 1px rgba(222, 214, 201, 0.34),
    inset 0 1px 0 rgba(255, 255, 255, 0.62);
}

.chapter-go-page span {
  position: relative;
  width: 18px;
  height: 18px;
  border: 2px solid currentColor;
  border-radius: 3px;
}

.chapter-go-page span::before,
.chapter-go-page span::after {
  content: "";
  position: absolute;
  background: currentColor;
}

.chapter-go-page span::before {
  left: 3px;
  right: 3px;
  top: 4px;
  height: 2px;
}

.chapter-go-page span::after {
  left: 4px;
  top: -4px;
  width: 2px;
  height: 6px;
  box-shadow: 6px 0 0 currentColor;
}

.file-picker input {
  position: absolute;
  inline-size: 1px;
  block-size: 1px;
  opacity: 0;
}

.file-picker span {
  background: var(--blue);
  color: white;
}

#fileStatus {
  color: var(--muted);
  font-size: 0.92rem;
}

textarea {
  width: 100%;
  min-height: 220px;
  resize: vertical;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: #fffaf0;
  color: var(--ink);
  line-height: 1.5;
}

textarea:focus {
  outline: 3px solid rgba(40, 79, 122, 0.22);
  border-color: var(--blue);
}

.paste-editor textarea {
  min-height: min(30dvh, 260px);
  border-radius: 14px;
  background: rgba(255, 253, 247, 0.76);
}

@media (max-width: 900px) {
  .app-shell {
    grid-template-columns: 1fr;
    align-items: stretch;
  }

  .reader-panel {
    min-height: 590px;
  }

  textarea {
    min-height: 280px;
  }
}

@media (max-width: 560px) {
  :root {
    --screen-pad-top: max(12px, env(safe-area-inset-top));
    --screen-pad-right: max(12px, env(safe-area-inset-right));
    --screen-pad-bottom: max(12px, env(safe-area-inset-bottom));
    --screen-pad-left: max(12px, env(safe-area-inset-left));
    --menu-icon-size: 52px;
    --menu-row-min-height: 82px;
    --context-gap: 10px;
  }

  html,
  body {
    height: 100%;
    overflow: hidden;
  }

  .app-shell {
    width: 100%;
    height: 100dvh;
    min-height: 0;
    padding: 0;
    gap: 12px;
    display: block;
    overflow: hidden;
  }

  .reader-panel {
    height: 100dvh;
    min-height: 0;
    padding:
      var(--screen-pad-top)
      var(--screen-pad-right)
      var(--screen-pad-bottom)
      var(--screen-pad-left);
    grid-template-rows: auto minmax(0, 1fr) auto;
    gap: 8px;
    overflow: hidden;
  }

  .ebook-reader {
    padding:
      var(--screen-pad-top)
      var(--screen-pad-right)
      max(46px, calc(env(safe-area-inset-bottom) + 30px))
      var(--screen-pad-left);
  }

  .input-panel {
    position: fixed;
    inset: 0;
    z-index: 70;
    max-height: none;
    min-height: 100dvh;
    display: none;
    padding:
      max(18px, env(safe-area-inset-top))
      max(16px, env(safe-area-inset-right))
      max(18px, env(safe-area-inset-bottom))
      max(16px, env(safe-area-inset-left));
    overflow: auto;
  }

  .chapter-panel {
    inset: 0;
    padding: 0;
  }

  .chapter-sheet {
    width: 100%;
    height: calc(100dvh - max(146px, calc(env(safe-area-inset-top) + 116px)));
    max-height: none;
    padding:
      14px max(16px, env(safe-area-inset-right))
      max(16px, env(safe-area-inset-bottom))
      max(16px, env(safe-area-inset-left));
    border-radius: 26px 26px 0 0;
    gap: 14px;
  }

  .input-panel.is-open {
    display: block;
  }

  .panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    font-weight: 900;
  }

  .panel-close {
    min-height: 40px;
    padding-inline: 12px;
  }

  .menu-card {
    min-height: calc(100dvh - max(18px, env(safe-area-inset-top)) - max(18px, env(safe-area-inset-bottom)));
    padding-top: clamp(54px, 7.8vh, 82px);
    gap: clamp(12px, 1.8vh, 18px);
  }

  .menu-main {
    gap: clamp(16px, 2.25vh, 22px);
  }

  .menu-hero h2 {
    font-size: clamp(1.86rem, 7.1vw, 2.34rem);
  }

  .menu-hero p {
    font-size: clamp(0.94rem, 3.6vw, 1.06rem);
  }

  .menu-section {
    gap: 9px;
  }

  .menu-row,
  .premium-card {
    padding: 10px 14px;
    column-gap: 14px;
  }

  .premium-pill {
    padding: 9px 12px;
    font-size: 0.88rem;
  }

  .paste-editor textarea {
    min-height: min(28dvh, 240px);
  }

  .top-bar,
  .ebook-top-bar {
    gap: 8px;
    display: grid;
    grid-template-columns: var(--top-control-size) minmax(0, 1fr) auto;
    align-items: center;
  }

  .eyebrow {
    margin-bottom: 4px;
    font-size: 0.7rem;
  }

  h1 {
    font-size: clamp(0.68rem, 2.45vw, 0.86rem);
  }

  .top-actions,
  .ebook-actions {
    font-size: 0.78rem;
    gap: 2px;
    align-items: center;
  }

  .brand-block,
  .ebook-title-block {
    width: min(58vw, 260px);
    max-width: calc(100% - 144px);
  }

  .focus-stage {
    min-height: 0;
    border-block-end: 0;
    padding-block: 0;
  }

  .bottom-dock {
    gap: 7px;
    padding-top: 7px;
    padding-bottom: max(46px, calc(env(safe-area-inset-bottom) + 30px));
  }

  .controls {
    width: min(390px, 100%);
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
    align-items: center;
    gap: 10px;
  }

  .transport-controls {
    width: clamp(224px, 58vw, 252px);
    gap: 14px;
    padding: 8px 10px;
  }

  .controls .ghost-button {
    padding-inline: 0;
  }

  .text-size-button {
    width: var(--bottom-control-size);
    min-width: var(--bottom-control-size);
    min-height: var(--bottom-control-size);
  }

  #playButton {
    width: var(--play-control-size);
    min-width: var(--play-control-size);
    min-height: var(--play-control-size);
  }

  .round-side-button {
    width: var(--bottom-control-size);
    min-width: var(--bottom-control-size);
    min-height: var(--bottom-control-size);
  }

  .bottom-mode-button {
    width: var(--bottom-control-size);
    min-width: var(--bottom-control-size);
    padding-inline: 0;
  }

  #textPanelButton {
    width: var(--top-control-size);
    min-width: var(--top-control-size);
  }

  #contextButton {
    display: none;
  }

  .slider-row {
    grid-template-columns: auto minmax(0, 1fr);
    gap: 10px;
  }

  .speed-control {
    grid-template-columns: minmax(0, 1fr) max-content;
    gap: 10px;
  }

  input[type="range"] {
    min-height: 34px;
  }

  .word-display.has-context {
    min-height: 100%;
    gap: clamp(0px, 0.2vh, 2px);
    --context-column-width: min(100%, calc(100vw - 32px));
  }

  .context-line {
    padding-inline: 4px;
    min-height: 1.08em;
  }

  .context-token {
    font-size: inherit;
    min-height: 0;
  }

  .progress-wrap {
    gap: 7px;
  }

  .progress-track {
    height: var(--progress-height);
  }

  .progress-meta {
    font-size: var(--progress-meta-size);
  }

  output {
    min-width: 72px;
    text-align: right;
  }

  .word-display {
    width: 100%;
  }
}

@media (max-width: 390px) {
  :root {
    --top-control-size: 42px;
    --top-icon-size: 23px;
    --bottom-control-size: 40px;
    --play-control-size: 54px;
    --progress-meta-size: clamp(0.72rem, 2.45vw, 0.82rem);
  }

  .top-bar,
  .ebook-top-bar {
    gap: 6px;
  }

  .brand-block,
  .ebook-title-block {
    width: min(58vw, 224px);
    max-width: calc(100% - 132px);
  }

  body:not(.has-loaded-text) .brand-block span {
    letter-spacing: 0.105em;
  }

  .speed-control {
    gap: 8px;
  }

  output {
    min-width: 68px;
    font-size: 0.84rem;
  }

  .progress-meta,
  .ebook-progress-row {
    gap: 8px;
  }

  .ebook-page.is-empty {
    padding-inline: clamp(18px, 6vw, 24px);
  }

  .ebook-empty-state {
    width: 100%;
    gap: 12px;
  }

  .ebook-empty-state p {
    max-width: 26ch;
    font-size: 0.86rem;
    line-height: 1.34;
  }

  .ebook-empty-actions {
    width: min(260px, 100%);
    gap: 8px;
  }

  .ebook-empty-load {
    min-height: 42px;
    padding-inline: 10px;
    font-size: 0.86rem;
  }
}

@media (max-width: 360px) {
  .controls {
    gap: 8px;
  }

  .transport-controls {
    width: clamp(176px, 55vw, 188px);
    gap: 14px;
    padding: 5px 7px;
  }

  .round-side-button {
    width: 38px;
    min-width: 38px;
    min-height: 38px;
    font-size: 1.62rem;
  }

  #playButton {
    width: 42px;
    min-width: 42px;
    min-height: 42px;
  }

  .text-size-button {
    width: 40px;
    min-width: 40px;
    min-height: 40px;
  }

  .font-size-popover {
    gap: 4px;
    padding: 6px;
  }

  .font-size-option {
    width: 28px;
    height: 28px;
    min-height: 28px;
  }

  .slider-row {
    gap: 9px;
    font-size: 0.88rem;
  }

  .speed-control {
    gap: 9px;
  }

  output {
    min-width: 64px;
    font-size: 0.8rem;
  }
}

@media (max-height: 700px) and (max-width: 560px) {
  .reader-panel {
    gap: 6px;
  }

  .bottom-dock {
    gap: 5px;
    padding-top: 5px;
    padding-bottom: max(32px, calc(env(safe-area-inset-bottom) + 20px));
  }

  .progress-wrap {
    gap: 5px;
  }

  .transport-controls {
    padding-block: 4px;
  }

  .menu-card {
    padding-top: clamp(42px, 6.4vh, 58px);
    gap: 11px;
  }

  .menu-main {
    gap: 14px;
  }

  .menu-row,
  .premium-card {
    min-height: 74px;
    padding-block: 8px;
  }

  .ebook-reader {
    gap: 7px;
    padding-bottom: max(32px, calc(env(safe-area-inset-bottom) + 20px));
  }

  .ebook-page {
    padding:
      clamp(12px, 2.2vh, 20px)
      clamp(18px, 6vw, 34px)
      clamp(12px, 2.2vh, 20px);
    line-height: 1.52;
  }

  .ebook-bottom-bar {
    gap: 4px;
  }

  .ebook-helper {
    display: none;
  }

  .coach-card-play {
    top: 47%;
  }

  .coach-card-context-open {
    bottom: calc(env(safe-area-inset-bottom) + 74px);
  }
}
