/* Arcade pédagogique des tables de multiplication */
.mg-page {
    --mg-ink: #183153;
    --mg-paper: #fffaf0;
    --mg-cream: #f6edda;
    --mg-coral: #ed6a5a;
    --mg-yellow: #f7c948;
    --mg-teal: #2a9d8f;
    --mg-blue: #3a6ea5;
    --mg-green: #4f9d69;
    --mg-muted: #5f6b7a;
    --mg-shadow: 6px 7px 0 rgba(24, 49, 83, 0.16);
    color: var(--mg-ink);
    font-family: 'Varela Round', sans-serif;
    margin: 1.25rem 0 3rem;
}

.mg-page *,
.mg-page *::before,
.mg-page *::after {
    box-sizing: border-box;
}

.mg-page button,
.mg-page input {
    font: inherit;
}

.mg-page button {
    touch-action: manipulation;
}

.mg-hero {
    background:
        linear-gradient(rgba(255, 250, 240, 0.93), rgba(255, 250, 240, 0.93)),
        repeating-linear-gradient(0deg, transparent 0 27px, rgba(58, 110, 165, 0.14) 28px 29px),
        repeating-linear-gradient(90deg, transparent 0 27px, rgba(58, 110, 165, 0.1) 28px 29px);
    border: 3px solid var(--mg-ink);
    border-radius: 26px 26px 46px 26px;
    box-shadow: var(--mg-shadow);
    overflow: hidden;
    padding: clamp(1.5rem, 4vw, 3.4rem);
    position: relative;
}

.mg-hero::after {
    background: var(--mg-yellow);
    border: 3px solid var(--mg-ink);
    border-radius: 50%;
    content: '×';
    display: grid;
    font-family: 'Patrick Hand', cursive;
    font-size: clamp(4.2rem, 9vw, 7rem);
    height: clamp(100px, 17vw, 170px);
    line-height: 1;
    place-items: center;
    position: absolute;
    right: clamp(-28px, 2vw, 24px);
    top: clamp(-28px, 2vw, 22px);
    transform: rotate(8deg);
    width: clamp(100px, 17vw, 170px);
}

.mg-hero__content {
    max-width: 760px;
    position: relative;
    z-index: 1;
}

.mg-eyebrow {
    color: var(--mg-coral);
    font-size: 0.82rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    margin: 0 0 0.65rem;
    text-transform: uppercase;
}

.mg-page .mg-hero h1 {
    color: var(--mg-ink);
    font-family: 'Patrick Hand', cursive;
    font-size: clamp(2.7rem, 7vw, 5.3rem);
    line-height: 0.94;
    margin: 0;
    max-width: 680px;
    text-align: left;
}

.mg-page .mg-hero h1 span {
    display: block;
}

.mg-hero__lead {
    color: #34445c;
    font-family: 'Open Sans', sans-serif;
    font-size: clamp(1rem, 2vw, 1.2rem);
    line-height: 1.65;
    margin: 1.2rem 0 0;
    max-width: 680px;
}

.mg-hero__facts {
    display: flex;
    flex-wrap: wrap;
    gap: 0.55rem;
    list-style: none;
    margin: 1.4rem 0 0;
    padding: 0;
}

.mg-hero__facts li {
    background: #fff;
    border: 2px solid var(--mg-ink);
    border-radius: 999px;
    box-shadow: 2px 3px 0 rgba(24, 49, 83, 0.13);
    font-size: 0.88rem;
    font-weight: 700;
    padding: 0.45rem 0.8rem;
}

.mg-control-panel {
    align-items: start;
    background: var(--mg-ink);
    border-radius: 22px;
    box-shadow: var(--mg-shadow);
    color: #fff;
    display: grid;
    gap: 1.4rem;
    grid-template-columns: minmax(0, 1fr) auto;
    margin: 2rem 0;
    padding: clamp(1.2rem, 3vw, 1.8rem);
}

.mg-control-panel fieldset {
    border: 0;
    margin: 0;
    min-width: 0;
    padding: 0;
}

.mg-control-panel legend {
    color: #fff;
    float: none;
    font-family: 'Patrick Hand', cursive;
    font-size: 1.65rem;
    line-height: 1;
    margin: 0 0 0.8rem;
    padding: 0;
    width: auto;
}

.mg-control-help {
    color: #dbe5f1;
    font-size: 0.92rem;
    line-height: 1.5;
    margin: -0.2rem 0 0.9rem;
    max-width: 760px;
}

.mg-presets,
.mg-table-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.mg-presets {
    margin-bottom: 0.8rem;
}

.mg-selection-summary {
    color: #fff;
    font-size: 0.9rem;
    line-height: 1.5;
    margin: 0.8rem 0 0;
}

.mg-selection-summary strong {
    color: var(--mg-yellow);
}

.mg-preset,
.mg-table-toggle,
.mg-sound-toggle {
    background: transparent;
    border: 2px solid rgba(255, 255, 255, 0.52);
    border-radius: 999px;
    color: #fff;
    cursor: pointer;
    min-height: 44px;
    padding: 0.48rem 0.8rem;
}

.mg-preset:hover,
.mg-preset:focus-visible,
.mg-sound-toggle:hover,
.mg-sound-toggle:focus-visible {
    background: rgba(255, 255, 255, 0.12);
    border-color: #fff;
}

.mg-table-toggle {
    align-items: center;
    display: inline-flex;
    font-weight: 700;
    justify-content: center;
    min-width: 46px;
    padding: 0.45rem;
}

.mg-table-toggle input {
    opacity: 0;
    pointer-events: none;
    position: absolute;
}

.mg-table-toggle:has(input:checked) {
    background: var(--mg-yellow);
    border-color: var(--mg-yellow);
    color: var(--mg-ink);
}

.mg-control-side {
    align-items: flex-end;
    display: flex;
    flex-direction: column;
    gap: 0.7rem;
}

.mg-best {
    color: #fdf4d6;
    font-family: 'Open Sans', sans-serif;
    font-size: 0.85rem;
    text-align: right;
}

.mg-best span {
    color: #fff;
    display: block;
    font-weight: 700;
}

.mg-best strong {
    color: var(--mg-yellow);
    display: block;
    font-family: 'Patrick Hand', cursive;
    font-size: 1.8rem;
    letter-spacing: 0.08em;
}

.mg-best small {
    color: #dbe5f1;
    display: block;
    line-height: 1.45;
    margin-top: 0.35rem;
    max-width: 270px;
}

.mg-section-heading {
    align-items: end;
    display: flex;
    gap: 1rem;
    justify-content: space-between;
    margin: 2.8rem 0 1rem;
}

.mg-page .mg-section-heading h2,
.mg-page .mg-copy h2 {
    background: transparent;
    color: var(--mg-ink);
    font-family: 'Patrick Hand', cursive;
    font-size: clamp(2rem, 4vw, 3.1rem);
    line-height: 1;
    margin: 0;
    padding: 0;
    text-align: left;
}

.mg-section-heading p {
    color: var(--mg-muted);
    font-family: 'Open Sans', sans-serif;
    margin: 0;
    max-width: 440px;
    text-align: right;
}

.mg-game-grid {
    display: grid;
    gap: 1.25rem;
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.mg-game-card {
    background: var(--mg-paper);
    border: 3px solid var(--mg-ink);
    border-radius: 22px;
    box-shadow: 5px 6px 0 rgba(24, 49, 83, 0.14);
    display: grid;
    gap: 1.2rem;
    grid-template-columns: 120px minmax(0, 1fr);
    min-height: 230px;
    overflow: hidden;
    padding: 1.25rem;
    position: relative;
    transition: transform 180ms ease, box-shadow 180ms ease;
}

.mg-game-card:hover {
    box-shadow: 8px 9px 0 rgba(24, 49, 83, 0.18);
    transform: translate(-2px, -3px);
}

.mg-game-card:nth-child(2) {
    background: #edf8f5;
}

.mg-game-card:nth-child(3) {
    background: #fff3ef;
}

.mg-game-card:nth-child(4) {
    background: #edf4fb;
}

.mg-game-card:nth-child(5) {
    background: #f4f0fb;
}

.mg-game-card:nth-child(6) {
    background: #edf8f5;
}

.mg-card-visual {
    align-items: center;
    align-self: stretch;
    background: var(--mg-yellow);
    border: 3px solid var(--mg-ink);
    border-radius: 18px 18px 42px 18px;
    display: flex;
    flex-direction: column;
    font-family: 'Patrick Hand', cursive;
    justify-content: center;
    min-height: 160px;
    overflow: hidden;
    position: relative;
}

.mg-game-card:nth-child(2) .mg-card-visual { background: #77c8b9; }
.mg-game-card:nth-child(3) .mg-card-visual { background: #f39a8f; }
.mg-game-card:nth-child(4) .mg-card-visual { background: #8db7dc; }
.mg-game-card:nth-child(5) .mg-card-visual { background: #b6a6e2; }
.mg-game-card:nth-child(6) .mg-card-visual { background: #77c8b9; }

.mg-card-visual__big {
    font-size: 3.5rem;
    line-height: 0.9;
}

.mg-card-visual__small {
    font-size: 1.25rem;
    margin-top: 0.4rem;
}

.mg-card-memory {
    display: grid;
    gap: 0.35rem;
    grid-template-columns: repeat(2, 38px);
}

.mg-card-memory span {
    background: #fff;
    border: 2px solid var(--mg-ink);
    border-radius: 7px;
    display: block;
    height: 38px;
}

.mg-card-rain {
    height: 108px;
    position: relative;
    width: 92px;
}

.mg-card-rain span {
    align-items: center;
    background: #fff9e9;
    border: 2px solid var(--mg-ink);
    border-radius: 50%;
    display: flex;
    font-family: 'Varela Round', sans-serif;
    font-size: 0.85rem;
    font-weight: 700;
    height: 34px;
    justify-content: center;
    position: absolute;
    top: 0;
    width: 34px;
}

.mg-card-rain span:first-child {
    left: 4px;
    animation: mg-card-fall 1.8s ease-in-out infinite;
}

.mg-card-rain span:nth-child(2) {
    animation: mg-card-fall 1.8s 0.55s ease-in-out infinite;
    right: 4px;
    top: 20px;
}

.mg-card-rain i {
    background: var(--mg-ink);
    border-radius: 8px 8px 3px 3px;
    bottom: 4px;
    height: 32px;
    left: 25px;
    position: absolute;
    width: 44px;
}

.mg-card-rain i::before {
    background: var(--mg-yellow);
    border-radius: 50%;
    box-shadow: 18px 0 0 var(--mg-yellow);
    content: '';
    height: 7px;
    left: 10px;
    position: absolute;
    top: 9px;
    width: 7px;
}

.mg-card-pipe {
    background: #5c8598;
    border: 3px solid var(--mg-ink);
    height: 22px;
    left: -8px;
    position: absolute;
    right: -8px;
    top: 70px;
}

.mg-card-mouse {
    height: 70px;
    position: relative;
    transform: translateY(-10px);
    width: 92px;
}

.mg-card-mouse span {
    background: #c2ced8;
    border: 3px solid var(--mg-ink);
    border-radius: 50% 55% 45% 50%;
    height: 35px;
    left: 22px;
    position: absolute;
    top: 25px;
    width: 55px;
}

.mg-card-mouse span::after {
    background: #c2ced8;
    border: 3px solid var(--mg-ink);
    border-radius: 50%;
    content: '';
    height: 24px;
    position: absolute;
    right: -14px;
    top: 2px;
    width: 27px;
}

.mg-card-mouse i {
    background: #f0a2aa;
    border: 2px solid var(--mg-ink);
    border-radius: 50%;
    height: 14px;
    position: absolute;
    right: 5px;
    top: 19px;
    width: 14px;
}

.mg-card-mouse b {
    border-left: 3px solid var(--mg-ink);
    border-radius: 50%;
    height: 32px;
    left: 4px;
    position: absolute;
    top: 31px;
    transform: rotate(-42deg);
    width: 34px;
}

@keyframes mg-card-fall {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(18px); }
}

.mg-card-body {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.mg-card-label {
    color: var(--mg-coral);
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    margin: 0 0 0.3rem;
    text-transform: uppercase;
}

.mg-page .mg-card-body h3 {
    color: var(--mg-ink);
    font-family: 'Patrick Hand', cursive;
    font-size: 2rem;
    line-height: 1;
    margin: 0;
    padding: 0;
}

.mg-page .mg-card-body h3::after {
    display: none;
}

.mg-card-body p {
    color: #46566d;
    font-family: 'Open Sans', sans-serif;
    font-size: 0.92rem;
    line-height: 1.55;
    margin: 0.7rem 0 1rem;
}

.mg-play-button,
.mg-primary-button,
.mg-secondary-button,
.mg-close-button {
    border: 2px solid var(--mg-ink);
    border-radius: 12px;
    cursor: pointer;
    font-weight: 700;
    min-height: 46px;
    padding: 0.62rem 1rem;
}

.mg-play-button,
.mg-primary-button {
    background: var(--mg-ink);
    color: #fff;
}

.mg-play-button {
    align-self: flex-start;
    margin-top: auto;
}

.mg-play-button:hover,
.mg-play-button:focus-visible,
.mg-primary-button:hover,
.mg-primary-button:focus-visible {
    background: var(--mg-coral);
}

.mg-card-score {
    color: var(--mg-muted);
    font-size: 0.78rem;
    margin-top: 0.6rem;
}

.mg-arena {
    background: #fff;
    border: 3px solid var(--mg-ink);
    border-radius: 28px;
    box-shadow: 8px 9px 0 rgba(24, 49, 83, 0.18);
    margin: 2.2rem 0;
    overflow: hidden;
    scroll-margin-top: 1rem;
}

.mg-arena[hidden] {
    display: none;
}

.mg-arena__header {
    align-items: center;
    background: var(--mg-ink);
    color: #fff;
    display: flex;
    gap: 1rem;
    justify-content: space-between;
    padding: 1rem 1.2rem;
}

.mg-arena__title {
    font-family: 'Patrick Hand', cursive;
    font-size: 1.9rem;
    line-height: 1;
    margin: 0;
}

.mg-arena__meta {
    color: #d9e2ef;
    font-family: 'Open Sans', sans-serif;
    font-size: 0.8rem;
    margin: 0.25rem 0 0;
}

.mg-close-button {
    background: transparent;
    border-color: rgba(255, 255, 255, 0.55);
    color: #fff;
    min-width: 46px;
    padding: 0.5rem 0.8rem;
}

.mg-close-button:hover,
.mg-close-button:focus-visible {
    border-color: #fff;
}

.mg-arena__body {
    background:
        linear-gradient(rgba(255, 255, 255, 0.94), rgba(255, 255, 255, 0.94)),
        repeating-linear-gradient(0deg, transparent 0 31px, rgba(58, 110, 165, 0.14) 32px 33px);
    min-height: 430px;
    padding: clamp(1.2rem, 4vw, 2.5rem);
}

.mg-game-layout {
    margin: 0 auto;
    max-width: 780px;
    text-align: center;
}

.mg-hud {
    align-items: center;
    display: grid;
    gap: 0.75rem;
    grid-template-columns: repeat(3, 1fr);
    margin-bottom: 1.3rem;
}

.mg-hud__item {
    background: var(--mg-cream);
    border: 2px solid var(--mg-ink);
    border-radius: 12px;
    color: var(--mg-muted);
    font-family: 'Open Sans', sans-serif;
    font-size: 0.75rem;
    padding: 0.55rem;
}

.mg-hud__item strong {
    color: var(--mg-ink);
    display: block;
    font-family: 'Varela Round', sans-serif;
    font-size: 1.15rem;
}

.mg-progress {
    background: #e4e8ee;
    border: 2px solid var(--mg-ink);
    border-radius: 999px;
    height: 18px;
    margin: 0 auto 1.2rem;
    max-width: 620px;
    overflow: hidden;
}

.mg-progress__bar {
    background: var(--mg-yellow);
    height: 100%;
    transition: width 250ms ease;
    width: 0;
}

.mg-question {
    color: var(--mg-ink);
    font-family: 'Patrick Hand', cursive;
    font-size: clamp(3.4rem, 9vw, 6.5rem);
    line-height: 1;
    margin: 1.1rem 0;
}

.mg-answer-form {
    align-items: stretch;
    display: flex;
    gap: 0.65rem;
    justify-content: center;
    margin: 0 auto;
    max-width: 430px;
}

.mg-answer-input {
    background: #fff;
    border: 3px solid var(--mg-ink);
    border-radius: 14px;
    color: var(--mg-ink);
    font-family: 'Patrick Hand', cursive;
    font-size: 2rem;
    font-weight: 700;
    min-height: 58px;
    min-width: 0;
    padding: 0.4rem 0.8rem;
    text-align: center;
    width: 100%;
}

.mg-answer-input:focus {
    border-color: var(--mg-blue);
    box-shadow: 0 0 0 4px rgba(58, 110, 165, 0.18);
    outline: 0;
}

.mg-feedback {
    color: var(--mg-muted);
    font-family: 'Open Sans', sans-serif;
    font-weight: 700;
    min-height: 32px;
    padding-top: 0.75rem;
}

.mg-feedback.is-correct { color: #237a57; }
.mg-feedback.is-wrong { color: #b84236; }

.mg-choice-grid {
    display: grid;
    gap: 0.8rem;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    margin: 0 auto;
    max-width: 570px;
}

.mg-choice {
    background: #fff;
    border: 3px solid var(--mg-ink);
    border-radius: 16px;
    color: var(--mg-ink);
    cursor: pointer;
    font-family: 'Patrick Hand', cursive;
    font-size: 2rem;
    font-weight: 700;
    min-height: 72px;
    padding: 0.6rem;
    transition: transform 130ms ease, background 130ms ease;
}

.mg-choice:hover,
.mg-choice:focus-visible {
    background: #fff4c8;
    transform: translateY(-2px);
}

.mg-choice.is-correct {
    background: #ccebdc;
    border-color: #237a57;
}

.mg-choice.is-wrong {
    background: #f9d5d0;
    border-color: #b84236;
}

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

.mg-memory-grid {
    display: grid;
    gap: clamp(0.45rem, 2vw, 0.8rem);
    grid-template-columns: repeat(4, minmax(0, 1fr));
    margin: 0 auto;
    max-width: 680px;
}

.mg-memory-card {
    aspect-ratio: 1 / 0.82;
    background: var(--mg-blue);
    border: 3px solid var(--mg-ink);
    border-radius: 14px;
    color: #fff;
    cursor: pointer;
    font-family: 'Patrick Hand', cursive;
    font-size: clamp(1.1rem, 3vw, 1.65rem);
    font-weight: 700;
    min-height: 76px;
    padding: 0.35rem;
    position: relative;
    transform-style: preserve-3d;
    transition: background 180ms ease, transform 180ms ease;
}

.mg-memory-card::before {
    content: '?';
    font-size: 2rem;
}

.mg-memory-card span {
    display: none;
}

.mg-memory-card.is-flipped,
.mg-memory-card.is-matched {
    background: #fff;
    color: var(--mg-ink);
    transform: rotate(-1deg) scale(1.02);
}

.mg-memory-card.is-flipped::before,
.mg-memory-card.is-matched::before {
    display: none;
}

.mg-memory-card.is-flipped span,
.mg-memory-card.is-matched span {
    display: inline;
}

.mg-memory-card.is-matched {
    background: #ccebdc;
    border-color: #237a57;
    cursor: default;
}

.mg-race-track {
    align-items: center;
    display: grid;
    grid-template-columns: repeat(11, 1fr);
    margin: 1.2rem auto 1.5rem;
    max-width: 680px;
    position: relative;
}

.mg-race-track::before {
    background: var(--mg-cream);
    border: 2px solid var(--mg-ink);
    content: '';
    height: 10px;
    left: 2%;
    position: absolute;
    right: 2%;
    top: 50%;
    transform: translateY(-50%);
}

.mg-race-step {
    background: #fff;
    border: 2px solid var(--mg-ink);
    border-radius: 50%;
    height: 20px;
    justify-self: center;
    position: relative;
    width: 20px;
    z-index: 1;
}

.mg-race-step.is-passed {
    background: var(--mg-yellow);
}

.mg-race-runner {
    background: var(--mg-coral);
    border: 2px solid var(--mg-ink);
    border-radius: 8px;
    height: 34px;
    position: absolute;
    top: -8px;
    transform: translateX(-50%) rotate(-4deg);
    transition: left 260ms ease;
    width: 34px;
    z-index: 2;
}

.mg-arcade-game {
    max-width: 980px;
}

.mg-arcade-game .mg-hud {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    margin-bottom: 0.8rem;
}

.mg-arcade-question {
    color: var(--mg-ink);
    font-family: 'Patrick Hand', cursive;
    font-size: clamp(1.8rem, 5vw, 3.2rem);
    line-height: 1;
    margin: 0.35rem 0;
}

.mg-arcade-question strong {
    color: var(--mg-coral);
}

.mg-arcade-instruction {
    color: var(--mg-muted);
    font-size: 0.9rem;
    margin: 0.35rem auto 0.8rem;
    max-width: 760px;
}

.mg-arcade-stage {
    background: var(--mg-ink);
    border: 4px solid var(--mg-ink);
    border-radius: 20px;
    box-shadow: 6px 7px 0 rgba(24, 49, 83, 0.18);
    margin: 0 auto;
    max-width: 900px;
    overflow: hidden;
    position: relative;
}

.mg-arcade-canvas {
    aspect-ratio: 900 / 520;
    background: #bde9f3;
    display: block;
    height: auto;
    max-width: 100%;
    touch-action: none;
    width: 100%;
}

[data-mg-runner-canvas] {
    aspect-ratio: 900 / 440;
}

.mg-arcade-controls,
.mg-runner-controls {
    display: flex;
    gap: 0.75rem;
    justify-content: center;
    margin: 1rem auto 0;
}

.mg-arcade-controls button,
.mg-runner-controls button {
    background: #fff;
    border: 3px solid var(--mg-ink);
    border-radius: 14px;
    color: var(--mg-ink);
    cursor: pointer;
    font-weight: 700;
    min-height: 50px;
    padding: 0.65rem 1.1rem;
}

.mg-arcade-controls button:hover,
.mg-arcade-controls button:focus-visible,
.mg-runner-controls button:hover,
.mg-runner-controls button:focus-visible {
    background: var(--mg-cream);
}

.mg-runner-controls button[aria-pressed='true'] {
    background: var(--mg-yellow);
    box-shadow: 3px 4px 0 rgba(24, 49, 83, 0.18);
    transform: translateY(-2px);
}

.mg-runner-controls strong {
    font-family: 'Varela Round', sans-serif;
    font-size: 1.2rem;
}

.mg-result {
    margin: 0 auto;
    max-width: 600px;
    padding: 1.2rem 0;
    text-align: center;
}

.mg-result__badge {
    align-items: center;
    background: var(--mg-yellow);
    border: 3px solid var(--mg-ink);
    border-radius: 50%;
    display: inline-flex;
    font-family: 'Patrick Hand', cursive;
    font-size: 3.2rem;
    height: 110px;
    justify-content: center;
    transform: rotate(-4deg);
    width: 110px;
}

.mg-page .mg-result h3 {
    color: var(--mg-ink);
    font-family: 'Patrick Hand', cursive;
    font-size: 2.6rem;
    margin: 1rem 0 0.45rem;
    padding: 0;
    text-align: center;
}

.mg-page .mg-result h3::after { display: none; }

.mg-result p {
    color: var(--mg-muted);
    font-family: 'Open Sans', sans-serif;
    font-size: 1rem;
    line-height: 1.6;
}

.mg-result__actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.7rem;
    justify-content: center;
    margin-top: 1.1rem;
}

.mg-secondary-button {
    background: #fff;
    color: var(--mg-ink);
}

.mg-secondary-button:hover,
.mg-secondary-button:focus-visible {
    background: var(--mg-cream);
}

.mg-copy {
    background: var(--mg-cream);
    border-left: 5px solid var(--mg-coral);
    margin-top: 3rem;
    padding: clamp(1.2rem, 4vw, 2.4rem);
}

.mg-copy p,
.mg-copy li {
    color: #3f4c60;
    font-family: 'Open Sans', sans-serif;
    line-height: 1.7;
}

.mg-copy-grid {
    display: grid;
    gap: 1.4rem;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    margin-top: 1.5rem;
}

.mg-copy-card {
    background: #fff;
    border: 2px solid var(--mg-ink);
    border-radius: 15px;
    padding: 1.1rem;
}

.mg-page .mg-copy-card h3 {
    color: var(--mg-ink);
    font-family: 'Patrick Hand', cursive;
    font-size: 1.65rem;
    margin: 0 0 0.5rem;
    padding: 0;
}

.mg-page .mg-copy-card h3::after { display: none; }
.mg-copy-card p { margin: 0; }

.mg-faq details {
    background: #fff;
    border: 2px solid var(--mg-ink);
    border-radius: 13px;
    margin-top: 0.7rem;
    padding: 0.85rem 1rem;
}

.mg-faq summary {
    cursor: pointer;
    font-weight: 700;
}

.mg-faq details p {
    margin: 0.75rem 0 0;
}

.mg-sr-only {
    clip: rect(0, 0, 0, 0);
    clip-path: inset(50%);
    height: 1px;
    overflow: hidden;
    position: absolute;
    white-space: nowrap;
    width: 1px;
}

.mg-page :focus-visible {
    outline: 4px solid var(--mg-yellow);
    outline-offset: 3px;
}

.mg-shake {
    animation: mg-shake 260ms ease;
}

.mg-pop {
    animation: mg-pop 320ms ease;
}

@keyframes mg-shake {
    25% { transform: translateX(-7px); }
    50% { transform: translateX(7px); }
    75% { transform: translateX(-4px); }
}

@keyframes mg-pop {
    50% { transform: scale(1.07) rotate(-1deg); }
}

@media (max-width: 820px) {
    .mg-hero::after {
        opacity: 0.22;
    }

    .mg-control-panel {
        grid-template-columns: 1fr;
    }

    .mg-control-side {
        align-items: flex-start;
        flex-direction: row;
        justify-content: space-between;
    }

    .mg-best { text-align: left; }
    .mg-game-grid { grid-template-columns: 1fr; }
    .mg-game-card { grid-template-columns: 110px minmax(0, 1fr); }
}

@media (max-width: 560px) {
    .mg-page {
        margin-top: 0.75rem;
    }

    .mg-hero {
        border-radius: 20px 20px 34px 20px;
        padding: 1.2rem;
    }

    .mg-page .mg-hero h1 {
        font-size: clamp(2.1rem, 9vw, 2.4rem);
    }

    .mg-section-heading {
        align-items: flex-start;
        flex-direction: column;
    }

    .mg-section-heading p { text-align: left; }

    .mg-game-card {
        grid-template-columns: 86px minmax(0, 1fr);
        min-height: 0;
        padding: 0.9rem;
    }

    .mg-card-visual {
        border-radius: 14px 14px 28px 14px;
        min-height: 130px;
    }

    .mg-card-visual__big { font-size: 2.7rem; }
    .mg-card-memory { grid-template-columns: repeat(2, 27px); }
    .mg-card-memory span { height: 27px; }
    .mg-page .mg-card-body h3 { font-size: 1.65rem; }
    .mg-card-body p { font-size: 0.84rem; }

    .mg-card-rain { transform: scale(0.78); }
    .mg-card-mouse { transform: translateY(-8px) scale(0.78); }
    .mg-card-visual__small {
        font-size: 0.82rem;
        line-height: 1;
        text-align: center;
    }

    .mg-control-side {
        align-items: stretch;
        flex-direction: column;
    }

    .mg-answer-form {
        flex-direction: column;
    }

    .mg-primary-button {
        width: 100%;
    }

    .mg-arena__body {
        padding: 0.75rem;
    }

    .mg-arcade-game .mg-hud {
        gap: 0.45rem;
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .mg-hud__item {
        font-size: 0.68rem;
        padding: 0.4rem;
    }

    .mg-hud__item strong {
        font-size: 1rem;
    }

    .mg-arcade-question {
        font-size: 1.75rem;
    }

    .mg-arcade-instruction {
        font-size: 0.78rem;
        line-height: 1.35;
    }

    .mg-arcade-stage {
        border-width: 3px;
        border-radius: 14px;
        box-shadow: 3px 4px 0 rgba(24, 49, 83, 0.18);
    }

    .mg-arcade-controls,
    .mg-runner-controls {
        gap: 0.4rem;
    }

    .mg-arcade-controls button,
    .mg-runner-controls button {
        flex: 1;
        font-size: 0.8rem;
        min-width: 0;
        padding: 0.5rem 0.35rem;
    }

    .mg-runner-controls strong {
        display: block;
        font-size: 1rem;
    }

    .mg-best small {
        max-width: none;
    }

    .mg-memory-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .mg-choice {
        font-size: 1.65rem;
        min-height: 64px;
    }

    .mg-copy-grid { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
    .mg-page *,
    .mg-page *::before,
    .mg-page *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        scroll-behavior: auto !important;
        transition-duration: 0.01ms !important;
    }
}
