/* ============================================================
   V16 — THE MUTANT ARCADE.
   Five arcade games in vanilla JS + canvas/DOM. No libraries,
   no images, no external anything. Green-on-black, same as the
   rest of the site; mutant colours from the site's own pool.
   ============================================================ */

/* --- Lobby cards --- */
.mm-arcade-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 14px;
    margin: 16px 0;
}
.mm-arcade-card {
    border: 2px solid var(--accent, #00FF66);
    background: #001a08;
    padding: 14px;
    text-align: center;
    box-shadow: 0 0 10px rgba(0, 255, 102, 0.25);
}
.mm-arcade-card h3 {
    margin: 0 0 6px;
    color: var(--text, #00FF66);
    font-family: monospace;
    letter-spacing: 1px;
}
.mm-arcade-card p {
    margin: 0 0 10px;
    font-size: 0.92em;
    line-height: 1.5;
    opacity: 0.9;
}
.mm-arcade-card .mm-best {
    display: block;
    margin: 8px 0 0;
    font-size: 0.85em;
    opacity: 0.85;
}
.mm-arcade-card .mm-best:empty {
    display: none;
}

/* --- Score bar above every game --- */
.mm-game-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 22px;
    justify-content: center;
    margin: 10px 0;
    padding: 8px 12px;
    border: 1px solid var(--accent, #00FF66);
    background: #001a08;
    font-family: monospace;
    font-size: 1.05em;
    letter-spacing: 1px;
}
.mm-game-bar span {
    white-space: nowrap;
}

/* --- Canvas + stage --- */
.mm-game-stage {
    margin: 12px auto 0;
    max-width: 520px;
    text-align: center;
}
.mm-game-stage canvas {
    display: block;
    width: 100%;
    max-width: 480px;
    height: auto;
    margin: 0 auto;
    background: #000;
    border: 2px solid var(--accent, #00FF66);
    box-shadow: 0 0 14px rgba(0, 255, 102, 0.3);
    touch-action: none;
}
.mm-game-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: center;
    margin: 12px 0 4px;
}
.mm-game-buttons .term-btn:disabled {
    opacity: 0.45;
    cursor: default;
}

/* --- Game-over / win banner --- */
.mm-game-over {
    margin: 12px auto 0;
    padding: 12px 16px;
    border: 2px solid var(--accent, #00FF66);
    background: #001a08;
    font-family: monospace;
    font-size: 1.15em;
    line-height: 1.6;
    box-shadow: 0 0 14px rgba(0, 255, 102, 0.35);
    min-height: 1.6em;
}
.mm-game-over:empty {
    display: none;
}

/* --- On-screen touch buttons (Invaders + Snake) --- */
.mm-touch {
    display: flex;
    gap: 10px;
    justify-content: center;
    margin: 12px 0 0;
    user-select: none;
    -webkit-user-select: none;
}
.mm-touch .term-btn {
    padding: 10px 18px;
    font-size: 1.1em;
    touch-action: none;
}
.mm-touch .mm-touch-fire {
    border-color: #FF5C8A;
    color: #FF5C8A;
    box-shadow: inset 0 0 6px #FF5C8A, 0 0 8px #FF5C8A;
}

/* --- Whack-a-Mutant tubes --- */
.mm-whack-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    max-width: 460px;
    margin: 14px auto 0;
}
.mm-whack-tube {
    position: relative;
    height: 150px;
    border: 2px solid var(--accent, #00FF66);
    border-radius: 0 0 26px 26px;
    background: linear-gradient(#001a08, #000);
    overflow: hidden;
    cursor: pointer;
    box-shadow: inset 0 0 12px rgba(0, 255, 102, 0.2);
}
.mm-whack-tube::before {
    /* The rim of the test tube */
    content: "";
    position: absolute;
    top: 0;
    left: -2px;
    right: -2px;
    height: 10px;
    border: 2px solid var(--accent, #00FF66);
    border-bottom: none;
    background: #001a08;
    z-index: 3;
}
.mm-whack-tube::after {
    /* The potion at the bottom of the tube */
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    height: 34px;
    background: rgba(0, 255, 102, 0.18);
    border-top: 1px solid rgba(0, 255, 102, 0.5);
    z-index: 1;
}
.mm-whack-mutant {
    position: absolute;
    left: 50%;
    bottom: 8px;
    width: 96px;
    height: 96px;
    margin-left: -48px;
    transform: translateY(130px);
    transition: transform 0.28s cubic-bezier(0.2, 1.3, 0.4, 1);
    z-index: 2;
    filter: drop-shadow(0 0 8px rgba(0, 255, 102, 0.45));
}
.mm-whack-tube.up .mm-whack-mutant {
    transform: translateY(0);
}
.mm-whack-tube.whacked .mm-whack-mutant {
    animation: mm-whack-squash 0.25s ease-in;
}
@keyframes mm-whack-squash {
    0%   { transform: translateY(0) scale(1); }
    50%  { transform: translateY(0) scale(1.25, 0.7); }
    100% { transform: translateY(130px) scale(1); }
}
.mm-whack-mutant svg {
    width: 96px;
    height: 96px;
}
.mm-whack-points {
    position: absolute;
    top: 14px;
    left: 50%;
    transform: translateX(-50%);
    font-family: monospace;
    font-size: 1.2em;
    font-weight: bold;
    color: #FFD23F;
    text-shadow: 0 0 8px #FFD23F;
    z-index: 4;
    pointer-events: none;
    opacity: 0;
}
.mm-whack-points.show {
    animation: mm-whack-points-float 0.7s ease-out;
}
@keyframes mm-whack-points-float {
    0%   { opacity: 1; transform: translateX(-50%) translateY(0); }
    100% { opacity: 0; transform: translateX(-50%) translateY(-26px); }
}

/* --- Controls note under each game --- */
.mm-controls {
    margin: 12px auto 0;
    max-width: 520px;
    font-size: 0.9em;
    line-height: 1.6;
    opacity: 0.85;
    text-align: center;
}

@media (max-width: 600px) {
    .mm-whack-tube { height: 120px; }
    .mm-whack-mutant, .mm-whack-mutant svg { width: 76px; height: 76px; }
    .mm-whack-mutant { margin-left: -38px; }
    .mm-game-bar { font-size: 0.95em; }
}

@media (prefers-reduced-motion: reduce) {
    .mm-whack-mutant { transition: none; }
    .mm-whack-tube.whacked .mm-whack-mutant { animation: none; }
    .mm-whack-points.show { animation: none; }
}
