/* ===== Base Reset & Typography ===== */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --bg-primary: #0a0e1a;
    --bg-secondary: #111827;
    --bg-panel: rgba(17, 24, 39, 0.7);
    --border: rgba(99, 130, 255, 0.15);
    --text-primary: #e2e8f0;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    --accent: #6366f1;
    --accent-glow: rgba(99, 102, 241, 0.3);
    --green: #22c55e;
    --red: #ef4444;
    --blue: #3b82f6;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    overflow: hidden;
    height: 100vh;
    width: 100vw;
}

/* ===== App Layout ===== */
.app {
    display: flex;
    flex-direction: column;
    height: 100vh;
    padding: 16px;
    gap: 16px;
}

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

.header h1 {
    font-size: 16px;
    font-weight: 600;
    letter-spacing: -0.02em;
}

.header-stats {
    display: flex;
    gap: 24px;
}

.stat {
    font-size: 13px;
    color: var(--text-secondary);
}

.stat strong {
    color: var(--text-primary);
    font-weight: 500;
}

.main-layout {
    flex: 1;
    display: grid;
    grid-template-columns: 320px 1fr 300px;
    gap: 16px;
    min-height: 0;
}

/* ===== Panels ===== */
.panel {
    background: var(--bg-panel);
    border: 1px solid var(--border);
    border-radius: 12px;
    backdrop-filter: blur(16px);
    padding: 20px;
    overflow: hidden;
}

.panel h2 {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 16px;
}

/* ===== Drawing Canvas ===== */
.drawing-panel {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.canvas-wrapper {
    background: #000;
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid var(--border);
    cursor: crosshair;
    width: 280px;
    height: 280px;
}

#draw-canvas {
    display: block;
    image-rendering: pixelated;
}

.canvas-controls {
    display: flex;
    gap: 8px;
    margin-top: 12px;
    width: 100%;
}

.btn {
    flex: 1;
    padding: 8px 16px;
    border: 1px solid var(--border);
    background: var(--bg-secondary);
    color: var(--text-primary);
    border-radius: 8px;
    cursor: pointer;
    font-family: inherit;
    font-size: 13px;
    font-weight: 500;
    transition: all 0.15s ease;
}

.btn:hover {
    background: var(--accent);
    border-color: var(--accent);
}

/* ===== 3D Network Panel ===== */
.network-panel {
    padding: 0;
    position: relative;
}

#network-3d {
    width: 100%;
    height: 100%;
}

#network-3d canvas {
    border-radius: 12px;
}

/* ===== Info Panel ===== */
.info-panel {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.predictions {
    flex: 1;
}

/* Probability Bars */
.prob-row {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 6px;
}

.prob-label {
    font-size: 14px;
    font-weight: 600;
    width: 16px;
    text-align: center;
    color: var(--text-secondary);
    font-variant-numeric: tabular-nums;
}

.prob-bar-track {
    flex: 1;
    height: 22px;
    background: rgba(255, 255, 255, 0.04);
    border-radius: 4px;
    overflow: hidden;
    position: relative;
}

.prob-bar-fill {
    height: 100%;
    border-radius: 4px;
    background: var(--accent);
    transition: width 0.3s ease, background 0.3s ease;
    width: 0%;
}

.prob-value {
    font-size: 12px;
    font-weight: 500;
    color: var(--text-muted);
    width: 42px;
    text-align: right;
    font-variant-numeric: tabular-nums;
}

.prob-row.top-prediction .prob-label {
    color: var(--green);
}

.prob-row.top-prediction .prob-bar-fill {
    background: var(--green);
    box-shadow: 0 0 12px rgba(34, 197, 94, 0.4);
}

.prob-row.top-prediction .prob-value {
    color: var(--green);
    font-weight: 600;
}

/* ===== Network Info ===== */
.network-info {
    border-top: 1px solid var(--border);
    padding-top: 16px;
}

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

.layer-name {
    color: var(--text-secondary);
    font-weight: 500;
}

.layer-dims {
    color: var(--text-muted);
    font-variant-numeric: tabular-nums;
}

.layer-activation {
    font-size: 11px;
    padding: 2px 6px;
    border-radius: 4px;
    background: rgba(99, 102, 241, 0.15);
    color: var(--accent);
    font-weight: 500;
}
