:root {
    --bg-base: #f8fafc;
    --bg-card: rgba(255, 255, 255, 0.96);
    --border-color: #e2e8f0;
    --primary: #0284c7;
    --primary-gradient: linear-gradient(135deg, #0284c7 0%, #4f46e5 50%, #7c3aed 100%);
    --text-title: #0f172a;
    --text-body: #334155;
    --text-muted: #64748b;
    --shadow-sm: 0 1px 3px rgba(15, 23, 42, 0.05);
    --shadow-md: 0 4px 12px rgba(15, 23, 42, 0.08);
    --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
}

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

body {
    font-family: 'Plus Jakarta Sans', sans-serif;
    background-color: var(--bg-base);
    color: var(--text-body);
    line-height: 1.65;
    overflow-x: hidden;
    position: relative;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

#quantum-circuit-canvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: -1;
    pointer-events: none;
}

/* Header */
header {
    position: sticky;
    top: 0;
    z-index: 100;
    background: #ffffff;
    border-bottom: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
}

.nav-container {
    max-width: 1240px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.85rem 2rem;
}

.nav-brand {
    font-weight: 800;
    font-size: 1.2rem;
    color: var(--text-title);
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 0.6rem;
}

.quantum-spin {
    color: var(--primary);
    animation: spin 18s linear infinite;
}

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

.nav-brand span {
    background: var(--primary-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.nav-links {
    display: flex;
    gap: 1.2rem;
    align-items: center;
    list-style: none;
}

.nav-links a {
    text-decoration: none;
    color: var(--text-muted);
    font-size: 0.88rem;
    font-weight: 600;
    transition: color 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
}

.nav-links a:hover {
    color: var(--primary);
}

/* Container & Cards */
.main-content {
    max-width: 1240px;
    margin: 0 auto;
    padding: 2rem 2rem 4rem;
    flex: 1;
    width: 100%;
}

.glass-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 18px;
    padding: 2rem;
    margin-bottom: 1.8rem;
    box-shadow: var(--shadow-sm);
    transition: box-shadow 0.2s var(--ease-out), border-color 0.2s ease;
}

.glass-card:hover {
    border-color: #cbd5e1;
    box-shadow: var(--shadow-md);
}

.hub-hero {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.98) 0%, rgba(240, 249, 255, 0.98) 100%);
    border-left: 5px solid var(--primary);
    padding: 2.2rem 2.4rem;
}

.role-badge-tag {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--primary);
    background: #e0f2fe;
    border: 1px solid #bae6fd;
    padding: 0.25rem 0.8rem;
    border-radius: 9999px;
    margin-bottom: 0.6rem;
}

.hub-main-title {
    font-size: 2rem;
    font-weight: 800;
    color: var(--text-title);
    letter-spacing: -0.02em;
    margin-bottom: 0.4rem;
}

.hub-subtitle {
    font-size: 0.94rem;
    color: var(--text-muted);
    max-width: 900px;
    line-height: 1.6;
}

.section-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1.2rem;
}

.section-title {
    font-size: 1.25rem;
    font-weight: 800;
    color: var(--text-title);
    letter-spacing: -0.02em;
    display: flex;
    align-items: center;
    gap: 0.6rem;
}

.section-title i {
    color: var(--primary);
}

/* 4-Column Grid */
.algorithm-selector-grid.four-col-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1.1rem;
}

.selector-group {
    background: #ffffff;
    border: 1px solid var(--border-color);
    border-radius: 14px;
    padding: 1.1rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.02);
}

.group-label {
    font-size: 0.76rem;
    font-weight: 800;
    text-transform: uppercase;
    color: var(--text-muted);
    letter-spacing: 0.04em;
    padding-bottom: 0.35rem;
    border-bottom: 1px solid #f1f5f9;
}

/* Radio Choice Cards */
.algo-option {
    display: block;
    cursor: pointer;
}

.algo-option input[type="radio"] {
    display: none;
}

.algo-card-inner {
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    padding: 0.8rem 0.85rem;
    background: #ffffff;
    transition: transform 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}

.algo-card-inner strong {
    display: block;
    font-size: 0.86rem;
    font-weight: 700;
    color: var(--text-title);
    line-height: 1.35;
}

.algo-card-inner p {
    font-size: 0.75rem;
    color: var(--text-muted);
    line-height: 1.35;
    margin-top: 0.3rem;
}

.algo-option:hover .algo-card-inner {
    border-color: #cbd5e1;
    transform: translateY(-1px);
}

.algo-option input[type="radio"]:checked + .algo-card-inner {
    border-color: var(--primary);
    background: #f0f9ff;
    box-shadow: 0 0 0 2px rgba(2, 132, 199, 0.25);
}

.algo-option input[type="radio"]:checked + .algo-card-inner strong {
    color: var(--primary);
}

/* Status Badges */
.status-pill {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.68rem;
    font-weight: 800;
    padding: 0.12rem 0.45rem;
    border-radius: 4px;
    display: inline-block;
    text-transform: uppercase;
}

.status-ongoing {
    background: #f0fdf4;
    color: #166534;
    border: 1px solid #86efac;
}

.status-completed {
    background: #f1f5f9;
    color: #64748b;
    border: 1px solid #cbd5e1;
}

.status-submitted {
    background: #f3e8ff;
    color: #7e22ce;
    border: 1px solid #e9d5ff;
}

/* SDM Sub-Headings */
.sdm-subgroup-header {
    font-size: 0.72rem;
    font-weight: 800;
    color: var(--primary);
    text-transform: uppercase;
    letter-spacing: 0.03em;
    padding: 0.28rem 0.5rem;
    background: #eff6ff;
    border-left: 3px solid var(--primary);
    border-radius: 4px;
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

/* =========================================================
   CUSTOM STYLED COMBOBOX COMPONENT (Matches site card design)
   ========================================================= */
.custom-combobox {
    position: relative;
    user-select: none;
}

.combo-trigger {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    padding: 0.65rem 0.85rem;
    background: #ffffff;
    border: 1.5px solid #cbd5e1;
    border-radius: 10px;
    cursor: pointer;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.03);
    transition: border-color 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease;
}

.combo-trigger:hover {
    border-color: var(--primary);
    transform: translateY(-1px);
}

.custom-combobox.open .combo-trigger {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(2, 132, 199, 0.15);
}

.combo-selected-title {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.84rem;
    font-weight: 700;
    color: var(--text-title);
    flex: 1;
}

.combo-arrow {
    font-size: 0.75rem;
    color: var(--text-muted);
    transition: transform 0.2s ease;
}

.custom-combobox.open .combo-arrow {
    transform: rotate(180deg);
    color: var(--primary);
}

.combo-dropdown {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    right: 0;
    max-height: 240px;
    overflow-y: auto;
    background: #ffffff;
    border: 1px solid var(--border-color);
    border-radius: 10px;
    box-shadow: 0 10px 25px rgba(15, 23, 42, 0.12);
    z-index: 50;
    display: none;
    padding: 0.4rem;
    animation: comboFadeIn 0.15s ease-out;
}

@keyframes comboFadeIn {
    from { opacity: 0; transform: translateY(-4px); }
    to { opacity: 1; transform: translateY(0); }
}

.custom-combobox.open .combo-dropdown {
    display: block;
}

.combo-dropdown::-webkit-scrollbar {
    width: 5px;
}
.combo-dropdown::-webkit-scrollbar-track {
    background: #f8fafc;
}
.combo-dropdown::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 4px;
}

.combo-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    padding: 0.45rem 0.65rem;
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.12s ease;
}

.combo-item:hover {
    background: #f0f9ff;
}

.combo-item .ci-name {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-title);
}

.combo-item.active-item {
    border-left: 3px solid #10b981;
}

.combo-item.upcoming-item {
    opacity: 0.85;
}

/* Workspace Controls & Tables */
.workspace-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1.5rem;
    margin-bottom: 1.3rem;
}

.section-desc {
    font-size: 0.88rem;
    color: var(--text-muted);
    margin-top: 0.2rem;
}

.citation-badge {
    background: #eff6ff;
    border: 1px solid #bfdbfe;
    color: #1e40af;
    font-size: 0.74rem;
    font-family: 'JetBrains Mono', monospace;
    padding: 0.45rem 0.8rem;
    border-radius: 8px;
    max-width: 420px;
}

.dss-controls-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.85rem;
    background: #ffffff;
    padding: 0.85rem 1.2rem;
    border-radius: 12px;
    border: 1px solid var(--border-color);
    margin-bottom: 1.3rem;
    box-shadow: var(--shadow-sm);
}

.dss-input-group {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.84rem;
    font-weight: 700;
    color: var(--text-title);
}

.dss-input-group input {
    width: 65px;
    padding: 0.35rem 0.45rem;
    border-radius: 6px;
    border: 1px solid #cbd5e1;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.88rem;
    outline: none;
    text-align: center;
    background: #f8fafc;
}

.dss-input-group input:focus {
    border-color: var(--primary);
    background: #ffffff;
}

.tech-pill {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    color: var(--text-body);
    font-size: 0.8rem;
    font-weight: 600;
    padding: 0.4rem 0.85rem;
    border-radius: 8px;
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    cursor: pointer;
    transition: transform 0.15s ease, border-color 0.15s ease;
}

.tech-pill:hover {
    border-color: var(--primary);
    background: #f0f9ff;
    color: var(--primary);
    transform: translateY(-1px);
}

.active-pill-btn {
    background: #0284c7 !important;
    color: #ffffff !important;
    border-color: #0284c7 !important;
}

.dss-launch-btn {
    background: linear-gradient(135deg, #0284c7 0%, #4f46e5 100%);
    color: #ffffff !important;
    text-decoration: none;
    font-size: 0.84rem;
    font-weight: 700;
    padding: 0.5rem 1.3rem;
    border-radius: 8px;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    white-space: nowrap;
    border: none;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(2, 132, 199, 0.25);
    transition: transform 0.15s ease, filter 0.15s ease;
}

.dss-launch-btn:hover {
    transform: translateY(-1px);
    filter: brightness(1.08);
}

.calculate-btn {
    margin-left: auto;
}

/* Spreadsheet Grid */
.dss-table-wrapper {
    overflow-x: auto;
    background: #ffffff;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 0.8rem;
    box-shadow: var(--shadow-sm);
}

.dss-matrix-table {
    width: 100%;
    border-collapse: collapse;
    font-family: 'JetBrains Mono', monospace;
}

.dss-matrix-table th, .dss-matrix-table td {
    padding: 0.55rem 0.45rem;
    text-align: center;
    border: 1px solid #e2e8f0;
}

.dss-matrix-table th {
    background: #f8fafc;
    color: var(--text-title);
    font-size: 0.8rem;
    font-weight: 700;
}

.dss-matrix-table tr.weights-row {
    background: #eff6ff;
}

.dss-matrix-table tr.weights-row td:first-child {
    font-weight: 700;
    color: #1e40af;
}

.dss-matrix-table input {
    width: 76px;
    padding: 0.32rem 0.4rem;
    border: 1px solid #cbd5e1;
    border-radius: 5px;
    text-align: center;
    font-size: 0.84rem;
    font-family: 'JetBrains Mono', monospace;
    background: #ffffff;
}

.dss-matrix-table input:focus {
    border-color: var(--primary);
    outline: none;
    box-shadow: 0 0 0 2px rgba(2, 132, 199, 0.15);
}

/* Results Component */
.results-panel {
    margin-top: 1.8rem;
    padding-top: 1.4rem;
    border-top: 2px dashed #cbd5e1;
    animation: fadeIn 0.25s ease-out;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(6px); }
    to { opacity: 1; transform: translateY(0); }
}

.result-top-banner {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.2rem;
    gap: 1rem;
    flex-wrap: wrap;
}

.winner-box {
    display: flex;
    align-items: center;
    gap: 1rem;
    background: #ecfdf5;
    border: 1px solid #a7f3d0;
    padding: 0.85rem 1.4rem;
    border-radius: 10px;
}

.trophy-icon {
    font-size: 1.8rem;
    color: #059669;
}

.winner-label {
    font-size: 0.72rem;
    text-transform: uppercase;
    font-weight: 800;
    color: #065f46;
    letter-spacing: 0.04em;
}

.winner-box h3 {
    font-size: 1.15rem;
    font-weight: 800;
    color: #064e3b;
}

.dss-result-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.88rem;
}

.dss-result-table th, .dss-result-table td {
    padding: 0.75rem 1.2rem;
    text-align: left;
    border-bottom: 1px solid #f1f5f9;
}

.dss-result-table th {
    background: #f8fafc;
    font-size: 0.76rem;
    font-weight: 800;
    color: var(--text-muted);
    text-transform: uppercase;
}

footer {
    border-top: 1px solid var(--border-color);
    text-align: center;
    padding: 2.2rem 1rem;
    font-size: 0.85rem;
    color: var(--text-muted);
    background: #ffffff;
    margin-top: auto;
}

footer a {
    color: var(--primary);
    text-decoration: none;
}

@media (max-width: 1200px) {
    .algorithm-selector-grid.four-col-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 900px) {
    .workspace-header { flex-direction: column; }
    .citation-badge { max-width: 100%; }
    .calculate-btn { margin-left: 0; width: 100%; justify-content: center; }
}

@media (max-width: 768px) {
    .algorithm-selector-grid.four-col-grid {
        grid-template-columns: 1fr;
    }
    .main-content {
        padding: 1.2rem 1rem 3rem;
    }
}