:root {
    --bg-dark: #0f172a;
    --glass-bg: rgba(30, 41, 59, 0.4);
    --glass-border: rgba(255, 255, 255, 0.1);
    --glass-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
    --primary-color: #3b82f6;
    --primary-gradient: linear-gradient(135deg, #3b82f6, #8b5cf6, #ec4899);
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --success: #10b981;
    --danger: #ef4444;
}

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

body {
    font-family: 'Outfit', sans-serif;
    background-color: var(--bg-dark);
    color: var(--text-primary);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    overflow-x: hidden;
    position: relative;
    padding: 2rem;
}

@media (max-width: 600px) {
    body { padding: 1rem; }
}

.background-orbs {
    position: fixed;
    top: 0; left: 0;
    width: 100vw; height: 100vh;
    z-index: -1;
    overflow: hidden;
    pointer-events: none;
}
.orb {
    position: absolute;
    border-radius: 50%;
    filter: blur(100px);
    opacity: 0.6;
    animation: drift 20s infinite alternate ease-in-out;
}
.orb-1 { width: 400px; height: 400px; background: #3b82f6; top: -100px; left: -100px; }
.orb-2 { width: 300px; height: 300px; background: #ec4899; bottom: 10%; right: 5%; animation-delay: -5s; }
.orb-3 { width: 250px; height: 250px; background: #8b5cf6; top: 30%; left: 40%; animation-delay: -10s; }

@keyframes drift {
    0% { transform: translate(0, 0) scale(1); }
    100% { transform: translate(50px, -50px) scale(1.1); }
}

.app-container {
    width: 100%;
    max-width: 1200px;
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

.header {
    text-align: center;
    margin-bottom: 1rem;
}
.gradient-text {
    background: var(--primary-gradient);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    font-size: 3rem;
    font-weight: 700;
}
.header p { color: var(--text-secondary); font-size: 1.1rem; }

@media (max-width: 600px) {
    .gradient-text { font-size: 2.2rem; }
    .header p { font-size: 0.95rem; }
}

.calculator-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 2rem;
}

@media (min-width: 900px) {
    .calculator-grid {
        grid-template-columns: 1fr 1.5fr;
        grid-template-rows: auto auto;
    }
    .settings-panel { grid-row: 1 / 3; }
    .form-panel { grid-row: 1 / 2; }
    .result-panel { grid-row: 2 / 3; }
}

.glass-panel {
    background: var(--glass-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    border-radius: 20px;
    box-shadow: var(--glass-shadow);
    padding: 2rem;
}

@media (max-width: 600px) {
    .glass-panel { padding: 1.2rem; }
}

.panel-header {
    margin-bottom: 1.5rem;
    border-bottom: 1px solid var(--glass-border);
    padding-bottom: 1rem;
}
.panel-header h3 {
    display: flex; align-items: center; gap: 0.5rem; font-weight: 600;
}

/* Forms */
.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    color: var(--text-secondary);
    font-size: 0.95rem;
}

.custom-select {
    position: relative;
    width: 100%;
}

.custom-select select {
    width: 100%;
    appearance: none;
    -webkit-appearance: none;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: var(--text-primary);
    padding: 0.8rem 1rem;
    border-radius: 10px;
    font-family: inherit;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s;
}
.custom-select select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.2);
}
.custom-select select option {
    background: var(--bg-dark);
    color: var(--text-primary);
}
.custom-select i {
    position: absolute;
    right: 1rem;
    top: 50%;
    transform: translateY(-50%);
    pointer-events: none;
    color: var(--text-secondary);
}

.hidden { display: none !important; }

/* Custom Weights */
.custom-weights {
    margin-top: 1.5rem;
    background: rgba(0, 0, 0, 0.2);
    padding: 1.5rem;
    border-radius: 12px;
}
.custom-weights h4 { margin-bottom: 1rem; color: #cbd5e1; }
.weight-inputs {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
    gap: 1rem;
}
.input-group label {
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-bottom: 0.3rem; display: block;
}
.input-group input {
    width: 100%;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: white;
    padding: 0.5rem;
    border-radius: 6px;
    font-family: inherit;
}
.input-group input:focus {
    outline: none; border-color: var(--primary-color);
}

.input-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 1rem;
    align-items: flex-end;
}

@media (max-width: 600px) {
    .input-row {
        grid-template-columns: 1fr;
    }
}
.error-msg {
    color: var(--danger);
    font-size: 0.85rem;
    margin-top: 1rem;
    display: flex;
    align-items: center; gap: 0.5rem;
}

.weights-summary {
    margin-top: 2rem;
}
.weights-summary h4 { margin-bottom: 1rem; color: var(--text-secondary); }
.weights-list {
    list-style: none;
    display: flex; flex-direction: column; gap: 0.8rem;
}
.weights-list li {
    display: flex; justify-content: space-between;
    background: rgba(255, 255, 255, 0.05);
    padding: 0.8rem 1rem;
    border-radius: 8px;
    font-size: 0.95rem;
}
.weights-list li strong { color: var(--primary-color); font-weight: 700; }

/* Domain Eval */
.domain-evals { display: flex; flex-direction: column; gap: 1.5rem; }
.domain-card {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.05);
    padding: 1.2rem;
    border-radius: 12px;
}
.domain-info {
    display: flex; justify-content: space-between; align-items: center;
    margin-bottom: 1rem;
}
.domain-info h4 { font-weight: 500; font-size: 1.05rem; color: #e2e8f0; }
.domain-score-badge {
    background: rgba(16, 185, 129, 0.2);
    color: #34d399;
    padding: 0.3rem 0.8rem;
    border-radius: 20px;
    font-weight: 700;
    font-size: 0.9rem;
}

/* Result Panel */
.result-panel { text-align: center; }

.circular-chart {
    display: block;
    margin: 1rem auto;
    max-width: 80%;
    max-height: 250px;
}
.circle-bg {
    fill: none;
    stroke: rgba(255, 255, 255, 0.05);
    stroke-width: 2.5;
}
.circle {
    fill: none;
    stroke-width: 2.5;
    stroke-linecap: round;
    transition: stroke-dasharray 1s ease-out, stroke 0.5s;
}
.percentage {
    fill: #fff;
    font-family: 'Outfit', sans-serif;
    font-size: 6px;
    font-weight: 700;
    text-anchor: middle;
}
.score-breakdown p { color: var(--text-secondary); font-size: 0.9rem; margin-top: 1rem; }

/* Inputs and Buttons */
.glass-input {
    flex: 1;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: white;
    padding: 0.8rem 1rem;
    border-radius: 10px;
    font-family: inherit;
    font-size: 0.95rem;
    transition: all 0.3s;
}
.glass-input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.2);
}

.glass-btn {
    background: rgba(255, 255, 255, 0.1);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.2);
    padding: 0.8rem 1.2rem;
    border-radius: 10px;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.95rem;
}
.glass-btn:hover {
    background: rgba(255, 255, 255, 0.15);
}
.glass-btn.primary {
    background: var(--primary-color);
    border-color: var(--primary-color);
    font-weight: 600;
}
.glass-btn.primary:hover {
    background: #2563eb;
    border-color: #2563eb;
}

/* Comparison Panel */
.comparison-panel {
    grid-column: 1 / -1; 
}

.comparison-container {
    display: flex;
    flex-wrap: wrap;
    gap: 1.5rem;
}

.empty-state {
    width: 100%;
    text-align: center;
    color: var(--text-secondary);
    padding: 2.5rem 1rem;
    border: 1px dashed rgba(255, 255, 255, 0.15);
    border-radius: 12px;
}

.comparison-card {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 12px;
    padding: 1.5rem;
    flex: 1 1 300px;
    min-width: 250px;
    position: relative;
    display: flex;
    flex-direction: column;
}

.comparison-card h4 {
    font-size: 1.15rem;
    color: var(--text-primary);
    margin-bottom: 1rem;
    padding-bottom: 0.8rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    padding-right: 2rem;
}

.comparison-card .remove-btn {
    position: absolute;
    top: 1.2rem;
    right: 1.2rem;
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-size: 1.2rem;
    cursor: pointer;
    transition: color 0.3s;
}
.comparison-card .remove-btn:hover {
    color: var(--danger);
}

.comparison-score {
    font-size: 2.2rem;
    font-weight: 700;
    text-align: center;
    margin-bottom: 1rem;
}

.comparison-details {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-top: auto;
}

.comparison-details li {
    display: flex;
    justify-content: space-between;
    font-size: 0.86rem;
    background: rgba(255, 255, 255, 0.03);
    padding: 0.5rem 0.8rem;
    border-radius: 6px;
}
.comparison-details li span { color: var(--text-secondary); }
.comparison-details li strong { color: var(--text-primary); }

/* Frontier Panel Styles */
.frontier-panel {
    grid-column: 1 / -1;
}

.frontier-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 2rem;
    align-items: start;
}

@media (min-width: 1000px) {
    .frontier-grid {
        grid-template-columns: 1.2fr 1fr;
    }
}

.table-block h4 {
    margin-bottom: 1rem;
    color: var(--text-secondary);
    font-size: 1rem;
    font-weight: 500;
}

.custom-table-wrapper {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 12px;
    overflow-x: auto;
    border: 1px solid var(--glass-border);
    -webkit-overflow-scrolling: touch;
}

.custom-table {
    width: 100%;
    min-width: 500px;
    border-collapse: collapse;
    text-align: left;
    font-size: 0.9rem;
}

.custom-table th {
    background: rgba(255, 255, 255, 0.05);
    padding: 1rem;
    color: var(--text-secondary);
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 0.05em;
}

.custom-table td {
    padding: 1rem;
    border-top: 1px solid var(--glass-border);
    color: var(--text-primary);
}

.custom-table tbody tr:hover {
    background: rgba(255, 255, 255, 0.02);
}

.badge {
    background: var(--primary-gradient);
    padding: 0.4rem 0.8rem;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.panel-actions {
    display: flex;
    gap: 0.8rem;
    align-items: center;
}

.status-tag {
    padding: 0.25rem 0.6rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
}

.status-tag.efficient { background: rgba(16, 185, 129, 0.2); color: #34d399; }
.status-tag.dominated { background: rgba(239, 68, 68, 0.2); color: #f87171; }
