/* =============================================
   QUANTUM BUTTON V1.0.0 — GAME.CSS
   Game VFX, button skins, robot variants
   ============================================= */

/* --- VFX OVERLAYS --- */
.scanlines { background: linear-gradient(to bottom, rgba(255,255,255,0), rgba(255,255,255,0) 50%, rgba(0,0,0,0.15) 50%, rgba(0,0,0,0.15)); background-size: 100% 4px; pointer-events: none !important; z-index: 50; }
.vignette { background: radial-gradient(circle, transparent 50%, black 120%); pointer-events: none !important; z-index: 51; }
#q-button { will-change: transform; transform: translateZ(0); backface-visibility: hidden; overflow: visible !important; }

/* --- DEVIL HORNS (generic, used by multiple skins) --- */
.horn-left, .horn-right {
    position: absolute;
    top: -10px;
    width: 0;
    height: 0;
    border-left: 8px solid transparent;
    border-right: 8px solid transparent;
    border-bottom: 20px solid red;
    z-index: -1;
}
.horn-left { left: 10px; transform: rotate(-30deg); }
.horn-right { right: 10px; transform: rotate(30deg); }

/* ============================================
   BASE ROBOT SKIN
   ============================================ */
.skin-robot {
    background: radial-gradient(circle at 30% 30%, #718096, #2d3748) !important;
    border: 3px solid #cbd5e0 !important;
    box-shadow: inset 0 0 20px rgba(0,0,0,0.5), 0 0 15px #a0aec0 !important;
    position: relative;
    overflow: hidden !important;
}

/* Robot Eyes */
.skin-robot::before, .skin-robot::after {
    content: '';
    position: absolute;
    top: 35%;
    width: 12px;
    height: 12px;
    background: #00f3ff;
    border-radius: 50%;
    box-shadow: 0 0 8px #00f3ff;
    animation: blink-eyes 4s infinite;
}

.skin-robot::before { left: 25%; }
.skin-robot::after { right: 25%; }

@keyframes blink-eyes {
    0%, 96%, 100% { transform: scaleY(1); }
    98% { transform: scaleY(0.1); }
}

/* ============================================
   ROBOT SKIN VARIANTS
   ============================================ */

/* --- GOLD ROBOT --- */
.skin-robot-gold {
    background: linear-gradient(135deg, #b8860b 0%, #ffd700 25%, #fff8dc 40%, #ffd700 55%, #daa520 75%, #b8860b 100%) !important;
    background-size: 300% 300% !important;
    animation: gold-shimmer 3s ease-in-out infinite !important;
    border: 3px solid #fff !important;
    box-shadow: inset 0 0 20px rgba(255,255,255,0.5), 0 0 30px #ffd700, 0 0 60px rgba(255,215,0,0.3) !important;
    position: relative;
    overflow: hidden !important;
}

@keyframes gold-shimmer {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

/* Sparkle overlay */
.skin-robot-gold::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: linear-gradient(
        45deg,
        transparent 30%,
        rgba(255,255,255,0.3) 45%,
        rgba(255,255,255,0.6) 50%,
        rgba(255,255,255,0.3) 55%,
        transparent 70%
    );
    animation: gold-sparkle-sweep 2.5s ease-in-out infinite;
    pointer-events: none;
    z-index: 1;
}

@keyframes gold-sparkle-sweep {
    0% { transform: translateX(-100%) rotate(45deg); }
    100% { transform: translateX(100%) rotate(45deg); }
}

.skin-robot-gold::after {
    content: none;
}

/* Gold eye styling */
.skin-robot-gold .gold-eye {
    position: absolute;
    top: 35%;
    width: 14px;
    height: 14px;
    background: radial-gradient(circle, #fff 20%, #ffd700 60%, #b8860b 100%);
    border-radius: 50%;
    box-shadow: 0 0 12px #ffd700, 0 0 24px rgba(255, 215, 0, 0.4);
    animation: gold-eye-glow 2s ease-in-out infinite, blink-eyes 3s infinite;
    z-index: 5;
    pointer-events: none;
}

.skin-robot-gold .gold-eye-left { left: 25%; }
.skin-robot-gold .gold-eye-right { right: 25%; }

@keyframes gold-eye-glow {
    0%, 100% { box-shadow: 0 0 12px #ffd700, 0 0 24px rgba(255, 215, 0, 0.4); }
    50% { box-shadow: 0 0 20px #ffd700, 0 0 40px rgba(255, 215, 0, 0.6); }
}

/* --- NEON ROBOT --- */
.skin-robot-neon {
    background: #0a0a0a !important;
    border: 2px solid #00f3ff !important;
    box-shadow: inset 0 0 30px rgba(0,243,255,0.3), 0 0 20px #00f3ff !important;
    position: relative;
    overflow: hidden !important;
}

.skin-robot-neon::before, .skin-robot-neon::after {
    content: '';
    position: absolute;
    top: 35%;
    width: 12px;
    height: 12px;
    background: #00f3ff;
    border-radius: 50%;
    box-shadow: 0 0 15px #00f3ff, 0 0 30px #ff0099;
    animation: neon-eyes 2s ease-in-out infinite;
}

.skin-robot-neon::before { left: 25%; }
.skin-robot-neon::after { right: 25%; }

@keyframes neon-eyes {
    0%, 100% { background: #00f3ff; box-shadow: 0 0 15px #00f3ff; }
    25% { background: #ff0099; box-shadow: 0 0 15px #ff0099; }
    50% { background: #00ff00; box-shadow: 0 0 15px #00ff00; }
    75% { background: #ffff00; box-shadow: 0 0 15px #ffff00; }
}

/* --- GLITCH ROBOT --- */
.skin-robot-glitch {
    background: #0a0a0a !important;
    border: 2px solid #0f0 !important;
    box-shadow: inset 0 0 25px rgba(0,255,0,0.15), 0 0 20px rgba(0,255,0,0.5), 0 0 40px rgba(0,255,0,0.2) !important;
    position: relative;
    overflow: hidden !important;
    animation: glitch-shake 0.15s steps(3) infinite;
}

/* Terminal-style flat rectangle eyes with RGB split */
.skin-robot-glitch::before, .skin-robot-glitch::after {
    content: '';
    position: absolute;
    top: 35%;
    width: 16px;
    height: 5px;
    background: #0f0;
    border-radius: 1px;
    box-shadow: 0 0 8px #0f0, 0 0 20px #0f0, 3px 0 0 rgba(255,0,0,0.6), -3px 0 0 rgba(0,0,255,0.6);
    animation: glitch-eyes 0.08s steps(2) infinite;
}
.skin-robot-glitch::before { left: 22%; }
.skin-robot-glitch::after { right: 22%; }

/* Scanline overlay on button */
.skin-robot-glitch .glitch-scanlines {
    position: absolute;
    inset: 0;
    border-radius: 50%;
    background: repeating-linear-gradient(
        0deg, transparent, transparent 2px,
        rgba(0,255,0,0.04) 2px, rgba(0,255,0,0.04) 4px
    );
    pointer-events: none;
    z-index: 1;
}

/* RGB channel split ghost */
.skin-robot-glitch .glitch-rgb {
    position: absolute;
    inset: -2px;
    border-radius: 50%;
    border: 2px solid rgba(255,0,0,0.3);
    animation: glitch-rgb-shift 0.2s steps(2) infinite;
    pointer-events: none;
    z-index: 2;
}

/* Random corruption bar */
.skin-robot-glitch .glitch-corrupt {
    position: absolute;
    left: 0;
    width: 100%;
    height: 8%;
    background: linear-gradient(90deg, transparent 10%, #0f0 30%, #0ff 50%, #0f0 70%, transparent 90%);
    mix-blend-mode: difference;
    animation: glitch-corrupt-bar 4s steps(1) infinite;
    pointer-events: none;
    z-index: 3;
    opacity: 0;
}

@keyframes glitch-shake {
    0%   { transform: translate(0) skewX(0deg); }
    10%  { transform: translate(-3px, 2px) skewX(0.5deg); }
    20%  { transform: translate(2px, -3px) skewX(-0.3deg); }
    30%  { transform: translate(-1px, -1px); }
    40%  { transform: translate(3px, 1px) skewX(0.8deg); }
    50%  { transform: translate(-2px, 3px); }
    60%  { transform: translate(1px, -2px) skewX(-0.5deg); }
    70%  { transform: translate(-3px, -1px); }
    80%  { transform: translate(2px, 2px) skewX(0.3deg); }
    90%  { transform: translate(-1px, 3px); }
    100% { transform: translate(0) skewX(0deg); }
}

@keyframes glitch-eyes {
    0%   { opacity: 1; transform: translate(0); box-shadow: 0 0 8px #0f0, 0 0 20px #0f0, 3px 0 0 rgba(255,0,0,0.6), -3px 0 0 rgba(0,0,255,0.6); }
    50%  { opacity: 0.6; transform: translate(3px, -2px); box-shadow: 0 0 12px #0f0, 0 0 25px #0f0, -4px 0 0 rgba(255,0,0,0.8), 4px 0 0 rgba(0,0,255,0.8); }
    100% { opacity: 1; transform: translate(-1px, 1px); }
}

@keyframes glitch-rgb-shift {
    0%   { transform: translate(2px, -1px); border-color: rgba(255,0,0,0.3); }
    25%  { transform: translate(-3px, 1px); border-color: rgba(0,0,255,0.4); }
    50%  { transform: translate(1px, 2px); border-color: rgba(255,0,255,0.3); }
    75%  { transform: translate(-1px, -2px); border-color: rgba(0,255,255,0.4); }
    100% { transform: translate(2px, -1px); border-color: rgba(255,0,0,0.3); }
}

@keyframes glitch-corrupt-bar {
    0%, 10%  { top: 20%; opacity: 0; }
    11%      { top: 20%; opacity: 0.7; }
    13%      { opacity: 0; }
    40%, 50% { top: 65%; opacity: 0; }
    51%      { top: 65%; opacity: 0.9; }
    53%      { opacity: 0; }
    75%, 82% { top: 40%; opacity: 0; }
    83%      { top: 40%; opacity: 0.5; }
    85%      { opacity: 0; }
    100%     { opacity: 0; }
}

/* Glitch tap flash — spawned by engine-tap.js */
.glitch-tap-flash {
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 50;
    background: linear-gradient(
        0deg,
        transparent 25%,
        rgba(0,255,0,0.2) 25%, rgba(0,255,0,0.2) 28%, transparent 28%,
        transparent 55%,
        rgba(255,0,0,0.15) 55%, rgba(255,0,0,0.15) 57%, transparent 57%,
        transparent 80%,
        rgba(0,0,255,0.12) 80%, rgba(0,0,255,0.12) 82%, transparent 82%
    );
    animation: glitch-flash-out 0.15s ease-out forwards;
    mix-blend-mode: screen;
}

@keyframes glitch-flash-out {
    0%   { opacity: 1; transform: translateX(-4px); }
    50%  { transform: translateX(4px); }
    100% { opacity: 0; transform: translateX(0); }
}

/* --- DEVIL ROBOT --- */
.skin-robot-devil {
    background: radial-gradient(circle at 30% 30%, #ffaaaa, #cc0000) !important;
    border: 3px solid #ff0000 !important;
    box-shadow: inset 0 0 20px rgba(0,0,0,0.5), 0 0 30px rgba(255,0,0,0.8) !important;
    position: relative;
    overflow: visible !important;
}

.skin-robot-devil::before, .skin-robot-devil::after {
    content: '';
    position: absolute;
    top: 35%;
    width: 14px;
    height: 14px;
    background: #ff0000;
    border-radius: 50%;
    box-shadow: 0 0 15px #ff0000, inset 0 0 5px #ffff00;
    animation: devil-eyes 1s ease-in-out infinite;
}

.skin-robot-devil::before { left: 22%; }
.skin-robot-devil::after { right: 22%; }

@keyframes devil-eyes {
    0%, 100% { box-shadow: 0 0 15px #ff0000, inset 0 0 5px #ffff00; }
    50% { box-shadow: 0 0 25px #ff0000, inset 0 0 8px #fff; }
}

/* Devil Horns - Applied via additional elements */
.skin-robot-devil .horn-left,
.skin-robot-devil .horn-right {
    position: absolute;
    top: -12px;
    width: 0;
    height: 0;
    border-left: 10px solid transparent;
    border-right: 10px solid transparent;
    border-bottom: 24px solid #cc0000;
    filter: drop-shadow(0 0 5px #ff0000);
    z-index: 10;
}

.skin-robot-devil .horn-left { left: 8px; transform: rotate(-25deg); }
.skin-robot-devil .horn-right { right: 8px; transform: rotate(25deg); }

/* --- ANIME ROBOT (D7) --- */
.skin-robot-anime {
    background: linear-gradient(180deg, #ffb3d9 0%, #ff69b4 35%, #e84393 65%, #c44eff 100%);
    border: 3px solid #1a1a2e !important;
    border-radius: 50%;
    box-shadow:
        inset 0 -25px 20px rgba(0,0,0,0.35),
        inset 0 12px 12px rgba(255,255,255,0.2),
        0 0 25px rgba(232,67,147,0.5);
    position: relative;
    overflow: hidden !important;
}

/* Anime eyes — white sclera ovals */
.skin-robot-anime .anime-eye-l,
.skin-robot-anime .anime-eye-r {
    position: absolute;
    width: 28%;
    height: 34%;
    top: 22%;
    background: #fff;
    border-radius: 50% 50% 45% 45%;
    border: 2.5px solid #1a1a2e;
    overflow: hidden;
    z-index: 2;
}
.skin-robot-anime .anime-eye-l { left: 13%; }
.skin-robot-anime .anime-eye-r { right: 13%; }

/* Iris + pupil inside each eye */
.skin-robot-anime .anime-eye-l::before,
.skin-robot-anime .anime-eye-r::before {
    content: '';
    position: absolute;
    width: 72%;
    height: 78%;
    bottom: 2%;
    left: 14%;
    border-radius: 50%;
    background: radial-gradient(circle at 45% 40%, #9b59b6 0%, #6b3fa0 40%, #2d1b69 70%, #1a1a2e 100%);
    box-shadow: inset 0 -4px 6px rgba(0,0,0,0.5);
}

/* Main highlight reflection in each eye */
.skin-robot-anime .anime-eye-l::after,
.skin-robot-anime .anime-eye-r::after {
    content: '';
    position: absolute;
    width: 30%;
    height: 28%;
    top: 16%;
    left: 18%;
    border-radius: 50%;
    background: #fff;
    box-shadow: 10px 12px 0 2px rgba(255,255,255,0.45);
    animation: anime-eye-sparkle 2s ease-in-out infinite;
    z-index: 3;
}

/* Small happy mouth arc */
.skin-robot-anime .anime-mouth {
    position: absolute;
    width: 18%;
    height: 10%;
    bottom: 20%;
    left: 41%;
    border: none;
    border-bottom: 2.5px solid #1a1a2e;
    border-radius: 0 0 50% 50%;
    z-index: 2;
}

/* Shine sweep across button */
.skin-robot-anime .anime-shine {
    position: absolute;
    top: 0;
    left: -60%;
    width: 35%;
    height: 100%;
    background: linear-gradient(100deg, transparent 20%, rgba(255,255,255,0.25) 50%, transparent 80%);
    transform: skewX(-20deg);
    animation: anime-shine-sweep 3.5s ease-in-out infinite;
    pointer-events: none;
    z-index: 4;
}

@keyframes anime-eye-sparkle {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.75; transform: scale(0.85); }
}

@keyframes anime-shine-sweep {
    0%, 15%  { left: -60%; opacity: 0; }
    20%      { opacity: 1; }
    50%      { left: 130%; opacity: 1; }
    55%, 100% { left: 130%; opacity: 0; }
}

/* Anime speed lines — spawned by engine-tap.js on each tap */
.anime-speed-lines {
    position: absolute;
    width: 180px;
    height: 180px;
    transform: translate(-50%, -50%);
    pointer-events: none;
    z-index: 50;
    background: repeating-conic-gradient(
        transparent 0deg, transparent 5deg,
        rgba(255,126,179,0.5) 5deg, rgba(255,126,179,0.5) 6.5deg
    );
    border-radius: 50%;
    animation: anime-speed-burst 0.4s ease-out forwards;
}

@keyframes anime-speed-burst {
    0%   { opacity: 1; transform: translate(-50%, -50%) scale(0.15) rotate(0deg); }
    100% { opacity: 0; transform: translate(-50%, -50%) scale(1.6) rotate(25deg); }
}

/* Anime impact flash — brief white screen punch */
.anime-impact-flash {
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 49;
    background: radial-gradient(circle at var(--ix, 50%) var(--iy, 50%), rgba(255,255,255,0.4) 0%, transparent 60%);
    animation: anime-impact-fade 0.25s ease-out forwards;
}

@keyframes anime-impact-fade {
    0%   { opacity: 1; }
    100% { opacity: 0; }
}

/* --- COSMIC ROBOT (D7) --- */
.skin-robot-cosmic {
    background: radial-gradient(circle at 30% 30%, #1a0533, #0d0221);
    border-radius: 50%;
    box-shadow: 0 0 30px rgba(100, 50, 255, 0.5), 0 0 60px rgba(0, 200, 255, 0.2), inset 0 -8px 12px rgba(0,0,0,0.6);
    position: relative;
    overflow: hidden;
}
.skin-robot-cosmic::before, .skin-robot-cosmic::after {
    content: '';
    position: absolute;
    width: 20%;
    height: 20%;
    border-radius: 50%;
    top: 30%;
    background: radial-gradient(circle, #00ffff 30%, #0066ff 70%, transparent 100%);
    box-shadow: 0 0 15px #00ccff, 0 0 30px #0066ff;
    animation: cosmic-pulse 2s ease-in-out infinite alternate;
}
.skin-robot-cosmic::before { left: 25%; }
.skin-robot-cosmic::after { right: 25%; animation-delay: 0.5s; }

/* Stars inside the cosmic button */
.skin-robot-cosmic .cosmic-stars {
    position: absolute;
    inset: 0;
    border-radius: 50%;
    background-image:
        radial-gradient(1px 1px at 20% 20%, #fff, transparent),
        radial-gradient(1px 1px at 60% 40%, #fff, transparent),
        radial-gradient(1px 1px at 80% 70%, #fff, transparent),
        radial-gradient(1px 1px at 40% 80%, #fff, transparent),
        radial-gradient(1.5px 1.5px at 70% 20%, #00ffff, transparent),
        radial-gradient(1.5px 1.5px at 30% 60%, #c44eff, transparent);
    animation: cosmic-rotate 20s linear infinite;
}

@keyframes cosmic-pulse {
    0% { transform: scale(1); box-shadow: 0 0 15px #00ccff; }
    100% { transform: scale(1.1); box-shadow: 0 0 25px #00ccff, 0 0 40px #0066ff; }
}

@keyframes cosmic-rotate {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* =============================================
   DEVIL DECOY BUTTONS
   ============================================= */
.devil-decoy {
    position: absolute;
    width: 96px;
    height: 96px;
    border-radius: 50%;
    z-index: 39;
    cursor: pointer;
    /* Slightly darker red than real devil button — the visual tell */
    background: radial-gradient(circle at 35% 35%, #8b0000, #4a0000);
    border: 3px solid #660000;
    box-shadow: 0 0 20px rgba(139, 0, 0, 0.4), inset 0 -6px 10px rgba(0,0,0,0.5);
    transition: opacity 0.5s ease;
    touch-action: manipulation;
}

.devil-decoy::before, .devil-decoy::after {
    content: '';
    position: absolute;
    width: 16%;
    height: 16%;
    border-radius: 50%;
    top: 35%;
    background: #ff2200;
    box-shadow: 0 0 6px #ff0000;
}
.devil-decoy::before { left: 25%; }
.devil-decoy::after { right: 25%; }

/* Poof when decoy is tapped */
@keyframes decoy-poof {
    0% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.3); opacity: 0.5; }
    100% { transform: scale(0); opacity: 0; }
}
.devil-decoy-poof {
    animation: decoy-poof 0.3s ease-out forwards;
    pointer-events: none;
}

/* =============================================
   COSMIC BLACK HOLE WARP
   ============================================= */
@keyframes cosmic-warp-out {
    0% { transform: translate3d(var(--wx), var(--wy), 0) scale(1); opacity: 1; }
    100% { transform: translate3d(var(--wx), var(--wy), 0) scale(0); opacity: 0; }
}
@keyframes cosmic-warp-in {
    0% { transform: translate3d(var(--wx), var(--wy), 0) scale(0); opacity: 0; }
    100% { transform: translate3d(var(--wx), var(--wy), 0) scale(1); opacity: 1; }
}

/* =============================================
   COSMIC METEORS
   ============================================= */
.cosmic-meteor {
    position: absolute;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: radial-gradient(circle, #c44eff 0%, #6432ff 60%, transparent 100%);
    box-shadow: 0 0 12px #c44eff, 0 0 24px #6432ff;
    pointer-events: none;
    z-index: 35;
    animation: meteor-fly 1s linear forwards;
}

/* Glowing trail behind the meteor */
.cosmic-meteor::after {
    content: '';
    position: absolute;
    top: 50%;
    right: 100%;
    width: 60px;
    height: 4px;
    transform: translateY(-50%);
    background: linear-gradient(to left, #c44eff, transparent);
    border-radius: 2px;
    filter: blur(2px);
}

@keyframes meteor-fly {
    0% { transform: translate(0, 0); opacity: 1; }
    80% { opacity: 1; }
    100% { transform: translate(var(--mx), var(--my)); opacity: 0; }
}