/* Reset and Base Tokens */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    background-color: #0b0f19;
    color: #e2e8f0;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    height: 100vh;
    padding: 8px 14px;
    display: flex;
    justify-content: center;
    overflow-x: hidden;
}

.app-container {
    width: 100%;
    max-width: 1560px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    height: 100%;
}

/* 1. Header Bar (Slim & Clean) */
.header-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: linear-gradient(135deg, #111827 0%, #1e293b 100%);
    border: 1px solid #334155;
    border-radius: 8px;
    padding: 8px 16px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.4);
    flex-shrink: 0;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 14px;
}

.logo-badge {
    display: flex;
    align-items: center;
    gap: 8px;
}

.pulse-dot {
    width: 8px;
    height: 8px;
    background-color: #00e676;
    border-radius: 50%;
    box-shadow: 0 0 8px #00e676;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(0, 230, 118, 0.7); }
    70% { transform: scale(1.1); box-shadow: 0 0 0 6px rgba(0, 230, 118, 0); }
    100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(0, 230, 118, 0); }
}

.logo-text {
    font-size: 17px;
    font-weight: 800;
    color: #f8fafc;
    letter-spacing: -0.3px;
    font-family: 'JetBrains Mono', monospace;
}

.header-desc {
    font-size: 12.5px;
    color: #94a3b8;
    font-weight: 500;
}

.header-right {
    display: flex;
    gap: 8px;
    align-items: center;
}

.action-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 12.5px;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.15s ease;
    cursor: pointer;
    border: 1px solid transparent;
}

.btn-bundle {
    background: linear-gradient(135deg, #059669 0%, #10b981 100%);
    color: #ffffff;
    box-shadow: 0 2px 8px rgba(16, 185, 129, 0.25);
}

.btn-bundle:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.4);
}

.btn-github {
    background: #1e293b;
    color: #f1f5f9;
    border-color: #475569;
}

.btn-github:hover {
    background: #334155;
    border-color: #64748b;
}

.btn-hub {
    background: #4338ca;
    color: #ffffff;
}

.btn-hub:hover {
    background: #4f46e5;
}

/* 2. Main Cockpit Layout */
.main-layout {
    display: grid;
    grid-template-columns: 1fr 310px;
    gap: 8px;
    flex: 1;
    min-height: 0;
}

@media (max-width: 1100px) {
    .main-layout {
        grid-template-columns: 1fr;
    }
}

.screen-section {
    background: #0d121f;
    border: 1px solid #1e293b;
    border-radius: 8px;
    padding: 6px;
    display: flex;
    justify-content: center;
    align-items: center;
    box-shadow: inset 0 2px 8px rgba(0,0,0,0.5);
    overflow: hidden;
}

.canvas-wrapper {
    width: 100%;
    height: 100%;
    max-height: calc(100vh - 165px);
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
    background: #0b0f19;
    border-radius: 6px;
    overflow: hidden;
}

#simCanvas {
    max-width: 100%;
    max-height: 100%;
    width: auto;
    height: auto;
    object-fit: contain;
    display: block;
    border-radius: 6px;
}

/* Control Panel */
.control-panel {
    display: flex;
    flex-direction: column;
    gap: 6px;
    overflow-y: auto;
}

.panel-card {
    background: #111827;
    border: 1px solid #1f293d;
    border-radius: 8px;
    padding: 10px 12px;
}

.card-title {
    font-size: 12px;
    font-weight: 700;
    color: #94a3b8;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 6px;
}

.btn-grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px;
}

.btn-grid-3 {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 4px;
}

button {
    font-family: inherit;
    border: none;
    outline: none;
    cursor: pointer;
    font-weight: 700;
    border-radius: 5px;
    transition: all 0.12s ease;
    padding: 7px 10px;
    font-size: 12px;
}

/* Modal Styles */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(4px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
}

.modal-content {
    background: #0f172a;
    border: 1px solid #334155;
    border-radius: 12px;
    width: 90%;
    max-width: 960px;
    max-height: 88vh;
    overflow-y: auto;
    box-shadow: 0 10px 40px rgba(0,0,0,0.8);
    display: flex;
    flex-direction: column;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    border-bottom: 1px solid #1e293b;
    background: #111827;
}

.modal-header h2 {
    font-size: 18px;
    color: #f8fafc;
    font-weight: 700;
}

.modal-close-btn {
    background: transparent;
    border: none;
    color: #94a3b8;
    font-size: 24px;
    cursor: pointer;
    line-height: 1;
}

.modal-close-btn:hover {
    color: #f8fafc;
}

.modal-body {
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.arch-box {
    background: #1e293b;
    border: 1px solid #334155;
    border-radius: 8px;
    padding: 14px 18px;
}

.arch-tag {
    font-size: 14px;
    font-weight: 700;
    color: #38bdf8;
    margin-bottom: 10px;
}

.arch-pre {
    font-family: 'JetBrains Mono', monospace;
    font-size: 12.5px;
    color: #a7f3d0;
    background: #0b0f19;
    padding: 12px;
    border-radius: 6px;
    border: 1px solid #1e293b;
    white-space: pre-wrap;
}

.arch-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12.5px;
    color: #e2e8f0;
}

.arch-table th {
    background: #0b0f19;
    padding: 8px 10px;
    text-align: left;
    border-bottom: 2px solid #334155;
    color: #94a3b8;
}

.arch-table td {
    padding: 8px 10px;
    border-bottom: 1px solid #334155;
}

.arch-table code {
    background: #0b0f19;
    padding: 2px 5px;
    border-radius: 4px;
    color: #38bdf8;
    font-family: 'JetBrains Mono', monospace;
}

.btn-primary {
    background: #00e676;
    color: #0b1510;
}
.btn-primary:hover {
    background: #20ff8e;
}

.btn-secondary {
    background: #1e293b;
    color: #cbd5e1;
    border: 1px solid #334155;
}
.btn-secondary:hover {
    background: #334155;
    color: #ffffff;
}

.btn-accent {
    background: #0284c7;
    color: #ffffff;
}
.btn-accent:hover {
    background: #0ea5e9;
}

.btn-cam {
    background: #1e293b;
    color: #94a3b8;
    border: 1px solid #334155;
    padding: 6px 4px;
    font-size: 11.5px;
}
.btn-cam.active {
    background: #f59e0b;
    color: #111827;
    border-color: #f59e0b;
}

.stage-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 3px;
}

.stage-btn {
    background: #161f30;
    color: #94a3b8;
    border: 1px solid #24324a;
    padding: 5px 8px;
    font-size: 11.5px;
    text-align: left;
    font-family: 'JetBrains Mono', monospace;
    font-weight: 600;
}
.stage-btn:hover {
    background: #202d44;
    color: #00f2fe;
    border-color: #00f2fe;
}
.stage-btn.active {
    background: #132b38;
    color: #00f2fe;
    border-color: #00f2fe;
}

.metrics-summary .spec-row {
    display: flex;
    justify-content: space-between;
    padding: 4px 0;
    border-bottom: 1px solid #1e293b;
    font-size: 11.5px;
    color: #94a3b8;
}

.metrics-summary .spec-row:last-child {
    border-bottom: none;
}

.highlight-green {
    color: #00e676;
    font-weight: 700;
}
.highlight-cyan {
    color: #00f2fe;
    font-weight: 700;
}

/* 3. Bottom Bento Grid (Slim Bar) */
.bottom-specs {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 6px;
    flex-shrink: 0;
}

@media (max-width: 768px) {
    .bottom-specs {
        grid-template-columns: repeat(2, 1fr);
    }
}

.spec-card {
    background: #111827;
    border: 1px solid #1f293d;
    border-radius: 6px;
    padding: 6px 10px;
    text-align: center;
}

.spec-card .val {
    font-size: 18px;
    font-weight: 800;
    color: #38bdf8;
    font-family: 'JetBrains Mono', monospace;
    line-height: 1.2;
}

.spec-card .lbl {
    font-size: 11px;
    color: #94a3b8;
    margin-top: 1px;
}
