/* ================================
   BIOCODEPY CHRONICLES
   CHARACTER SELECT CSS
   OPTIMIZED VERSION
================================ */

:root {
    --primary-color: #00d4ff;
    --secondary-color: #7c3aed;
    --accent-color: #00ff88;
    --danger-color: #ff4757;
    --bg-dark: #0a0f1a;

    --panel-bg:
        linear-gradient(
            135deg,
            rgba(30, 41, 59, 0.8) 0%,
            rgba(51, 65, 85, 0.8) 100%
        );
}

/* ================================
   GLOBAL
================================ */

* {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    margin: 0;
    padding: 0;

    font-family:
        'Orbitron',
        'Share Tech Mono',
        monospace;

    background: var(--bg-dark);
    color: white;

    min-height: 100vh;

    display: flex;
    align-items: center;
    justify-content: center;

    overflow-x: hidden;

    opacity: 1;
    transition: opacity 0.3s ease;

    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

/* Smooth transition between pages */
body.fade-out {
    opacity: 0;
}

/* ================================
   MATRIX BACKGROUND
================================ */

#matrix-bg {
    position: fixed;
    inset: 0;

    width: 100%;
    height: 100%;

    z-index: -1;

    opacity: 0.15;

    pointer-events: none;

    transform: translateZ(0);
    will-change: transform;
}

/* ================================
   CUTSCENE LAYER
================================ */

#cutscene-layer {
    position: fixed;
    inset: 0;

    width: 100%;
    height: 100%;

    background: #000;

    z-index: 9999;

    display: none;

    align-items: center;
    justify-content: center;
    flex-direction: column;

    backdrop-filter: blur(4px);

    transform: translateZ(0);
}

#cutscene-img {
    max-width: 90%;
    max-height: 80vh;

    object-fit: contain;

    border: 2px solid #333;

    box-shadow:
        0 0 50px rgba(0, 255, 136, 0.2);

    transform: translateZ(0);

    will-change: transform, opacity;

    animation: fadeInCutscene 0.4s ease;
}

@keyframes fadeInCutscene {
    from {
        opacity: 0;
        transform: scale(0.98);
    }

    to {
        opacity: 1;
        transform: scale(1);
    }
}

.cutscene-prompt {
    margin-top: 20px;

    font-family: 'Share Tech Mono', monospace;

    color: #00ff88;

    animation: blink 1s infinite;

    cursor: pointer;

    letter-spacing: 2px;

    user-select: none;
}

/* ================================
   MAIN CONTAINER
================================ */

.container {
    width: 100%;
    max-width: 1000px;

    padding: 20px;

    max-height: 100vh;

    overflow-y: auto;
}

.container::-webkit-scrollbar {
    width: 8px;
}

.container::-webkit-scrollbar-thumb {
    background: var(--primary-color);
    border-radius: 4px;
}

/* ================================
   CREATION PANEL
================================ */

.creation-panel {
    background: var(--panel-bg);

    border: 2px solid var(--primary-color);

    border-radius: 20px;

    padding: 40px;

    backdrop-filter: blur(10px);

    box-shadow:
        0 0 40px rgba(0, 212, 255, 0.2);

    opacity: 0;

    transition:
        opacity 1s ease-in,
        transform 0.3s ease;

    transform: translateY(10px);
}

.creation-panel.visible {
    opacity: 1;
    transform: translateY(0);
}

/* ================================
   TYPOGRAPHY
================================ */

h1 {
    text-align: center;

    color: var(--primary-color);

    font-size: 2.5rem;

    margin-bottom: 30px;

    text-shadow:
        0 0 15px rgba(0, 212, 255, 0.5);
}

label {
    display: block;

    color: var(--primary-color);

    margin-bottom: 10px;

    font-size: 1.1rem;
}

/* ================================
   FORM GRID
================================ */

.form-grid {
    display: grid;

    grid-template-columns: 1fr 1fr;

    gap: 40px;
}

.form-group {
    margin-bottom: 25px;
}

/* ================================
   INPUTS
================================ */

input[type="text"],
select {
    width: 100%;

    padding: 12px;

    background:
        rgba(0, 0, 0, 0.5);

    border:
        1px solid var(--primary-color);

    color: white;

    font-family:
        'Share Tech Mono',
        monospace;

    font-size: 1rem;

    border-radius: 5px;

    transition:
        border 0.3s ease,
        box-shadow 0.3s ease;
}

input[type="text"]:focus {
    outline: none;

    box-shadow:
        0 0 10px var(--primary-color);
}

/* ================================
   GENDER BUTTONS
================================ */

.gender-selector {
    display: flex;
    gap: 10px;
}

.gender-btn {
    flex: 1;

    padding: 10px;

    border:
        1px solid var(--primary-color);

    background:
        rgba(0, 0, 0, 0.3);

    color: #aaa;

    cursor: pointer;

    font-family: 'Orbitron';

    font-weight: bold;

    transition: all 0.3s ease;
}

.gender-btn:hover {
    background:
        rgba(0, 212, 255, 0.1);

    color: #fff;
}

.gender-btn.active {
    background: var(--primary-color);

    color: #000;

    border-color: #fff;

    box-shadow:
        0 0 15px rgba(0, 212, 255, 0.4);
}

/* ================================
   SLIDERS
================================ */

.skill-slider-container {
    margin-bottom: 20px;
}

.skill-header {
    display: flex;

    justify-content: space-between;

    margin-bottom: 8px;

    font-family: 'Share Tech Mono';
}

input[type="range"] {
    width: 100%;

    accent-color: var(--primary-color);

    cursor: pointer;
}

/* ================================
   TRAITS
================================ */

.trait-options {
    display: grid;

    grid-template-columns: 1fr 1fr;

    gap: 15px;

    max-height: 300px;

    overflow-y: auto;

    padding-right: 5px;
}

.trait-options::-webkit-scrollbar {
    width: 5px;
}

.trait-options::-webkit-scrollbar-thumb {
    background: var(--primary-color);
    border-radius: 5px;
}

.trait-card {
    background:
        rgba(0, 0, 0, 0.3);

    border:
        1px solid #444;

    padding: 15px;

    border-radius: 10px;

    cursor: pointer;

    transition: all 0.2s ease;
}

.trait-card:hover {
    border-color: var(--primary-color);

    transform: translateY(-2px);
}

.trait-card.selected-strength {
    border-color: var(--accent-color);

    background:
        rgba(0, 255, 136, 0.1);

    box-shadow:
        0 0 10px rgba(0, 255, 136, 0.2);
}

.trait-card.selected-weakness {
    border-color: var(--danger-color);

    background:
        rgba(255, 71, 87, 0.1);

    box-shadow:
        0 0 10px rgba(255, 71, 87, 0.2);
}

.trait-name {
    font-weight: bold;

    margin-bottom: 5px;

    color: var(--primary-color);
}

.trait-card.selected-strength .trait-name {
    color: var(--accent-color);
}

.trait-card.selected-weakness .trait-name {
    color: var(--danger-color);
}

.trait-desc {
    font-size: 0.8rem;

    color: #ccc;

    font-family:
        'Share Tech Mono',
        monospace;
}

/* ================================
   TRAIT MODES
================================ */

.trait-mode-toggle {
    display: flex;

    margin-bottom: 15px;

    background:
        rgba(0, 0, 0, 0.3);

    border-radius: 5px;

    overflow: hidden;
}

.mode-btn {
    flex: 1;

    padding: 10px;

    border: none;

    cursor: pointer;

    font-family: 'Orbitron';

    font-size: 0.9rem;

    transition: 0.3s;
}

.mode-btn.strength {
    background:
        rgba(0, 255, 136, 0.1);

    color: #aaa;
}

.mode-btn.strength.active {
    background: var(--accent-color);

    color: #000;

    font-weight: bold;
}

.mode-btn.weakness {
    background:
        rgba(255, 71, 87, 0.1);

    color: #aaa;
}

.mode-btn.weakness.active {
    background: var(--danger-color);

    color: white;

    font-weight: bold;
}

/* ================================
   AVATAR PREVIEW
================================ */

.avatar-preview {
    text-align: center;

    display: flex;

    flex-direction: column;

    align-items: center;

    justify-content: center;

    position: sticky;

    top: 20px;
}

.avatar-icon {
    font-size: 8rem;

    width: 150px;
    height: 150px;

    background:
        linear-gradient(
            45deg,
            var(--primary-color),
            var(--secondary-color)
        );

    border-radius: 50%;

    display: flex;

    align-items: center;
    justify-content: center;

    border:
        4px solid rgba(0, 212, 255, 0.5);

    box-shadow:
        0 0 30px rgba(0, 212, 255, 0.3);

    margin-bottom: 20px;

    transition:
        transform 0.3s ease,
        box-shadow 0.3s ease;
}

.avatar-icon:hover {
    transform: scale(1.05);

    box-shadow:
        0 0 40px rgba(0, 212, 255, 0.5);
}

/* ================================
   BUTTONS
================================ */

.btn {
    width: 100%;

    padding: 15px;

    border: none;

    border-radius: 10px;

    font-family: 'Orbitron';

    font-weight: 900;

    font-size: 1.2rem;

    cursor: pointer;

    text-transform: uppercase;

    letter-spacing: 2px;

    transition: all 0.3s ease;
}

.btn-primary {
    background:
        linear-gradient(
            45deg,
            var(--primary-color),
            var(--secondary-color)
        );

    color: white;

    margin-top: 30px;
}

.btn-primary:hover {
    transform: translateY(-2px);

    box-shadow:
        0 0 30px rgba(0, 212, 255, 0.5);
}

.btn-primary:disabled {
    opacity: 0.5;

    cursor: not-allowed;

    transform: none;

    box-shadow: none;
}

/* ================================
   ANIMATIONS
================================ */

@keyframes blink {
    50% {
        opacity: 0;
    }
}

/* =========================================
   MOBILE OPTIMIZATION
========================================= */

@media screen and (max-width: 768px) {

    body {
        align-items: flex-start;
        justify-content: flex-start;
        overflow-x: hidden;
    }

    .container {
        width: 100%;
        max-width: 100%;
        padding: 12px;
        overflow-x: hidden;
    }

    .creation-panel {
        padding: 20px;
        border-radius: 14px;
    }

    h1 {
        font-size: 1.4rem;
        line-height: 1.4;
        margin-bottom: 20px;
        text-align: center;
    }

    .form-grid {
        grid-template-columns: 1fr;
        gap: 25px;
    }

    .avatar-preview {
        order: -1;
        position: static;
        margin-bottom: 20px;
    }

    .avatar-icon {
        width: 110px;
        height: 110px;
        font-size: 5rem;
        margin-bottom: 15px;
    }

    label {
        font-size: 0.95rem;
    }

    input[type="text"],
    select {
        font-size: 16px;
        padding: 14px;
    }

    .gender-selector {
        flex-direction: column;
    }

    .gender-btn {
        width: 100%;
        padding: 14px;
        font-size: 0.9rem;
    }

    .trait-options {
        grid-template-columns: 1fr;
        max-height: unset;
        overflow-y: visible;
    }

    .trait-card {
        padding: 14px;
    }

    .trait-name {
        font-size: 0.95rem;
    }

    .trait-desc {
        font-size: 0.75rem;
        line-height: 1.4;
    }

    .mode-btn {
        font-size: 0.75rem;
        padding: 12px;
    }

    .skill-header {
        font-size: 0.8rem;
    }

    .btn {
        padding: 16px;
        font-size: 1rem;
        letter-spacing: 1px;
    }

    #preview-stats {
        font-size: 0.8rem !important;
    }

    #cutscene-img {
        max-width: 96%;
        max-height: 70vh;
    }

    .cutscene-prompt {
        font-size: 0.8rem;
        text-align: center;
        padding: 10px;
    }

    #matrix-bg {
        opacity: 0.08;
    }
}

/* =========================================
   SMALL PHONES
========================================= */

@media screen and (max-width: 480px) {

    h1 {
        font-size: 1.1rem;
    }

    .creation-panel {
        padding: 15px;
    }

    .avatar-icon {
        width: 90px;
        height: 90px;
        font-size: 4rem;
    }

    .btn {
        font-size: 0.9rem;
        padding: 14px;
    }

    .trait-desc {
        font-size: 0.7rem;
    }

    .cutscene-prompt {
        font-size: 0.7rem;
    }
}