:root {
  --bg0: #070d17;
  --bg1: #0e1c2e;
  --gold: #e8c88a;
  --gold-dim: #b99a5e;
  --ink: #eaf1fb;
  --muted: #8fa3bd;
  --card: rgba(18, 32, 50, 0.78);
  --line: rgba(232, 200, 138, 0.22);
  --accent: #4fc3f7;
  --good: #7fe0b0;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0;
  min-height: 100%;
  background: var(--bg0);
  color: var(--ink);
  font-family: "PingFang SC", "Microsoft YaHei", "Noto Sans SC", system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
}

.bg {
  position: fixed;
  inset: 0;
  background:
    radial-gradient(1200px 600px at 50% -10%, rgba(79, 195, 247, 0.16), transparent 60%),
    radial-gradient(900px 500px at 10% 100%, rgba(232, 200, 138, 0.10), transparent 60%),
    linear-gradient(180deg, var(--bg1), var(--bg0) 55%);
  z-index: -1;
}

main {
  max-width: 560px;
  margin: 0 auto;
  padding: 18px 16px calc(24px + env(safe-area-inset-bottom));
}

.screen { animation: fade 0.35s ease; }
@keyframes fade { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 20px 18px;
  backdrop-filter: blur(10px);
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.35);
}
.card + .card { margin-top: 12px; }

.crest { text-align: center; color: var(--gold); font-size: 26px; letter-spacing: 6px; }

h1 { font-size: 24px; margin: 8px 0 4px; text-align: center; font-weight: 600; letter-spacing: 2px; }
h2 { font-size: 21px; margin: 6px 0 4px; text-align: center; letter-spacing: 2px; }
.sub { text-align: center; color: var(--muted); margin: 0 0 18px; font-size: 13px; }

.rules { color: var(--muted); font-size: 13px; line-height: 1.75; padding-left: 18px; margin: 0 0 18px; }
.rules b { color: var(--ink); font-weight: 500; }

.field { display: block; margin-bottom: 14px; }
.field span { display: block; font-size: 12px; color: var(--muted); margin-bottom: 6px; }
.field input, textarea {
  width: 100%;
  background: rgba(6, 14, 24, 0.7);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 10px;
  color: var(--ink);
  padding: 11px 12px;
  font-size: 15px;
  font-family: inherit;
  outline: none;
}
.field input:focus, textarea:focus { border-color: var(--gold-dim); }

button {
  font-family: inherit;
  cursor: pointer;
  border: none;
  border-radius: 10px;
  font-size: 15px;
  transition: transform 0.08s ease, background 0.15s ease, opacity 0.15s;
}
button:active { transform: scale(0.98); }

.primary {
  width: 100%;
  padding: 14px;
  background: linear-gradient(180deg, #f0d6a4, var(--gold-dim));
  color: #1b1305;
  font-weight: 600;
  letter-spacing: 1px;
}
.primary:disabled { opacity: 0.38; }
.ghost {
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.16);
  color: var(--muted);
  padding: 8px 14px;
  font-size: 13px;
}

.hint { font-size: 11.5px; color: var(--muted); margin: 10px 0 0; line-height: 1.6; text-align: center; }
.hint a { color: var(--gold); }

/* ---------- 测试页 ---------- */
.topbar { margin-bottom: 12px; }
.progress { height: 4px; background: rgba(255, 255, 255, 0.1); border-radius: 99px; overflow: hidden; }
.progress > div { height: 100%; width: 0; background: linear-gradient(90deg, var(--gold-dim), var(--gold)); transition: width 0.3s ease; }
.meta { display: flex; justify-content: space-between; align-items: center; margin-top: 8px; color: var(--muted); font-size: 12px; }

.sentence { font-size: 17px; line-height: 1.85; margin: 4px 0 18px; letter-spacing: 0.5px; }

.player { display: flex; align-items: center; gap: 12px; }
.play {
  width: 52px; height: 52px; border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #f6e3bd, var(--gold-dim));
  color: #1b1305;
  display: grid; place-items: center;
  flex: 0 0 auto;
  box-shadow: 0 6px 18px rgba(232, 200, 138, 0.28);
}
.play.playing { box-shadow: 0 0 0 8px rgba(232, 200, 138, 0.12); }

.wave { flex: 1; height: 34px; display: flex; align-items: center; gap: 3px; overflow: hidden; }
.wave i { flex: 1; background: rgba(232, 200, 138, 0.25); border-radius: 2px; transition: background 0.2s, height 0.2s; }
.wave i.on { background: var(--gold); }

.time { font-variant-numeric: tabular-nums; color: var(--muted); font-size: 12px; min-width: 38px; text-align: right; }
.listen-count { margin: 12px 0 0; font-size: 12px; color: var(--muted); }

/* ---------- 评分 ---------- */
.row + .row { margin-top: 16px; }
.row-head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 8px; font-size: 13px; color: var(--muted); }
.row-head b { color: var(--gold); font-size: 15px; font-variant-numeric: tabular-nums; }

.scale { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; }
.scale button {
  padding: 10px 2px;
  font-size: 12px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--muted);
  border-radius: 8px;
}
.scale button.active {
  background: rgba(232, 200, 138, 0.16);
  border-color: var(--gold);
  color: var(--gold);
}

textarea { margin-top: 16px; resize: none; font-size: 13px; }

.actions { display: flex; gap: 10px; margin-top: 16px; }
.actions .primary { flex: 1; width: auto; }
.actions .ghost { flex: 0 0 auto; }

.stats { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 18px 0; }
.stats div {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  padding: 12px;
  text-align: center;
}
.stats b { display: block; font-size: 22px; color: var(--gold); font-weight: 600; }
.stats span { font-size: 11.5px; color: var(--muted); }

.toast {
  position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%);
  background: rgba(8, 16, 28, 0.95);
  border: 1px solid var(--line);
  color: var(--ink);
  padding: 10px 16px; border-radius: 99px; font-size: 13px;
  z-index: 20;
}
