.mini-game {
  background:
    linear-gradient(145deg, rgba(255, 214, 111, 0.16), transparent 36%),
    linear-gradient(220deg, rgba(154, 220, 179, 0.2), transparent 34%),
    linear-gradient(180deg, #fff8e9, #eef8f3);
}

.mini-game .app-shell {
  width: min(980px, calc(100% - 28px));
}

.mini-game .page-nav a {
  border-radius: 8px;
}

.mini-game .hero-band {
  align-items: center;
}

.mini-game h1 {
  font-size: 2.7rem;
}

.mini-game .game-panel {
  padding: 20px;
  border-radius: 10px;
}

.mini-game .play-toolbar,
.mini-game .game-controls,
.mini-game .mode-controls,
.mini-game .game-stats {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.mini-game .play-toolbar {
  justify-content: space-between;
  margin-bottom: 16px;
}

.mini-game .game-stats {
  gap: 8px;
}

.mini-game .game-stat {
  min-width: 92px;
  padding: 9px 12px;
  border: 1px solid #e2ddd1;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.8);
  font-variant-numeric: tabular-nums;
}

.mini-game .game-stat span {
  display: block;
  margin-bottom: 3px;
  color: #79798a;
  font-size: 0.68rem;
  font-weight: 800;
}

.mini-game .game-stat strong {
  color: #454554;
  font-size: 1.1rem;
}

.mini-game button,
.mini-game select {
  font: inherit;
}

.mini-game button {
  color: #4d4a58;
}

.mini-game .game-button,
.mini-game .mode-button,
.mini-game select {
  min-height: 44px;
  padding: 9px 14px;
  border: 1px solid #dcd8cb;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.86);
  font-weight: 800;
  cursor: pointer;
}

.mini-game .game-button.primary {
  border-color: #e87970;
  color: #fff;
  background: #e87970;
}

.mini-game .mode-controls {
  gap: 0;
  width: fit-content;
  padding: 3px;
  border: 1px solid #dcd8cb;
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.74);
}

.mini-game .mode-button {
  min-height: 36px;
  padding: 6px 12px;
  border: 0;
  background: transparent;
  font-size: 0.84rem;
}

.mini-game .mode-button[aria-pressed="true"] {
  color: #fff;
  background: #558c74;
}

.mini-game button:focus-visible,
.mini-game select:focus-visible,
.mini-game canvas:focus-visible {
  outline: 3px solid #478cc5;
  outline-offset: 3px;
}

.mini-game button:disabled {
  cursor: default;
  opacity: 0.56;
}

.mini-game .game-message {
  min-height: 48px;
  margin: 14px 0;
  padding: 12px 14px;
  border-left: 4px solid #e3bd55;
  color: #555662;
  background: #fff8e6;
  line-height: 1.5;
}

.mini-game .game-board-wrap {
  display: grid;
  justify-items: center;
  padding: 16px;
  border: 1px solid #e2ddd1;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.66);
}

.mini-game .game-board-wrap canvas {
  display: block;
  width: min(100%, 440px);
  height: auto;
  border-radius: 6px;
  touch-action: none;
}

.mini-game .game-controls {
  justify-content: center;
  margin-top: 14px;
}

.mini-game .guide-content {
  margin-top: 28px;
}

.mini-game .guide-content .content-section h2 {
  font-size: 1.7rem;
}

.mini-game .source-credit {
  margin-top: 16px;
  color: #79798a;
  font-size: 0.8rem;
}

.mini-game .source-credit a,
.mini-game .game-links a {
  color: #bf5660;
  font-weight: 800;
}

.mini-game .game-links {
  display: flex;
  gap: 8px 16px;
  flex-wrap: wrap;
  margin: 12px 0 0;
}

.arcade-links {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 20px;
}

.arcade-links a {
  padding: 9px 12px;
  border: 1px solid rgba(225, 213, 194, 0.82);
  border-radius: 8px;
  color: #575465;
  background: rgba(255, 255, 255, 0.72);
  font-size: 0.9rem;
  font-weight: 800;
  text-decoration: none;
}

.arcade-title {
  margin-top: 24px;
  font-size: 1rem;
}

.snake-stage {
  position: relative;
  width: min(100%, 440px);
}

.snake-stage canvas {
  width: 100%;
}

.snake-overlay {
  position: absolute;
  inset: 0;
  display: grid;
  place-content: center;
  gap: 12px;
  padding: 20px;
  border-radius: 6px;
  color: #fff;
  text-align: center;
  background: rgba(35, 57, 50, 0.82);
}

.snake-overlay[hidden] {
  display: none;
}

.snake-overlay h2 {
  font-size: 1.7rem;
}

.mine-scroll {
  width: 100%;
  overflow: auto;
  padding: 4px;
}

.mine-board {
  display: grid;
  grid-template-columns: repeat(var(--mine-cols), 36px);
  gap: 3px;
  width: max-content;
  margin: 0 auto;
}

.mine-cell {
  display: grid;
  width: 36px;
  aspect-ratio: 1;
  place-items: center;
  padding: 0;
  border: 1px solid #c3cbd1;
  border-radius: 4px;
  background: #e8edf0;
  font-size: 0.88rem;
  font-weight: 900;
}

.mine-cell.revealed {
  border-color: #d4d1c8;
  background: #fffdf5;
}

.mine-cell.flagged {
  color: #bc4e4e;
  background: #f8e5dc;
}

.mine-cell.mine-hit {
  color: #fff;
  background: #d85856;
}

.mine-cell[data-number="1"] { color: #397bb5; }
.mine-cell[data-number="2"] { color: #37804f; }
.mine-cell[data-number="3"] { color: #cb514e; }
.mine-cell[data-number="4"] { color: #705590; }
.mine-cell[data-number="5"] { color: #a3653c; }
.mine-cell[data-number="6"] { color: #368c91; }
.mine-cell[data-number="7"] { color: #42424a; }
.mine-cell[data-number="8"] { color: #7b7b80; }

.memory-board {
  display: grid;
  grid-template-columns: repeat(var(--memory-cols), minmax(38px, 68px));
  gap: 8px;
  justify-content: center;
  width: 100%;
}

.memory-card {
  display: grid;
  aspect-ratio: 1;
  place-items: center;
  padding: 5px;
  border: 1px solid #d8d9d4;
  border-radius: 8px;
  background: #dce9e6;
  box-shadow: 0 3px 0 #bdcfca;
}

.memory-card[aria-pressed="true"],
.memory-card.matched {
  border-color: #c5d9cd;
  background: #fff9e9;
  box-shadow: inset 0 0 0 2px #d2e1d6;
}

.memory-card.matched {
  cursor: default;
}

.memory-backmark {
  width: 24px;
  height: 24px;
  border: 3px solid #6c9588;
  border-radius: 50%;
}

.memory-glyph {
  display: block;
  width: 60%;
  height: 60%;
  background: var(--glyph-color, #e87970);
  clip-path: var(--glyph-shape, circle(50%));
}

.memory-glyph.g1 { --glyph-shape: polygon(50% 0, 100% 100%, 0 100%); }
.memory-glyph.g2 { --glyph-shape: polygon(20% 0, 80% 0, 100% 20%, 100% 80%, 80% 100%, 20% 100%, 0 80%, 0 20%); }
.memory-glyph.g3 { --glyph-shape: polygon(50% 0, 100% 50%, 50% 100%, 0 50%); }
.memory-glyph.g4 { --glyph-shape: polygon(25% 0, 75% 0, 100% 50%, 75% 100%, 25% 100%, 0 50%); }
.memory-glyph.g5 { --glyph-shape: polygon(50% 0, 62% 35%, 100% 35%, 69% 57%, 81% 100%, 50% 73%, 19% 100%, 31% 57%, 0 35%, 38% 35%); }
.memory-glyph.g6 { --glyph-shape: polygon(0 15%, 85% 0, 100% 85%, 15% 100%); }
.memory-glyph.g7 { --glyph-shape: polygon(35% 0, 65% 0, 65% 35%, 100% 35%, 100% 65%, 65% 65%, 65% 100%, 35% 100%, 35% 65%, 0 65%, 0 35%, 35% 35%); }
.memory-glyph.g8 { --glyph-shape: polygon(50% 0, 93% 25%, 93% 75%, 50% 100%, 7% 75%, 7% 25%); }
.memory-glyph.g9 { --glyph-shape: polygon(50% 0, 100% 38%, 81% 100%, 19% 100%, 0 38%); }
.memory-glyph.g10 { --glyph-shape: polygon(25% 0, 75% 0, 75% 25%, 100% 25%, 100% 75%, 75% 75%, 75% 100%, 25% 100%, 25% 75%, 0 75%, 0 25%, 25% 25%); }
.memory-glyph.g11 { --glyph-shape: polygon(50% 0, 61% 34%, 98% 35%, 68% 57%, 79% 94%, 50% 72%, 21% 94%, 32% 57%, 2% 35%, 39% 34%); }
.memory-glyph.g12 { --glyph-shape: polygon(50% 0, 100% 25%, 100% 75%, 50% 100%, 0 75%, 0 25%); }

.ttt-board {
  display: grid;
  grid-template-columns: repeat(3, min(24vw, 98px));
  gap: 8px;
}

.ttt-cell {
  display: grid;
  aspect-ratio: 1;
  place-items: center;
  padding: 0;
  border: 1px solid #d8d9d4;
  border-radius: 8px;
  background: #fffdf7;
  color: #4c6072;
  font-size: 2.6rem;
  font-weight: 900;
}

.ttt-cell.x-mark { color: #d76c6a; }
.ttt-cell.o-mark { color: #4e91b1; }
.ttt-cell.win-cell { background: #f7e6a7; }

.lights-board {
  display: grid;
  grid-template-columns: repeat(var(--light-size), var(--light-cell, 36px));
  gap: 6px;
  justify-content: center;
}

.light-cell {
  width: var(--light-cell, 36px);
  aspect-ratio: 1;
  padding: 0;
  border: 1px solid #c8cfc9;
  border-radius: 7px;
  background: #e1e8e1;
  box-shadow: inset 0 -3px 0 rgba(74, 88, 72, 0.14);
}

.light-cell.on {
  border-color: #d4ad46;
  background: #ffd66f;
  box-shadow: inset 0 2px 0 rgba(255, 255, 255, 0.7), 0 2px 9px rgba(194, 142, 27, 0.18);
}

.light-cell.hint-cell {
  outline: 3px solid #478cc5;
  outline-offset: 1px;
}

@media (max-width: 620px) {
  .mini-game .app-shell { width: min(100% - 18px, 100%); }
  .mini-game h1 { font-size: 2.15rem; }
  .mini-game .game-panel { padding: 12px; }
  .mini-game .game-stat { min-width: 78px; padding: 8px 9px; }
  .mini-game .play-toolbar { align-items: flex-start; }
  .mini-game .game-board-wrap { padding: 10px; }
  .mine-cell { width: 34px; }
  .mine-board { grid-template-columns: repeat(var(--mine-cols), 34px); }
  .memory-board { gap: 5px; grid-template-columns: repeat(var(--memory-cols), minmax(34px, 1fr)); }
  .ttt-board { gap: 6px; }
  .lights-board { --light-cell: min(32px, max(23px, calc((100vw - 82px) / 9))); gap: 4px; }
  .mini-game .guide-content .content-section h2 { font-size: 1.5rem; }
}
