:root {
    --bg-primary: #0a0e14;
    --bg-secondary: #0f1419;
    --bg-elevated: #151b23;
    --text-primary: #e6edf3;
    --text-secondary: #8b949e;
    --text-muted: #6e7681;
    --accent-green: #22c55e;
    --accent-blue: #38bdf8;
    --accent-orange: #f97316;
    --accent-purple: #a855f7;
    --accent-yellow: #eab308;
    --border: rgba(139, 148, 158, 0.2);
    --shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Noto Sans', sans-serif;
    background: linear-gradient(135deg, var(--bg-primary) 0%, var(--bg-secondary) 100%);
    color: var(--text-primary);
    min-height: 100vh;
    line-height: 1.6;
}

/* HEADER */
header {
    background: var(--bg-elevated);
    border-bottom: 1px solid var(--border);
    padding: 1.5rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    backdrop-filter: blur(10px);
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-content h1 {
    font-size: 1.5rem;
    font-weight: 600;
    letter-spacing: 0.05em;
    margin-bottom: 0.25rem;
}

.subtitle {
    font-size: 0.875rem;
    color: var(--text-secondary);
    font-weight: 400;
}

.status-badge {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background: rgba(34, 197, 94, 0.1);
    border: 1px solid rgba(34, 197, 94, 0.3);
    border-radius: 999px;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--accent-green);
}

.pulse-dot {
    width: 8px;
    height: 8px;
    background: var(--accent-green);
    border-radius: 50%;
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.5; transform: scale(0.8); }
}

/* NAVIGATION */
.main-nav {
    display: flex;
    gap: 0.5rem;
    padding: 1rem 2rem;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border);
    overflow-x: auto;
}

.nav-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.25rem;
    background: transparent;
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text-secondary);
    font-size: 0.875rem;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}

.nav-btn:hover {
    background: var(--bg-elevated);
    color: var(--text-primary);
    border-color: var(--accent-green);
}

.nav-btn.active {
    background: rgba(34, 197, 94, 0.15);
    border-color: var(--accent-green);
    color: var(--accent-green);
}

.nav-icon {
    font-size: 1.1rem;
}

/* MAIN CONTAINER */
.main-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
}

.view-section {
    display: none;
    animation: fadeIn 0.3s ease-in;
}

.view-section.active {
    display: block;
}

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

/* MUSEUM CARD */
.museum-card {
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 2rem;
    box-shadow: var(--shadow);
}

.museum-card h2 {
    font-size: 1.75rem;
    font-weight: 600;
    margin-bottom: 1rem;
    letter-spacing: 0.02em;
}

.lead {
    font-size: 1.125rem;
    line-height: 1.7;
    margin-bottom: 1.5rem;
    color: var(--text-primary);
}

.museum-text {
    color: var(--text-secondary);
    margin-bottom: 1.5rem;
    line-height: 1.8;
}

.muted-text {
    color: var(--text-muted);
    font-size: 0.875rem;
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border);
}

/* INFO GRID */
.info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
    margin: 2rem 0;
}

.info-block {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 1.5rem;
    text-align: center;
    transition: transform 0.2s, border-color 0.2s;
}

.info-block:hover {
    transform: translateY(-2px);
    border-color: var(--accent-green);
}

.info-symbol {
    font-size: 2rem;
    margin-bottom: 1rem;
    color: var(--accent-green);
    font-weight: 600;
}

.info-block h3 {
    font-size: 1rem;
    margin-bottom: 0.5rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-primary);
}

.info-block p {
    font-size: 0.875rem;
    color: var(--text-secondary);
    line-height: 1.6;
}

/* CONTROLS */
.controls {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    margin: 1.5rem 0;
    flex-wrap: wrap;
}

.controls label {
    font-size: 0.875rem;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

input[type="range"] {
    width: 200px;
    height: 4px;
    background: var(--bg-secondary);
    border-radius: 2px;
    outline: none;
    -webkit-appearance: none;
}

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 16px;
    height: 16px;
    background: var(--accent-green);
    border-radius: 50%;
    cursor: pointer;
    transition: transform 0.2s;
}

input[type="range"]::-webkit-slider-thumb:hover {
    transform: scale(1.2);
}

input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

.action-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    background: linear-gradient(135deg, var(--accent-green), #16a34a);
    border: none;
    border-radius: 8px;
    color: white;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    box-shadow: 0 4px 12px rgba(34, 197, 94, 0.3);
}

.action-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(34, 197, 94, 0.4);
}

.action-btn:active {
    transform: translateY(0);
}

/* SEQUENCE OUTPUT */
.sequence-output {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 1.5rem;
    font-family: 'Courier New', monospace;
    font-size: 1.125rem;
    line-height: 1.8;
    color: var(--text-primary);
    white-space: pre-wrap;
    word-break: break-word;
    margin: 1.5rem 0;
    max-height: 400px;
    overflow-y: auto;
}

.sequence-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(50px, 1fr));
    gap: 8px;
    padding: 1rem;
    background: var(--bg-primary);
}

.letter-cell {
    width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-elevated);
    border: 2px solid var(--border);
    border-radius: 8px;
    font-size: 1.5rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s;
    position: relative;
}

.letter-cell::before {
    content: attr(data-index);
    position: absolute;
    top: 2px;
    right: 4px;
    font-size: 0.6rem;
    color: var(--text-muted);
    opacity: 0.5;
}

.letter-cell:hover {
    transform: scale(1.15) translateY(-3px);
    box-shadow: 0 8px 20px rgba(34, 197, 94, 0.4);
    z-index: 10;
}

.letter-cell.selected {
    border-width: 3px;
    box-shadow: 0 0 20px currentColor;
}

.clickable-letters {
    cursor: pointer;
}

.clickable-letters span.letter {
    display: inline-block;
    padding: 2px 4px;
    margin: 1px;
    border-radius: 4px;
    transition: all 0.2s;
}

.clickable-letters span.letter:hover {
    background: var(--accent-green);
    color: var(--bg-primary);
    transform: scale(1.1);
}

.sequence-stats {
    display: flex;
    gap: 1.5rem;
    justify-content: center;
    margin: 1rem 0;
    flex-wrap: wrap;
}

.stat-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 1rem;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 8px;
    min-width: 120px;
}

.stat-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    margin-bottom: 0.5rem;
}

.stat-value {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--accent-green);
}

/* CANVAS */
canvas {
    width: 100%;
    height: 400px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 8px;
    margin: 1.5rem 0;
    display: block;
}

/* LEGEND */
.legend {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    margin-top: 1rem;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 999px;
    font-size: 0.75rem;
}

.legend-dot {
    width: 10px;
    height: 10px;
    background: var(--color);
    border-radius: 50%;
    box-shadow: 0 0 8px var(--color);
}

.caption {
    font-size: 0.875rem;
    color: var(--text-muted);
    margin-top: 1rem;
    font-style: italic;
}

/* DASHBOARD MODAL */
.dashboard-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(10, 14, 20, 0.95);
    backdrop-filter: blur(10px);
    z-index: 1000;
    overflow-y: auto;
    padding: 2rem;
    animation: fadeIn 0.3s ease-in;
}

.dashboard-content {
    max-width: 1400px;
    margin: 0 auto;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 2rem;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6);
}

.dashboard-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border);
}

.dashboard-header h2 {
    font-size: 2rem;
    margin: 0;
}

.dashboard-header span {
    color: var(--accent-green);
}

.close-btn {
    width: 40px;
    height: 40px;
    border: none;
    background: rgba(239, 68, 68, 0.2);
    color: #ef4444;
    border-radius: 50%;
    font-size: 1.5rem;
    cursor: pointer;
    transition: all 0.2s;
}

.close-btn:hover {
    background: rgba(239, 68, 68, 0.3);
    transform: rotate(90deg);
}

.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: 1.5rem;
}

.dashboard-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 1.5rem;
}

.dashboard-card h3 {
    font-size: 1rem;
    margin: 0 0 1rem 0;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

.dashboard-card canvas {
    width: 100% !important;
    height: 250px !important;
}

.stats-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.stats-list .stat-row {
    display: flex;
    justify-content: space-between;
    padding: 0.75rem;
    background: var(--bg-primary);
    border-radius: 6px;
    border-left: 3px solid var(--accent-green);
}

.stats-list .stat-row .label {
    color: var(--text-secondary);
    font-size: 0.875rem;
}

.stats-list .stat-row .value {
    color: var(--text-primary);
    font-weight: 600;
}

.color-window {
    min-height: 300px;
}

.color-display {
    width: 100%;
    height: 250px;
    border-radius: 8px;
    border: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
    background: var(--bg-primary);
}

.color-display::before {
    content: '';
    position: absolute;
    inset: 0;
    animation: colorShift 5s ease-in-out infinite;
}

@keyframes colorShift {
    0%, 100% {
        background: radial-gradient(circle at 30% 30%, var(--accent-green), transparent 70%);
    }
    33% {
        background: radial-gradient(circle at 70% 50%, var(--accent-blue), transparent 70%);
    }
    66% {
        background: radial-gradient(circle at 50% 80%, var(--accent-orange), transparent 70%);
    }
}

/* MATRIX VIEW */
.matrix-theme {
    background: radial-gradient(circle at top left, #0a1f0a, #020617);
    border: 1px solid rgba(34, 197, 94, 0.3);
}

.matrix-btn {
    background: linear-gradient(135deg, #22c55e, #16a34a) !important;
    box-shadow: 0 0 20px rgba(34, 197, 94, 0.5);
}

#matrix-canvas {
    width: 100%;
    height: 500px;
    background: #000;
    border: 2px solid var(--accent-green);
    border-radius: 8px;
    box-shadow: 0 0 30px rgba(34, 197, 94, 0.3), inset 0 0 50px rgba(0, 0, 0, 0.8);
}

/* RATIOS DISPLAY */
.ratio-display {
    margin-top: 2rem;
    padding-top: 2rem;
    border-top: 1px solid var(--border);
}

.ratio-display h3 {
    font-size: 1.1rem;
    margin-bottom: 1.5rem;
    color: var(--text-primary);
}

#ratio-sum {
    color: var(--accent-green);
    font-weight: 700;
}

.ratio-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
}

.ratio-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
    transition: transform 0.3s, box-shadow 0.3s;
}

.ratio-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 30px rgba(34, 197, 94, 0.2);
}

.ratio-circle {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    font-weight: 700;
    position: relative;
    animation: pulse 2s ease-in-out infinite;
}

.ratio-label {
    font-size: 0.875rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

.ratio-value {
    font-size: 1.25rem;
    color: var(--text-primary);
}

.ratio-bar {
    width: 100%;
    height: 8px;
    background: var(--bg-primary);
    border-radius: 4px;
    overflow: hidden;
    position: relative;
}

.ratio-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--accent-green), var(--accent-blue));
    border-radius: 4px;
    transition: width 1s ease-out;
    box-shadow: 0 0 10px var(--accent-green);
}

/* LIGHT POINTS */
.light-points {
    margin-top: 2rem;
    padding-top: 2rem;
    border-top: 1px solid var(--border);
}

.light-points h3 {
    font-size: 1.1rem;
    margin-bottom: 1rem;
    color: var(--text-primary);
}

.points-container {
    background: #000;
    border: 1px solid var(--accent-green);
    border-radius: 8px;
    overflow: hidden;
}

#light-canvas {
    width: 100%;
    height: 300px;
    display: block;
}

/* NUMERIC CONVERSION */
.numeric-conversion {
    margin-top: 2rem;
    padding-top: 2rem;
    border-top: 1px solid var(--border);
}

.numeric-conversion h3 {
    font-size: 1.1rem;
    margin-bottom: 1rem;
    color: var(--text-primary);
}

.conversion-table {
    display: flex;
    gap: 1.5rem;
    flex-wrap: wrap;
    justify-content: center;
    margin: 1.5rem 0;
}

.conv-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem 1.5rem;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 8px;
    transition: all 0.3s;
}

.conv-item:hover {
    border-color: var(--accent-green);
    box-shadow: 0 0 20px rgba(34, 197, 94, 0.2);
    transform: scale(1.05);
}

.conv-letter {
    font-size: 2rem;
    color: var(--accent-green);
    font-weight: 700;
}

.conv-arrow {
    font-size: 1.5rem;
    color: var(--text-muted);
}

.conv-number {
    font-size: 1.5rem;
    color: var(--accent-blue);
    font-weight: 700;
    font-family: 'Courier New', monospace;
}

/* MATHEMATICAL RATIOS */
.mathematical-ratios {
    margin-top: 2rem;
    padding-top: 2rem;
    border-top: 1px solid var(--border);
}

.mathematical-ratios h3 {
    font-size: 1.1rem;
    margin-bottom: 1.5rem;
    color: var(--text-primary);
    text-align: center;
}

.ratio-windows {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1.5rem;
}

.ratio-window {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.ratio-window h4 {
    margin: 0;
    font-size: 0.9rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    text-align: center;
}

.ratio-window canvas {
    width: 100% !important;
    height: 250px !important;
    background: var(--bg-primary);
    border-radius: 8px;
    border: 1px solid var(--border);
}

.ratio-value-display {
    text-align: center;
    padding: 0.75rem;
    background: var(--bg-primary);
    border-radius: 6px;
    font-family: 'Courier New', monospace;
    color: var(--accent-green);
    font-weight: 600;
    font-size: 1rem;
}

.ratio-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.ratio-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem 0.75rem;
    background: var(--bg-primary);
    border-radius: 6px;
    border-left: 3px solid var(--accent-green);
    font-size: 0.875rem;
}

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

.ratio-item .ratio-val {
    color: var(--text-primary);
    font-weight: 600;
    font-family: 'Courier New', monospace;
}

/* VISUAL STATS */
.visual-stats {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.stat-visual {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.stat-circle {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 1.25rem;
    flex-shrink: 0;
    position: relative;
    animation: pulse 2s ease-in-out infinite;
}

.stat-circle::after {
    content: '';
    position: absolute;
    inset: -5px;
    border-radius: 50%;
    border: 2px solid currentColor;
    opacity: 0.3;
}

.stat-info {
    flex: 1;
}

.stat-info .label {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

.stat-info .value {
    font-size: 1.5rem;
    color: var(--text-primary);
    font-weight: 600;
}

.stat-segment {
    width: 100%;
    height: 60px;
    background: var(--bg-primary);
    border-radius: 8px;
    position: relative;
    overflow: hidden;
}

.stat-segment-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--accent-green), var(--accent-blue));
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 700;
    transition: width 1s ease-out;
    box-shadow: 0 0 20px var(--accent-green);
}

/* MATRIX VISUAL */
.matrix-visual canvas {
    width: 100% !important;
    height: 250px !important;
    background: #000;
    border-radius: 8px;
}

/* RATIO PANEL */
.ratio-panel {
    margin-top: 2rem;
    padding: 2rem;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 8px;
}

.ratio-panel h3 {
    font-size: 1.1rem;
    margin-bottom: 1.5rem;
    color: var(--text-primary);
}

.ratio-bars {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.ratio-bar-item {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.ratio-bar-label {
    width: 100px;
    font-size: 1.25rem;
    color: var(--accent-green);
    font-weight: 700;
}

.ratio-bar-container {
    flex: 1;
    position: relative;
}

.ratio-bar-value {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    color: white;
    font-weight: 600;
    font-size: 0.875rem;
    z-index: 2;
}

/* FOOTER */
footer {
    margin-top: 4rem;
    padding: 2rem;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.875rem;
    border-top: 1px solid var(--border);
}

.footer-note {
    margin-top: 0.5rem;
    font-size: 0.75rem;
}

/* RESPONSIVE */
@media (max-width: 768px) {
    header {
        flex-direction: column;
        gap: 1rem;
        text-align: center;
    }

    .main-nav {
        padding: 0.5rem 1rem;
    }

    .nav-btn {
        padding: 0.5rem 0.75rem;
        font-size: 0.75rem;
    }

    .main-container {
        padding: 1rem;
    }

    .museum-card {
        padding: 1.5rem;
    }

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

    canvas {
        height: 300px;
    }
    
    .dashboard-modal {
        padding: 1rem;
    }
    
    .dashboard-content {
        padding: 1rem;
    }
    
    .dashboard-grid {
        grid-template-columns: 1fr;
    }
    
    .controls {
        flex-direction: column;
        align-items: stretch;
    }
    
    .controls input[type="range"] {
        width: 100%;
    }
    
    .action-btn {
        width: 100%;
        justify-content: center;
    }
}
