:root {
  --bg: #f4f6f8;
  --panel: #ffffff;
  --ink: #1f2933;
  --muted: #6b7785;
  --line: #e4e8ec;
  --accent: #10b981;
  --accent-d: #0c8f6a;
  --accent-soft: #e7f7f1;
  --t2: #6366f1;
  --t2-soft: #ecedff;
  --shadow: 0 1px 3px rgba(16,24,40,.08), 0 6px 20px rgba(16,24,40,.06);
  --radius: 16px;
}
* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: "PingFang SC", "Microsoft YaHei", "Hiragino Sans GB", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
}

/* Top bar */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 22px;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 20;
}
.brand { display: flex; align-items: center; gap: 12px; }
.logo { font-size: 30px; }
.brand-text h1 { margin: 0; font-size: 18px; letter-spacing: .3px; }
.brand-text p { margin: 2px 0 0; font-size: 12px; color: var(--muted); }
.mode-switch { display: inline-flex; background: var(--bg); border: 1px solid var(--line); border-radius: 999px; padding: 3px; }
.mode-btn {
  border: 0; background: transparent; cursor: pointer;
  padding: 8px 16px; border-radius: 999px; font-size: 14px; color: var(--muted); font-weight: 600;
  transition: all .15s;
}
.mode-btn.active { background: var(--accent); color: #fff; box-shadow: var(--shadow); }
.mode-btn[data-mode="T2"].active { background: var(--t2); }

/* Layout */
.layout { display: grid; grid-template-columns: 320px 1fr; height: calc(100vh - 60px); }
.sidebar { border-right: 1px solid var(--line); background: var(--panel); display: flex; flex-direction: column; min-height: 0; }
.search-box { padding: 14px; border-bottom: 1px solid var(--line); }
.search-box input {
  width: 100%; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px;
  font-size: 13px; outline: none; background: var(--bg);
}
.search-box input:focus { border-color: var(--accent); background: #fff; }
.tree { flex: 1; overflow-y: auto; padding: 8px 6px 16px; }
.tree-foot { padding: 8px 14px; font-size: 12px; color: var(--muted); border-top: 1px solid var(--line); }

/* Tree */
.node { user-select: none; }
.node.date {
  font-size: 12px; font-weight: 700; color: var(--muted);
  padding: 10px 10px 4px; letter-spacing: .4px; cursor: pointer;
  display: flex; align-items: center; gap: 6px;
}
.node.date:hover { color: var(--ink); }
.node.task {
  padding: 7px 10px 7px 22px; border-radius: 9px; cursor: pointer; font-size: 14px;
  display: flex; align-items: center; gap: 6px; color: var(--ink);
}
.node.task:hover { background: var(--accent-soft); }
.node.task.active { background: var(--accent-soft); color: var(--accent-d); font-weight: 600; }
.node.q {
  padding: 6px 10px 6px 40px; border-radius: 9px; cursor: pointer; font-size: 13px;
  color: var(--muted); display: flex; gap: 8px; align-items: baseline;
}
.node.q:hover { background: #f0f2f4; color: var(--ink); }
.node.q.active { background: var(--accent-soft); color: var(--accent-d); font-weight: 600; }
.node.q .qbadge { font-weight: 700; color: var(--accent); min-width: 22px; }
.mode-T2 .node.q .qbadge, .node.q.t2 .qbadge { color: var(--t2); }
.node.q .qsnip { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.caret { width: 12px; display: inline-block; transition: transform .15s; color: var(--muted); font-size: 10px; }
.collapsed > .children { display: none; }
.children { margin: 0; }

/* Stage */
.stage { overflow-y: auto; padding: 22px 30px 48px; }
.breadcrumb { font-size: 13px; color: var(--muted); margin-bottom: 14px; }
.breadcrumb b { color: var(--ink); }

.card {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 22px 24px; max-width: 980px;
}
.scene-head { display: flex; align-items: center; gap: 12px; margin-bottom: 18px; }
.tag {
  font-size: 12px; font-weight: 800; padding: 4px 10px; border-radius: 8px; color: #fff; background: var(--accent);
}
.tag.T2 { background: var(--t2); }
.scenario { font-size: 13px; color: var(--muted); line-height: 1.5; }

.scene-body { display: block; }
.text-col { min-width: 0; }
.q-label { font-size: 13px; font-weight: 800; color: var(--accent); letter-spacing: .5px; }
.q-label-row { display: flex; align-items: center; gap: 10px; }
.eye-btn {
  width: 34px; height: 34px; border-radius: 10px; border: 1px solid var(--line);
  background: #fff; cursor: pointer; color: var(--accent); padding: 0;
  display: inline-flex; align-items: center; justify-content: center; transition: all .15s;
}
.eye-btn:hover { border-color: var(--accent); background: var(--accent-soft); }
.eye-ic { width: 20px; height: 20px; display: none; }
.eye-btn.closed .eye-closed { display: block; }
.eye-btn:not(.closed) .eye-open { display: block; }
.q-text { font-size: 22px; line-height: 1.5; font-weight: 600; margin: 6px 0 20px; }
.q-text.hidden-text { color: var(--muted); font-weight: 500; font-style: italic; }

/* Player */
.player { display: flex; align-items: center; gap: 12px; margin-bottom: 18px; }
.play-btn {
  width: 52px; height: 52px; border-radius: 50%; border: 0; cursor: pointer;
  background: var(--accent); color: #fff; font-size: 20px; flex: none;
  box-shadow: var(--shadow); transition: transform .1s;
}
.play-btn:hover { transform: scale(1.05); }
.play-btn:disabled { background: #c7ced4; cursor: not-allowed; }
.progress { flex: 1; height: 8px; background: var(--bg); border-radius: 999px; overflow: hidden; }
.progress-fill { height: 100%; width: 0%; background: var(--accent); transition: width .1s linear; }
.time { font-size: 13px; color: var(--muted); min-width: 44px; text-align: right; font-variant-numeric: tabular-nums; }

/* Countdown */
.countdown-wrap { position: relative; width: 120px; height: 120px; margin: 8px 0 4px; }
.ring { transform: rotate(-90deg); }
.ring-bg { fill: none; stroke: var(--bg); stroke-width: 9; }
.ring-fg { fill: none; stroke: var(--accent); stroke-width: 9; stroke-linecap: round;
  stroke-dasharray: 326.7; stroke-dashoffset: 326.7; transition: stroke-dashoffset .25s linear, stroke .2s; }
.ring-fg.t2 { stroke: var(--t2); }
.ring-center { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.cd-num { font-size: 34px; font-weight: 800; font-variant-numeric: tabular-nums; }
.cd-status { font-size: 11px; color: var(--muted); margin-top: 2px; text-align: center; padding: 0 6px; }

/* Buttons */
.actions { display: flex; gap: 10px; margin: 14px 0 6px; }
.btn {
  border: 1px solid var(--line); background: #fff; cursor: pointer; border-radius: 10px;
  padding: 9px 14px; font-size: 13px; font-weight: 600; color: var(--ink); transition: all .15s;
}
.btn:hover { border-color: var(--accent); color: var(--accent-d); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.nav { display: flex; align-items: center; gap: 12px; margin-top: 10px; }
.nav-pos { font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; }
.hint { font-size: 12px; color: var(--muted); margin-top: 14px; }

@media (max-width: 880px) {
  .layout { grid-template-columns: 1fr; }
  .sidebar { display: none; }
}
