:root {
  --bg: #faf8f2;
  --surface: #ffffff;
  --ink: #24231f;
  --ink-soft: #5f5e58;
  --ink-mute: #8c8a82;
  --line: #e6e1d6;
  --primary: #ba7517;
  --primary-ink: #633806;
  --tint: #faeeda;
  --radius: 14px;
}

* { box-sizing: border-box; }

/* hidden 属性优先级要压过 class 里的 display */
[hidden] { display: none !important; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", system-ui, sans-serif;
  font-size: 15px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--primary-ink); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { font-weight: 500; margin: 0 0 8px; line-height: 1.3; }
h1 { font-size: 26px; }
h2 { font-size: 17px; }
p { margin: 0 0 10px; }

.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 24px; border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, .8); backdrop-filter: blur(8px);
  position: sticky; top: 0; z-index: 10;
}
.brand { font-weight: 500; letter-spacing: .04em; color: var(--ink); }
.topbar nav a { margin-left: 18px; color: var(--ink-soft); font-size: 14px; }

.page { max-width: 1080px; margin: 0 auto; padding: 28px 24px 80px; }
.page-title { margin-bottom: 6px; }
.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.page-actions { display: flex; gap: 10px; flex-wrap: wrap; }

.hero { padding: 40px 0 28px; }
.hero h1 { font-size: 34px; letter-spacing: .02em; }
.hero p { color: var(--ink-soft); max-width: 620px; }

.muted { color: var(--ink-soft); }
.small { font-size: 13px; }
.mono { font-variant-numeric: tabular-nums; font-feature-settings: "tnum"; }
.kicker { font-size: 12px; letter-spacing: .18em; color: var(--primary); text-transform: uppercase; margin-bottom: 6px; }
.pinyin { color: var(--ink-mute); font-size: 13px; letter-spacing: .04em; }
.lead { font-size: 18px; color: var(--ink); }
.right { text-align: right; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 9px 18px; border-radius: 999px; border: 1px solid var(--line);
  background: var(--surface); color: var(--ink); font-size: 14px; cursor: pointer;
  transition: transform .12s ease, background .12s ease, border-color .12s ease;
  font-family: inherit;
}
.btn:hover { text-decoration: none; transform: translateY(-1px); }
.btn:disabled { opacity: .45; cursor: default; transform: none; }
.btn.primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn.ghost { background: transparent; color: var(--ink-soft); }
.btn.small { padding: 5px 12px; font-size: 13px; }
.btn.tiny { padding: 2px 9px; font-size: 12px; }
.btn.big { padding: 15px 42px; font-size: 17px; min-width: 160px; }

.card {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 22px; margin-bottom: 18px;
}
.card h2 { margin-bottom: 12px; }
.row { display: flex; gap: 14px; flex-wrap: wrap; }
.row.between { justify-content: space-between; align-items: center; }
.row.tight { gap: 8px; }
.form label { display: block; flex: 1; min-width: 200px; font-size: 13px; color: var(--ink-soft); margin-bottom: 12px; }
.form input, .form textarea {
  display: block; width: 100%; margin-top: 5px; padding: 9px 12px;
  border: 1px solid var(--line); border-radius: 10px; background: #fdfcf8;
  font-family: inherit; font-size: 14px; color: var(--ink);
}
.form input:focus, .form textarea:focus { outline: 2px solid #f0dcc0; border-color: var(--primary); }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 16px; }
.theme-card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 20px; display: flex; flex-direction: column; justify-content: space-between; gap: 14px;
}
.theme-card h2 { font-size: 19px; }
.theme-actions { display: flex; gap: 8px; }
.meta { font-size: 12px; color: var(--ink-mute); margin: 0; }

.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th { text-align: left; font-weight: 500; color: var(--ink-mute); font-size: 12px; padding: 8px 10px; border-bottom: 1px solid var(--line); }
.table td { padding: 10px; border-bottom: 1px solid #f1ece1; vertical-align: top; }
.table tr.aux { opacity: .55; }
.table tr:hover { background: #fdfbf6; }
.editable { min-width: 60px; border-radius: 6px; padding: 2px 4px; }
.editable:focus { outline: 2px solid #f0dcc0; background: #fffdf6; }

.tag { display: inline-block; padding: 1px 9px; border-radius: 999px; font-size: 11px; background: #f1ece1; color: var(--ink-soft); }
.tag.ready, .tag.approved { background: #e6f4ea; color: #2c6b3f; }
.tag.generating, .tag.pending { background: var(--tint); color: var(--primary-ink); }
.tag.rejected, .tag.failed { background: #fcebeb; color: #9c2b2b; }

.job .bar { height: 6px; background: #f1ece1; border-radius: 999px; overflow: hidden; margin: 10px 0 8px; }
.job .bar span { display: block; height: 100%; background: var(--primary); transition: width .4s ease; }
.err { color: #9c2b2b; font-size: 11px; margin-top: 4px; }

.sheets { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 14px; }
.sheets img { width: 100%; border-radius: 8px; border: 1px solid var(--line); display: block; }
.sheets a { text-decoration: none; }
.contact { width: 100%; border-radius: 10px; border: 1px solid var(--line); }

.start { max-width: 620px; padding: 30px 0; }
.start h1 { font-size: 38px; }
.start-actions { display: flex; gap: 12px; margin: 22px 0 16px; flex-wrap: wrap; }

/* 玩家 */
.player { max-width: 760px; margin: 0 auto; }
.player-head { display: flex; align-items: center; gap: 16px; margin-bottom: 18px; }
.progress { flex: 1; height: 5px; background: #ece6d9; border-radius: 999px; overflow: hidden; }
.progress span { display: block; height: 100%; width: 0; background: var(--primary); transition: width .35s ease; }
.counter { font-size: 13px; color: var(--ink-mute); font-variant-numeric: tabular-nums; }

.stage {
  background: var(--surface); border: 1px solid var(--line); border-radius: 20px;
  min-height: 420px; padding: 34px; display: flex; align-items: center; justify-content: center;
}
.ask { text-align: center; max-width: 560px; }
.ask .hint { font-size: 17px; color: var(--ink); margin-bottom: 18px; }
.ask .qtext { font-size: 20px; line-height: 1.6; margin: 0 auto 18px; max-width: 520px; }
.rings { display: flex; gap: 10px; justify-content: center; margin-bottom: 22px; height: 26px; align-items: center; }
.rings span {
  width: 10px; height: 10px; border-radius: 50%; background: var(--primary); opacity: .25;
}
.stage[data-state="playing"] .rings span { animation: pulse 1.2s infinite ease-in-out; }
.stage[data-state="playing"] .rings span:nth-child(2) { animation-delay: .2s; }
.stage[data-state="playing"] .rings span:nth-child(3) { animation-delay: .4s; }
@keyframes pulse { 0%, 100% { opacity: .2; transform: scale(.85); } 50% { opacity: 1; transform: scale(1.15); } }
.ask .btn { margin: 0 4px; }

.answer { display: grid; grid-template-columns: 240px 1fr; gap: 24px; align-items: center; width: 100%; }
.answer-media img { width: 100%; border-radius: 12px; display: block; background: #f4f0e6; }
.answer-text h2 { font-size: 30px; margin: 4px 0 10px; }

.controls { display: flex; gap: 12px; justify-content: center; margin-top: 20px; }

.done { max-width: 560px; margin: 40px auto; text-align: center; }

.single-card { max-width: 520px; margin: 0 auto; }
.sc-media img { width: 100%; max-width: 360px; border-radius: 14px; margin: 12px 0 18px; display: block; }
.single-card audio { width: 100%; margin: 12px 0; }

.empty { padding: 40px; text-align: center; color: var(--ink-soft); background: var(--surface); border: 1px dashed var(--line); border-radius: var(--radius); }

.alert { background: var(--tint); color: var(--primary-ink); border: 1px solid #eccfa4; border-radius: 10px; padding: 10px 14px; font-size: 14px; margin-bottom: 14px; }
.form label.inline { display: flex; align-items: center; gap: 8px; min-width: 0; font-size: 14px; color: var(--ink-soft); }
.form label.inline input { display: inline; width: auto; margin: 0; }
td.right form { display: inline; }

/* 打印机 */
.dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; background: #c9c4b6; }
.dot.on { background: #2f9e5f; box-shadow: 0 0 0 3px rgba(47, 158, 95, .15); }
.dot.off { background: #c0503f; box-shadow: 0 0 0 3px rgba(192, 80, 63, .12); }
.ipt { padding: 8px 12px; border: 1px solid var(--line); border-radius: 10px; background: #fdfcf8; font-family: inherit; font-size: 14px; min-width: 240px; }
.ipt.sm { min-width: 70px; padding: 5px 8px; }
.ipt:focus { outline: 2px solid #f0dcc0; border-color: var(--primary); }
.mt { margin-top: 12px; }
.found { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.jobbar { height: 6px; background: #f1ece1; border-radius: 999px; overflow: hidden; margin: 16px 0 8px; }
.jobbar span { display: block; height: 100%; width: 0; background: var(--primary); transition: width .5s ease; }
.joblist { list-style: none; padding: 0; margin: 10px 0 0; font-size: 13px; }
.joblist li { padding: 3px 0; color: var(--ink-soft); }
.joblist li.ok::before { content: "✓ "; color: #2f9e5f; }
.joblist li.bad { color: #9c2b2b; }
.joblist li.bad::before { content: "× "; }
.sheet-cell { display: flex; flex-direction: column; gap: 6px; }
.sheet-cell img { border-radius: 8px; border: 1px solid var(--line); width: 100%; display: block; }

@media (max-width: 720px) {
  .page { padding: 20px 16px 60px; }
  .answer { grid-template-columns: 1fr; }
  .answer-media img { max-width: 240px; margin: 0 auto; }
  .stage { padding: 22px; min-height: 360px; }
  .btn.big { width: 100%; }
  .controls { flex-direction: column; }
}
