:root {
    color-scheme: light;
    --bg: #ffffff;
    --surface: #ffffff;
    --surface-soft: #fafafa;
    --ink: #0f0f10;
    --ink-soft: #6b6b70;
    --line: #d4d4d4;
    --line-strong: #c0c0c0;
    --accent: #2f4ad0;
    --accent-soft: #eef1fc;
    --ok: #1f9d55;
    --ok-soft: #e7f6ec;
    --bad: #c53030;
    --bad-soft: #fdecec;
    --shadow-card: 0 8px 24px -12px rgba(15, 15, 16, 0.18);
    --shadow-focus: 0 0 0 4px rgba(15, 15, 16, 0.06);
    --shadow-toplink: 0 4px 14px -6px rgba(15, 15, 16, 0.12);
}

[data-theme="dark"] {
    color-scheme: dark;
    --bg: #0c0c0e;
    --surface: #141418;
    --surface-soft: #1c1c21;
    --ink: #f5f5f7;
    --ink-soft: #9b9ba3;
    --line: #2e2e35;
    --line-strong: #44444c;
    --accent: #7c8fff;
    --accent-soft: #1c2244;
    --ok: #4ade80;
    --ok-soft: #102a1a;
    --bad: #f87171;
    --bad-soft: #2c1414;
    --shadow-card: 0 8px 24px -8px rgba(0, 0, 0, 0.6);
    --shadow-focus: 0 0 0 4px rgba(124, 143, 255, 0.18);
    --shadow-toplink: 0 4px 14px -6px rgba(0, 0, 0, 0.6);
}

* {
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Inter", "Helvetica Neue", Helvetica, Arial, sans-serif;
    font-size: 16px;
    line-height: 1.55;
    letter-spacing: -0.005em;
    -webkit-font-smoothing: antialiased;
    background: var(--bg);
    color: var(--ink);
    margin: 0;
    padding: 0;
    min-height: 100vh;
}

a {
    color: inherit;
    text-decoration: none;
}

.skip-link {
    position: absolute;
    top: -100%;
    left: 16px;
    padding: 12px 24px;
    background: var(--accent);
    color: var(--bg);
    border-radius: 0 0 12px 12px;
    font-weight: 600;
    z-index: 100;
}

.skip-link:focus {
    top: 0;
}

.universe-page {
    width: min(1120px, calc(100% - 40px));
    margin: 0 auto;
    padding: 20px 0 80px;
}

.nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 0;
    border-bottom: 1px solid var(--line);
    margin-bottom: 24px;
}

.brand {
    display: flex;
    align-items: center;
    gap: 10px;
}

.brand-mark {
    display: grid;
    place-items: center;
    width: 28px;
    height: 28px;
    background: var(--ink);
    color: var(--bg);
    border-radius: 6px;
    font-size: 14px;
}

.brand-name {
    font-weight: 600;
    font-size: 0.95rem;
    letter-spacing: -0.01em;
}

.brand-dot {
    color: var(--ink-soft);
}

.nav-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.nav-tag {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.75rem;
    color: var(--ink-soft);
    padding: 6px 12px;
    border: 1px solid var(--line);
    border-radius: 999px;
}

.theme-toggle {
    display: inline-grid;
    place-items: center;
    width: 38px;
    height: 38px;
    border: 1px solid var(--line);
    border-radius: 50%;
    background: var(--surface-soft);
    color: var(--ink);
    cursor: pointer;
    font-size: 14px;
    padding: 0;
}

.theme-toggle:hover,
.theme-toggle:focus-visible {
    background: var(--accent-soft);
    border-color: var(--accent);
    color: var(--accent);
    outline: 0;
}

.theme-toggle-icon { display: none; }
[data-theme="dark"] .theme-toggle-icon-light { display: inline-block; }
:root:not([data-theme="dark"]) .theme-toggle-icon-dark { display: inline-block; }

.breadcrumb {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 24px;
    flex-wrap: wrap;
}

.breadcrumb a {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 0.875rem;
    color: var(--ink-soft);
    padding: 8px 16px;
    border: 1px solid var(--line);
    border-radius: 999px;
    transition: all 0.2s;
}

.breadcrumb a:hover {
    color: var(--accent);
    border-color: var(--accent);
    background: var(--accent-soft);
}

#canvas-container {
    position: relative;
    width: 100%;
    height: 65vh;
    min-height: 420px;
    max-height: 750px;
    border-radius: 16px;
    overflow: hidden;
    background: #000814;
    margin-bottom: 32px;
}

#universe-canvas {
    width: 100%;
    height: 100%;
    display: block;
}

.controls-hint {
    position: absolute;
    bottom: 16px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 12px;
    font-size: 0.72rem;
    color: rgba(255, 255, 255, 0.65);
    pointer-events: none;
    transition: opacity 0.5s;
}

.controls-hint span {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: rgba(0, 0, 0, 0.55);
    padding: 7px 14px;
    border-radius: 999px;
    backdrop-filter: blur(8px);
}

.planet-info {
    position: absolute;
    top: 16px;
    right: 16px;
    background: rgba(0, 0, 0, 0.75);
    color: #fff;
    padding: 20px 24px;
    border-radius: 14px;
    max-width: 300px;
    backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    transition: opacity 0.3s, transform 0.3s;
}

.planet-info[hidden] {
    display: none;
}

.planet-info-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
}

.planet-info-dot {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    flex-shrink: 0;
    border: 2px solid rgba(255, 255, 255, 0.3);
}

.planet-info h3 {
    margin: 0;
    font-size: 1.2rem;
    font-weight: 600;
    letter-spacing: -0.02em;
}

.planet-info p {
    margin: 0 0 8px;
    font-size: 0.88rem;
    line-height: 1.55;
    color: rgba(255, 255, 255, 0.85);
}

.planet-info-stats {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 12px;
}

.planet-info-stat {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 0.72rem;
    color: rgba(255, 255, 255, 0.6);
    background: rgba(255, 255, 255, 0.08);
    padding: 4px 10px;
    border-radius: 999px;
}

.planet-info-stat i {
    font-size: 10px;
}

.planet-info-close {
    position: absolute;
    top: 10px;
    right: 12px;
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.5);
    cursor: pointer;
    font-size: 14px;
    padding: 4px;
    line-height: 1;
}

.planet-info-close:hover {
    color: rgba(255, 255, 255, 0.9);
}

.view-controls {
    position: absolute;
    bottom: 16px;
    right: 16px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.view-btn {
    display: inline-grid;
    place-items: center;
    width: 42px;
    height: 42px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 10px;
    background: rgba(0, 0, 0, 0.55);
    color: rgba(255, 255, 255, 0.8);
    cursor: pointer;
    font-size: 15px;
    padding: 0;
    backdrop-filter: blur(8px);
    transition: all 0.2s;
}

.view-btn:hover,
.view-btn:focus-visible {
    background: rgba(47, 74, 208, 0.6);
    border-color: rgba(124, 143, 255, 0.6);
    color: #fff;
}

.view-btn.active {
    background: rgba(47, 74, 208, 0.8);
    border-color: rgba(124, 143, 255, 0.8);
    color: #fff;
}

.universe-main {
    max-width: 880px;
}

.hero-title {
    font-size: clamp(2.2rem, 7vw, 5rem);
    font-weight: 600;
    letter-spacing: -0.035em;
    line-height: 1.05;
    margin-bottom: 20px;
}

.hero-lede {
    font-size: clamp(1.05rem, 2vw, 1.2rem);
    color: var(--ink-soft);
    max-width: 600px;
    line-height: 1.6;
    margin-bottom: 40px;
}

.planets-nav {
    margin-bottom: 48px;
}

.planets-nav h2 {
    font-size: 1.3rem;
    font-weight: 600;
    letter-spacing: -0.025em;
    margin-bottom: 20px;
}

.planets-grid {
    list-style: none;
    padding: 0;
    margin: 0;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 10px;
}

.planet-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    border: 1px solid var(--line);
    border-radius: 10px;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s;
    background: var(--surface);
}

.planet-item:hover {
    border-color: var(--accent);
    background: var(--accent-soft);
    color: var(--accent);
}

.planet-item.selected {
    border-color: var(--accent);
    background: var(--accent-soft);
    color: var(--accent);
    font-weight: 600;
}

.planet-dot {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    flex-shrink: 0;
}

.planet-facts {
    margin-bottom: 48px;
}

.planet-facts h2 {
    font-size: 1.3rem;
    font-weight: 600;
    letter-spacing: -0.025em;
    margin-bottom: 20px;
}

.facts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 12px;
}

.fact-card {
    padding: 20px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: var(--surface);
    transition: border-color 0.2s;
}

.fact-card:hover {
    border-color: var(--ink);
}

.fact-card-label {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    font-weight: 600;
    color: var(--ink-soft);
    margin-bottom: 6px;
}

.fact-card-value {
    font-size: 1.15rem;
    font-weight: 600;
    color: var(--ink);
}

.orbit-controls {
    margin-bottom: 48px;
}

.orbit-controls h2 {
    font-size: 1.3rem;
    font-weight: 600;
    letter-spacing: -0.025em;
    margin-bottom: 16px;
}

.speed-control {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 16px;
}

.speed-label {
    font-size: 0.88rem;
    color: var(--ink-soft);
    min-width: 70px;
}

.speed-slider {
    flex: 1;
    height: 6px;
    border-radius: 3px;
    background: var(--line);
    -webkit-appearance: none;
    appearance: none;
    outline: 0;
    cursor: pointer;
}

.speed-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: var(--accent);
    border: 3px solid var(--surface);
    box-shadow: var(--shadow-card);
    cursor: pointer;
}

.speed-slider::-moz-range-thumb {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: var(--accent);
    border: 3px solid var(--surface);
    box-shadow: var(--shadow-card);
    cursor: pointer;
}

.speed-value {
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--ink);
    min-width: 40px;
    text-align: right;
}

.toggle-row {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.toggle-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 18px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: var(--surface);
    color: var(--ink);
    font: inherit;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.toggle-btn:hover {
    border-color: var(--accent);
    background: var(--accent-soft);
    color: var(--accent);
}

.toggle-btn.active {
    background: var(--ink);
    border-color: var(--ink);
    color: var(--bg);
}

.toggle-btn i {
    font-size: 12px;
}

.foot {
    display: flex;
    justify-content: space-between;
    padding: 24px 0;
    margin-top: 64px;
    border-top: 1px solid var(--line);
    font-size: 0.875rem;
    color: var(--ink-soft);
}

@media (max-width: 760px) {
    .universe-page {
        width: calc(100% - 32px);
        padding: 16px 0 60px;
    }

    #canvas-container {
        height: 50vh;
        min-height: 300px;
        border-radius: 12px;
    }

    .controls-hint {
        flex-direction: column;
        gap: 6px;
        align-items: center;
    }

    .planet-info {
        top: auto;
        bottom: 64px;
        right: 12px;
        left: 12px;
        max-width: none;
    }

    .planets-grid {
        grid-template-columns: repeat(2, 1fr);
    }

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

    .view-controls {
        bottom: 12px;
        right: 12px;
    }

    .view-btn {
        width: 36px;
        height: 36px;
        font-size: 13px;
    }
}