/* SCH Life Notes TTS V2.3.2
   Reading / Listening dual mode + shared player
*/
:root{
  --sch-tts-bg:#fffaf2;
  --sch-tts-panel:#ffffff;
  --sch-tts-text:#241c18;
  --sch-tts-muted:#6f6258;
  --sch-tts-line:#d9cbbd;
  --sch-tts-accent:#3a2a22;
  --sch-tts-gold:#f2cc00;
  --sch-tts-highlight:#fff0a6;
  --sch-tts-ok:#16733d;
  --sch-tts-err:#b42318;
}

/* V2.3 dual-mode selector */
.sch-tts-modebar{
  margin:0 0 20px;padding:12px 14px;border:1px solid var(--sch-tts-line);border-radius:16px;
  background:#fbf6ef;color:var(--sch-tts-text);box-shadow:0 8px 22px rgba(40,28,20,.05)
}
.sch-tts-modebar__label{margin-bottom:8px;color:var(--sch-tts-muted);font-size:13px;font-weight:900;letter-spacing:.08em}
.sch-tts-mode-switch{display:grid;grid-template-columns:1fr 1fr;gap:8px}
.sch-tts-mode-btn{
  min-height:44px;border:1px solid var(--sch-tts-line);border-radius:12px;padding:9px 12px;
  background:#fff;color:var(--sch-tts-accent);font:inherit;font-weight:900;cursor:pointer;touch-action:manipulation
}
.sch-tts-mode-btn.active{background:var(--sch-tts-accent);color:#fff;border-color:var(--sch-tts-accent);box-shadow:0 7px 18px rgba(58,42,34,.16)}
.sch-tts-mode-btn:focus-visible{outline:3px solid var(--sch-tts-gold);outline-offset:2px}
.sch-tts-mode-duration{font-size:.84em;font-weight:800;opacity:.82;white-space:nowrap}
.sch-tts-modebar__hint{margin-top:8px;color:var(--sch-tts-muted);font-size:13px;line-height:1.55}

/* Only after JS initialization do we hide listening controls in Reading mode.
   If the shared JS fails to load, the fallback panel stays visible for diagnosis. */
body.sch-tts-enhanced.sch-tts-mode-reading .sch-tts-panel,
body.sch-tts-enhanced.sch-tts-mode-reading .sch-tts-preparing,
body.sch-tts-enhanced.sch-tts-mode-reading .sch-tts-float,
body.sch-tts-enhanced.sch-tts-mode-reading .sch-tts-follow-btn,
body.sch-tts-enhanced.sch-tts-mode-reading .sch-tts-chapter{display:none !important}
body.sch-tts-enhanced.sch-tts-mode-reading [data-tts-seg][data-tts-chunk].sch-tts-clickable{cursor:inherit}
body.sch-tts-enhanced.sch-tts-mode-reading [data-tts-seg][data-tts-chunk].sch-tts-clickable:hover{outline:0;outline-offset:0}
body.sch-tts-enhanced.sch-tts-mode-listening .sch-tts-panel{display:block}


.sch-tts-panel{
  margin:0 0 26px;
  padding:18px;
  border:1px solid var(--sch-tts-line);
  border-radius:18px;
  background:linear-gradient(135deg,var(--sch-tts-panel),var(--sch-tts-bg));
  color:var(--sch-tts-text);
  box-shadow:0 12px 30px rgba(40,28,20,.08);
}
.sch-tts-panel *{box-sizing:border-box}
.sch-tts-panel__title{font-size:21px;font-weight:900;color:var(--sch-tts-accent);margin-bottom:7px}
.sch-tts-panel__intro{font-size:14px;line-height:1.7;color:var(--sch-tts-muted);margin-bottom:13px}
.sch-tts-row{display:flex;flex-wrap:wrap;align-items:center;gap:8px;margin:8px 0}
.sch-tts-panel button,.sch-tts-panel select,.sch-tts-float button,.sch-tts-preparing button,.sch-tts-follow-btn{
  font:inherit;
}
.sch-tts-panel button,.sch-tts-chapter,.sch-tts-preparing button,.sch-tts-follow-btn{
  min-height:42px;
  border:0;
  border-radius:10px;
  padding:9px 13px;
  background:var(--sch-tts-accent);
  color:#fff;
  font-weight:800;
  cursor:pointer;
  touch-action:manipulation;
}
.sch-tts-panel button.secondary{background:#6b625c}
.sch-tts-panel button.ghost{background:#f1ebe3;color:var(--sch-tts-accent);border:1px solid var(--sch-tts-line)}
.sch-tts-panel button:disabled{opacity:.48;cursor:not-allowed}
.sch-tts-panel select{
  min-height:42px;
  max-width:100%;
  border:1px solid var(--sch-tts-line);
  border-radius:10px;
  padding:7px 10px;
  background:#fff;
  color:var(--sch-tts-text);
}
.sch-tts-hint{margin-top:10px;color:var(--sch-tts-muted);font-size:13px;line-height:1.65}
.sch-tts-status{margin-top:9px;font-size:14px;font-weight:800;color:var(--sch-tts-muted);line-height:1.55}
.sch-tts-status.ok{color:var(--sch-tts-ok)}
.sch-tts-status.err{color:var(--sch-tts-err)}
.sch-tts-now{display:none;margin-top:11px;padding:10px 12px;border-radius:11px;background:#f7f1e9;color:var(--sch-tts-accent);font-weight:800;line-height:1.55}
.sch-tts-now.show{display:block}
.sch-tts-admin{margin-top:9px;font-size:13px;color:var(--sch-tts-muted)}
.sch-tts-admin summary{cursor:pointer;font-weight:800}

.sch-tts-transport{display:flex;flex-wrap:wrap;gap:7px;margin-top:12px}
.sch-tts-transport button{min-width:48px}
.sch-tts-progress-wrap{margin-top:14px}
.sch-tts-progress-line{display:flex;align-items:center;gap:10px}
.sch-tts-progress-line input[type="range"]{width:100%;accent-color:var(--sch-tts-accent)}
.sch-tts-time{display:flex;justify-content:space-between;gap:10px;margin-top:3px;color:var(--sch-tts-muted);font-size:12px;font-variant-numeric:tabular-nums}
.sch-tts-resume{display:none;margin-top:11px;padding:10px 12px;border-radius:11px;background:#f7f1e9;border:1px solid var(--sch-tts-line)}
.sch-tts-resume.show{display:flex;flex-wrap:wrap;align-items:center;gap:8px}
.sch-tts-resume span{font-size:13px;color:var(--sch-tts-muted);font-weight:700;flex:1 1 240px}

.sch-tts-chapter{display:inline-block;margin:0 0 18px;padding:7px 11px;min-height:36px;font-size:14px}
.sch-tts-chapter:disabled{opacity:.48;cursor:not-allowed}

/* Current sentence highlight. !important prevents article-specific styles from hiding it. */
.sch-tts-highlight{
  background:var(--sch-tts-highlight) !important;
  color:#241c18 !important;
  outline:3px solid var(--sch-tts-gold) !important;
  outline-offset:3px !important;
  box-shadow:0 0 0 7px rgba(242,204,0,.18) !important;
  border-radius:8px !important;
  transition:background-color .12s ease,outline-color .12s ease,box-shadow .12s ease !important;
}
.sch-tts-highlight *{color:#241c18 !important}
[data-tts-seg][data-tts-chunk].sch-tts-clickable{cursor:pointer}
[data-tts-seg][data-tts-chunk].sch-tts-clickable:hover{outline:1px dashed rgba(58,42,34,.25);outline-offset:2px}

.sch-tts-preparing:not(.show),.sch-tts-float:not(.show),.sch-tts-follow-btn:not(.show){display:none}
.sch-tts-preparing.show{
  display:flex;gap:10px;align-items:center;flex-wrap:wrap;
  margin:10px 0 16px;padding:10px 12px;border-radius:10px;
  background:#f7f1e9;border:1px solid var(--sch-tts-line);color:var(--sch-tts-text)
}
.sch-tts-preparing button{min-height:36px;padding:7px 10px}
.sch-tts-ios-play:not(.show){display:none}
.sch-tts-ios-play.show{display:inline-block}

.sch-tts-float.show{
  position:fixed;left:50%;bottom:max(14px,env(safe-area-inset-bottom));transform:translateX(-50%);z-index:9998;
  display:flex;align-items:center;gap:7px;width:min(94vw,820px);padding:9px 10px;border-radius:14px;
  background:#241c18;color:#fffdf8;box-shadow:0 10px 30px rgba(0,0,0,.27)
}
.sch-tts-float button{cursor:pointer;min-width:38px;min-height:36px;border:0;border-radius:9px;background:#fff;color:#241c18;font-weight:900}
.sch-tts-float__text{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;flex:1 1 auto;font-size:13px}
.sch-tts-float__progress{font-size:12px;color:#e6ddd6;white-space:nowrap;font-variant-numeric:tabular-nums}

.sch-tts-follow-btn.show{
  position:fixed;right:14px;bottom:78px;z-index:9997;min-height:40px;padding:8px 12px;
  background:#241c18;color:#fff;border:0;border-radius:999px;box-shadow:0 8px 22px rgba(0,0,0,.22);cursor:pointer
}

@media(max-width:640px){
  .sch-tts-modebar{padding:11px 12px;margin-bottom:16px}
  .sch-tts-mode-switch{grid-template-columns:1fr 1fr}
  .sch-tts-mode-btn{padding:8px 6px;font-size:15px}
  .sch-tts-modebar__hint{font-size:12px}
  .sch-tts-panel{padding:15px;border-radius:15px}
  .sch-tts-panel__title{font-size:19px}
  .sch-tts-row{align-items:stretch}
  .sch-tts-row>button,.sch-tts-row>select{flex:1 1 calc(50% - 8px)}
  .sch-tts-transport{display:grid;grid-template-columns:repeat(5,1fr)}
  .sch-tts-transport button{padding:8px 4px;min-width:0;font-size:13px}
  .sch-tts-float__progress{display:none}
}

@media(prefers-reduced-motion:reduce){
  .sch-tts-highlight{transition:none !important}
}
