/* yybb - 网页语音播报样式
 * v1.8 新增：TTS 后端切换按钮样式
 */
:root {
  --bg: #f4f6fb;
  --card: #ffffff;
  --ink: #1f2430;
  --ink-soft: #6b7280;
  --line: #e5e8f0;
  --brand: #3555f2;
  --brand-dark: #2743cf;
  --brand-soft: #eaeefe;
  --ok: #0e9f6e;
  --radius: 14px;
  --shadow: 0 6px 24px rgba(31, 41, 66, 0.07);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #14161d;
    --card: #1d2029;
    --ink: #e8eaf0;
    --ink-soft: #9aa1b0;
    --line: #2c313d;
    --brand: #6b83ff;
    --brand-dark: #5067f0;
    --brand-soft: #262b45;
    --shadow: 0 6px 24px rgba(0, 0, 0, 0.35);
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font-family: "Segoe UI", "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  line-height: 1.6;
}

.topbar {
  text-align: center;
  padding: 40px 16px 8px;
}

.topbar h1 {
  margin: 0;
  font-size: 6rem;
  letter-spacing: 0.02em;
  outline: none;
  border-bottom: 2px dashed transparent;
  transition: border-color 0.2s;
  line-height: 1.2;
  min-height: 1.2em;
}

.topbar h1:focus {
  border-bottom-color: var(--brand);
  background: var(--brand-soft);
}

.clock {
  margin-top: 12px;
  font-size: 3rem;
  font-weight: 700;
  color: var(--brand);
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.05em;
}

.subtitle {
  margin: 6px 0 0;
  color: var(--ink-soft);
  font-size: 0.95rem;
}

.container {
  max-width: 860px;
  margin: 0 auto;
  padding: 20px 16px 48px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px 20px;
}

.editor-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 10px;
}

.editor-head label { font-weight: 600; }

.editor-tools { display: flex; gap: 8px; }

textarea {
  width: 100%;
  min-height: 160px;
  resize: vertical;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--bg);
  color: var(--ink);
  font: inherit;
  font-size: 1rem;
  outline: none;
}

textarea:focus { border-color: var(--brand); }

.counter {
  margin-top: 6px;
  text-align: right;
  color: var(--ink-soft);
  font-size: 0.85rem;
}

.control-row {
  display: flex;
  align-items: flex-end;
  gap: 12px;
  flex-wrap: wrap;
}

.control { display: flex; flex-direction: column; gap: 4px; }
.control.grow { flex: 1 1 240px; }

.control label {
  font-size: 0.88rem;
  color: var(--ink-soft);
  font-weight: 600;
}

select {
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--bg);
  color: var(--ink);
  font: inherit;
  outline: none;
}

select:focus { border-color: var(--brand); }

.sliders .control { flex: 1 1 150px; }

input[type="range"] {
  width: 100%;
  accent-color: var(--brand);
}

output { color: var(--brand); font-weight: 600; }

.action-row {
  display: flex;
  gap: 10px;
  margin-top: 16px;
  flex-wrap: wrap;
}

.btn {
  padding: 10px 22px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--card);
  color: var(--ink);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.05s, background 0.15s, border-color 0.15s;
}

.btn:hover:not(:disabled) { border-color: var(--brand); }
.btn:active:not(:disabled) { transform: scale(0.97); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }

.btn.primary {
  background: var(--brand);
  border-color: var(--brand);
  color: #fff;
}

.btn.primary:hover:not(:disabled) { background: var(--brand-dark); }

.btn.ghost { background: transparent; }
.btn.small { padding: 5px 12px; font-size: 0.85rem; font-weight: 500; }

.script-card .counter { margin: 0; }

.script {
  min-height: 120px;
  max-height: 400px;
  overflow-y: auto;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--bg);
  font-size: 1rem;
  line-height: 1.8;
  white-space: pre-wrap;
  word-break: break-word;
}

.sentence {
  cursor: pointer;
  border-radius: 3px;
  padding: 2px 0;
  transition: color 0.2s, background 0.2s;
}

.sentence:hover {
  background: var(--brand-soft);
}

.sentence.current {
  color: var(--brand);
  font-weight: 600;
  background: var(--brand-soft);
}

.sentence.done {
  color: var(--ink-soft);
}

.tip {
  color: var(--ink-soft);
  font-size: 0.88rem;
  margin: 4px 2px 0;
}

.notice {
  background: #fff7e6;
  border: 1px solid #f0d9a8;
  color: #7a5b12;
  border-radius: var(--radius);
  padding: 12px 16px;
  font-size: 0.92rem;
  line-height: 1.7;
}

.notice.fail {
  background: #fdecea;
  border-color: #f5b7b1;
  color: #9d261d;
}

.notice.warn {
  background: #fff7e6;
  border-color: #f0d9a8;
  color: #7a5b12;
}

@media (prefers-color-scheme: dark) {
  .notice {
    background: #2b2413;
    border-color: #4d3f1c;
    color: #e6c56a;
  }
  .notice.fail {
    background: #3a1a18;
    border-color: #5c2620;
    color: #f0a098;
  }
}

.footer {
  text-align: center;
  padding: 18px 16px 30px;
  color: var(--ink-soft);
  font-size: 0.88rem;
}

.footer a { color: var(--brand); text-decoration: none; }
.footer a:hover { text-decoration: underline; }

@media (max-width: 560px) {
  .topbar { padding-top: 28px; }
  .card { padding: 14px; }
  .btn { flex: 1 1 auto; }
}
