:root {
  color-scheme: dark;
  font-family: "Century Gothic", "Avenir Next", "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  background: #121116;
  color: #f5f1fa;
  --surface: #19171f;
  --panel: #1e1b26;
  --input: #15131b;
  --line: #393342;
  --muted: #ada5ba;
  --accent: #c6aaff;
  --accent-ink: #211338;
}

* { box-sizing: border-box; }
body { margin: 0; }
[hidden] { display: none !important; }
.shell { width: min(1120px, calc(100% - 64px)); margin-inline: auto; }
.masthead { border-bottom: 1px solid #2b2732; }
.masthead-inner { display: flex; min-height: 72px; align-items: center; justify-content: space-between; gap: 16px; }
.wordmark { display: flex; align-items: center; gap: 12px; font-size: 1.46rem; font-weight: 700; letter-spacing: -.035em; }
.brand-mark {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 2px;
  background: var(--accent);
  color: var(--accent-ink);
}
.brand-mark i { width: 2px; border-radius: 2px; background: currentColor; height: 8px; }
.brand-mark i:nth-child(even) { height: 13px; }
.brand-mark i:nth-child(3) { height: 19px; }

main { padding-block: clamp(34px, 5vw, 62px) 32px; }
.intro { margin-bottom: 30px; animation: enter .45s ease-out both; }
h1 {
  margin: 0;
  font-size: clamp(2rem, 5.3vw, 3.55rem);
  line-height: 1.13;
  letter-spacing: -.065em;
  font-weight: 700;
}
:lang(zh-CN) h1 { letter-spacing: -.045em; }
.intro p { margin: 12px 0 0; color: var(--muted); font-size: 1rem; line-height: 1.55; }
.reader { background: var(--surface); border: 1px solid var(--line); border-radius: 18px; overflow: hidden; animation: enter .48s .06s ease-out both; }
.toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 15px; padding: 12px 23px; border-bottom: 1px solid var(--line); }
.toolbar-label { color: var(--muted); font-size: .875rem; }
.segment {
  display: inline-flex;
  gap: 2px;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--input);
}
button, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; transition: background .16s ease, border-color .16s ease, color .16s ease; }
button:disabled { cursor: default; }
.segment button {
  min-height: 35px;
  min-width: 46px;
  padding: 4px 12px;
  border: 1px solid transparent;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  font-size: .875rem;
  font-weight: 600;
}
.segment button[aria-pressed="true"] { background: #322640; border-color: #514166; color: #efddff; }
.segment button:hover { color: #fff; }

.workbench { display: grid; grid-template-columns: 1.45fr 1fr; }
.editor, .player { min-width: 0; padding: 23px; }
.editor { display: flex; flex-direction: column; }
.editor-heading { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 4px 12px; margin-bottom: 10px; }
.editor-heading label { font-size: 1rem; font-weight: 650; }
.editor-actions, .transport { display: flex; gap: 8px; }
.quiet { min-height: 36px; padding: 5px 9px; margin-block: -5px; border: 1px solid transparent; border-radius: 7px; background: transparent; color: var(--accent); font-size: .875rem; }
.quiet:last-child { color: var(--muted); }
.quiet:hover:not(:disabled) { background: #2e2438; }
.quiet:disabled { opacity: .65; }
textarea {
  display: block;
  width: 100%;
  flex: 1 0 auto;
  height: 244px;
  min-height: 170px;
  max-height: 70vh;
  resize: vertical;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 16px 18px;
  background: var(--input);
  font-size: 1.125rem;
  line-height: 1.7;
}
textarea::placeholder { color: #aaa0b8; }
.character-count { align-self: flex-end; margin-top: 10px; color: var(--muted); font-size: .8125rem; font-variant-numeric: tabular-nums; }

.player { background: var(--panel); border-left: 1px solid var(--line); }
.soundstage {
  position: relative;
  display: flex;
  flex-direction: column;
  min-height: 154px;
  padding: 13px 15px 15px;
  overflow: hidden;
  border: 1px solid #523961;
  border-radius: 11px;
  background: radial-gradient(ellipse at 55% 115%, #4f2972, transparent 74%), #271a35;
}
.soundstage-top { display: flex; justify-content: space-between; flex-wrap: wrap; align-items: center; gap: 3px 12px; color: #d6c3e5; font-size: .8125rem; }
#voice-name { color: #f0dfff; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 72%; }
.waveform {
  height: 80px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 2px;
  margin-block: 11px 5px;
  background: linear-gradient(transparent calc(50% - .5px), #d0a8ff35 calc(50% - .5px), #d0a8ff35 calc(50% + .5px), transparent calc(50% + .5px));
}
.waveform i { flex: 1; height: var(--height); min-width: 0; border-radius: 5px; background: #b796ef; opacity: .66; transform-origin: center; transition: height .32s ease, opacity .18s ease, background .18s ease; }
.waveform i.played { opacity: 1; background: #e0caff; }
.reader[data-phase="loading"] .waveform i { animation: pulse .9s var(--delay) ease-in-out infinite alternate; }
.timeline { display: flex; justify-content: space-between; color: #e4cbed; font-size: .75rem; font-variant-numeric: tabular-nums; }

.settings { display: grid; grid-template-columns: 1.45fr 1fr; gap: 13px; margin-block: 15px; }
.field { min-width: 0; }
.field label { display: flex; align-items: center; justify-content: space-between; gap: 6px; font-size: .875rem; color: #dcd3e7; margin-bottom: 5px; }
.field output { color: var(--accent); font-variant-numeric: tabular-nums; }
select {
  width: 100%;
  min-height: 44px;
  appearance: none;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 28px 8px 10px;
  background:
    linear-gradient(45deg, transparent 50%, #c6b2d4 50%) calc(100% - 14px) 52% / 5px 5px,
    linear-gradient(135deg, #c6b2d4 50%, transparent 50%) calc(100% - 9px) 52% / 5px 5px,
    var(--input);
  background-repeat: no-repeat;
  text-overflow: ellipsis;
  font-size: .875rem;
}
input[type="range"] { width: 100%; min-height: 44px; margin: 0; accent-color: var(--accent); cursor: pointer; }
.transport button { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 8px 13px; border-radius: 8px; border: 1px solid transparent; font-size: .9375rem; font-weight: 650; }
.transport .primary { flex: 1; background: var(--accent); color: var(--accent-ink); }
.transport .primary:hover:not(:disabled) { background: #dfcaff; }
.transport .primary:disabled { background: #443755; color: #e5d9f6; }
.transport .secondary { border-color: #4a4157; background: var(--input); }
.transport .secondary:hover:not(:disabled) { background: #322640; }
.transport .secondary:disabled { color: #aaa0b8; }
.icon { display: inline-block; flex-shrink: 0; width: 11px; height: 11px; }
.icon-play { width: 0; height: 0; border-block: 5px solid transparent; border-left: 8px solid currentColor; }
.icon-pause { border-inline: 3px solid currentColor; }
.icon-stop { width: 9px; height: 9px; border-radius: 2px; background: currentColor; }
.icon-loading { border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: spin .9s infinite linear; }
.status { margin: 9px 0 0; min-height: 1.55em; color: #c8bbd5; font-size: .875rem; line-height: 1.55; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }

.samples { margin-block: 29px 20px; }
.samples h2 { margin: 0 0 6px; font-size: 1.16rem; }
.samples p { margin: 0 0 11px; color: var(--muted); font-size: .9375rem; line-height: 1.6; }
.sample-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: 26px; }
.sample-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(140px, 1.55fr); gap: 10px; align-items: center; padding: 9px 0; border-top: 1px solid var(--line); font-size: .875rem; }
.sample-row audio { display: block; width: 100%; height: 36px; }
footer { display: block; border-top: 1px solid var(--line); padding-top: 17px; color: var(--muted); font-size: .8125rem; line-height: 1.65; }
a { color: var(--accent); text-underline-offset: 3px; }
.license { display: inline-block; margin-left: 8px; }

@keyframes enter { from { opacity: 0; transform: translateY(7px); } to { opacity: 1; transform: translateY(0); } }
@keyframes pulse { from { transform: scaleY(.55); } to { transform: scaleY(1.12); opacity: 1; } }
@keyframes spin { to { transform: rotate(360deg); } }

@media (max-width: 850px) {
  .shell { width: calc(100% - 40px); }
  .workbench { grid-template-columns: 1.1fr 1fr; }
  .editor, .player, .toolbar { padding-inline: 16px; }
}
@media (max-width: 650px) {
  .shell { width: calc(100% - 32px); }
  .masthead-inner { min-height: 62px; }
  .workbench, .sample-list { grid-template-columns: 1fr; }
  .player { border-left: 0; border-top: 1px solid var(--line); }
  .intro { margin-bottom: 22px; }
  .editor, .player { padding-block: 17px; }
  textarea { height: 172px; padding: 12px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

.editor-heading h2 { margin: 0; font-size: 1rem; font-weight: 650; }
.follow-text {
  width: 100%;
  min-width: 0;
  flex: 1 0 auto;
  height: 244px;
  min-height: 170px;
  max-height: 70vh;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 16px 18px;
  background: var(--input);
  font-size: 1.125rem;
  line-height: 1.85;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.follow-word {
  display: inline;
  padding: 0;
  border: 0;
  border-radius: 4px;
  background: transparent;
  text-align: start;
  transition: none;
  overflow-wrap: anywhere;
}
.follow-word:hover, .follow-word[aria-pressed="true"] { text-decoration: underline; text-decoration-color: var(--accent); text-underline-offset: .21em; }
.follow-word[aria-current="true"] { color: var(--accent-ink); background: var(--accent); box-shadow: 2px 0 var(--accent), -2px 0 var(--accent); }
.editor-footer { display: flex; min-height: 35px; flex-wrap: wrap; align-items: center; gap: 5px 9px; margin-top: 9px; }
.editor-footer .character-count { margin: 0 0 0 auto; align-self: center; }
.favorite { display: inline-flex; align-items: center; gap: 5px; min-width: 0; white-space: nowrap; }
.favorite span:last-child { overflow: hidden; text-overflow: ellipsis; }
.favorite[aria-pressed="true"] { color: #f0ddff; }
.star { font: 1.18rem/1 system-ui, sans-serif; }
.download { display: inline-flex; gap: 6px; align-items: center; min-height: 36px; margin: 6px 0 0; padding: 3px 6px; border: 0; border-radius: 6px; background: transparent; color: var(--accent); font-size: .875rem; }
.download:hover:not(:disabled) { background: #322640; }
.download:disabled { color: var(--muted); opacity: .73; }
.download-icon { font-family: system-ui, sans-serif; font-size: 1rem; }
.download + .status { margin-top: 1px; }
.favorites { margin-top: 22px; border-block: 1px solid var(--line); }
.favorites summary { width: fit-content; padding: 12px 4px 12px 1px; color: #dcd3e7; font-weight: 650; cursor: pointer; }
.favorites summary:hover { color: var(--accent); }
.favorites p { margin: 0 0 12px; color: var(--muted); font-size: .875rem; }
.favorites ul { list-style: none; margin: 0; padding: 0; }
.favorite-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 9px; padding: 8px 0; border-top: 1px solid var(--line); }
.favorite-row .restore { display: flex; min-width: 0; flex-direction: column; gap: 4px; border: 0; border-radius: 7px; background: transparent; padding: 6px 8px; text-align: start; }
.favorite-row .restore:hover { background: #2e2438; }
.favorite-row .excerpt { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%; }
.favorite-row .meta { font-size: .8125rem; color: var(--muted); }
.favorite-row .remove { align-self: center; margin: 0; }
@media (max-width: 650px) {
  .follow-text { height: 172px; padding: 12px; }
}

.toolbar { justify-content: space-between; }
.toolbar-group { display: flex; align-items: center; gap: 10px 15px; flex-wrap: wrap; }
.import-button { display: inline-flex; gap: 7px; align-items: center; }
.import-icon { position: relative; width: 11px; height: 13px; border: 1px solid currentColor; border-radius: 2px; flex: none; }
.import-icon::after { content: ""; position: absolute; inset: 4px 2px 2px; border-block: 1px solid currentColor; }
.material-status {
  margin: 0 0 9px;
  padding: 7px 10px;
  border-left: 2px solid #7955a9;
  background: #241b30;
  color: #e1d1ee;
  font-size: .8125rem;
  overflow-wrap: anywhere;
}
.editor[data-drop="true"] textarea,
.editor[data-drop="true"] .sentence-list { outline: 2px dashed var(--accent); outline-offset: -4px; }
.sentence-list {
  min-height: 172px;
  max-height: 298px;
  overflow: auto;
  margin: 0;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 10px;
  list-style: none;
  background: var(--input);
}
.sentence-list li + li { border-top: 1px solid #292533; }
.sentence-button {
  display: grid;
  grid-template-columns: 2.2rem minmax(0, 1fr);
  gap: 8px;
  width: 100%;
  min-height: 48px;
  padding: 10px 14px 10px 0;
  border: 0;
  border-left: 2px solid transparent;
  background: transparent;
  text-align: start;
  line-height: 1.52;
  overflow-wrap: anywhere;
}
.sentence-button:hover { background: #211b2a; }
.sentence-button[aria-current="true"] {
  color: #f5eaff;
  background: linear-gradient(105deg, #39264d, #211a2b 82%);
  border-left-color: #be9be9;
}
.sentence-number { color: var(--muted); text-align: center; font-size: .75rem; padding-top: .16rem; font-variant-numeric: tabular-nums; }
.sentence-button[aria-current="true"] .sentence-number { color: var(--accent); }
.reader[data-mode="practice"] .follow-text {
  flex: 0 0 auto;
  height: auto;
  min-height: 0;
  max-height: 132px;
  margin-top: 10px;
  padding: 9px 13px;
  background: #211829;
}
#practice-empty { align-content: center; flex: 1; min-height: 172px; margin: 0; padding: 14px; text-align: center; color: var(--muted); border: 1px dashed var(--line); border-radius: 10px; }
.practice-controls { margin: 0 0 14px; padding-top: 11px; border-top: 1px solid var(--line); }
.sentence-nav { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); align-items: center; gap: 6px; }
.sentence-nav .secondary {
  min-height: 38px;
  padding: 4px 6px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--input);
  font-size: .875rem;
}
.sentence-nav .secondary:hover:not(:disabled) { background: #322640; }
.sentence-nav .secondary:disabled { color: var(--muted); opacity: .63; }
#sentence-position { text-align: center; color: #d8c1f3; font-size: .8125rem; font-variant-numeric: tabular-nums; white-space: nowrap; }
.loop-label { display: flex; gap: 7px; align-items: center; width: fit-content; padding-top: 11px; font-size: .875rem; cursor: pointer; }
.loop-label input { accent-color: var(--accent); margin: 0; }
@media (max-width: 650px) {
  .toolbar { align-items: flex-start; }
  .toolbar-group { gap: 7px; }
  .sentence-list { max-height: 248px; flex: 0 0 auto; }
}
