/* ============================================================
   GAMES SECTION
   ============================================================ */
.games-section {
    background: linear-gradient(180deg, #0d0118, #1a0828, #0d0118);
    padding: 2rem 0;
}

.games-tabs {
    display: flex;
    justify-content: center;
    gap: 0.7rem;
    margin-bottom: 2.5rem;
    flex-wrap: wrap;
}
.gtab {
    padding: 0.6rem 1.5rem;
    border-radius: 25px;
    border: 1px solid rgba(255,107,157,.3);
    background: rgba(255,107,157,.07);
    color: rgba(255,255,255,.6);
    font-family: var(--font-sans);
    font-size: 0.88rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.25s;
}
.gtab:hover  { background: rgba(255,107,157,.18); color: #fff; }
.gtab.active {
    background: linear-gradient(135deg, rgba(255,107,157,.32), rgba(198,120,221,.28));
    border-color: rgba(255,107,157,.6);
    color: #fff;
    box-shadow: 0 0 20px rgba(255,107,157,.22);
}

.gpanel        { display: none; }
.gpanel.active { display: flex; flex-direction: column; align-items: center; }

/* ── MEMORY MATCH ── */
.mem-stats {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    max-width: 380px;
    margin-bottom: 1.2rem;
    font-size: 0.88rem;
    color: rgba(255,255,255,.7);
}
.mem-reset {
    padding: 0.38rem 1rem;
    border-radius: 20px;
    border: 1px solid rgba(255,107,157,.4);
    background: rgba(255,107,157,.1);
    color: var(--pink);
    cursor: pointer;
    font-size: 0.82rem;
    font-weight: 600;
    transition: all 0.2s;
}
.mem-reset:hover { background: rgba(255,107,157,.25); box-shadow: var(--glow-pink); }

.mem-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.55rem;
    max-width: 380px;
    width: 100%;
}
.mem-hint {
    margin-top: 1rem;
    font-size: 0.8rem;
    color: rgba(255,255,255,.4);
    font-style: italic;
}

.mem-card {
    aspect-ratio: 1;
    cursor: pointer;
    perspective: 700px;
    -webkit-tap-highlight-color: transparent;
}
.mem-inner {
    position: relative;
    width: 100%; height: 100%;
    transform-style: preserve-3d;
    transition: transform 0.5s cubic-bezier(.25,.46,.45,.94);
    border-radius: 12px;
}
.mem-card.flipped .mem-inner,
.mem-card.matched .mem-inner { transform: rotateY(180deg); }

.mem-front, .mem-back {
    position: absolute;
    inset: 0;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
    font-size: 1.55rem;
}
.mem-front {
    background: linear-gradient(135deg, rgba(255,107,157,.18), rgba(198,120,221,.18));
    border: 1px solid rgba(255,107,157,.3);
    box-shadow: 0 4px 14px rgba(0,0,0,.35);
    font-size: 1.1rem;
}
.mem-back {
    background: linear-gradient(135deg, rgba(255,107,157,.12), rgba(198,120,221,.12));
    border: 1px solid rgba(255,107,157,.35);
    transform: rotateY(180deg);
}
.mem-card.matched .mem-back {
    background: linear-gradient(135deg, rgba(255,107,157,.35), rgba(198,120,221,.35));
    border-color: var(--pink);
    box-shadow: 0 0 18px rgba(255,107,157,.45);
    animation: matchPop 0.38s ease;
}
@keyframes matchPop {
    0%   { transform: rotateY(180deg) scale(1); }
    50%  { transform: rotateY(180deg) scale(1.18); }
    100% { transform: rotateY(180deg) scale(1); }
}

/* ── SPIN WHEEL ── */
.wheel-wrap {
    display: flex;
    flex-direction: column;
    align-items: center;
}
.wheel-arrow {
    font-size: 2rem;
    color: #fff;
    text-shadow: 0 0 12px var(--pink), var(--glow-pink);
    margin-bottom: -4px;
    z-index: 5;
    animation: pulse 1.4s ease-in-out infinite;
    line-height: 1;
}
.wheel-canvas {
    border-radius: 50%;
    display: block;
    box-shadow:
        0 0 0 4px rgba(255,107,157,.25),
        0 0 50px rgba(255,107,157,.25),
        0 0 100px rgba(198,120,221,.15);
}
.spin-btn {
    margin-top: 1.6rem;
    padding: 0.9rem 2.6rem;
    border: none;
    border-radius: 50px;
    background: linear-gradient(135deg, var(--pink), var(--purple));
    color: #fff;
    font-size: 1.05rem;
    font-weight: 700;
    font-family: var(--font-sans);
    cursor: pointer;
    box-shadow: 0 6px 30px rgba(255,107,157,.5);
    transition: transform 0.2s, box-shadow 0.2s;
}
.spin-btn:hover    { transform: scale(1.07); box-shadow: 0 8px 40px rgba(255,107,157,.7); }
.spin-btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }

.wheel-result {
    margin-top: 1.4rem;
    min-height: 90px;
    text-align: center;
    max-width: 340px;
    width: 100%;
}
.wheel-result-card {
    padding: 1.2rem 1.8rem;
    background: rgba(255,107,157,.09);
    border: 1px solid rgba(255,107,157,.3);
    border-radius: 18px;
    backdrop-filter: blur(10px);
    animation: fadeUp 0.5s ease;
    box-shadow: 0 0 25px rgba(255,107,157,.12);
}
.wheel-result-label { font-family: var(--font-script); font-size: 1.55rem; color: var(--pink); margin-bottom: 0.5rem; }
.wheel-result-msg   { font-size: 0.93rem; color: rgba(255,255,255,.85); font-style: italic; line-height: 1.65; }

/* ── SCRATCH CARD ── */
.scratch-wrap { display: flex; flex-direction: column; align-items: center; gap: 1rem; width: 100%; }
.scratch-hint { font-size: 0.88rem; color: rgba(255,255,255,.55); font-style: italic; }

.scratch-container {
    position: relative;
    width: 320px;
    height: 200px;
    border-radius: 18px;
    overflow: hidden;
    box-shadow: 0 12px 45px rgba(0,0,0,.45), 0 0 35px rgba(255,107,157,.18);
    border: 1px solid rgba(255,107,157,.25);
}
.scratch-reveal {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    background: linear-gradient(135deg, #2a0845, #1e0438);
    padding: 1.4rem 1.8rem;
}
.sr-icon { font-size: 2rem; animation: heartbeat 1.5s ease-in-out infinite; }
.sr-msg  { font-family: var(--font-script); font-size: 1.2rem; color: var(--light-pink); text-align: center; line-height: 1.6; }

.scratch-canvas {
    position: absolute;
    inset: 0;
    cursor: crosshair;
    touch-action: none;
    transition: opacity 0.7s ease;
}

.scratch-progress {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    width: 320px;
    max-width: 100%;
}
.scratch-bar {
    flex: 1;
    height: 6px;
    background: rgba(255,255,255,.1);
    border-radius: 3px;
    overflow: hidden;
}
.scratch-fill {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, var(--pink), var(--purple));
    border-radius: 3px;
    transition: width 0.25s ease;
}
#scratchPct { font-size: 0.74rem; color: rgba(255,255,255,.45); white-space: nowrap; }

.scratch-new {
    padding: 0.55rem 1.5rem;
    border-radius: 25px;
    border: 1px solid rgba(255,107,157,.4);
    background: rgba(255,107,157,.1);
    color: var(--pink);
    cursor: pointer;
    font-size: 0.86rem;
    font-weight: 600;
    transition: all 0.2s;
}
.scratch-new:hover { background: rgba(255,107,157,.25); box-shadow: var(--glow-pink); }

/* ── WIN TOAST ── */
.game-toast {
    position: fixed;
    top: 80px;
    left: 50%;
    transform: translateX(-50%) translateY(-16px);
    background: linear-gradient(135deg, #1e0438, #2d0650);
    border: 1px solid rgba(255,107,157,.5);
    border-radius: 20px;
    padding: 1.1rem 2rem;
    text-align: center;
    z-index: 8500;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.38s ease, transform 0.38s ease;
    box-shadow: 0 12px 50px rgba(255,107,157,.3);
    min-width: 220px;
}
.game-toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.game-toast h3   { font-family: var(--font-script); font-size: 1.5rem; color: var(--pink); }
.game-toast p    { font-size: 0.82rem; color: rgba(255,255,255,.65); margin-top: 0.25rem; }

/* Responsive */
@media (max-width: 480px) {
    .mem-grid  { max-width: 300px; gap: 0.42rem; }
    .mem-front, .mem-back { font-size: 1.3rem; }
    .wheel-canvas { width: 260px !important; height: 260px !important; }
    .scratch-container { width: 280px; height: 180px; }
    .scratch-canvas    { width: 280px !important; height: 180px !important; }
    .scratch-progress  { width: 280px; }
}
