/* 听全文 — the three-source reading player (机械声 / 石龙仔 / 莫问), restyled for the 雪青刊 design study.
   Same markup, controls and behaviour as CMP-01 Gate 6; only the presentation changes: a slim listening strip
   that opens into a paper control sheet, 紫泥 for the play control, hairlines instead of glass. */
.tts-panel {
  --p-ink: var(--ink); --p-soft: var(--ink-soft); --p-muted: var(--muted);
  --p-line: var(--line); --p-line-strong: var(--line-strong); --p-fill: var(--violet); --p-track: var(--lavender-deep);
  max-width: var(--measure); margin: 0 auto 44px; display: grid; gap: 10px; font-size: 19px;
}
.tts-panel[hidden] { display: none; }
.tts-panel svg { width: 22px; height: 22px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }

.tts-launch { display: flex; align-items: center; gap: 14px; width: 100%; min-height: 60px; padding: 8px 18px 8px 8px; border: 1px solid var(--p-line-strong); border-radius: var(--radius-sm); background: var(--paper); color: var(--p-ink); font: inherit; font-size: 16px; text-align: left; cursor: pointer; transition: border-color .25s, background-color .25s; }
.tts-launch:hover { border-color: var(--violet); background: #fff; }
.tts-launch .tts-icon-lead { width: 44px; height: 44px; padding: 11px; border-radius: 50%; background: var(--violet); color: var(--paper); stroke-width: 1.8; transition: transform .3s var(--ease); }
.tts-launch:hover .tts-icon-lead { transform: scale(1.06); }
.tts-launch-title { font: 600 17px/1.2 var(--font-serif); letter-spacing: .08em; }
.tts-launch-meta { flex: 1; font-size: 13px; color: var(--p-muted); }
.tts-chevron { width: 18px; height: 18px; color: var(--violet); transition: transform .25s var(--ease); }
.tts-launch[aria-expanded="true"] { border-color: var(--violet); }
.tts-launch[aria-expanded="true"] .tts-chevron { transform: rotate(90deg); }

.tts-player {
  position: relative; display: grid; gap: 14px 12px; padding: 18px 20px 18px; border: 1px solid var(--p-line); border-top: 2px solid var(--violet); border-radius: 0 0 var(--radius-sm) var(--radius-sm); background: var(--paper);
  grid-template-columns: auto 1fr auto; grid-template-areas: "wave title time" "seek seek seek" "transport transport transport" "tools tools tools" "vol vol vol" "source source source" "status status status";
  animation: tts-open .35s var(--ease);
}
@keyframes tts-open { from { opacity: 0; transform: translateY(-6px); } }
.tts-player[hidden] { display: none; }
.tts-wave { grid-area: wave; width: 24px; height: 24px; color: var(--violet); }
.tts-title { grid-area: title; margin: 0; align-self: center; font: 600 16px/1.5 var(--font-serif); letter-spacing: .06em; color: var(--p-ink); }
.tts-time { grid-area: time; align-self: center; font: 13px/1 var(--font-num); color: var(--p-muted); font-variant-numeric: tabular-nums; }

.tts-seek { grid-area: seek; width: 100%; height: 22px; margin: 0; background: transparent; -webkit-appearance: none; appearance: none; cursor: pointer; --fill: 0%; }
.tts-seek::-webkit-slider-runnable-track { height: 3px; border-radius: 2px; background: linear-gradient(to right, var(--p-fill) var(--fill), var(--p-track) var(--fill)); }
.tts-seek::-moz-range-track { height: 3px; border-radius: 2px; background: var(--p-track); }
.tts-seek::-moz-range-progress { height: 3px; border-radius: 2px; background: var(--p-fill); }
.tts-seek::-webkit-slider-thumb { -webkit-appearance: none; width: 14px; height: 14px; margin-top: -5.5px; border-radius: 50%; border: 2px solid var(--p-fill); background: var(--paper); }
.tts-seek::-moz-range-thumb { width: 10px; height: 10px; border-radius: 50%; border: 2px solid var(--p-fill); background: var(--paper); }
.tts-seek:focus-visible, .tts-volume input:focus-visible { outline: 2px solid var(--violet); outline-offset: 3px; }

.tts-transport { grid-area: transport; display: flex; justify-content: space-between; align-items: flex-start; padding: 0 4px; }
.tts-ctl { display: grid; justify-items: center; gap: 6px; min-width: 64px; }
.tts-ctl span { font-size: 12px; color: var(--p-muted); white-space: nowrap; }
.tts-round { display: grid; place-items: center; width: 46px; height: 46px; padding: 0; border: 1px solid var(--p-line-strong); border-radius: 50%; background: var(--paper); color: var(--violet); cursor: pointer; transition: background-color .2s, border-color .2s, transform .2s var(--ease); }
.tts-round:hover { border-color: var(--violet); background: var(--lavender); }
.tts-round:active { transform: scale(.95); }
.tts-round svg { width: 20px; height: 20px; }
.tts-main { width: 54px; height: 54px; margin-top: -4px; border-color: var(--violet); background: var(--violet); color: var(--paper); }
.tts-main:hover { border-color: var(--violet-deep); background: var(--violet-deep); }
.tts-main .i-play, .tts-main[data-state="playing"] .i-pause { display: block; }
.tts-main .i-pause, .tts-main[data-state="playing"] .i-play { display: none; }
.tts-main .i-play { fill: currentColor; }

.tts-tools { grid-area: tools; display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; padding-top: 14px; border-top: 1px solid var(--p-line); }
.tts-tool { display: flex; align-items: center; justify-content: center; gap: 6px; min-height: 44px; padding: 0 8px; min-width: 0; white-space: nowrap; border: 1px solid var(--p-line); border-radius: var(--radius-sm); background: var(--ground); color: var(--p-soft); font: 400 13px/1.3 var(--font-sans); cursor: pointer; transition: border-color .2s, background-color .2s; }
.tts-tool:hover:not([disabled]) { border-color: var(--violet); color: var(--violet); }
.tts-tool svg { width: 17px; height: 17px; }
.tts-tool-on { color: var(--violet); font-weight: 600; }
.tts-tool[disabled] { opacity: .5; cursor: not-allowed; }
.tts-tool[aria-pressed="true"] { border-color: var(--violet); background: var(--lavender); color: var(--violet); font-weight: 600; }

.tts-volume { grid-area: vol; display: none; align-items: center; gap: 10px; font-size: 13px; color: var(--p-soft); }
.tts-volume svg { width: 18px; height: 18px; color: var(--violet); }
.tts-volume input { flex: 1; height: 18px; accent-color: var(--p-fill); }
.tts-volume output { min-width: 3.2em; color: var(--p-muted); font: 12px var(--font-num); }

.tts-source { grid-area: source; position: relative; }
.tts-source-button { display: flex; align-items: center; justify-content: space-between; width: 100%; min-height: 44px; padding: 0 14px; border: 1px solid var(--p-line-strong); border-radius: var(--radius-sm); background: var(--ground); color: var(--p-ink); font: 600 14px/1.3 var(--font-serif); letter-spacing: .04em; cursor: pointer; }
.tts-source-button:hover { border-color: var(--violet); }
.tts-reading-preferences { display:flex; align-items:center; gap:26px; flex-wrap:wrap; }
.tts-reading-preferences .voice-markers-player { margin:0; }
.tts-reading-preferences .language-switch { flex:none; }
.tts-selected-voice { display:inline-flex; align-items:center; gap:10px; min-width:0; }
.tts-selected-voice [hidden] { display:none; }
.tts-voice-avatar { width:36px; height:36px; display:inline-flex; flex:none; align-items:center; justify-content:center; container-type:inline-size; }
.tts-selected-voice .tts-voice-avatar { width:32px; height:32px; }
.tts-voice-avatar picture { display:block; width:100%; height:100%; border-radius:50%; overflow:hidden; box-shadow:0 0 0 1px var(--p-line-strong); }
.tts-voice-avatar img { display:block; width:100%; height:100%; object-fit:cover; transform-origin:50% 92%; animation:voice-nod 2.2s cubic-bezier(.45,.05,.35,1) infinite; }
.tts-voice-avatar[data-avatar-voice="MOWEN"] img { animation-delay:.45s; }
.tts-panel .tts-voice-avatar .robot-mini { display:block; width:100%; height:100%; stroke:none; stroke-width:0; }
.robot-mini-light { opacity:.75; animation:robot-mini-light 2s linear infinite; }
@keyframes robot-mini-light { 0% { animation-timing-function:ease-in-out; opacity:.75; } 40% { animation-timing-function:ease-in-out; opacity:1; } 80%,100% { opacity:.75; } }
html[data-voice-motion="off"] :is(.robot-mini-light,.tts-voice-avatar img) { animation:none; }
.tts-source-list li { min-height:48px; }
@media(prefers-reduced-motion:reduce),(update:slow) { .robot-mini-light,.tts-voice-avatar img { animation:none; } }
@container (max-width:24px) { .robot-mini-light { animation:none; } }
.tts-source-button svg { width: 14px; height: 14px; color: var(--violet); }
.tts-source-list { list-style: none; margin: 6px 0 0; padding: 6px; border: 1px solid var(--p-line); border-radius: var(--radius-sm); background: var(--paper); box-shadow: var(--shadow-menu); }
.tts-source-list[hidden] { display: none; }
.tts-source-list li { position: relative; display: flex; align-items: center; gap: 10px; min-height: 44px; padding: 0 14px; color: var(--p-ink); font: 600 14px/1.3 var(--font-serif); cursor: pointer; }
.tts-source-list li:hover:not([aria-disabled="true"]), .tts-source-list li:focus-visible { background: var(--lavender); outline: none; }
.tts-source-list li[aria-selected="true"] { color: var(--violet); }
.tts-source-list li[aria-disabled="true"] { cursor: not-allowed; color: var(--p-muted); font-weight: 400; }
.tts-opt-note { font: 400 12px/1 var(--font-sans); color: var(--p-muted); }
.tts-dot { display: none; position: absolute; right: 16px; top: 50%; width: 7px; height: 7px; margin-top: -3.5px; background: var(--violet); transform: rotate(45deg); }
.tts-source-list li[aria-selected="true"] .tts-dot { display: block; }
.tts-source-button:focus-visible, .tts-tool:focus-visible, .tts-round:focus-visible, .tts-launch:focus-visible, .tts-source-list li:focus-visible { outline: 2px solid var(--violet); outline-offset: 2px; }

.tts-status { grid-area: status; margin: 0; min-height: 1.4em; font-size: 13px; color: var(--p-muted); }
.tts-approval-note { margin: 0; font: 14px/1.6 var(--font-kai); color: var(--p-soft); }
.tts-rate-menu { position: absolute; z-index: 8; right: 12px; top: 64px; width: min(400px, calc(100% - 24px)); padding: 16px 18px; border: 1px solid var(--p-line); border-top: 2px solid var(--violet); border-radius: var(--radius-sm); background: var(--paper); box-shadow: var(--shadow-menu); color: var(--p-ink); }
.tts-rate-menu[hidden] { display: none; }
.tts-rate-heading { display: flex; align-items: center; gap: 10px; }
.tts-rate-heading h3 { flex: 1; margin: 0; font: 600 17px/1.4 var(--font-serif); letter-spacing: .06em; }
.tts-rate-heading output { font: 26px/1 var(--font-num); color: var(--violet); }
.tts-rate-menu button { border: 1px solid var(--p-line-strong); color: var(--violet); background: var(--ground); cursor: pointer; }
.tts-rate-menu button svg { width: 18px; height: 18px; }
.tts-rate-heading button { width: 44px; height: 44px; margin: -8px 0 -8px -10px; display: grid; place-items: center; padding: 0; background: transparent; border: 0; }
.tts-rate-slider { display: flex; align-items: center; gap: 14px; margin: 20px 0 18px; }
.tts-rate-slider button { width: 44px; height: 44px; padding: 0; border-radius: 50%; display: grid; place-items: center; flex: none; }
.tts-rate-slider input { flex: 1; min-width: 0; appearance: none; background: transparent; height: 24px; cursor: pointer; }
.tts-rate-slider input::-webkit-slider-runnable-track { height: 3px; border-radius: 2px; background: linear-gradient(to right, var(--violet) var(--fill), var(--lavender-deep) var(--fill)); }
.tts-rate-slider input::-webkit-slider-thumb { appearance: none; width: 14px; height: 14px; margin-top: -5.5px; border-radius: 50%; border: 2px solid var(--violet); background: var(--paper); }
.tts-rate-slider input::-moz-range-track { height: 3px; background: var(--lavender-deep); }
.tts-rate-slider input::-moz-range-thumb { width: 10px; height: 10px; border-radius: 50%; border: 2px solid var(--violet); background: var(--paper); }
.tts-rate-presets { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; }
.tts-rate-presets button { min-height: 44px; border-radius: var(--radius-sm); font: 14px var(--font-num); }
.tts-rate-presets button[aria-pressed="true"] { border-color: var(--violet); background: var(--violet); color: var(--paper); }
.tts-rate-menu p { margin: 16px 0 0; font-size: 12px; color: var(--p-muted); }

@media (min-width: 768px) {
  .tts-launch { width: auto; justify-self: start; min-width: 360px; }
  .tts-player {
    grid-template-columns: auto 1fr minmax(180px, 220px) auto; column-gap: 16px;
    grid-template-areas: "wave title source time" "seek seek seek seek" "transport transport transport transport" "tools tools vol vol" "status status status status";
    padding: 20px 26px 18px;
  }
  .tts-source .tts-source-list { position: absolute; z-index: 5; left: 0; right: 0; }
  .tts-transport {
    display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); column-gap: clamp(12px, 2vw, 20px);
    width: min(100%, 680px); justify-self: center; align-self: center; padding: 0 12px; border-right: 0;
  }
  .tts-ctl { width: 100%; min-width: 0; }
  .tts-ctl span { max-width: 100%; white-space: normal; text-align: center; line-height: 1.35; }
  .tts-tools { padding: 0 0 0 4px; border-top: 0; align-self: end; }
  .tts-volume { display: flex; padding-left: 4px; }
}
@media (prefers-reduced-motion: reduce) { .tts-chevron, .tts-launch .tts-icon-lead, .tts-round { transition: none; } .tts-player { animation: none; } }
/* Player 2.1 isolated integration: do not affect the site-wide theme. */
.tts-mini[hidden], .tts-resume[hidden] { display: none !important; }
.tts-player { --p-fill: #55418a; --p-line: #dcd2ee; --p-line-strong: #cdbfe8; --p-track: #b9a6f2; background: #fcfaff; border: 1px solid #dcd2ee; border-radius: 16px; grid-template-areas: "wave title source" "resume resume resume" "seek seek seek" "time time time" "transport transport transport" "tools tools tools" "vol vol vol" "status status status"; }
.tts-player .tts-source-button, .tts-player .tts-tool { border-radius: 10px; background: #fff; }
.tts-player .tts-main { background: #55418a; color: #fff; }
.tts-player .tts-seek { height: 32px; }
.tts-player .tts-seek::-webkit-slider-runnable-track { height: 20px; background: linear-gradient(to right, #55418a var(--fill), #e6def3 var(--fill)); -webkit-mask-image: repeating-linear-gradient(to right, #000 0 3px, transparent 3px 6px); mask-image: repeating-linear-gradient(to right, #000 0 3px, transparent 3px 6px); }
.tts-player .tts-seek::-webkit-slider-thumb { margin-top: 3px; }
.tts-player .tts-time { font-variant-numeric: tabular-nums; }
.tts-resume:not([hidden]) { grid-area: resume; padding: 14px; border: 1px solid #dcd2ee; border-radius: 12px; background: #f3eefb; }
.tts-resume p { margin: 0 0 10px; }
.tts-resume button { min-height: 44px; margin-right: 8px; padding: 8px 16px; border: 1px solid #cdbfe8; border-radius: 9px; background: #fcfaff; color: #3b2c66; }
.tts-resume button:last-child { background: #55418a; color: white; }
.tts-volume { display: flex; }
.tts-mini { display: none; }
@media (max-width: 640px) {
  .tts-mini:not([hidden]) { position: fixed; z-index: 40; left: 8px; right: 8px; bottom: calc(8px + env(safe-area-inset-bottom, 0px)); display: flex; align-items: center; gap: 8px; padding: 8px; border: 1px solid #dcd2ee; border-radius: 14px; background: #fcfaff; box-shadow: 0 4px 20px #55418a33; }
  .tts-mini [data-mini-title] { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .tts-mini button { min-width: 44px; min-height: 44px; }
}
@media (min-width: 768px) {
  .tts-player { grid-template-areas: "wave title source time" "resume resume resume resume" "seek seek seek seek" "transport transport transport transport" "tools tools vol vol" "status status status status"; }
}
