/* ============ RESET & BASE ============ */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary: #00e5ff;
    --primary-dark: #0091ea;
    --secondary: #76ff03;
    --accent: #ff6d00;
    --danger: #ff1744;
    --bg-dark: #0a0a1a;
    --bg-panel: rgba(10, 15, 40, 0.92);
    --bg-card: rgba(20, 30, 60, 0.8);
    --text: #e0e8ff;
    --text-dim: #7888aa;
    --glow-primary: 0 0 20px rgba(0, 229, 255, 0.4);
    --glow-secondary: 0 0 20px rgba(118, 255, 3, 0.4);
    --border: rgba(0, 229, 255, 0.2);
    --font-title: 'Orbitron', sans-serif;
    --font-body: 'Exo 2', sans-serif;
}

html, body {
    width: 100%;
    height: 100%;
    overflow: hidden;
    background: var(--bg-dark);
    color: var(--text);
    font-family: var(--font-body);
}

/* ============ CANVASES ============ */
#bgCanvas, #particleCanvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
}

#particleCanvas {
    z-index: 1;
    pointer-events: none;
}

/* ============ SCREENS ============ */
.screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 10;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.6s ease, transform 0.6s ease;
    transform: scale(0.96);
}

.screen.active {
    opacity: 1;
    pointer-events: all;
    transform: scale(1);
}

.screen-title {
    font-family: var(--font-title);
    font-size: 2.2rem;
    color: var(--primary);
    text-shadow: var(--glow-primary);
    margin-bottom: 30px;
    letter-spacing: 3px;
}

/* ============ LOGO ============ */
.logo-container {
    position: relative;
    text-align: center;
    margin-bottom: 50px;
}

.logo-glow {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 400px;
    height: 400px;
    background: radial-gradient(circle, rgba(0, 229, 255, 0.15) 0%, transparent 70%);
    border-radius: 50%;
    animation: logoPulse 4s ease-in-out infinite;
}

@keyframes logoPulse {
    0%, 100% { transform: translate(-50%, -50%) scale(1); opacity: 0.6; }
    50% { transform: translate(-50%, -50%) scale(1.2); opacity: 1; }
}

.logo-dna {
    position: absolute;
    top: 50%;
    width: 60px;
    height: 200px;
    transform: translateY(-50%);
    opacity: 0.3;
}

.logo-dna.left { left: -40px; }
.logo-dna.right { right: -40px; }

.game-title {
    font-family: var(--font-title);
    font-size: 5rem;
    letter-spacing: 8px;
    position: relative;
    z-index: 2;
    line-height: 1;
}

.title-evo {
    display: block;
    font-weight: 900;
    background: linear-gradient(135deg, #00e5ff, #76ff03);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    filter: drop-shadow(0 0 30px rgba(0, 229, 255, 0.5));
    animation: titleShimmer 3s ease-in-out infinite;
}

@keyframes titleShimmer {
    0%, 100% { filter: drop-shadow(0 0 30px rgba(0, 229, 255, 0.5)); }
    50% { filter: drop-shadow(0 0 50px rgba(118, 255, 3, 0.6)); }
}

.title-genesis {
    display: block;
    font-weight: 400;
    font-size: 2.8rem;
    color: var(--text);
    text-shadow: 0 0 20px rgba(224, 232, 255, 0.3);
    letter-spacing: 18px;
    margin-top: 5px;
}

.subtitle {
    font-family: var(--font-body);
    font-size: 1.1rem;
    color: var(--text-dim);
    letter-spacing: 6px;
    text-transform: uppercase;
    margin-top: 15px;
    opacity: 0.7;
}

/* ============ MENU BUTTONS ============ */
.menu-buttons {
    display: flex;
    flex-direction: column;
    gap: 12px;
    align-items: center;
}

.menu-btn {
    position: relative;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 40px;
    min-width: 280px;
    background: linear-gradient(135deg, rgba(20, 30, 60, 0.9), rgba(10, 20, 50, 0.95));
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text);
    font-family: var(--font-title);
    font-size: 0.95rem;
    letter-spacing: 2px;
    cursor: pointer;
    overflow: hidden;
    transition: all 0.3s ease;
}

.menu-btn:hover {
    border-color: var(--primary);
    box-shadow: var(--glow-primary), inset 0 0 30px rgba(0, 229, 255, 0.1);
    transform: translateX(5px);
    background: linear-gradient(135deg, rgba(0, 40, 80, 0.9), rgba(0, 30, 70, 0.95));
}

.menu-btn:active {
    transform: translateX(5px) scale(0.98);
}

.menu-btn.primary {
    border-color: var(--primary);
    background: linear-gradient(135deg, rgba(0, 60, 100, 0.9), rgba(0, 40, 80, 0.95));
    box-shadow: var(--glow-primary);
}

.menu-btn.primary:hover {
    box-shadow: 0 0 40px rgba(0, 229, 255, 0.6), inset 0 0 40px rgba(0, 229, 255, 0.15);
}

.menu-btn.small {
    min-width: 140px;
    padding: 10px 20px;
    font-size: 0.8rem;
}

.btn-icon {
    font-size: 1.2rem;
    min-width: 24px;
    text-align: center;
}

.btn-text {
    flex: 1;
}

.btn-shine {
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.08), transparent);
    transition: left 0.5s ease;
}

.menu-btn:hover .btn-shine {
    left: 100%;
}

.back-btn {
    margin-top: 30px;
}

/* ============ VERSION TAG ============ */
.version-tag {
    position: fixed;
    bottom: 15px;
    right: 20px;
    font-size: 0.75rem;
    color: var(--text-dim);
    opacity: 0.5;
    font-family: var(--font-body);
    letter-spacing: 1px;
}

/* ============ FLOATING CELLS ============ */
.floating-cell {
    position: fixed;
    border-radius: 50%;
    opacity: 0.15;
    pointer-events: none;
    z-index: 5;
}

.cell-1 {
    width: 80px;
    height: 80px;
    background: radial-gradient(circle at 30% 30%, var(--primary), transparent);
    top: 10%;
    left: 5%;
    animation: floatCell 12s ease-in-out infinite;
}

.cell-2 {
    width: 120px;
    height: 120px;
    background: radial-gradient(circle at 40% 40%, var(--secondary), transparent);
    top: 70%;
    right: 8%;
    animation: floatCell 15s ease-in-out infinite reverse;
}

.cell-3 {
    width: 50px;
    height: 50px;
    background: radial-gradient(circle at 30% 30%, var(--accent), transparent);
    top: 30%;
    right: 15%;
    animation: floatCell 10s ease-in-out infinite;
}

.cell-4 {
    width: 90px;
    height: 90px;
    background: radial-gradient(circle at 35% 35%, #e040fb, transparent);
    bottom: 15%;
    left: 12%;
    animation: floatCell 18s ease-in-out infinite reverse;
}

.cell-5 {
    width: 60px;
    height: 60px;
    background: radial-gradient(circle at 30% 30%, #ffab40, transparent);
    top: 55%;
    left: 25%;
    animation: floatCell 14s ease-in-out infinite;
}

@keyframes floatCell {
    0%, 100% { transform: translate(0, 0) rotate(0deg); }
    25% { transform: translate(30px, -20px) rotate(90deg); }
    50% { transform: translate(-10px, -40px) rotate(180deg); }
    75% { transform: translate(-30px, 10px) rotate(270deg); }
}

/* ============ STAGE SELECT ============ */
.stage-timeline {
    display: flex;
    align-items: center;
    gap: 20px;
    position: relative;
    padding: 20px 40px;
    overflow-x: auto;
    max-width: 95vw;
}

.timeline-line {
    position: absolute;
    top: 50%;
    left: 40px;
    right: 40px;
    height: 2px;
    background: linear-gradient(90deg, var(--primary), var(--secondary), var(--accent), #e040fb, #7c4dff);
    opacity: 0.3;
    z-index: 0;
}

.stage-card {
    position: relative;
    z-index: 1;
    background: var(--bg-panel);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 20px;
    text-align: center;
    min-width: 160px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.stage-card:hover {
    border-color: var(--primary);
    transform: translateY(-5px);
    box-shadow: var(--glow-primary);
}

.stage-card.locked {
    opacity: 0.5;
    cursor: not-allowed;
}

.stage-card.locked:hover {
    transform: none;
    border-color: var(--border);
    box-shadow: none;
}

.stage-card.unlocked {
    border-color: rgba(0, 229, 255, 0.4);
}

.stage-icon {
    width: 120px;
    height: 120px;
    margin: 0 auto 15px;
    border-radius: 50%;
    overflow: hidden;
    border: 2px solid var(--border);
    background: rgba(0, 10, 30, 0.5);
}

.stage-card h3 {
    font-family: var(--font-title);
    font-size: 0.9rem;
    color: var(--primary);
    letter-spacing: 2px;
    margin-bottom: 4px;
}

.stage-card p {
    font-size: 0.8rem;
    color: var(--text-dim);
}

.stage-status {
    display: inline-block;
    margin-top: 10px;
    font-size: 0.7rem;
    padding: 4px 12px;
    border-radius: 20px;
    background: rgba(0, 229, 255, 0.1);
    color: var(--primary);
    letter-spacing: 1px;
}

.stage-card.locked .stage-status {
    background: rgba(255, 23, 68, 0.1);
    color: var(--danger);
}

.stage-preview {
    width: 100%;
    height: 100%;
    border-radius: 50%;
}

/* ============ SETTINGS ============ */
.settings-panel {
    background: var(--bg-panel);
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 40px;
    width: 600px;
    max-width: 90vw;
    max-height: 80vh;
    overflow-y: auto;
    backdrop-filter: blur(20px);
}

.settings-tabs {
    display: flex;
    gap: 5px;
    margin-bottom: 25px;
    border-bottom: 1px solid var(--border);
    padding-bottom: 10px;
}

.tab-btn {
    padding: 8px 16px;
    background: transparent;
    border: 1px solid transparent;
    border-radius: 8px 8px 0 0;
    color: var(--text-dim);
    font-family: var(--font-body);
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.tab-btn:hover {
    color: var(--text);
    background: rgba(0, 229, 255, 0.05);
}

.tab-btn.active {
    color: var(--primary);
    border-color: var(--border);
    border-bottom-color: transparent;
    background: rgba(0, 229, 255, 0.08);
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
    animation: fadeIn 0.3s ease;
}

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

.setting-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.setting-row label:first-child {
    font-size: 0.9rem;
    color: var(--text);
    min-width: 160px;
}

.slider-container {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1;
    max-width: 250px;
}

input[type="range"] {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    height: 6px;
    border-radius: 3px;
    background: rgba(255, 255, 255, 0.1);
    outline: none;
}

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--primary);
    cursor: pointer;
    box-shadow: 0 0 10px rgba(0, 229, 255, 0.5);
    transition: box-shadow 0.2s;
}

input[type="range"]::-webkit-slider-thumb:hover {
    box-shadow: 0 0 20px rgba(0, 229, 255, 0.8);
}

.slider-value {
    font-size: 0.85rem;
    color: var(--primary);
    min-width: 40px;
    text-align: right;
    font-family: var(--font-title);
}

select {
    padding: 8px 16px;
    background: rgba(10, 15, 40, 0.9);
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text);
    font-family: var(--font-body);
    font-size: 0.85rem;
    cursor: pointer;
    outline: none;
}

select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 10px rgba(0, 229, 255, 0.2);
}

select option {
    background: #0a0a1a;
    color: var(--text);
}

/* Toggle Switch */
.toggle-switch {
    position: relative;
    display: inline-block;
    width: 50px;
    height: 26px;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 26px;
    transition: 0.3s;
}

.toggle-slider::before {
    content: '';
    position: absolute;
    height: 20px;
    width: 20px;
    left: 3px;
    bottom: 3px;
    background: var(--text-dim);
    border-radius: 50%;
    transition: 0.3s;
}

.toggle-switch input:checked + .toggle-slider {
    background: rgba(0, 229, 255, 0.3);
}

.toggle-switch input:checked + .toggle-slider::before {
    transform: translateX(24px);
    background: var(--primary);
    box-shadow: 0 0 10px rgba(0, 229, 255, 0.5);
}

.settings-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    margin-top: 25px;
    padding-top: 15px;
    border-top: 1px solid var(--border);
}

/* Controls Tab */
.controls-grid {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.control-row {
    display: flex;
    justify-content: space-between;
    padding: 10px 15px;
    background: rgba(255, 255, 255, 0.02);
    border-radius: 6px;
}

.control-row:nth-child(even) {
    background: rgba(255, 255, 255, 0.04);
}

.control-action {
    color: var(--text);
    font-size: 0.9rem;
}

.control-key {
    color: var(--primary);
    font-family: var(--font-title);
    font-size: 0.8rem;
    padding: 2px 10px;
    background: rgba(0, 229, 255, 0.08);
    border: 1px solid rgba(0, 229, 255, 0.2);
    border-radius: 4px;
}

/* ============ LOAD / SAVE ============ */
.loadsave-panel {
    background: var(--bg-panel);
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 40px;
    width: 650px;
    max-width: 90vw;
    max-height: 80vh;
    overflow-y: auto;
    backdrop-filter: blur(20px);
}

.loadsave-tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
}

.ls-tab-btn {
    flex: 1;
    padding: 12px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text-dim);
    font-family: var(--font-title);
    font-size: 0.85rem;
    cursor: pointer;
    letter-spacing: 1px;
    transition: all 0.2s;
}

.ls-tab-btn.active {
    color: var(--primary);
    border-color: var(--primary);
    background: rgba(0, 229, 255, 0.08);
}

.save-slots {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 15px;
}

.save-slot {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 15px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border);
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s;
}

.save-slot:hover {
    border-color: var(--primary);
    background: rgba(0, 229, 255, 0.05);
}

.save-slot.selected {
    border-color: var(--primary);
    box-shadow: inset 0 0 20px rgba(0, 229, 255, 0.1);
}

.save-slot.empty {
    opacity: 0.5;
    border-style: dashed;
}

.slot-number {
    font-family: var(--font-title);
    font-size: 1.5rem;
    color: var(--primary);
    min-width: 40px;
    text-align: center;
}

.slot-info {
    flex: 1;
}

.slot-name {
    font-weight: 600;
    font-size: 0.95rem;
    margin-bottom: 3px;
}

.slot-details {
    font-size: 0.75rem;
    color: var(--text-dim);
}

.slot-stage {
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 0.7rem;
    font-family: var(--font-title);
    background: rgba(0, 229, 255, 0.1);
    color: var(--primary);
    letter-spacing: 1px;
}

/* ============ TUTORIAL ============ */
.tutorial-panel {
    background: var(--bg-panel);
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 40px;
    width: 650px;
    max-width: 90vw;
    max-height: 85vh;
    overflow-y: auto;
    backdrop-filter: blur(20px);
    text-align: center;
}

.tutorial-nav {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 20px;
    margin-bottom: 25px;
}

.tut-nav-btn {
    padding: 8px 20px;
    background: rgba(0, 229, 255, 0.1);
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--primary);
    font-family: var(--font-title);
    font-size: 0.8rem;
    cursor: pointer;
    transition: all 0.2s;
    letter-spacing: 1px;
}

.tut-nav-btn:hover:not(:disabled) {
    background: rgba(0, 229, 255, 0.2);
    border-color: var(--primary);
}

.tut-nav-btn:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

.tut-page-num {
    font-family: var(--font-title);
    font-size: 0.85rem;
    color: var(--text-dim);
    letter-spacing: 2px;
}

.tutorial-page {
    display: none;
}

.tutorial-page.active {
    display: block;
    animation: fadeIn 0.4s ease;
}

.tut-illustration {
    margin-bottom: 20px;
    border-radius: 12px;
    overflow: hidden;
    border: 1px solid var(--border);
    background: rgba(0, 5, 20, 0.6);
}

.tut-illustration canvas {
    display: block;
    width: 100%;
    height: auto;
}

.tutorial-page h3 {
    font-family: var(--font-title);
    font-size: 1.2rem;
    color: var(--primary);
    margin-bottom: 12px;
    letter-spacing: 2px;
}

.tutorial-page p {
    font-size: 0.95rem;
    line-height: 1.7;
    color: var(--text);
    text-align: left;
    padding: 0 10px;
}

/* ============ CREDITS ============ */
.credits-scroll {
    text-align: center;
    padding: 40px;
    /* Animation is applied via JS on screen enter so it always starts fresh */
}

@keyframes scrollCredits {
    0% { transform: translateY(100vh); }
    100% { transform: translateY(-100%); }
}

#creditsScreen:hover .credits-scroll {
    animation-play-state: paused;
}

.credits-scroll h2 {
    font-family: var(--font-title);
    font-size: 3rem;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 5px;
}

.credits-scroll h3 {
    font-family: var(--font-body);
    font-weight: 300;
    color: var(--text-dim);
    letter-spacing: 4px;
    font-size: 1.1rem;
    margin-bottom: 40px;
}

.credits-divider {
    width: 100px;
    height: 1px;
    background: var(--border);
    margin: 30px auto;
}

.credit-section {
    font-family: var(--font-title);
    font-size: 0.8rem;
    color: var(--primary);
    letter-spacing: 3px;
    text-transform: uppercase;
    margin-bottom: 8px;
}

.credit-name {
    font-size: 1.1rem;
    color: var(--text);
    margin-bottom: 4px;
}

.credit-tiny {
    font-size: 0.85rem;
    color: var(--text-dim);
    margin-top: 40px;
}

/* ============ CELL STAGE ============ */
#cellStage {
    z-index: 10;
}

#cellGameCanvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: block;
    cursor: none;
}

/* HUD */
.cell-hud {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    pointer-events: none;
    z-index: 20;
}

.hud-left {
    position: absolute;
    top: 20px;
    left: 20px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.hud-bar {
    width: 220px;
    height: 14px;
    background: rgba(0, 0, 0, 0.6);
    border-radius: 7px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    overflow: hidden;
}

.hud-bar-fill {
    height: 100%;
    border-radius: 7px;
    transition: width 0.2s ease-out;
}

.hp-fill { background: linear-gradient(90deg, #c62828, #ff5252); box-shadow: inset 0 0 10px rgba(255, 82, 82, 0.5); }
.evo-fill { background: linear-gradient(90deg, #00838f, #00e5ff, #76ff03); box-shadow: inset 0 0 10px rgba(0, 229, 255, 0.5); }
.nrg-fill { background: linear-gradient(90deg, #e65100, #ffab40, #ffd740); box-shadow: inset 0 0 10px rgba(255, 215, 64, 0.5); }

.hud-label {
    font-family: var(--font-title);
    font-size: 0.65rem;
    color: var(--text-dim);
    letter-spacing: 2px;
    display: block;
    margin-bottom: 2px;
}

.hud-info-row {
    display: flex;
    gap: 15px;
    margin-top: 4px;
}

.hud-level {
    font-family: var(--font-title);
    font-size: 0.8rem;
    color: var(--primary);
    text-shadow: 0 0 8px rgba(0, 229, 255, 0.5);
    letter-spacing: 2px;
}

.hud-size {
    font-family: var(--font-title);
    font-size: 0.7rem;
    color: var(--text-dim);
    letter-spacing: 1px;
}

.hud-score {
    font-family: var(--font-body);
    font-size: 0.7rem;
    color: var(--text-dim);
    letter-spacing: 1px;
    margin-top: 2px;
}

/* Game Overlays (Pause, Death, Win, Evolution) */
.game-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 50;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.4s ease, background 0.4s ease;
}

.game-overlay.active {
    opacity: 1;
    pointer-events: all;
    background: rgba(0, 5, 15, 0.75);
    backdrop-filter: blur(6px);
}

.overlay-panel {
    background: var(--bg-panel);
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 40px 50px;
    text-align: center;
    min-width: 320px;
    max-width: 90vw;
    transform: scale(0.9);
    transition: transform 0.4s ease;
}

.game-overlay.active .overlay-panel {
    transform: scale(1);
}

.overlay-title {
    font-family: var(--font-title);
    font-size: 2.5rem;
    color: var(--primary);
    text-shadow: var(--glow-primary);
    letter-spacing: 6px;
    margin-bottom: 10px;
}

.overlay-buttons {
    display: flex;
    flex-direction: column;
    gap: 10px;
    align-items: center;
    margin-top: 25px;
}

.overlay-hint {
    font-size: 0.75rem;
    color: var(--text-dim);
    margin-top: 20px;
    letter-spacing: 1px;
}

/* Death */
.death-title {
    color: var(--danger) !important;
    text-shadow: 0 0 30px rgba(255, 23, 68, 0.6) !important;
}

.death-subtitle {
    color: var(--text-dim);
    font-style: italic;
    margin-bottom: 5px;
}

.death-panel {
    border-color: rgba(255, 23, 68, 0.3);
}

/* Win */
.win-title {
    background: linear-gradient(135deg, #ffd740, #76ff03, #00e5ff);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    filter: drop-shadow(0 0 20px rgba(118, 255, 3, 0.5));
}

.win-panel {
    border-color: rgba(118, 255, 3, 0.4);
}

.win-subtitle {
    color: var(--secondary);
    font-size: 1.1rem;
    margin-bottom: 15px;
}

.win-time, .win-stats {
    font-family: var(--font-title);
    font-size: 0.85rem;
    color: var(--text-dim);
    letter-spacing: 1px;
    margin-bottom: 5px;
}

.win-next {
    color: var(--primary);
    font-style: italic;
    font-size: 0.9rem;
    margin-top: 10px;
}

/* Evolution Popup */
.evo-panel {
    border-color: rgba(0, 229, 255, 0.5);
    min-width: 500px;
    box-shadow: 0 0 60px rgba(0, 229, 255, 0.15);
}

.evo-title {
    background: linear-gradient(135deg, #00e5ff, #76ff03);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    filter: drop-shadow(0 0 20px rgba(0, 229, 255, 0.6));
    animation: evoPulse 1.5s ease-in-out infinite;
}

@keyframes evoPulse {
    0%, 100% { filter: drop-shadow(0 0 20px rgba(0, 229, 255, 0.6)); }
    50% { filter: drop-shadow(0 0 40px rgba(118, 255, 3, 0.8)); }
}

.evo-subtitle {
    color: var(--text-dim);
    font-size: 1rem;
    margin-bottom: 20px;
    letter-spacing: 1px;
}

.evo-choices {
    display: flex;
    gap: 15px;
    justify-content: center;
    flex-wrap: wrap;
}

.evo-choice-btn {
    background: rgba(10, 20, 50, 0.9);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 20px;
    width: 150px;
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: center;
    color: var(--text);
}

.evo-choice-btn:hover {
    border-color: var(--primary);
    box-shadow: var(--glow-primary), inset 0 0 30px rgba(0, 229, 255, 0.08);
    transform: translateY(-5px);
}

.evo-choice-btn:active {
    transform: translateY(-5px) scale(0.97);
}

.evo-choice-icon {
    font-size: 2.5rem;
    font-family: var(--font-title);
    margin-bottom: 10px;
}

.evo-choice-name {
    font-family: var(--font-title);
    font-size: 0.85rem;
    letter-spacing: 1px;
    margin-bottom: 8px;
    color: var(--primary);
}

.evo-choice-desc {
    font-size: 0.75rem;
    color: var(--text-dim);
    line-height: 1.4;
}

/* ============ CREATURE EDITOR ============ */
.editor-screen {
    z-index: 60 !important;
    background: #060c1a;
}

.editor-screen #editorCanvas {
    position: absolute;
    top: 50px;
    left: 0;
    width: 100%;
    height: calc(100% - 50px);
    display: block;
    cursor: crosshair;
}

.editor-top-bar {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 50px;
    background: rgba(5, 10, 30, 0.95);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
    z-index: 70;
}

.editor-title-group {
    display: flex;
    align-items: baseline;
    gap: 15px;
}

.editor-title {
    font-family: var(--font-title);
    font-size: 1.2rem;
    color: var(--primary);
    text-shadow: var(--glow-primary);
    letter-spacing: 4px;
}

.editor-subtitle {
    font-size: 0.75rem;
    color: var(--text-dim);
    letter-spacing: 1px;
}

.editor-evo-display {
    display: flex;
    align-items: center;
    gap: 8px;
}

.editor-evo-label {
    font-family: var(--font-title);
    font-size: 0.7rem;
    color: var(--text-dim);
    letter-spacing: 2px;
}

.editor-evo-value {
    font-family: var(--font-title);
    font-size: 1.3rem;
    color: #ffd740;
    text-shadow: 0 0 12px rgba(255, 215, 64, 0.5);
    min-width: 40px;
    text-align: center;
}

.editor-done-btn {
    min-width: 120px !important;
    padding: 8px 24px !important;
}

@media (max-width: 768px) {
    .editor-subtitle { display: none; }
    .editor-top-bar { padding: 0 10px; }
}

/* ============ CREATURE STAGE 3D ============ */

.c3d-hud {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 20;
}

.c3d-hud-left {
    position: absolute;
    top: 15px;
    left: 15px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.c3d-hp-row {
    display: flex;
    align-items: center;
    gap: 8px;
}

.c3d-label {
    font-family: var(--font-title);
    font-size: 0.7rem;
    color: var(--text-dim);
    letter-spacing: 2px;
    min-width: 28px;
}

.c3d-bar {
    width: 200px;
    height: 14px;
    background: rgba(0, 0, 0, 0.6);
    border-radius: 7px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    overflow: hidden;
}

.c3d-bar-fill {
    height: 100%;
    border-radius: 7px;
    transition: width 0.2s ease-out;
}

.c3d-hp-fill {
    background: linear-gradient(90deg, #c62828, #ff5252);
    box-shadow: inset 0 0 10px rgba(255, 82, 82, 0.5);
}

.c3d-info-row {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.c3d-alignment, .c3d-party, .c3d-nests {
    font-family: var(--font-title);
    font-size: 0.7rem;
    letter-spacing: 1px;
    padding: 3px 10px;
    background: rgba(0, 0, 0, 0.5);
    border-radius: 4px;
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.c3d-alignment { color: #ffd740; }
.c3d-party { color: #00e5ff; }
.c3d-nests { color: #76ff03; }

.c3d-interact {
    position: absolute;
    bottom: 80px;
    left: 50%;
    transform: translateX(-50%);
    font-family: var(--font-title);
    font-size: 0.85rem;
    color: #fff;
    text-shadow: 0 0 10px rgba(0, 0, 0, 0.8);
    letter-spacing: 1px;
    background: rgba(0, 0, 0, 0.5);
    padding: 8px 20px;
    border-radius: 6px;
    border: 1px solid rgba(0, 229, 255, 0.3);
    pointer-events: none;
}

.c3d-crosshair {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 24px;
    color: rgba(255, 255, 255, 0.4);
    font-weight: 100;
    pointer-events: none;
    text-shadow: 0 0 4px rgba(0, 0, 0, 0.5);
}

.c3d-notifications {
    position: absolute;
    top: 25%;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    pointer-events: none;
}

.c3d-notif {
    font-family: var(--font-title);
    font-size: 0.9rem;
    color: #00e5ff;
    text-shadow: 0 0 15px rgba(0, 229, 255, 0.5), 0 2px 8px rgba(0, 0, 0, 0.8);
    letter-spacing: 1px;
    white-space: nowrap;
}

#creatureStage .game-overlay {
    z-index: 50;
}

/* ============ FPS COUNTER ============ */
#fpsCounter {
    position: fixed;
    top: 10px;
    left: 10px;
    font-family: var(--font-title);
    font-size: 0.7rem;
    color: var(--secondary);
    z-index: 100;
    letter-spacing: 1px;
}

#fpsCounter.hidden {
    display: none;
}

/* ============ AUDIO TOGGLE ============ */
.audio-toggle {
    position: fixed;
    bottom: 15px;
    left: 20px;
    width: 40px;
    height: 40px;
    background: rgba(10, 15, 40, 0.8);
    border: 1px solid var(--border);
    border-radius: 50%;
    color: var(--text);
    font-size: 1.2rem;
    cursor: pointer;
    z-index: 50;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.audio-toggle:hover {
    border-color: var(--primary);
    box-shadow: var(--glow-primary);
}

.hidden {
    display: none !important;
}

/* ============ SCROLLBAR ============ */
::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.02);
}

::-webkit-scrollbar-thumb {
    background: rgba(0, 229, 255, 0.2);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 229, 255, 0.4);
}

/* ============ RESPONSIVE ============ */
@media (max-width: 768px) {
    .game-title { font-size: 3rem; }
    .title-genesis { font-size: 1.8rem; letter-spacing: 10px; }
    .settings-panel, .loadsave-panel, .tutorial-panel { padding: 25px; width: 95vw; }
    .stage-timeline { flex-direction: column; }
    .timeline-line { display: none; }
    .menu-btn { min-width: 240px; padding: 12px 30px; }
}
