@import url('https://fonts.googleapis.com/css2?family=Bungee&family=Inter:wght@400;600;750;800&display=swap');

:root {
  color-scheme: dark;
  font-family: Inter, "PingFang SC", "Microsoft YaHei", system-ui, -apple-system, sans-serif;
  background: #0a0b0d;
  color: #f7f1e8;
  --panel: rgba(16, 18, 22, 0.95);
  --panel-strong: #1c2028;
  --line: rgba(255, 255, 255, 0.10);
  --line-strong: rgba(255, 255, 255, 0.18);
  --text-soft: #8a919a;
  --red: #d84b43;
  --amber: #f3b953;
  --mint: #3eb99b;
  --ink: #0c0d10;
  --accent-rgb: 216, 75, 67;
  --accent-glow: rgba(216, 75, 67, 0.3);
  --accent-glow-strong: rgba(216, 75, 67, 0.25);
  --accent-gradient-start: rgba(216, 75, 67, 0.28);
  --accent-gradient-end: rgba(127, 23, 24, 0.85);
  --accent-solid: #631818;
  --accent-text: #fff4ee;
  --accent-shadow: rgba(127, 23, 24, 0.35);
  --accent-light: #ffd8d3;
  --bg-gradient-1: #0a0b0d;
  --bg-gradient-2: #141012;
  --bg-gradient-3: #101816;
  --game-font: 'Bungee', 'PingFang SC', sans-serif;
  --radius: 12px;
  --radius-sm: 8px;
}

/* ── 配色方案 ── */
[data-theme="blue"] {
  --red: #4a9eff;
  --accent-rgb: 74, 158, 255;
  --accent-glow: rgba(74, 158, 255, 0.3);
  --accent-glow-strong: rgba(74, 158, 255, 0.25);
  --accent-gradient-start: rgba(74, 158, 255, 0.28);
  --accent-gradient-end: rgba(23, 60, 127, 0.85);
  --accent-solid: #183363;
  --accent-text: #eef4ff;
  --accent-shadow: rgba(23, 60, 127, 0.35);
  --accent-light: #d3e5ff;
  --bg-gradient-1: #0a0b0d;
  --bg-gradient-2: #0e1118;
  --bg-gradient-3: #0c1218;
}

[data-theme="green"] {
  --red: #5ecf70;
  --accent-rgb: 94, 207, 112;
  --accent-glow: rgba(94, 207, 112, 0.3);
  --accent-glow-strong: rgba(94, 207, 112, 0.25);
  --accent-gradient-start: rgba(94, 207, 112, 0.28);
  --accent-gradient-end: rgba(30, 100, 40, 0.85);
  --accent-solid: #1a4a22;
  --accent-text: #eefff0;
  --accent-shadow: rgba(30, 100, 40, 0.35);
  --accent-light: #d3ffd8;
  --bg-gradient-1: #0a0b0d;
  --bg-gradient-2: #0e140e;
  --bg-gradient-3: #0c180e;
}

[data-theme="purple"] {
  --red: #b084ff;
  --accent-rgb: 176, 132, 255;
  --accent-glow: rgba(176, 132, 255, 0.3);
  --accent-glow-strong: rgba(176, 132, 255, 0.25);
  --accent-gradient-start: rgba(176, 132, 255, 0.28);
  --accent-gradient-end: rgba(80, 40, 127, 0.85);
  --accent-solid: #3d1a63;
  --accent-text: #f4eeff;
  --accent-shadow: rgba(80, 40, 127, 0.35);
  --accent-light: #e8d3ff;
  --bg-gradient-1: #0a0b0d;
  --bg-gradient-2: #120e16;
  --bg-gradient-3: #100e16;
}

[data-theme="orange"] {
  --red: #ff9f43;
  --accent-rgb: 255, 159, 67;
  --accent-glow: rgba(255, 159, 67, 0.3);
  --accent-glow-strong: rgba(255, 159, 67, 0.25);
  --accent-gradient-start: rgba(255, 159, 67, 0.28);
  --accent-gradient-end: rgba(127, 70, 23, 0.85);
  --accent-solid: #633a18;
  --accent-text: #fff8ee;
  --accent-shadow: rgba(127, 70, 23, 0.35);
  --accent-light: #ffe8d3;
  --bg-gradient-1: #0a0b0d;
  --bg-gradient-2: #141008;
  --bg-gradient-3: #141008;
}

* { box-sizing: border-box; }

html, body {
  width: 100%;
  min-height: 100%;
  margin: 0;
}

body {
  overflow: hidden;
  background:
    radial-gradient(circle at 15% 15%, var(--accent-glow), transparent 26rem),
    linear-gradient(135deg, var(--bg-gradient-1) 0%, var(--bg-gradient-2) 42%, var(--bg-gradient-3) 100%);
}

button {
  border: 0;
  border-radius: var(--radius-sm);
  font: inherit;
  color: inherit;
  cursor: pointer;
}

button:disabled {
  cursor: wait;
  opacity: 0.4;
}

/* ── 动画 ── */
@keyframes bounce-in {
  0% { transform: scale(0.92); }
  50% { transform: scale(1.06); }
  100% { transform: scale(1); }
}

@keyframes pulse-glow {
  0%, 100% { box-shadow: 0 0 8px rgba(var(--accent-rgb), 0.3); }
  50% { box-shadow: 0 0 20px rgba(var(--accent-rgb), 0.6); }
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-4px); }
  40% { transform: translateX(4px); }
  60% { transform: translateX(-3px); }
  80% { transform: translateX(2px); }
}

@keyframes flash-green {
  0% { box-shadow: inset 0 0 0 2px rgba(62, 185, 155, 0.8), 0 0 20px rgba(62, 185, 155, 0.4); }
  100% { box-shadow: inset 0 0 0 1px var(--line-strong), none; }
}

@keyframes flash-red {
  0% { box-shadow: inset 0 0 0 2px rgba(216, 75, 67, 0.8), 0 0 20px rgba(216, 75, 67, 0.4); }
  100% { box-shadow: inset 0 0 0 1px var(--line-strong), none; }
}

@keyframes digit-pop {
  0% { transform: scale(0.5) translateY(10px); opacity: 0; }
  60% { transform: scale(1.15) translateY(-4px); opacity: 1; }
  100% { transform: scale(1) translateY(0); opacity: 1; }
}

@keyframes confetti-fall {
  0% { transform: translateY(-20px) rotate(0deg); opacity: 1; }
  100% { transform: translateY(100px) rotate(720deg); opacity: 0; }
}

@keyframes float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-3px); }
}

.shake { animation: shake 0.4s ease-in-out; }
.flash-success { animation: flash-green 0.6s ease-out; }
.flash-fail { animation: flash-red 0.6s ease-out; }

/* ── 主布局 ── */
.app-shell {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 400px;
  width: 100vw;
  height: 100vh;
}

.stage {
  position: relative;
  min-width: 0;
  overflow: hidden;
  height: 100%;
}

#scene {
  display: block;
  width: 100%;
  height: 100%;
}

/* ── 场景覆盖层 ── */
.marquee {
  position: absolute;
  left: clamp(18px, 3vw, 42px);
  top: clamp(18px, 3vw, 36px);
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 18px;
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: var(--radius);
  background: rgba(10, 12, 14, 0.72);
  backdrop-filter: blur(18px);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.4);
}

.marquee span {
  font-family: var(--game-font);
  font-size: 14px;
  letter-spacing: 1px;
  color: var(--amber);
}

.marquee strong {
  font-family: var(--game-font);
  font-size: 16px;
  color: #fffaf0;
}

/* ── 控制面板 ── */
.control-panel {
  display: flex;
  flex-direction: column;
  gap: 14px;
  height: 100%;
  padding: 22px;
  border-left: 1px solid var(--line);
  background: var(--panel);
  box-shadow: -20px 0 60px rgba(0, 0, 0, 0.4);
  overflow: auto;
}

header h1,
.notebook h2 {
  margin: 4px 0 0;
  letter-spacing: 0;
}

header h1 {
  font-family: var(--game-font);
  max-width: 10em;
  font-size: clamp(20px, 2.2vw, 30px);
  line-height: 1.12;
  background: linear-gradient(135deg, #fff 0%, var(--accent-light) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.header-actions {
  display: flex;
  margin-top: 14px;
}

.header-actions button,
.message-head button {
  min-height: 46px;
  padding: 0 20px;
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: var(--radius-sm);
  background:
    linear-gradient(180deg, var(--accent-gradient-start), var(--accent-gradient-end)),
    var(--accent-solid);
  color: var(--accent-text);
  font-family: var(--game-font);
  font-size: 13px;
  letter-spacing: 0.5px;
  box-shadow: 0 8px 24px var(--accent-shadow);
  transition: transform 0.15s, box-shadow 0.15s;
}

.header-actions button:hover:not(:disabled),
.message-head button:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 12px 32px var(--accent-shadow);
}

.header-actions button:active:not(:disabled),
.message-head button:active:not(:disabled) {
  transform: translateY(0) scale(0.97);
}

.header-actions button {
  min-width: 150px;
}

.notebook h2 {
  font-size: 18px;
}

.eyebrow {
  margin: 0;
  font-family: var(--game-font);
  font-size: 11px;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--amber);
}

/* ── 步骤进度条 ── */
.meter-row {
  display: flex;
  align-items: center;
  gap: 0;
  padding: 14px 16px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.03);
}

.meter-row .step {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  flex: 1;
  position: relative;
}

.meter-row .step-dot {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 2px solid var(--line-strong);
  background: rgba(0, 0, 0, 0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--game-font);
  font-size: 12px;
  color: var(--text-soft);
  transition: all 0.3s;
}

.meter-row .step-dot.active {
  border-color: var(--red);
  background: rgba(var(--accent-rgb), 0.2);
  color: var(--accent-light);
  animation: pulse-glow 1.5s ease-in-out infinite;
}

.meter-row .step-dot.done {
  border-color: var(--mint);
  background: rgba(62, 185, 155, 0.2);
  color: var(--mint);
}

.meter-row .step-label {
  font-size: 11px;
  color: var(--text-soft);
  font-weight: 600;
}

.meter-row .step-connector {
  flex: 0 0 24px;
  height: 2px;
  background: var(--line-strong);
  margin-bottom: 18px;
}

.meter-row .step-connector.done {
  background: var(--mint);
}

/* 大号数字展示 */
.caught-display {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 0;
}

.caught-digit {
  width: 48px;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: rgba(0, 0, 0, 0.3);
  font-family: var(--game-font);
  font-size: 28px;
  color: var(--text-soft);
  transition: all 0.3s;
}

.caught-digit.filled {
  border-color: var(--mint);
  background: rgba(62, 185, 155, 0.15);
  color: var(--mint);
  animation: digit-pop 0.5s ease-out;
}

/* ── 配色选择器 ── */
.theme-picker {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.03);
}

.theme-picker.theme-locked {
  justify-content: flex-end;
}

.theme-picker.theme-locked .theme-label,
.theme-picker.theme-locked .theme-swatches {
  display: none;
}

.token-display {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 6px 4px 10px;
  border-radius: 20px;
  background: rgba(243, 185, 83, 0.15);
  border: 1px solid rgba(243, 185, 83, 0.3);
}

.token-icon {
  font-size: 14px;
}

.token-value {
  font-family: var(--game-font);
  font-size: 14px;
  color: var(--amber);
  font-weight: 800;
}

.token-adjust-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  padding: 0;
  border: 1px solid rgba(243, 185, 83, 0.45);
  border-radius: 50%;
  background: rgba(243, 185, 83, 0.18);
  color: #ffe5a6;
  font-family: var(--game-font);
  font-size: 13px;
  line-height: 1;
}

.token-adjust-btn:hover:not(:disabled) {
  background: rgba(243, 185, 83, 0.28);
  transform: scale(1.06);
}

/* ── 奖项列表 ── */
.award-table {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: rgba(0, 0, 0, 0.15);
}

.award-row {
  display: grid;
  grid-template-columns: 26px 1fr auto auto;
  align-items: center;
  gap: 6px;
  padding: 5px 8px;
  border-radius: 6px;
  font-size: 12px;
  transition: background 0.2s;
}

.award-row.highlight {
  background: var(--highlight-bg, rgba(255, 215, 0, 0.1));
  border: 1px solid var(--highlight-border, rgba(255, 215, 0, 0.3));
  box-shadow: 0 0 12px var(--highlight-glow, rgba(255, 215, 0, 0.15));
}

.award-icon {
  font-size: 16px;
  text-align: center;
}

.award-name {
  font-weight: 700;
  color: #e8e0d5;
  white-space: nowrap;
}

.award-guess {
  font-family: var(--game-font);
  color: var(--text-soft);
  font-size: 11px;
  letter-spacing: 0.3px;
}

.award-tokens {
  font-family: var(--game-font);
  color: var(--amber);
  font-size: 11px;
  letter-spacing: 0.3px;
  text-align: right;
}

/* ── 猜测次数限制条 ── */
.guess-limit-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: rgba(0, 0, 0, 0.15);
  font-size: 13px;
}

.guess-limit-info {
  font-weight: 600;
  color: var(--text-soft);
}

.guess-limit-info strong {
  color: #fff6e0;
  font-family: var(--game-font);
  font-size: 15px;
}

.guess-limit-bar.limit-reached .guess-limit-info strong {
  color: var(--red);
}

.use-token-btn {
  margin-left: auto;
  padding: 6px 14px;
  border: 1px solid rgba(243, 185, 83, 0.4) !important;
  border-radius: 20px !important;
  background: rgba(243, 185, 83, 0.15) !important;
  color: var(--amber) !important;
  font-family: var(--game-font);
  font-size: 11px;
  letter-spacing: 0.3px;
  white-space: nowrap;
  transition: transform 0.12s, background 0.15s;
  animation: pulse-glow 1.5s ease-in-out infinite;
}

.use-token-btn:hover {
  transform: scale(1.05);
  background: rgba(243, 185, 83, 0.25) !important;
}

.guess-limit-msg {
  font-family: var(--game-font);
  font-size: 12px;
  color: var(--red);
  letter-spacing: 0.5px;
  animation: shake 0.4s ease-in-out;
}

.theme-label {
  font-family: var(--game-font);
  font-size: 11px;
  letter-spacing: 1px;
  color: var(--text-soft);
  white-space: nowrap;
}

.theme-swatches {
  display: flex;
  gap: 8px;
}

.swatch {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 2.5px solid transparent;
  cursor: pointer;
  transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.2s;
  padding: 0;
}

.swatch:hover {
  transform: scale(1.2);
}

.swatch.active {
  border-color: #fff;
  box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.25), 0 0 12px rgba(var(--accent-rgb), 0.4);
  transform: scale(1.15);
}

/* ── 骰子数字按钮 ── */
.digit-pad {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  flex-shrink: 0;
}

.digit-pad button {
  position: relative;
  aspect-ratio: 1.2 / 1;
  border: 2px solid rgba(255, 255, 255, 0.12);
  border-radius: var(--radius);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.14) 0%, rgba(255, 255, 255, 0.02) 100%),
    #22262b;
  box-shadow:
    0 6px 0 #121518,
    0 8px 20px rgba(0, 0, 0, 0.35),
    inset 0 1px 0 rgba(255, 255, 255, 0.15);
  font-family: var(--game-font);
  font-size: clamp(28px, 4vw, 42px);
  color: #fff;
  transition: transform 0.12s, box-shadow 0.12s, border-color 0.2s;
}

.digit-pad button:hover:not(:disabled) {
  transform: translateY(-3px);
  box-shadow:
    0 9px 0 #121518,
    0 12px 28px rgba(0, 0, 0, 0.4),
    inset 0 1px 0 rgba(255, 255, 255, 0.2);
  border-color: rgba(var(--accent-rgb), 0.5);
}

.digit-pad button:active:not(:disabled) {
  transform: translateY(2px);
  box-shadow:
    0 2px 0 #121518,
    0 4px 12px rgba(0, 0, 0, 0.3),
    inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

.digit-pad button:focus-visible {
  outline: 2px solid rgba(var(--accent-rgb), 0.8);
  outline-offset: 2px;
}

/* ── 消息条 ── */
.message-strip {
  min-height: 88px;
  padding: 16px 18px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: linear-gradient(135deg, rgba(var(--accent-rgb), 0.12) 0%, rgba(0, 0, 0, 0.15) 100%);
  transition: border-color 0.3s, box-shadow 0.3s;
  flex-shrink: 0;
}

.message-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 6px;
}

.message-strip strong {
  font-family: var(--game-font);
  font-size: 15px;
  color: #fff0dc;
}

.message-head button {
  min-height: 38px;
  padding: 0 14px;
  font-size: 12px;
  box-shadow: 0 6px 16px var(--accent-shadow);
}

.message-strip p {
  margin: 0;
  color: #c8cdc5;
  line-height: 1.5;
  font-size: 14px;
}

/* ── 记录本 ── */
.notebook {
  min-height: 220px;
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  gap: 8px;
  padding: 12px;
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: var(--radius);
  background:
    linear-gradient(90deg, rgba(14, 16, 18, 0.7), rgba(14, 16, 18, 0.4)),
    repeating-linear-gradient(#1e2227 0 36px, #252a30 37px 38px);
  overflow: auto;
}

.notebook > * { flex-shrink: 0; }
.notebook > .record-details { flex-shrink: 1; }

.notebook-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  flex-shrink: 0;
}

.quiet {
  flex: 0 0 auto;
  padding: 8px 10px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.05);
  color: #fce5b6;
  font-size: 13px;
}

.record-slot {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 12px;
  width: 100%;
  flex-shrink: 0;
  min-height: 72px;
  padding: 16px;
  border: 1px dashed rgba(var(--accent-rgb), 0.4);
  border-radius: var(--radius-sm);
  background:
    linear-gradient(180deg, rgba(var(--accent-rgb), 0.15), rgba(0, 0, 0, 0.1)),
    rgba(0, 0, 0, 0.18);
  text-align: left;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.record-slot:hover,
.record-slot:focus-visible {
  outline: 2px solid rgba(var(--accent-rgb), 0.6);
  outline-offset: 2px;
  border-color: rgba(var(--accent-rgb), 0.6);
}

.record-slot span {
  color: var(--text-soft);
  font-size: 13px;
}

.record-slot strong {
  font-family: var(--game-font);
  color: #fff4ee;
  font-size: 18px;
}

.record-slot small {
  grid-column: 1 / -1;
  color: var(--accent-light);
  font-size: 13px;
  line-height: 1.4;
}

.token-display[hidden] {
  display: none;
}

.record-details[hidden] { display: none; }

.record-details {
  display: flex;
  flex-direction: column;
  gap: 12px;
  overflow: auto;
  flex: 1 1 auto;
  min-height: 0;
}

.record-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-sm);
  background: rgba(0, 0, 0, 0.18);
}

.record-actions p {
  margin: 0;
  color: var(--text-soft);
  font-size: 13px;
  line-height: 1.4;
}

.record-actions button {
  min-height: 38px;
  padding: 0 14px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-sm);
  background:
    linear-gradient(180deg, rgba(var(--accent-rgb), 0.2), var(--accent-gradient-end)),
    var(--accent-solid);
  color: var(--accent-text);
  font-family: var(--game-font);
  font-size: 12px;
  letter-spacing: 0.3px;
  white-space: nowrap;
}

.facts {
  display: grid;
  grid-template-columns: 0.85fr 0.75fr;
  gap: 10px;
  margin: 0;
}

.facts div {
  min-width: 0;
  padding: 10px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-sm);
  background: rgba(0, 0, 0, 0.18);
}

.facts dt {
  display: block;
  color: var(--text-soft);
  font-size: 12px;
  white-space: nowrap;
}

.facts dd {
  margin: 3px 0 0;
  overflow-wrap: anywhere;
  color: #fff6e0;
  font-weight: 750;
}

.facts .wide { grid-column: 1 / -1; }

.record-table {
  width: 100%;
  border-collapse: collapse;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-sm);
  background: rgba(0, 0, 0, 0.14);
  color: #e5e8e5;
  font-size: 13px;
  table-layout: fixed;
}

.record-table th,
.record-table td {
  padding: 9px 8px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  text-align: left;
  overflow-wrap: anywhere;
}

.record-table th {
  color: var(--amber);
  font-family: var(--game-font);
  font-size: 11px;
  letter-spacing: 0.5px;
}

.record-table td { color: #f3f0e8; }

.open-record-page {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  min-height: 46px;
  padding: 10px 16px;
  border: 1px solid rgba(62, 185, 155, 0.3);
  border-radius: var(--radius-sm);
  background: rgba(62, 185, 155, 0.1);
  color: #7ef5d4;
  font-family: var(--game-font);
  font-size: 12px;
  letter-spacing: 0.5px;
  flex-shrink: 0;
  transition: background 0.2s, transform 0.15s;
}

.open-record-page:hover {
  background: rgba(62, 185, 155, 0.2);
  transform: translateY(-1px);
}

.record-table tr:last-child td { border-bottom: 0; }

/* ── 音量按钮 ── */
.mute-btn {
  position: absolute;
  right: clamp(18px, 3vw, 42px);
  top: clamp(18px, 3vw, 36px);
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.15);
  background: rgba(10, 12, 14, 0.72);
  backdrop-filter: blur(18px);
  color: #fff;
  font-size: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.15s, background 0.2s;
  z-index: 10;
}

.mute-btn:hover {
  transform: scale(1.1);
  background: rgba(10, 12, 14, 0.85);
}

/* ── 胜利覆盖层 ── */
.victory-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(12px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 20px;
  z-index: 1000;
  animation: bounce-in 0.4s ease-out;
}

.victory-password {
  font-family: var(--game-font);
  font-size: 72px;
  letter-spacing: 8px;
  color: var(--amber);
  text-shadow: 0 0 40px rgba(243, 185, 83, 0.5), 0 4px 12px rgba(0, 0, 0, 0.5);
  animation: digit-pop 0.6s ease-out;
}

.victory-label {
  font-family: var(--game-font);
  font-size: 16px;
  letter-spacing: 2px;
  color: var(--accent-light);
}

.victory-stats {
  display: flex;
  gap: 24px;
  margin-top: 8px;
}

.victory-stat {
  text-align: center;
}

.victory-stat .val {
  font-family: var(--game-font);
  font-size: 28px;
  color: #fff;
}

.victory-stat .lbl {
  font-size: 12px;
  color: var(--text-soft);
  margin-top: 4px;
}

.victory-rating {
  font-family: var(--game-font);
  font-size: 24px;
  letter-spacing: 2px;
  padding: 6px 20px;
  border-radius: 20px;
  border: 2px solid;
}

.victory-rating.perfect {
  color: #ffd700;
  border-color: rgba(255, 215, 0, 0.4);
  background: rgba(255, 215, 0, 0.1);
  text-shadow: 0 0 20px rgba(255, 215, 0, 0.4);
}

.victory-rating.good {
  color: var(--mint);
  border-color: rgba(62, 185, 155, 0.4);
  background: rgba(62, 185, 155, 0.1);
}

.victory-rating.try-again {
  color: var(--red);
  border-color: rgba(var(--accent-rgb), 0.4);
  background: rgba(var(--accent-rgb), 0.1);
}

.victory-award {
  font-family: var(--game-font);
  font-size: 32px;
  letter-spacing: 2px;
  padding: 8px 28px;
  border-radius: 24px;
  border: 2px solid;
  animation: digit-pop 0.6s ease-out 0.2s both;
}

.victory-award.gold {
  color: #ffd700;
  border-color: rgba(255, 215, 0, 0.5);
  background: rgba(255, 215, 0, 0.12);
  text-shadow: 0 0 30px rgba(255, 215, 0, 0.5);
}

.victory-award.silver {
  color: #e0e0e0;
  border-color: rgba(192, 192, 192, 0.4);
  background: rgba(192, 192, 192, 0.10);
}

.victory-award.bronze {
  color: #e8a060;
  border-color: rgba(205, 127, 50, 0.4);
  background: rgba(205, 127, 50, 0.10);
}

.victory-award.lime {
  color: #c8c8c8;
  border-color: rgba(184, 184, 184, 0.3);
  background: rgba(184, 184, 184, 0.08);
}

.victory-award.participation {
  color: var(--text-soft);
  border-color: rgba(138, 145, 154, 0.3);
  background: rgba(138, 145, 154, 0.06);
}

.victory-award.persistence {
  color: #ff9f43;
  border-color: rgba(255, 159, 67, 0.4);
  background: rgba(255, 159, 67, 0.10);
}

.victory-btn {
  margin-top: 12px;
  min-height: 50px;
  min-width: 180px;
  padding: 0 28px;
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: var(--radius-sm);
  background:
    linear-gradient(180deg, var(--accent-gradient-start), var(--accent-gradient-end)),
    var(--accent-solid);
  color: var(--accent-text);
  font-family: var(--game-font);
  font-size: 14px;
  letter-spacing: 1px;
  box-shadow: 0 10px 30px var(--accent-shadow);
  transition: transform 0.15s;
}

.victory-btn:hover {
  transform: translateY(-2px) scale(1.03);
}

/* ── 响应式 ── */
@media (max-width: 900px) {
  body { overflow: auto; }

  .app-shell {
    grid-template-columns: 1fr;
    grid-template-rows: minmax(400px, 50vh) auto;
    min-height: 100vh;
    height: auto;
  }

  .control-panel {
    height: auto;
    min-height: 0;
    border-left: 0;
    border-top: 1px solid var(--line);
    gap: 10px;
    padding: 16px;
  }

  .theme-picker { padding: 6px 10px; gap: 8px; }
  .digit-pad { gap: 8px; }
  .digit-pad button {
    aspect-ratio: 1.05 / 1;
    font-size: clamp(24px, 7vw, 34px);
  }
  .guess-limit-bar,
  .message-strip,
  .notebook,
  .award-table,
  .meter-row {
    padding-left: 12px;
    padding-right: 12px;
  }
  .record-slot {
    min-height: 60px;
    padding: 12px;
  }
}

@media (max-width: 520px) {
  .control-panel {
    gap: 8px;
    padding: 14px;
  }

  header h1 {
    font-size: 32px;
    line-height: 1.02;
    max-width: none;
  }

  .header-actions button {
    min-width: 0;
    width: 100%;
  }

  .caught-display { padding: 4px 0 2px; }
  .caught-digit {
    width: 42px;
    height: 50px;
    font-size: 24px;
  }

  .theme-picker {
    flex-wrap: wrap;
    row-gap: 6px;
  }

  .theme-swatches { gap: 6px; }
  .swatch {
    width: 22px;
    height: 22px;
  }

  .token-display {
    margin-left: 0;
    margin-right: 0;
    margin-top: 2px;
    width: 100%;
    justify-content: flex-end;
  }

  .award-row {
    grid-template-columns: 22px 1fr auto;
    gap: 4px;
    padding: 4px 6px;
    font-size: 11px;
  }

  .award-tokens { grid-column: 2 / -1; }

  .digit-pad {
    gap: 8px;
  }

  .digit-pad button {
    border-radius: 10px;
    font-size: 30px;
  }

  .guess-limit-bar {
    gap: 8px;
    padding: 8px 10px;
    font-size: 12px;
  }

  .message-strip {
    min-height: 0;
    padding: 12px 14px;
  }

  .message-head {
    align-items: flex-start;
    flex-direction: column;
  }

  .meter-row { flex-wrap: wrap; gap: 8px; }
  .meter-row .step { flex: 0 0 auto; }
  .meter-row .step-connector { flex: 1 1 16px; }

  .facts { grid-template-columns: 1fr; }
  .facts div { padding: 8px 10px; }
  .facts dd { font-size: 13px; }

  .record-actions {
    align-items: flex-start;
    flex-direction: column;
  }

  .record-table th,
  .record-table td {
    padding: 8px 6px;
    font-size: 12px;
  }

  .open-record-page {
    min-height: 40px;
    padding: 8px 12px;
  }

  .victory-password { font-size: 48px; }
  .victory-stats { gap: 16px; }
  .victory-stat .val { font-size: 22px; }
}
