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

.game-card {
  font-family: "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
  background: transparent;
  color: #1f2937;
}

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

.page {
  margin: 0 auto;
  padding: 32px 16px 48px;
}

/* ---------- 头部 ---------- */
.header {
  text-align: center;
  margin-bottom: 24px;
}

.header__title {
  font-size: 30px;
  font-weight: 700;
  color: #0989E2;
}

.header__subtitle {
  margin-top: 8px;
  font-size: 14px;
  color: #6b7280;
}

/* ---------- 信息面板 ---------- */
.panel {
  background: #ffffff;
  border-radius: 16px;
  padding: 20px;
  box-shadow: 0 8px 24px rgba(9,137,226, 0.10);
}

.panel__stats {
  display: flex;
  justify-content: space-around;
  margin-bottom: 16px;
}

.stat {
  text-align: center;
}

.stat__label {
  display: block;
  font-size: 13px;
  color: #9ca3af;
}

.stat__value {
  display: block;
  margin-top: 4px;
  font-size: 24px;
  font-weight: 700;
  color: #0989E2;
}

.panel__controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 24px;
  margin-bottom: 12px;
}

/* ---------- 棋盘大小选择器 ---------- */
.size-select {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  user-select: none;
}

.size-select__text {
  font-size: 14px;
  font-weight: 500;
}

.size-select select {
  padding: 8px 12px;
  border: 1px solid #bfe0ef;
  border-radius: 8px;
  background: #ffffff;
  color: #0989E2;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  outline: none;
}

.size-select select:focus {
  border-color: #0989E2;
}

/* ---------- 旋转模式开关 ---------- */
.mode-switch {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  user-select: none;
}

.mode-switch input {
  display: none;
}

.mode-switch__track {
  width: 44px;
  height: 24px;
  border-radius: 12px;
  background: #d1d5db;
  position: relative;
  transition: background 0.25s;
}

.mode-switch__thumb {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #ffffff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
  transition: transform 0.25s;
}

.mode-switch input:checked + .mode-switch__track {
  background: #0989E2;
}

.mode-switch input:checked + .mode-switch__track .mode-switch__thumb {
  transform: translateX(20px);
}

.mode-switch__text {
  font-size: 14px;
  font-weight: 500;
}

/* ---------- 按钮 ---------- */
.btn {
  border: none;
  border-radius: 8px;
  padding: 10px 24px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.2s, transform 0.1s;
}

.btn:active {
  transform: scale(0.96);
}

.btn--primary {
  background: #0989E2;
  color: #ffffff;
}

.btn--primary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn--ghost {
  background: #ffffff;
  color: #0989E2;
  border: 1px solid #bfe0ef;
}

/* ---------- 状态提示 ---------- */
.status {
  text-align: center;
  font-size: 15px;
  color: #4b5563;
  min-height: 24px;
}

.status--countdown {
  color: #0989E2;
  font-weight: 700;
  font-size: 18px;
}

.status--success {
  color: #16a34a;
  font-weight: 600;
}

.status--fail {
  color: #dc2626;
  font-weight: 600;
}

/* ---------- 棋盘 ---------- */
.board-wrap {
  margin-top: 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
  max-width: 100%;
  overflow-x: auto;
}

.board-frame {
  display: flex;
  align-items: center;
  justify-content: center;
}

.board-rotor {
  border: 2px solid #e5e7eb;
  border-top: 6px solid #f59e0b;
  border-radius: 10px;
  padding: 8px;
  background: #ffffff;
  transform: rotate(var(--rot, 0deg));
  transition: transform 0.6s ease-in-out, width 0.25s ease, height 0.25s ease;
  box-shadow: 0 8px 24px rgba(9,137,226, 0.10);
}

/* 格子大小固定，棋盘总宽 = 格子数 × 单格宽度 */
.board {
  display: grid;
  grid-template-columns: repeat(var(--size, 5), var(--cell, 76px));
  grid-template-rows: repeat(var(--size, 5), var(--cell, 76px));
  gap: 0;
}

.cell {
  /* 白色描边充当格子间距，不占用棋盘总宽（box-sizing: border-box） */
  border: 3px solid #ffffff;
  border-radius: 8px;
  background: #e5e7eb;
  cursor: pointer;
  transition: background 0.2s, box-shadow 0.2s;
}

.cell:hover {
  background: #d1d5db;
}

.cell--lit {
  background: #0989E2;
  box-shadow: 0 0 12px rgba(9,137,226, 0.55);
}

.cell--selected {
  background: #2f9fce;
  box-shadow: inset 0 0 0 2px #ffffff, 0 0 8px rgba(9,137,226, 0.5);
}

.cell--answer {
  background: #0989E2;
  box-shadow: 0 0 10px rgba(9,137,226, 0.6);
}

.cell--wrong {
  background: #dc2626;
  box-shadow: 0 0 10px rgba(220, 38, 38, 0.6);
}

.cell:disabled {
  cursor: default;
}

.cell:disabled:hover {
  background: #e5e7eb;
}

.cell--lit:disabled:hover {
  background: #0989E2;
}

.cell--selected:disabled:hover {
  background: #2f9fce;
}

.cell--answer:disabled:hover {
  background: #0989E2;
}

.cell--wrong:disabled:hover {
  background: #dc2626;
}

.board-tip {
  margin-top: 12px;
  font-size: 13px;
  color: #b45309;
  visibility: hidden;
}

.board-tip--visible {
  visibility: visible;
}

/* ---------- 失败后的操作区 ---------- */
.board-actions {
  display: none;
  gap: 12px;
  margin-top: 16px;
}

.board-actions--visible {
  display: flex;
}

/* ---------- 底部说明（与顺序记忆训练一致） ---------- */
.intro-footer {
  margin-top: 34px;
  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: 22px 24px;
  display: grid;
  grid-template-columns: auto 1fr;
  grid-template-rows: auto auto;
  column-gap: 16px;
  align-items: center;
}

.intro-card__icon {
  grid-row: 1 / span 2;
  font-size: 28px;
}

.intro-card__title {
  align-self: end;
  font-size: 16px;
  margin-bottom: 6px;
}

.intro-card__text {
  align-self: start;
  font-size: 13px;
  line-height: 1.9;
  color: #5b6a80;
}

.intro-card__text strong {
  color: #0989E2;
  font-weight: 600;
}

.footer {
  margin-top: 32px;
  text-align: center;
  font-size: 12px;
  color: #9ca3af;
}

@media (max-width: 420px) {
  .panel__controls {
    flex-direction: column;
    gap: 12px;
  }
}
