:root { color-scheme: light; --bg: #f6f7f4; --paper: #fff; --ink: #172c2b; --muted: #62716e; --line: #e0e7e2; --accent: #087f72; --accent-dark: #06665c; --soft: #edf5f1; font: 100%/1.6 system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; color: var(--ink); background: var(--bg); }
* { box-sizing: border-box; }
body { margin: 0; }
button, input, select, textarea { font: inherit; }
button, input, select, textarea, a { -webkit-tap-highlight-color: transparent; }
button { min-height: 44px; cursor: pointer; }
button:disabled { opacity: .55; cursor: wait; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 4px; }
.hidden, .svg-defs { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.icon { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; flex-shrink: 0; }
.page-shell { max-width: 1224px; padding: 0 40px; margin: 0 auto; }
.site-header { height: 96px; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--line); gap: 20px; }
.brand { display: inline-flex; align-items: center; color: var(--ink); text-decoration: none; font-size: 23px; font-weight: 750; letter-spacing: -.9px; }
.brand-mark { display: grid; place-items: center; width: 36px; height: 36px; background: var(--accent); color: white; border-radius: 11px; margin-right: 10px; }
.brand-mark .icon { width: 23px; height: 23px; }
.brand-dot { color: var(--accent); }
.header-note { font-size: .875rem; color: var(--muted); }
.intro { position: relative; padding: 48px 0 38px; }
.eyebrow { display: flex; align-items: center; gap: 8px; margin: 0 0 14px; font-size: .875rem; font-weight: 650; letter-spacing: .6px; color: var(--accent-dark); }
.eyebrow > span { width: 6px; height: 6px; border-radius: 50%; background: var(--accent); }
h1 { font-size: clamp(36px, 4.5vw, 58px); line-height: 1.12; font-weight: 720; letter-spacing: -2.2px; margin: 0 0 18px; }
h1 span { color: var(--accent); }
.intro-description { color: var(--muted); margin: 0; font-size: 1rem; }
.intro-art { display: flex; position: absolute; right: 52px; top: 112px; align-items: center; gap: 26px; transform: rotate(-5deg); }
.wave-bars { display: flex; align-items: center; gap: 6px; height: 100px; }
.wave-bars i { width: 7px; height: 30px; background: #9ecabe; border-radius: 6px; }
.wave-bars i:nth-child(3n) { height: 62px; background: var(--accent); }
.wave-bars i:nth-child(4n) { height: 88px; background: #51aa98; }
.wave-bars i:nth-child(5n) { height: 45px; }
.wave-bars i:first-child, .wave-bars i:last-child { height: 15px; }
.art-arrow { color: #8ba69c; font-size: 28px; }
.text-lines { width: 100px; display: grid; gap: 12px; }
.text-lines i { height: 5px; border-radius: 4px; background: #bdd4cb; }
.text-lines i:nth-child(2) { width: 80%; }
.text-lines i:nth-child(4) { width: 60%; }
.workspace { display: grid; grid-template-columns: minmax(0, .9fr) minmax(0, 1.25fr); gap: 24px; align-items: stretch; }
.panel { min-width: 0; background: var(--paper); border: 1px solid var(--line); border-radius: 20px; box-shadow: 0 6px 24px #17352a04; }
.source-panel { padding: 28px; }
.panel-heading { display: flex; align-items: center; gap: 10px; margin-bottom: 24px; }
.step { display: grid; place-items: center; width: 1.6875rem; height: 1.6875rem; flex-shrink: 0; background: var(--soft); color: var(--accent-dark); border-radius: 8px; font-size: .875rem; font-weight: 700; }
h2 { margin: 0; font-size: 1.25rem; font-weight: 680; letter-spacing: -.35px; }
.source-switch { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; background: #f0f3f0; border-radius: 11px; padding: 5px; margin-bottom: 25px; }
.source-switch button { display: flex; align-items: center; justify-content: center; gap: 8px; padding: 8px; border: 1px solid transparent; border-radius: 8px; background: transparent; color: var(--muted); font-size: 1rem; font-weight: 600; }
.source-switch button[aria-pressed="true"] { background: white; border-color: var(--line); box-shadow: 0 2px 4px #17352a07; color: var(--accent-dark); }
label { display: block; font-size: 1rem; font-weight: 650; margin-bottom: 8px; }
input[type="url"], select { width: 100%; min-height: 48px; border: 1px solid #d7e1db; border-radius: 9px; background: #fff; color: var(--ink); padding: 11px 12px; }
input::placeholder { color: #7a8882; font-size: 1rem; }
.hint { color: var(--muted); font-size: 1rem; line-height: 1.6; margin: 9px 0 0; overflow-wrap: anywhere; white-space: pre-wrap; }
.language-field { margin-top: 24px; }
.file-picker { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 22px 14px; border: 1px dashed #9cbeb0; border-radius: 11px; background: #f8fbf9; text-align: center; }
.file-picker:focus-within { outline: 3px solid var(--accent); outline-offset: 3px; }
.file-picker:has(input:disabled) { opacity: .55; }
.upload-icon { width: 26px; height: 26px; color: var(--accent); margin-bottom: 10px; }
.file-prompt { font-size: 1rem; font-weight: 600; }
#file-name { max-width: 100%; }
input[type="file"] { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; }
.run-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 28px; }
.primary { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex: 1; border: 1px solid var(--accent); border-radius: 10px; background: var(--accent); color: white; padding: 12px 17px; font-weight: 600; }
.primary:hover:not(:disabled) { background: var(--accent-dark); }
.stop { border: 1px solid #e6c9c5; background: #fff5f3; color: #9e3d31; border-radius: 10px; padding: 10px 16px; }
#status, .status { color: var(--accent-dark); font-size: 1rem; white-space: pre-wrap; overflow-wrap: anywhere; margin: 14px 0 0; }
#status:empty, .status:empty { display: none; }
#status[data-state="error"], .status[data-state="error"] { color: #a1392e; }
#status[data-state="busy"]::before, .status[data-state="busy"]::before { content: ""; display: inline-block; width: 10px; height: 10px; margin-right: 8px; border: 2px solid #b8d8ce; border-top-color: var(--accent); border-radius: 50%; animation: spin 1s linear infinite; }
.source-footer { display: flex; align-items: center; gap: 7px; color: var(--muted); font-size: .875rem; margin: 23px 0 0; padding-top: 18px; border-top: 1px solid var(--line); }
.source-footer .icon { width: 16px; height: 16px; }
.result-panel { padding: 28px; display: flex; flex-direction: column; }
.result-heading { flex-wrap: wrap; row-gap: 10px; }
.badge { font-size: .875rem; font-weight: 550; color: var(--muted); border: 1px solid var(--line); padding: 3px 8px; border-radius: 20px; margin-left: auto; }
.badge[data-state="complete"] { background: var(--soft); color: var(--accent-dark); border-color: #c9e1d6; }
.empty-result { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 28px 0 42px; min-height: 380px; }
.paper-art { width: 102px; height: 126px; position: relative; padding: 19px; background: #fff; border: 1px solid #d9e5dd; border-radius: 12px; box-shadow: -12px 12px 0 #f0f5ef; margin: 5px 0 30px; transform: rotate(-6deg); }
.paper-symbol { display: block; color: #8aa99a; margin-bottom: 10px; text-align: left; }
.paper-symbol .icon { width: 23px; height: 23px; }
.paper-art > i { display: block; height: 3px; margin-top: 8px; background: #d4e3da; border-radius: 3px; }
.paper-art > i:last-of-type { width: 65%; }
.paper-wave { display: grid; place-items: center; position: absolute; right: -18px; bottom: 8px; width: 43px; height: 43px; background: var(--accent); color: white; border: 4px solid white; border-radius: 13px; transform: rotate(12deg); }
.empty-result h3 { font-size: 1.375rem; font-weight: 650; letter-spacing: -.4px; margin: 0 0 9px; }
.empty-result p { font-size: 1rem; color: var(--muted); margin: 0; max-width: 340px; }
.empty-result strong { font-weight: 600; }
.empty-formats { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin-top: 24px; }
.empty-formats span { font-size: .875rem; color: var(--muted); background: #f5f7f4; padding: 3px 9px; border-radius: 5px; }
#result { display: flex; flex: 1; flex-direction: column; min-width: 0; }
.result-toolbar { display: flex; gap: 8px; flex-wrap: wrap; padding-bottom: 17px; border-bottom: 1px solid var(--line); }
.result-toolbar button { display: inline-flex; align-items: center; justify-content: center; gap: 6px; border: 1px solid var(--line); background: white; padding: 7px 11px; border-radius: 8px; font-size: 1rem; color: var(--ink); }
.result-toolbar button:hover { background: var(--soft); border-color: #a6c6b8; }
.result-toolbar .icon { width: 15px; height: 15px; }
#copy-status { margin: 8px 0 0; font-size: 1rem; color: var(--accent-dark); overflow-wrap: anywhere; }
#copy-status:empty { display: none; }
#output { width: 100%; flex: 1; min-height: 360px; resize: vertical; border: 0; border-radius: 6px; background: transparent; color: var(--ink); padding: 16px 0 0; font-size: 1.125rem; line-height: 1.7; }
.site-footer { display: flex; justify-content: space-between; gap: 15px; margin-top: 35px; padding: 20px 0 28px; border-top: 1px solid var(--line); color: var(--muted); font-size: .875rem; }
.site-footer > span { color: var(--ink); font-weight: 700; }
.site-footer p { margin: 0; }
/* Chuyển công cụ Transcript / Text to Speech */
.mode-switch { display: flex; gap: 4px; background: #f0f3f0; border-radius: 11px; padding: 5px; }
.mode-switch a { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 8px 14px; border: 1px solid transparent; border-radius: 8px; color: var(--muted); font-weight: 600; text-decoration: none; white-space: nowrap; }
.mode-switch a[aria-current="page"] { background: white; border-color: var(--line); box-shadow: 0 2px 4px #17352a07; color: var(--accent-dark); }
.mode-switch a:hover:not([aria-current]) { color: var(--ink); }
/* Text to Speech */
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-top: 24px; }
.output-mode { border: 0; padding: 0; margin: 24px 0 0; min-width: 0; }
.output-mode legend { font-weight: 650; padding: 0; margin-bottom: 8px; }
.choice { display: flex; gap: 10px; align-items: flex-start; font-weight: 400; margin: 0 0 8px; padding: 12px; border: 1px solid #d7e1db; border-radius: 9px; cursor: pointer; }
.choice:has(input:checked) { border-color: var(--accent); background: #f8fbf9; }
.choice input { width: 20px; height: 20px; margin: 2px 0 0; accent-color: var(--accent); flex-shrink: 0; }
.choice strong { display: block; font-weight: 600; }
.choice .hint { margin: 2px 0 0; }
.book-title { margin: 0 0 14px; font-weight: 650; font-size: 1.125rem; overflow-wrap: anywhere; }
.player-bar { background: var(--ink); color: white; border-radius: 14px; padding: 16px; }
.progress { position: relative; height: 8px; background: #ffffff2e; border-radius: 6px; cursor: pointer; }
.progress i { position: absolute; inset: 0 auto 0 0; width: 0; background: #6fd0bd; border-radius: 6px; }
.player-times { display: flex; justify-content: space-between; font-size: .875rem; color: #c8d8d2; margin-top: 6px; }
.player-controls { display: flex; align-items: center; gap: 8px; margin-top: 8px; }
.player-controls button { display: grid; place-items: center; width: 48px; height: 48px; border: 0; border-radius: 12px; background: #ffffff14; color: white; }
.player-controls button:hover { background: #ffffff26; }
.player-controls .play { width: 56px; height: 56px; background: var(--accent); }
.player-controls .play:hover { background: #0a9585; }
.player-controls .play .icon { fill: currentColor; }
.player-controls .speed { margin: 0 0 0 auto; }
.player-controls select { width: auto; min-height: 44px; background: #ffffff14; color: white; border-color: #ffffff33; }
.player-controls select option { color: var(--ink); }
.now-label { margin: 16px 0 6px; font-size: .875rem; font-weight: 650; color: var(--accent-dark); }
.reading-text { max-height: 360px; overflow-y: auto; font-size: 1.125rem; line-height: 1.7; white-space: pre-wrap; overflow-wrap: anywhere; }
.chunk-list { margin-top: 16px; border-top: 1px solid var(--line); padding-top: 12px; }
.chunk-list summary { cursor: pointer; font-weight: 600; min-height: 44px; display: flex; align-items: center; }
.chunk-list ol { margin: 8px 0 0; padding-left: 2.2em; max-height: 320px; overflow-y: auto; }
.chunk-list li[data-active] button { color: var(--accent-dark); font-weight: 650; }
.chunk-list button { width: 100%; text-align: left; border: 0; background: none; padding: 8px 0; color: var(--ink); overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.file-list { list-style: none; margin: 12px 0 0; padding: 0; display: grid; gap: 10px; }
.file-list li { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 6px 12px; padding: 12px; border: 1px solid var(--line); border-radius: 10px; }
.file-list a { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; color: var(--accent-dark); font-weight: 600; overflow-wrap: anywhere; }
.file-list .hint { margin: 0; }
/* Text to Speech: danh sách phần (chương/mục) để chọn */
.section-tools { display: flex; gap: 8px; flex-wrap: wrap; margin: 12px 0 8px; }
.section-tools button, .back-link { border: 1px solid var(--line); background: white; color: var(--ink); border-radius: 8px; padding: 7px 12px; }
.section-tools button:hover, .back-link:hover { background: var(--soft); border-color: #a6c6b8; }
.back-link { margin-bottom: 12px; }
.section-list { list-style: none; margin: 0; padding: 0; max-height: 460px; overflow-y: auto; border-top: 1px solid var(--line); }
.section-list li { border-bottom: 1px solid var(--line); }
.section-list label { display: flex; gap: 12px; align-items: flex-start; margin: 0; padding: 12px 4px; font-weight: 400; cursor: pointer; }
.section-list label:has(input:checked) { background: #f8fbf9; }
.section-list input { width: 20px; height: 20px; margin: 3px 0 0; accent-color: var(--accent); flex-shrink: 0; }
.section-list strong { display: block; font-weight: 600; overflow-wrap: anywhere; }
.section-list .hint { margin: 2px 0 0; font-size: .875rem; }
.selection-summary { margin: 12px 0 0; font-weight: 600; color: var(--accent-dark); }
.selection-summary[data-state="warn"] { color: #a1392e; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (max-width: 1000px) {
  .intro-art { right: 20px; transform: rotate(-5deg) scale(.8); transform-origin: right center; }
  .workspace { gap: 18px; grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr); }
  .source-panel, .result-panel { padding: 22px; }
}
@media (max-width: 760px) {
  .page-shell { padding: 0 20px; }
  .site-header { height: auto; min-height: 76px; flex-wrap: wrap; padding: 14px 0; row-gap: 12px; }
  .mode-switch { width: 100%; }
  .mode-switch a { flex: 1; padding: 8px; }
  .field-row { grid-template-columns: 1fr; }
  .reading-text { max-height: none; }
  .section-list { max-height: none; }
  .intro { padding: 32px 0 28px; }
  h1 { font-size: 44px; }
  .intro-art { display: none; }
  .intro-description { max-width: 420px; }
  .desktop-break { display: none; }
  .workspace { grid-template-columns: minmax(0, 1fr); gap: 18px; }
  .panel { border-radius: 16px; }
  .empty-result { min-height: 320px; padding: 25px 0 30px; }
  .source-footer { margin-top: 19px; }
  #output { min-height: 400px; }
  .site-footer { margin-top: 24px; }
  body.has-result .intro { padding: 24px 0; }
  body.has-result h1 { font-size: 32px; margin-bottom: 0; }
  body.has-result h1 br { display: none; }
  body.has-result .eyebrow, body.has-result .intro-description { display: none; }
}
@media (max-width: 380px) {
  .page-shell { padding: 0 14px; }
  .header-note { display: none; }
  .mode-switch a .icon { display: none; }
  .player-controls { gap: 6px; }
  .source-panel, .result-panel { padding: 19px; }
  h1 { font-size: 39px; }
  .result-heading .badge { margin-left: 37px; }
  .site-footer { flex-wrap: wrap; gap: 4px; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; scroll-behavior: auto !important; } }
