:root {
    --neon-cyan: #00f3ff;
    --neon-magenta: #ff00ff;
    --neon-green: #39ff14;
    --dark-bg: #0a0a0f;
    --darker-bg: #050508;
    --glass-bg: rgba(15, 15, 25, 0.7);
    --glass-border: rgba(0, 243, 255, 0.2);
    --text-primary: #e0e0e0;
    --text-secondary: #a0a0a0;
    --grid-color: rgba(0, 243, 255, 0.1);
}

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

body {
    font-family: 'JetBrains Mono', monospace;
    background: var(--dark-bg);
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
    position: relative;
}

/* Matrix Background Animation */
.matrix-bg {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    background:
        linear-gradient(90deg, var(--grid-color) 1px, transparent 1px),
        linear-gradient(0deg, var(--grid-color) 1px, transparent 1px);
    background-size: 50px 50px;
    animation: matrix-scroll 20s linear infinite;
    opacity: 0.3;
}

@keyframes matrix-scroll {
    0% { transform: translateY(0); }
    100% { transform: translateY(50px); }
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 30px 20px;
    position: relative;
    z-index: 1;
}

/* Header */
.header {
    text-align: center;
    margin-bottom: 30px;
    animation: fade-in-down 1s ease-out;
}

@keyframes fade-in-down {
    from {
        opacity: 0;
        transform: translateY(-30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.logo {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
    margin-bottom: 10px;
}

.logo-icon {
    font-size: 48px;
    animation: pulse-glow 2s ease-in-out infinite;
}

@keyframes pulse-glow {
    0%, 100% {
        filter: drop-shadow(0 0 10px var(--neon-cyan));
        transform: scale(1);
    }
    50% {
        filter: drop-shadow(0 0 20px var(--neon-cyan));
        transform: scale(1.05);
    }
}

.header h1 {
    font-family: 'Orbitron', sans-serif;
    font-size: 52px;
    font-weight: 900;
    letter-spacing: 4px;
    background: linear-gradient(135deg, var(--neon-cyan), var(--neon-magenta));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    text-shadow: 0 0 30px rgba(0, 243, 255, 0.5);
}

.highlight {
    color: var(--neon-green);
    -webkit-text-fill-color: var(--neon-green);
}

.subtitle {
    font-size: 14px;
    color: var(--text-secondary);
    letter-spacing: 2px;
    text-transform: uppercase;
}

/* Two Column Layout */
.two-column-layout {
    display: grid;
    grid-template-columns: 340px 1fr;
    gap: 24px;
    align-items: start;
}

.left-column {
    position: sticky;
    top: 20px;
    align-self: start;
}

/* Glass Panel */
.glass-panel {
    background: var(--glass-bg);
    backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    padding: 24px;
    box-shadow:
        0 8px 32px rgba(0, 0, 0, 0.5),
        inset 0 1px 0 rgba(255, 255, 255, 0.05);
    animation: fade-in-up 1s ease-out;
    animation-delay: 0.2s;
    animation-fill-mode: both;
}

@keyframes fade-in-up {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Results Panel */
.results-panel {
    animation: fade-in-up 0.8s ease-out;
}

.results-title {
    font-family: 'Orbitron', sans-serif;
    font-size: 18px;
    margin-bottom: 20px;
    color: var(--neon-cyan);
    text-align: center;
    letter-spacing: 1px;
}

.results-placeholder {
    text-align: center;
    color: var(--text-secondary);
    font-size: 13px;
    line-height: 1.6;
    padding: 20px 10px;
    border: 1px dashed rgba(0, 243, 255, 0.15);
    border-radius: 10px;
    background: rgba(0, 0, 0, 0.2);
}

.result-cards {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 16px;
}

.result-card {
    background: rgba(0, 0, 0, 0.5);
    border: 1px solid rgba(0, 243, 255, 0.3);
    border-radius: 10px;
    padding: 14px 16px;
    display: flex;
    align-items: center;
    gap: 14px;
    transition: all 0.3s ease;
}

@keyframes slide-in {
    from {
        opacity: 0;
        transform: translateX(-20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.result-card:hover {
    border-color: var(--neon-cyan);
    box-shadow: 0 4px 20px rgba(0, 243, 255, 0.2);
}

.highlight-card {
    background: linear-gradient(135deg, rgba(0, 243, 255, 0.2), rgba(255, 0, 255, 0.2));
    border-color: var(--neon-cyan);
    box-shadow: 0 0 20px rgba(0, 243, 255, 0.15);
}

.card-icon {
    font-size: 28px;
    flex-shrink: 0;
}

.card-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.card-label {
    font-size: 10px;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.card-value {
    font-size: 20px;
    font-weight: 700;
    color: var(--neon-cyan);
    font-family: 'Orbitron', sans-serif;
}

.card-value.total {
    font-size: 24px;
    color: var(--neon-green);
}

/* TurboQuant Toggle */
.turboquant-section {
    margin-top: 15px;
    margin-bottom: 15px;
    padding: 12px 15px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 12px;
    border: 1px solid rgba(0, 243, 255, 0.15);
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

.turboquant-section:has(input:checked) {
    border-color: rgba(0, 243, 255, 0.5);
    box-shadow: 0 0 15px rgba(0, 243, 255, 0.15);
}

.turboquant-toggle {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    cursor: pointer;
}

.turboquant-toggle input[type="checkbox"] {
    display: none;
}

.turboquant-slider {
    position: relative;
    width: 44px;
    min-width: 44px;
    height: 24px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    transition: background 0.3s ease;
    margin-top: 2px;
}

.turboquant-slider::after {
    content: '';
    position: absolute;
    top: 3px;
    left: 3px;
    width: 18px;
    height: 18px;
    background: rgba(255, 255, 255, 0.5);
    border-radius: 50%;
    transition: transform 0.3s ease, background 0.3s ease;
}

.turboquant-toggle input:checked + .turboquant-slider {
    background: linear-gradient(135deg, #00f3ff, #0099ff);
}

.turboquant-toggle input:checked + .turboquant-slider::after {
    transform: translateX(20px);
    background: white;
}

.turboquant-label {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.turboquant-title {
    font-family: 'JetBrains Mono', monospace;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
    letter-spacing: 0.5px;
}

.turboquant-hint {
    font-size: 11px;
    color: var(--text-secondary);
    line-height: 1.4;
}

/* VRAM Visualization */
.vram-visualization {
    margin-top: 15px;
    margin-bottom: 15px;
    padding: 15px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 12px;
    border: 1px solid rgba(0, 243, 255, 0.15);
}

.viz-label {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 10px;
    text-transform: uppercase;
    letter-spacing: 1.5px;
}

.viz-bar {
    height: 48px;
    background: rgba(0, 0, 0, 0.5);
    border-radius: 8px;
    overflow: hidden;
    display: flex;
    border: 1px solid rgba(0, 243, 255, 0.2);
}

.viz-segment {
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.8s ease;
    position: relative;
    overflow: hidden;
}

.viz-segment::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    animation: shimmer 2s infinite;
}

@keyframes shimmer {
    to { left: 100%; }
}

.viz-segment.weights {
    background: linear-gradient(135deg, #00f3ff, #0099ff);
}

.viz-segment.kv-cache {
    background: linear-gradient(135deg, #ff00ff, #cc00cc);
}

.viz-segment.activations {
    background: linear-gradient(135deg, #39ff14, #00cc00);
}

.viz-label-inline {
    font-size: 12px;
    font-weight: 600;
    color: white;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
    z-index: 1;
}

/* Mode Selector */
.mode-selector {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    background: var(--darker-bg);
    padding: 6px;
    border-radius: 10px;
    border: 1px solid rgba(0, 243, 255, 0.1);
}

.mode-btn {
    flex: 1;
    padding: 12px 20px;
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-family: 'JetBrains Mono', monospace;
    font-size: 13px;
    font-weight: 600;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.3s ease;
}

.mode-btn .icon {
    font-size: 18px;
}

.mode-btn:hover {
    background: rgba(0, 243, 255, 0.1);
    color: var(--neon-cyan);
}

.mode-btn.active {
    background: linear-gradient(135deg, rgba(0, 243, 255, 0.2), rgba(255, 0, 255, 0.2));
    color: var(--neon-cyan);
    box-shadow: 0 0 20px rgba(0, 243, 255, 0.3);
}

/* Upload + Settings Side by Side */
.upload-and-settings {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

.upload-half {
    display: flex;
    flex-direction: column;
}

.settings-half {
    display: flex;
    flex-direction: column;
    gap: 16px;
    padding: 20px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 10px;
    border: 1px solid rgba(0, 243, 255, 0.1);
}

/* File Size Warning */
.file-size-warning {
    background: rgba(255, 165, 0, 0.1);
    border: 1px solid rgba(255, 165, 0, 0.3);
    border-radius: 10px;
    padding: 12px 16px;
    margin-bottom: 16px;
    display: flex;
    align-items: flex-start;
    gap: 10px;
}

.warning-icon {
    font-size: 20px;
    flex-shrink: 0;
}

.file-size-warning p {
    margin: 0;
    font-size: 12px;
    line-height: 1.6;
    color: var(--text-primary);
}

.file-size-warning strong {
    color: #ffa500;
}

/* Upload Area */
.upload-area {
    border: 2px dashed var(--glass-border);
    border-radius: 12px;
    padding: 40px 24px;
    text-align: center;
    transition: all 0.3s ease;
    cursor: pointer;
    background: rgba(0, 243, 255, 0.02);
}

.upload-area:hover {
    border-color: var(--neon-cyan);
    background: rgba(0, 243, 255, 0.05);
    box-shadow: 0 0 30px rgba(0, 243, 255, 0.1);
}

.upload-area.drag-over {
    border-color: var(--neon-green);
    background: rgba(57, 255, 20, 0.1);
    box-shadow: 0 0 40px rgba(57, 255, 20, 0.2);
}

/* Context warning */
.context-warning {
    margin-top: 8px;
    padding: 8px 12px;
    border-radius: 8px;
    border: 1px solid rgba(255, 165, 0, 0.4);
    background: rgba(255, 165, 0, 0.08);
    color: #ffc107;
    font-size: 12px;
    line-height: 1.5;
}

.upload-icon {
    font-size: 48px;
    color: var(--neon-cyan);
    margin-bottom: 16px;
    animation: float 3s ease-in-out infinite;
}

@keyframes float {
    0%, 100% { transform: translateY(0px); }
    50% { transform: translateY(-10px); }
}

.upload-text {
    font-size: 15px;
    margin-bottom: 8px;
    color: var(--text-primary);
}

.upload-formats {
    font-size: 11px;
    color: var(--text-secondary);
    margin-bottom: 16px;
}

.browse-btn {
    padding: 10px 24px;
    background: rgba(0, 243, 255, 0.1);
    border: 1px solid var(--neon-cyan);
    color: var(--neon-cyan);
    border-radius: 8px;
    cursor: pointer;
    font-family: 'JetBrains Mono', monospace;
    font-weight: 600;
    font-size: 13px;
    transition: all 0.3s ease;
}

.browse-btn:hover {
    background: rgba(0, 243, 255, 0.2);
    box-shadow: 0 0 20px rgba(0, 243, 255, 0.3);
    transform: translateY(-2px);
}

.file-info {
    margin-top: 16px;
    padding: 16px;
    background: rgba(57, 255, 20, 0.1);
    border: 1px solid var(--neon-green);
    border-radius: 10px;
}

.file-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 12px;
}

.file-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 12px;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(57, 255, 20, 0.3);
    border-radius: 8px;
    transition: all 0.3s ease;
}

.file-item:hover {
    background: rgba(0, 0, 0, 0.5);
    border-color: var(--neon-green);
}

.file-item-info {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1;
}

.file-icon {
    font-size: 18px;
}

.file-details {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.file-name {
    color: var(--neon-green);
    font-weight: 600;
    font-size: 12px;
}

.file-size {
    color: var(--text-secondary);
    font-size: 10px;
}

.remove-file {
    background: rgba(255, 0, 0, 0.2);
    border: 1px solid #ff0000;
    color: #ff0000;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 16px;
    line-height: 1;
    transition: all 0.3s ease;
    flex-shrink: 0;
}

.remove-file:hover {
    background: rgba(255, 0, 0, 0.4);
    transform: rotate(90deg);
}

.clear-all-btn {
    width: 100%;
    padding: 8px;
    background: rgba(255, 0, 0, 0.1);
    border: 1px solid rgba(255, 0, 0, 0.3);
    color: #ff6b6b;
    border-radius: 8px;
    cursor: pointer;
    font-family: 'JetBrains Mono', monospace;
    font-size: 11px;
    font-weight: 600;
    transition: all 0.3s ease;
}

.clear-all-btn:hover {
    background: rgba(255, 0, 0, 0.2);
    border-color: #ff0000;
    color: #ff0000;
}

/* Input Groups */
.input-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
    margin-bottom: 20px;
}

.input-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.input-group label {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--neon-cyan);
    font-weight: 600;
}

.section-label {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--neon-cyan);
    font-weight: 600;
    margin-bottom: 12px;
    display: block;
}

.input-group input {
    padding: 10px 12px;
    background: rgba(0, 0, 0, 0.5);
    border: 1px solid rgba(0, 243, 255, 0.3);
    border-radius: 8px;
    color: var(--text-primary);
    font-family: 'JetBrains Mono', monospace;
    font-size: 13px;
    transition: all 0.3s ease;
}

.input-group input:focus {
    outline: none;
    border-color: var(--neon-cyan);
    box-shadow: 0 0 15px rgba(0, 243, 255, 0.3);
}

.input-hint {
    font-size: 10px;
    color: var(--text-secondary);
    font-style: italic;
}

/* Settings Section */
.settings-section {
    display: grid;
    gap: 20px;
    margin: 20px 0;
    padding: 20px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 10px;
    border: 1px solid rgba(0, 243, 255, 0.1);
}

/* Precision Options */
.precision-options {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.precision-btn {
    padding: 8px 14px;
    background: rgba(0, 0, 0, 0.5);
    border: 1px solid rgba(0, 243, 255, 0.3);
    color: var(--text-secondary);
    border-radius: 6px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.precision-btn:hover {
    border-color: var(--neon-cyan);
    color: var(--neon-cyan);
    transform: translateY(-2px);
}

.precision-btn.active {
    background: linear-gradient(135deg, rgba(0, 243, 255, 0.3), rgba(255, 0, 255, 0.3));
    border-color: var(--neon-cyan);
    color: var(--neon-cyan);
    box-shadow: 0 0 15px rgba(0, 243, 255, 0.4);
}

/* Calculate Button */
.calculate-btn {
    width: 100%;
    padding: 16px;
    background: linear-gradient(135deg, var(--neon-cyan), var(--neon-magenta));
    border: none;
    border-radius: 10px;
    color: white;
    font-family: 'Orbitron', sans-serif;
    font-size: 16px;
    font-weight: 700;
    letter-spacing: 2px;
    cursor: pointer;
    position: relative;
    overflow: hidden;
    transition: all 0.3s ease;
    margin-top: 20px;
}

.calculate-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 40px rgba(0, 243, 255, 0.5);
}

.calculate-btn:active {
    transform: translateY(-1px);
}

.btn-text {
    position: relative;
    z-index: 1;
}

.btn-glow {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.calculate-btn:hover .btn-glow {
    width: 300px;
    height: 300px;
}

/* GPU Recommendations */
.gpu-recommendations {
    margin-top: 24px;
}

.gpu-recommendations h3 {
    font-family: 'Orbitron', sans-serif;
    font-size: 18px;
    color: var(--neon-cyan);
    margin-bottom: 16px;
}

.gpu-list {
    display: grid;
    gap: 10px;
}

.gpu-item {
    background: rgba(0, 0, 0, 0.5);
    border: 1px solid rgba(0, 243, 255, 0.3);
    border-radius: 10px;
    padding: 14px 18px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: all 0.3s ease;
}

.gpu-item:hover {
    border-color: var(--neon-green);
    transform: translateX(5px);
}

.gpu-item.recommended {
    border-color: var(--neon-green);
    background: rgba(57, 255, 20, 0.1);
}

.gpu-name {
    font-weight: 600;
    color: var(--text-primary);
    font-size: 13px;
}

.gpu-vram {
    color: var(--neon-cyan);
    font-family: 'Orbitron', sans-serif;
    font-weight: 700;
    font-size: 13px;
}

/* Detailed Breakdown */
.detailed-breakdown {
    margin-top: 24px;
}

.detailed-breakdown h3 {
    font-family: 'Orbitron', sans-serif;
    font-size: 18px;
    color: var(--neon-cyan);
    margin-bottom: 16px;
}

.breakdown-content {
    background: rgba(0, 0, 0, 0.5);
    border: 1px solid rgba(0, 243, 255, 0.2);
    border-radius: 10px;
    padding: 20px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 12px;
    line-height: 1.8;
}

.breakdown-item {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
    border-bottom: 1px solid rgba(0, 243, 255, 0.1);
}

.breakdown-item:last-child {
    border-bottom: none;
}

.breakdown-label {
    color: var(--text-secondary);
}

.breakdown-value {
    color: var(--neon-cyan);
    font-weight: 600;
}

/* Responsive */
@media (max-width: 900px) {
    .two-column-layout {
        grid-template-columns: 1fr;
    }

    .left-column {
        position: static;
    }

    .header h1 {
        font-size: 36px;
    }

    .glass-panel {
        padding: 20px;
    }

    .upload-and-settings {
        grid-template-columns: 1fr;
    }

    .input-grid {
        grid-template-columns: 1fr;
    }

    .precision-options {
        justify-content: center;
    }
}
