* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* Neon-noir scrollbars */
* { scrollbar-width: thin; scrollbar-color: #ff00ff #0a0a15; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: #0a0a15; }
::-webkit-scrollbar-thumb {
    background: linear-gradient(180deg, #ff00ff, #00f0ff);
    border-radius: 6px;
    border: 2px solid #0a0a15;
}
::-webkit-scrollbar-thumb:hover { background: linear-gradient(180deg, #ff5cff, #5cf6ff); }
::-webkit-scrollbar-corner { background: #0a0a15; }

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: #0a0a15 url('assets/bg_optimized.jpg') center/cover no-repeat fixed;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    color: #fff;
    overflow-x: hidden;
    padding-top: 20px;
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    -webkit-tap-highlight-color: transparent;
}

/* Images never selectable or draggable by browser default */
img {
    user-select: none;
    -webkit-user-select: none;
    -webkit-user-drag: none;
    -khtml-user-drag: none;
    -moz-user-drag: none;
    -o-user-drag: none;
}
/* Tool-sidebar images still need HTML5 drag — re-enable on the draggable parent only */
.tool-item { -webkit-user-drag: element; }

/* Allow selection in inputs/textareas so the user can still type and edit */
input, textarea, select {
    user-select: text;
    -webkit-user-select: text;
}

/* Title Section with Logo */
.title-section {
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 5px;
    animation: fadeIn 0.8s ease-in;
}

.logo {
    max-width: 250px;
    height: auto;
    filter: drop-shadow(0 0 30px rgba(0, 240, 255, 0.6));
    transition: transform 0.3s ease;
}

.logo:hover {
    transform: scale(1.05);
}

/* TABS */
.tabs-container {
    width: 100%;
    display: flex;
    justify-content: center;
    margin-bottom: 20px;
    z-index: 10;
}

.tabs {
    display: flex;
    background: rgba(0, 0, 0, 0.6);
    border-radius: 30px;
    padding: 5px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.tab-btn {
    background: transparent;
    border: none;
    color: #aaa;
    padding: 10px 25px;
    font-size: 0.9rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s ease;
    border-radius: 25px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.tab-btn.active {
    background: linear-gradient(135deg, #a855f7, #ec4899);
    color: #fff;
    box-shadow: 0 0 15px rgba(236, 72, 153, 0.5);
}

.tab-btn:hover:not(.active) {
    color: #fff;
}

.tab-content {
    display: none;
    width: 100%;
    justify-content: center;
    animation: fadeIn 0.5s ease;
}

.tab-content.active {
    display: flex;
}

.hidden {
    display: none !important;
}

/* RANDOMIZER STYLES */
.container {
    width: 90%;
    max-width: 680px;
    padding: 0px;
}

.loadout-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 5px;
    margin-bottom: 8px;
    animation: fadeIn 1s ease-in;
}

.weapon-slot {
    aspect-ratio: 1;
    background: rgba(30, 20, 60, 0.6);
    border: 2px solid rgba(0, 240, 255, 0.3);
    border-radius: 8px;
    padding: 4px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
    transition: all 0.3s ease;
    animation: slideIn 0.6s ease forwards;
    opacity: 0;
}

.weapon-slot:nth-child(1) {
    animation-delay: 0.1s;
}

.weapon-slot:nth-child(2) {
    animation-delay: 0.2s;
}

.weapon-slot:nth-child(3) {
    animation-delay: 0.3s;
}

.weapon-slot:nth-child(4) {
    animation-delay: 0.4s;
}

.weapon-slot:nth-child(5) {
    animation-delay: 0.5s;
}

.weapon-slot:nth-child(6) {
    animation-delay: 0.6s;
}

.weapon-slot::before {
    content: '';
    position: absolute;
    top: -2px;
    left: -2px;
    right: -2px;
    bottom: -2px;
    background: linear-gradient(135deg, #00f0ff, #a855f7, #00f0ff);
    border-radius: 15px;
    opacity: 0;
    z-index: -1;
    transition: opacity 0.3s ease;
    animation: borderGlow 3s ease infinite;
}

.weapon-slot:hover {
    transform: translateY(-5px);
    border-color: rgba(0, 240, 255, 0.8);
    box-shadow: 0 10px 40px rgba(0, 240, 255, 0.3),
        inset 0 0 30px rgba(0, 240, 255, 0.1);
}

.weapon-slot:hover::before {
    opacity: 0.5;
}

.weapon-img {
    width: 60%;
    height: 60%;
    object-fit: contain;
    filter: drop-shadow(0 5px 15px rgba(0, 240, 255, 0.4));
    transition: transform 0.3s ease;
}

.weapon-slot:hover .weapon-img {
    transform: scale(1.1);
}

.weapon-name {
    margin-top: 7px;
    font-size: 0.68rem;
    font-weight: 600;
    letter-spacing: 1px;
    text-transform: uppercase;
    color: #ffffff;
    text-shadow: 0 0 10px rgba(255, 255, 255, 0.5);
    text-align: center;
}

.controls {
    display: flex;
    justify-content: center;
    animation: fadeIn 1.2s ease-in;
}

.generate-btn {
    background: linear-gradient(135deg, #a855f7, #ec4899, #a855f7);
    border: 2px solid #ec4899;
    color: #fff;
    padding: 10px 30px;
    font-size: 0.65rem;
    font-weight: 800;
    letter-spacing: 3px;
    text-transform: uppercase;
    border-radius: 10px;
    cursor: pointer;
    position: relative;
    overflow: hidden;
    transition: all 0.3s ease;
    box-shadow: 0 0 20px rgba(236, 72, 153, 0.4);
}

.generate-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(0, 240, 255, 0.4), transparent);
    transition: left 0.5s ease;
}

.generate-btn:hover {
    transform: scale(1.08);
    box-shadow: 0 0 40px rgba(236, 72, 153, 0.8),
        inset 0 0 20px rgba(236, 72, 153, 0.3);
    border-color: #fff;
    color: #fff;
    background: linear-gradient(135deg, #ec4899, #a855f7, #ec4899);
}

.generate-btn:hover::before {
    left: 100%;
}

.generate-btn:active {
    transform: scale(0.98);
}

.secondary-btn {
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid rgba(0, 240, 255, 0.3);
    color: #00f0ff;
    padding: 10px 15px;
    font-size: 0.65rem;
    font-weight: 700;
    margin-left: 10px;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.secondary-btn:hover {
    background: rgba(0, 240, 255, 0.2);
    box-shadow: 0 0 15px rgba(0, 240, 255, 0.3);
    border-color: #00f0ff;
}

/* Attachment Badge */
.attachment-badge {
    position: absolute;
    top: 2px;
    right: 5px;
    font-family: 'Impact', sans-serif;
    color: #ffdd00;
    /* More yellow */
    /* Yellow text */
    font-size: 1.2rem;
    font-weight: normal;
    text-shadow: 2px 2px 0 #000;
    /* Black outline for readability */
    z-index: 10;
    pointer-events: none;
    animation: popIn 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes popIn {
    from {
        transform: scale(0);
    }

    to {
        transform: scale(1);
    }
}

/* CARD CREATOR STYLES */
.creator-container {
    width: 95%;
    max-width: 1200px;
}

.creator-layout {
    display: flex;
    flex-wrap: wrap;
    gap: 30px;
    justify-content: center;
}

.creator-form {
    flex: 1;
    min-width: 300px;
    max-width: 400px;
    background: rgba(0, 0, 0, 0.6);
    padding: 20px;
    border-radius: 15px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.form-group {
    margin-bottom: 15px;
}

.form-group label {
    display: block;
    font-size: 0.8rem;
    color: #00f0ff;
    margin-bottom: 5px;
    font-weight: bold;
    letter-spacing: 1px;
}

.form-row {
    display: flex;
    gap: 15px;
}

.form-row .form-group {
    flex: 1;
}

input[type="text"],
select {
    width: 100%;
    background: #1a1a2e;
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: #fff;
    padding: 8px 12px;
    border-radius: 5px;
    font-family: inherit;
    font-size: 0.9rem;
}

input[type="text"]:focus,
select:focus {
    outline: none;
    border-color: #ec4899;
    box-shadow: 0 0 10px rgba(236, 72, 153, 0.3);
    background: #0f0f1a;
}

/* Ensure options inside select are dark as well */
select option {
    background: #1a1a2e;
    color: #fff;
}

.stat-slider {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 5px;
}

.stat-slider span {
    width: 96px;
    font-size: 0.85rem;
}

/* Fourth stat name is a picker (Strategy / Agility); sized to sit in the
   label column so the sliders stay aligned. */
.stat-slider .stat-name-select {
    width: 96px;
    flex-shrink: 0;
    padding: 3px 6px;
    font-size: 0.85rem;
    cursor: pointer;
}

.stat-slider input[type="range"] {
    flex: 1;
    height: 6px;
    -webkit-appearance: none;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 3px;
    outline: none;
}

.stat-slider input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #00f0ff;
    cursor: pointer;
    box-shadow: 0 0 10px #00f0ff;
}

.weapon-select-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
}

.weapon-select {
    width: 100%;
    font-size: 0.8rem;
}

/* PREVIEW CARD STYLES */
.card-preview {
    flex: 2;
    min-width: 600px;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.player-card {
    --card-border: #ff00ff;
    --card-glow: #ff00ff;
    width: 700px;
    height: 400px;
    position: relative;
    border-radius: 25px;
    padding: 15px;
    box-shadow: 0 0 30px rgba(0, 0, 0, 0.8),
        0 0 22px var(--card-glow),
        0 0 8px var(--card-glow);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: #080810;
    border: 8px solid var(--card-border);
    box-sizing: border-box;
}

.player-card[data-border="plasma"] { --card-border: #ff00ff; --card-glow: #ff00ff; }
.player-card[data-border="cryo"]   { --card-border: #00f0ff; --card-glow: #00f0ff; }
.player-card[data-avatar="plasma"] .avatar-box { border-color: #ff00ff; box-shadow: 0 0 10px #ff00ff; }
.player-card[data-avatar="cryo"]   .avatar-box { border-color: #00f0ff; box-shadow: 0 0 10px #00f0ff; }

.card-rank-line { display: flex; align-items: center; gap: 6px; }
.rank-icon-inline {
    width: 28px;
    height: 28px;
    object-fit: contain;
    vertical-align: middle;
}

/* The actual background image layer */
.card-bg-layer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    background-size: cover;
    background-position: center;
    /* filter: blur(3px); Removed blur to fix save artifacts */
    opacity: 0.6;
}

/* Removed separate .card-border to fix pink block glitch */

.card-content {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    z-index: 2;
    position: relative;
}

.card-header {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-bottom: 5px;
    position: relative;
    flex-shrink: 0;
    /* Prevent squishing */
}

.card-logo {
    height: 90px;
    /* Bigger logo */
    margin-top: -20px;
    /* Move up slightly */
    margin-bottom: -10px;
    /* Reduce bottom space */
    position: relative;
    z-index: 10;
}

.player-name-display {
    font-size: 2.2rem;
    font-weight: 900;
    color: #ffdd00;
    /* More yellow */
    text-transform: uppercase;
    text-shadow: 3px 3px 0 #000;
    font-family: 'Impact', sans-serif, 'Arial Black';
    letter-spacing: 1px;
    line-height: 1;
}

.card-body {
    display: flex;
    flex: 1;
    gap: 15px;
    padding: 0 5px;
    overflow: visible;
    min-height: 0;
    /* Enable flex shrinking */
}

.avatar-section {
    width: 35%;
    display: flex;
    flex-direction: column;
}

.avatar-box {
    width: 100%;
    aspect-ratio: 0.75;
    background: #080810;
    border: 3px solid #00f0ff;
    box-shadow: 0 0 10px #00f0ff;
    border-radius: 2px;
    overflow: hidden;
    position: relative;
}

/* Avatar adjust controls — appear after upload */
.avatar-adjust {
    margin-top: 8px;
    padding: 8px 10px;
    background: rgba(0,0,0,.4);
    border: 1px solid rgba(0,240,255,.25);
    border-radius: 4px;
}
.avatar-adjust-row {
    display: flex; align-items: center; gap: 10px;
}
.avatar-adjust-label {
    font-family: 'Orbitron', sans-serif;
    font-size: 0.7rem; letter-spacing: 1px;
    color: #00f0ff; min-width: 44px;
}
.avatar-adjust-row input[type="range"] { flex: 1; }
.avatar-adjust-hint {
    margin-top: 6px;
    font-size: 0.7rem; color: #999; font-style: italic;
}

/* Avatar via background-image so html2canvas renders it deterministically
   (object-fit on <img> is unreliable in html2canvas and causes preview/
   published mismatches). Uploads are pre-baked at high resolution to the
   box aspect, so cover crop is exact and stays sharp at 3.5× capture. */
.card-avatar-div {
    width: 100%;
    height: 100%;
    background-image: url('assets/logo.png');
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
}

.player-info {
    margin-top: 5px;
    /* Lowered slightly more */
    color: #ffdd00;
    /* More yellow */
    font-family: 'Impact', sans-serif;
    font-size: 1.0rem;
    text-shadow: 2px 2px 0 #000;
    line-height: 1.2;
    display: flex;
    flex-direction: column;
    /* transform removed for better html2canvas support */
}

.stats-section {
    width: 65%;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    padding-top: 10px;
    /* Reduced from 25px to save space */
}

/* Larger stats rows */
.stat-row {
    display: flex;
    align-items: center;
    margin-bottom: 8px;
    /* Reduced spacing */
    height: 28px;
}

.stat-icon {
    width: 28px;
    height: 28px;
    margin-right: 5px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.stat-icon svg {
    width: 24px;
    height: 24px;
    fill: currentColor;
    filter: drop-shadow(0 0 2px currentColor);
}

/* Pseudo-icons using borders/css */
.offense-icon {
    color: #ff3333;
}

.defense-icon {
    color: #3388ff;
}

.evasion-icon {
    color: #ff33ff;
}

.strategy-icon {
    color: #33ff33;
}

.stat-label {
    width: 100px;
    /* Increased from 85px to prevent overlap */
    flex-shrink: 0;
    /* Prevent shrinking */
    font-family: 'Impact', sans-serif;
    font-size: 1.6rem;
    /* Larger text */
    color: #ffdd00;
    /* More yellow */
    text-transform: uppercase;
    text-shadow: 2px 2px 0 #000;
    margin-right: 10px;
}

.stat-bar-container {
    flex: 1;
    height: 24px;
    /* Thicker bar */
    background: #1a0b3c;
    /* Dark purple background for empty part */
    border: 2px solid #5500aa;
    border-radius: 4px;
    position: relative;
    padding: 2px;
}

.stat-bar {
    height: 100%;
    width: 50%;
    border-radius: 1px;
    box-shadow: 0 0 5px currentColor;
    /* Glow effect */
}

.offense-bar {
    background: linear-gradient(90deg, #ff3333, #ff5555);
    color: #ff3333;
}

.defense-bar {
    background: linear-gradient(90deg, #3388ff, #5599ff);
    color: #3388ff;
}

.evasion-bar {
    background: linear-gradient(90deg, #ff00ff, #ff55ff);
    color: #ff00ff;
}

.strategy-bar {
    background: linear-gradient(90deg, #33ff33, #55ff55);
    color: #33ff33;
}

.card-loadout-box {
    margin-top: auto;
    border: 3px solid #ffdd00;
    /* More yellow */
    padding: 5px;
    background: rgba(0, 0, 0, 0.6);
    height: 80px;
    display: flex;
    align-items: center;
    justify-content: space-around;
    margin-bottom: 5px;
    /* Reduced to fit footer */
}

.card-weapons {
    display: flex;
    width: 100%;
    height: 100%;
    justify-content: space-around;
    align-items: center;
}

.card-weapon-slot {
    width: 60px;
    height: 60px;
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
    cursor: pointer;
    transition: transform 0.2s ease;
}

.card-weapon-slot:hover {
    transform: scale(1.1);
}

.card-weapon-img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.card-footer {
    flex-shrink: 0;
    text-align: right;
    width: 100%;
    padding-right: 5px;
    margin-top: 13px;
    /* Adjusted from 5px + 8px transform */
    margin-bottom: 0;
    transform: translateY(5px);
    /* Lower text slightly */
}

.card-footer div {
    font-family: 'Impact', sans-serif;
    color: #ffdd00;
    /* More yellow */
    font-size: 1.4rem;
    text-transform: uppercase;
    text-shadow: 2px 2px 0 #000;
    display: inline-block;
    border-bottom: 2px solid #ffdd00;
    /* More yellow */
    line-height: 1;
    padding-bottom: 1px;
    white-space: nowrap;
    /* Prevent wrapping */
}

/* Loading animations reset animations */
@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(30px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes borderGlow {

    0%,
    100% {
        background-position: 0% 50%;
    }

    50% {
        background-position: 100% 50%;
    }
}

/* Responsive Design */
@media (max-width: 1024px) {
    .randomizer-container {
        grid-template-columns: minmax(0, 1fr);
        gap: 20px;
    }

    .loadout-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 12px;
    }

    .logo {
        max-width: 400px;
    }

    .creator-layout {
        flex-direction: column;
        align-items: center;
    }

    .card-preview {
        min-width: unset;
        width: 100%;
        overflow-x: auto;
    }
}

@media (max-width: 640px) {
    body {
        padding: 10px 0;
    }

    .title-section {
        margin-bottom: 10px;
    }

    .container {
        padding: 0 10px;
        width: 95%;
    }

    .loadout-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 8px;
        margin-bottom: 10px;
    }

    .weapon-slot {
        padding: 6px;
        border-radius: 6px;
    }

    .weapon-name {
        font-size: 0.55rem;
        margin-top: 4px;
    }

    .logo {
        max-width: 180px;
    }

    .generate-btn {
        padding: 10px 25px;
        font-size: 0.65rem;
    }

    /* Mobile tweaks for card */
    .player-card {
        transform: scale(0.6);
        transform-origin: top center;
        margin-bottom: -150px;
        /* Compensate for scaling */
    }
}

@media (min-width: 1920px) {
    body {
        justify-content: flex-start;
        padding-top: 40px;
    }
}

/* ============================================================
   BETYA-STYLE BUTTON (grey base, yellow hover, clipped polygon)
   Replaces old .tab-btn/.generate-btn/.secondary-btn
   ============================================================ */
.nav-btn {
    position: relative;
    padding: 12px 24px;
    font-size: 0.8rem;
    font-weight: 700;
    border: none;
    background: #1a0a2e;
    color: #1a0a2e;
    border-radius: 0;
    clip-path: polygon(8px 0%, calc(100% - 8px) 0%, 100% 8px, 100% calc(100% - 8px), calc(100% - 8px) 100%, 8px 100%, 0% calc(100% - 8px), 0% 8px);
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: 'Orbitron', sans-serif;
    letter-spacing: 2px;
    min-height: 40px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    z-index: 1;
    text-transform: uppercase;
}

.nav-btn::before {
    content: '';
    position: absolute;
    inset: 2px;
    background: #dcdde1;
    clip-path: polygon(6px 0%, calc(100% - 6px) 0%, 100% 6px, 100% calc(100% - 6px), calc(100% - 6px) 100%, 6px 100%, 0% calc(100% - 6px), 0% 6px);
    z-index: -1;
    transition: all 0.2s ease;
}

.nav-btn:hover { transform: scale(1.04); filter: drop-shadow(0 0 8px rgba(255, 180, 41, 0.5)); }
.nav-btn:hover::before { background: #ffb429; }
.nav-btn:active { transform: scale(0.98); }
a.nav-btn { text-decoration: none; color: #1a0a2e; }

.nav-btn.active::before { background: #ffb429; }
.nav-btn.active { filter: drop-shadow(0 0 8px rgba(255, 180, 41, 0.5)); }

.nav-btn.small { padding: 7px 14px; font-size: 0.65rem; min-height: 28px; letter-spacing: 1px; }
.nav-btn.danger::before { background: #e8c4c4; }
.nav-btn.danger:hover::before { background: #ff6b6b; }

/* Override existing tabs/controls layout to fit new buttons */
.tabs {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px;
    background: transparent;
    border: none;
    padding: 0;
}

.loadout-wrap { display: flex; align-items: flex-start; gap: 10px; }
.loadout-wrap .loadout-grid { flex: 1; min-width: 0; margin-bottom: 0; }
.attach-btn {
    width: 32px;
    height: 32px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    color: #00f0ff;
    border: 1px solid rgba(0, 240, 255, 0.5);
    border-radius: 50%;
    cursor: pointer;
    transition: color 0.2s ease, background 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
    padding: 0;
}
@media (hover: hover) {
    .attach-btn:hover {
        color: #00f0ff;
        background: rgba(0, 240, 255, 0.12);
        border-color: rgba(0, 240, 255, 0.7);
        box-shadow: 0 0 8px rgba(0, 240, 255, 0.25);
    }
}
.attach-btn:active { filter: brightness(0.9); }
.attach-btn-icon {
    width: 16px;
    height: 16px;
    display: block;
    transform-origin: 50% 50%;
}
.attach-btn.spinning .attach-btn-icon { animation: attach-spin 0.6s ease-in-out; }
@keyframes attach-spin { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }

.controls { gap: 8px; flex-wrap: wrap; justify-content: center; margin-top: 18px; }
.controls .nav-btn + .nav-btn { margin-left: 0; }
.controls .nav-btn { padding: 8px 16px; font-size: 0.7rem; min-height: 32px; letter-spacing: 1.5px; }

/* ============================================================
   RANDOMIZER: SIDE-BY-SIDE LAYOUT WITH TOOL LIBRARY SIDEBAR
   ============================================================ */
.randomizer-container {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 60px;
    max-width: 1600px;
    width: 96%;
    align-items: start;
    justify-content: space-between;
}

.randomizer-main { min-width: 0; width: 100%; }

.tool-sidebar {
    background: rgba(0, 0, 0, 0.55);
    border: 1px solid rgba(0, 240, 255, 0.25);
    border-radius: 10px;
    padding: 10px;
}

.sidebar-header {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    font-family: 'Orbitron', sans-serif;
    color: #ffb429;
    font-size: 0.85rem;
    font-weight: 700;
    letter-spacing: 2px;
    padding: 4px 6px 10px;
    border-bottom: 1px solid rgba(255, 180, 41, 0.3);
    margin-bottom: 8px;
}
.sidebar-header small { color: #aaa; font-size: 0.65rem; letter-spacing: 0.5px; }

.tool-list {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 8px;
}

.tool-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1px;
    background: rgba(30, 20, 60, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 6px;
    padding: 6px 3px;
    cursor: grab;
    transition: all 0.15s ease;
    user-select: none;
}
.tool-item:hover { border-color: #ffb429; background: rgba(255, 180, 41, 0.15); }
.tool-item.dragging { opacity: 0.4; }
.tool-item.in-use { opacity: 0.35; filter: grayscale(0.6); }
.tool-item.in-use:hover { border-color: rgba(255, 180, 41, 0.4); }
.tool-item.armed { border-color: #ffb429; background: rgba(255, 180, 41, 0.25); box-shadow: 0 0 12px rgba(255, 180, 41, 0.5); }
.weapon-slot.tap-target { border-color: #ffb429 !important; box-shadow: 0 0 16px rgba(255, 180, 41, 0.45) !important; }
.tool-item img { width: 56px; height: 56px; object-fit: contain; pointer-events: none; }
.tool-item-name { font-size: 0.55rem; text-align: center; color: #ccc; text-transform: uppercase; letter-spacing: 0.4px; pointer-events: none; margin-top: 4px; line-height: 1.1; }

.weapon-slot.drag-over {
    border-color: #ffb429 !important;
    box-shadow: 0 0 20px rgba(255, 180, 41, 0.5) !important;
    transform: scale(1.02);
}

/* ============================================================
   SHARE NOTICE + MY LOADOUTS
   ============================================================ */
.share-notice {
    margin-bottom: 15px;
    padding: 12px 16px;
    background: rgba(26, 10, 46, 0.9);
    border: 1px solid rgba(255, 180, 41, 0.3);
    border-left: 4px solid #ffb429;
    border-radius: 4px;
    color: #fff;
    font-size: 0.85rem;
    word-break: break-all;
    user-select: text;
    -webkit-user-select: text;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
    font-family: 'Orbitron', sans-serif;
    letter-spacing: 0.5px;
}
.share-notice strong {
    color: #ffb429;
    text-shadow: 0 0 8px rgba(255, 180, 41, 0.3);
}
.share-notice.error { 
    background: rgba(60, 20, 20, 0.9); 
    border-color: rgba(255, 77, 94, 0.4); 
    border-left-color: #ff4d5e;
    color: #ffbaba; 
}
.share-notice a { color: #00f0ff; text-decoration: underline; font-weight: 700; }

.my-loadouts-panel { margin-top: 20px; }
.my-loadouts-panel h3 {
    color: #ffb429;
    font-family: 'Orbitron', sans-serif;
    font-size: 1rem;
    letter-spacing: 2px;
    margin-bottom: 10px;
}
.my-loadouts-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 10px;
}
.loadout-card {
    background: rgba(0, 0, 0, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    padding: 10px;
}
.loadout-card-name { font-weight: 700; color: #00f0ff; margin-bottom: 8px; font-size: 0.9rem; }
.loadout-card-weapons { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 10px; }
.loadout-card-weapons img { width: 32px; height: 32px; object-fit: contain; }
.loadout-card-actions { display: flex; gap: 6px; flex-wrap: wrap; }

.muted { color: #888; font-style: italic; }

/* ============================================================
   LEADERBOARD TAB
   ============================================================ */
.leaderboard-container {
    max-width: 900px;
    width: 95%;
    background: rgba(0, 0, 0, 0.55);
    border: 1px solid rgba(0, 240, 255, 0.25);
    border-radius: 10px;
    padding: 20px;
}
.lb-header h2 {
    color: #ffb429;
    font-family: 'Orbitron', sans-serif;
    letter-spacing: 3px;
    font-size: 1.2rem;
    margin-bottom: 8px;
}
.lb-meta {
    display: flex; gap: 20px; flex-wrap: wrap;
    color: #aaa; font-size: 0.8rem; margin-bottom: 14px;
}
.lb-meta strong { color: #00f0ff; }
.lb-tabs { display: flex; gap: 8px; margin-bottom: 12px; flex-wrap: wrap; align-items: flex-end; }
.lb-disclaimer {
    color: #c0c0d0;
    font-size: 0.85rem;
    font-style: italic;
    margin: 0 0 10px 0;
    opacity: 0.85;
}
.lb-search {
    width: 100%; max-width: 300px; margin-bottom: 12px;
    background: #1a1a2e; border: 1px solid rgba(255,255,255,0.2);
    color: #fff; padding: 8px 12px; border-radius: 4px;
    font-family: inherit;
}
.lb-mount { overflow-x: auto; }
.lb-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
    width: 100%;
}
.lb-row {
    display: flex;
    align-items: center;
    background: rgba(15, 5, 25, 0.4);
    padding: 6px 12px;
    transition: background 0.2s;
}
.lb-row:hover {
    background: rgba(138, 43, 226, 0.15);
}
.lb-pos-box {
    background: #8e24aa;
    color: #1a0a2e;
    font-weight: 900;
    width: 28px;
    height: 28px;
    flex: 0 0 28px;
    box-sizing: border-box;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 15px;
    margin-left: 5px;
    font-family: 'Orbitron', sans-serif;
    font-size: 0.9rem;
    box-shadow: 0 0 0 5px rgba(142, 36, 170, 0.3);
}
.lb-name {
    color: #fff;
    font-weight: 600;
    font-family: 'Orbitron', sans-serif;
    flex: 1 1 auto;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 1.1rem;
    letter-spacing: 1px;
}
.lb-name-winner {
    color: #ffd700;
    text-shadow: 0 0 8px rgba(255, 215, 0, 0.5);
}
.lb-score-box {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
    flex: 0 0 auto;
}
.lb-rank-icon {
    height: 24px;
    width: 36px;
    object-fit: contain;
}
.lb-pts {
    color: #ffb429;
    font-weight: 700;
    font-family: 'Orbitron', sans-serif;
    font-size: 1.2rem;
    width: 90px;
    display: inline-block;
    text-align: right;
    white-space: nowrap;
}
.lb-loading { color: #888; padding: 30px; text-align: center; }
.lb-error { color: #ff6b7a; padding: 20px; }
.lb-thanks {
    margin-top: 25px;
    font-size: 0.65rem;
    color: rgba(255, 255, 255, 0.4);
    text-align: center;
    font-family: 'Orbitron', sans-serif;
    letter-spacing: 1px;
}
.lb-blastats {
    margin: 0;
    padding-bottom: 4px;
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.7);
    font-family: 'Orbitron', sans-serif;
    letter-spacing: 1px;
}
.lb-blastats a {
    color: #ffb429;
    text-decoration: none;
    font-weight: 700;
}
.lb-blastats a:hover { text-decoration: underline; }

@media (max-width: 480px) {
    .lb-row { padding: 6px 8px; }
    .lb-pos-box { margin-right: 10px; margin-left: 0; box-shadow: 0 0 0 3px rgba(142, 36, 170, 0.3); }
    .lb-name { font-size: 0.95rem; letter-spacing: 0.5px; }
    .lb-score-box { gap: 6px; }
    .lb-rank-icon { width: 28px; height: 20px; }
    .lb-pts { font-size: 1rem; width: 70px; }
}

/* ============================================================
   BLASTON BATTLES TAB
   ============================================================ */
.battles-container {
    max-width: 700px;
    width: 95%;
    margin: 40px auto;
    text-align: center;
    background: rgba(0, 0, 0, 0.55);
    border: 1px solid rgba(255, 180, 41, 0.3);
    border-radius: 10px;
    padding: 40px 30px;
}
#battles-tab.active { display: block; padding: 0; }
.battles-embed-wrap {
    width: 95%;
    max-width: 1100px;
    margin: 20px auto 40px;
    box-sizing: border-box;
}
.battles-frame {
    display: block;
    width: 100%;
    height: 78vh;
    min-height: 560px;
    border: 1px solid rgba(255, 180, 41, 0.3);
    border-radius: 10px;
    background: #000;
}
.battles-frame-meta {
    text-align: right;
    font-size: 0.8rem;
    color: #ffb429;
    font-family: 'JetBrains Mono', monospace;
    margin-top: 8px;
}
.battles-frame-meta a { color: #ffb429; text-decoration: none; }
.battles-frame-meta a:hover { text-decoration: underline; }
.battles-container h2 {
    color: #ffb429;
    font-family: 'Orbitron', sans-serif;
    font-size: 2rem;
    letter-spacing: 4px;
    margin-bottom: 10px;
}
.battles-tagline { color: #ffb429; font-family: 'Orbitron', sans-serif; font-size: 1.4rem; letter-spacing: 3px; margin-bottom: 14px; }
.publish-btn { display: inline-flex; align-items: center; gap: 8px; }
.publish-btn .discord-icon { width: 18px; height: 18px; flex: 0 0 auto; color: #5865F2; }
.battles-subtext { color: #ccc; font-size: 0.95rem; line-height: 1.6; }
.battles-features {
    list-style: none;
    text-align: left;
    max-width: 520px;
    margin: 0 auto 28px;
    color: #ddd;
    font-size: 0.9rem;
}
.battles-features li { padding: 8px 0; border-bottom: 1px solid rgba(255,255,255,0.08); }
.battles-features li:last-child { border: none; }
.battles-features strong { color: #00f0ff; }
.battles-cta { font-size: 0.95rem !important; padding: 16px 32px !important; text-decoration: none; }

@media (max-width: 900px) {
    .randomizer-container { grid-template-columns: 1fr; }
    .tool-sidebar { position: static; }
    .tool-list { grid-template-columns: repeat(4, 1fr); }
}

/* ============================================================
   MODAL STYLES
   ============================================================ */
.modal-overlay {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    backdrop-filter: blur(5px);
}

.modal-content {
    background: #1a0a2e;
    border: 2px solid #ffb429;
    border-radius: 8px;
    padding: 25px;
    width: 90%;
    max-width: 400px;
    box-shadow: 0 0 30px rgba(255, 180, 41, 0.4);
    text-align: center;
    animation: popIn 0.3s ease-out;
}

.modal-content h3 {
    color: #00f0ff;
    font-family: 'Orbitron', sans-serif;
    margin-bottom: 10px;
    letter-spacing: 2px;
}

.modal-content p {
    color: #ccc;
    font-size: 0.9rem;
    margin-bottom: 20px;
}

.modal-content input {
    width: 100%;
    background: rgba(0, 0, 0, 0.5);
    border: 1px solid #00f0ff;
    color: #fff;
    padding: 12px;
    border-radius: 4px;
    font-family: inherit;
    font-size: 1rem;
    margin-bottom: 25px;
    text-align: center;
}

.modal-content input:focus {
    outline: none;
    border-color: #ffb429;
    box-shadow: 0 0 10px rgba(255, 180, 41, 0.3);
}

.modal-actions {
    display: flex;
    gap: 15px;
    justify-content: center;
}
