/* ==========================================================================
   DEVCARD 3D - CORE DESIGN SYSTEM & PREMIUM STYLES
   ========================================================================== */

/* --------------------------------------------------------------------------
   DESIGN TOKENS - DARK MODE (DEFAULT)
   -------------------------------------------------------------------------- */
:root {
    /* Backgrounds */
    --bg-dark: #07080a;
    --panel-bg: rgba(13, 17, 24, 0.45);
    --panel-border: rgba(255, 255, 255, 0.08);

    /* Typography */
    --text-main: #f0f2f5;
    --text-muted: #8b949e;

    /* Brand Colors */
    --primary: #4f46e5;
    --primary-glow: rgba(79, 70, 229, 0.4);
    --accent: #00f2fe;
    --accent-glow: rgba(0, 242, 254, 0.3);

    /* Inputs */
    --input-bg: rgba(0, 0, 0, 0.3);
    --input-border: rgba(255, 255, 255, 0.08);

    /* Code Box */
    --code-bg: rgba(0, 0, 0, 0.4);
    --code-color: var(--accent);

    /* Share Buttons */
    --share-link-bg: rgba(255, 255, 255, 0.06);
    --share-link-border: rgba(255, 255, 255, 0.1);

    /* Toast */
    --toast-bg: rgba(13, 17, 24, 0.95);

    /* Card Dimensions */
    --card-width: 345px;
    --card-height: 522px;
    --border-radius-card: 18px;

    /* Fonts */
    --font-heading: 'Space Grotesk', sans-serif;
    --font-body: 'Plus Jakarta Sans', sans-serif;
    --font-mono: 'JetBrains Mono', monospace;

    /* Transitions */
    --transition-speed: 0.3s;
    --transition-bounce: cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* --------------------------------------------------------------------------
   LIGHT MODE OVERRIDES
   -------------------------------------------------------------------------- */
body.light-mode {
    --bg-dark: #f1f5f9;
    --panel-bg: rgba(255, 255, 255, 0.45);
    --panel-border: rgba(0, 0, 0, 0.1);

    --text-main: #0f172a;
    --text-muted: #64748b;

    --primary: #4f46e5;
    --primary-glow: rgba(79, 70, 229, 0.2);
    --accent: #0284c7;
    --accent-glow: rgba(2, 132, 199, 0.25);

    --input-bg: rgba(255, 255, 255, 0.8);
    --input-border: rgba(0, 0, 0, 0.1);

    --code-bg: rgba(0, 0, 0, 0.05);
    --code-color: #0284c7;

    --share-link-bg: rgba(0, 0, 0, 0.04);
    --share-link-border: rgba(0, 0, 0, 0.1);

    --toast-bg: rgba(255, 255, 255, 0.97);
}

/* ==========================================================================
   BASE RESET & BODY
   ========================================================================== */

*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    background-color: var(--bg-dark);
    color: var(--text-main);
    font-family: var(--font-body);
    min-height: 100vh;
    overflow-x: hidden;
    position: relative;
    line-height: 1.5;
    transition: background-color 0.4s ease, color 0.4s ease;
}

body.light-mode {
    background: linear-gradient(135deg, #f0f7ff 0%, #f1f5f9 50%, #e8f4fd 100%);
}

/* ==========================================================================
   BACKGROUND GLOW DECORATIONS
   ========================================================================== */

.bg-glow {
    position: fixed;
    border-radius: 50%;
    filter: blur(100px);
    opacity: 0.15;
    pointer-events: none;
    z-index: 0;
    transition: all 0.6s ease;
}

.bg-glow-1 {
    top: -10%;
    left: -10%;
    width: 50vw;
    height: 50vw;
    background: radial-gradient(circle, #4f46e5, transparent);
}

.bg-glow-2 {
    bottom: -10%;
    right: -10%;
    width: 60vw;
    height: 60vw;
    background: radial-gradient(circle, #00f2fe, transparent);
}

.bg-glow-3 {
    top: 40%;
    left: 45%;
    width: 35vw;
    height: 35vw;
    background: radial-gradient(circle, #ff007f, transparent);
    opacity: 0.08;
}

body.light-mode .bg-glow-1 { opacity: 0.07; }
body.light-mode .bg-glow-2 { opacity: 0.07; background: radial-gradient(circle, #0284c7, transparent); }
body.light-mode .bg-glow-3 { opacity: 0.04; }

.particles-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
    pointer-events: none;
}

#canvas-particles {
    width: 100%;
    height: 100%;
}

/* ==========================================================================
   APP HEADER
   ========================================================================== */

.app-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.25rem 5%;
    background: rgba(7, 8, 10, 0.8);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-bottom: 1px solid var(--panel-border);
    position: sticky;
    top: 0;
    z-index: 100;
    transition: background 0.4s ease, border-color 0.4s ease;
}

body.light-mode .app-header {
    background: rgba(255, 255, 255, 0.85);
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-family: var(--font-heading);
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-main);
    letter-spacing: -0.5px;
    text-decoration: none;
}

.logo-icon {
    color: var(--accent);
    stroke-width: 2.5px;
    width: 24px;
    height: 24px;
}

.highlight {
    background: linear-gradient(135deg, var(--accent), #4f46e5);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    font-weight: 800;
}

.header-links {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.github-link {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--text-main);
    text-decoration: none;
    font-weight: 500;
    font-size: 0.875rem;
    padding: 0.5rem 1rem;
    border-radius: 80px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--panel-border);
    transition: all var(--transition-speed) ease;
}

body.light-mode .github-link {
    background: rgba(0, 0, 0, 0.04);
}

.github-link:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.2);
    transform: translateY(-2px);
}

body.light-mode .github-link:hover {
    background: rgba(0, 0, 0, 0.08);
}

.github-link i { width: 16px; height: 16px; }

/* Theme Toggle Button */
.theme-toggle-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 1px solid var(--panel-border);
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-main);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-speed) ease;
    position: relative;
    overflow: hidden;
}

body.light-mode .theme-toggle-btn {
    background: rgba(0, 0, 0, 0.04);
}

.theme-toggle-btn:hover {
    background: rgba(255, 255, 255, 0.12);
    border-color: var(--accent);
    transform: rotate(15deg) scale(1.05);
}

body.light-mode .theme-toggle-btn:hover {
    background: rgba(0, 0, 0, 0.08);
}

.theme-toggle-btn i { width: 18px; height: 18px; }

/* GitHub Auth Button */
.btn-github-auth {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-family: var(--font-heading);
    font-weight: 600;
    font-size: 0.875rem;
    padding: 0.5rem 1.1rem;
    border-radius: 80px;
    border: 1px solid var(--panel-border);
    background: rgba(255, 255, 255, 0.06);
    color: var(--text-main);
    cursor: pointer;
    transition: all var(--transition-speed) ease;
}

.btn-github-auth:hover {
    background: rgba(255, 255, 255, 0.12);
    border-color: rgba(255, 255, 255, 0.2);
    transform: translateY(-2px);
}

body.light-mode .btn-github-auth {
    background: rgba(0, 0, 0, 0.04);
}

body.light-mode .btn-github-auth:hover {
    background: rgba(0, 0, 0, 0.08);
}

.btn-github-auth i { width: 16px; height: 16px; }

/* User Profile Chip (shown when logged in) */
.user-profile-chip {
    display: none;
    align-items: center;
    gap: 0.5rem;
    padding: 0.35rem 0.9rem 0.35rem 0.4rem;
    border-radius: 80px;
    border: 1px solid rgba(0, 242, 254, 0.3);
    background: rgba(0, 242, 254, 0.06);
    cursor: pointer;
    font-family: var(--font-heading);
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-main);
    transition: all var(--transition-speed) ease;
    position: relative;
}

body.light-mode .user-profile-chip {
    border-color: rgba(2, 132, 199, 0.3);
    background: rgba(2, 132, 199, 0.06);
}

.user-profile-chip.visible { display: flex; }

.user-profile-chip:hover {
    background: rgba(0, 242, 254, 0.12);
    transform: translateY(-1px);
}

.user-avatar-sm {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    border: 1.5px solid var(--accent);
    object-fit: cover;
}

.user-chip-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    background: var(--panel-bg);
    border: 1px solid var(--panel-border);
    border-radius: 12px;
    padding: 0.5rem;
    min-width: 160px;
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.3);
    z-index: 200;
    display: none;
    flex-direction: column;
    gap: 0.25rem;
}

.user-chip-dropdown.open { display: flex; }

.dropdown-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.75rem;
    border-radius: 8px;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-muted);
    cursor: pointer;
    border: none;
    background: transparent;
    font-family: var(--font-body);
    width: 100%;
    text-align: left;
    transition: all 0.2s ease;
}

.dropdown-item:hover {
    background: rgba(255, 255, 255, 0.06);
    color: var(--text-main);
}

body.light-mode .dropdown-item:hover {
    background: rgba(0, 0, 0, 0.04);
}

.dropdown-item.danger:hover {
    background: rgba(255, 74, 90, 0.1);
    color: #ff4a5a;
}

.dropdown-item i { width: 14px; height: 14px; }

/* ==========================================================================
   MAIN CONTAINER LAYOUT
   ========================================================================== */

.app-container {
    display: grid;
    grid-template-columns: 0.95fr 1.15fr 0.95fr;
    gap: 2rem;
    max-width: 1440px;
    margin: 2.5rem auto;
    padding: 0 2rem;
    position: relative;
    z-index: 10;
}

@media (max-width: 1250px) and (min-width: 901px) {
    .app-container {
        grid-template-columns: 1fr 1fr;
    }
    .leaderboard-container {
        grid-column: span 2;
    }
}

@media (max-width: 900px) {
    .app-container {
        grid-template-columns: 1fr;
        gap: 2rem;
        margin: 1.5rem auto;
        padding: 0 1rem;
    }
}

/* ==========================================================================
   CONTROL PANEL (LEFT COLUMN)
   ========================================================================== */

.control-panel {
    background: var(--panel-bg);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--panel-border);
    border-radius: 20px;
    padding: 2rem 2.5rem;
    display: flex;
    flex-direction: column;
    gap: 1.75rem;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.15);
    transition: background 0.4s ease, border-color 0.4s ease;
}

.header-section h2 {
    font-family: var(--font-heading);
    font-size: 1.75rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    letter-spacing: -0.5px;
    background: linear-gradient(to right, var(--text-main), var(--text-muted));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.header-section p {
    color: var(--text-muted);
    font-size: 0.9rem;
    line-height: 1.6;
}

.section-label {
    display: block;
    font-family: var(--font-heading);
    font-weight: 600;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 1.2px;
    color: var(--text-muted);
    margin-bottom: 0.75rem;
}

/* GitHub Input Group */
.input-group {
    display: flex;
    border: 1px solid var(--input-border);
    background: var(--input-bg);
    border-radius: 12px;
    overflow: hidden;
    padding: 0.3rem;
    transition: all var(--transition-speed) ease;
}

.input-group:focus-within {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-glow);
}

.input-prefix {
    display: flex;
    align-items: center;
    padding-left: 0.75rem;
    color: var(--text-muted);
    font-family: var(--font-mono);
    font-weight: 700;
}

.input-group input {
    flex: 1;
    background: transparent;
    border: none;
    outline: none;
    color: var(--text-main);
    font-family: var(--font-mono);
    font-size: 1rem;
    padding: 0.5rem 0.75rem;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    font-family: var(--font-heading);
    font-weight: 600;
    font-size: 0.875rem;
    border-radius: 8px;
    border: none;
    cursor: pointer;
    transition: all var(--transition-speed) ease;
    white-space: nowrap;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary), #6366f1);
    color: #ffffff;
    padding: 0.6rem 1.2rem;
    box-shadow: 0 4px 12px rgba(79, 70, 229, 0.3);
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(79, 70, 229, 0.45);
    background: linear-gradient(135deg, #5850ec, #6875f5);
}

.btn-primary.loading {
    opacity: 0.7;
    cursor: not-allowed;
}

.quick-links {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-top: 0.75rem;
    font-size: 0.8rem;
    color: var(--text-muted);
    flex-wrap: wrap;
}

.btn-quick-fill {
    background: transparent;
    border: none;
    color: var(--accent);
    cursor: pointer;
    font-family: var(--font-mono);
    font-size: 0.8rem;
    text-decoration: underline;
    transition: color var(--transition-speed) ease;
}

.btn-quick-fill:hover { color: var(--text-main); }

/* Theme Selection Grid */
.theme-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(90px, 1fr));
    gap: 0.65rem;
}

.theme-card {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--panel-border);
    border-radius: 12px;
    padding: 0.5rem;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.45rem;
    transition: all var(--transition-speed) ease;
}

body.light-mode .theme-card {
    background: rgba(0, 0, 0, 0.02);
}

.theme-card:hover {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.15);
    transform: translateY(-2px);
}

body.light-mode .theme-card:hover {
    background: rgba(0, 0, 0, 0.05);
    border-color: rgba(0, 0, 0, 0.15);
}

.theme-card.active {
    background: rgba(79, 70, 229, 0.08);
    border-color: var(--primary);
    box-shadow: 0 0 12px rgba(79, 70, 229, 0.2);
}

.theme-preview {
    width: 100%;
    aspect-ratio: 1;
    border-radius: 8px;
}

.theme-name {
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--text-muted);
    text-align: center;
}

.theme-card.active .theme-name { color: var(--text-main); }

.theme-holo-classic { background: linear-gradient(135deg, #a5f3fc, #c084fc, #fbcfe8); }
.theme-cyber-neon { background: linear-gradient(135deg, #ff007f, #00f2fe, #7928ca); }
.theme-solar-gold { background: linear-gradient(135deg, #fbbf24, #f59e0b, #d97706); }
.theme-obsidian-shadow { background: linear-gradient(135deg, #1f2937, #111827, #374151); }
.theme-ethereal-glass {
    background: linear-gradient(135deg, rgba(255,255,255,0.8), rgba(255,255,255,0.1));
    border: 1px solid rgba(255,255,255,0.4);
}

/* Customizer Accordion */
.customizer-section {
    border-top: 1px solid var(--panel-border);
    padding-top: 1.5rem;
}

.accordion-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    padding: 0.5rem 0;
    color: var(--text-main);
    transition: color var(--transition-speed) ease;
}

.accordion-header:hover { color: var(--accent); }

.section-label-icon {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-family: var(--font-heading);
    font-weight: 600;
    font-size: 0.9rem;
}

.chevron-icon { transition: transform var(--transition-speed) ease; }
.accordion-header.active .chevron-icon { transform: rotate(180deg); }

.accordion-content {
    display: none;
    flex-direction: column;
    gap: 1.25rem;
    margin-top: 1.25rem;
    padding-bottom: 0.5rem;
}

.accordion-content.active { display: flex; }

.slider-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.slider-header {
    display: flex;
    justify-content: space-between;
    font-size: 0.85rem;
    color: var(--text-muted);
}

.slider-val {
    color: var(--accent);
    font-family: var(--font-mono);
    font-weight: 700;
}

input[type="range"] {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    height: 5px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.08);
    outline: none;
    transition: background 0.3s ease;
}

body.light-mode input[type="range"] {
    background: rgba(0, 0, 0, 0.1);
}

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--accent);
    cursor: pointer;
    box-shadow: 0 0 10px var(--accent-glow);
    transition: transform 0.15s ease;
}

input[type="range"]::-webkit-slider-thumb:hover { transform: scale(1.25); }

.input-field-group {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.input-field-group label {
    font-size: 0.8rem;
    color: var(--text-muted);
    font-weight: 500;
}

.input-field-group input,
.input-field-group textarea,
.input-field-group select {
    background: var(--input-bg);
    border: 1px solid var(--input-border);
    border-radius: 8px;
    color: var(--text-main);
    font-family: var(--font-body);
    font-size: 0.9rem;
    padding: 0.55rem 0.75rem;
    outline: none;
    transition: border-color var(--transition-speed) ease, background 0.4s ease;
}

.input-field-group input:focus,
.input-field-group textarea:focus,
.input-field-group select:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 2px var(--accent-glow);
}

.input-field-group textarea {
    resize: vertical;
    min-height: 68px;
    font-size: 0.85rem;
}

.language-pickers {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
}

/* ==========================================================================
   CARD VIEWPORT COLUMN (RIGHT COLUMN)
   ========================================================================== */

.card-viewport {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    gap: 1.75rem;
}

.viewport-header {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    text-align: center;
}

.preview-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    background: rgba(0, 242, 254, 0.08);
    border: 1px solid rgba(0, 242, 254, 0.2);
    color: var(--accent);
    padding: 0.35rem 0.8rem;
    border-radius: 80px;
    font-size: 0.75rem;
    font-family: var(--font-heading);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

body.light-mode .preview-badge {
    background: rgba(2, 132, 199, 0.08);
    border-color: rgba(2, 132, 199, 0.2);
}

.interaction-tip {
    font-size: 0.78rem;
    color: var(--text-muted);
}

/* 3D Perspective Setup */
.card-perspective-container {
    perspective: 1200px;
    width: var(--card-width);
    height: var(--card-height);
    margin: 0.5rem 0;
    position: relative;
}

.card-perspective-container::before {
    content: '';
    position: absolute;
    top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    width: 82%; height: 82%;
    background: radial-gradient(circle, var(--accent-glow) 0%, transparent 70%);
    filter: blur(55px);
    z-index: 0;
    pointer-events: none;
    opacity: 0.55;
    transition: opacity var(--transition-speed) ease, width var(--transition-speed) ease, height var(--transition-speed) ease;
}

.card-perspective-container:hover::before {
    opacity: 0.85;
    width: 92%; height: 92%;
}

.card-3d-wrapper {
    width: 100%;
    height: 100%;
    position: relative;
    transform-style: preserve-3d;
    transition: transform 0.1s ease-out;
}

.card-face {
    position: absolute;
    width: 100%;
    height: 100%;
    border-radius: var(--border-radius-card);
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
    overflow: hidden;
    box-shadow: 0 30px 60px rgba(0, 0, 0, 0.6);
}

.card-front {
    padding: 0.95rem;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    border: 1px solid rgba(255, 255, 255, 0.2);
    transform: rotateY(0deg);
    z-index: 2;
}

/* Holographic Foil Overlay */
.holo-foil {
    position: absolute;
    top: 0; left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 10;
    mix-blend-mode: color-dodge;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.card-perspective-container:hover .holo-foil { opacity: 0.45; }

/* ==========================================================================
   CARD THEMES
   ========================================================================== */

.holo-classic {
    background: radial-gradient(circle at 50% 0%, #1e1b4b, #090514 80%);
    border-color: rgba(165, 243, 252, 0.2);
}
.holo-classic .holo-foil {
    background: linear-gradient(115deg, transparent 0%, rgba(165, 243, 252, 0.2) 30%,
        rgba(192, 132, 252, 0.35) 45%, rgba(251, 207, 232, 0.2) 60%, transparent 100%);
    background-size: 200% 200%;
}
.holo-classic .card-header-bar { border-bottom: 1px solid rgba(165, 243, 252, 0.15); }
.holo-classic .level-value { color: #a5f3fc; text-shadow: 0 0 8px rgba(165, 243, 252, 0.4); }
.holo-classic .card-portrait-container {
    border: 1px solid rgba(165, 243, 252, 0.2);
    background: radial-gradient(circle, rgba(165, 243, 252, 0.1) 0%, transparent 80%);
}

.cyber-neon {
    background: radial-gradient(circle at 50% 0%, #170221, #08000b 80%);
    border-color: rgba(255, 0, 127, 0.35);
    box-shadow: 0 0 30px rgba(255, 0, 127, 0.15), 0 30px 60px rgba(0, 0, 0, 0.6);
}
.cyber-neon .holo-foil {
    background: linear-gradient(115deg, transparent 0%, rgba(0, 242, 254, 0.25) 25%,
        rgba(255, 0, 127, 0.3) 45%, rgba(121, 40, 202, 0.25) 65%, transparent 100%);
    background-size: 200% 200%;
}
.cyber-neon .card-header-bar { border-bottom: 1px solid rgba(255, 0, 127, 0.25); }
.cyber-neon .level-value { color: #ff007f; text-shadow: 0 0 10px rgba(255, 0, 127, 0.6); }
.cyber-neon .card-portrait-container {
    border: 1px solid rgba(0, 242, 254, 0.3);
    background: radial-gradient(circle, rgba(0, 242, 254, 0.1) 0%, transparent 80%);
}
.cyber-neon .portrait-mesh {
    background-size: 15px 15px;
    background-image: linear-gradient(to right, rgba(0, 242, 254, 0.05) 1px, transparent 1px),
        linear-gradient(to bottom, rgba(0, 242, 254, 0.05) 1px, transparent 1px);
}

.solar-gold {
    background: radial-gradient(circle at 50% 0%, #2e1d02, #0d0901 80%);
    border-color: rgba(251, 191, 36, 0.3);
    box-shadow: 0 0 30px rgba(251, 191, 36, 0.1), 0 30px 60px rgba(0, 0, 0, 0.6);
}
.solar-gold .holo-foil {
    background: linear-gradient(115deg, transparent 0%, rgba(251, 191, 36, 0.3) 30%,
        rgba(245, 158, 11, 0.4) 50%, rgba(217, 119, 6, 0.2) 70%, transparent 100%);
    background-size: 200% 200%;
}
.solar-gold .card-header-bar { border-bottom: 1px solid rgba(251, 191, 36, 0.2); }
.solar-gold .level-value { color: #fbbf24; text-shadow: 0 0 10px rgba(251, 191, 36, 0.5); }
.solar-gold .card-portrait-container {
    border: 1px solid rgba(251, 191, 36, 0.25);
    background: radial-gradient(circle, rgba(251, 191, 36, 0.08) 0%, transparent 80%);
}

.obsidian-shadow {
    background: radial-gradient(circle at 50% 0%, #1e242d, #090a0c 80%);
    border-color: rgba(255, 255, 255, 0.1);
}
.obsidian-shadow .holo-foil {
    background: linear-gradient(115deg, transparent 0%, rgba(255, 255, 255, 0.05) 30%,
        rgba(55, 65, 81, 0.2) 50%, rgba(17, 24, 39, 0.3) 70%, transparent 100%);
    background-size: 200% 200%;
}
.obsidian-shadow .card-header-bar { border-bottom: 1px solid rgba(255, 255, 255, 0.08); }
.obsidian-shadow .level-value { color: #ffffff; text-shadow: 0 0 6px rgba(255, 255, 255, 0.2); }
.obsidian-shadow .card-portrait-container {
    border: 1px solid rgba(255, 255, 255, 0.08);
    background: radial-gradient(circle, rgba(255, 255, 255, 0.03) 0%, transparent 80%);
}
.obsidian-shadow .portrait-mesh {
    background-size: 8px 8px;
    background-image: linear-gradient(45deg, rgba(0, 0, 0, 0.2) 25%, transparent 25%),
        linear-gradient(-45deg, rgba(0, 0, 0, 0.2) 25%, transparent 25%),
        linear-gradient(45deg, transparent 75%, rgba(0, 0, 0, 0.2) 75%),
        linear-gradient(-45deg, transparent 75%, rgba(0, 0, 0, 0.2) 75%);
}

.ethereal-glass {
    background: rgba(255, 255, 255, 0.04);
    backdrop-filter: blur(25px);
    -webkit-backdrop-filter: blur(25px);
    border-color: rgba(255, 255, 255, 0.25);
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.3);
}
.ethereal-glass .holo-foil {
    background: linear-gradient(115deg, transparent 0%, rgba(255, 255, 255, 0.3) 30%,
        rgba(0, 242, 254, 0.2) 50%, rgba(255, 0, 127, 0.15) 70%, transparent 100%);
    background-size: 200% 200%;
}
.ethereal-glass .card-header-bar { border-bottom: 1px solid rgba(255, 255, 255, 0.15); }
.ethereal-glass .level-value { color: #ffffff; text-shadow: 0 0 10px rgba(255, 255, 255, 0.3); }
.ethereal-glass .card-portrait-container {
    border: 1px solid rgba(255, 255, 255, 0.2);
    background: radial-gradient(circle, rgba(255, 255, 255, 0.08) 0%, transparent 80%);
}

/* ==========================================================================
   CARD DETAIL COMPONENTS
   ========================================================================== */

.card-header-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 0.4rem;
    margin-bottom: 0.4rem;
}

.dev-meta { display: flex; flex-direction: column; }

.rarity-and-badges {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
}

.rarity-title {
    font-size: 0.72rem;
    font-family: var(--font-heading);
    text-transform: uppercase;
    letter-spacing: 1px;
    font-weight: 700;
    color: #00f2fe;
}

.quest-badge {
    background: rgba(0, 242, 150, 0.12);
    border: 1px solid rgba(0, 242, 150, 0.4);
    color: #00f296;
    padding: 0.05rem 0.35rem;
    border-radius: 4px;
    font-size: 0.45rem;
    font-weight: 800;
    line-height: 1;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    box-shadow: 0 0 8px rgba(0, 242, 150, 0.2);
}

.card-username-link {
    text-decoration: none;
    color: inherit;
    display: inline-block;
    transition: opacity 0.2s ease;
}

.card-username-link:hover {
    opacity: 0.85;
}

.card-username-wrapper {
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.card-username-link:hover .card-username {
    text-decoration: underline;
    color: var(--accent);
}

.verified-check-tick {
    display: inline-flex;
    align-items: center;
    color: #00f296;
    filter: drop-shadow(0 0 4px rgba(0, 242, 150, 0.5));
}

.verified-check-tick i {
    width: 14px;
    height: 14px;
    stroke-width: 2.5px;
}

.card-username {
    font-family: var(--font-heading);
    font-size: 1.25rem;
    font-weight: 700;
    color: #ffffff;
    letter-spacing: -0.5px;
    margin-top: 0.05rem;
}

.guild-title {
    font-size: 0.62rem;
    color: var(--text-muted);
    font-family: var(--font-heading);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 600;
    margin-top: 0.05rem;
}

.established-year {
    font-size: 0.65rem;
    color: rgba(255, 215, 0, 0.9);
    font-family: var(--font-mono);
    text-transform: uppercase;
    letter-spacing: 0.8px;
    font-weight: 700;
    margin-top: 0.3rem;
    padding: 0.15rem 0.4rem;
    background: rgba(255, 215, 0, 0.12);
    border: 1px solid rgba(255, 215, 0, 0.35);
    border-radius: 4px;
    display: inline-block;
}

.card-level-badge {
    display: flex;
    flex-direction: column;
    align-items: center;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    padding: 0.2rem 0.5rem;
    border-radius: 6px;
    min-width: 34px;
}

.level-label {
    font-size: 0.52rem;
    font-weight: 700;
    color: rgba(255, 255, 255, 0.5);
    letter-spacing: 0.5px;
}

.level-value {
    font-family: var(--font-heading);
    font-size: 0.9rem;
    font-weight: 700;
}

/* Portrait */
.card-portrait-container {
    width: 100%;
    aspect-ratio: 2.45;
    border-radius: 12px;
    overflow: hidden;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 0.35rem;
}

.portrait-mesh {
    position: absolute;
    top: 0; left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
    pointer-events: none;
}

.portrait-avatar {
    width: 70px;
    height: 70px;
    border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, 0.8);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.4);
    z-index: 2;
    position: relative;
    transition: transform var(--transition-speed) ease;
    object-fit: cover;
}

.card-portrait-container:hover .portrait-avatar {
    transform: scale(1.08) rotate(2deg);
}

.card-element-icon {
    position: absolute;
    bottom: 8px;
    right: 8px;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.7);
    border: 1px solid rgba(255, 255, 255, 0.25);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 3;
    font-size: 0.9rem;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.4);
    transition: transform var(--transition-speed) ease;
}

/* Passive Ability Block */
.card-passive-block {
    margin-bottom: 0.3rem;
    padding: 0.25rem 0.45rem;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
    transition: all 0.3s ease;
}

body.light-mode .card-passive-block {
    background: rgba(0, 0, 0, 0.015);
    border-color: rgba(0, 0, 0, 0.05);
}

.card-passive-block:hover {
    background: rgba(255, 255, 255, 0.04);
    border-color: rgba(255, 255, 255, 0.1);
}

body.light-mode .card-passive-block:hover {
    background: rgba(0, 0, 0, 0.03);
}

.passive-label {
    font-size: 0.65rem;
    font-weight: 800;
    color: var(--accent);
    letter-spacing: 0.5px;
    text-transform: uppercase;
    font-family: var(--font-heading);
}

#card-passive-name {
    font-size: 0.65rem;
    font-weight: 800;
    color: var(--text-main);
    text-transform: none;
    margin-left: 0.15rem;
}

.passive-desc {
    font-size: 0.56rem;
    line-height: 1.25;
    color: var(--text-muted);
    margin: 0;
    font-style: italic;
    font-family: var(--font-body);
}

/* Verification Badge on Card */
.card-verified-badge {
    position: absolute;
    top: 8px;
    left: 8px;
    display: flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.18rem 0.5rem;
    border-radius: 80px;
    font-size: 0.62rem;
    font-weight: 700;
    font-family: var(--font-heading);
    letter-spacing: 0.5px;
    text-transform: uppercase;
    z-index: 5;
    transition: all var(--transition-speed) ease;
}

.card-verified-badge.verified {
    background: rgba(0, 242, 150, 0.15);
    border: 1px solid rgba(0, 242, 150, 0.5);
    color: #00f296;
    animation: badge-pulse 2.5s ease-in-out infinite;
}

.card-verified-badge.creative {
    background: rgba(255, 170, 0, 0.12);
    border: 1px solid rgba(255, 170, 0, 0.35);
    color: #ffaa00;
}

.card-verified-badge i {
    width: 8px;
    height: 8px;
}

@keyframes badge-pulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(0, 242, 150, 0.3); }
    50% { box-shadow: 0 0 0 4px rgba(0, 242, 150, 0); }
}

/* Bio Block */
.card-bio-block {
    background: rgba(0, 0, 0, 0.25);
    border: 1px solid rgba(255, 255, 255, 0.05);
    padding: 0.3rem 0.5rem;
    border-radius: 8px;
    margin-bottom: 0.35rem;
    min-height: 40px;
}

.bio-text {
    font-size: 0.75rem;
    line-height: 1.35;
    color: rgba(255, 255, 255, 0.55);
    font-style: italic;
}

/* Stats Grid */
.card-stats-grid {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    margin-bottom: 0.35rem;
}

.card-stat-node {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.04);
    border-radius: 8px;
    padding: 0.2rem 0.45rem;
}

.stat-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    color: #00f2fe;
}

.stat-icon i { width: 13px; height: 13px; }

.stat-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex: 1;
}

.stat-label {
    font-size: 0.74rem;
    font-weight: 500;
    color: rgba(255, 255, 255, 0.45);
}

.stat-value {
    font-family: var(--font-mono);
    font-size: 0.85rem;
    font-weight: 700;
    color: #ffffff;
}

/* Footer Bar */
.card-footer-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    padding-top: 0.55rem;
}

.language-affinity { display: flex; gap: 0.3rem; }

.affinity-pill {
    font-size: 0.56rem;
    font-weight: 700;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: #f0f2f5;
    padding: 0.1rem 0.4rem;
    border-radius: 4px;
}

.card-serial {
    font-family: var(--font-mono);
    font-size: 0.56rem;
    color: rgba(255, 255, 255, 0.3);
}

/* Card Back Face (migrated from app.js) */
.card-back {
    background: radial-gradient(circle at 50% 50%, #0d1117, #030406 90%);
    border: 1px solid rgba(255, 255, 255, 0.1);
    transform: rotateY(180deg);
    padding: 2rem 1.5rem;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    align-items: center;
    z-index: 1;
    position: absolute;
    width: 100%;
    height: 100%;
    border-radius: var(--border-radius-card);
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
    overflow: hidden;
}

.circuit-grid {
    position: absolute;
    top: 0; left: 0;
    width: 100%;
    height: 100%;
    opacity: 0.15;
    background-size: 20px 20px;
    background-image: radial-gradient(circle, #00f2fe 1px, transparent 1px),
        linear-gradient(to right, rgba(0,242,254,0.1) 1px, transparent 1px),
        linear-gradient(to bottom, rgba(0,242,254,0.1) 1px, transparent 1px);
    pointer-events: none;
}

.card-back-logo {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    margin-top: 1rem;
    font-family: var(--font-heading);
    font-weight: 800;
    letter-spacing: 2px;
    color: #ffffff;
    font-size: 0.85rem;
}

.back-logo-icon {
    color: #00f2fe;
    width: 44px;
    height: 44px;
    stroke-width: 2px;
    filter: drop-shadow(0 0 10px rgba(0, 242, 254, 0.4));
}

.card-back-frame {
    background: rgba(255,255,255,0.02);
    border: 1px solid rgba(255,255,255,0.06);
    border-radius: 12px;
    padding: 1.1rem;
    width: 100%;
    text-align: center;
}

.card-back-frame h4 {
    font-family: var(--font-heading);
    font-size: 0.65rem;
    color: rgba(255, 255, 255, 0.4);
    letter-spacing: 1.5px;
    margin-bottom: 0.75rem;
    text-transform: uppercase;
}

.back-attributes {
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
    margin-bottom: 1.2rem;
    text-align: left;
}

.attribute-node {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
}

.attribute-meta {
    display: flex;
    justify-content: space-between;
    font-size: 0.65rem;
    font-weight: 800;
    letter-spacing: 0.5px;
    color: rgba(255, 255, 255, 0.6);
    font-family: var(--font-heading);
}

body.light-mode .attribute-meta {
    color: rgba(15, 23, 42, 0.7);
}

.attribute-value {
    color: var(--accent);
    font-weight: 800;
}

.attribute-bar-bg {
    height: 6px;
    background: rgba(255, 255, 255, 0.06);
    border-radius: 30px;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

body.light-mode .attribute-bar-bg {
    background: rgba(0, 0, 0, 0.06);
    border-color: rgba(0, 0, 0, 0.03);
}

.attribute-bar-fill {
    height: 100%;
    border-radius: 30px;
    background: linear-gradient(90deg, var(--accent), var(--primary));
    box-shadow: 0 0 8px var(--accent-glow);
    transition: width 0.8s ease-out;
}

.back-stats-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    font-family: var(--font-mono);
    font-size: 0.72rem;
}

.back-stats-list li {
    display: flex;
    justify-content: space-between;
    color: rgba(255, 255, 255, 0.45);
    border-bottom: 1px dashed rgba(255,255,255,0.05);
    padding-bottom: 0.25rem;
}

.stat-highlight {
    color: #00f2fe;
    font-weight: 700;
}

.card-back-footer {
    font-family: var(--font-mono);
    font-size: 0.62rem;
    color: rgba(255,255,255,0.2);
    letter-spacing: 0.5px;
}

/* Action Buttons Below Card */
.action-buttons-group {
    display: flex;
    gap: 1rem;
    width: var(--card-width);
}

.btn-action {
    flex: 1;
    padding: 0.75rem 1rem;
    border-radius: 12px;
}

.btn-download-main {
    background: linear-gradient(135deg, var(--primary), #6366f1);
    color: #fff;
    box-shadow: 0 4px 12px rgba(79, 70, 229, 0.3);
}

.btn-download-main:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(79, 70, 229, 0.4);
}

.btn-outline {
    background: transparent;
    border: 1px solid var(--panel-border);
    color: var(--text-main);
}

.btn-outline:hover {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.25);
}

body.light-mode .btn-outline:hover {
    background: rgba(0, 0, 0, 0.05);
}

/* ==========================================================================
   EXPORTER & SHARE HUB (BOTTOM DRAWER)
   ========================================================================== */

.exporter-tabs-section {
    max-width: 1200px;
    width: 100%;
    margin: 0 auto 5rem;
    padding: 0 2rem;
    position: relative;
    z-index: 10;
}

@media (max-width: 900px) {
    .exporter-tabs-section { padding: 0 1rem; }
}

.exporter-container-single {
    max-width: 900px;
    margin: 0 auto;
    width: 100%;
}

.exporter-container, .leaderboard-container {
    background: var(--panel-bg);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--panel-border);
    border-radius: 20px;
    padding: 2.5rem;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.15);
    transition: background 0.4s ease;
}

.leaderboard-container {
    display: flex;
    flex-direction: column;
}

.tabs-header {
    display: flex;
    border-bottom: 1px solid var(--panel-border);
    gap: 1.25rem;
    margin-bottom: 2rem;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.tab-trigger {
    background: transparent;
    border: none;
    outline: none;
    color: var(--text-muted);
    font-family: var(--font-heading);
    font-weight: 600;
    font-size: 0.9rem;
    padding: 0.75rem 0.25rem;
    cursor: pointer;
    position: relative;
    white-space: nowrap;
    display: flex;
    align-items: center;
    gap: 0.45rem;
    transition: color var(--transition-speed) ease;
}

.tab-trigger i { width: 15px; height: 15px; }
.tab-trigger:hover { color: var(--text-main); }
.tab-trigger.active { color: var(--accent); }

.tab-trigger.active::after {
    content: '';
    position: absolute;
    bottom: -1px;
    left: 0;
    width: 100%;
    height: 2px;
    background: var(--accent);
    box-shadow: 0 0 10px var(--accent-glow);
}

.tab-content { display: none; }
.tab-content.active { display: block; }

.tab-info h4 {
    font-family: var(--font-heading);
    font-size: 1.2rem;
    margin-bottom: 0.4rem;
    color: var(--text-main);
}

.tab-info p {
    color: var(--text-muted);
    font-size: 0.875rem;
    margin-bottom: 1.5rem;
    line-height: 1.6;
}

/* Code Boxes */
.code-box {
    display: flex;
    background: var(--code-bg);
    border: 1px solid var(--panel-border);
    border-radius: 12px;
    padding: 1rem;
    align-items: center;
    justify-content: space-between;
    gap: 1.5rem;
    transition: background 0.4s ease;
}

.code-box pre {
    flex: 1;
    overflow-x: auto;
    font-family: var(--font-mono);
    font-size: 0.82rem;
    color: var(--code-color);
    white-space: pre-wrap;
    word-break: break-all;
}

.btn-copy {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--panel-border);
    color: var(--text-main);
    padding: 0.45rem 0.9rem;
    border-radius: 8px;
    font-size: 0.8rem;
    font-family: var(--font-heading);
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.4rem;
    transition: all var(--transition-speed) ease;
    flex-shrink: 0;
}

.btn-copy:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.2);
}

body.light-mode .btn-copy { background: rgba(0, 0, 0, 0.04); }
body.light-mode .btn-copy:hover { background: rgba(0, 0, 0, 0.08); }

/* Share Grid */
.share-grid {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

.btn-share {
    flex: 1;
    min-width: 140px;
    padding: 0.75rem 1.25rem;
    border-radius: 12px;
    text-decoration: none;
    color: #ffffff;
    font-family: var(--font-heading);
    font-weight: 600;
    text-align: center;
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
    cursor: pointer;
    border: none;
    transition: all var(--transition-speed) ease;
    font-size: 0.875rem;
}

.btn-share.twitter { background: #1da1f2; }
.btn-share.twitter:hover { background: #0d95e8; transform: translateY(-2px); }
.btn-share.linkedin { background: #0077b5; }
.btn-share.linkedin:hover { background: #00669c; transform: translateY(-2px); }
.btn-share.link {
    background: var(--share-link-bg);
    border: 1px solid var(--share-link-border);
    color: var(--text-main);
}
.btn-share.link:hover { transform: translateY(-2px); }

/* ==========================================================================
   DEVELOPER LEADERBOARD TAB
   ========================================================================== */

.leaderboard-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.5rem;
    gap: 1rem;
    flex-wrap: wrap;
}

.leaderboard-header-text h4 {
    font-family: var(--font-heading);
    font-size: 1.2rem;
    margin-bottom: 0.3rem;
    color: var(--text-main);
}

.leaderboard-header-text p {
    color: var(--text-muted);
    font-size: 0.875rem;
    margin: 0;
}

.btn-join-leaderboard {
    background: linear-gradient(135deg, #00f296, #00b4d8);
    color: #000;
    font-family: var(--font-heading);
    font-weight: 700;
    font-size: 0.85rem;
    padding: 0.6rem 1.2rem;
    border-radius: 10px;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: all var(--transition-speed) ease;
    white-space: nowrap;
    flex-shrink: 0;
}

.btn-join-leaderboard:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(0, 242, 150, 0.3);
}

.btn-join-leaderboard i { width: 16px; height: 16px; }

/* Leaderboard unverified warning */
.leaderboard-unverified-notice {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 1rem;
    padding: 2rem;
    background: rgba(255, 170, 0, 0.05);
    border: 1px dashed rgba(255, 170, 0, 0.3);
    border-radius: 14px;
    margin-bottom: 1.5rem;
}

.leaderboard-unverified-notice .notice-icon {
    font-size: 2rem;
}

.leaderboard-unverified-notice h5 {
    font-family: var(--font-heading);
    font-size: 1rem;
    color: #ffaa00;
}

.leaderboard-unverified-notice p {
    color: var(--text-muted);
    font-size: 0.85rem;
    margin: 0;
    max-width: 420px;
}

/* Leaderboard Table */
.leaderboard-list {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
}

.leaderboard-row {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.85rem 1rem;
    border-radius: 12px;
    border: 1px solid var(--panel-border);
    background: rgba(255, 255, 255, 0.015);
    transition: all var(--transition-speed) ease;
    position: relative;
    overflow: hidden;
}

body.light-mode .leaderboard-row {
    background: rgba(0, 0, 0, 0.015);
}

.leaderboard-row:hover {
    border-color: rgba(255, 255, 255, 0.12);
    background: rgba(255, 255, 255, 0.04);
    transform: translateX(4px);
}

body.light-mode .leaderboard-row:hover {
    background: rgba(0, 0, 0, 0.04);
}

.leaderboard-row.is-current-user {
    border-color: rgba(0, 242, 150, 0.3);
    background: rgba(0, 242, 150, 0.04);
}

.leaderboard-divider {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 0.25rem 0;
    color: var(--text-muted);
    font-size: 0.8rem;
    letter-spacing: 2px;
    opacity: 0.5;
}

.leaderboard-row.is-pinned {
    border: 1px solid rgba(0, 242, 254, 0.25);
    background: rgba(0, 242, 254, 0.04) !important;
    box-shadow: 0 0 15px rgba(0, 242, 254, 0.08);
}

body.light-mode .leaderboard-row.is-pinned {
    border-color: rgba(2, 132, 199, 0.25);
    background: rgba(2, 132, 199, 0.04) !important;
    box-shadow: 0 0 15px rgba(2, 132, 199, 0.08);
}

.leaderboard-row.rank-1 { border-color: rgba(255, 215, 0, 0.35); }
.leaderboard-row.rank-2 { border-color: rgba(192, 192, 192, 0.35); }
.leaderboard-row.rank-3 { border-color: rgba(205, 127, 50, 0.35); }

.lb-rank {
    font-family: var(--font-mono);
    font-size: 0.85rem;
    font-weight: 700;
    min-width: 28px;
    text-align: center;
    color: var(--text-muted);
}

.rank-1 .lb-rank { color: #ffd700; }
.rank-2 .lb-rank { color: #c0c0c0; }
.rank-3 .lb-rank { color: #cd7f32; }

.lb-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--panel-border);
    flex-shrink: 0;
}

.lb-info {
    flex: 1;
    min-width: 0;
}

.lb-profile-link {
    text-decoration: none;
    color: inherit;
    display: flex;
    flex-direction: column;
    width: 100%;
}

.lb-profile-link:hover .lb-name {
    color: var(--accent);
    text-decoration: underline;
}

.lb-name {
    font-family: var(--font-heading);
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--text-main);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.lb-sub {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-family: var(--font-mono);
}

.lb-score-block {
    text-align: right;
    flex-shrink: 0;
}

.lb-score {
    font-family: var(--font-mono);
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--accent);
    display: block;
}

.lb-score-label {
    font-size: 0.65rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.lb-verified-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #00f296;
    box-shadow: 0 0 6px #00f296;
    flex-shrink: 0;
}

.lb-empty {
    text-align: center;
    padding: 3rem 2rem;
    color: var(--text-muted);
    font-size: 0.875rem;
}

.lb-empty .empty-icon {
    font-size: 2.5rem;
    display: block;
    margin-bottom: 0.75rem;
}

/* ==========================================================================
   CONSENT MODAL OVERLAY
   ========================================================================== */

.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    z-index: 500;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

body.light-mode .modal-overlay {
    background: rgba(15, 23, 42, 0.5);
}

.modal-overlay.open {
    opacity: 1;
    pointer-events: all;
}

.modal-card {
    background: #0f1117;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 20px;
    padding: 2.5rem;
    max-width: 480px;
    width: 100%;
    box-shadow: 0 40px 80px rgba(0, 0, 0, 0.5);
    transform: translateY(20px) scale(0.97);
    transition: transform 0.3s var(--transition-bounce);
    position: relative;
}

body.light-mode .modal-card {
    background: #ffffff;
    border-color: rgba(0, 0, 0, 0.1);
}

.modal-overlay.open .modal-card {
    transform: translateY(0) scale(1);
}

.modal-icon {
    font-size: 2.5rem;
    margin-bottom: 1rem;
    display: block;
}

.modal-title {
    font-family: var(--font-heading);
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--text-main);
    margin-bottom: 0.75rem;
}

.modal-body {
    color: var(--text-muted);
    font-size: 0.9rem;
    line-height: 1.65;
    margin-bottom: 1.5rem;
}

.modal-body strong { color: var(--text-main); }

.modal-actions {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.btn-modal-confirm {
    flex: 1;
    background: linear-gradient(135deg, #00f296, #00b4d8);
    color: #000;
    font-family: var(--font-heading);
    font-weight: 700;
    font-size: 0.9rem;
    padding: 0.75rem;
    border-radius: 10px;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    transition: all var(--transition-speed) ease;
}

.btn-modal-confirm:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(0, 242, 150, 0.3);
}

.btn-modal-cancel {
    flex: 1;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--panel-border);
    color: var(--text-muted);
    font-family: var(--font-heading);
    font-weight: 600;
    font-size: 0.9rem;
    padding: 0.75rem;
    border-radius: 10px;
    cursor: pointer;
    transition: all var(--transition-speed) ease;
}

body.light-mode .btn-modal-cancel { background: rgba(0, 0, 0, 0.04); }

.btn-modal-cancel:hover {
    color: var(--text-main);
    background: rgba(255, 255, 255, 0.08);
}

.modal-close-btn {
    position: absolute;
    top: 1rem;
    right: 1rem;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid var(--panel-border);
    color: var(--text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.modal-close-btn:hover {
    background: rgba(255, 74, 90, 0.15);
    color: #ff4a5a;
}

.modal-close-btn i { width: 14px; height: 14px; }

/* ==========================================================================
   TOAST NOTIFICATION
   ========================================================================== */

.toast {
    position: fixed;
    bottom: 24px;
    right: 24px;
    background: var(--toast-bg);
    border: 1px solid var(--accent);
    box-shadow: 0 10px 30px var(--accent-glow);
    border-radius: 12px;
    padding: 0.85rem 1.25rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    z-index: 1000;
    transform: translateY(150%);
    opacity: 0;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    max-width: 320px;
}

.toast.show { transform: translateY(0); opacity: 1; }

.toast-icon { color: var(--accent); width: 18px; height: 18px; flex-shrink: 0; }

.toast-message {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-main);
}

/* ==========================================================================
   EMBED MODE (hides everything except the 3D card)
   ========================================================================== */

body.embed-mode .app-header,
body.embed-mode .control-panel,
body.embed-mode .exporter-tabs-section,
body.embed-mode .action-buttons-group,
body.embed-mode .viewport-header,
body.embed-mode .bg-glow,
body.embed-mode .particles-container,
body.embed-mode .modal-overlay {
    display: none !important;
}

body.embed-mode {
    background: transparent;
    overflow: hidden;
}

body.embed-mode .app-container {
    grid-template-columns: 1fr;
    padding: 0;
    margin: 0;
}

/* ==========================================================================
   PROMO BANNER
   ========================================================================== */
.promo-banner {
    grid-column: 1 / -1;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(0, 242, 150, 0.05);
    border: 1px solid rgba(0, 242, 150, 0.2);
    border-radius: 12px;
    padding: 0.85rem 1.5rem;
    margin-bottom: 0.5rem;
    box-shadow: 0 10px 30px rgba(0, 242, 150, 0.05);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    transition: all 0.3s ease;
    animation: slideDown 0.4s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

body.light-mode .promo-banner {
    background: rgba(2, 132, 199, 0.05);
    border-color: rgba(2, 132, 199, 0.2);
    box-shadow: 0 10px 30px rgba(2, 132, 199, 0.05);
}

.promo-content {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.promo-icon {
    font-size: 1.25rem;
    filter: drop-shadow(0 0 4px rgba(255, 215, 0, 0.4));
}

.promo-text {
    font-size: 0.875rem;
    color: var(--text-main);
    margin: 0;
    line-height: 1.4;
}

.promo-text strong {
    color: #ffffff;
    font-weight: 700;
}

body.light-mode .promo-text strong {
    color: var(--text-main);
}

.promo-link-btn {
    background: transparent;
    border: none;
    color: var(--accent);
    text-decoration: underline;
    font-weight: 700;
    cursor: pointer;
    font-family: inherit;
    font-size: inherit;
    padding: 0;
    display: inline;
    transition: color 0.2s ease;
}

.promo-link-btn:hover {
    color: #ffffff;
    text-decoration: none;
}

body.light-mode .promo-link-btn:hover {
    color: #000000;
}

.promo-close-btn {
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0.25rem;
    border-radius: 4px;
    transition: all 0.2s ease;
}

.promo-close-btn:hover {
    color: var(--text-main);
    background: rgba(255, 255, 255, 0.08);
}

.promo-close-btn i {
    width: 16px;
    height: 16px;
}

body.embed-mode .app-container {
    grid-template-columns: 1fr;
    margin: 0;
    padding: 0;
    height: 100vh;
    place-items: center;
}

body.embed-mode .card-viewport {
    justify-content: center;
    gap: 0;
    height: 100%;
}

body.embed-mode .card-perspective-container {
    margin: 0;
}

/* ==========================================================================
   RESPONSIVE ADJUSTMENTS
   ========================================================================== */

/* Hide horizontal scrollbar for clean horizontal tab navigation */
.tabs-header {
    scrollbar-width: none; /* Firefox */
}
.tabs-header::-webkit-scrollbar {
    display: none; /* Chrome, Safari, Opera */
}

@media (max-width: 900px) {
    .app-container {
        grid-template-columns: 1fr;
        gap: 2rem;
        margin: 1.5rem auto;
        padding: 0 1rem;
    }
    
    /* Reorder columns so Card Viewport is on top on mobile */
    .promo-banner {
        order: 1;
    }
    
    .card-viewport {
        order: 2;
    }
    
    .control-panel {
        order: 3;
    }
    
    .leaderboard-container {
        order: 4;
    }
}

@media (max-width: 640px) {
    .app-header { padding: 0.85rem 4%; }
    .logo { font-size: 1.15rem; }
    .logo-icon { width: 20px; height: 20px; }
    
    /* Optimize Header Actions for small screens */
    .github-link span { display: none; }
    .btn-github-auth span { display: none; }
    .btn-github-auth {
        padding: 0.5rem;
        aspect-ratio: 1;
        border-radius: 50%;
        justify-content: center;
    }
    #user-chip-name { display: none; }
    .user-profile-chip { padding: 0.35rem; }
    
    /* Reduce large panels padding on mobile */
    .control-panel, 
    .exporter-container, 
    .leaderboard-container {
        padding: 1.25rem 1rem;
        border-radius: 16px;
    }
    
    .leaderboard-row { gap: 0.6rem; padding: 0.65rem 0.75rem; }
    .modal-card { padding: 1.5rem 1.25rem; }
}

@media (max-width: 600px) {
    .promo-banner {
        flex-direction: row;
        align-items: flex-start;
        padding: 0.75rem 1rem;
    }
    .promo-content {
        align-items: flex-start;
    }
}

@media (max-width: 480px) {
    /* Scale the 3D card down cleanly to fit narrow screens without overflow */
    :root {
        --card-width: 300px;
        --card-height: 454px;
    }
    
    .card-front {
        padding: 0.75rem;
    }
    
    .card-username {
        font-size: 1.1rem;
    }
    
    .portrait-avatar {
        width: 62px;
        height: 62px;
    }
    
    .stat-label {
        font-size: 0.68rem;
    }
    
    .stat-value {
        font-size: 0.78rem;
    }
    
    .card-passive-block p {
        font-size: 0.65rem;
    }
    
    .established-year {
        font-size: 0.58rem;
        padding: 0.1rem 0.3rem;
    }
    
    /* Stack social shares/embed code boxes neatly on narrow viewports */
    .code-box {
        flex-direction: column;
        align-items: stretch;
        gap: 0.75rem;
    }
    .btn-copy {
        align-self: flex-end;
    }
}

@media (max-width: 350px) {
    /* Ultra-small viewports (e.g. iPhone SE) */
    :root {
        --card-width: 270px;
        --card-height: 408px;
    }
    
    .card-front {
        padding: 0.65rem;
    }
    
    .card-username {
        font-size: 1.0rem;
    }
    
    .portrait-avatar {
        width: 55px;
        height: 55px;
    }
    
    .stat-label {
        font-size: 0.62rem;
    }
    
    .stat-value {
        font-size: 0.72rem;
    }
    
    .card-stats-grid {
        gap: 0.15rem;
    }
}

/* ==========================================================================
   GLOBAL FOOTER
   ========================================================================== */
.global-footer {
    border-top: 1px solid var(--panel-border);
    background: rgba(7, 8, 10, 0.4);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    padding: 2.5rem 2rem;
    margin-top: 5rem;
    position: relative;
    z-index: 10;
    width: 100%;
}

body.light-mode .global-footer {
    background: rgba(255, 255, 255, 0.4);
}

.footer-content {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1.5rem;
    flex-wrap: wrap;
}

.footer-attribution {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    font-size: 0.875rem;
    color: var(--text-muted);
}

.footer-logo-icon {
    width: 16px;
    height: 16px;
    color: var(--accent);
}

.footer-halonic-text {
    color: var(--text-main);
    font-weight: 700;
}

.footer-copyright {
    font-size: 0.8125rem;
    color: var(--text-muted);
    font-family: var(--font-mono);
}

@media (max-width: 768px) {
    .footer-content {
        flex-direction: column;
        text-align: center;
        gap: 1rem;
    }
}

.footer-legal-links {
    display: flex;
    gap: 1rem;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
}

.footer-legal-link {
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.8125rem;
    font-family: var(--font-mono);
    transition: color var(--transition-speed) ease;
}

.footer-legal-link:hover {
    color: var(--text-main);
}

/* ==========================================================================
   LEGAL PAGES STYLES
   ========================================================================== */
.legal-container {
    max-width: 860px;
    margin: 4rem auto;
    padding: 0 2rem;
    position: relative;
    z-index: 10;
}

.legal-panel {
    background: var(--panel-bg);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--panel-border);
    border-radius: 20px;
    padding: 3rem 3.5rem;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.15);
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    transition: background 0.4s ease, border-color 0.4s ease;
}

.legal-header {
    border-bottom: 1px solid var(--panel-border);
    padding-bottom: 1.5rem;
    margin-bottom: 0.5rem;
}

.legal-header h1 {
    font-family: var(--font-heading);
    font-size: 2.25rem;
    font-weight: 700;
    color: var(--text-main);
    letter-spacing: -0.5px;
    background: linear-gradient(to right, var(--text-main), var(--text-muted));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.legal-header .last-updated {
    font-size: 0.8125rem;
    color: var(--text-muted);
    font-family: var(--font-mono);
    margin-top: 0.5rem;
    display: block;
}

.legal-content {
    font-family: var(--font-body);
    font-size: 0.95rem;
    line-height: 1.6;
    color: var(--text-main);
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.legal-content h2 {
    font-family: var(--font-heading);
    font-size: 1.35rem;
    font-weight: 600;
    color: var(--accent);
    margin-top: 0.75rem;
    letter-spacing: -0.2px;
}

.legal-content p {
    color: rgba(255, 255, 255, 0.75);
}

body.light-mode .legal-content p {
    color: rgba(15, 23, 42, 0.8);
}

.legal-content ul {
    padding-left: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    color: rgba(255, 255, 255, 0.7);
}

body.light-mode .legal-content ul {
    color: rgba(15, 23, 42, 0.75);
}

.legal-content li strong {
    color: var(--text-main);
}

.btn-back-home {
    align-self: flex-start;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--accent);
    text-decoration: none;
    font-family: var(--font-heading);
    font-weight: 600;
    font-size: 0.875rem;
    transition: color 0.2s ease, transform 0.2s ease;
}

.btn-back-home:hover {
    color: var(--text-main);
    transform: translateX(-4px);
}

@media (max-width: 600px) {
    .legal-container {
        margin: 2rem auto;
        padding: 0 1rem;
    }
    
    .legal-panel {
        padding: 2rem 1.5rem;
        border-radius: 16px;
    }
    
    .legal-header h1 {
        font-size: 1.75rem;
    }
}

/* ==========================================================================
   CARBON ADS MONETIZATION STYLING
   ========================================================================== */
.ad-placement-section {
    margin-top: auto;
    padding-top: 1.5rem;
    border-top: 1px solid var(--panel-border);
    width: 100%;
}

#carbonads {
    display: block;
    overflow: hidden;
    max-width: 100%;
    background: rgba(255, 255, 255, 0.015);
    border: 1px solid var(--panel-border);
    border-radius: 12px;
    padding: 0.85rem;
    font-size: 0.76rem;
    line-height: 1.4;
    font-family: var(--font-body);
    transition: background 0.4s ease, border-color 0.4s ease;
}

body.light-mode #carbonads {
    background: rgba(0, 0, 0, 0.015);
}

#carbonads a {
    color: var(--text-main);
    text-decoration: none;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

#carbonads a:hover {
    color: var(--text-main);
}

.carbon-wrap {
    display: flex;
    flex-direction: row;
    gap: 0.75rem;
    align-items: center;
    width: 100%;
}

.carbon-img {
    display: block;
    flex-shrink: 0;
}

.carbon-img img {
    display: block;
    border-radius: 6px;
    width: 100px;
    height: 75px;
    object-fit: cover;
    border: 1px solid var(--panel-border);
}

.carbon-text {
    display: block;
    font-weight: 500;
    color: var(--text-muted);
    transition: color 0.2s ease;
    flex: 1;
}

#carbonads a:hover .carbon-text {
    color: var(--text-main);
}

.carbon-poweredby {
    display: block;
    font-size: 0.6rem;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: var(--accent) !important;
    font-family: var(--font-mono);
    font-weight: 700;
    margin-top: 0.25rem;
}

@media (max-width: 480px) {
    #carbonads {
        padding: 0.75rem;
    }
    .carbon-img img {
        width: 80px;
        height: 60px;
    }
    .carbon-text {
        font-size: 0.7rem;
    }
}

/* ==========================================================================
   FOLLOW CREATOR SOCIAL LINKS STYLING
   ========================================================================== */
.footer-social-links {
    display: flex;
    gap: 1.25rem;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    margin-top: 0.6rem;
    width: 100%;
}

.footer-social-link {
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.8125rem;
    font-family: var(--font-mono);
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    transition: color var(--transition-speed) ease, transform var(--transition-speed) ease;
}

.footer-social-link i {
    width: 14px;
    height: 14px;
    color: var(--accent);
    transition: color var(--transition-speed) ease;
}

.footer-social-link:hover {
    color: var(--text-main);
    transform: translateY(-1px);
}

.footer-social-link:hover i {
    color: var(--text-main);
}

@media (max-width: 600px) {
    .footer-social-links {
        gap: 0.85rem;
    }
    .footer-social-link {
        font-size: 0.75rem;
    }
}
