/* CSS Design System - SYS_05 // TOKEN_FACTORY */

:root {
    --bg-color: #030712;
    --panel-bg: rgba(10, 15, 30, 0.75);
    --border-color: rgba(0, 240, 255, 0.15);
    --border-hover: rgba(0, 240, 255, 0.4);
    --text-primary: #f3f4f6;
    --text-secondary: #9ca3af;
    
    /* Neon Colors */
    --cyan: #00f0ff;
    --cyan-glow: rgba(0, 240, 255, 0.4);
    --magenta: #ff007f;
    --magenta-glow: rgba(255, 0, 127, 0.4);
    --yellow: #ffcc00;
    --yellow-glow: rgba(255, 204, 0, 0.4);
    --green: #00ff66;
    --green-glow: rgba(0, 255, 102, 0.4);
    --red: #ff3366;
    --red-glow: rgba(255, 51, 102, 0.4);
    
    /* Font definitions */
    --font-sans: 'Outfit', sans-serif;
    --font-mono: 'Fira Code', monospace;
}

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

body {
    background-color: var(--bg-color);
    color: var(--text-primary);
    font-family: var(--font-sans);
    overflow: hidden;
    height: 100vh;
    width: 100vw;
    position: relative;
}

/* CRT SCANLINE GRID FILTERS */
.crt-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle, rgba(0,0,0,0) 60%, rgba(0,0,0,0.4) 100%);
    pointer-events: none;
    z-index: 99;
}

.scanlines {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(
        rgba(18, 16, 16, 0) 50%, 
        rgba(0, 0, 0, 0.2) 50%
    );
    background-size: 100% 4px;
    pointer-events: none;
    z-index: 99;
}

/* PORTAL SYSTEM CONTAINER HEADER */
.dashboard-wrapper {
    display: flex;
    flex-direction: column;
    height: 100vh;
    width: 100vw;
    padding: 16px;
    box-sizing: border-box;
}

.portal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border: 1px solid var(--border-color);
    background: var(--panel-bg);
    padding: 10px 20px;
    border-radius: 12px;
    margin-bottom: 12px;
    backdrop-filter: blur(10px);
}

.back-link {
    text-decoration: none;
    color: var(--text-secondary);
    font-family: var(--font-mono);
    font-size: 0.8rem;
    font-weight: bold;
    letter-spacing: 1px;
    transition: color 0.2s;
    cursor: pointer;
}

.back-link:hover {
    color: var(--cyan);
}

.system-code {
    font-family: var(--font-mono);
    color: var(--text-secondary);
    font-size: 0.8rem;
    margin-left: 15px;
    border-left: 1px solid rgba(255,255,255,0.1);
    padding-left: 15px;
}

.glow-text {
    font-size: 1.5rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 2px;
    background: linear-gradient(135deg, #ffffff 40%, var(--cyan) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    text-shadow: 0 0 15px var(--cyan-glow);
}

.btn-sound-toggle {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    color: var(--text-secondary);
    font-family: var(--font-mono);
    font-size: 0.72rem;
    padding: 6px 12px;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-sound-toggle:hover {
    color: #ffffff;
    border-color: var(--border-hover);
}

/* MAIN LAYOUT */
.main-content {
    display: flex;
    flex: 1;
    gap: 12px;
    height: calc(100vh - 90px);
    overflow: hidden;
}

/* SIDE PANELS */
.panel {
    background: var(--panel-bg);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    height: 100%;
    backdrop-filter: blur(10px);
    overflow: hidden;
}

.left-panel {
    width: 320px;
    flex-shrink: 0;
}

.right-panel {
    width: 340px;
    flex-shrink: 0;
}

.panel-header {
    background: rgba(255, 255, 255, 0.02);
    border-bottom: 1px solid var(--border-color);
    font-family: var(--font-mono);
    font-size: 0.8rem;
    letter-spacing: 2px;
    padding: 12px 16px;
    font-weight: bold;
}

/* TELEMETRY CARDS */
.telemetry-grid {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 14px;
    border-bottom: 1px solid var(--border-color);
}

.telemetry-card {
    background: rgba(255, 255, 255, 0.015);
    border: 1px solid rgba(255, 255, 255, 0.04);
    border-radius: 8px;
    padding: 10px 14px;
    text-align: left;
}

.telemetry-label {
    font-size: 0.65rem;
    font-family: var(--font-mono);
    color: var(--text-secondary);
    letter-spacing: 1px;
    margin-bottom: 2px;
}

.telemetry-value {
    font-size: 1.4rem;
    font-weight: 800;
    font-family: var(--font-mono);
}

.telemetry-value .unit {
    font-size: 0.75rem;
    color: var(--text-secondary);
    font-weight: normal;
}

.telemetry-sub {
    font-size: 0.65rem;
    color: var(--text-secondary);
    font-family: var(--font-mono);
    margin-top: 2px;
}

/* TEXT COLOR UTILITIES */
.text-cyan { color: var(--cyan); text-shadow: 0 0 8px var(--cyan-glow); }
.text-magenta { color: var(--magenta); text-shadow: 0 0 8px var(--magenta-glow); }
.text-yellow { color: var(--yellow); text-shadow: 0 0 8px var(--yellow-glow); }
.text-green { color: var(--green); text-shadow: 0 0 8px var(--green-glow); }
.text-red { color: var(--red); text-shadow: 0 0 8px var(--red-glow); }
.font-bold { font-weight: bold; }

/* VRAM PROGRESS GRAPH */
.panel-section {
    padding: 14px;
    border-bottom: 1px solid var(--border-color);
}

.section-title {
    font-size: 0.72rem;
    font-family: var(--font-mono);
    color: var(--text-secondary);
    letter-spacing: 1.5px;
    margin-bottom: 10px;
    text-transform: uppercase;
}

.vram-progress-wrapper {
    background: rgba(255, 255, 255, 0.01);
    border: 1px solid rgba(255, 255, 255, 0.03);
    border-radius: 8px;
    padding: 12px;
}

.vram-bar-container {
    height: 10px;
    background: rgba(0, 0, 0, 0.4);
    border-radius: 5px;
    overflow: hidden;
    margin-bottom: 8px;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.vram-bar {
    width: 0%;
    height: 100%;
    background: linear-gradient(90deg, var(--cyan), var(--magenta));
    box-shadow: 0 0 8px var(--cyan-glow);
    transition: width 0.3s ease;
}

.vram-text-row {
    display: flex;
    justify-content: space-between;
    font-family: var(--font-mono);
    font-size: 0.7rem;
}

/* LEVEL DETAILS PANEL SECTION */
.level-details-box {
    border-bottom: none;
    flex-grow: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}

.level-desc {
    font-size: 0.76rem;
    color: var(--text-secondary);
    line-height: 1.5;
    margin-bottom: auto;
    padding-bottom: 14px;
}

.target-parameters {
    background: rgba(0,0,0,0.3);
    border: 1px solid rgba(255, 255, 255, 0.03);
    border-radius: 6px;
    padding: 10px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.param-row {
    display: flex;
    justify-content: space-between;
    font-size: 0.72rem;
    font-family: var(--font-mono);
}

/* VIEWPORT PANEL CENTER */
.viewport-panel {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: var(--panel-bg);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    overflow: hidden;
}

.viewport-header {
    background: rgba(255,255,255,0.02);
    border-bottom: 1px solid var(--border-color);
    padding: 12px 18px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.viewport-title {
    font-family: var(--font-mono);
    font-size: 0.8rem;
    letter-spacing: 2px;
    font-weight: bold;
}

.simulation-state {
    font-family: var(--font-mono);
    font-size: 0.72rem;
    background: rgba(0, 240, 255, 0.1);
    color: var(--cyan);
    padding: 2px 8px;
    border-radius: 4px;
    border: 1px solid rgba(0, 240, 255, 0.2);
}

.canvas-container {
    flex: 1;
    position: relative;
    background: rgba(2, 4, 8, 0.95);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

#grid-canvas {
    display: block;
    cursor: crosshair;
}

/* VIEWPORT CONTROLS BAR */
.simulation-controls {
    border-top: 1px solid var(--border-color);
    background: rgba(255,255,255,0.015);
    padding: 12px 18px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
}

.btn-action {
    font-family: var(--font-sans);
    font-weight: 800;
    font-size: 0.9rem;
    letter-spacing: 1px;
    padding: 10px 24px;
    border-radius: 6px;
    cursor: pointer;
    border: none;
    transition: all 0.2s ease;
    text-transform: uppercase;
}

.btn-simulate {
    background: var(--cyan);
    color: #030712;
    box-shadow: 0 0 15px var(--cyan-glow);
}
.btn-simulate:hover {
    background: #ffffff;
    box-shadow: 0 0 20px #ffffff;
}

.btn-stop {
    background: var(--red);
    color: #ffffff;
    box-shadow: 0 0 15px var(--red-glow);
}
.btn-stop:hover {
    background: #ff557f;
    box-shadow: 0 0 20px var(--red-glow);
}

.btn-speed {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    padding: 6px 12px;
    font-family: var(--font-mono);
    font-size: 0.75rem;
    cursor: pointer;
    border-radius: 4px;
    transition: all 0.15s;
}

.btn-speed:hover {
    color: #ffffff;
    border-color: var(--border-hover);
}

.btn-speed.active {
    background: var(--cyan);
    color: #030712;
    border-color: var(--cyan);
    box-shadow: 0 0 10px var(--cyan-glow);
}

.speed-controls {
    display: flex;
    gap: 6px;
}

.hidden {
    display: none !important;
}

/* COMPONENTS TOOLBOX PANEL */
.components-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
    padding: 14px;
    border-bottom: 1px solid var(--border-color);
    overflow-y: auto;
    max-height: 280px;
}

.toolbox-card {
    background: rgba(255,255,255,0.015);
    border: 1px solid rgba(255,255,255,0.05);
    border-radius: 8px;
    padding: 10px;
    cursor: pointer;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    transition: all 0.2s ease-in-out;
}

.toolbox-card:hover {
    background: rgba(0, 240, 255, 0.03);
    border-color: var(--cyan);
}

.toolbox-card.active {
    background: rgba(0, 240, 255, 0.08);
    border-color: var(--cyan);
    box-shadow: 0 0 12px var(--cyan-glow);
}

.toolbox-card.locked {
    opacity: 0.3;
    pointer-events: none;
}

.tool-icon {
    width: 28px;
    height: 28px;
}

.tool-name {
    font-size: 0.65rem;
    font-family: var(--font-mono);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: bold;
}

/* COMPONENT DESC DETAILS PANEL */
.component-description-panel {
    padding: 14px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    overflow-y: auto;
    flex-grow: 1;
}

.desc-title {
    font-weight: 800;
    font-size: 1rem;
    color: #ffffff;
    letter-spacing: 0.5px;
}

.badge {
    font-size: 0.6rem;
    font-family: var(--font-mono);
    background: rgba(255,255,255,0.08);
    padding: 2px 6px;
    border-radius: 4px;
    text-transform: uppercase;
    color: var(--text-secondary);
}

.badge-cyan { background: rgba(0, 240, 255, 0.15); color: var(--cyan); }
.badge-yellow { background: rgba(255, 204, 0, 0.15); color: var(--yellow); }
.badge-magenta { background: rgba(255, 0, 127, 0.15); color: var(--magenta); }

.desc-text {
    font-size: 0.72rem;
    color: var(--text-secondary);
    line-height: 1.4;
}

.desc-stats-grid {
    background: rgba(0,0,0,0.3);
    border: 1px solid rgba(255,255,255,0.02);
    border-radius: 6px;
    padding: 10px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.stat-row {
    display: flex;
    justify-content: space-between;
    font-size: 0.7rem;
    font-family: var(--font-mono);
    color: var(--text-secondary);
}

.stat-row span:last-child {
    color: #ffffff;
    font-weight: bold;
}

/* OVERLAY PANEL SCREEN GLASSMORPHISM */
.overlay-panel {
    position: absolute;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(2, 4, 10, 0.85);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 90;
    backdrop-filter: blur(8px);
    transition: opacity 0.3s ease;
    padding: 20px;
}

.overlay-panel.hidden {
    opacity: 0;
    pointer-events: none;
}

.overlay-content {
    background: var(--panel-bg);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 24px 30px;
    text-align: center;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    box-sizing: border-box;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.8), 0 0 35px var(--cyan-glow);
}

.max-w-md { max-width: 480px; }
.max-w-lg { max-width: 820px; }
.border-red { border-color: var(--red); box-shadow: 0 20px 50px rgba(0,0,0,0.8), 0 0 35px var(--red-glow); }
.border-green { border-color: var(--green); box-shadow: 0 20px 50px rgba(0,0,0,0.8), 0 0 35px var(--green-glow); }

.glow-red { text-shadow: 0 0 15px var(--red-glow); }
.glow-green { text-shadow: 0 0 15px var(--green-glow); }

/* LEVEL CARDS LAYOUT */
.level-cards-container {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
    margin-top: 25px;
}

.level-card {
    background: rgba(255, 255, 255, 0.015);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 10px;
    padding: 18px;
    cursor: pointer;
    text-align: left;
    transition: all 0.25s;
    display: flex;
    flex-direction: column;
    gap: 8px;
    box-sizing: border-box;
}

.level-card:hover {
    transform: translateY(-4px);
    background: rgba(0, 240, 255, 0.03);
    border-color: var(--cyan);
}

.level-card.locked {
    opacity: 0.5;
    pointer-events: auto;
    cursor: pointer;
    border-style: dashed;
}

.level-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.level-number {
    font-size: 0.65rem;
    font-family: var(--font-mono);
    color: var(--text-secondary);
}

.level-card h3 {
    font-size: 1.05rem;
    font-weight: 800;
    color: #ffffff;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-top: 4px;
}

.level-card p {
    font-size: 0.72rem;
    color: var(--text-secondary);
    line-height: 1.45;
}

.level-requirements {
    font-family: var(--font-mono);
    font-size: 0.62rem;
    color: var(--text-secondary);
    background: rgba(0,0,0,0.3);
    padding: 4px 8px;
    border-radius: 4px;
    margin-top: auto;
}

/* OUT OF MEMORY MODAL STYLE */
.crash-dump-box {
    background: #010206;
    border: 1px dashed rgba(255, 51, 102, 0.3);
    border-radius: 8px;
    padding: 12px;
    text-align: left;
    margin: 18px 0;
}

.crash-code {
    font-family: var(--font-mono);
    font-size: 0.68rem;
    color: var(--red);
    line-height: 1.4;
    white-space: pre-wrap;
}

.crash-hint {
    font-size: 0.76rem;
    color: var(--text-secondary);
    line-height: 1.5;
    margin-bottom: 20px;
}

.btn-danger {
    background: var(--red);
    color: #ffffff;
    width: 100%;
    box-shadow: 0 0 15px var(--red-glow);
}
.btn-danger:hover {
    background: #ff557f;
    box-shadow: 0 0 20px var(--red-glow);
}

/* VICTORY OVERLAY SCREEN BOX */
.victory-stats-box {
    background: rgba(0,0,0,0.3);
    border: 1px solid rgba(0, 255, 102, 0.1);
    border-radius: 8px;
    padding: 16px;
    margin: 20px 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.vic-stat-row {
    display: flex;
    justify-content: space-between;
    font-family: var(--font-mono);
    font-size: 0.76rem;
}

.victory-buttons {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 15px;
}

.btn-success {
    background: var(--green);
    color: #030712;
    width: 100%;
    box-shadow: 0 0 15px var(--green-glow);
}
.btn-success:hover {
    background: #ffffff;
    box-shadow: 0 0 20px #ffffff;
}

.btn-secondary {
    background: rgba(255,255,255,0.06);
    color: #ffffff;
    width: 100%;
    border: 1px solid rgba(255,255,255,0.1);
}
.btn-secondary:hover {
    background: rgba(255,255,255,0.12);
}

/* CUSTOM SCROLLBARS FOR TERMINAL FEEL */
::-webkit-scrollbar {
    width: 6px;
}
::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.1);
}
::-webkit-scrollbar-thumb {
    background: rgba(0, 240, 255, 0.1);
    border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover {
    background: var(--cyan);
}

/* GUIDE / DOCUMENTATION STYLES */
.guide-tabs {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin: 15px 0;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 12px;
}

.tab-btn {
    background: rgba(255,255,255,0.03);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    font-family: var(--font-sans);
    font-weight: 700;
    font-size: 0.72rem;
    padding: 8px 14px;
    cursor: pointer;
    border-radius: 6px;
    transition: all 0.2s;
}

.tab-btn:hover {
    border-color: var(--border-hover);
    color: #ffffff;
}

.tab-btn.active {
    background: var(--cyan);
    color: #030712;
    border-color: var(--cyan);
    box-shadow: 0 0 10px var(--cyan-glow);
}

.tab-content {
    display: none;
}

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

.guide-body {
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid rgba(255,255,255,0.03);
    border-radius: 8px;
    padding: 18px;
    text-align: left;
    max-height: 40vh;
    overflow-y: auto;
}

.guide-list {
    margin-left: 20px;
    margin-top: 8px;
    margin-bottom: 12px;
    font-size: 0.76rem;
    color: var(--text-secondary);
    line-height: 1.5;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.guide-list strong {
    color: #ffffff;
}

