/* ==========================================================================
   Keep Talking and Nobody Explodes 工业风视觉重制
   金属炸弹外壳 / LED 数码倒计时 / 螺丝铆钉 / 斑马警示条 / 泛黄手册
   全部效果由 CSS 实现，不依赖 JS 结构改动
   ========================================================================== */

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

/* 确保 hidden 属性始终生效（防止 display 规则覆盖） */
[hidden] {
  display: none !important;
}

:root {
  --bg: #0f1014;
  --metal: #26282e;
  --metal-light: #3b3e46;
  --metal-dark: #17181d;
  --steel: #4a4d55;
  --line: #34373f;
  --orange: #ff7a00;
  --orange-deep: #c25e00;
  --yellow: #ffcc00;
  --red: #ff3b30;
  --red-deep: #b3121b;
  --green: #3cff6a;
  --blue: #3b7bd6;
  --text: #e8e8e8;
  --text-dim: #9a9da5;
  --paper: #e9dbb0;
  --ink: #3a2f1e;
  --shadow-lg: 0 18px 40px rgba(0, 0, 0, 0.55);

  /* 四角螺丝：4 个径向渐变，叠加在面板底色之上 */
  --screws:
    radial-gradient(circle 3.5px at 14px 14px, #5a5e67 0 38%, #23252b 62% 100%),
    radial-gradient(circle 3.5px at calc(100% - 14px) 14px, #5a5e67 0 38%, #23252b 62% 100%),
    radial-gradient(circle 3.5px at 14px calc(100% - 14px), #5a5e67 0 38%, #23252b 62% 100%),
    radial-gradient(circle 3.5px at calc(100% - 14px) calc(100% - 14px), #5a5e67 0 38%, #23252b 62% 100%);

  /* 胶片颗粒噪点 */
  --noise: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='140' height='140' filter='url(%23n)' opacity='0.5'/%3E%3C/svg%3E");

  --font-digi: 'Share Tech Mono', 'Courier New', Menlo, monospace;
  --font-display: 'Russo One', 'PingFang SC', 'Microsoft YaHei', sans-serif;
}

html, body {
  height: 100%;
}

body {
  color: var(--text);
  font-family: "PingFang SC", "Microsoft YaHei", sans-serif;
  user-select: none;
  touch-action: manipulation;
  background:
    radial-gradient(120% 90% at 50% -10%, rgba(255, 180, 80, 0.07), transparent 55%),
    radial-gradient(150% 110% at 50% 115%, rgba(0, 0, 0, 0.55), transparent 60%),
    linear-gradient(180deg, #181a21 0%, #101116 55%, #0a0b0e 100%);
}

/* 全局噪点颗粒层 */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 999;
  pointer-events: none;
  background-image: var(--noise);
  opacity: 0.06;
  mix-blend-mode: overlay;
}

#app {
  max-width: 480px;
  margin: 0 auto;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ========== 头部：警示牌风格 ========== */
.app-header {
  position: relative;
  text-align: center;
  padding: 22px 12px 16px;
}

.app-header h1 {
  font-family: var(--font-display);
  font-size: 32px;
  letter-spacing: 3px;
  color: #fff;
  text-shadow:
    0 0 10px rgba(255, 59, 48, 0.55),
    0 0 26px rgba(255, 59, 48, 0.25),
    0 2px 0 #000;
}

.tagline {
  color: var(--text-dim);
  font-size: 12px;
  margin-top: 6px;
  letter-spacing: 1px;
}

/* 黄黑斑马警示条 */
.app-header::after {
  content: "";
  display: block;
  width: min(92%, 380px);
  height: 9px;
  margin: 12px auto 0;
  border-radius: 2px;
  background: repeating-linear-gradient(-45deg, var(--yellow) 0 12px, #141414 12px 24px);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.6), inset 0 1px 0 rgba(255, 255, 255, 0.35);
}

/* ========== 大厅 ========== */
.lobby {
  flex: 1;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 24px 16px;
}

.lobby-card {
  position: relative;
  width: 100%;
  background-image: var(--screws), linear-gradient(180deg, #2c2f36, #1d1f25 70%, #17181d);
  border: 1px solid #0c0d10;
  border-radius: 18px;
  padding: 26px 20px;
  text-align: center;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.07), var(--shadow-lg);
}

.lobby-card h2 {
  font-family: var(--font-display);
  font-size: 20px;
  letter-spacing: 2px;
  color: #fff;
  text-shadow: 0 1px 0 #000;
  margin-bottom: 10px;
}

.lobby-tip {
  color: var(--text-dim);
  font-size: 13px;
  line-height: 1.7;
  margin-bottom: 22px;
}

.lobby-actions {
  display: flex;
  gap: 12px;
  justify-content: center;
}

.panel {
  margin-top: 18px;
}

.code-input {
  width: 100%;
  height: 52px;
  text-align: center;
  font-family: var(--font-digi);
  font-size: 28px;
  letter-spacing: 14px;
  background: #0b0c0f;
  color: var(--yellow);
  border: 2px solid #0c0d10;
  border-radius: 10px;
  outline: none;
  margin-bottom: 12px;
  box-shadow: inset 0 2px 8px rgba(0, 0, 0, 0.8);
  text-shadow: 0 0 8px rgba(255, 204, 0, 0.45);
}

.code-input:focus {
  border-color: var(--orange);
  box-shadow: inset 0 2px 8px rgba(0, 0, 0, 0.8), 0 0 0 3px rgba(255, 122, 0, 0.18);
}

.waiting-label {
  color: var(--text-dim);
  font-family: var(--font-digi);
  font-size: 12px;
  letter-spacing: 2px;
  margin-bottom: 8px;
}

.code-big {
  font-family: var(--font-digi);
  font-size: 52px;
  font-weight: 700;
  letter-spacing: 18px;
  padding-left: 18px; /* 抵消末位间距，让文字视觉居中 */
  color: var(--orange);
  text-shadow: 0 0 14px rgba(255, 122, 0, 0.55);
  margin-bottom: 16px;
}

.waiting-hint {
  color: var(--text-dim);
  font-size: 13px;
  line-height: 1.6;
}

.error {
  margin-top: 14px;
  color: var(--red);
  font-size: 13px;
  padding: 10px;
  background: rgba(255, 59, 48, 0.12);
  border: 1px solid rgba(255, 59, 48, 0.4);
  border-radius: 8px;
}

/* 加载动画 */
.spinner {
  width: 28px;
  height: 28px;
  margin: 16px auto 0;
  border: 3px solid #3a3d45;
  border-top-color: var(--orange);
  border-radius: 50%;
  box-shadow: 0 0 10px rgba(255, 122, 0, 0.25);
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ========== 按钮：工业塑料键 ========== */
.btn {
  border: none;
  border-radius: 10px;
  padding: 14px 22px;
  font-size: 16px;
  font-weight: 700;
  font-family: var(--font-display);
  letter-spacing: 1px;
  cursor: pointer;
  min-width: 120px;
  position: relative;
  transition: transform 0.06s, box-shadow 0.06s, filter 0.15s;
}

.btn:active {
  transform: translateY(2px);
}

.btn-primary {
  background: linear-gradient(180deg, #ff9a3c, #ff7a00 55%, #d95e00);
  color: #fff;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.35);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.4),
    inset 0 -4px 8px rgba(0, 0, 0, 0.3),
    0 4px 12px rgba(255, 122, 0, 0.25);
}

.btn-primary:active {
  box-shadow: inset 0 3px 8px rgba(0, 0, 0, 0.4);
}

.btn-outline {
  background: linear-gradient(180deg, #2e3138, #1e2026);
  border: 1px solid #0c0d10;
  color: var(--text);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.1), 0 2px 6px rgba(0, 0, 0, 0.35);
}

.btn:disabled {
  opacity: 0.5;
}

/* ========== 破解者（炸弹本体） ========== */
.bomb {
  position: relative;
  flex: 1;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  background-image: var(--screws), linear-gradient(180deg, #33363e, #22242a 45%, #16171c);
  border: 2px solid #0b0c0f;
  border-radius: 20px;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.08),
    inset 0 3px 14px rgba(0, 0, 0, 0.55),
    0 16px 34px rgba(0, 0, 0, 0.5);
}

/* 顶盖散热栅 */
.bomb::before {
  content: "";
  height: 10px;
  border-radius: 4px;
  background: repeating-linear-gradient(90deg, #0c0d10 0 9px, #26282e 9px 14px);
  border: 1px solid #0c0d10;
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.8);
}

/* 红色提手（起爆器提环） */
.bomb::after {
  content: "";
  position: absolute;
  top: 4px;
  left: 50%;
  transform: translateX(-50%);
  width: 52px;
  height: 22px;
  border: 5px solid #b3121b;
  border-bottom: none;
  border-radius: 18px 18px 0 0;
  background: transparent;
  box-shadow: inset 0 4px 6px rgba(0, 0, 0, 0.5), 0 0 10px rgba(179, 18, 27, 0.4);
  z-index: 1;
}

/* ========== 金属铭牌信息条 ========== */
.bomb-features {
  background-image: var(--screws), linear-gradient(180deg, #43464e, #2e3138 55%, #22242a);
  border: 1px solid #0c0d10;
  border-radius: 9px;
  padding: 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
  font-family: var(--font-digi);
  font-size: 12px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.12), inset 0 -2px 5px rgba(0, 0, 0, 0.45);
}

.feature-item {
  display: flex;
  align-items: center;
  gap: 6px;
  color: #a9adb5;
}

.feature-item b {
  color: #fff;
  font-weight: 700;
}

/* 解谜者信息条：允许横向滚动 */
.solver-features {
  justify-content: flex-start;
  overflow-x: auto;
  white-space: nowrap;
}

/* 指示灯（LED 灯座） */
.led-dot {
  width: 17px;
  height: 17px;
  border-radius: 50%;
  display: inline-block;
  border: 2px solid rgba(0, 0, 0, 0.65);
  box-shadow:
    inset 0 -2px 2px rgba(0, 0, 0, 0.55),
    inset 0 2px 2px rgba(255, 255, 255, 0.3),
    0 0 9px currentColor;
}

.led-green { background: #2ecc71; color: #2ecc71; }
.led-red { background: #ff3b30; color: #ff3b30; }
.led-blue { background: #3b7bd6; color: #3b7bd6; }
.led-white { background: #eee; color: #eee; }
.led-yellow { background: #ffd500; color: #ffd500; }

/* 容错红灯（罚错指示灯） */
.mistakes {
  display: flex;
  gap: 5px;
}

.mistake-dot {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: radial-gradient(circle at 40% 35%, #45484f, #17181d 80%);
  border: 1px solid #000;
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.9);
}

.mistake-dot.lost {
  background: radial-gradient(circle at 40% 35%, #ff9a8a, #e0241f 55%, #7a0c08);
  box-shadow: 0 0 12px rgba(255, 59, 48, 0.9), inset 0 1px 1px rgba(255, 255, 255, 0.5);
  animation: led-pulse 1.2s ease infinite;
}

@keyframes led-pulse {
  0%, 100% { filter: brightness(1); }
  50% { filter: brightness(1.5); }
}

/* ========== 模块外壳（塑料面板 + 螺丝） ========== */
.module-panel {
  position: relative;
  flex: 1;
  background-image: var(--screws), linear-gradient(180deg, #34373f, #23252b 55%, #1a1c21);
  border: 2px solid #0b0c0f;
  border-radius: 16px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  box-shadow:
    inset 0 2px 10px rgba(0, 0, 0, 0.6),
    inset 0 1px 0 rgba(255, 255, 255, 0.07),
    0 10px 22px rgba(0, 0, 0, 0.4);
}

/* 顶部彩色饰条：KTANE 各模块用不同塑料颜色区分 */
.module-panel::before {
  content: "";
  position: absolute;
  top: 0;
  left: 14px;
  right: 14px;
  height: 5px;
  border-radius: 0 0 6px 6px;
  background: var(--module-accent, #8a8f99);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.45);
}

/* 彩色塑料面板内发光描边 */
.module-panel::after {
  content: "";
  position: absolute;
  inset: 3px;
  border-radius: 13px;
  border: 1px solid var(--module-glow, rgba(138, 143, 153, 0.3));
  pointer-events: none;
}

.module-panel[data-type="wires"] { --module-accent: #5b7d9e; --module-glow: rgba(91, 125, 158, 0.4); }
.module-panel[data-type="button"] { --module-accent: #ffc23c; --module-glow: rgba(255, 194, 60, 0.4); }
.module-panel[data-type="simon"] { --module-accent: #4a90e2; --module-glow: rgba(74, 144, 226, 0.4); }
.module-panel[data-type="memory"] { --module-accent: #d96a7a; --module-glow: rgba(217, 106, 122, 0.4); }
.module-panel[data-type="password"] { --module-accent: #9aa0a9; --module-glow: rgba(154, 160, 169, 0.35); }
.module-panel[data-type="keypads"] { --module-accent: #59a35f; --module-glow: rgba(89, 163, 95, 0.4); }

/* 模块标题：黄色工牌标签 */
.module-title {
  font-family: var(--font-display);
  font-size: 13px;
  letter-spacing: 2px;
  color: var(--yellow);
  text-shadow: 0 1px 0 #000;
  padding: 5px 14px;
  background: linear-gradient(180deg, #3a2f0c, #241d05);
  border: 1px solid #57430e;
  border-radius: 6px;
  box-shadow: inset 0 1px 0 rgba(255, 220, 120, 0.14);
}

/* ========== 剪线模块（KTANE 垂挂式） ========== */
.wire-grid {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
}

/* 顶部端子排：金属条，线缆从孔中垂下 */
.wire-rail {
  width: 100%;
  max-width: 330px;
  height: 14px;
  background:
    repeating-linear-gradient(90deg, rgba(0, 0, 0, 0.4) 0 3px, transparent 3px 8px),
    linear-gradient(180deg, #5a5e67, #2c2f36 60%, #1a1c21);
  border: 1px solid #0c0d10;
  border-radius: 4px 4px 2px 2px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.22), inset 0 -2px 3px rgba(0, 0, 0, 0.55);
}

.wire-rows {
  display: flex;
  justify-content: center;
  align-items: flex-start;
  gap: 6px;
  width: 100%;
  padding-top: 2px;
}

/* 单根线：整条可点击（线缆 + 压线夹 + 标签） */
.wire {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  flex: 0 1 56px;
  min-width: 44px;
  padding: 2px 4px 6px;
  cursor: pointer;
  border-radius: 8px;
  transition: background 0.1s, transform 0.06s;
}

.wire:hover {
  background: rgba(255, 255, 255, 0.05);
}

.wire:active {
  transform: translateY(2px);
}

/* 顶部插销：插入端子排 */
.wire::before {
  content: "";
  width: 12px;
  height: 8px;
  background: linear-gradient(180deg, #c9cdd4, #6a6e77);
  border-radius: 1px 1px 3px 3px;
  box-shadow: inset 0 -1px 2px rgba(0, 0, 0, 0.5);
}

/* 线缆本体：底色由 JS 内联提供，这里叠加圆柱高光 */
.wire-cable {
  position: relative;
  width: 11px;
  height: 92px;
  border-radius: 6px;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.35);
  transition: filter 0.15s, transform 0.25s;
}

.wire-cable::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 6px;
  background: linear-gradient(
    90deg,
    rgba(255, 255, 255, 0.55) 0%,
    rgba(255, 255, 255, 0) 28%,
    rgba(0, 0, 0, 0.08) 55%,
    rgba(0, 0, 0, 0.5) 100%
  );
  pointer-events: none;
}

/* 底部压线夹 */
.wire-cable::after {
  content: "";
  position: absolute;
  bottom: -7px;
  left: 50%;
  transform: translateX(-50%);
  width: 15px;
  height: 7px;
  background: linear-gradient(180deg, #9aa0a9, #4a4d55);
  border-radius: 1px 1px 3px 3px;
  box-shadow: inset 0 -1px 2px rgba(0, 0, 0, 0.6);
}

.wire-label {
  font-family: var(--font-digi);
  font-size: 11px;
  font-weight: 700;
  color: #c9ccd3;
  letter-spacing: 0.5px;
}

/* 已剪断：变灰、线缆下沉脱出、红色斜口 */
.wire.cut {
  cursor: default;
}

.wire.cut .wire-cable {
  filter: grayscale(1) brightness(0.5);
  transform: translateY(18px);
}

.wire.cut .wire-cable::before {
  background:
    linear-gradient(115deg, transparent 40%, rgba(255, 59, 48, 0.95) 40% 50%, transparent 50%),
    linear-gradient(90deg, rgba(255, 255, 255, 0.35), transparent 30%, rgba(0, 0, 0, 0.45) 100%);
}

.wire.cut .wire-label {
  opacity: 0.45;
  text-decoration: line-through;
}

/* ========== 按钮模块 ========== */
.button-led {
  margin-bottom: 2px;
}

/* 大按钮：塑料凸起 + 光泽 */
.big-button {
  position: relative;
  width: 210px;
  height: 92px;
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-size: 28px;
  font-weight: 700;
  letter-spacing: 4px;
  cursor: pointer;
  border: none;
  box-shadow:
    inset 0 3px 6px rgba(255, 255, 255, 0.45),
    inset 0 -8px 14px rgba(0, 0, 0, 0.55),
    inset 0 0 0 3px rgba(0, 0, 0, 0.3),
    0 8px 18px rgba(0, 0, 0, 0.5);
  user-select: none;
  touch-action: none;
  transition: transform 0.06s, box-shadow 0.06s;
}

.big-button::before {
  content: "";
  position: absolute;
  inset: 5px 9px;
  border-radius: 12px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.5), rgba(255, 255, 255, 0) 42%);
  pointer-events: none;
}

.big-button.pressed {
  transform: translateY(4px) scale(0.99);
  box-shadow:
    inset 0 4px 10px rgba(0, 0, 0, 0.7),
    inset 0 0 0 3px rgba(0, 0, 0, 0.3),
    0 2px 4px rgba(0, 0, 0, 0.5);
}

.big-button.pressed::before {
  opacity: 0.3;
}

.hold-timer {
  min-height: 22px;
  font-family: var(--font-digi);
  font-size: 14px;
  color: var(--green);
  text-align: center;
}

/* ========== 西蒙说 ========== */
.simon-hint {
  font-size: 12px;
  color: var(--text-dim);
  text-align: center;
  margin-bottom: 6px;
}

.simon-pad {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  width: 100%;
  max-width: 260px;
  padding: 14px;
  background: #0e0f13;
  border-radius: 14px;
  border: 1px solid #0c0d10;
  box-shadow: inset 0 2px 10px rgba(0, 0, 0, 0.7);
}

.simon-btn {
  position: relative;
  height: 86px;
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 700;
  color: #000;
  cursor: pointer;
  border: none;
  box-shadow:
    inset 0 3px 4px rgba(255, 255, 255, 0.5),
    inset 0 -6px 10px rgba(0, 0, 0, 0.5),
    0 5px 10px rgba(0, 0, 0, 0.5);
  transition: filter 0.1s;
  user-select: none;
}

.simon-btn::before {
  content: "";
  position: absolute;
  inset: 4px 7px;
  border-radius: 12px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.45), rgba(255, 255, 255, 0) 40%);
  pointer-events: none;
}

.simon-btn.lit {
  filter: brightness(1.4) saturate(1.35) drop-shadow(0 0 16px rgba(255, 255, 255, 0.85));
  transform: scale(1.02);
}

.simon-btn.pressed {
  filter: brightness(0.55);
  box-shadow: inset 0 4px 8px rgba(0, 0, 0, 0.6);
}

.simon-progress {
  font-family: var(--font-digi);
  font-size: 13px;
  color: var(--green);
  min-height: 20px;
  text-align: center;
}

.simon-btn:disabled {
  cursor: default;
}

/* ========== 记忆 ========== */
.memory-step {
  font-size: 13px;
  color: var(--text-dim);
  letter-spacing: 1px;
}

/* 记忆数字屏：红色 LED 数码管 */
.memory-display {
  min-width: 150px;
  padding: 8px 20px;
  background:
    repeating-linear-gradient(0deg, rgba(0, 0, 0, 0.3) 0 1px, transparent 1px 3px),
    radial-gradient(90% 100% at 50% 0%, #4a0c0c, #200304 75%);
  border: 3px solid #0b0c0f;
  border-radius: 10px;
  font-family: var(--font-digi);
  font-size: 62px;
  font-weight: 700;
  color: #ff4a3d;
  text-align: center;
  line-height: 1;
  text-shadow: 0 0 12px rgba(255, 74, 61, 0.7);
  box-shadow: inset 0 0 16px rgba(0, 0, 0, 0.9), 0 4px 12px rgba(0, 0, 0, 0.45);
}

.memory-pad {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 8px;
  width: 100%;
  max-width: 300px;
}

.memory-btn {
  height: 50px;
  border-radius: 10px;
  background: linear-gradient(180deg, #3d4048, #26282e 60%, #1c1e23);
  border: 1px solid #0c0d10;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.14), inset 0 -3px 5px rgba(0, 0, 0, 0.5);
  color: var(--text);
  font-family: var(--font-digi);
  font-size: 18px;
  font-weight: 700;
  cursor: pointer;
}

.memory-btn:active {
  transform: translateY(2px);
  background: linear-gradient(180deg, #ff7a00, #c25e00);
  color: #fff;
  box-shadow: inset 0 2px 6px rgba(0, 0, 0, 0.5);
}

/* ========== 密码 ========== */
.password-row {
  display: flex;
  gap: 12px;
  justify-content: center;
  width: 100%;
}

.password-col {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

.pwd-btn {
  width: 48px;
  height: 34px;
  border-radius: 6px;
  background: linear-gradient(180deg, #4a4d55, #2a2c32);
  border: 1px solid #0c0d10;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.16);
  color: #cfd2d6;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
}

.pwd-btn:active {
  transform: translateY(1px);
  background: linear-gradient(180deg, #ff7a00, #c25e00);
  color: #fff;
}

/* 密码轮槽：琥珀色数码窗 */
.pwd-value {
  width: 48px;
  height: 58px;
  background:
    repeating-linear-gradient(0deg, rgba(0, 0, 0, 0.25) 0 1px, transparent 1px 3px),
    linear-gradient(180deg, #2c2f36, #1a1c21 60%, #14151a);
  border: 2px solid #0c0d10;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-digi);
  font-size: 30px;
  font-weight: 700;
  color: #ffd75e;
  text-transform: uppercase;
  text-shadow: 0 0 8px rgba(255, 215, 94, 0.45);
  box-shadow: inset 0 2px 8px rgba(0, 0, 0, 0.75), inset 0 -1px 0 rgba(255, 255, 255, 0.08);
}

/* ========== 符号键盘 ========== */
.keypads-pad {
  display: flex;
  gap: 14px;
  justify-content: center;
  flex-wrap: wrap;
  width: 100%;
  max-width: 290px;
  padding: 14px;
  background: #0e0f13;
  border-radius: 14px;
  border: 1px solid #0c0d10;
  box-shadow: inset 0 2px 10px rgba(0, 0, 0, 0.7);
}

/* 符号键：石灰色凸起圆键 */
.keypad-sym {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background:
    radial-gradient(circle at 50% 30%, rgba(255, 255, 255, 0.18), transparent 46%),
    linear-gradient(180deg, #4a4d55, #2a2c32 60%, #1c1e23);
  border: 2px solid #0c0d10;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 30px;
  color: #eceff3;
  cursor: pointer;
  user-select: none;
  box-shadow: inset 0 2px 3px rgba(255, 255, 255, 0.2), inset 0 -4px 6px rgba(0, 0, 0, 0.55), 0 4px 8px rgba(0, 0, 0, 0.45);
  transition: transform 0.06s;
}

.keypad-sym:active {
  transform: translateY(2px);
}

.keypad-sym.pressed {
  background:
    radial-gradient(circle at 50% 30%, rgba(255, 255, 255, 0.3), transparent 46%),
    linear-gradient(180deg, #ff9a3c, #ff7a00 55%, #c25e00);
  color: #fff;
  box-shadow: inset 0 3px 8px rgba(0, 0, 0, 0.45), 0 0 14px rgba(255, 122, 0, 0.5);
}

/* ========== 通用反馈区 ========== */
.feedback {
  min-height: 24px;
  font-size: 14px;
  text-align: center;
  color: var(--text-dim);
  font-family: var(--font-digi);
}

.feedback.ok {
  color: var(--green);
}

.feedback.bad {
  color: var(--red);
  font-weight: 700;
  animation: shake 0.4s;
}

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

/* 确认按钮 */
.confirm-btn {
  width: 100%;
  max-width: 260px;
  background: linear-gradient(180deg, #ff9a3c, #ff7a00 55%, #d95e00);
  border: none;
  border-radius: 10px;
  padding: 14px;
  font-size: 16px;
  font-weight: 700;
  font-family: var(--font-display);
  letter-spacing: 1px;
  color: #fff;
  cursor: pointer;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.35);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.4), inset 0 -4px 8px rgba(0, 0, 0, 0.3);
}

.confirm-btn:active {
  transform: translateY(2px);
  box-shadow: inset 0 3px 8px rgba(0, 0, 0, 0.4);
}

.confirm-btn:disabled {
  opacity: 0.4;
}

/* ========== 解谜者（操作台 + 手册） ========== */
.solver {
  flex: 1;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  background: radial-gradient(110% 85% at 50% 100%, #1b1d24, #0e0f13 75%);
  border-radius: 20px;
  border: 1px solid #0b0c0f;
  box-shadow: inset 0 2px 12px rgba(0, 0, 0, 0.6), 0 12px 28px rgba(0, 0, 0, 0.5);
}

.solver-progress {
  font-size: 14px;
  color: var(--text-dim);
  text-align: center;
}

.manual-tabs {
  display: flex;
  gap: 8px;
  justify-content: center;
  flex-wrap: wrap;
}

.note-tab {
  padding: 8px 15px;
  border-radius: 8px;
  border: 1px solid #0c0d10;
  background: linear-gradient(180deg, #34373f, #23252b);
  color: var(--text-dim);
  font-family: var(--font-display);
  font-size: 12px;
  letter-spacing: 1px;
  cursor: pointer;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

.note-tab.active {
  background: linear-gradient(180deg, #ff9a3c, #e86200);
  color: #fff;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.4);
}

.note-tab.done {
  border-color: #1f5c33;
  color: var(--green);
}

.note-tab.done::before {
  content: "✓ ";
}

/* ========== 泛黄手册纸页 ========== */
.manual-paper {
  position: relative;
  flex: 1;
  background:
    var(--noise),
    radial-gradient(130% 60% at 25% 0%, rgba(255, 250, 220, 0.65), transparent 60%),
    radial-gradient(110% 50% at 85% 100%, rgba(140, 100, 40, 0.18), transparent 60%),
    linear-gradient(180deg, #f3e7bd, #e7d4a0 80%, #dcc68b);
  border: 1px solid #a08b58;
  border-radius: 6px 16px 16px 6px;
  padding: 20px 18px 20px 26px;
  overflow-y: auto;
  box-shadow:
    inset 0 0 34px rgba(120, 90, 30, 0.28),
    inset 0 0 4px rgba(120, 90, 30, 0.35),
    0 8px 20px rgba(0, 0, 0, 0.5);
}

/* 左侧活页孔 */
.manual-paper::before {
  content: "";
  position: absolute;
  left: 7px;
  top: 14px;
  bottom: 14px;
  width: 6px;
  background-image: radial-gradient(circle 3px at 3px 11px, rgba(50, 38, 16, 0.55) 0 72%, transparent 73%);
  background-size: 6px 34px;
  background-repeat: repeat-y;
}

.manual-paper h3 {
  font-family: Georgia, "Songti SC", serif;
  color: #7a1f1f;
  font-size: 19px;
  font-weight: 700;
  letter-spacing: 1px;
  margin-bottom: 12px;
  border-bottom: 2px solid rgba(122, 31, 31, 0.45);
  padding-bottom: 8px;
}

.manual-paper .manual-ch {
  font-family: var(--font-digi);
  font-size: 11px;
  color: #8a6d3b;
  font-weight: normal;
  float: right;
  margin-top: 4px;
}

.note-svgs {
  text-align: center;
  margin-bottom: 12px;
}

.note-svgs svg {
  max-width: 100%;
  height: auto;
  border-radius: 4px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
}

.note-svg-caption {
  font-size: 11px;
  color: #8a6d3b;
  margin-top: 4px;
}

.note-rules {
  list-style: none;
  padding: 0;
}

.note-rules li {
  color: var(--ink);
  font-size: 14px;
  line-height: 1.85;
  margin-bottom: 4px;
}

.note-rules li.highlight {
  color: #b3121b;
  font-weight: 700;
}

.note-rules li.warn {
  color: #a01212;
}

/* ========== KTANE 版 LED 倒计时 ========== */
.countdown {
  background: linear-gradient(180deg, #111216, #1a1b20);
  border: 1px solid #000;
  border-radius: 10px;
  padding: 8px 16px 12px;
  text-align: center;
  box-shadow: inset 0 2px 8px rgba(0, 0, 0, 0.85), 0 4px 10px rgba(0, 0, 0, 0.4);
}

.countdown-label {
  font-family: var(--font-digi);
  font-size: 11px;
  letter-spacing: 2px;
  color: var(--text-dim);
  margin-bottom: 3px;
}

/* 数码管玻璃面板 */
.countdown-display {
  position: relative;
  overflow: hidden;
  font-family: var(--font-digi);
  font-size: 46px;
  font-weight: 700;
  line-height: 1.08;
  color: #ff4438;
  letter-spacing: 3px;
  padding: 6px 10px;
  border-radius: 8px;
  background:
    repeating-linear-gradient(0deg, rgba(0, 0, 0, 0.28) 0 1px, transparent 1px 3px),
    linear-gradient(180deg, #230405, #33070a 45%, #150303);
  text-shadow: 0 0 10px rgba(255, 60, 50, 0.95), 0 0 26px rgba(255, 60, 50, 0.5);
  box-shadow: inset 0 0 12px rgba(0, 0, 0, 0.95), inset 0 1px 0 rgba(255, 120, 100, 0.18);
}

/* 玻璃反光扫过 */
.countdown-display::after {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  left: -45%;
  width: 32%;
  background: linear-gradient(105deg, transparent, rgba(255, 255, 255, 0.12) 50%, transparent);
  transform: skewX(-18deg);
  pointer-events: none;
  animation: glass-sweep 5.5s ease-in-out infinite;
}

@keyframes glass-sweep {
  0% { left: -45%; }
  55%, 100% { left: 135%; }
}

.countdown-display.urgent {
  animation: blink 0.5s steps(2) infinite;
}

@keyframes blink {
  50% { opacity: 0.4; }
}

.countdown-small {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 6px 14px;
}

.countdown-small .countdown-label {
  margin: 0;
}

.countdown-small .countdown-display {
  font-size: 28px;
  padding: 4px 10px;
  letter-spacing: 2px;
}

/* ========== 结算覆盖层 ========== */
.overlay {
  position: fixed;
  inset: 0;
  background: radial-gradient(100% 100% at 50% 40%, rgba(10, 10, 14, 0.85), rgba(0, 0, 0, 0.94));
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  backdrop-filter: blur(3px);
}

.overlay-card {
  position: relative;
  background-image: var(--screws), linear-gradient(180deg, #2e3138, #1c1e24 75%);
  border: 1px solid #0c0d10;
  border-radius: 20px;
  padding: 34px 30px;
  text-align: center;
  max-width: 320px;
  width: 90%;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08), 0 30px 60px rgba(0, 0, 0, 0.6);
  animation: overlay-in 0.3s ease;
}

@keyframes overlay-in {
  from { opacity: 0; transform: scale(0.92) translateY(12px); }
  to { opacity: 1; transform: none; }
}

.overlay-title {
  font-family: var(--font-display);
  font-size: 30px;
  font-weight: 700;
  letter-spacing: 2px;
  margin-bottom: 12px;
}

.overlay-title.win {
  color: var(--green);
  text-shadow: 0 0 18px rgba(60, 255, 106, 0.6);
}

.overlay-title.lose {
  color: var(--red);
  text-shadow: 0 0 18px rgba(255, 59, 48, 0.6);
}

.overlay-detail {
  color: var(--text-dim);
  font-size: 14px;
  margin-bottom: 24px;
  line-height: 1.7;
}

/* ========== 顶部提示横幅 ========== */
.toast {
  position: fixed;
  top: 14px;
  left: 50%;
  transform: translateX(-50%);
  max-width: 90%;
  background: rgba(15, 16, 20, 0.94);
  border: 1px solid var(--orange);
  color: var(--text);
  font-size: 14px;
  padding: 10px 18px;
  border-radius: 20px;
  z-index: 90;
  text-align: center;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.08);
  animation: toast-in 0.25s ease;
}

@keyframes toast-in {
  from { opacity: 0; transform: translateX(-50%) translateY(-8px); }
  to { opacity: 1; transform: translateX(-50%) translateY(0); }
}

/* ========== 进场动画 ========== */
#game-view .bomb > *,
#game-view .solver > * {
  animation: rise-in 0.4s ease both;
}

#game-view .bomb > :nth-child(2),
#game-view .solver > :nth-child(2) { animation-delay: 0.06s; }
#game-view .bomb > :nth-child(3),
#game-view .solver > :nth-child(3) { animation-delay: 0.12s; }
#game-view .bomb > :nth-child(4),
#game-view .solver > :nth-child(4) { animation-delay: 0.18s; }
#game-view .bomb > :nth-child(5),
#game-view .solver > :nth-child(5) { animation-delay: 0.24s; }

@keyframes rise-in {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: none; }
}

@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.001s !important;
    animation-iteration-count: 1 !important;
  }
}
