:root {
  color-scheme: light;
  --bg-top: #fff3b0;
  --bg-bottom: #a0e7e5;
  --card: rgba(255, 255, 255, 0.92);
  --text: #1d3557;
  --muted: #4f6d7a;
  --accent: #ff7f50;
  --accent-dark: #ef5d28;
  --secondary: #6c5ce7;
  --cell: #fff8e7;
  --cell-fixed: #ffd166;
  --cell-active: #7bdff2;
  --cell-correct: #b9fbc0;
  --cell-wrong: #ffadad;
  --shadow: 0 18px 40px rgba(29, 53, 87, 0.16);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Baloo 2", "Microsoft YaHei", sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(255, 255, 255, 0.75), transparent 32%),
    radial-gradient(circle at bottom right, rgba(255, 255, 255, 0.7), transparent 28%),
    linear-gradient(160deg, var(--bg-top), var(--bg-bottom));
}

.app-shell {
  width: min(1100px, calc(100% - 32px));
  margin: 0 auto;
  padding: 28px 0 40px;
}

.hero-card,
.game-card {
  background: var(--card);
  backdrop-filter: blur(8px);
  border-radius: 28px;
  box-shadow: var(--shadow);
}

.hero-card {
  padding: 28px;
  margin-bottom: 22px;
}

.eyebrow {
  margin: 0;
  color: var(--accent-dark);
  font-size: 1rem;
  letter-spacing: 0.06em;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  margin-top: 4px;
  font-size: clamp(2rem, 5vw, 3.4rem);
  line-height: 1;
}

.intro {
  margin-top: 10px;
  max-width: 700px;
  font-size: 1.1rem;
  color: var(--muted);
}

.rules {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 18px;
}

.rules span {
  padding: 8px 14px;
  border-radius: 999px;
  background: #ffffff;
  color: var(--secondary);
  font-size: 0.98rem;
}

.mode-panel {
  margin-top: 18px;
}

.mode-panel p {
  color: var(--muted);
  font-size: 1rem;
}

.mode-picker {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 12px;
}

.progress-panel {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 18px;
}

.score-card,
.unlock-card {
  min-width: 140px;
  padding: 14px 16px;
  border-radius: 18px;
  background: linear-gradient(180deg, #ffffff, #fff8ea);
  box-shadow: 0 10px 24px rgba(29, 53, 87, 0.08);
}

.score-label {
  display: block;
  color: var(--muted);
  font-size: 0.95rem;
}

.score-display {
  display: block;
  margin-top: 2px;
  font-size: 1.35rem;
  line-height: 1.1;
  color: var(--accent-dark);
}

.mode-button {
  padding: 10px 16px;
  border-radius: 999px;
  background: #ffffff;
  color: var(--secondary);
  box-shadow: 0 10px 24px rgba(29, 53, 87, 0.08);
  transition: transform 160ms ease, background 160ms ease, color 160ms ease;
}

.mode-button:hover {
  transform: translateY(-2px);
}

.mode-button.active {
  background: var(--secondary);
  color: #ffffff;
}

.mode-button.locked {
  background: #edf1f7;
  color: #8aa0b2;
  box-shadow: none;
}

.game-card {
  padding: 24px;
}

.status-bar {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
}

.status-bar p {
  color: var(--muted);
  margin-top: 6px;
}

.timer-card {
  min-width: 120px;
  padding: 12px 16px;
  border-radius: 18px;
  background: linear-gradient(180deg, #ffffff, #eef7ff);
  box-shadow: 0 10px 24px rgba(29, 53, 87, 0.08);
  text-align: center;
}

.timer-label {
  display: block;
  color: var(--muted);
  font-size: 0.95rem;
}

.timer-display {
  display: block;
  margin-top: 2px;
  font-size: 1.9rem;
  line-height: 1;
  color: var(--secondary);
}

.controls {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: flex-end;
}

button {
  border: 0;
  font: inherit;
  cursor: pointer;
}

.action-button,
.clear-button,
.picker-button {
  transition: transform 160ms ease, box-shadow 160ms ease, background 160ms ease;
}

.action-button:hover,
.clear-button:hover,
.picker-button:hover,
.cell.editable:hover {
  transform: translateY(-2px);
}

.action-button {
  padding: 12px 18px;
  border-radius: 16px;
  background: #ffffff;
  color: var(--text);
  box-shadow: 0 10px 24px rgba(29, 53, 87, 0.08);
}

.action-button.primary {
  background: var(--accent);
  color: #ffffff;
}

.board-wrap {
  display: flex;
  justify-content: center;
  padding: 22px 0 10px;
}

.board {
  display: grid;
  grid-template-columns: repeat(var(--board-size, 5), minmax(40px, 72px));
  gap: 10px;
  padding: 18px;
  border-radius: 24px;
  background: linear-gradient(180deg, #fffcf2, #f1f7ff);
  box-shadow: inset 0 0 0 4px rgba(29, 53, 87, 0.08);
}

.cell {
  aspect-ratio: 1;
  border-radius: 22px;
  display: grid;
  place-items: center;
  font-size: clamp(1.2rem, 3vw, 2.4rem);
  line-height: 1;
  box-shadow: inset 0 -6px 0 rgba(0, 0, 0, 0.06);
  background: var(--cell);
  border: 3px solid transparent;
}

.cell.fixed {
  background: var(--cell-fixed);
  color: #734400;
}

.cell.editable {
  background: #ffffff;
}

.cell.active {
  border-color: var(--cell-active);
  transform: scale(1.04);
}

.cell.correct {
  background: var(--cell-correct);
}

.cell.wrong {
  background: var(--cell-wrong);
}

.picker-panel {
  margin-top: 12px;
  padding-top: 12px;
}

.picker-panel p {
  text-align: center;
  font-size: 1.1rem;
}

.number-picker {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 14px;
}

.picker-button {
  width: 60px;
  height: 60px;
  border-radius: 20px;
  background: linear-gradient(180deg, #6c5ce7, #4b3fbe);
  color: #ffffff;
  font-size: 1.6rem;
  box-shadow: 0 12px 24px rgba(76, 63, 190, 0.28);
}

.board.size-8 .cell,
.board.size-9 .cell {
  border-radius: 18px;
}

.number-picker.size-8 .picker-button,
.number-picker.size-9 .picker-button {
  font-size: 1.4rem;
}

.board.size-7 .cell,
.board.size-8 .cell,
.board.size-9 .cell {
  font-size: clamp(1rem, 2.5vw, 2rem);
}

.clear-button {
  display: block;
  margin: 16px auto 0;
  padding: 10px 16px;
  border-radius: 14px;
  background: #e6f4f1;
  color: #1b6b5c;
}

@media (max-width: 760px) {
  .app-shell {
    width: min(100% - 20px, 560px);
    padding-top: 18px;
  }

  .hero-card,
  .game-card {
    border-radius: 24px;
  }

  .hero-card,
  .game-card {
    padding: 18px;
  }

  .progress-panel {
    flex-direction: column;
  }

  .status-bar {
    flex-direction: column;
  }

  .timer-card {
    width: 100%;
    max-width: 180px;
  }

  .controls {
    justify-content: flex-start;
  }

  .board {
    gap: 8px;
    padding: 12px;
    grid-template-columns: repeat(var(--board-size, 5), minmax(32px, 1fr));
  }

  .picker-button {
    width: 52px;
    height: 52px;
  }
}
