/* ==========================================================================
   ARF — play.css
   Game arcade: tabs, stage shell, HUD, Memory Matrix, Math Mission,
   Pattern Protocol, results, confetti.
   ========================================================================== */

/* ---------- Arcade hero ---------- */
.arcade-hero {
  position: relative;
  padding-block: clamp(30px, 4vw, 46px) clamp(26px, 3.5vw, 38px);
  background:
    radial-gradient(640px 280px at 90% 0%, rgba(255, 198, 61, 0.24), transparent 70%),
    radial-gradient(500px 300px at 4% 100%, rgba(123, 97, 255, 0.12), transparent 70%),
    linear-gradient(180deg, rgba(227, 242, 254, 0.8), rgba(255, 251, 245, 0));
  border-bottom: 1px solid var(--line);
}

.arcade-hero__inner {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
}

.arcade-hero h1 {
  margin-top: 12px;
  font-size: clamp(2rem, 4.2vw, 3.1rem);
}

.arcade-hero .lead {
  max-width: 58ch;
  margin-top: 12px;
}

.arcade-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 18px;
}

.arcade-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border: 1px solid var(--line);
  border-radius: var(--r-pill);
  background: rgba(255, 255, 255, 0.8);
  font-size: 0.72rem;
  font-weight: 800;
  color: var(--ink-2);
}

.arcade-badge .icon {
  width: 14px;
  height: 14px;
  color: var(--leaf-600);
}

.arcade-score {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: rgba(255, 255, 255, 0.85);
  box-shadow: var(--shadow-sm);
}

.arcade-score__icon {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 12px;
  background: var(--sun-100);
  color: #9a6b00;
}

.arcade-score__icon .icon {
  width: 19px;
  height: 19px;
}

.arcade-score strong {
  display: block;
  font-family: var(--font-display);
  font-size: 1rem;
  line-height: 1.15;
}

.arcade-score span {
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--ink-3);
}

/* ---------- Sticky game tabs ---------- */
.arcade-tabs-wrap {
  position: sticky;
  top: var(--header-h);
  z-index: 40;
  padding-block: 12px;
  background: rgba(255, 251, 245, 0.9);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid transparent;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.arcade-tabs-wrap.is-stuck {
  border-bottom-color: var(--line);
  box-shadow: 0 12px 24px -26px rgba(19, 42, 74, 0.8);
}

.game-tabs {
  display: flex;
  gap: 5px;
  width: 100%;
  max-width: 660px;
  padding: 5px;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: var(--r-pill);
  background: var(--paper);
  box-shadow: var(--shadow-sm);
  scrollbar-width: none;
}

.game-tabs::-webkit-scrollbar {
  display: none;
}

.game-tab {
  display: inline-flex;
  flex: 1 0 auto;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 9px 16px;
  border-radius: var(--r-pill);
  color: var(--ink-2);
  font-size: 0.86rem;
  font-weight: 800;
  white-space: nowrap;
  transition: background 0.16s, color 0.16s, box-shadow 0.16s;
}

.game-tab__emoji {
  font-size: 1.02rem;
  line-height: 1;
}

.game-tab:hover {
  background: var(--sky-50);
  color: var(--sky-700);
}

.game-tab[aria-selected="true"],
.game-tab[aria-pressed="true"] {
  background: var(--ink);
  color: #ffffff;
  box-shadow: 0 4px 12px -6px rgba(19, 42, 74, 0.6);
}

/* ---------- Stage shell ---------- */
.stage {
  --accent: var(--sky-600);
  --accent-soft: var(--sky-100);
  --accent-deep: var(--sky-700);
  position: relative;
  margin-top: 20px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--r-xl);
  background: var(--paper);
  box-shadow: var(--shadow-md);
}

.stage[data-game="math"] {
  --accent: #a97500;
  --accent-soft: var(--sun-100);
  --accent-deep: #7a5200;
}

.stage[data-game="pattern"] {
  --accent: var(--berry-600);
  --accent-soft: var(--berry-100);
  --accent-deep: #4a34b8;
}

.stage__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px clamp(18px, 3vw, 28px);
  border-bottom: 1px solid var(--line);
}

.stage__identity {
  display: flex;
  align-items: center;
  gap: 13px;
  min-width: 0;
}

.stage__emoji {
  display: grid;
  place-items: center;
  width: 52px;
  height: 52px;
  flex: none;
  border-radius: 16px;
  background: var(--accent-soft);
  font-size: 1.45rem;
  line-height: 1;
}

.stage__title {
  font-size: clamp(1.2rem, 2vw, 1.45rem);
  line-height: 1.05;
}

.stage__tagline {
  margin-top: 4px;
  font-size: 0.76rem;
  font-weight: 700;
  color: var(--ink-3);
}

.stage__tools {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: none;
}

.stage__sound[aria-pressed="false"] {
  color: var(--ink-3);
  background: var(--cream);
}

/* ---------- HUD ---------- */
.hud {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  border-bottom: 1px solid var(--line);
  background: linear-gradient(180deg, #fbfdff, #f3f8fe);
}

.hud[hidden] {
  display: none;
}

.hud__stat {
  padding: 11px clamp(14px, 3vw, 24px);
  border-left: 1px solid var(--line);
}

.hud__stat:first-child {
  border-left: 0;
}

.hud__label {
  display: block;
  font-size: 0.62rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-3);
}

.hud__stat strong {
  display: block;
  margin-top: 2px;
  font-family: var(--font-display);
  font-size: 1.18rem;
  font-weight: 700;
  line-height: 1.1;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}

.hud__stat strong.is-warning {
  color: var(--coral-600);
}

/* ---------- Stage body ---------- */
.stage__body {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 540px;
  padding: clamp(22px, 4vw, 40px);
  background:
    radial-gradient(520px 320px at 50% 0%, rgba(46, 155, 240, 0.07), transparent 70%),
    var(--paper);
}

.stage__body.is-playing {
  place-items: start center;
  padding-top: clamp(22px, 3.5vw, 34px);
}

/* ---------- Intro / result screens ---------- */
.game-intro,
.game-result {
  width: 100%;
  max-width: 580px;
  text-align: center;
  animation: pop-in 0.32s var(--ease);
}

.game-intro__emoji {
  display: block;
  margin-bottom: 10px;
  font-size: clamp(2.6rem, 6vw, 3.6rem);
  line-height: 1;
  filter: drop-shadow(0 8px 14px rgba(19, 42, 74, 0.12));
}

.game-intro h2 {
  font-size: clamp(1.55rem, 3vw, 2.05rem);
}

.game-intro__lead {
  max-width: 46ch;
  margin: 10px auto 0;
  font-size: 0.94rem;
  line-height: 1.65;
  color: var(--ink-2);
}

.game-rules {
  display: grid;
  gap: 8px;
  max-width: 440px;
  margin: 20px auto 0;
  text-align: left;
}

.game-rules li {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-size: 0.86rem;
  font-weight: 600;
  line-height: 1.5;
  color: var(--ink-2);
}

.game-rules .icon {
  width: 18px;
  height: 18px;
  flex: none;
  margin-top: 2px;
  color: var(--accent);
  stroke-width: 2.5;
}

.difficulty {
  display: flex;
  flex-wrap: wrap;
  width: fit-content;
  margin: 24px auto 0;
  padding: 5px;
  border: 1px solid var(--line);
  border-radius: var(--r-pill);
  background: var(--cream);
}

.difficulty button {
  min-width: 88px;
  padding: 7px 16px;
  border-radius: var(--r-pill);
  color: var(--ink-2);
  font-size: 0.8rem;
  font-weight: 800;
  line-height: 1.2;
  transition: background 0.16s, color 0.16s, box-shadow 0.16s;
}

.difficulty button strong {
  display: block;
  margin-top: 2px;
  font-size: 0.62rem;
  font-weight: 700;
  color: var(--ink-3);
}

.difficulty button:hover {
  color: var(--ink);
}

.difficulty button[aria-checked="true"] {
  background: var(--paper);
  color: var(--ink);
  box-shadow: var(--shadow-sm);
}

.difficulty button[aria-checked="true"] strong {
  color: var(--accent);
}

.game-intro__best {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  width: fit-content;
  margin: 18px auto 0;
  padding: 6px 13px;
  border-radius: var(--r-pill);
  background: var(--sun-100);
  color: #7a5200;
  font-size: 0.74rem;
  font-weight: 800;
}

.game-intro__best .icon {
  width: 14px;
  height: 14px;
}

.game-intro__best[hidden] {
  display: none;
}

.game-intro .btn--start {
  margin-top: 24px;
  min-width: 190px;
}

.game-intro__hint {
  margin-top: 14px;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--ink-3);
}

/* ---------- Memory Matrix ---------- */
.memory-board {
  display: grid;
  grid-template-columns: repeat(var(--cols, 4), minmax(0, 1fr));
  gap: clamp(6px, 1.2vw, 11px);
  width: min(100%, 540px);
  margin-inline: auto;
  perspective: 1200px;
}

.memory-board[data-size="20"] {
  width: min(100%, 480px);
}

.memory-card {
  position: relative;
  padding: 0;
  aspect-ratio: 1;
  border: 0;
  border-radius: 14px;
  background: transparent;
  transform-style: preserve-3d;
  transition: transform 0.45s var(--ease);
  -webkit-tap-highlight-color: transparent;
}

.memory-card.is-flipped {
  transform: rotateY(180deg);
}

.memory-card__face {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  border-radius: 14px;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  font-size: clamp(1.65rem, 3.6vw, 2.6rem);
  line-height: 1;
  user-select: none;
}

.memory-card__front {
  background: linear-gradient(145deg, #4cb0f7, var(--accent-deep));
  border: 3px solid rgba(255, 255, 255, 0.9);
  box-shadow: 0 4px 0 rgba(7, 90, 155, 0.45), var(--shadow-sm);
  color: rgba(255, 255, 255, 0.92);
  font-family: var(--font-display);
  font-size: clamp(1.5rem, 2.8vw, 2rem);
  font-weight: 700;
}

.memory-card__back {
  transform: rotateY(180deg);
  border: 3px solid var(--line);
  background: #ffffff;
  box-shadow: 0 4px 0 rgba(19, 42, 74, 0.08);
}

.memory-card:hover:not(.is-flipped):not([disabled]) .memory-card__front {
  transform: translateY(-2px);
  box-shadow: 0 6px 0 rgba(7, 90, 155, 0.45), var(--shadow-md);
}

.memory-card:hover:not(.is-flipped):not([disabled]) {
  transform: translateY(-2px);
}

.memory-card.is-matched {
  transform: rotateY(180deg);
  animation: match-pop 0.45s var(--ease-bounce);
}

.memory-card.is-matched .memory-card__back {
  border-color: var(--sun);
  background: linear-gradient(150deg, #fff7dd, var(--sun-100));
}

.memory-card.is-matched .memory-card__face {
  opacity: 0.72;
}

.memory-card.is-matched[disabled] {
  cursor: default;
}

.memory-card.is-miss {
  animation: shake 0.4s var(--ease);
}

.memory-card:focus-visible {
  outline: 3px solid var(--accent-deep);
  outline-offset: 3px;
}

@keyframes match-pop {
  0% { transform: rotateY(180deg) scale(1); }
  45% { transform: rotateY(180deg) scale(1.07); }
  100% { transform: rotateY(180deg) scale(1); }
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-5px) rotate(-1.5deg); }
  45% { transform: translateX(5px) rotate(1.5deg); }
  70% { transform: translateX(-3px); }
}

/* ---------- Math Mission ---------- */
.math-wrap {
  width: 100%;
  max-width: 580px;
  text-align: center;
}

.math-progress {
  display: flex;
  justify-content: center;
  gap: 5px;
  margin-bottom: 20px;
}

.math-progress span {
  width: clamp(16px, 3vw, 26px);
  height: 6px;
  border-radius: var(--r-pill);
  background: #e8eef6;
  transition: background 0.25s;
}

.math-progress span.is-done {
  background: var(--leaf);
}

.math-progress span.is-now {
  background: var(--sun);
}

.math-timer {
  width: min(100%, 320px);
  height: 8px;
  margin: 0 auto 28px;
  overflow: hidden;
  border-radius: var(--r-pill);
  background: #eef2f7;
}

.math-timer__fill {
  width: 100%;
  height: 100%;
  border-radius: inherit;
  background: var(--sun-600);
  transition: width 0.9s linear, background-color 0.3s;
}

.math-timer__fill.is-low {
  background: var(--coral);
}

.math-streak {
  min-height: 22px;
  margin-bottom: 6px;
  font-size: 0.78rem;
  font-weight: 800;
  color: var(--coral-600);
}

.math-expression {
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: clamp(8px, 2vw, 16px);
  font-family: var(--font-display);
  font-size: clamp(2.8rem, 8vw, 4.3rem);
  font-weight: 700;
  line-height: 1;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}

.math-expression .math-eq {
  color: var(--sky);
  font-size: 0.78em;
}

.math-expression .math-unknown {
  color: var(--sun-600);
}

.math-options {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 30px;
}

.math-option {
  position: relative;
  padding: 16px;
  border: 2px solid var(--line-strong);
  border-radius: 16px;
  background: #ffffff;
  font-family: var(--font-display);
  font-size: clamp(1.3rem, 3vw, 1.6rem);
  font-weight: 700;
  color: var(--ink);
  box-shadow: 0 4px 0 rgba(19, 42, 74, 0.08);
  transition: transform 0.14s var(--ease), background 0.14s, border-color 0.14s,
    color 0.14s, box-shadow 0.14s;
}

.math-option kbd {
  position: absolute;
  top: 7px;
  left: 9px;
  padding: 1px 5px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: var(--cream);
  font-family: var(--font-body);
  font-size: 0.6rem;
  font-weight: 800;
  color: var(--ink-3);
}

.math-option:hover:not(:disabled) {
  border-color: var(--sun-600);
  background: var(--sun-100);
  transform: translateY(-2px);
  box-shadow: 0 6px 0 rgba(19, 42, 74, 0.08);
}

.math-option.is-correct {
  border-color: var(--leaf);
  background: var(--leaf-100);
  color: #0a6b45;
  animation: pop-in 0.3s var(--ease);
}

.math-option.is-wrong {
  border-color: var(--coral);
  background: var(--coral-100);
  color: var(--coral-600);
  animation: shake 0.4s var(--ease);
}

.math-option:disabled {
  cursor: default;
}

.math-hint {
  margin-top: 18px;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--ink-3);
}

/* ---------- Pattern Protocol ---------- */
.pattern-wrap {
  width: 100%;
  max-width: 520px;
  text-align: center;
}

.pattern-status {
  min-height: 26px;
  font-size: 0.92rem;
  font-weight: 800;
  color: var(--ink-2);
}

.pattern-status strong {
  color: var(--berry-600);
}

.pads {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: clamp(10px, 2.5vw, 16px);
  width: min(100%, 360px);
  margin: 24px auto;
}

.pad {
  position: relative;
  aspect-ratio: 1.16;
  border: 4px solid rgba(255, 255, 255, 0.92);
  border-radius: clamp(16px, 3vw, 24px);
  box-shadow:
    inset 0 -9px 0 rgba(0, 0, 0, 0.13),
    0 10px 22px -16px rgba(19, 42, 74, 0.6);
  transition: transform 0.12s var(--ease), filter 0.12s, box-shadow 0.12s;
  -webkit-tap-highlight-color: transparent;
}

.pad--0 { background: #ff6b6b; --glow: rgba(255, 107, 107, 0.85); }
.pad--1 { background: #ffc63d; --glow: rgba(255, 198, 61, 0.85); }
.pad--2 { background: #34d399; --glow: rgba(52, 211, 153, 0.85); }
.pad--3 { background: #4ba3f7; --glow: rgba(75, 163, 247, 0.85); }

.pad:hover:not(:disabled) {
  transform: translateY(-2px);
  filter: brightness(1.04);
}

.pad:active:not(:disabled),
.pad.is-pressed {
  transform: translateY(2px) scale(0.99);
  filter: brightness(1.1);
}

.pad.is-lit {
  filter: brightness(1.45) saturate(1.1);
  transform: scale(1.03);
  box-shadow:
    inset 0 -9px 0 rgba(0, 0, 0, 0.07),
    0 0 0 5px rgba(255, 255, 255, 0.95),
    0 0 34px 8px var(--glow);
}

.pad:disabled {
  cursor: default;
  opacity: 0.96;
}

.pad__num {
  position: absolute;
  top: 8px;
  left: 10px;
  display: grid;
  place-items: center;
  width: 21px;
  height: 21px;
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.45);
  font-family: var(--font-body);
  font-size: 0.66rem;
  font-weight: 800;
  color: rgba(19, 42, 74, 0.6);
}

.pattern-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 10px;
}

.pattern-controls .btn[disabled] {
  opacity: 0.45;
}

.pattern-lives {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-size: 0.95rem;
}

.pattern-lives span {
  filter: grayscale(1);
  opacity: 0.28;
  transition: filter 0.2s, opacity 0.2s;
}

.pattern-lives span.is-on {
  filter: none;
  opacity: 1;
}

.pattern-watch {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  margin-left: 4px;
  font-size: 0.72rem;
  font-weight: 800;
  color: var(--ink-3);
}

/* ---------- Results ---------- */
.stars {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 8px;
  margin-bottom: 16px;
}

.stars span {
  font-size: 2rem;
  line-height: 1;
  filter: grayscale(1);
  opacity: 0.25;
  transform: scale(0.85);
}

.stars span.is-on {
  filter: none;
  opacity: 1;
  transform: scale(1);
  animation: star-pop 0.5s var(--ease-bounce) backwards;
}

.stars span:nth-child(2) {
  font-size: 2.6rem;
  animation-delay: 0.1s;
}

.stars span:nth-child(3) {
  animation-delay: 0.2s;
}

@keyframes star-pop {
  from { opacity: 0; transform: scale(0.3) rotate(-18deg); }
  to { opacity: 1; transform: scale(1) rotate(0); }
}

.result-title {
  font-size: clamp(1.6rem, 3.4vw, 2.2rem);
}

.result-title:focus {
  outline: none;
}

.result-msg {
  max-width: 44ch;
  margin: 10px auto 0;
  font-size: 0.94rem;
  line-height: 1.6;
  color: var(--ink-2);
}

.result-best {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  margin-top: 14px;
  padding: 6px 13px;
  border-radius: var(--r-pill);
  background: var(--sun-100);
  color: #7a5200;
  font-size: 0.76rem;
  font-weight: 800;
}

.result-best .icon {
  width: 14px;
  height: 14px;
}

.result-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin: 24px 0;
  padding: 18px 12px;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: var(--cream);
}

.result-stat strong {
  display: block;
  font-family: var(--font-display);
  font-size: clamp(1.25rem, 3vw, 1.55rem);
  font-weight: 700;
  line-height: 1.15;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}

.result-stat span {
  display: block;
  margin-top: 3px;
  font-size: 0.62rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-3);
}

.result-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
}

.result-actions .btn {
  flex: 0 1 auto;
}

/* ---------- Confetti ---------- */
.confetti {
  position: absolute;
  inset: 0;
  z-index: 6;
  overflow: hidden;
  pointer-events: none;
}

.confetti span {
  position: absolute;
  top: -12%;
  width: 9px;
  height: 14px;
  border-radius: 2px;
  opacity: 0.95;
  animation: confetti-fall 2.8s linear forwards;
}

@keyframes confetti-fall {
  to {
    transform: translateY(620px) rotate(760deg);
    opacity: 0;
  }
}

/* ---------- Tips below the stage ---------- */
.arcade-tips {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: clamp(14px, 2vw, 20px);
  margin-block: clamp(32px, 5vw, 52px) clamp(48px, 7vw, 80px);
}

.arcade-tip {
  padding: clamp(20px, 2.6vw, 24px);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: rgba(255, 255, 255, 0.8);
}

.arcade-tip h3 {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 1rem;
}

.arcade-tip h3 .icon {
  width: 18px;
  height: 18px;
  color: var(--sky-700);
}

.arcade-tip p {
  margin-top: 7px;
  font-size: 0.83rem;
  line-height: 1.62;
  color: var(--ink-2);
}

.arcade-safety {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 28px;
  padding: 14px 18px;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  background: rgba(227, 251, 241, 0.6);
  font-size: 0.8rem;
  line-height: 1.6;
  color: var(--ink-2);
}

.arcade-safety .icon {
  width: 16px;
  height: 16px;
  flex: none;
  margin-top: 2px;
  color: var(--leaf-600);
}

.arcade-safety a {
  font-weight: 800;
}

/* ---------- Responsive ---------- */
@media (max-width: 860px) {
  .arcade-tips {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .arcade-tips .arcade-tip:last-child {
    grid-column: 1 / -1;
  }

  .arcade-hero__inner {
    align-items: flex-start;
  }
}

@media (max-width: 640px) {
  .game-tabs {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 4px;
    border-radius: 20px;
    padding: 4px;
    overflow: visible;
  }

  .game-tab {
    flex: none;
    flex-direction: column;
    gap: 2px;
    padding: 8px 4px;
    border-radius: 16px;
    font-size: 0.72rem;
    line-height: 1.15;
    white-space: normal;
    text-align: center;
  }

  .game-tab__emoji {
    font-size: 1.1rem;
  }

  .stage {
    border-radius: var(--r-lg);
  }

  .stage__body {
    min-height: 480px;
    padding: 20px 16px 26px;
  }

  .stage__head {
    padding: 14px 16px;
  }

  .stage__emoji {
    width: 44px;
    height: 44px;
    border-radius: 13px;
    font-size: 1.25rem;
  }

  .stage__tagline {
    display: none;
  }

  .stage__tools .btn {
    padding: 8px 12px;
    font-size: 0.8rem;
  }

  .hud__stat {
    padding: 9px 12px;
  }

  .hud__stat strong {
    font-size: 1rem;
  }

  .hud__label {
    font-size: 0.56rem;
  }

  .arcade-tips {
    grid-template-columns: minmax(0, 1fr);
  }

  .arcade-tips .arcade-tip:last-child {
    grid-column: auto;
  }

  .game-intro {
    max-width: 100%;
  }

  .difficulty button {
    min-width: 78px;
    padding: 7px 12px;
  }

  .memory-board {
    gap: 6px;
  }

  .memory-card__face {
    border-width: 2px;
    border-radius: 11px;
  }

  .memory-card__front {
    font-size: 1.1rem;
  }

  .math-options {
    gap: 8px;
  }

  .math-option {
    padding: 13px;
  }

  .result-stats {
    padding: 14px 8px;
  }

  .pattern-controls {
    gap: 8px;
  }

  .pattern-controls .btn {
    padding: 9px 14px;
    font-size: 0.8rem;
  }

  .arcade-score {
    width: 100%;
  }
}

@media (max-width: 400px) {
  .stage__title {
    font-size: 1.08rem;
  }

  .game-tab {
    padding: 8px 12px;
    font-size: 0.8rem;
  }

  .math-expression {
    font-size: 2.5rem;
  }
}
