:root {
  --bg: #ffffff;
  --panel: #ffffff;
  --panel-light: #eceff5;
  --primary: #0989E2;
  --primary-deep: #11719c;
  --accent: #f59e0b;
  --success: #2f9e63;
  --danger: #e5484d;
  --text: #1d2129;
  --text-dim: #86909c;
  --radius: 14px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

[hidden] { display: none !important; }

.game-card--dark {
  background: transparent;
  color: var(--text);
  font-family: "PingFang SC", "Microsoft YaHei", sans-serif;
  padding: 24px 16px;
}

/* 外层容器透明：去掉外壳给 rounded-2xl 加的边框 */
.ot_workspace__inner .game-card {
  border: 0;
  box-shadow: none;
}

.page { width: 100%; max-width: 1160px; margin: 0 auto; }

/* ---------- 头部 ---------- */
.header { text-align: center; margin-bottom: 24px; }
.header__title {
  font-size: 30px;
  letter-spacing: 4px;
  background: linear-gradient(120deg, var(--primary), #36cfc9);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.header__subtitle { margin-top: 8px; color: var(--text-dim); font-size: 14px; }

/* ---------- 页签 ---------- */
.tabs {
  display: flex;
  background: var(--panel);
  border-radius: var(--radius);
  padding: 6px;
  margin-bottom: 20px;
}
.tabs__item {
  flex: 1;
  padding: 10px 0;
  border: none;
  border-radius: 10px;
  background: transparent;
  color: var(--text-dim);
  font-size: 15px;
  cursor: pointer;
  transition: all .25s;
}
.tabs__item:hover { color: var(--text); }
.tabs__item--active { background: var(--primary-deep); color: #fff; }

/* ---------- 面板 ---------- */
.panel { display: none; }
.panel--active { display: block; }

/* ---------- 难度选择 ---------- */
.difficulty {
  display: flex;
  gap: 10px;
  margin-bottom: 22px;
}
.difficulty__item {
  flex: 1;
  padding: 10px 4px;
  border: 1px solid #dfe3ea;
  border-radius: 10px;
  background: var(--panel);
  color: var(--text-dim);
  font-size: 14px;
  cursor: pointer;
  transition: all .2s;
}
.difficulty__item:hover { border-color: var(--primary); color: var(--text); }
.difficulty__item--active {
  border-color: var(--primary);
  background: rgba(91, 140, 255, .16);
  color: var(--primary);
}

/* ---------- 舞台 ---------- */
.stage {
  background: var(--panel);
  border-radius: var(--radius);
  padding: 30px 24px 34px;
  text-align: center;
}
.stage__target { font-size: 24px; font-weight: 700; letter-spacing: 1px; }
.stage__target--run { color: var(--accent); }
.stage__hint { margin-top: 8px; min-height: 20px; color: var(--text-dim); font-size: 13px; }

.stage__circle {
  width: 150px;
  height: 150px;
  margin: 26px auto;
  border-radius: 50%;
  border: 2px solid #dfe3ea;
  background: var(--panel-light);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: border-color .3s, box-shadow .3s;
}
.stage__circle--running {
  border-color: var(--accent);
  animation: pulse 1.6s ease-in-out infinite;
}
.stage__icon { font-size: 46px; color: var(--primary); }
.stage__circle--running .stage__icon { color: var(--accent); }

@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(255, 197, 88, .35); transform: scale(1); }
  50% { box-shadow: 0 0 0 22px rgba(255, 197, 88, 0); transform: scale(1.06); }
}

/* ---------- 结果 ---------- */
.result { margin-top: 18px; animation: fadeUp .35s ease; }
.result__time, .result__diff { font-size: 15px; color: var(--text-dim); }
.result__time b, .result__diff b { color: var(--text); font-size: 18px; }
.result__diff b { color: var(--accent); }
.result__grade { margin-top: 10px; font-size: 20px; font-weight: 700; }

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ---------- 按钮 ---------- */
.btn {
  padding: 13px 46px;
  border: none;
  border-radius: 999px;
  font-size: 16px;
  letter-spacing: 2px;
  cursor: pointer;
  transition: transform .15s, filter .2s;
  margin-top: 6px;
}
.btn:active { transform: scale(.96); }
.btn--primary { background: linear-gradient(135deg, var(--primary), var(--primary-deep)); color: #fff; }
.btn--primary:hover { filter: brightness(1.12); }
.btn--primary--stop { background: linear-gradient(135deg, #ff8a5c, var(--danger)); }
.btn--ghost {
  background: transparent;
  border: 1px solid #dfe3ea;
  color: var(--text-dim);
}
.btn--ghost:hover { color: var(--text); border-color: var(--primary); }
.btn--danger {
  background: transparent;
  border: 1px solid #f3c1c6;
  color: var(--danger);
  padding: 9px 30px;
  font-size: 14px;
}
.btn--danger:hover { background: rgba(255, 107, 122, .1); }

/* ---------- 最佳纪录 ---------- */
.records {
  margin-top: 20px;
  background: var(--panel);
  border-radius: var(--radius);
  padding: 16px 20px;
}
.records__title { font-size: 14px; color: var(--text-dim); margin-bottom: 12px; }
.records__list { display: flex; gap: 12px; }
.records__item {
  flex: 1;
  background: var(--panel-light);
  border-radius: 10px;
  padding: 10px;
  text-align: center;
  font-size: 13px;
  color: var(--text-dim);
}
.records__item b { display: block; margin-top: 4px; font-size: 17px; color: var(--accent); }

/* ---------- 对战 ---------- */
.duel__rule { margin: 4px 0 20px; color: var(--text-dim); font-size: 13px; text-align: center; }
.duel__setup { text-align: center; }
.duel__setup .btn { margin-top: 0; }

.duel__board {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 18px;
  margin-bottom: 20px;
}
.duel__side {
  flex: 1;
  max-width: 200px;
  background: var(--panel);
  border-radius: var(--radius);
  padding: 14px;
  text-align: center;
  border: 2px solid transparent;
  transition: border-color .3s;
}
.duel__side--active { border-color: var(--accent); }
.duel__name { display: block; color: var(--text-dim); font-size: 13px; }
.duel__score { font-size: 22px; color: var(--text); }
.duel__vs { font-weight: 700; color: var(--text-dim); }
.duel__final { margin-top: 16px; animation: fadeUp .35s ease; }
.duel__winner { font-size: 22px; font-weight: 700; color: var(--accent); margin-bottom: 12px; }

/* ---------- 统计 ---------- */
.stats-grid { display: flex; gap: 12px; margin-bottom: 20px; }
.stats-card {
  flex: 1;
  background: var(--panel);
  border-radius: var(--radius);
  padding: 16px;
  text-align: center;
  font-size: 13px;
  color: var(--text-dim);
}
.stats-card b { display: block; margin-top: 6px; font-size: 22px; color: var(--accent); }

.history {
  width: 100%;
  border-collapse: collapse;
  background: var(--panel);
  border-radius: var(--radius);
  overflow: hidden;
  font-size: 13px;
}
.history th, .history td { padding: 10px 8px; text-align: center; }
.history th { background: var(--panel-light); color: var(--text-dim); font-weight: 500; }
.history tr:not(:last-child) td { border-bottom: 1px solid #e5e9f0; }
.history__empty {
  margin: 40px 0;
  text-align: center;
  color: var(--text-dim);
  font-size: 14px;
}
#clearBtn { display: block; margin: 20px auto 0; }

.grade--perfect { color: var(--success); }
.grade--good { color: var(--primary); }
.grade--normal { color: var(--accent); }
.grade--bad { color: var(--danger); }

/* ---------- 底部介绍 ---------- */
.intro-footer {
  margin-top: 36px;
}
.intro-footer__grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
}
.intro-card {
  background: #fff;
  border-radius: 14px;
  box-shadow: 0 6px 24px rgba(50, 70, 100, 0.08);
  padding: 24px 26px;
  text-align: left;
  display: grid;
  grid-template-columns: auto 1fr;
  grid-template-rows: auto auto;
  column-gap: 18px;
  align-items: center;
}
.intro-card__icon {
  grid-row: 1 / span 2;
  font-size: 30px;
}
.intro-card__title {
  align-self: end;
  font-size: 17px;
  margin-bottom: 6px;
  color: #2c3e50;
}
.intro-card__text {
  align-self: start;
  font-size: 13px;
  line-height: 1.9;
  color: #5a6a7e;
}
.intro-card__text strong {
  color: #0989E2;
  font-weight: 600;
}

@media (max-width: 480px) {
  .header__title { font-size: 24px; }
  .difficulty { flex-direction: column; }
  .records__list { flex-direction: column; }
  .stage__circle { width: 120px; height: 120px; }
}
