/* ===== 主题变量（保留原暗色基调）===== */
:root {
  color-scheme: dark;
  --bg:       #0f1a1f;
  --panel:    #182730;
  --panel2:   #1d3039;
  --line:     #2b4550;
  --muted:    #7f9aa4;
  --accent:   #9de3b7;
  --accent-dim: #4a8a65;
  --text:     #eaf4f0;
  --font:     32px;

  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bot: env(safe-area-inset-bottom, 0px);
}

/* ===== 基础 ===== */
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; margin: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, "Microsoft YaHei", "PingFang SC", sans-serif;
  overflow: hidden;           /* 整页不滚，只有提词窗口滚 */
  display: flex;
  flex-direction: column;
  padding-top: var(--safe-top);
  padding-bottom: var(--safe-bot);
}

/* ===== 控制栏 ===== */
.controls {
  background: var(--panel);
  border-bottom: 1px solid var(--line);
  padding: 10px 14px 8px;
  flex-shrink: 0;
}
.controls .row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}
.controls .row.status {
  font-size: 12px;
  color: var(--muted);
  gap: 14px;
  margin-top: 2px;
  margin-bottom: 2px;
}
.controls .row.status span { font-variant-numeric: tabular-nums; }

/* ===== 按钮 ===== */
button {
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  min-height: 40px;
  min-width: 40px;
  padding: 8px 14px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--panel2);
  color: var(--text);
  cursor: pointer;
  user-select: none;
  transition: background .12s, border-color .12s;
}
button:hover { border-color: var(--accent-dim); }
button:active { transform: scale(.97); }
button:disabled { opacity: .4; cursor: default; transform: none; }

button.primary { background: var(--accent); color: #112a1d; border-color: var(--accent); }
button.primary:hover:not(:disabled) { background: #b8eccb; }
button.big { padding: 10px 18px; font-size: 15px; }
button.ghost { background: transparent; }

/* ===== 滑块 ===== */
.slider {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--muted);
  white-space: nowrap;
}
.slider input[type=range] {
  width: 100px;
  accent-color: var(--accent);
}
.slider output {
  min-width: 2.2em;
  text-align: right;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

/* ===== 提词窗口 ===== */
.reading {
  flex: 1 1 auto;
  position: relative;
  overflow: hidden;
  background: var(--bg);
}
#prompter {
  height: 100%;
  overflow-y: auto;
  padding: 60px 28px 120px;
  font-size: var(--font);
  line-height: 2.0;
  color: var(--text);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  scroll-behavior: smooth;
  /* 镜像模式由 JS 加 class */
}
#prompter.mirror {
  transform: scaleX(-1);
}

/* 提词器的"已读 / 当前"标记 */
#prompter span { cursor: pointer; border-radius: 2px; }
#prompter .read   { color: #5f7d86; }
#prompter .current {
  background: var(--accent);
  color: #0f2a1c;
  box-shadow: 0 0 0 3px var(--accent);
  border-radius: 3px;
}

/* 渐隐遮罩 */
.overlay {
  position: absolute;
  left: 0; right: 0;
  height: 60px;
  pointer-events: none;
}
.overlay.top    { top: 0;    background: linear-gradient(to bottom, var(--bg), transparent); }
.overlay.bottom { bottom: 0; background: linear-gradient(to top,    var(--bg), transparent); }

/* 中间参考线 */
.indicator {
  position: absolute;
  left: 0; right: 0;
  top: 35%;
  height: 1px;
  background: var(--accent-dim);
  opacity: .35;
  pointer-events: none;
}

/* ===== 编辑区（折叠面板）===== */
.editor {
  background: var(--panel);
  border-top: 1px solid var(--line);
  flex-shrink: 0;
  padding: 10px 14px;
}
.editor summary {
  cursor: pointer;
  font-weight: 600;
  font-size: 14px;
  padding: 4px 0;
}
.editor summary span {
  font-size: 12px;
  color: var(--muted);
  font-weight: 400;
  margin-left: 8px;
}
.editor textarea {
  width: 100%;
  min-height: 100px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--bg);
  color: var(--text);
  padding: 10px 12px;
  font-size: 15px;
  line-height: 1.7;
  font-family: inherit;
  resize: vertical;
  margin: 8px 0;
}
.editor textarea:focus { outline: 2px solid var(--accent); outline-offset: -1px; border-color: transparent; }

/* ===== 页脚快捷键提示 ===== */
footer {
  flex-shrink: 0;
  text-align: center;
  font-size: 11px;
  color: var(--muted);
  padding: 6px 8px 10px;
  line-height: 1.9;
}
footer kbd {
  display: inline-block;
  background: var(--panel2);
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 1px 6px;
  margin: 0 2px;
  font-size: 10px;
  font-family: inherit;
  color: var(--text);
}

.muted { color: var(--muted); font-size: 12px; }

/* ===== 全屏模式下隐藏控制栏，让提词窗口占满 ===== */
:fullscreen body { background: #000; }
:fullscreen .controls,
:fullscreen .editor,
:fullscreen footer { display: none; }
:fullscreen .reading { height: 100vh; }
:fullscreen #prompter { padding: 80px 40px 140px; }

/* ===== 横屏优化 ===== */
@media (orientation: landscape) and (max-height: 500px) {
  .controls { padding: 6px 10px; }
  .controls .row { margin-bottom: 4px; }
  .editor textarea { min-height: 70px; }
  footer { display: none; }
  #prompter { padding: 40px 20px 100px; }
}

/* ===== 手机小屏 ===== */
@media (max-width: 420px) {
  .slider input[type=range] { width: 80px; }
  button { padding: 8px 10px; font-size: 13px; }
  button.big { padding: 9px 14px; }
  #prompter { padding: 50px 16px 110px; }
}

/* ===== 动效 ===== */
@media (prefers-reduced-motion: reduce) {
  #prompter { scroll-behavior: auto; }
}
