/* ============================================================
 * 守夜人口风琴 · 样式
 * 深色夜景 + 琥珀铜色（口琴 / 灯火）
 * ============================================================ */

:root {
  --bg: #0c1015;
  --bg-soft: #11161d;
  --panel: #151b24;
  --panel-2: #1b232e;
  --line: #263140;
  --line-soft: #1e2733;
  --text: #e8eef5;
  --text-dim: #a4b2c2;
  --muted: #6f8096;
  --accent: #e0a458;
  --accent-soft: rgba(224, 164, 88, 0.14);
  --accent-line: rgba(224, 164, 88, 0.4);
  --green: #4fa98a;
  --ok: #5ac97f;
  --bad: #ef6a5e;
  --warn: #d99a4e;
  --radius: 14px;
  --radius-sm: 9px;
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
  --mono: ui-monospace, "SF Mono", "Cascadia Mono", Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background:
    radial-gradient(1100px 600px at 12% -8%, rgba(224, 164, 88, 0.10), transparent 62%),
    radial-gradient(900px 520px at 96% 4%, rgba(79, 169, 138, 0.09), transparent 58%),
    var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", "Source Han Sans SC", sans-serif;
  font-size: 15px;
  line-height: 1.72;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ---------- 布局 ---------- */
.wrap { max-width: 1060px; margin: 0 auto; padding: 0 20px; }

/* ---------- 顶部导航 ---------- */
.nav {
  position: sticky; top: 0; z-index: 50;
  background: rgba(12, 16, 21, 0.86);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line-soft);
}
.nav-in {
  max-width: 1060px; margin: 0 auto; padding: 0 20px;
  height: 58px; display: flex; align-items: center; gap: 26px;
}
.brand {
  display: flex; align-items: center; gap: 9px;
  font-weight: 700; color: var(--text); font-size: 15px;
  letter-spacing: 0.2px; white-space: nowrap;
}
.brand:hover { text-decoration: none; }
.brand-mark {
  width: 26px; height: 26px; border-radius: 7px; flex: 0 0 auto;
  background: linear-gradient(135deg, var(--accent), #b57a34);
  display: grid; place-items: center; font-size: 14px;
  box-shadow: 0 0 0 1px rgba(224, 164, 88, 0.25), 0 3px 10px rgba(224, 164, 88, 0.22);
}
.nav-links { display: flex; gap: 4px; margin-left: auto; }
.nav-links a {
  color: var(--text-dim); padding: 7px 13px; border-radius: 8px;
  font-size: 14px; transition: background 0.15s, color 0.15s;
}
.nav-links a:hover { background: var(--panel); color: var(--text); text-decoration: none; }
.nav-links a.on { background: var(--accent-soft); color: var(--accent); }

/* ---------- Hero ---------- */
.hero { padding: 62px 0 44px; }
.hero-tag {
  display: inline-flex; align-items: center; gap: 7px;
  font-size: 12.5px; color: var(--accent);
  background: var(--accent-soft); border: 1px solid var(--accent-line);
  padding: 5px 12px; border-radius: 999px; margin-bottom: 18px;
  letter-spacing: 0.3px;
}
.hero h1 {
  margin: 0 0 16px; font-size: 40px; line-height: 1.24;
  letter-spacing: -0.5px; font-weight: 750;
}
.hero h1 em {
  font-style: normal;
  background: linear-gradient(100deg, var(--accent), #f0c88a 55%, var(--green));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.hero p.lead {
  margin: 0 0 28px; color: var(--text-dim); font-size: 16px; max-width: 640px;
}
.hero-actions { display: flex; gap: 12px; flex-wrap: wrap; }

/* ---------- 按钮 ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 10px 18px; border-radius: 10px; font-size: 14.5px;
  border: 1px solid var(--line); background: var(--panel);
  color: var(--text); cursor: pointer; font-family: inherit;
  transition: transform 0.12s, background 0.15s, border-color 0.15s;
  user-select: none;
}
.btn:hover { background: var(--panel-2); border-color: #35445a; }
.btn:active { transform: translateY(1px); }
.btn-primary {
  background: linear-gradient(135deg, var(--accent), #c88c40);
  color: #1a1206; border-color: transparent; font-weight: 650;
}
.btn-primary:hover { background: linear-gradient(135deg, #eab066, #d2964a); }
.btn-sm { padding: 6px 12px; font-size: 13px; border-radius: 8px; }
.btn-ghost { background: transparent; }
.btn[disabled] { opacity: 0.45; cursor: not-allowed; }

/* ---------- 数据条 ---------- */
.stats {
  display: grid; grid-template-columns: repeat(4, 1fr);
  gap: 1px; background: var(--line-soft);
  border: 1px solid var(--line-soft); border-radius: var(--radius);
  overflow: hidden; margin: 34px 0 0;
}
.stat { background: var(--bg-soft); padding: 17px 18px; }
.stat .k { font-size: 12px; color: var(--muted); letter-spacing: 0.4px; margin-bottom: 5px; }
.stat .v { font-size: 17px; font-weight: 650; color: var(--text); }
.stat .v small { font-size: 12.5px; color: var(--text-dim); font-weight: 400; margin-left: 4px; }

/* ---------- 区块 ---------- */
section.block { padding: 46px 0 8px; }
.sec-head { margin-bottom: 22px; }
.sec-head h2 {
  margin: 0 0 7px; font-size: 22px; font-weight: 700; letter-spacing: -0.2px;
  display: flex; align-items: center; gap: 10px;
}
.sec-head h2::before {
  content: ""; width: 3px; height: 19px; border-radius: 2px;
  background: linear-gradient(var(--accent), var(--green)); flex: 0 0 auto;
}
.sec-head p { margin: 0; color: var(--muted); font-size: 14px; }

/* ---------- 卡片网格 ---------- */
.grid { display: grid; gap: 16px; }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-2 { grid-template-columns: repeat(2, 1fr); }

.card {
  background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 22px;
  transition: border-color 0.18s, transform 0.18s;
}
a.card { display: block; color: inherit; }
a.card:hover {
  border-color: var(--accent-line); transform: translateY(-2px);
  text-decoration: none; box-shadow: var(--shadow);
}
.card .ico {
  width: 38px; height: 38px; border-radius: 10px; display: grid;
  place-items: center; font-size: 18px; margin-bottom: 14px;
  background: var(--accent-soft); border: 1px solid var(--accent-line);
}
.card h3 { margin: 0 0 8px; font-size: 16.5px; font-weight: 650; }
.card p { margin: 0; color: var(--text-dim); font-size: 14px; }

/* ---------- 提示条 ---------- */
.notice {
  border-radius: var(--radius-sm); padding: 13px 16px; font-size: 13.5px;
  border: 1px solid var(--line); background: var(--panel);
  color: var(--text-dim); display: flex; gap: 10px; align-items: flex-start;
}
.notice .ni { flex: 0 0 auto; font-size: 14px; line-height: 1.6; }
.notice strong { color: var(--text); }
.notice.warn { border-color: rgba(217, 154, 78, 0.42); background: rgba(217, 154, 78, 0.08); }
.notice.warn .ni { color: var(--warn); }
.notice.info { border-color: rgba(79, 169, 138, 0.35); background: rgba(79, 169, 138, 0.07); }
.notice.info .ni { color: var(--green); }

/* ---------- 键位表 ---------- */
.keytable { display: flex; flex-wrap: wrap; gap: 9px; }
.keycell {
  background: var(--panel); border: 1px solid var(--line);
  border-radius: 10px; padding: 11px 0 9px; min-width: 74px;
  text-align: center; transition: border-color 0.12s, background 0.12s;
  cursor: pointer;
}
.keycell:hover { border-color: var(--accent-line); background: var(--panel-2); }
.keycell.hit { border-color: var(--accent); background: var(--accent-soft); }
.keycell .kbd {
  font-family: var(--mono); font-size: 17px; font-weight: 700;
  color: var(--accent); display: block; line-height: 1.3;
}
.keycell .num { font-size: 13px; color: var(--text); font-weight: 600; }
.keycell .sol { font-size: 11.5px; color: var(--muted); }

/* ---------- 曲谱音符 ---------- */
.song { padding: 0; overflow: hidden; }
.song-head {
  padding: 18px 20px 15px; border-bottom: 1px solid var(--line-soft);
  display: flex; align-items: flex-start; gap: 12px; flex-wrap: wrap;
}
.song-head .t { flex: 1 1 200px; min-width: 0; }
.song-head h3 {
  margin: 0 0 5px; font-size: 17px; font-weight: 680;
  display: flex; align-items: center; gap: 9px; flex-wrap: wrap;
}
.song-head .meta { font-size: 12.5px; color: var(--muted); }
.chip {
  font-size: 11.5px; padding: 2px 9px; border-radius: 999px;
  border: 1px solid var(--line); color: var(--text-dim);
  background: var(--bg-soft); font-weight: 500; white-space: nowrap;
}
.chip.npc { color: var(--green); border-color: rgba(79, 169, 138, 0.35); background: rgba(79, 169, 138, 0.08); }
.chip.count { color: var(--accent); border-color: var(--accent-line); background: var(--accent-soft); }

.song-body { padding: 17px 20px 20px; }
.raw-score {
  font-family: var(--mono); font-size: 13px; color: var(--text-dim);
  background: var(--bg-soft); border: 1px dashed var(--line);
  border-radius: 8px; padding: 8px 12px; margin-bottom: 15px;
  display: inline-block; word-break: break-all;
}
.raw-score b { color: var(--muted); font-weight: 400; }

/* 音符序列 */
.notes { display: flex; flex-wrap: wrap; gap: 7px; margin-bottom: 15px; }
.note {
  position: relative; min-width: 52px; padding: 8px 8px 6px;
  border-radius: 9px; border: 1px solid var(--line);
  background: var(--bg-soft); text-align: center; cursor: pointer;
  transition: transform 0.1s, border-color 0.12s, background 0.12s;
}
.note:hover { border-color: var(--accent-line); background: var(--panel-2); }
.note:active { transform: scale(0.94); }
.note .dg {
  font-size: 17px; font-weight: 700; color: var(--text);
  display: block; line-height: 1.25; font-family: var(--mono);
}
.note.acc .dg { color: var(--accent); }
.note .hw {
  font-size: 10.5px; color: var(--muted); line-height: 1.35; display: block;
  margin-top: 2px; white-space: nowrap;
}
.note.hold::after {
  content: "长按"; position: absolute; top: -7px; right: -5px;
  font-size: 9.5px; padding: 1px 5px; border-radius: 5px;
  background: var(--warn); color: #1a1206; font-weight: 700;
  letter-spacing: 0.2px;
}
.note.hold { border-color: rgba(217, 154, 78, 0.5); }
.note.playing { border-color: var(--accent); background: var(--accent-soft); }
.note.done { opacity: 0.5; }
.note.ok { border-color: var(--ok); background: rgba(90, 201, 127, 0.14); }
.note.bad { border-color: var(--bad); background: rgba(239, 106, 94, 0.14); }
.note.cur {
  border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-soft);
  animation: pulse 1.2s ease-in-out infinite;
}
@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 2px var(--accent-soft); }
  50% { box-shadow: 0 0 0 6px rgba(224, 164, 88, 0.06); }
}

/* 控制条 */
.controls {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding-top: 14px; border-top: 1px solid var(--line-soft);
}
.speed { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); }
.speed input[type="range"] { width: 92px; accent-color: var(--accent); }
.speed b { color: var(--text); font-family: var(--mono); min-width: 42px; }
.progress { font-size: 13px; color: var(--muted); margin-left: auto; }
.progress b { color: var(--accent); font-family: var(--mono); }
.progress.err b { color: var(--bad); }

.tip {
  margin-top: 13px; font-size: 13px; color: var(--text-dim);
  padding-left: 12px; border-left: 2px solid var(--line);
}
.tip b { color: var(--accent); font-weight: 600; }

/* 键盘提示条 */
.kbdbar {
  margin-top: 13px; padding: 10px 13px; border-radius: 9px;
  background: var(--bg-soft); border: 1px solid var(--line);
  font-size: 13px; color: var(--text-dim); display: none;
}
.kbdbar.show { display: block; }
.kbdbar .cur-note { color: var(--accent); font-weight: 700; font-family: var(--mono); }
.kbdbar .need { color: var(--text); }
.kbdbar .hint { color: var(--muted); }

/* ---------- 步骤 / 列表 ---------- */
.steps { display: grid; gap: 16px; }
.step {
  background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 22px;
}
.step-head { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.step-day {
  font-size: 12px; font-weight: 700; color: #1a1206; letter-spacing: 0.5px;
  background: linear-gradient(135deg, var(--accent), #c88c40);
  padding: 4px 11px; border-radius: 999px; flex: 0 0 auto;
}
.step-head h3 { margin: 0; font-size: 16.5px; font-weight: 650; }
.step ol { margin: 0 0 0 0; padding-left: 20px; color: var(--text-dim); }
.step ol li { margin-bottom: 9px; }
.step ol li:last-child { margin-bottom: 0; }
.step .notice { margin-top: 15px; }

/* ---------- 折叠 ---------- */
.faq { display: grid; gap: 10px; }
details.qa {
  background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius-sm); overflow: hidden;
}
details.qa summary {
  cursor: pointer; padding: 14px 18px; font-weight: 600; font-size: 14.5px;
  list-style: none; display: flex; align-items: center; gap: 10px;
}
details.qa summary::-webkit-details-marker { display: none; }
details.qa summary::before {
  content: "+"; color: var(--accent); font-family: var(--mono);
  font-size: 16px; font-weight: 700; flex: 0 0 auto;
}
details.qa[open] summary::before { content: "\2212"; }
details.qa[open] summary { border-bottom: 1px solid var(--line-soft); }
details.qa .ans { padding: 14px 18px 17px; color: var(--text-dim); font-size: 14px; }

/* ---------- 自由弹奏 ---------- */
.free { display: grid; gap: 14px; }
.free-keys { display: flex; gap: 9px; flex-wrap: wrap; }
.free-key {
  flex: 1 1 70px; min-width: 70px; text-align: center; cursor: pointer;
  background: var(--panel); border: 1px solid var(--line);
  border-radius: 11px; padding: 14px 0 11px;
  transition: transform 0.08s, border-color 0.12s, background 0.12s;
}
.free-key:hover { border-color: var(--accent-line); background: var(--panel-2); }
.free-key.active, .free-key:active {
  border-color: var(--accent); background: var(--accent-soft);
  transform: translateY(2px);
}
.free-key .fk { font-family: var(--mono); font-size: 19px; font-weight: 700; color: var(--accent); display: block; }
.free-key .fn { font-size: 13px; font-weight: 600; color: var(--text); display: block; }
.free-key .fs { font-size: 11px; color: var(--muted); display: block; line-height: 1.35; }
.free-status { font-size: 13.5px; color: var(--text-dim); }
.free-status b { color: var(--accent); font-family: var(--mono); }
.free-status .mod { color: var(--green); font-weight: 600; }

/* ---------- 表格 ---------- */
.tbl { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.tbl th, .tbl td { padding: 10px 13px; text-align: left; border-bottom: 1px solid var(--line-soft); }
.tbl th { color: var(--muted); font-weight: 600; font-size: 12.5px; letter-spacing: 0.3px; }
.tbl td { color: var(--text-dim); }
.tbl tr:last-child td { border-bottom: none; }
.tbl code {
  font-family: var(--mono); background: var(--bg-soft); padding: 2px 7px;
  border-radius: 5px; color: var(--accent); font-size: 12.5px;
  border: 1px solid var(--line);
}
.tbl-wrap { border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; background: var(--panel); }

/* ---------- 页脚 ---------- */
footer {
  margin-top: 64px; padding: 30px 0 40px;
  border-top: 1px solid var(--line-soft);
  color: var(--muted); font-size: 13px;
}
footer .foot-in { display: grid; gap: 9px; }
footer .disc { line-height: 1.7; }
footer b { color: var(--text-dim); }

/* ---------- 音游练习 ---------- */
.card.rhythm { padding: 18px 20px 20px; }

.rhythm-bar {
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
  padding-bottom: 14px; border-bottom: 1px solid var(--line-soft);
}
.rb-field {
  display: flex; align-items: center; gap: 8px;
  font-size: 13px; color: var(--muted); white-space: nowrap;
}
.rb-field select {
  font-family: inherit; font-size: 13.5px; color: var(--text);
  background: var(--bg-soft); border: 1px solid var(--line);
  border-radius: 8px; padding: 6px 9px; cursor: pointer; max-width: 200px;
}
.rb-field input[type="range"] { width: 96px; accent-color: var(--accent); }
.rb-field b { color: var(--accent); font-family: var(--mono); min-width: 46px; }
.rhythm-status { font-size: 13px; color: var(--muted); margin-left: auto; }
.rhythm-status.live { color: var(--accent); }
.rhythm-status.done { color: var(--ok); font-weight: 600; }

.rhythm-hud {
  display: grid; grid-template-columns: repeat(4, 1fr);
  gap: 1px; background: var(--line-soft); border: 1px solid var(--line-soft);
  border-radius: 10px; overflow: hidden; margin: 14px 0;
}
.rhythm-hud .rh { background: var(--bg-soft); padding: 9px 13px; }
.rhythm-hud .k { font-size: 11.5px; color: var(--muted); display: block; letter-spacing: 0.3px; }
.rhythm-hud b {
  font-size: 17px; font-weight: 700; color: var(--text);
  font-family: var(--mono); display: block; line-height: 1.35;
}

.rhythm-stage {
  position: relative; width: 100%; border-radius: 12px;
  overflow: hidden; border: 1px solid var(--line); background: var(--bg-soft);
}
.rhythm-stage canvas { display: block; width: 100%; }

.rhythm-pads { display: flex; gap: 8px; margin-top: 12px; align-items: stretch; }
.rhythm-keys { display: flex; gap: 6px; flex: 1; min-width: 0; }

.rhythm-key {
  flex: 1; min-width: 0; cursor: pointer; font-family: inherit;
  background: var(--panel-2); border: 1px solid var(--line);
  border-radius: 10px; padding: 11px 2px 9px; text-align: center;
  transition: transform 0.07s, background 0.1s, border-color 0.1s;
  touch-action: none; user-select: none; -webkit-user-select: none;
}
.rhythm-key:hover { border-color: var(--accent-line); }
.rhythm-key.on, .rhythm-key:active {
  background: var(--accent-soft); border-color: var(--accent); transform: translateY(2px);
}
.rhythm-key .rk {
  display: block; font-family: var(--mono); font-size: 16px;
  font-weight: 700; color: var(--accent); line-height: 1.25;
}
.rhythm-key .rn { display: block; font-size: 11px; color: var(--muted); }
.rhythm-shift { flex: 0 0 78px; }
.rhythm-shift .rk { font-size: 13px; }
.rhythm-shift.on {
  background: rgba(79, 169, 138, 0.16); border-color: var(--green);
}
.rhythm-shift.on .rk { color: var(--green); }

.rhythm-counts {
  display: flex; gap: 16px; flex-wrap: wrap;
  margin-top: 13px; font-size: 12.5px; color: var(--muted);
}
.rhythm-counts b { font-family: var(--mono); color: var(--text); }
.rhythm-counts .perfect b { color: var(--accent); }
.rhythm-counts .great b { color: var(--green); }
.rhythm-counts .good b { color: #7aa2d6; }
.rhythm-counts .miss b { color: var(--bad); }

@media (max-width: 620px) {
  .rhythm-bar { gap: 10px; }
  .rhythm-status { margin-left: 0; width: 100%; }
  .rhythm-hud { grid-template-columns: 1fr 1fr; }
  .rhythm-pads { flex-direction: column; }
  .rhythm-shift { flex: 0 0 auto; padding: 8px 2px; }
  .rhythm-key { padding: 9px 2px 7px; }
  .rhythm-key .rk { font-size: 14px; }
  .rb-field select { max-width: 150px; }
}

/* ---------- 导航登录区 ---------- */
.nav-auth { display: flex; align-items: center; gap: 8px; margin-left: 10px; }
.nav-who {
  font-size: 13px; color: var(--text-dim); max-width: 130px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  text-decoration: none;
}
a.nav-who:hover { color: var(--accent); text-decoration: underline; }

/* ---------- 加载中 ---------- */
.loading { padding: 44px 0; text-align: center; color: var(--muted); font-size: 14px; }

/* ---------- 未解锁引导 ---------- */
.lock-card {
  background: linear-gradient(180deg, rgba(224, 164, 88, 0.09), rgba(224, 164, 88, 0.02));
  border: 1px dashed var(--accent-line);
  border-radius: var(--radius);
  padding: 32px 24px; text-align: center;
}
.lock-card .lock-ico { font-size: 30px; margin-bottom: 12px; }
.lock-card h3 { margin: 0 0 10px; font-size: 18px; font-weight: 680; }
.lock-card p {
  margin: 0 auto 20px; color: var(--text-dim);
  max-width: 440px; font-size: 14px;
}

/* ---------- 登录 / 注册表单 ---------- */
.auth-card .ico { margin-bottom: 14px; }
.auth-note { font-size: 13px; color: var(--muted); margin: 0 0 16px; line-height: 1.75; }
.auth-note code {
  font-family: var(--mono); background: var(--bg-soft); padding: 1px 6px;
  border-radius: 5px; color: var(--accent); border: 1px solid var(--line); font-size: 12px;
}
.field { display: block; margin-bottom: 14px; }
.field > span { display: block; font-size: 13px; color: var(--text-dim); margin-bottom: 6px; }
.field > small { display: block; font-size: 11.5px; color: var(--muted); margin-top: 5px; }
.field input {
  width: 100%; font-family: inherit; font-size: 14px;
  background: var(--bg-soft); border: 1px solid var(--line);
  border-radius: 9px; padding: 10px 12px; color: var(--text);
  transition: border-color 0.15s, background 0.15s;
}
.field input:focus {
  outline: none; border-color: var(--accent); background: var(--panel-2);
}
.auth-submit { width: 100%; justify-content: center; }
.auth-msg { margin-top: 12px; font-size: 13px; min-height: 18px; }
.auth-msg.err { color: var(--bad); }
.auth-msg.ok { color: var(--ok); }

/* ---------- 响应式 ---------- */
@media (max-width: 860px) {
  .grid-3 { grid-template-columns: 1fr 1fr; }
  .stats { grid-template-columns: 1fr 1fr; }
  .hero h1 { font-size: 32px; }
}
@media (max-width: 620px) {
  .grid-3, .grid-2 { grid-template-columns: 1fr; }
  .hero { padding: 40px 0 30px; }
  .hero h1 { font-size: 27px; }
  .nav-in { gap: 12px; height: auto; padding: 10px 20px; flex-wrap: wrap; }
  .nav-links { margin-left: 0; width: 100%; overflow-x: auto; }
  .nav-links a { white-space: nowrap; }
  .note { min-width: 46px; }
  .progress { margin-left: 0; width: 100%; }
}
