:root {
    --bg-main: #0a0e17;
    --bg-sidebar: #0f172a;
    --bg-panel: #161b22;
    --bg-card: #1c2433;
    --bg-input: #0d1117;

    --primary: #3b82f6;
    --primary-hover: #2563eb;
    --accent: #06b6d4;

    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --text-dim: #64748b;

    --border: rgba(255, 255, 255, 0.08);
    --border-hover: rgba(255, 255, 255, 0.15);

    --font-sans: 'Inter', system-ui, sans-serif;
    --font-mono: 'JetBrains Mono', monospace;
}

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

body {
    font-family: var(--font-sans);
    background-color: var(--bg-main);
    color: var(--text-main);
    height: 100vh;
    overflow: hidden;
}

.app-container {
    display: flex;
    height: 100vh;
    width: 100vw;
}

/* Sidebar */
.sidebar {
    width: 360px;
    background-color: var(--bg-sidebar);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    z-index: 10;
}

.brand {
    padding: 1.5rem;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 0.75rem;
    background-color: var(--bg-panel);
}

.logo-icon {
    width: 36px;
    height: 36px;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    color: white;
}

.logo-text h1 {
    font-size: 1.1rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    line-height: 1.2;
}

.logo-text span {
    font-size: 0.75rem;
    color: var(--text-dim);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.scroll-content {
    flex: 1;
    overflow-y: auto;
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

/* Panels */
.panel {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.panel-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--text-main);
    margin-bottom: 0.25rem;
}

.panel-header i {
    color: var(--primary);
    font-size: 1.1rem;
}

.panel-header h2 {
    font-size: 0.85rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
}

/* Inputs */
.input-group {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

label {
    font-size: 0.75rem;
    color: var(--text-dim);
    font-weight: 500;
}

input[type="number"],
select {
    background-color: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 0.6rem;
    color: var(--text-main);
    font-family: var(--font-mono);
    font-size: 0.85rem;
    outline: none;
    transition: all 0.2s;
    width: 100%;
}

input[type="number"]:focus,
select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.2);
}

.grid-3 {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.75rem;
}

.divider {
    height: 1px;
    background-color: var(--border);
    width: 100%;
}

.checkbox-wrapper {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
}

/* Results Card */
.results-card {
    background-color: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 1.25rem;
    position: relative;
    overflow: hidden;
}

.results-header {
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--text-dim);
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.main-stats {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
    margin-bottom: 1.5rem;
}

.stat-item {
    display: flex;
    flex-direction: column;
}

.stat-item .label {
    font-size: 0.7rem;
    color: var(--text-dim);
    margin-bottom: 0.25rem;
}

.stat-item .value {
    font-size: 1.75rem;
    font-weight: 700;
    line-height: 1;
    letter-spacing: -0.03em;
}

.stat-item .value.highlight {
    color: var(--primary);
}

.details-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    font-size: 0.85rem;
    color: var(--text-muted);
}

.detail-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.detail-row.sm {
    font-size: 0.75rem;
    color: var(--text-dim);
}

.mono {
    font-family: var(--font-mono);
    color: var(--text-main);
}

.line {
    height: 1px;
    background-color: rgba(255, 255, 255, 0.05);
    margin: 0.25rem 0;
}

.footer {
    padding: 1rem;
    text-align: center;
    font-size: 0.7rem;
    color: var(--text-dim);
    border-top: 1px solid var(--border);
    background-color: var(--bg-main);
}

/* Viewport */
.viewport {
    flex: 1;
    background-color: #0b1016;
    /* Slightly lighter than pure black for depth */
    background-image:
        radial-gradient(circle at 50% 50%, #161b22 0%, transparent 100%);
    position: relative;
    overflow: hidden;
}

.overlay-controls {
    position: absolute;
    top: 1.5rem;
    right: 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    z-index: 100;
}

.btn-icon {
    background: rgba(22, 27, 34, 0.8);
    backdrop-filter: blur(8px);
    border: 1px solid var(--border);
    color: var(--text-muted);
    width: 36px;
    height: 36px;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.btn-icon:hover {
    background: var(--bg-card);
    color: var(--text-main);
    border-color: var(--primary);
}

.sep {
    width: 1px;
    height: 24px;
    background-color: var(--border);
    margin: 0 0.5rem;
}

.btn-primary {
    background-color: var(--primary);
    color: white;
    border: none;
    padding: 0 1rem;
    height: 36px;
    border-radius: 8px;
    font-weight: 600;
    font-size: 0.85rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: background-color 0.2s;
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

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

.loading-overlay {
    position: absolute;
    inset: 0;
    background-color: var(--bg-main);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 200;
    color: var(--text-dim);
    font-size: 0.85rem;
    gap: 1rem;
    transition: opacity 0.5s;
}

.spinner {
    width: 24px;
    height: 24px;
    border: 2px solid var(--border);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

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

/* Voxel Info Panel */
.voxel-info {
    position: absolute;
    bottom: 2rem;
    left: 2rem;
    background-color: rgba(22, 27, 34, 0.9);
    backdrop-filter: blur(12px);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 0;
    min-width: 280px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
    z-index: 150;
    transform-origin: bottom left;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.voxel-info.hidden {
    opacity: 0;
    transform: translateY(20px) scale(0.95);
    pointer-events: none;
}

.info-header {
    padding: 1rem;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-main);
    background-color: rgba(255, 255, 255, 0.03);
    border-top-left-radius: 12px;
    border-top-right-radius: 12px;
}

.info-header i {
    color: var(--primary);
    margin-right: 0.5rem;
}

.close-info {
    background: none;
    border: none;
    color: var(--text-dim);
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    display: flex;
}

.close-info:hover {
    background-color: rgba(255, 255, 255, 0.1);
    color: var(--text-main);
}

.info-content {
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.info-row {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.info-row .label {
    font-size: 0.7rem;
    color: var(--text-dim);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: 600;
}

.value-group {
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
    font-family: var(--font-mono);
    font-size: 0.9rem;
}

.equation {
    color: var(--accent);
    font-size: 0.8rem;
    opacity: 0.9;
}

.exact {
    color: var(--text-main);
    font-weight: 500;
}

/* Axis Labels */
.axis-label {
    position: absolute;
    background-color: rgba(15, 23, 42, 0.8);
    backdrop-filter: blur(4px);
    border: 1px solid var(--border);
    padding: 2px 6px;
    border-radius: 4px;
    font-family: var(--font-mono);
    font-size: 0.75rem;
    color: var(--text-main);
    pointer-events: none;
    transform: translate(-50%, -50%);
    white-space: nowrap;
    z-index: 90;
    transition: opacity 0.2s;
}

.axis-label.hidden {
    opacity: 0;
}