/* themes.css - Nano Banana Redesign */

/* ==================== 0. Global Reset & Variables (Nano Banana Base) ==================== */
:root {
    /* Nano Banana Palette */
    --nano-bg: #0F1012;
    /* Graphene Black */
    --nano-card: #18191d;
    /* Dark Matter */
    --nano-yellow: #FFE135;
    /* Electric Banana */
    --nano-yellow-dim: #bbaa11;
    --nano-text: #FFFFFF;
    --nano-sub: #7A7A7A;
    --nano-grid: rgba(255, 225, 53, 0.03);

    /* Functional Colors */
    --success: #00FF9D;
    --error: #FF4D4D;
    --accent: var(--nano-yellow);
    /* Default reference */

    /* Typography */
    --font-head: 'JetBrains Mono', monospace;
    /* Tech feel */
    --font-body: 'Noto Sans SC', sans-serif;
}

* {
    box-sizing: border-box;
}

body {
    background-color: var(--nano-bg);
    color: var(--nano-text);
    font-family: var(--font-body);
    margin: 0;
    min-height: 100vh;
    overflow-x: hidden;
    /* Nano Grid Background */
    background-image:
        linear-gradient(var(--nano-grid) 1px, transparent 1px),
        linear-gradient(90deg, var(--nano-grid) 1px, transparent 1px);
    background-size: 40px 40px;
    background-position: center top;
}

/* ==================== 1. Utility Classes (Nano Banana Style) ==================== */

/* Buttons */
.btn-main,
.btn-primary,
button.btn-main {
    background: var(--nano-yellow);
    color: #000;
    border: none;
    padding: 12px 24px;
    font-family: var(--font-head);
    font-weight: 800;
    border-radius: 12px;
    /* Slight rounding, not full pill yet unless requested */
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    box-shadow: 0 4px 0 var(--nano-yellow-dim);
    text-transform: uppercase;
    letter-spacing: 1px;
    position: relative;
    overflow: hidden;
}

.btn-main:hover,
.btn-primary:hover,
button.btn-main:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 0 var(--nano-yellow-dim), 0 10px 20px rgba(255, 225, 53, 0.2);
    filter: brightness(1.1);
}

.btn-main:active,
.btn-primary:active,
button.btn-main:active {
    transform: translateY(2px);
    box-shadow: 0 2px 0 var(--nano-yellow-dim);
}

.btn-secondary,
.btn-small {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--nano-text);
    padding: 8px 16px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: 0.2s;
}

.btn-secondary:hover,
.btn-small:hover {
    border-color: var(--nano-yellow);
    color: var(--nano-yellow);
    background: rgba(255, 225, 53, 0.05);
}

/* Cards */
.card,
.nano-card {
    background: rgba(24, 25, 29, 0.8);
    backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 20px;
    padding: 24px;
    transition: 0.3s;
    position: relative;
    overflow: hidden;
}

.card:hover,
.nano-card:hover {
    transform: translateY(-5px);
    border-color: var(--nano-yellow);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
}

.card:hover::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 2px;
    background: var(--nano-yellow);
    box-shadow: 0 0 15px var(--nano-yellow);
}

/* Inputs */
input,
select,
textarea {
    background: #0a0a0c;
    border: 1px solid #333;
    color: var(--nano-text);
    padding: 12px 16px;
    border-radius: 8px;
    font-family: var(--font-head);
    outline: none;
    transition: 0.3s;
    width: 100%;
}

input:focus {
    border-color: var(--nano-yellow);
    box-shadow: 0 0 0 2px rgba(255, 225, 53, 0.1);
}

/* Typography Helpers */
.text-yellow {
    color: var(--nano-yellow) !important;
}

.text-sub {
    color: var(--nano-sub) !important;
}

.font-code {
    font-family: var(--font-head) !important;
}

/* Effects */
.glow-text {
    text-shadow: 0 0 20px rgba(255, 225, 53, 0.5);
}


/* ==================== 2. Legacy Theme Support (Scoped) ==================== */
/* We keep these for the shop system, but scoped tightly */

/* Matrix */
/* Matrix */
html.theme-matrix body {
    /* Matrix Green Palette */
    background: #000500 !important;
    --nano-bg: #000500;
    --nano-card: rgba(0, 20, 0, 0.9);
    --nano-yellow: #00ff41;
    /* Override "yellow" logic with green */
    --accent: #00ff41;
    --nano-grid: rgba(0, 255, 65, 0.05);
    /* Grid becomes green */
}

html.theme-matrix .card,
html.theme-matrix .nano-card,
html.theme-matrix .btn-main,
html.theme-matrix input,
html.theme-matrix .skin-card,
html.theme-matrix .shop-header,
html.theme-matrix .preview-orb,
html.theme-matrix .coin-pill,
html.theme-matrix .btn-action {
    border-radius: 0 !important;
    border-color: var(--accent) !important;
}

/* Matrix 文字可见性保护 - 只针对核心内容元素，不影响弹窗 */
html.theme-matrix .wrapper,
html.theme-matrix .card,
html.theme-matrix .nano-card,
html.theme-matrix .auth-wrapper,
html.theme-matrix .brand-container,
html.theme-matrix .main-content,
html.theme-matrix .game-container,
html.theme-matrix .header {
    color: inherit;
}

/* Fire */
html.theme-fire body {
    /* Magma Red Palette */
    background: #0f0000 !important;
    --nano-bg: #0f0000;
    --nano-card: rgba(30, 5, 5, 0.9);
    --nano-yellow: #ff4500;
    /* Override with Orange-Red */
    --accent: #ff4500;
    --nano-grid: rgba(255, 69, 0, 0.05);
}

/* Neon */
html.theme-neon body {
    /* Cyber Purple Palette */
    background: #0d001a !important;
    --nano-bg: #0d001a;
    --nano-card: rgba(20, 0, 35, 0.9);
    --nano-yellow: #d000ff;
    /* Override with Purple */
    --accent: #d000ff;
    --nano-grid: rgba(208, 0, 255, 0.05);
}

/* Gold */
html.theme-gold body {
    /* Wealth Gold Palette */
    background: #0a0a0a !important;
    --nano-bg: #0a0a0a;
    --nano-card: rgba(25, 20, 5, 0.9);
    --nano-yellow: #ffd700;
    /* Override with Gold */
    --accent: #ffd700;
    --nano-grid: rgba(255, 215, 0, 0.05);
}

/* Divine (Epic Dark Gold) */
html.theme-divine body {
    /* Mandala Divine Palette */
    background: #050401 !important;
    --nano-bg: #050401;
    --nano-card: rgba(10, 8, 4, 0.85);
    --nano-yellow: #e5c158;
    /* Pale/Dark gold for buttons to avoid pure yellow */
    --accent: #ffd700;
    --nano-grid: rgba(255, 239, 150, 0.03);
}

html.theme-divine .card,
html.theme-divine .nano-card,
html.theme-divine .btn-main,
html.theme-divine input {
    border-color: rgba(229, 193, 88, 0.5) !important;
}

html.theme-divine .btn-main {
    background: linear-gradient(135deg, #d4af37 0%, #aa8c2c 100%) !important;
    color: #111 !important;
    box-shadow: 0 4px 0 #735e1d, 0 0 15px rgba(212, 175, 55, 0.3) !important;
    text-shadow: none !important;
}

html.theme-divine .btn-main:hover {
    box-shadow: 0 6px 0 #735e1d, 0 0 25px rgba(212, 175, 55, 0.5) !important;
    filter: brightness(1.15);
}

/* ==================== 3. Specific Component Fixes ==================== */
/* Difficulty Switch */
.difficulty-switch {
    display: flex;
    background: rgba(255, 255, 255, 0.05);
    padding: 4px;
    border-radius: 50px;
    position: relative;
    width: fit-content;
    margin: 0 auto;
}

.diff-bg {
    position: absolute;
    top: 4px;
    left: 4px;
    width: calc(50% - 4px);
    height: calc(100% - 8px);
    background: var(--accent);
    border-radius: 40px;
    transition: 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

/* Matrix Rain Canvas */
#matrix-rain-canvas {
    z-index: 0;
    pointer-events: none;
    position: fixed;
    top: 0;
    left: 0;
}

/* ==================== 4. Enhanced Visual Effects for Skins ==================== */

/* === FIRE SKIN: 燃烧效果 === */
@keyframes fireGlow {

    0%,
    100% {
        box-shadow: 0 0 20px rgba(255, 69, 0, 0.5), 0 0 40px rgba(255, 69, 0, 0.3);
    }

    50% {
        box-shadow: 0 0 30px rgba(255, 69, 0, 0.8), 0 0 60px rgba(255, 69, 0, 0.5), 0 0 80px rgba(255, 140, 0, 0.3);
    }
}

@keyframes fireFlicker {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.85;
    }
}

html.theme-fire .card,
html.theme-fire .nano-card,
html.theme-fire .game-card {
    animation: fireGlow 2s ease-in-out infinite;
    border-color: #ff4500 !important;
}

html.theme-fire .btn-main {
    animation: fireGlow 1.5s ease-in-out infinite;
    box-shadow: 0 4px 0 #cc3700, 0 0 20px rgba(255, 69, 0, 0.5) !important;
}

html.theme-fire body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: radial-gradient(circle at 50% 50%, rgba(255, 69, 0, 0.1) 0%, transparent 70%);
    pointer-events: none;
    animation: fireFlicker 3s ease-in-out infinite;
    z-index: 1;
}

/* === NEON SKIN: 赛博朋克扫描线 === */
@keyframes neonPulse {

    0%,
    100% {
        box-shadow: 0 0 10px #d000ff, 0 0 20px #d000ff, 0 0 30px #d000ff;
        border-color: #d000ff;
    }

    50% {
        box-shadow: 0 0 20px #d000ff, 0 0 40px #d000ff, 0 0 60px #ff00ff;
        border-color: #ff00ff;
    }
}

@keyframes scanline {
    0% {
        transform: translateY(-100%);
    }

    100% {
        transform: translateY(100vh);
    }
}

html.theme-neon .card,
html.theme-neon .nano-card,
html.theme-neon .game-card {
    animation: neonPulse 2s ease-in-out infinite;
    border: 2px solid #d000ff !important;
}

html.theme-neon .btn-main {
    animation: neonPulse 1.5s ease-in-out infinite;
    text-shadow: 0 0 10px #d000ff;
}

html.theme-neon body::after {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(to bottom, transparent, #d000ff, transparent);
    animation: scanline 4s linear infinite;
    pointer-events: none;
    z-index: 9999;
    opacity: 0.5;
}

/* === GOLD SKIN: 豪华金属质感 === */
@keyframes goldShine {
    0% {
        background-position: -200% center;
    }

    100% {
        background-position: 200% center;
    }
}

@keyframes goldFloat {

    0%,
    100% {
        transform: translateY(0px);
    }

    50% {
        transform: translateY(-10px);
    }
}

html.theme-gold .card,
html.theme-gold .nano-card,
html.theme-gold .game-card {
    background: linear-gradient(135deg, rgba(25, 20, 5, 0.9) 0%, rgba(40, 35, 10, 0.9) 50%, rgba(25, 20, 5, 0.9) 100%) !important;
    border: 2px solid #ffd700 !important;
    box-shadow: 0 0 20px rgba(255, 215, 0, 0.3), inset 0 0 20px rgba(255, 215, 0, 0.1);
    animation: goldFloat 3s ease-in-out infinite;
}

html.theme-gold .btn-main {
    background: linear-gradient(90deg, #ffd700 0%, #ffed4e 50%, #ffd700 100%) !important;
    background-size: 200% 100%;
    animation: goldShine 3s linear infinite;
    box-shadow: 0 4px 0 #b8960a, 0 0 20px rgba(255, 215, 0, 0.5) !important;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
}

html.theme-gold body::before {
    content: '';
    position: fixed;
    top: -50%;
    left: -50%;
    right: -50%;
    bottom: -50%;
    background-image: radial-gradient(circle, rgba(255, 215, 0, 0.03) 1px, transparent 1px);
    background-size: 50px 50px;
    animation: goldFloat 20s linear infinite;
    pointer-events: none;
    z-index: 1;
}

/* === FROST SKIN: 极地冰霜 === */
/* 背景由 Canvas 动态渐变渲染 */
html.theme-frost body {
    background: transparent !important;
    --nano-bg: #050a14;
    --nano-card: rgba(10, 30, 50, 0.85);
    --nano-yellow: #00d4ff;
    --accent: #00d4ff;
    --nano-grid: rgba(0, 212, 255, 0.08);
}

/* Aurora / Ice Fog (Static Gradient for Performance) */
html.theme-frost body::after {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    /* Static aurora gradient */
    background: linear-gradient(120deg,
            transparent 0%,
            rgba(0, 255, 200, 0.03) 30%,
            rgba(0, 150, 255, 0.05) 50%,
            rgba(150, 50, 255, 0.03) 70%,
            transparent 100%);
    background-size: 100% 100%;
    pointer-events: none;
    z-index: 0;
}

/* 优化后的下雪动画 - 已迁移至 JS Canvas 实现 (initFrostEffect) 以提升性能 */

html.theme-frost .bg-layer-2 {
    display: none !important;
}

/* 优化后的下雪动画 - 多层视差 */
/* html.theme-frost body::before 已移除 */
/* html.theme-frost .bg-layer-2 已移除 */

/* Layer 3: 小雪花 (远景) - 已迁移至 JS Canvas */

html.theme-frost .card,
html.theme-frost .nano-card,
html.theme-frost .game-card {
    /* 静态样式，无 box-shadow 动画 */
    border: 2px solid #00d4ff !important;
    background: linear-gradient(135deg, rgba(10, 30, 50, 0.9) 0%, rgba(20, 50, 80, 0.8) 100%) !important;
    box-shadow: 0 0 15px rgba(0, 212, 255, 0.15);
    transition: box-shadow 0.3s ease, transform 0.3s ease;
}

html.theme-frost .card:hover,
html.theme-frost .nano-card:hover,
html.theme-frost .game-card:hover {
    /* 仅在鼠标悬停时发光 */
    box-shadow: 0 0 25px rgba(0, 212, 255, 0.4), 0 0 50px rgba(0, 212, 255, 0.2);
    transform: translateY(-5px);
}

html.theme-frost .btn-main {
    background: linear-gradient(135deg, #00d4ff 0%, #64c8ff 100%) !important;
    box-shadow: 0 0 15px rgba(0, 212, 255, 0.3);
    transition: 0.3s;
}

html.theme-frost .btn-main:hover {
    box-shadow: 0 0 25px rgba(0, 212, 255, 0.6);
}

/* 这里我们利用一个技巧：复用 ::before 的多重背景来实现视差，或者修改 ::after */
/* 由于 ::after 已用于极光，我们把极光移到底层背景中，或者叠加在 ::after */


/* === VOID SKIN: 虚空深渊 - 虚空之眼 (单元素完美对齐版) === */
html.theme-void body {
    background: #0a0012 !important;
    --nano-bg: #0a0012;
    --nano-card: rgba(20, 0, 40, 0.9);
    --nano-yellow: #8b00ff;
    --accent: #8b00ff;
    --nano-grid: rgba(139, 0, 255, 0.05);
}

@keyframes voidPulse {

    0%,
    100% {
        box-shadow: 0 0 20px rgba(139, 0, 255, 0.5), 0 0 40px rgba(139, 0, 255, 0.2), inset 0 0 30px rgba(139, 0, 255, 0.1);
        border-color: #8b00ff;
    }

    50% {
        box-shadow: 0 0 30px rgba(139, 0, 255, 0.8), 0 0 60px rgba(200, 0, 255, 0.4), inset 0 0 50px rgba(139, 0, 255, 0.2);
        border-color: #c800ff;
    }
}

@keyframes voidWarp {

    0%,
    100% {
        transform: scale(1);
    }

    25% {
        transform: scale(1.02) rotate(0.5deg);
    }

    50% {
        transform: scale(0.98);
    }

    75% {
        transform: scale(1.01) rotate(-0.5deg);
    }
}

@keyframes voidVortex {
    0% {
        transform: translate(-50%, -50%) rotate(0deg);
    }

    100% {
        transform: translate(-50%, -50%) rotate(360deg);
    }
}



html.theme-void .card,
html.theme-void .nano-card,
html.theme-void .game-card {
    animation: voidPulse 2.5s ease-in-out infinite, voidWarp 8s ease-in-out infinite;
    border: 2px solid #8b00ff !important;
    background: radial-gradient(ellipse at center, rgba(30, 0, 60, 0.9) 0%, rgba(10, 0, 20, 0.95) 100%) !important;
}

html.theme-void .btn-main {
    animation: voidPulse 2s ease-in-out infinite;
    background: linear-gradient(135deg, #8b00ff 0%, #c800ff 100%) !important;
}

/* 虚空漩涡背景 */
html.theme-void::before {
    content: '';
    position: fixed;
    top: 50%;
    left: 50%;
    width: 200vmax;
    height: 200vmax;
    background: radial-gradient(ellipse at center, transparent 0%, transparent 30%, rgba(139, 0, 255, 0.03) 50%, transparent 70%);
    animation: voidVortex 60s linear infinite;
    pointer-events: none;
    z-index: -1;
}

/* 虚空之眼 - 右下角神秘之眼 */
html.theme-void body::before {
    content: '';
    position: fixed;
    bottom: 80px;
    right: 80px;
    width: 120px;
    height: 60px;
    /* 眼形：杏仁形 */
    background:
        /* 高光点 */
        radial-gradient(circle 3px at 55% 40%, rgba(255, 255, 255, 0.95) 0%, transparent 100%),
        /* 瞳孔 - 深邃黑色 */
        radial-gradient(circle 8px at 50% 50%, #000 0%, #0a0015 80%, transparent 100%),
        /* 虹膜 - 紫色渐变 */
        radial-gradient(circle 22px at 50% 50%, #a050ff 0%, #7020cc 50%, #4a0080 75%, transparent 80%),
        /* 眼白 */
        radial-gradient(ellipse 60px 30px at 50% 50%, rgba(245, 240, 255, 0.95) 0%, rgba(200, 180, 220, 0.85) 70%, transparent 100%);

    background-repeat: no-repeat;
    background-position: center;
    border-radius: 50% 50% 50% 50% / 60% 60% 40% 40%;

    animation: voidEyeTeleport 40s ease-in-out infinite, voidEyeLook 4s ease-in-out infinite;
    transform-origin: center;
    pointer-events: none;
    z-index: 10;
    /* 降低层级，不遮挡UI */
    box-shadow:
        0 0 30px rgba(139, 0, 255, 0.4),
        0 0 60px rgba(139, 0, 255, 0.2),
        inset 0 -5px 15px rgba(0, 0, 0, 0.3);
    /* 内阴影增加立体感 */
    opacity: 0.85;
}

/* 眼影层已移除 - 无法跟随传送动画 */
html.theme-void body::after {
    display: none !important;
}

/* 移除 wrapper 伪元素 */
html.theme-void .wrapper::before,
html.theme-void .wrapper::after {
    display: none !important;
    content: none !important;
}

/* === TOXIC SKIN: 生化毒素 === */
html.theme-toxic body {
    background: #0a1200 !important;
    --nano-bg: #0a1200;
    --nano-card: rgba(15, 30, 5, 0.9);
    --nano-yellow: #39ff14;
    --accent: #39ff14;
    --nano-grid: rgba(57, 255, 20, 0.05);
}

/* CSS 动画已迁移至 JS Canvas 实现 */

html.theme-toxic .card,
html.theme-toxic .nano-card,
html.theme-toxic .game-card {
    /* 静态样式，移除 continuous box-shadow animation */
    border: 2px solid #39ff14 !important;
    background: linear-gradient(180deg, rgba(15, 30, 5, 0.9) 0%, rgba(20, 40, 10, 0.85) 100%) !important;
    box-shadow: 0 0 10px rgba(57, 255, 20, 0.2);
    transition: box-shadow 0.3s ease, transform 0.3s ease;
}

html.theme-toxic .card:hover,
html.theme-toxic .nano-card:hover,
html.theme-toxic .game-card:hover {
    box-shadow: 0 0 20px rgba(57, 255, 20, 0.5), 0 0 40px rgba(57, 255, 20, 0.2);
    transform: translateY(-5px);
}

html.theme-toxic .btn-main {
    background: linear-gradient(135deg, #39ff14 0%, #96ff32 100%) !important;
    box-shadow: 0 0 10px rgba(57, 255, 20, 0.3);
    transition: 0.3s;
}

html.theme-toxic .btn-main:hover {
    box-shadow: 0 0 20px rgba(57, 255, 20, 0.6);
}

/* 毒气泡泡 - 后景层（小泡泡，慢速）*/
/* 毒气泡泡 - 已迁移至 JS Canvas (initToxicBubbleEffect) */
html.theme-toxic body::before {
    content: none !important;
    display: none !important;
}

html.theme-toxic body::after {
    content: none !important;
    display: none !important;
}

/* 底部毒雾 - 静态化 */
html.theme-toxic::after {
    content: '';
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 150px;
    background: linear-gradient(to top, rgba(57, 255, 20, 0.15), transparent 100%);
    pointer-events: none;
    z-index: 999;
}

/* 彩虹名字流动动画 */
@keyframes rainbow-flow {
    0% {
        background-position: 0% 50%;
    }

    100% {
        background-position: 200% 50%;
    }
}

/* === VOID SKIN OVERRIDE: 禁用眼睛动画，启用 Canvas 黑洞 === */
html.theme-void::before,
html.theme-void body::before,
html.theme-void body::after {
    display: none !important;
    content: none !important;
    animation: none !important;
    opacity: 0 !important;
    visibility: hidden !important;
}

html.theme-void body {
    background: linear-gradient(180deg, #0a0012 0%, #050008 100%) !important;
}