:root {
    --neon-pink: #ff2bd6;
    --neon-cyan: #2bfff2;
    --neon-yellow: #ffe14a;
    --neon-lime: #7dff6b;
    --ink: #070014;
    --pad: clamp(12px, 2.4vw, 28px);
}
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
    background:
        radial-gradient(ellipse 80% 50% at 50% 115%, rgba(125, 255, 107, 0.14), transparent 55%),
        radial-gradient(ellipse 60% 40% at 80% 0%, rgba(43, 255, 242, 0.1), transparent 50%),
        linear-gradient(#12002a 0%, #070014 50%, #140018 100%);
    color: var(--neon-cyan);
    font-family: 'VT323', monospace;
    padding: var(--pad);
    padding-bottom: 48px;
}
.top {
    display: flex; flex-wrap: wrap; gap: 12px; align-items: center;
    justify-content: space-between; margin-bottom: 18px;
}
.brand {
    font-family: 'Press Start 2P', monospace;
    font-size: clamp(10px, 2vw, 14px);
    color: var(--neon-yellow);
    text-shadow: 0 0 8px var(--neon-yellow);
    text-decoration: none;
}
h1 {
    font-family: 'Press Start 2P', monospace;
    font-size: clamp(14px, 3.2vw, 28px);
    color: var(--neon-lime);
    text-shadow: 2px 2px 0 var(--neon-pink);
    margin: 0 0 8px;
}
.sub { font-size: 22px; color: #fff; margin: 0 0 22px; opacity: 0.9; line-height: 1.25; }
.hub {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 14px;
}
button.tile {
    display: block; width: 100%; text-align: left; cursor: pointer;
    font: inherit; color: inherit;
    border: 3px solid var(--neon-cyan);
    background: linear-gradient(180deg, #240044 0%, #0c001c 100%);
    padding: 16px 14px;
    box-shadow: 0 0 0 3px #000, 5px 5px 0 rgba(255, 43, 214, 0.55);
    min-height: 128px;
}
button.tile:hover, button.tile:focus-visible {
    background: #2a0058; color: #fff;
    transform: translate(-2px, -2px);
    box-shadow: 0 0 0 3px #000, 7px 7px 0 var(--neon-yellow);
}
button.tile .t {
    font-family: 'Press Start 2P', monospace;
    font-size: clamp(10px, 1.6vw, 13px);
    line-height: 1.5; color: var(--neon-cyan);
    margin-bottom: 8px;
}
button.tile:hover .t { color: #fff; }
button.tile .b { font-size: 19px; color: #fff; opacity: 0.88; line-height: 1.2; }
.tile.coil { border-color: var(--neon-lime); }
.tile.break { border-color: var(--neon-pink); }
.tile.memory { border-color: var(--neon-yellow); }
.tile.stack { border-color: #9b5cff; }
.tile.drift { border-color: var(--neon-cyan); }

.stage { display: none; }
.stage.on { display: block; }
.hub.hidden { display: none; }

.game-bar {
    display: flex; flex-wrap: wrap; gap: 10px; align-items: center;
    justify-content: space-between; margin-bottom: 12px;
}
.game-bar h2 {
    font-family: 'Press Start 2P', monospace;
    font-size: clamp(11px, 2vw, 16px);
    color: var(--neon-yellow);
    margin: 0;
    line-height: 1.5;
}
.how { font-size: 20px; color: #fff; margin: 0 0 12px; line-height: 1.3; }
.meta {
    display: flex; flex-wrap: wrap; gap: 10px; align-items: center;
    margin-bottom: 12px; font-size: 22px; color: #fff;
}
.meta b { color: var(--neon-yellow); }
.btn {
    font-family: 'Press Start 2P', monospace;
    font-size: 10px;
    padding: 10px 12px;
    cursor: pointer;
    color: #070014;
    background: var(--neon-yellow);
    border: 3px solid #fff;
    box-shadow: 3px 3px 0 var(--neon-pink);
    text-decoration: none;
}
.btn.ghost {
    background: #0c001c;
    color: var(--neon-cyan);
    border-color: var(--neon-cyan);
    box-shadow: 3px 3px 0 rgba(255, 43, 214, 0.5);
}
.btn:hover { transform: translate(-1px, -1px); }
.status { min-height: 1.2em; color: var(--neon-lime); }

.playfield {
    width: min(520px, 100%);
    margin: 0 auto 14px;
    border: 4px solid var(--neon-cyan);
    background: #050010;
    box-shadow: 0 0 0 4px #000, 8px 8px 0 rgba(255, 43, 214, 0.45);
}
#gameCanvas {
    display: block;
    width: 100%;
    height: auto;
    image-rendering: pixelated;
    background: #020008;
    touch-action: none;
}
#gameBoard {
    display: none;
    padding: 10px;
}
#gameBoard.on {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
}
.card {
    aspect-ratio: 1;
    border: 3px solid #2bfff2;
    background: #16002a;
    color: #fff;
    cursor: pointer;
    font-size: clamp(22px, 6vw, 36px);
    display: flex; align-items: center; justify-content: center;
    box-shadow: 3px 3px 0 #000;
}
.card.back { color: transparent; background: linear-gradient(180deg, #2a0058, #0c001c); }
.card.back::after { content: '?'; color: var(--neon-cyan); font-family: 'Press Start 2P', monospace; font-size: 14px; }
.card.matched { border-color: var(--neon-lime); box-shadow: 0 0 12px rgba(125, 255, 107, 0.45); }
.card:disabled { cursor: default; }

.touch-pad {
    display: flex; flex-wrap: wrap; gap: 8px; justify-content: center;
    width: min(520px, 100%);
    margin: 0 auto;
}
.touch-pad button {
    min-width: 72px;
    min-height: 48px;
    font-family: 'Press Start 2P', monospace;
    font-size: 9px;
    color: var(--neon-cyan);
    background: #0c001c;
    border: 3px solid var(--neon-cyan);
    cursor: pointer;
}
.touch-pad button:active { background: #2a0058; color: #fff; }
.note { text-align: center; font-size: 18px; color: #fff; opacity: 0.7; margin-top: 18px; }
