:root {
  color-scheme: light;
  --canvas: #f7f4ef;
  --paper: #fffcf8;
  --ink: #29242c;
  --muted: #6d6370;
  --line: #e7dfe4;
  --purple: #613e70;
  --stage: #2c2031;
  --accent: #f3c8b9;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; background: var(--canvas); color: var(--ink); }
[hidden] { display: none !important; }
button, textarea, input { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: wait; opacity: .65; }
button:focus-visible, a:focus-visible, textarea:focus-visible, input:focus-visible { outline: 3px solid #9469a1; outline-offset: 3px; }
.icon { width: 1.125rem; height: 1.125rem; fill: none; stroke: currentColor; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.shell { width: min(1120px, calc(100% - 72px)); margin-inline: auto; }
.site-header { border-bottom: 1px solid var(--line); }
.header-inner { min-height: 74px; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.brand { display: inline-flex; align-items: center; gap: 10px; font-size: 1.18rem; font-weight: 800; text-decoration: none; color: var(--ink); letter-spacing: -.05em; }
.brand-mark { display: grid; place-items: center; width: 38px; height: 38px; background: #43294b; color: #f9ebf8; border-radius: 12px; }
.brand-mark .icon { width: 24px; height: 24px; stroke-width: 2; }
.brand-accent { color: var(--purple); margin-inline-start: .15em; }
.private-tag { display: inline-flex; align-items: center; gap: 6px; color: #5e4667; background: #efe6f0; border-radius: 999px; padding: 7px 11px; font-size: .75rem; font-weight: 700; white-space: nowrap; }
.private-tag .icon { width: .875rem; height: .875rem; }
.intro { display: flex; align-items: center; justify-content: space-between; gap: 28px; padding: 36px 0 32px; }
.eyebrow { display: flex; align-items: center; gap: 8px; margin: 0 0 9px; color: var(--purple); font-size: .71rem; letter-spacing: .15em; font-weight: 800; }
.eyebrow > span { width: 7px; height: 7px; border-radius: 50%; background: #9c73a8; }
h1 { margin: 0; font: 500 clamp(3rem, 7vw, 5.4rem)/1.02 Georgia, "Times New Roman", serif; letter-spacing: -.065em; text-wrap: balance; }
h1 em { color: var(--purple); font-weight: inherit; }
.intro-copy { margin: 13px 0 0; color: var(--muted); font-size: clamp(.94rem, 1.8vw, 1.05rem); line-height: 1.55; }
.hero-ornament { flex: 0 1 240px; min-width: 130px; margin-right: 9px; }
.hero-ornament svg { width: 100%; display: block; }
.workspace { display: grid; grid-template-columns: minmax(0, .79fr) minmax(0, 1.21fr); gap: 18px; align-items: stretch; }
.panel { min-width: 0; border: 1px solid var(--line); border-radius: 23px; background: var(--paper); padding: 23px; box-shadow: 0 8px 23px #38273a08; }
.section-heading { display: flex; align-items: center; gap: 12px; margin-bottom: 20px; min-width: 0; }
.section-heading h2 { margin: 0; font-size: 1.27rem; line-height: 1.25; letter-spacing: -.035em; }
.section-heading p { margin: 3px 0 0; color: var(--muted); font-size: .82rem; line-height: 1.4; }
.step { display: grid; place-items: center; flex: none; width: 37px; height: 37px; border-radius: 11px; color: var(--purple); background: #f1e7f2; font-size: .73rem; font-weight: 800; font-variant-numeric: tabular-nums; }
.tabs { display: grid; grid-template-columns: 1fr 1fr; gap: 3px; padding: 4px; border-radius: 12px; background: #f2edf0; }
.tab { border: 1px solid transparent; border-radius: 9px; display: flex; gap: 7px; align-items: center; justify-content: center; min-height: 40px; padding: 5px 4px; color: #625765; background: transparent; font-size: .82rem; font-weight: 700; }
.tab .icon { width: 15px; height: 15px; }
.tab:hover { color: var(--purple); }
.tab[aria-selected="true"] { background: var(--paper); border-color: #e5dbe3; color: var(--ink); box-shadow: 0 1px 3px #38273a0a; }
.source-panel { margin-top: 12px; }
textarea { display: block; width: 100%; min-height: 137px; height: 137px; max-height: 400px; resize: vertical; padding: 13px 14px; border: 1px solid #dfd6de; border-radius: 12px; background: #fcf9f6; color: var(--ink); font-size: 1rem; line-height: 1.5; }
textarea::placeholder { color: #7a707d; font-size: .88rem; }
.source-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 12px; margin-top: 11px; }
.button { display: inline-flex; justify-content: center; align-items: center; gap: 8px; min-height: 44px; border: 1px solid transparent; border-radius: 10px; padding: 8px 13px; font-size: .83rem; font-weight: 760; white-space: nowrap; }
.button-ink { color: #fff; background: #442c4d; }
.button-ink:not(:disabled):hover { background: #5b3b67; }
.button-ink .icon { width: 16px; height: 16px; }
.text-button { min-height: 44px; padding: 6px 5px; border: 0; background: transparent; color: var(--purple); font-size: .82rem; font-weight: 750; text-decoration: underline; text-underline-offset: .22em; }
.text-button:hover { color: #42274f; }
.drop-zone { min-height: 192px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; text-align: center; padding: 12px; background: #fcf9f6; border: 1px dashed #b6a1b9; border-radius: 12px; }
.drop-zone.is-over { border-color: #714580; background: #f2e9f4; }
.drop-zone p { margin: 0; font-size: .87rem; font-weight: 730; }
.drop-zone small { color: var(--muted); font-size: .73rem; }
.upload-icon { width: 21px; height: 21px; color: var(--purple); }
.source-message { color: #5b4565; font-size: .81rem; line-height: 1.5; margin: 10px 0 0; overflow-wrap: anywhere; }
.source-message[data-error="true"] { color: #962f43; }
.speed { margin-top: 17px; padding-top: 15px; border-top: 1px solid var(--line); }
.speed-heading { display: flex; justify-content: space-between; align-items: baseline; gap: 6px; margin-bottom: 3px; }
.speed-heading label { font-size: .88rem; font-weight: 750; }
.speed-value { display: flex; gap: 4px; align-items: baseline; white-space: nowrap; color: var(--purple); }
.speed-value output { font-size: 1.36rem; font-weight: 790; letter-spacing: -.04em; font-variant-numeric: tabular-nums; }
.speed-value span { font-size: .72rem; font-weight: 680; }
input[type="range"] { width: 100%; height: 30px; display: block; margin: 0; cursor: pointer; accent-color: #765186; }
.speed-scale { display: flex; justify-content: space-between; color: var(--muted); font-size: .72rem; font-variant-numeric: tabular-nums; }
.reader { display: flex; flex-direction: column; }
.reader-heading { margin-bottom: 16px; }
.reader-title { min-width: 0; }
.reader-title p { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.state { margin-left: auto; display: flex; align-items: center; gap: 6px; flex: none; border-radius: 999px; background: #f0e7f0; color: #5e4269; padding: 6px 9px; font-size: .7rem; font-weight: 760; }
.state::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.state[data-state="running"], .state[data-state="finished"] { background: #e5eee5; color: #3b644d; }
.stage { flex: 1; display: flex; flex-direction: column; justify-content: space-between; min-height: 226px; min-width: 0; border-radius: 17px; padding: 15px 19px 17px; color: #f7eaf6; background: radial-gradient(ellipse at 50% 7%, #483251 0%, transparent 68%), var(--stage); }
.stage-label { display: inline-flex; align-items: center; align-self: flex-start; gap: 6px; color: #dec6df; font-size: .63rem; font-weight: 760; letter-spacing: .15em; }
.stage-label .icon { width: 14px; height: 14px; }
.focus { min-width: 0; display: grid; place-items: center; min-height: 104px; text-align: center; }
#focus-word { max-width: 100%; overflow-wrap: anywhere; padding: 0 5px; color: var(--accent); font: 500 clamp(2.2rem, 4.8vw, 3.85rem)/1.08 Georgia, "Times New Roman", serif; letter-spacing: -.042em; }
#focus-word.is-long { font-size: clamp(1.25rem, 3.5vw, 2.45rem); }
.context { border-top: 1px solid #ffffff22; padding-top: 11px; min-height: 64px; color: #e0cfe2; font-size: .88rem; line-height: 1.66; text-align: center; overflow-wrap: anywhere; }
.context .past { color: #c0a9c3; }
.context mark { background: var(--accent); color: #352139; border-radius: 4px; box-shadow: 0 0 0 2px var(--accent); font-weight: 720; }
.progress-block { margin: 16px 0 15px; }
.progress-heading { display: flex; justify-content: space-between; align-items: baseline; gap: 5px; margin-bottom: 6px; font-size: .78rem; }
.progress-heading label { font-weight: 730; }
.progress-heading b { margin-left: 3px; color: var(--purple); font-weight: 790; font-variant-numeric: tabular-nums; }
.word-count { color: var(--muted); text-align: right; font-variant-numeric: tabular-nums; }
progress { display: block; width: 100%; height: 7px; border: 0; border-radius: 999px; overflow: hidden; background: #eee4ee; color: #81548f; }
progress::-webkit-progress-bar { background: #eee4ee; }
progress::-webkit-progress-value { background: #81548f; border-radius: 999px; }
progress::-moz-progress-bar { background: #81548f; border-radius: 999px; }
.transport { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.button-play { min-width: 130px; background: #704980; color: #fff; }
.button-play:hover { background: #5e386d; }
.button-play .icon { width: 15px; height: 15px; }
.button-reset { border-color: #e0d5df; background: #fcf8f7; color: #46384a; }
.button-reset:hover { background: #f0e7f0; }
.button-reset .icon { width: 16px; height: 16px; }
.eta { display: inline-flex; align-items: center; gap: 5px; margin-left: auto; color: var(--muted); font-size: .77rem; white-space: nowrap; }
.eta .icon { width: 15px; height: 15px; }
.footer { display: flex; justify-content: space-between; gap: 10px; padding: 15px 1px 22px; color: var(--muted); font-size: .75rem; }
.footer span { display: inline-flex; align-items: center; gap: 6px; }
.footer .icon { width: 14px; height: 14px; }
kbd { font: 680 .69rem system-ui, sans-serif; padding: 2px 5px; color: #5f4c66; border: 1px solid #ded4de; border-radius: 5px; background: #fbf7fa; }
kbd + kbd { margin-left: 4px; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
@media (max-width: 820px) {
  .shell { width: min(720px, calc(100% - 40px)); }
  .panel { padding: 17px; }
  .workspace { grid-template-columns: minmax(0, .9fr) minmax(0, 1.1fr); gap: 12px; }
  .stage { padding-inline: 13px; }
}
@media (max-width: 680px) {
  .shell { width: min(510px, calc(100% - 28px)); }
  .header-inner { min-height: 62px; }
  .brand-mark { width: 33px; height: 33px; border-radius: 10px; }
  .brand-mark .icon { width: 21px; height: 21px; }
  .intro { padding: 25px 1px 21px; }
  .hero-ornament { display: none; }
  h1 { font-size: clamp(2.57rem, 9.8vw, 4rem); }
  .intro-copy { margin-top: 9px; }
  .workspace { grid-template-columns: minmax(0, 1fr); gap: 13px; }
  .panel { padding: 15px; border-radius: 18px; }
  .reader { scroll-margin-top: 9px; }
  .stage { min-height: 210px; }
  .footer .shortcuts { display: none; }
}
@media (max-width: 360px) {
  .button-play { min-width: auto; }
  .eta { font-size: .7rem; }
  .transport { gap: 6px; }
  .transport .button { padding-inline: 9px; }
}

/* Sentence history and synchronized PDF view */
.workspace { align-items: start; }
#focus-word {
  display: block;
  padding: 5px 12px 8px;
  border: 1px solid #f3c8b988;
  border-radius: 12px;
  background: #f3c8b913;
}
.history { margin-top: 17px; padding-top: 15px; border-top: 1px solid var(--line); }
.history-heading { display: flex; align-items: flex-start; gap: 9px; }
.history-heading > .icon { margin-top: 1px; color: var(--purple); }
.history-heading h3 { margin: 0; font-size: .88rem; letter-spacing: -.015em; }
.history-heading p, .history-empty { margin: 3px 0 0; color: var(--muted); font-size: .76rem; line-height: 1.45; }
.history-empty { margin: 10px 0 0; padding: 11px 12px; border: 1px dashed var(--line); border-radius: 10px; }
.history-list { display: grid; gap: 5px; list-style: none; margin: 10px 0 0; padding: 0; }
.history-jump {
  width: 100%; min-height: 44px; display: flex; align-items: center; gap: 9px; padding: 6px 8px;
  border: 1px solid var(--line); border-radius: 10px; background: #fcf8f7;
  color: var(--ink); text-align: left; font-size: .8rem; line-height: 1.42;
}
.history-jump:hover { border-color: #c9afd0; background: #f4ebf4; }
.history-distance {
  flex: none; white-space: nowrap; color: var(--purple); background: #efe5f0; border-radius: 6px;
  padding: 4px 6px; font-size: .67rem; font-weight: 750;
}
.history-excerpt {
  min-width: 0; overflow-wrap: anywhere; overflow: hidden;
  display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2;
}
.workspace.has-pdf { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.has-pdf .setup { grid-column: 1 / -1; }
.pdf-preview .section-heading { margin-bottom: 13px; }
.pdf-controls { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-bottom: 9px; }
.pdf-pagination { display: flex; align-items: center; gap: 4px; margin-right: auto; }
.pdf-page-number { min-width: 6.5em; color: var(--muted); font-size: .75rem; text-align: center; font-variant-numeric: tabular-nums; }
.pdf-controls .icon-button { width: 44px; padding: 0; }
.pdf-controls [aria-pressed="true"] { border-color: #c6a7cd; background: #f0e4f1; color: #5d3b6c; }
.pdf-controls button:disabled, .transport button:disabled { cursor: default; }
.pdf-scroll {
  height: clamp(365px, 56vh, 610px); overflow: auto; scrollbar-gutter: stable; padding: 10px;
  border: 1px solid var(--line); border-radius: 12px; background: #f2edf0;
}
.pdf-scroll:focus-visible { outline: 3px solid #9469a1; outline-offset: 3px; }
.pdf-message { margin: 14px 0; color: var(--muted); font-size: .82rem; text-align: center; }
.pdf-paper {
  --scale-round-x: 1px; --scale-round-y: 1px; position: relative; overflow: hidden;
  margin-inline: auto; background: #fff; box-shadow: 0 2px 7px #37253c25;
}
.pdf-paper canvas { display: block; width: 100%; height: 100%; }
.pdf-text-layer {
  --text-scale-factor: calc(var(--total-scale-factor) * var(--min-font-size, 1));
  --min-font-size-inv: calc(1 / var(--min-font-size, 1));
  position: absolute; inset: 0; overflow: hidden; line-height: 1; text-align: initial;
  -webkit-text-size-adjust: none; text-size-adjust: none; transform-origin: 0 0;
}
.pdf-text-layer :is(span, br) { position: absolute; color: transparent; white-space: pre; transform-origin: 0 0; }
.pdf-text-layer span:not(.markedContent) {
  font-size: calc(var(--text-scale-factor) * var(--font-height));
  transform: rotate(var(--rotate, 0deg)) scaleX(var(--scale-x, 1)) scale(var(--min-font-size-inv));
}
.pdf-text-layer .markedContent { display: contents; }
.pdf-text-layer[data-main-rotation="90"] { transform: rotate(90deg) translateY(-100%); }
.pdf-text-layer[data-main-rotation="180"] { transform: rotate(180deg) translate(-100%, -100%); }
.pdf-text-layer[data-main-rotation="270"] { transform: rotate(270deg) translateX(-100%); }
.pdf-marks { position: absolute; inset: 0; pointer-events: none; }
.pdf-word-highlight {
  position: absolute; border-radius: 2px; background: #ffcd5c70;
  box-shadow: 0 0 0 1.5px #7d3f8e; mix-blend-mode: multiply;
}
@media (min-width: 1120px) {
  main.shell:has(.has-pdf) { width: min(1480px, calc(100% - 64px)); }
  .workspace.has-pdf { grid-template-columns: minmax(245px, .63fr) minmax(0, 1.12fr) minmax(0, 1.25fr); }
  .has-pdf .setup { grid-column: auto; }
  .has-pdf .tab { gap: 5px; font-size: .75rem; }
}
@media (max-width: 720px) {
  .workspace.has-pdf { grid-template-columns: minmax(0, 1fr); }
  .has-pdf .reader, .pdf-preview { scroll-margin-top: 9px; }
}
@media (max-width: 385px) {
  .pdf-controls .icon-button { width: 38px; }
  .pdf-page-number { min-width: 5.8em; }
  .pdf-controls { gap: 4px; }
}
