/* --- CORE VARIABLES & RESET --- */
:root {
    --bg-color: #f8fafc;
    --text-main: #0f172a;
    --card-front-bg: #ffffff;
    --card-front-text: #000000;
    --angle: 0deg; /* Used for the Rainbow Glass effect */
}

body { 
    background-color: var(--bg-color); 
    color: var(--text-main);
    transition: background-color 0.5s ease, color 0.5s ease; 
    min-height: 100vh; 
    font-family: ui-sans-serif, system-ui, sans-serif; 
    overflow-x: hidden;
    margin: 0;
}

/* --- THEME DEFINITIONS --- */

/* 1. Midnight (Starry Background) */
.theme-midnight { 
    --bg-color: #020617; 
    --text-main: #f8fafc; 
    --card-front-bg: #1e293b;
    --card-front-text: #ffffff;
    background-image: radial-gradient(circle at 50% 50%, rgba(255,255,255,0.08) 1px, transparent 1px);
    background-size: 40px 40px;
    animation: stars-move 100s linear infinite;
}

/* 2. Cyber (Glitch & Neon) */
.theme-cyber { 
    --bg-color: #000000; 
    --text-main: #39ff14; 
    --card-front-bg: #050505;
    --card-front-text: #39ff14;
}
.theme-cyber h2 {
    animation: glitch 3s infinite;
    text-shadow: 2px 0 #ff00ff, -2px 0 #00ffff;
}

/* 3. Glass (Rainbow Animation) */
.theme-glass { 
    --bg-color: #cbd5e1; 
    --text-main: #0f172a;
    --card-front-bg: rgba(255, 255, 255, 0.4);
    --card-front-text: #000000;
}
.theme-glass .flip-card-front { 
    backdrop-filter: blur(12px); 
    border: 3px solid transparent;
    background-image: linear-gradient(var(--card-front-bg), var(--card-front-bg)), 
                      linear-gradient(var(--angle), #ff0000, #00ff00, #0000ff, #ff0000);
    background-origin: border-box;
    background-clip: padding-box, border-box;
    animation: rotate-gradient 4s linear infinite;
}

/* 4. Magma (Pulsing Heat) */
.theme-magma {
    --bg-color: #1a0505;
    --text-main: #ff4d00;
    --card-front-bg: #2d0a0a;
    --card-front-text: #ff9d00;
}
.theme-magma .flip-card-front {
    animation: magma-pulse 3s ease-in-out infinite;
    border-top-color: #ff4d00 !important;
}

/* 5. Retro (80s Arcade) */
.theme-retro {
    --bg-color: #2b0057;
    --text-main: #ff00ff;
    --card-front-bg: #1a0033;
    --card-front-text: #00ffff;
    font-family: 'Courier New', Courier, monospace;
}
.theme-retro .flip-card-front {
    border: 4px solid #ff00ff;
    box-shadow: 8px 8px 0px #00ffff;
}

/* 6. Forest (Nature Zen) */
.theme-forest {
    --bg-color: #061a06;
    --text-main: #a7f3d0;
    --card-front-bg: #064e3b;
    --card-front-text: #ecfdf5;
}

/* --- ANIMATIONS --- */
@keyframes stars-move {
    from { background-position: 0 0; }
    to { background-position: 1000px 1000px; }
}

@keyframes glitch {
    0% { transform: skew(0deg); }
    1% { transform: skew(10deg); }
    2% { transform: skew(-10deg); }
    3% { transform: skew(0deg); }
    100% { transform: skew(0deg); }
}

@property --angle {
    syntax: '<angle>';
    initial-value: 0deg;
    inherits: false;
}

@keyframes rotate-gradient {
    to { --angle: 360deg; }
}

@keyframes magma-pulse {
    0%, 100% { box-shadow: 0 0 15px rgba(255, 68, 0, 0.2); }
    50% { box-shadow: 0 0 35px rgba(255, 68, 0, 0.6); }
}

/* --- CARD STRUCTURE --- */
.flip-card { background-color: transparent; perspective: 1000px; height: 380px; transition: all 0.3s ease; }
.flip-card:hover { transform: translateY(-8px); }
.flip-card-inner { position: relative; width: 100%; height: 100%; text-align: center; transition: transform 0.8s cubic-bezier(0.175, 0.885, 0.32, 1.275); transform-style: preserve-3d; cursor: pointer; }
.is-flipped .flip-card-inner { transform: rotateY(180deg); }

.flip-card-front, .flip-card-back { 
    position: absolute; 
    inset: 0; 
    width: 100%; 
    height: 100%; 
    backface-visibility: hidden; 
    border-radius: 1.5rem; 
    display: flex; 
    flex-direction: column; 
    justify-content: center; 
    align-items: center; 
    padding: 1.5rem; 
    box-shadow: 0 10px 25px -5px rgb(0 0 0 / 0.1); 
}

.flip-card-front { 
    background: var(--card-front-bg); 
    color: var(--card-front-text); 
    border-top-width: 12px; 
    border-top-style: solid; 
    z-index: 2; 
    transform: rotateY(0deg); 
    transition: background 0.5s ease, color 0.5s ease;
}

.flip-card-back { 
    background: #1e293b; 
    color: white; 
    transform: rotateY(180deg); 
    z-index: 1; 
    border: 2px solid rgba(255,255,255,0.1); 
}

/* --- LEADER SPECIAL EFFECTS --- */
.is-leader .flip-card-back {
    background: linear-gradient(135deg, #1e293b 0%, #334155 25%, #475569 50%, #334155 75%, #1e293b 100%);
    background-size: 400% 400%;
    animation: holo-shimmer 3s ease infinite;
    position: relative;
    overflow: hidden;
}

.is-leader .flip-card-back::after {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(105deg, transparent 30%, rgba(255, 255, 255, 0.1) 45%, rgba(255, 255, 255, 0.2) 50%, rgba(255, 255, 255, 0.1) 55%, transparent 70%);
    background-size: 200% 200%;
    animation: holo-glint 2s linear infinite;
    pointer-events: none; 
}

@keyframes holo-shimmer {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}
@keyframes holo-glint {
    0% { background-position: -200% 0%; }
    100% { background-position: 200% 0%; }
}

.leader-crown {
    position: absolute;
    top: -25px;
    font-size: 3.5rem;
    filter: drop-shadow(0 0 15px rgba(245, 158, 11, 0.9));
    z-index: 30;
    animation: bounce-crown 2s infinite;
}

@keyframes bounce-crown {
    0%, 100% { transform: translateY(0) rotate(-8deg); }
    50% { transform: translateY(-12px) rotate(8deg); }
}

/* --- FORUM & UI OVERLAYS --- */
#forum-overlay, #admin-modal, #duel-overlay { 
    display: none; 
    position: fixed; 
    inset: 0; 
    background: rgba(0,0,0,0.9); 
    z-index: 100; 
    align-items: center; 
    justify-content: center; 
    backdrop-filter: blur(20px); 
    padding: 20px;
}

#forum-overlay { overflow-y: auto; display: none; flex-direction: column; }
#forum-feed {
    color: #ffffff; /* Change this hex code to any color you want */
}
#forum-feed .text-sm {
    color: #cbd5e1; /* A light greyish-blue */
    font-size: 15px;
}
.profile-img { 
    width: 100px; 
    height: 100px; 
    border-radius: 50%; 
    object-fit: cover; 
    margin-bottom: 1rem; 
    border: 4px solid #fff; 
    background-color: #e2e8f0; 
    transition: transform 0.3s ease; 
}
.flip-card:hover .profile-img { transform: scale(1.1); }

/* --- INPUT STYLING --- */
.flip-card-back select, 
.flip-card-back input {
    background: rgba(15, 23, 42, 0.8);
    color: white;
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 0.5rem;
    padding: 6px;
    width: 100%;
}

.flip-card-back button {
    cursor: pointer;
    transition: background 0.2s;
}

/* Theme specific tag adjustments */
.theme-cyber #active-tag { background: rgba(57, 255, 20, 0.1); color: #39ff14; border-color: #39ff14; }
.theme-midnight .bg-white\/50 { background: rgba(30, 41, 59, 0.8); border-color: rgba(255,255,255,0.1); color: white; }
/* --- THE PURPLE BUTTON BOX --- */
.forum-container-box {
    background: linear-gradient(135deg, #6366f1 0%, #a855f7 100%); /* Purple to Indigo gradient */
    padding: 15px;
    border-radius: 50px; /* Makes it a pill/round box */
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 10px 25px -5px rgba(168, 85, 247, 0.4);
    border: 2px solid rgba(255, 255, 255, 0.2);
    margin: 20px 0;
}

/* Optional: Subtle pulse animation for the purple box */
.forum-container-box {
    animation: purple-pulse 3s infinite;
}

@keyframes purple-pulse {
    0% { box-shadow: 0 10px 25px -5px rgba(168, 85, 247, 0.4); }
    50% { box-shadow: 0 10px 35px 0px rgba(168, 85, 247, 0.6); }
    100% { box-shadow: 0 10px 25px -5px rgba(168, 85, 247, 0.4); }
}

/* Ensure the button inside doesn't have its own margin now */
.forum-container-box .forum-btn-cool {
    margin: 0;
    background: rgba(0, 0, 0, 0.2); /* Slightly darker background to pop against purple */
}