:root {
  --bg: #f6f7f9;
  --panel: #ffffff;
  --text: #1d2129;
  --muted: #5c6370;
  --line: #dcdfe5;
  --accent: #2459d6;
  --accent-text: #ffffff;
  --warn-bg: #1d2129;
  --error: #c62828;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg); color: var(--text);
  font: 16px/1.6 -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", "Segoe UI", sans-serif;
}
.panel {
  max-width: 720px; margin: 40px auto; padding: 32px 36px;
  background: var(--panel); border: 1px solid var(--line); border-radius: 10px;
}
h1 { font-size: 24px; margin: 0 0 16px; }
h2 { font-size: 19px; margin: 0 0 12px; }
.muted { color: var(--muted); }
.error { color: var(--error); min-height: 1.6em; }
label { display: block; font-weight: 600; margin: 18px 0 6px; }
input[type=text], input[type=number], select, textarea {
  width: 100%; padding: 8px 10px; font: inherit; color: inherit;
  border: 1px solid var(--line); border-radius: 6px; background: #fff;
}
.choices label { display: inline-flex; gap: 6px; align-items: center; font-weight: 400; margin: 4px 18px 4px 0; }
button {
  font: inherit; padding: 10px 22px; border: 0; border-radius: 6px; cursor: pointer;
  background: var(--accent); color: var(--accent-text);
}
button:disabled { opacity: .5; cursor: not-allowed; }
.consent { white-space: pre-line; background: var(--bg); padding: 14px 16px; border-radius: 6px; }
.check { display: flex; gap: 8px; align-items: flex-start; font-weight: 400; }

/* 外壳 */
#stage { position: fixed; inset: 0; border: 0; width: 100%; height: 100%; background: var(--bg); }
#overlay {
  position: fixed; inset: 0; z-index: 10; display: none;
  background: var(--warn-bg); color: #fff; align-items: center; justify-content: center; text-align: center;
}
#overlay.show { display: flex; }
#overlay p { max-width: 520px; }

/* 写作页 */
#confirm { border: 0; border-radius: 8px; padding: 22px 24px; max-width: 420px; }
#confirm::backdrop { background: rgba(0, 0, 0, .4); }
#confirm .actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 16px; }
button.secondary { background: var(--line); color: inherit; }
.writing { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; height: 100vh; padding: 20px; }
.writing.no-source { grid-template-columns: 1fr; max-width: 900px; margin: 0 auto; }
.writing .col { display: flex; flex-direction: column; min-height: 0; }
.source {
  flex: 1; overflow: auto; padding: 16px 20px; background: var(--panel); border: 1px solid var(--line);
  border-radius: 8px; white-space: pre-wrap; user-select: none; -webkit-user-select: none;
}
#essay { flex: 1; resize: none; font-size: 17px; line-height: 1.7; padding: 16px; }
.bar { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin: 10px 0; }
.timer { font-variant-numeric: tabular-nums; font-weight: 600; }
.timer.low { color: var(--error); }

table { border-collapse: collapse; width: 100%; }
th, td { border-bottom: 1px solid var(--line); padding: 6px 8px; text-align: left; font-size: 14px; }
#overlay .muted { color: #b8bec9; }
