* {
  box-sizing: border-box;
}

/* Use with css/site.css — layout & chrome are on .site / .site-main--game */

.game-panel {
  max-width: 48rem;
  margin: 0 auto;
  width: 100%;
}

.game-panel--wide {
  max-width: 64rem;
}

.game-title {
  font-size: clamp(2.2rem, 6vw, 4.2rem);
  font-weight: 700;
  text-align: center;
  text-shadow: 0 2px 14px rgba(0, 0, 0, 0.35);
  margin-bottom: 0.35em;
  line-height: 1.12;
  padding: 0 0.25rem;
  color: var(--site-text, #f1f5f9);
}

.game-help {
  text-align: center;
  font-size: clamp(1.35rem, 3.5vw, 1.6rem);
  color: var(--site-text-muted, #94a3b8);
  margin-bottom: clamp(1rem, 3vw, 1.5rem);
  line-height: 1.45;
  padding: 0 0.35rem;
}

/* ----- Reaction ----- */
.reaction-area {
  border-radius: 1.2rem;
  min-height: clamp(14rem, 48vh, 22rem);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  user-select: none;
  font-size: clamp(1.65rem, 4.5vw, 2.4rem);
  font-weight: 700;
  text-align: center;
  padding: clamp(1rem, 4vw, 2rem);
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.35);
  transition: background 0.12s ease, color 0.12s ease;
  touch-action: manipulation;
  width: 100%;
  max-width: 36rem;
  margin-inline: auto;
}

.reaction-area.phase-intro,
.reaction-area.phase-result {
  background: linear-gradient(160deg, #3d5a80, #293241);
  color: #e0fbfc;
}

.reaction-area.phase-waiting {
  background: linear-gradient(160deg, #c1121f, #780000);
  color: #fff;
}

.reaction-area.phase-ready {
  background: linear-gradient(160deg, #2d6a4f, #1b4332);
  color: #d8f3dc;
}

.reaction-area.phase-early {
  background: linear-gradient(160deg, #6c757d, #495057);
  color: #fff;
}

.reaction-meta {
  text-align: center;
  margin-top: 1.5rem;
  font-size: 1.8rem;
}

.reaction-best {
  opacity: 0.9;
  margin-top: 0.5rem;
  font-size: 1.5rem;
}

/* ----- Simon ----- */
.simon-board {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: clamp(0.65rem, 2.5vw, 1rem);
  width: 100%;
  max-width: min(28rem, 100%);
  margin: 0 auto 1.5rem;
}

.simon-btn {
  aspect-ratio: 1;
  border: none;
  border-radius: 1rem;
  cursor: pointer;
  opacity: 0.75;
  transition: opacity 0.1s ease, transform 0.08s ease;
  box-shadow: inset 0 -6px 0 rgba(0, 0, 0, 0.2);
  touch-action: manipulation;
  min-width: 0;
}

.simon-btn:active,
.simon-btn.is-lit {
  opacity: 1;
  transform: scale(1.02);
}

.simon-btn[data-i="0"] {
  background: #2d6a4f;
}
.simon-btn[data-i="1"] {
  background: #c1121f;
}
.simon-btn[data-i="2"] {
  background: #ffb703;
}
.simon-btn[data-i="3"] {
  background: #3a86ff;
}

.simon-btn:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

.simon-status {
  text-align: center;
  font-size: clamp(1.45rem, 4vw, 2rem);
  font-weight: 600;
  min-height: 2.4em;
  margin-bottom: 1rem;
  padding: 0 0.35rem;
}

.simon-controls {
  display: flex;
  justify-content: center;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 1rem;
}

.simon-controls button {
  font-family: inherit;
  font-size: clamp(1.4rem, 3.5vw, 1.5rem);
  padding: 0.75em 1.25em;
  min-height: 44px;
  border: none;
  border-radius: 2em;
  cursor: pointer;
  background: #28e;
  color: #fff;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.25);
  touch-action: manipulation;
}

.simon-controls button:hover {
  filter: brightness(1.08);
}

.simon-best {
  text-align: center;
  font-size: 1.5rem;
  opacity: 0.9;
}

/* ----- Tic-tac-toe ----- */
.ttt-board {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: clamp(0.45rem, 2vw, 0.6rem);
  width: 100%;
  max-width: min(28rem, 100%);
  margin: 0 auto 1.5rem;
  aspect-ratio: 1;
}

.ttt-cell {
  border: none;
  border-radius: 0.8rem;
  font-size: clamp(2.2rem, 11vw, 4.2rem);
  font-weight: 700;
  cursor: pointer;
  background: rgba(255, 255, 255, 0.92);
  color: #1b4332;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
  transition: transform 0.08s ease;
  touch-action: manipulation;
  min-width: 0;
  min-height: 44px;
}

.ttt-cell:hover:not(:disabled) {
  transform: scale(1.02);
}

.ttt-cell:disabled {
  cursor: default;
  opacity: 0.95;
}

.ttt-cell.x {
  color: #c1121f;
}

.ttt-cell.o {
  color: #1d3557;
}

.ttt-status {
  text-align: center;
  font-size: 2rem;
  font-weight: 600;
  min-height: 2.4em;
  margin-bottom: 1rem;
}

.ttt-reset {
  display: block;
  margin: 0 auto;
  font-family: inherit;
  font-size: clamp(1.4rem, 3.5vw, 1.6rem);
  padding: 0.75em 1.5em;
  min-height: 44px;
  border: none;
  border-radius: 2em;
  cursor: pointer;
  background: #1c9882;
  color: #fff;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.25);
  touch-action: manipulation;
}

.ttt-reset:hover {
  filter: brightness(1.06);
}

/* ----- Snake ----- */
.snake-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 0.65rem 1.25rem;
  margin-bottom: 1rem;
  font-size: clamp(1.45rem, 3.8vw, 1.8rem);
}

.snake-toolbar button {
  font-family: inherit;
  font-size: clamp(1.35rem, 3.5vw, 1.5rem);
  padding: 0.65em 1.2em;
  min-height: 44px;
  border: none;
  border-radius: 2em;
  cursor: pointer;
  background: #4ecca3;
  color: #1a1a2e;
  font-weight: 700;
  touch-action: manipulation;
}

.snake-status {
  text-align: center;
  font-size: clamp(1.3rem, 3.4vw, 1.5rem);
  margin-top: 1rem;
  min-height: 2.4em;
  padding: 0 0.35rem;
}

#snake-canvas {
  display: block;
  margin: 0 auto;
  border-radius: 0.8rem;
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.45);
  max-width: 100%;
  height: auto;
}

.snake-dpad {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.55rem;
  max-width: 15rem;
  margin: 1rem auto 0;
}

.snake-dir {
  font-family: inherit;
  font-size: clamp(1.85rem, 6vw, 2.2rem);
  line-height: 1;
  padding: 0.65rem 0.25rem;
  min-height: 48px;
  border: none;
  border-radius: 0.75rem;
  cursor: pointer;
  background: rgba(78, 204, 163, 0.4);
  color: #fff;
  font-weight: 700;
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.25);
  touch-action: manipulation;
}

.snake-dir:active {
  background: rgba(78, 204, 163, 0.75);
  transform: scale(0.97);
}

.snake-dpad-spacer {
  min-height: clamp(2.6rem, 12vw, 2.8rem);
}

/* ----- Quiz toolbar ----- */
.quiz-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 0.65rem 1rem;
  margin-bottom: 1.25rem;
  font-size: clamp(1.35rem, 3.5vw, 1.6rem);
  width: 100%;
}

.quiz-toolbar label {
  font-weight: 600;
  width: 100%;
  text-align: center;
}

@media (min-width: 400px) {
  .quiz-toolbar label {
    width: auto;
    text-align: initial;
  }
}

.quiz-toolbar select {
  font-family: inherit;
  font-size: clamp(1.35rem, 3.5vw, 1.5rem);
  padding: 0.55em 0.75em;
  min-height: 44px;
  width: 100%;
  max-width: 22rem;
  border-radius: 0.5rem;
  border: 2px solid rgba(255, 255, 255, 0.35);
  background: rgba(255, 255, 255, 0.95);
  color: #1a1a2e;
  cursor: pointer;
  touch-action: manipulation;
}

/* ----- 2048 ----- */
.g2048-toolbar {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 0.65rem 1.25rem;
  margin-bottom: 1rem;
  font-size: clamp(1.45rem, 3.8vw, 1.8rem);
}

.g2048-toolbar button {
  font-family: inherit;
  font-size: clamp(1.35rem, 3.5vw, 1.5rem);
  padding: 0.65em 1.2em;
  min-height: 44px;
  border: none;
  border-radius: 2em;
  cursor: pointer;
  background: #edc22e;
  color: #1a1a2e;
  font-weight: 700;
  touch-action: manipulation;
}

#g2048-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: clamp(0.35rem, 1.5vw, 0.5rem);
  width: 100%;
  max-width: min(28rem, 100%);
  margin: 0 auto 1rem;
  padding: clamp(0.35rem, 2vw, 0.5rem);
  background: rgba(0, 0, 0, 0.35);
  border-radius: 0.8rem;
}

.g2048-cell {
  aspect-ratio: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 0.4rem;
  font-size: clamp(1.8rem, 5vw, 2.8rem);
  font-weight: 700;
  background: rgba(238, 228, 218, 0.35);
  color: #f9f6f2;
}

.g2048-cell[data-v="2"] {
  background: #eee4da;
  color: #776e65;
}
.g2048-cell[data-v="4"] {
  background: #ede0c8;
  color: #776e65;
}
.g2048-cell[data-v="8"] {
  background: #f2b179;
  color: #f9f6f2;
}
.g2048-cell[data-v="16"] {
  background: #f59563;
}
.g2048-cell[data-v="32"] {
  background: #f67c5f;
}
.g2048-cell[data-v="64"] {
  background: #f65e3b;
}
.g2048-cell[data-v="128"],
.g2048-cell[data-v="256"],
.g2048-cell[data-v="512"] {
  background: #edcf72;
  color: #f9f6f2;
  font-size: clamp(1.5rem, 4vw, 2.2rem);
}
.g2048-cell[data-v="1024"],
.g2048-cell[data-v="2048"] {
  background: #edc22e;
  color: #f9f6f2;
  font-size: clamp(1.3rem, 3.5vw, 2rem);
}

.g2048-cell[data-v]:not([data-v=""]) {
  font-weight: 800;
}

#g2048-status {
  text-align: center;
  font-size: 1.6rem;
  min-height: 2.4em;
}

/* ----- Whack-a-mole ----- */
.whack-toolbar {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 1rem 1.5rem;
  margin-bottom: 1rem;
  font-size: clamp(1.5rem, 4vw, 2rem);
  font-weight: 600;
}

.whack-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: clamp(0.5rem, 2vw, 0.75rem);
  width: 100%;
  max-width: min(28rem, 100%);
  margin: 0 auto 1rem;
}

.whack-hole {
  aspect-ratio: 1;
  border-radius: 50%;
  border: 0.35rem solid #5c4033;
  background: linear-gradient(180deg, #3d2914 0%, #2a1a0a 100%);
  cursor: pointer;
  position: relative;
  box-shadow: inset 0 4px 12px rgba(0, 0, 0, 0.5);
  touch-action: manipulation;
  min-width: 0;
}

.whack-hole:disabled {
  cursor: default;
  opacity: 0.85;
}

.whack-hole.whack-mole::after {
  content: "";
  position: absolute;
  inset: 12%;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #c97b63 0%, #6d3a2e 45%, #4a2619 100%);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
}

#whack-status {
  text-align: center;
  font-size: 1.6rem;
  min-height: 2.4em;
}

.whack-start {
  display: block;
  margin: 0.5rem auto 0;
  font-family: inherit;
  font-size: clamp(1.4rem, 3.5vw, 1.6rem);
  padding: 0.75em 1.5em;
  min-height: 48px;
  min-width: min(100%, 12rem);
  border: none;
  border-radius: 2em;
  cursor: pointer;
  background: #e94560;
  color: #fff;
  font-weight: 700;
  touch-action: manipulation;
}

.whack-best {
  text-align: center;
  font-size: 1.5rem;
  margin-top: 0.75rem;
  opacity: 0.95;
}

/* ----- Quiz ----- */
#quiz-title {
  font-size: clamp(2rem, 4vw, 2.8rem);
  font-weight: 700;
  text-align: center;
  margin-bottom: 1rem;
  line-height: 1.25;
}

#quiz-progress {
  text-align: center;
  font-size: 1.5rem;
  opacity: 0.9;
  margin-bottom: 1.25rem;
}

#quiz-choices {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  max-width: 36rem;
  margin: 0 auto 1rem;
}

.quiz-choice {
  font-family: inherit;
  font-size: clamp(1.35rem, 3.4vw, 1.6rem);
  text-align: left;
  padding: 1rem 1.15rem;
  min-height: 48px;
  border: none;
  border-radius: 0.75rem;
  cursor: pointer;
  background: rgba(255, 255, 255, 0.92);
  color: #1b4332;
  transition: transform 0.08s ease;
  touch-action: manipulation;
  line-height: 1.35;
}

.quiz-choice:hover:not(:disabled) {
  transform: scale(1.01);
}

.quiz-choice:disabled {
  cursor: default;
}

.quiz-choice.quiz-correct {
  background: #2d6a4f;
  color: #fff;
}

.quiz-choice.quiz-wrong {
  background: #c1121f;
  color: #fff;
}

#quiz-result {
  text-align: center;
  font-size: 2rem;
  font-weight: 600;
  min-height: 1.5em;
  margin-bottom: 0.75rem;
}

#quiz-next {
  display: none;
  margin: 0 auto;
  font-family: inherit;
  font-size: clamp(1.4rem, 3.5vw, 1.6rem);
  padding: 0.75em 1.5em;
  min-height: 48px;
  min-width: min(100%, 10rem);
  border: none;
  border-radius: 2em;
  cursor: pointer;
  background: #28e;
  color: #fff;
  touch-action: manipulation;
}

/* ----- Typing ----- */
#typing-stats {
  text-align: center;
  font-size: 1.6rem;
  margin-bottom: 1rem;
  min-height: 2.4em;
}

#typing-target {
  font-size: clamp(1.35rem, 3.2vw, 2rem);
  line-height: 1.65;
  text-align: left;
  padding: clamp(0.85rem, 3vw, 1.25rem);
  border-radius: 0.75rem;
  background: rgba(0, 0, 0, 0.35);
  margin-bottom: 1rem;
  min-height: clamp(6rem, 28vh, 8em);
  white-space: pre-wrap;
  word-break: break-word;
  overflow-wrap: anywhere;
}

#typing-target .typing-ok {
  background: rgba(45, 106, 79, 0.55);
  color: #d8f3dc;
}

#typing-target .typing-bad {
  background: #c1121f;
}

#typing-input {
  width: 100%;
  max-width: 40rem;
  display: block;
  margin: 0 auto 1rem;
  font-family: ui-monospace, monospace;
  font-size: max(1.6rem, 16px);
  padding: 0.85rem 1rem;
  border-radius: 0.5rem;
  border: 2px solid rgba(255, 255, 255, 0.35);
  background: rgba(255, 255, 255, 0.95);
  color: #1a1a2e;
  resize: vertical;
  min-height: 5.5rem;
  touch-action: manipulation;
}

#typing-reset {
  display: block;
  margin: 0 auto;
  font-family: inherit;
  font-size: clamp(1.4rem, 3.5vw, 1.5rem);
  padding: 0.7em 1.4em;
  min-height: 44px;
  min-width: min(100%, 10rem);
  border: none;
  border-radius: 2em;
  cursor: pointer;
  background: #1c9882;
  color: #fff;
  touch-action: manipulation;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ----- Breakout ----- */
.breakout-hud {
  text-align: center;
  font-size: clamp(1.2rem, 3vw, 1.45rem);
  color: var(--site-text-muted, #94a3b8);
  margin-bottom: 0.75rem;
  min-height: 1.5em;
}

.breakout-wrap {
  max-width: min(100%, 36rem);
  margin: 0 auto 1rem;
  border-radius: 0.85rem;
  overflow: hidden;
  box-shadow: 0 10px 32px rgba(0, 0, 0, 0.4);
  touch-action: none;
  background: #020617;
}

.breakout-wrap canvas {
  display: block;
  width: 100%;
  height: auto;
  vertical-align: middle;
}

.breakout-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  justify-content: center;
  align-items: center;
}

.breakout-actions button {
  font-family: inherit;
  font-size: clamp(1.25rem, 3.2vw, 1.4rem);
  padding: 0.65em 1.35em;
  min-height: 44px;
  border: none;
  border-radius: 2em;
  cursor: pointer;
  touch-action: manipulation;
}

#breakout-start {
  background: linear-gradient(160deg, #2d6a4f, #1b4332);
  color: #fff;
}

#breakout-pause {
  background: rgba(148, 163, 184, 0.35);
  color: #f1f5f9;
}

.breakout-modes {
  max-width: 28rem;
  margin: 0 auto 1rem;
  padding: 0.65rem 0.85rem;
  border-radius: 0.65rem;
  border: 1px solid var(--site-border, rgba(255, 255, 255, 0.12));
  background: rgba(15, 23, 42, 0.45);
  font-size: clamp(0.95rem, 2.5vw, 1.05rem);
  color: var(--site-text-muted, #94a3b8);
}

.breakout-modes__opt {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
}

.breakout-modes__opt input {
  width: 1.1rem;
  height: 1.1rem;
  accent-color: #2dd4bf;
}

/* ----- Pong ----- */
.pong-hud {
  text-align: center;
  font-size: clamp(1.2rem, 3vw, 1.45rem);
  color: var(--site-text-muted, #94a3b8);
  margin-bottom: 0.75rem;
  min-height: 1.5em;
}

.pong-wrap {
  max-width: min(100%, 36rem);
  margin: 0 auto 1rem;
  border-radius: 0.85rem;
  overflow: hidden;
  box-shadow: 0 10px 32px rgba(0, 0, 0, 0.4);
  touch-action: none;
  background: #020617;
}

.pong-wrap canvas {
  display: block;
  width: 100%;
  height: auto;
  vertical-align: middle;
}

.pong-actions {
  display: flex;
  justify-content: center;
}

.pong-actions button {
  font-family: inherit;
  font-size: clamp(1.25rem, 3.2vw, 1.4rem);
  padding: 0.65em 1.35em;
  min-height: 44px;
  border: none;
  border-radius: 2em;
  cursor: pointer;
  touch-action: manipulation;
  background: linear-gradient(160deg, #3d5a80, #293241);
  color: #e0fbfc;
}

/* ----- Minesweeper ----- */
.mine-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem 1rem;
  align-items: center;
  justify-content: center;
  margin-bottom: 1rem;
}

.mine-hud {
  margin: 0;
  flex: 1 1 12rem;
  text-align: center;
  font-size: clamp(0.95rem, 2.5vw, 1.1rem);
  color: var(--site-text-muted, #94a3b8);
}

.mine-toolbar button {
  font-family: inherit;
  font-size: clamp(0.95rem, 2.4vw, 1.05rem);
  padding: 0.5em 1em;
  min-height: 44px;
  border-radius: 0.65rem;
  border: 1px solid rgba(148, 163, 184, 0.45);
  background: rgba(15, 23, 42, 0.6);
  color: #f1f5f9;
  cursor: pointer;
  touch-action: manipulation;
}

.mine-toolbar button[aria-pressed="true"] {
  border-color: #2dd4bf;
  color: #2dd4bf;
}

#mine-new {
  background: linear-gradient(160deg, #2d6a4f, #1b4332);
  border: none;
  color: #fff;
}

.mine-grid {
  display: grid;
  grid-template-columns: repeat(9, 1fr);
  gap: 4px;
  max-width: min(100%, 22rem);
  margin: 0 auto;
}

.mine-cell {
  aspect-ratio: 1;
  min-width: 0;
  min-height: 36px;
  border-radius: 4px;
  border: 1px solid rgba(148, 163, 184, 0.35);
  background: rgba(30, 41, 59, 0.95);
  color: #f8fafc;
  font-size: clamp(0.75rem, 2.8vw, 1rem);
  font-weight: 700;
  cursor: pointer;
  touch-action: manipulation;
  padding: 0;
}

.mine-cell.mine-open {
  background: rgba(15, 23, 42, 0.85);
  border-color: rgba(148, 163, 184, 0.2);
}

.mine-cell.mine-flag {
  background: rgba(45, 106, 79, 0.45);
}

.mine-cell.mine-boom {
  background: #7f1d1d;
  color: #fecaca;
}

.mine-n1 {
  color: #38bdf8;
}
.mine-n2 {
  color: #4ade80;
}
.mine-n3 {
  color: #f87171;
}
.mine-n4 {
  color: #a78bfa;
}
.mine-n5 {
  color: #fbbf24;
}
.mine-n6 {
  color: #22d3ee;
}
.mine-n7 {
  color: #f472b6;
}
.mine-n8 {
  color: #94a3b8;
}

/* ----- Hangman ----- */
.hangman-word {
  text-align: center;
  font-size: clamp(1.6rem, 5vw, 2.4rem);
  font-weight: 700;
  letter-spacing: 0.2em;
  color: #f1f5f9;
  margin: 0 0 1rem;
  font-family: ui-monospace, monospace;
}

.hangman-svg {
  max-width: 14rem;
  margin: 0 auto 1rem;
}

.hangman-svg-inner {
  width: 100%;
  height: auto;
  display: block;
}

.hangman-svg .hg-stroke {
  stroke: #e2e8f0;
  stroke-width: 5;
  fill: none;
  stroke-linecap: round;
}

.hangman-status {
  text-align: center;
  font-size: clamp(1.1rem, 2.8vw, 1.25rem);
  color: var(--site-text-muted, #94a3b8);
  margin-bottom: 1rem;
  min-height: 1.4em;
}

.hangman-keys {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  justify-content: center;
  max-width: 28rem;
  margin: 0 auto 1rem;
}

.hangman-key {
  min-width: 2.35rem;
  min-height: 44px;
  padding: 0 0.35rem;
  font-weight: 700;
  font-size: 1rem;
  border-radius: 0.4rem;
  border: 1px solid rgba(148, 163, 184, 0.4);
  background: rgba(15, 23, 42, 0.75);
  color: #f1f5f9;
  cursor: pointer;
  touch-action: manipulation;
}

.hangman-key:disabled {
  opacity: 0.35;
  cursor: default;
}

.hangman-new {
  display: block;
  margin: 0 auto;
  font-family: inherit;
  font-size: clamp(1.15rem, 3vw, 1.3rem);
  padding: 0.6em 1.3em;
  min-height: 44px;
  border: none;
  border-radius: 2em;
  cursor: pointer;
  background: #1c9882;
  color: #fff;
  touch-action: manipulation;
}

/* ----- Rock paper scissors ----- */
.rps-score {
  text-align: center;
  font-size: clamp(1.35rem, 3.5vw, 1.6rem);
  font-weight: 700;
  color: #f1f5f9;
  margin: 0 0 0.5rem;
}

.rps-last {
  text-align: center;
  font-size: clamp(1.05rem, 2.8vw, 1.2rem);
  color: var(--site-text-muted, #94a3b8);
  min-height: 2.6em;
  margin: 0 0 1.25rem;
}

.rps-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  justify-content: center;
  margin-bottom: 1.25rem;
}

.rps-btn {
  flex: 1 1 6.5rem;
  max-width: 10rem;
  min-height: 48px;
  font-family: inherit;
  font-size: clamp(1.1rem, 3vw, 1.25rem);
  font-weight: 700;
  border: none;
  border-radius: 0.75rem;
  cursor: pointer;
  touch-action: manipulation;
  background: linear-gradient(160deg, #5c4d7d, #3d3154);
  color: #ede9fe;
}

.rps-btn:active {
  transform: scale(0.98);
}

#rps-reset {
  display: block;
  margin: 0 auto;
  font-family: inherit;
  font-size: clamp(1rem, 2.6vw, 1.1rem);
  padding: 0.5em 1.2em;
  min-height: 44px;
  border-radius: 2em;
  border: 1px solid rgba(148, 163, 184, 0.45);
  background: rgba(15, 23, 42, 0.6);
  color: #e2e8f0;
  cursor: pointer;
  touch-action: manipulation;
}

/* ----- 15 puzzle ----- */
.fifteen-meta {
  text-align: center;
  font-size: clamp(1.05rem, 2.8vw, 1.2rem);
  color: var(--site-text-muted, #94a3b8);
  margin-bottom: 1rem;
}

.fifteen-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
  max-width: min(100%, 20rem);
  margin: 0 auto 1.25rem;
}

.fifteen-cell {
  aspect-ratio: 1;
  min-height: 48px;
  border-radius: 0.5rem;
  border: 2px solid rgba(148, 163, 184, 0.35);
  background: linear-gradient(165deg, #334155, #1e293b);
  color: #f8fafc;
  font-size: clamp(1.25rem, 4vw, 1.6rem);
  font-weight: 800;
  cursor: pointer;
  touch-action: manipulation;
}

.fifteen-cell.fifteen-empty {
  visibility: hidden;
  cursor: default;
  border-color: transparent;
  background: transparent;
}

#fifteen-shuffle {
  display: block;
  margin: 0 auto;
  font-family: inherit;
  font-size: clamp(1.15rem, 3vw, 1.3rem);
  padding: 0.6em 1.3em;
  min-height: 44px;
  border: none;
  border-radius: 2em;
  cursor: pointer;
  background: linear-gradient(160deg, #2d6a4f, #1b4332);
  color: #fff;
  touch-action: manipulation;
}

/* ----- Lights Out ----- */
.lights-meta {
  text-align: center;
  font-size: clamp(1.05rem, 2.8vw, 1.2rem);
  color: var(--site-text-muted, #94a3b8);
  margin-bottom: 1rem;
}

.lights-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 6px;
  max-width: min(100%, 18rem);
  margin: 0 auto 1.25rem;
}

.lights-cell {
  aspect-ratio: 1;
  min-height: 44px;
  border-radius: 0.45rem;
  border: 2px solid rgba(148, 163, 184, 0.35);
  background: #0f172a;
  cursor: pointer;
  touch-action: manipulation;
}

.lights-cell.lights-on {
  background: radial-gradient(circle at 35% 30%, #fde68a, #f59e0b 55%, #b45309);
  border-color: rgba(251, 191, 36, 0.85);
  box-shadow: 0 0 14px rgba(245, 158, 11, 0.45);
}

#lights-new {
  display: block;
  margin: 0 auto;
  font-family: inherit;
  font-size: clamp(1.1rem, 3vw, 1.25rem);
  padding: 0.55em 1.25em;
  min-height: 44px;
  border: none;
  border-radius: 2em;
  cursor: pointer;
  background: #1c9882;
  color: #fff;
  touch-action: manipulation;
}

/* ----- Guess the number ----- */
.guess-label {
  display: block;
  text-align: center;
  font-size: clamp(0.95rem, 2.4vw, 1.05rem);
  color: var(--site-text-muted, #94a3b8);
  margin-bottom: 0.35rem;
}

.guess-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  justify-content: center;
  align-items: stretch;
  margin-bottom: 1rem;
}

#guess-input {
  width: min(100%, 12rem);
  font-size: max(1.35rem, 16px);
  padding: 0.65rem 0.85rem;
  border-radius: 0.55rem;
  border: 2px solid rgba(148, 163, 184, 0.45);
  background: rgba(15, 23, 42, 0.85);
  color: #f1f5f9;
}

#guess-submit {
  font-family: inherit;
  font-size: clamp(1.1rem, 3vw, 1.2rem);
  padding: 0.55em 1.2em;
  min-height: 44px;
  border: none;
  border-radius: 0.55rem;
  cursor: pointer;
  background: linear-gradient(160deg, #3d5a80, #293241);
  color: #e0fbfc;
  touch-action: manipulation;
}

.guess-feedback {
  text-align: center;
  font-size: clamp(1.2rem, 3.2vw, 1.45rem);
  font-weight: 600;
  color: #f1f5f9;
  min-height: 1.5em;
  margin: 0 0 0.35rem;
}

.guess-tries {
  text-align: center;
  font-size: clamp(1rem, 2.6vw, 1.1rem);
  color: var(--site-text-muted, #94a3b8);
  margin: 0 0 1.25rem;
}

#guess-new {
  display: block;
  margin: 0 auto;
  font-family: inherit;
  font-size: clamp(1.05rem, 2.8vw, 1.15rem);
  padding: 0.5em 1.15em;
  min-height: 44px;
  border-radius: 2em;
  border: 1px solid rgba(148, 163, 184, 0.45);
  background: rgba(15, 23, 42, 0.6);
  color: #e2e8f0;
  cursor: pointer;
  touch-action: manipulation;
}

/* ----- Connect Four ----- */
.c4-status {
  text-align: center;
  font-size: clamp(1.1rem, 2.9vw, 1.25rem);
  color: var(--site-text-muted, #94a3b8);
  margin-bottom: 0.85rem;
  min-height: 1.4em;
}

.c4-drop {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  justify-content: center;
  margin-bottom: 0.65rem;
}

.c4-drop-btn {
  min-width: 2.5rem;
  min-height: 44px;
  padding: 0 0.4rem;
  font-weight: 800;
  font-size: 0.95rem;
  border-radius: 0.45rem;
  border: 1px solid rgba(148, 163, 184, 0.45);
  background: rgba(30, 41, 59, 0.9);
  color: #e2e8f0;
  cursor: pointer;
  touch-action: manipulation;
}

.c4-board {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 5px;
  max-width: min(100%, 28rem);
  margin: 0 auto 1.15rem;
  padding: 0.5rem;
  border-radius: 0.65rem;
  background: linear-gradient(180deg, #1d4ed8, #1e3a8a);
  box-shadow: inset 0 2px 12px rgba(0, 0, 0, 0.35);
}

.c4-cell {
  aspect-ratio: 1;
  min-width: 0;
  min-height: 32px;
  border-radius: 50%;
  background: #0f172a;
  box-shadow: inset 0 2px 6px rgba(0, 0, 0, 0.45);
}

.c4-cell.c4-user {
  background: radial-gradient(circle at 35% 30%, #fca5a5, #dc2626 60%, #7f1d1d);
  box-shadow: 0 2px 8px rgba(220, 38, 38, 0.45);
}

.c4-cell.c4-ai {
  background: radial-gradient(circle at 35% 30%, #fde047, #eab308 55%, #854d0e);
  box-shadow: 0 2px 8px rgba(234, 179, 8, 0.4);
}

#c4-new {
  display: block;
  margin: 0 auto;
  font-family: inherit;
  font-size: clamp(1.1rem, 3vw, 1.25rem);
  padding: 0.55em 1.25em;
  min-height: 44px;
  border: none;
  border-radius: 2em;
  cursor: pointer;
  background: linear-gradient(160deg, #2d6a4f, #1b4332);
  color: #fff;
  touch-action: manipulation;
}

/* ----- Stopwatch ----- */
.sw-display {
  text-align: center;
  font-variant-numeric: tabular-nums;
  font-size: clamp(2.4rem, 8vw, 3.5rem);
  font-weight: 700;
  font-family: ui-monospace, monospace;
  color: #f1f5f9;
  margin: 0 0 1rem;
  letter-spacing: 0.02em;
}

.sw-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  justify-content: center;
  margin-bottom: 1.25rem;
}

.sw-actions button {
  font-family: inherit;
  font-size: clamp(1.05rem, 2.8vw, 1.15rem);
  padding: 0.55em 1.15em;
  min-height: 44px;
  border-radius: 0.65rem;
  border: 1px solid rgba(148, 163, 184, 0.45);
  background: rgba(30, 41, 59, 0.9);
  color: #f1f5f9;
  cursor: pointer;
  touch-action: manipulation;
}

.sw-actions button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

#sw-start {
  background: linear-gradient(160deg, #2d6a4f, #1b4332);
  border: none;
  color: #fff;
}

.sw-laps {
  max-width: 28rem;
  margin: 0 auto;
  padding-left: 1.25rem;
  color: var(--site-text-muted, #94a3b8);
  font-size: clamp(0.95rem, 2.5vw, 1.05rem);
  line-height: 1.5;
  max-height: 40vh;
  overflow: auto;
}

/* ----- Tower of Hanoi ----- */
.hanoi-meta {
  text-align: center;
  font-size: clamp(1.05rem, 2.8vw, 1.2rem);
  color: var(--site-text-muted, #94a3b8);
  margin-bottom: 1rem;
  min-height: 2.6em;
}

.hanoi-board {
  display: flex;
  justify-content: center;
  align-items: flex-end;
  gap: clamp(0.35rem, 2vw, 1rem);
  min-height: 14rem;
  margin-bottom: 1.25rem;
  padding: 0 0.25rem;
}

.hanoi-peg {
  flex: 1 1 5.5rem;
  max-width: 8rem;
  min-height: 13rem;
  border: none;
  border-radius: 0.5rem 0.5rem 0 0;
  background: linear-gradient(180deg, rgba(30, 41, 59, 0.5), rgba(15, 23, 42, 0.95));
  cursor: pointer;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  align-items: center;
  padding: 0 0.25rem 0.35rem;
  touch-action: manipulation;
  box-shadow: inset 0 -6px 0 rgba(148, 163, 184, 0.35);
}

.hanoi-peg--active {
  outline: 2px solid #2dd4bf;
  outline-offset: 2px;
}

.hanoi-stack {
  display: flex;
  flex-direction: column-reverse;
  align-items: center;
  gap: 4px;
  width: 100%;
}

.hanoi-disk {
  height: 1.65rem;
  width: var(--w, 60%);
  max-width: 100%;
  border-radius: 4px;
  background: linear-gradient(180deg, #60a5fa, #2563eb);
  color: #0f172a;
  font-weight: 800;
  font-size: 0.85rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

.hanoi-disk--ghost {
  opacity: 0.85;
  box-shadow: 0 0 0 2px #2dd4bf;
}

#hanoi-reset {
  display: block;
  margin: 0 auto;
  font-family: inherit;
  font-size: clamp(1.1rem, 3vw, 1.25rem);
  padding: 0.55em 1.25em;
  min-height: 44px;
  border: none;
  border-radius: 2em;
  cursor: pointer;
  background: rgba(148, 163, 184, 0.25);
  color: #f1f5f9;
  touch-action: manipulation;
}

/* ----- Blackjack ----- */
.bj-section {
  margin-bottom: 1rem;
}

.bj-label {
  margin: 0 0 0.35rem;
  font-size: clamp(0.85rem, 2.2vw, 0.95rem);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--site-text-muted, #94a3b8);
}

.bj-hand {
  margin: 0 0 0.25rem;
  font-size: clamp(1.25rem, 3.5vw, 1.5rem);
  font-weight: 600;
  color: #f8fafc;
  font-family: ui-monospace, monospace;
}

.bj-sum {
  margin: 0;
  font-size: clamp(1rem, 2.6vw, 1.1rem);
  color: #94a3b8;
}

.bj-status {
  text-align: center;
  font-size: clamp(1.15rem, 3vw, 1.3rem);
  font-weight: 600;
  color: #e2e8f0;
  min-height: 1.5em;
  margin-bottom: 1rem;
}

.bj-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  justify-content: center;
}

.bj-actions button {
  font-family: inherit;
  font-size: clamp(1.05rem, 2.8vw, 1.15rem);
  padding: 0.55em 1.2em;
  min-height: 44px;
  border-radius: 0.65rem;
  border: none;
  cursor: pointer;
  touch-action: manipulation;
}

#bj-deal {
  background: linear-gradient(160deg, #2d6a4f, #1b4332);
  color: #fff;
}

#bj-hit,
#bj-stand {
  background: rgba(30, 41, 59, 0.95);
  color: #f1f5f9;
  border: 1px solid rgba(148, 163, 184, 0.45);
}

.bj-actions button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

/* ----- Bulls & cows ----- */
.bulls-mode {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1.25rem;
  justify-content: center;
  align-items: center;
  margin-bottom: 0.85rem;
  font-size: clamp(1rem, 2.6vw, 1.1rem);
  color: var(--site-text-muted, #94a3b8);
}

.bulls-mode__opt {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  cursor: pointer;
}

.bulls-mode__opt input {
  accent-color: #2dd4bf;
}

.bulls-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  justify-content: center;
  align-items: stretch;
  margin-bottom: 1rem;
}

#bulls-input {
  width: min(100%, 9rem);
  font-size: max(1.5rem, 18px);
  text-align: center;
  letter-spacing: 0.25em;
  padding: 0.65rem 0.5rem;
  border-radius: 0.55rem;
  border: 2px solid rgba(148, 163, 184, 0.45);
  background: rgba(15, 23, 42, 0.85);
  color: #f1f5f9;
}

#bulls-input.bulls-input--wide {
  width: min(100%, 13rem);
  letter-spacing: 0.12em;
}

#bulls-submit {
  font-family: inherit;
  font-size: clamp(1.1rem, 3vw, 1.2rem);
  padding: 0.55em 1.2em;
  min-height: 44px;
  border: none;
  border-radius: 0.55rem;
  cursor: pointer;
  background: linear-gradient(160deg, #3d5a80, #293241);
  color: #e0fbfc;
  touch-action: manipulation;
}

.bulls-feedback {
  text-align: center;
  font-size: clamp(1.1rem, 2.9vw, 1.25rem);
  color: #e2e8f0;
  margin: 0 0 0.75rem;
  min-height: 1.4em;
}

.bulls-log {
  max-width: 24rem;
  margin: 0 auto 1.25rem;
  padding-left: 1.25rem;
  color: var(--site-text-muted, #94a3b8);
  font-size: clamp(0.95rem, 2.5vw, 1.05rem);
  line-height: 1.45;
  max-height: 36vh;
  overflow: auto;
}

#bulls-new {
  display: block;
  margin: 0 auto;
  font-family: inherit;
  font-size: clamp(1.05rem, 2.8vw, 1.15rem);
  padding: 0.5em 1.15em;
  min-height: 44px;
  border-radius: 2em;
  border: 1px solid rgba(148, 163, 184, 0.45);
  background: rgba(15, 23, 42, 0.6);
  color: #e2e8f0;
  cursor: pointer;
  touch-action: manipulation;
}

/* ----- Flappy ----- */
.flappy-hud {
  text-align: center;
  font-size: clamp(1.05rem, 2.8vw, 1.2rem);
  color: var(--site-text-muted, #94a3b8);
  margin-bottom: 0.75rem;
  min-height: 1.4em;
}

.flappy-wrap {
  max-width: min(100%, 22.5rem);
  margin: 0 auto 1rem;
  border-radius: 0.85rem;
  overflow: hidden;
  box-shadow: 0 10px 32px rgba(0, 0, 0, 0.4);
  touch-action: manipulation;
  background: #020617;
}

.flappy-wrap canvas {
  display: block;
  width: 100%;
  height: auto;
  vertical-align: middle;
}

#flappy-start {
  display: block;
  margin: 0 auto;
  font-family: inherit;
  font-size: clamp(1.15rem, 3vw, 1.3rem);
  padding: 0.6em 1.3em;
  min-height: 44px;
  border: none;
  border-radius: 2em;
  cursor: pointer;
  background: linear-gradient(160deg, #2d6a4f, #1b4332);
  color: #fff;
  touch-action: manipulation;
}

/* ----- Phase 2 canvas (Dodge → Invaders → Asteroids → Pong2P) ----- */

.dodge-hud,
.invaders-hud,
.ast-hud,
.pong2p-hud {
  text-align: center;
  font-size: clamp(1.05rem, 2.8vw, 1.25rem);
  color: var(--site-text-muted, #94a3b8);
  margin-bottom: 0.75rem;
  min-height: 1.5em;
}

.dodge-wrap,
.invaders-wrap,
.ast-wrap,
.pong2p-wrap {
  max-width: min(100%, 36rem);
  margin: 0 auto 1rem;
  border-radius: 0.85rem;
  overflow: hidden;
  box-shadow: 0 10px 32px rgba(0, 0, 0, 0.4);
  touch-action: none;
  background: #020617;
}

.ast-wrap {
  max-width: min(100%, 32rem);
}

.dodge-wrap canvas,
.invaders-wrap canvas,
.ast-wrap canvas,
.pong2p-wrap canvas {
  display: block;
  width: 100%;
  height: auto;
  vertical-align: middle;
}

.dodge-actions,
.invaders-actions,
.ast-actions,
.pong2p-actions {
  display: flex;
  justify-content: center;
}

.dodge-actions button,
.invaders-actions button,
.ast-actions button,
.pong2p-actions button {
  font-family: inherit;
  font-size: clamp(1.1rem, 3vw, 1.25rem);
  padding: 0.6em 1.35em;
  min-height: 44px;
  border: none;
  border-radius: 2em;
  cursor: pointer;
  touch-action: manipulation;
  background: linear-gradient(160deg, #3d5a80, #293241);
  color: #e0fbfc;
}

/* ----- Sudoku 4×4 ----- */
.sudoku4-meta {
  text-align: center;
  font-size: clamp(1.05rem, 2.8vw, 1.2rem);
  color: var(--site-text-muted, #94a3b8);
  margin-bottom: 1rem;
  min-height: 1.4em;
}

.sudoku4-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
  max-width: min(100%, 16rem);
  margin: 0 auto 1rem;
}

.sudoku4-cell {
  aspect-ratio: 1;
  min-height: 48px;
  border-radius: 0.45rem;
  border: 2px solid rgba(148, 163, 184, 0.45);
  background: rgba(15, 23, 42, 0.85);
  color: #f8fafc;
  font-size: clamp(1.35rem, 4vw, 1.75rem);
  font-weight: 800;
  cursor: pointer;
  touch-action: manipulation;
}

.sudoku4-cell--given {
  background: rgba(30, 41, 59, 0.95);
  color: #94a3b8;
  cursor: default;
}

.sudoku4-cell--sel {
  outline: 2px solid #2dd4bf;
  outline-offset: 2px;
}

.sudoku4-cell--boxr {
  box-shadow: inset -3px 0 0 rgba(45, 212, 191, 0.25);
}

.sudoku4-cell--boxb {
  box-shadow: inset 0 -3px 0 rgba(45, 212, 191, 0.25);
}

.sudoku4-cell--boxr.sudoku4-cell--boxb {
  box-shadow:
    inset -3px 0 0 rgba(45, 212, 191, 0.25),
    inset 0 -3px 0 rgba(45, 212, 191, 0.25);
}

.sudoku4-pad {
  display: flex;
  gap: 0.5rem;
  justify-content: center;
  margin-bottom: 1rem;
}

.sudoku4-digit {
  min-width: 3rem;
  min-height: 48px;
  font-size: 1.35rem;
  font-weight: 800;
  border-radius: 0.5rem;
  border: none;
  cursor: pointer;
  background: linear-gradient(160deg, #3d5a80, #293241);
  color: #e0fbfc;
  touch-action: manipulation;
}

.sudoku4-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  justify-content: center;
}

.sudoku4-actions button {
  font-family: inherit;
  font-size: clamp(1rem, 2.6vw, 1.1rem);
  padding: 0.5em 1em;
  min-height: 44px;
  border-radius: 0.65rem;
  border: 1px solid rgba(148, 163, 184, 0.45);
  background: rgba(30, 41, 59, 0.9);
  color: #f1f5f9;
  cursor: pointer;
  touch-action: manipulation;
}

#sudoku4-new {
  background: linear-gradient(160deg, #2d6a4f, #1b4332);
  border: none;
  color: #fff;
}

#sudoku4-daily {
  background: linear-gradient(160deg, #1e3a5f, #0f172a);
  border: 1px solid rgba(56, 189, 248, 0.4);
  color: #e0f2fe;
}

/* ----- Dice roller ----- */
.dice-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 0.65rem;
  margin-bottom: 1rem;
}

.dice-toolbar label {
  font-weight: 600;
  color: var(--site-text-muted, #94a3b8);
}

#dice-count {
  width: min(100%, 12rem);
  accent-color: #2dd4bf;
}

.dice-count-val {
  font-weight: 800;
  font-size: 1.25rem;
  color: #f1f5f9;
  min-width: 1.25rem;
}

.dice-faces {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  justify-content: center;
  min-height: 4.5rem;
  margin-bottom: 0.75rem;
}

.dice-face {
  font-size: clamp(2.8rem, 12vw, 4rem);
  line-height: 1;
  user-select: none;
}

.dice-sum {
  text-align: center;
  font-size: clamp(1.35rem, 3.5vw, 1.6rem);
  font-weight: 700;
  color: #f1f5f9;
  margin: 0 0 1rem;
}

.dice-actions {
  display: flex;
  justify-content: center;
  margin-bottom: 1.25rem;
}

#dice-roll {
  font-family: inherit;
  font-size: clamp(1.15rem, 3vw, 1.3rem);
  padding: 0.6em 1.4em;
  min-height: 44px;
  border: none;
  border-radius: 2em;
  cursor: pointer;
  background: linear-gradient(160deg, #2d6a4f, #1b4332);
  color: #fff;
  touch-action: manipulation;
}

#dice-roll:disabled {
  opacity: 0.55;
  cursor: wait;
}

.dice-log {
  max-width: 28rem;
  margin: 0 auto;
  padding-left: 1.25rem;
  color: var(--site-text-muted, #94a3b8);
  font-size: clamp(0.92rem, 2.4vw, 1.02rem);
  line-height: 1.45;
  max-height: 32vh;
  overflow: auto;
}

/* ----- Mastermind ----- */
.mm-meta {
  text-align: center;
  font-size: clamp(1.05rem, 2.8vw, 1.2rem);
  color: var(--site-text-muted, #94a3b8);
  margin-bottom: 0.75rem;
  min-height: 1.4em;
}

.mm-secret {
  display: flex;
  justify-content: center;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.mm-secret-dot {
  width: 2rem;
  height: 2rem;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.35);
}

.mm-secret-dot--hidden {
  background: rgba(148, 163, 184, 0.35) !important;
}

.mm-palette {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  justify-content: center;
  margin-bottom: 1rem;
}

.mm-swatch {
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 50%;
  border: 3px solid transparent;
  cursor: pointer;
  touch-action: manipulation;
}

.mm-swatch--sel {
  border-color: #f8fafc;
  box-shadow: 0 0 0 2px #0f172a;
}

.mm-current {
  text-align: center;
  margin-bottom: 1rem;
}

.mm-label {
  display: block;
  font-size: 0.85rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--site-text-muted, #94a3b8);
  margin-bottom: 0.5rem;
}

.mm-slots {
  display: flex;
  gap: 0.5rem;
  justify-content: center;
  margin-bottom: 0.75rem;
}

.mm-slot {
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 50%;
  border: 2px dashed rgba(148, 163, 184, 0.6);
  background: rgba(15, 23, 42, 0.6);
  cursor: pointer;
  touch-action: manipulation;
}

#mm-submit {
  font-family: inherit;
  font-size: clamp(1.05rem, 2.8vw, 1.15rem);
  padding: 0.55em 1.2em;
  min-height: 44px;
  border: none;
  border-radius: 2em;
  cursor: pointer;
  background: linear-gradient(160deg, #3d5a80, #293241);
  color: #e0fbfc;
  touch-action: manipulation;
}

#mm-submit:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.mm-board {
  max-width: 22rem;
  margin: 0 auto 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.mm-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.4rem 0.5rem;
  border-radius: 0.5rem;
  background: rgba(15, 23, 42, 0.55);
}

.mm-row-pegs {
  display: flex;
  gap: 0.35rem;
}

.mm-mini {
  width: 1.35rem;
  height: 1.35rem;
  border-radius: 50%;
  border: 1px solid rgba(0, 0, 0, 0.25);
}

.mm-feedback {
  font-size: 0.95rem;
  font-weight: 600;
  color: #e2e8f0;
  white-space: nowrap;
}

#mm-new {
  display: block;
  margin: 0 auto;
  font-family: inherit;
  font-size: clamp(1.05rem, 2.8vw, 1.15rem);
  padding: 0.5em 1.15em;
  min-height: 44px;
  border-radius: 2em;
  border: 1px solid rgba(148, 163, 184, 0.45);
  background: rgba(30, 41, 59, 0.85);
  color: #f1f5f9;
  cursor: pointer;
  touch-action: manipulation;
}

/* ----- Coin streak ----- */
.coin-stats {
  text-align: center;
  font-size: clamp(1.2rem, 3.2vw, 1.45rem);
  font-weight: 700;
  color: #f1f5f9;
  margin: 0 0 1rem;
}

.coin-display {
  text-align: center;
  font-size: clamp(2.5rem, 10vw, 4rem);
  font-weight: 800;
  color: #fde047;
  margin: 0 0 1rem;
  min-height: 1.2em;
  text-shadow: 0 2px 12px rgba(0, 0, 0, 0.35);
}

.coin-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  justify-content: center;
  margin-bottom: 1rem;
}

.coin-btn {
  flex: 1 1 8rem;
  max-width: 12rem;
  min-height: 52px;
  font-family: inherit;
  font-size: clamp(1.15rem, 3vw, 1.3rem);
  font-weight: 700;
  border: none;
  border-radius: 0.75rem;
  cursor: pointer;
  touch-action: manipulation;
  color: #0f172a;
}

.coin-btn[data-side="heads"] {
  background: linear-gradient(160deg, #e2e8f0, #94a3b8);
}

.coin-btn[data-side="tails"] {
  background: linear-gradient(160deg, #fcd34d, #d97706);
}

.coin-last {
  text-align: center;
  font-size: clamp(1.05rem, 2.8vw, 1.2rem);
  color: var(--site-text-muted, #94a3b8);
  min-height: 1.4em;
  margin: 0 0 1.25rem;
}

#coin-reset {
  display: block;
  margin: 0 auto;
  font-size: clamp(1rem, 2.6vw, 1.1rem);
  padding: 0.5em 1.1em;
  min-height: 44px;
  border-radius: 2em;
  border: 1px solid rgba(148, 163, 184, 0.45);
  background: rgba(15, 23, 42, 0.6);
  color: #e2e8f0;
  cursor: pointer;
  touch-action: manipulation;
}

/* ----- Nim ----- */
.nim-meta {
  text-align: center;
  font-size: clamp(1.05rem, 2.8vw, 1.15rem);
  color: var(--site-text-muted, #94a3b8);
  min-height: 2.75em;
  margin: 0 0 0.75rem;
  line-height: 1.45;
}

.nim-pile {
  display: flex;
  flex-wrap: wrap;
  gap: 0.28rem;
  justify-content: center;
  align-content: flex-start;
  min-height: 4.5rem;
  max-width: 22rem;
  margin: 0 auto 1rem;
  padding: 0.65rem;
  border-radius: 0.75rem;
  background: rgba(15, 23, 42, 0.55);
  border: 1px solid var(--site-border, rgba(255, 255, 255, 0.1));
}

.nim-stone {
  width: 0.65rem;
  height: 0.65rem;
  border-radius: 50%;
  background: radial-gradient(circle at 30% 25%, #6ee7b7, #059669 65%, #064e3b);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.35);
}

.nim-pile-more {
  align-self: center;
  font-size: clamp(0.95rem, 2.5vw, 1.05rem);
  font-weight: 700;
  color: var(--site-text-muted, #94a3b8);
  padding: 0.15rem 0.35rem;
}

.nim-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  justify-content: center;
  margin-bottom: 1rem;
}

.nim-actions .nim-take {
  font-family: inherit;
  font-size: clamp(1.05rem, 2.8vw, 1.15rem);
  padding: 0.55em 1.1em;
  min-height: 44px;
  min-width: 5.5rem;
  border: none;
  border-radius: 0.65rem;
  cursor: pointer;
  touch-action: manipulation;
  background: linear-gradient(160deg, #2d6a4f, #1b4332);
  color: #fff;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.3);
}

.nim-actions .nim-take:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

#nim-new {
  display: block;
  margin: 0 auto;
  font-family: inherit;
  font-size: clamp(1rem, 2.6vw, 1.1rem);
  padding: 0.5em 1.25em;
  min-height: 44px;
  border-radius: 2em;
  border: 1px solid rgba(148, 163, 184, 0.45);
  background: rgba(15, 23, 42, 0.6);
  color: #e2e8f0;
  cursor: pointer;
  touch-action: manipulation;
}

/* ----- Hi-Lo streak ----- */
.hilo-stats {
  text-align: center;
  font-size: clamp(1.05rem, 2.8vw, 1.15rem);
  color: var(--site-text-muted, #94a3b8);
  margin: 0 0 1rem;
}

.hilo-board {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  justify-content: center;
  align-items: stretch;
  margin-bottom: 1rem;
}

.hilo-card {
  min-width: min(100%, 8.5rem);
  min-height: 10.5rem;
  padding: 1rem 0.75rem;
  border-radius: 0.85rem;
  background: linear-gradient(165deg, #f8fafc, #e2e8f0);
  border: 1px solid rgba(15, 23, 42, 0.12);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.28);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: clamp(2rem, 7vw, 2.75rem);
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  color: #0f172a;
}

.hilo-card--ghost {
  background: rgba(30, 41, 59, 0.55);
  border-color: rgba(148, 163, 184, 0.35);
  color: #e2e8f0;
}

.hilo-rank--red {
  color: #dc2626;
}

.hilo-next-placeholder {
  opacity: 0.65;
  font-weight: 700;
}

.hilo-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  justify-content: center;
  margin-bottom: 0.75rem;
}

.hilo-actions button {
  font-family: inherit;
  font-size: clamp(1.05rem, 2.8vw, 1.15rem);
  padding: 0.55em 1.35em;
  min-height: 44px;
  min-width: 7rem;
  border: none;
  border-radius: 0.65rem;
  cursor: pointer;
  touch-action: manipulation;
  color: #fff;
}

#hilo-high {
  background: linear-gradient(160deg, #2563eb, #1e40af);
}

#hilo-low {
  background: linear-gradient(160deg, #7c3aed, #5b21b6);
}

.hilo-actions button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.hilo-msg {
  text-align: center;
  font-size: clamp(1rem, 2.6vw, 1.1rem);
  color: var(--site-text-muted, #94a3b8);
  min-height: 1.5em;
  margin: 0 0 1rem;
}

#hilo-new {
  display: block;
  margin: 0 auto;
  font-family: inherit;
  font-size: clamp(1rem, 2.6vw, 1.1rem);
  padding: 0.5em 1.15em;
  min-height: 44px;
  border-radius: 2em;
  border: 1px solid rgba(148, 163, 184, 0.45);
  background: rgba(15, 23, 42, 0.6);
  color: #e2e8f0;
  cursor: pointer;
  touch-action: manipulation;
}

/* ----- Sokoban mini ----- */
.sok-levels,
.pipe-levels,
.nono-levels {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  justify-content: center;
  margin-bottom: 0.75rem;
}

.sok-level-btn,
.pipe-level-btn,
.nono-level-btn {
  font-family: inherit;
  font-size: clamp(1rem, 2.6vw, 1.1rem);
  min-width: 2.75rem;
  min-height: 44px;
  padding: 0.35em 0.65em;
  border-radius: 0.55rem;
  border: 1px solid rgba(148, 163, 184, 0.45);
  background: rgba(30, 41, 59, 0.9);
  color: #e2e8f0;
  cursor: pointer;
  touch-action: manipulation;
}

.sok-level-btn[aria-pressed="true"],
.pipe-level-btn[aria-pressed="true"],
.nono-level-btn[aria-pressed="true"] {
  outline: 2px solid #2dd4bf;
  outline-offset: 2px;
}

.sok-hud,
.pipe-hud,
.nono-hud {
  text-align: center;
  font-size: clamp(1rem, 2.6vw, 1.1rem);
  color: var(--site-text-muted, #94a3b8);
  margin: 0 0 1rem;
  min-height: 1.5em;
}

.sok-grid {
  display: grid;
  gap: 3px;
  max-width: min(100%, 22rem);
  margin: 0 auto 1rem;
  padding: 0.35rem;
  border-radius: 0.65rem;
  background: rgba(15, 23, 42, 0.55);
  border: 1px solid rgba(148, 163, 184, 0.25);
}

.sok-cell {
  aspect-ratio: 1;
  min-width: 0;
  min-height: 36px;
  border-radius: 0.35rem;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: clamp(1rem, 3.5vw, 1.35rem);
  font-weight: 800;
}

.sok-cell--wall {
  background: #0f172a;
  box-shadow: inset 0 0 0 1px rgba(15, 23, 42, 0.8);
}

.sok-cell--floor {
  background: rgba(51, 65, 85, 0.65);
}

.sok-cell--goal {
  background: rgba(45, 106, 79, 0.45);
  box-shadow: inset 0 0 0 2px rgba(45, 212, 191, 0.35);
}

.sok-cell--box {
  background: linear-gradient(160deg, #b45309, #92400e);
  color: #fffbeb;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.35);
}

.sok-cell--player {
  outline: 2px solid #2dd4bf;
  outline-offset: -2px;
}

.sok-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  justify-content: center;
}

.sok-actions button {
  font-family: inherit;
  font-size: clamp(1rem, 2.6vw, 1.1rem);
  padding: 0.5em 1.15em;
  min-height: 44px;
  border-radius: 0.65rem;
  border: 1px solid rgba(148, 163, 184, 0.45);
  background: rgba(30, 41, 59, 0.9);
  color: #f1f5f9;
  cursor: pointer;
  touch-action: manipulation;
}

.sok-actions button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

/* ----- Pipe mini ----- */
.pipe-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 4px;
  max-width: min(100%, 22rem);
  margin: 0 auto 1rem;
  padding: 0.35rem;
  border-radius: 0.65rem;
  background: rgba(15, 23, 42, 0.55);
  border: 1px solid rgba(148, 163, 184, 0.25);
}

.pipe-cell {
  aspect-ratio: 1;
  min-height: 40px;
  border-radius: 0.4rem;
  border: 1px solid rgba(148, 163, 184, 0.35);
  background: rgba(30, 41, 59, 0.95);
  color: #e0f2fe;
  font-family: ui-monospace, "Cascadia Code", "Consolas", monospace;
  font-size: clamp(1.15rem, 4vw, 1.5rem);
  line-height: 1;
  cursor: pointer;
  touch-action: manipulation;
}

.pipe-cell--empty {
  background: rgba(15, 23, 42, 0.35);
  border-color: transparent;
  cursor: default;
}

.pipe-cell--source {
  box-shadow: inset 0 0 0 2px rgba(45, 212, 191, 0.65);
}

.pipe-cell--sink {
  box-shadow: inset 0 0 0 2px rgba(96, 165, 250, 0.55);
}

.pipe-actions {
  display: flex;
  justify-content: center;
}

.pipe-actions button {
  font-family: inherit;
  font-size: clamp(1rem, 2.6vw, 1.1rem);
  padding: 0.5em 1.25em;
  min-height: 44px;
  border-radius: 0.65rem;
  border: none;
  cursor: pointer;
  touch-action: manipulation;
  background: linear-gradient(160deg, #2d6a4f, #1b4332);
  color: #fff;
}

/* ----- Nonogram 5×5 ----- */
.nono-board {
  display: grid;
  grid-template-columns: minmax(2.25rem, auto) minmax(0, 1fr);
  grid-template-rows: auto minmax(0, 1fr);
  grid-template-areas:
    "corner cols"
    "rows main";
  gap: 6px;
  max-width: min(100%, 19rem);
  margin: 0 auto 1rem;
  align-items: stretch;
}

.nono-corner {
  grid-area: corner;
}

#nono-col-clues {
  grid-area: cols;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 4px;
}

#nono-row-clues {
  grid-area: rows;
  display: grid;
  grid-template-rows: repeat(5, 1fr);
  gap: 4px;
}

#nono-grid {
  grid-area: main;
  display: grid;
  gap: 4px;
}

.nono-clue {
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  font-size: clamp(0.75rem, 2.2vw, 0.9rem);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: #cbd5e1;
  background: rgba(15, 23, 42, 0.5);
  border-radius: 0.35rem;
  padding: 0.2rem 0.15rem;
  min-height: 0;
}

.nono-clue--col {
  flex-direction: column;
  white-space: pre-line;
  line-height: 1.15;
}

.nono-cell {
  aspect-ratio: 1;
  min-width: 0;
  min-height: 36px;
  border-radius: 0.35rem;
  border: 1px solid rgba(148, 163, 184, 0.4);
  background: rgba(30, 41, 59, 0.85);
  color: #94a3b8;
  font-size: clamp(1rem, 3vw, 1.25rem);
  font-weight: 800;
  cursor: pointer;
  touch-action: manipulation;
}

.nono-cell--fill {
  background: linear-gradient(160deg, #334155, #1e293b);
  color: #0f172a;
}

.nono-cell--mark {
  color: #f87171;
}

.nono-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  justify-content: center;
}

.nono-actions button {
  font-family: inherit;
  font-size: clamp(1rem, 2.6vw, 1.1rem);
  padding: 0.5em 1.15em;
  min-height: 44px;
  border-radius: 0.65rem;
  border: 1px solid rgba(148, 163, 184, 0.45);
  background: rgba(30, 41, 59, 0.9);
  color: #f1f5f9;
  cursor: pointer;
  touch-action: manipulation;
}

#nono-check {
  background: linear-gradient(160deg, #2d6a4f, #1b4332);
  border: none;
  color: #fff;
}

/* ----- Word search ----- */
.ws-hud,
.ws-found {
  text-align: center;
  font-size: clamp(1rem, 2.6vw, 1.1rem);
  color: var(--site-text-muted, #94a3b8);
  margin: 0 0 0.5rem;
}

.ws-found {
  margin-bottom: 1rem;
  min-height: 1.4em;
}

.ws-grid {
  display: grid;
  gap: 3px;
  max-width: min(100%, 24rem);
  margin: 0 auto 1rem;
  padding: 0.35rem;
  border-radius: 0.65rem;
  background: rgba(15, 23, 42, 0.55);
  border: 1px solid rgba(148, 163, 184, 0.25);
  user-select: none;
  touch-action: none;
}

.ws-cell {
  aspect-ratio: 1;
  min-width: 0;
  min-height: 32px;
  border-radius: 0.3rem;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: clamp(0.95rem, 3.2vw, 1.15rem);
  font-weight: 800;
  letter-spacing: 0.02em;
  background: rgba(30, 41, 59, 0.9);
  color: #f8fafc;
  cursor: pointer;
}

.ws-cell--found {
  background: linear-gradient(160deg, #14532d, #166534);
  color: #ecfdf5;
  outline: 1px solid rgba(45, 212, 191, 0.45);
}

.ws-actions {
  display: flex;
  justify-content: center;
}

#ws-new {
  font-family: inherit;
  font-size: clamp(1rem, 2.6vw, 1.1rem);
  padding: 0.5em 1.25em;
  min-height: 44px;
  border-radius: 0.65rem;
  border: none;
  cursor: pointer;
  touch-action: manipulation;
  background: linear-gradient(160deg, #2d6a4f, #1b4332);
  color: #fff;
}

/* ----- Idle tap ----- */
.idle-hud {
  text-align: center;
  font-size: clamp(1.1rem, 3vw, 1.25rem);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: #fbbf24;
  margin: 0 0 1rem;
}

.idle-big {
  display: block;
  width: min(100%, 14rem);
  margin: 0 auto 1.25rem;
  font-family: inherit;
  font-size: clamp(1.25rem, 4vw, 1.5rem);
  font-weight: 800;
  padding: 0.85em 1.25em;
  min-height: 52px;
  border: none;
  border-radius: 999px;
  cursor: pointer;
  touch-action: manipulation;
  color: #0f172a;
  background: linear-gradient(165deg, #fcd34d, #f59e0b);
  box-shadow: 0 6px 20px rgba(245, 158, 11, 0.35);
}

.idle-upgrades {
  max-width: 26rem;
  margin: 0 auto 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.idle-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.65rem;
  padding: 0.65rem 0.85rem;
  border-radius: 0.65rem;
  background: rgba(15, 23, 42, 0.55);
  border: 1px solid rgba(148, 163, 184, 0.25);
  font-size: clamp(0.95rem, 2.5vw, 1.05rem);
  color: #e2e8f0;
}

.idle-row span {
  flex: 1 1 12rem;
}

.idle-row button {
  font-family: inherit;
  font-size: clamp(1rem, 2.6vw, 1.1rem);
  padding: 0.45em 1.1em;
  min-height: 44px;
  border-radius: 0.55rem;
  border: none;
  cursor: pointer;
  touch-action: manipulation;
  background: linear-gradient(160deg, #3d5a80, #293241);
  color: #e0fbfc;
}

.idle-row button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.idle-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  justify-content: center;
}

.idle-actions button {
  font-family: inherit;
  font-size: clamp(1rem, 2.6vw, 1.1rem);
  padding: 0.5em 1.15em;
  min-height: 44px;
  border-radius: 0.65rem;
  border: 1px solid rgba(148, 163, 184, 0.45);
  background: rgba(30, 41, 59, 0.9);
  color: #f1f5f9;
  cursor: pointer;
  touch-action: manipulation;
}

#idle-reset {
  border-color: rgba(248, 113, 113, 0.45);
  color: #fecaca;
}

/* ----- Memory cards (layout matches other games: game-panel + mini-games only) ----- */

.memory-difficulty {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 0.5rem 0.85rem;
  width: 100%;
  max-width: 36rem;
  margin: 0 auto 1rem;
  padding: 0.65rem 0.85rem;
  border-radius: var(--site-radius-sm, 10px);
  background: var(--site-surface, rgba(255, 255, 255, 0.055));
  border: 1px solid var(--site-border, rgba(255, 255, 255, 0.1));
  box-sizing: border-box;
}

.memory-difficulty__label {
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--site-text-muted, #94a3b8);
}

.memory-difficulty__btns {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  justify-content: center;
}

.memory-diff__btn {
  margin: 0;
  padding: 0.5rem 1rem;
  min-height: 44px;
  border-radius: var(--site-radius-sm, 10px);
  border: 1px solid var(--site-border, rgba(255, 255, 255, 0.12));
  background: rgba(15, 23, 42, 0.55);
  color: var(--site-text, #f1f5f9);
  font-weight: 600;
  font-size: clamp(0.9rem, 2.4vw, 1rem);
  cursor: pointer;
  touch-action: manipulation;
  font-family: inherit;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.memory-diff__btn:hover,
.memory-diff__btn:focus-visible {
  border-color: var(--site-accent, #2dd4bf);
  color: var(--site-accent, #2dd4bf);
  outline: none;
}

.memory-diff__btn--active {
  border-color: var(--site-accent, #2dd4bf);
  background: rgba(45, 212, 191, 0.12);
  color: var(--site-accent, #2dd4bf);
}

.memory-win {
  width: 100%;
  max-width: 36rem;
  margin: 0 auto 1rem;
  border-radius: var(--site-radius, 14px);
  border: 1px solid var(--site-border, rgba(255, 255, 255, 0.12));
  background: var(--site-bg-elevated, #111827);
  box-shadow: var(--site-shadow, 0 18px 50px rgba(0, 0, 0, 0.45));
  box-sizing: border-box;
}

.memory-win[hidden] {
  display: none !important;
}

.memory-win__inner {
  padding: clamp(1rem, 3vw, 1.25rem) clamp(1rem, 3vw, 1.35rem);
  text-align: center;
}

.memory-win__title {
  margin: 0 0 0.65rem;
  font-size: clamp(1.15rem, 3.5vw, 1.4rem);
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--site-text, #f1f5f9);
}

.memory-win__stats {
  margin: 0 0 1rem;
  text-align: left;
}

.memory-win__line {
  margin: 0.35rem 0;
  font-size: clamp(0.92rem, 2.5vw, 1rem);
  color: var(--site-text-muted, #94a3b8);
  font-weight: 500;
}

.memory-win__line strong {
  color: var(--site-text, #f1f5f9);
  font-weight: 700;
}

.memory-win__sub {
  display: inline-block;
  margin-left: 0.35rem;
  font-size: 0.88em;
  opacity: 0.9;
}

.memory-win__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  justify-content: center;
}

.memory-win__btn {
  margin: 0;
  padding: 0.55rem 1.15rem;
  min-height: 44px;
  border-radius: var(--site-radius-sm, 10px);
  font-weight: 700;
  font-size: clamp(0.95rem, 2.5vw, 1.05rem);
  cursor: pointer;
  touch-action: manipulation;
  border: 1px solid transparent;
  font-family: inherit;
}

.memory-win__btn--primary {
  background: linear-gradient(160deg, #0d9488, #0f766e);
  color: #ecfdf5;
  border-color: rgba(45, 212, 191, 0.35);
}

.memory-win__btn--primary:hover,
.memory-win__btn--primary:focus-visible {
  filter: brightness(1.06);
  outline: none;
}

.memory-win__btn--ghost {
  background: transparent;
  color: var(--site-text-muted, #94a3b8);
  border-color: var(--site-border, rgba(255, 255, 255, 0.12));
}

.memory-win__btn--ghost:hover,
.memory-win__btn--ghost:focus-visible {
  color: var(--site-text, #f1f5f9);
  border-color: var(--site-text-muted, #94a3b8);
  outline: none;
}

.memory-hud {
  font-size: clamp(0.95rem, 2.6vw, 1.1rem);
  display: flex;
  flex-direction: row;
  flex-wrap: nowrap;
  align-items: center;
  gap: 0.45rem 0.65rem;
  margin: 0 auto 1rem;
  width: 100%;
  max-width: min(36rem, 100%);
  min-width: 0;
  padding: 0.55rem 0.9rem;
  border-radius: var(--site-radius, 12px);
  background: linear-gradient(180deg, rgba(30, 41, 59, 0.48), rgba(15, 23, 42, 0.82));
  border: 1px solid var(--site-border, rgba(255, 255, 255, 0.1));
  color: var(--site-text, #f1f5f9);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

.memory-hud__timer {
  flex: 0 0 auto;
  display: inline-flex;
  flex-direction: row;
  flex-wrap: nowrap;
  align-items: center;
  gap: 0.35em;
  background: rgba(15, 23, 42, 0.75);
  border-radius: 999px;
  margin: 0;
  padding: 0.4em 0.75em;
  border: 1px solid var(--site-border, rgba(255, 255, 255, 0.12));
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.22);
  font-variant-numeric: tabular-nums;
}

.memory-hud__stars {
  flex: 1 1 0;
  min-width: 0;
  max-width: 100%;
  display: flex;
  flex-direction: row;
  flex-wrap: nowrap;
  align-items: center;
  justify-content: center;
  gap: 0.12em;
  margin: 0;
  padding: 0;
  padding-inline-start: 0;
  list-style: none;
  list-style-type: none;
  overflow: hidden;
}

.memory-hud__stars > li {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  margin: 0;
  list-style: none;
  list-style-type: none;
}

.memory-hud__stars > li::marker {
  content: none;
}

.memory-star {
  display: inline-block;
  font-size: clamp(1.35rem, 4vw, 1.75rem);
  line-height: 1;
  color: rgba(148, 163, 184, 0.45);
  transition: color 0.15s ease, transform 0.15s ease;
}

.memory-star--on {
  color: #fbbf24;
  text-shadow: 0 0 12px rgba(251, 191, 36, 0.45);
}

.memory-hud__moves {
  text-align: right;
  font-weight: 600;
  color: var(--site-text-muted, #94a3b8);
  white-space: nowrap;
}

.memory-hud__moves-num {
  color: var(--site-text, #f1f5f9);
  font-weight: 800;
  margin-right: 0.25em;
}

.memory-hud__right {
  flex: 0 0 auto;
  display: inline-flex;
  flex-direction: row;
  flex-wrap: nowrap;
  align-items: center;
  gap: 0.45rem;
  margin-left: auto;
}

.memory-hud__shuffle {
  flex: 0 0 auto;
  width: 2.75rem;
  height: 2.75rem;
  min-width: 44px;
  min-height: 44px;
  padding: 0;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: linear-gradient(160deg, #0d9488, #0f766e);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.12s ease, box-shadow 0.12s ease;
  touch-action: manipulation;
  box-shadow: 0 3px 12px rgba(0, 0, 0, 0.32);
  cursor: pointer;
  color: #ecfdf5;
}

.memory-hud__shuffle:hover,
.memory-hud__shuffle:focus-visible {
  transform: scale(1.05);
  outline: none;
}

.memory-hud__shuffle-icon {
  font-size: 1.35em;
  line-height: 1;
  font-weight: 700;
}

.memory-deck {
  margin: 0 auto max(2rem, env(safe-area-inset-bottom));
  padding: clamp(0.5rem, 2vw, 0.85rem);
  width: min(100%, 28rem);
  max-width: 100%;
  box-sizing: border-box;
  background: var(--site-surface, rgba(255, 255, 255, 0.06));
  border-radius: var(--site-radius, 14px);
  display: grid;
  gap: clamp(0.35rem, 1.8vw, 0.65rem);
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.35);
  border: 1px solid var(--site-border, rgba(255, 255, 255, 0.1));
  perspective: 10rem;
  aspect-ratio: 1;
  max-height: min(88vh, 32rem);
}

.memory-deck--easy {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  grid-template-rows: repeat(2, minmax(0, 1fr));
}

.memory-deck--medium {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  grid-template-rows: repeat(2, minmax(0, 1fr));
  /* 4×2 grid: landscape board so each cell is square (not a tall slot inside a square deck). */
  aspect-ratio: 2 / 1;
  max-height: min(88vh, 36rem);
}

.memory-deck--hard {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  grid-template-rows: repeat(4, minmax(0, 1fr));
}

.memory-slot {
  container-type: size;
  container-name: memory-slot;
  display: grid;
  place-items: center;
  min-width: 0;
  min-height: 0;
}

.memory-card {
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 0.5em;
  width: min(100%, 5.25rem);
  height: min(100%, 5.25rem);
  max-width: 100%;
  max-height: 100%;
  aspect-ratio: 1;
  box-shadow: 4px 2px 10px rgba(0, 0, 0, 0.2);
  touch-action: manipulation;
  cursor: pointer;
  overflow: hidden;
  transform-style: preserve-3d;
}

@supports (width: 1cqmin) {
  .memory-card {
    width: min(100cqmin, 100%);
    height: min(100cqmin, 100%);
  }
}

.memory-deck .memory-card img {
  user-select: none;
  visibility: hidden;
  width: 78%;
  height: 78%;
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  margin: auto;
  display: block;
}

.memory-card.flip {
  cursor: default;
  pointer-events: none;
  transition: transform 0.3s linear;
}

.memory-card.flip img {
  visibility: visible;
  width: 85%;
  height: 85%;
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

.memory-card.match {
  visibility: visible;
  cursor: default;
  animation: memory-card-pop 1s forwards;
}

@keyframes memory-card-pop {
  0% {
    transform: rotateX(0deg) rotateY(180deg) scale(1);
  }
  80% {
    transform: rotateX(0deg) rotateY(180deg) scale(1.1);
  }
  100% {
    transform: rotateX(0deg) rotateY(180deg) scale(1);
  }
}

@media screen and (min-width: 550px) {
  .memory-deck {
    width: min(100%, 36rem);
    max-height: min(88vh, 40rem);
    padding: 1rem;
  }
  .memory-win__title {
    font-size: clamp(1.35rem, 3.5vw, 1.65rem);
  }
}

@media screen and (min-width: 800px) {
  .memory-deck {
    width: min(100%, 44rem);
    max-height: min(88vh, 48rem);
  }
  .memory-hud {
    width: min(48rem, 94vw);
    max-width: 100%;
    min-width: 0;
    gap: 1rem 1.35rem;
    padding: 0.6rem 1.1rem;
  }
  .memory-diff__btn:hover {
    filter: brightness(1.08);
  }
}

/* Memory — layout & typography tuned for phones (safe-area, dvh, tap targets) */
.memory-page {
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  padding-inline: max(0.65rem, env(safe-area-inset-left), env(safe-area-inset-right));
  padding-bottom: max(0.35rem, env(safe-area-inset-bottom));
}

.memory-page .game-title {
  font-size: clamp(1.75rem, 7.5vw, 3.25rem);
  line-height: 1.08;
  margin-bottom: 0.35rem;
  padding-inline: 0.2rem;
}

.memory-page .memory-help {
  font-size: clamp(0.9rem, 3.5vw, 1.2rem);
  line-height: 1.55;
  margin-bottom: clamp(0.85rem, 3vw, 1.25rem);
  max-width: 22rem;
  margin-left: auto;
  margin-right: auto;
}

.memory-diff__btn:active {
  transform: scale(0.97);
}

.memory-hud__shuffle:active {
  transform: scale(0.96);
}

@media (max-width: 639.98px) {
  .memory-page .memory-difficulty {
    flex-direction: column;
    align-items: stretch;
    gap: 0.55rem;
    padding: 0.75rem 1rem;
    margin-bottom: 0.85rem;
  }

  .memory-page .memory-difficulty__label {
    text-align: center;
    width: 100%;
  }

  .memory-page .memory-difficulty__btns {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.5rem;
    width: 100%;
  }

  .memory-page .memory-diff__btn {
    min-height: 48px;
    padding: 0.55rem 0.35rem;
    font-size: clamp(0.88rem, 3.5vw, 0.98rem);
  }

  .memory-page .memory-hud {
    padding: 0.45rem 0.65rem;
    gap: 0.2rem 0.35rem;
    margin-bottom: 0.75rem;
  }

  .memory-page .memory-hud__timer {
    font-size: clamp(0.82rem, 3vw, 0.98rem);
    padding: 0.32em 0.55em;
  }

  .memory-page .memory-hud__moves {
    font-size: clamp(0.78rem, 2.7vw, 0.92rem);
  }

  .memory-page .memory-hud__stars {
    gap: 0.08rem;
  }

  .memory-page .memory-star {
    font-size: clamp(1.05rem, 3.8vw, 1.45rem);
  }

  .memory-page .memory-hud__right {
    gap: 0.28rem;
  }

  .memory-page .memory-hud__shuffle {
    width: 2.5rem;
    height: 2.5rem;
    min-width: 40px;
    min-height: 40px;
  }

  .memory-page .memory-hud__shuffle-icon {
    font-size: 1.2em;
  }

  .memory-page .memory-deck {
    width: 100%;
    max-width: 100%;
    padding: clamp(0.4rem, 2vw, 0.65rem);
    gap: clamp(0.28rem, 1.5vw, 0.5rem);
    max-height: min(56dvh, 24rem);
    margin-bottom: max(0.75rem, env(safe-area-inset-bottom));
  }

  .memory-page .memory-win {
    margin-bottom: 0.75rem;
  }

  .memory-page .memory-win__actions {
    flex-direction: column;
    align-items: stretch;
  }

  .memory-page .memory-win__btn {
    width: 100%;
    max-width: 16rem;
    margin-left: auto;
    margin-right: auto;
  }
}

@media (min-width: 640px) {
  .memory-page .memory-help {
    max-width: 36rem;
  }
}

@media (max-width: 380px) {
  .snake-dpad {
    max-width: 100%;
  }
}
