/* ================= 太阳系星图 · 数字星图台 ================= */
:root {
    --void-0: #04070f;
    --void-1: #060b18;
    --starlight: #eaf2ff;
    --brass: #d4a94e;
    --brass-dim: rgba(212, 169, 78, 0.35);
    --indigo: #6b7fd7;
    --muted: #5e7390;
    --line: rgba(234, 242, 255, 0.08);
    --serif: "Noto Serif SC", "Songti SC", serif;
    --sans: "Noto Sans SC", "PingFang SC", sans-serif;
    --mono: "JetBrains Mono", ui-monospace, monospace;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
::-webkit-scrollbar { display: none; }

body {
    background:
        radial-gradient(90% 60% at 50% 40%, #0a1226 0%, var(--void-1) 55%, var(--void-0) 100%);
    color: var(--starlight);
    font-family: var(--sans);
    height: 100vh;
    overflow: hidden;
    -webkit-font-smoothing: antialiased;
}

::selection { background: rgba(212, 169, 78, 0.35); }
button { font-family: inherit; }
:focus-visible { outline: 2px solid var(--brass); outline-offset: 2px; border-radius: 6px; }

.mono-label {
    font-family: var(--mono);
    font-size: 0.62rem;
    font-weight: 700;
    letter-spacing: 0.25em;
    color: var(--muted);
}

.mono-val {
    font-family: var(--mono);
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--brass);
}

/* ---- 标题 ---- */
.atlas-title {
    position: fixed;
    top: 22px;
    left: 26px;
    z-index: 10;
    pointer-events: none;
    border-left: 2px solid var(--brass);
    padding-left: 14px;
}

.eyebrow {
    font-family: var(--mono);
    font-size: 0.62rem;
    letter-spacing: 0.3em;
    color: var(--brass);
    margin-bottom: 6px;
}

.atlas-title h1 {
    font-family: var(--serif);
    font-weight: 900;
    font-size: clamp(1.6rem, 3.6vw, 2.4rem);
    letter-spacing: 0.14em;
    background: linear-gradient(150deg, #fff, #cfdcf5 60%, #8fa5cc);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.atlas-title .hint {
    margin-top: 8px;
    font-size: 0.72rem;
    letter-spacing: 0.2em;
    color: var(--muted);
}

/* ---- 画布 ---- */
#universe {
    width: 100vw;
    height: 100vh;
    cursor: grab;
    touch-action: none;
}
#universe.grabbing { cursor: grabbing; }

#solar-system { width: 100%; height: 100%; display: block; }

/* 太阳 */
.sun-glow { animation: sunPulse 5s ease-in-out infinite; }
@keyframes sunPulse {
    0%, 100% { filter: drop-shadow(0 0 18px rgba(255, 200, 50, 0.55)); }
    50% { filter: drop-shadow(0 0 42px rgba(255, 220, 100, 0.85)); }
}

.corona {
    transform-box: fill-box;
    transform-origin: center;
    animation: coronaBreathe 7s ease-in-out infinite;
}
@keyframes coronaBreathe {
    0%, 100% { transform: scale(1); opacity: 0.8; }
    50% { transform: scale(1.12); opacity: 1; }
}

/* 天球分划 */
.grat-circle {
    fill: none;
    stroke: rgba(234, 242, 255, 0.045);
    stroke-width: 1;
    stroke-dasharray: 3 7;
}
.grat-spoke { stroke: rgba(234, 242, 255, 0.03); stroke-width: 1; }

/* 星星闪烁 */
.tw1 { animation: twinkle 3.2s ease-in-out infinite; }
.tw2 { animation: twinkle 4.6s ease-in-out infinite 1.1s; }
.tw3 { animation: twinkle 5.8s ease-in-out infinite 2.2s; }
@keyframes twinkle {
    0%, 100% { opacity: var(--o, 0.8); }
    50% { opacity: calc(var(--o, 0.8) * 0.25); }
}

/* 流星 */
.meteor { animation: meteorFly 1.1s ease-out forwards; }
@keyframes meteorFly {
    0% { opacity: 0; transform: translate(0, 0); }
    12% { opacity: 1; }
    100% { opacity: 0; transform: translate(var(--mx), var(--my)); }
}

/* 轨道 */
.orbit {
    fill: none;
    stroke: rgba(234, 242, 255, 0.09);
    stroke-width: 1;
    transition: stroke 0.3s, stroke-width 0.3s;
}
.orbit.active {
    stroke: var(--brass-dim);
    stroke-width: 1.8;
}

.orbit-label {
    font-family: var(--mono);
    font-size: 9px;
    fill: rgba(94, 115, 144, 0.75);
    letter-spacing: 0.1em;
    pointer-events: none;
}

/* 行星 */
.planet-group { cursor: pointer; }
.planet-body { transition: filter 0.25s; }
.planet-group:hover .planet-body,
.planet-group.selected .planet-body {
    filter: brightness(1.35) drop-shadow(0 0 12px rgba(255, 255, 255, 0.5));
}

.saturn-ring {
    stroke: rgba(210, 180, 140, 0.55);
    fill: none;
    stroke-width: 3;
}

.planet-label {
    font-family: var(--sans);
    font-size: 11px;
    fill: rgba(234, 242, 255, 0.75);
    letter-spacing: 0.15em;
    text-anchor: middle;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.3s;
}
.show-labels .planet-label { opacity: 1; }

/* 观测十字环 */
.reticle { pointer-events: none; transition: opacity 0.3s; }
.reticle-ring {
    fill: none;
    stroke: var(--brass);
    stroke-width: 1.2;
    stroke-dasharray: 4 5;
    animation: reticleSpin 14s linear infinite;
}
@keyframes reticleSpin {
    to { transform: rotate(360deg); }
}
.reticle-ring {
    transform-box: fill-box;
    transform-origin: center;
}
.reticle-tick {
    stroke: var(--brass);
    stroke-width: 1.4;
    stroke-linecap: round;
}

/* ---- 信息卡 ---- */
.info-card {
    position: fixed;
    top: 22px;
    right: 26px;
    z-index: 20;
    width: 264px;
    background: rgba(8, 13, 26, 0.82);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border: 1px solid var(--line);
    border-left: 3px solid var(--brass);
    border-radius: 14px;
    padding: 18px 18px 16px;
    box-shadow: 0 20px 50px -14px rgba(0, 0, 0, 0.8);
    transition: opacity 0.35s, transform 0.35s cubic-bezier(0.22, 1, 0.36, 1);
}
.info-card.hidden {
    opacity: 0;
    transform: translateX(16px);
    pointer-events: none;
}

.info-close {
    position: absolute;
    top: 10px;
    right: 12px;
    background: none;
    border: none;
    color: var(--muted);
    font-size: 1.1rem;
    cursor: pointer;
    line-height: 1;
    padding: 4px;
    transition: color 0.2s;
}
.info-close:hover { color: var(--starlight); }

.info-card h2 {
    font-family: var(--serif);
    font-weight: 900;
    font-size: 1.45rem;
    letter-spacing: 0.06em;
    margin: 8px 0 12px;
}

.info-rows { display: flex; flex-direction: column; }
.info-rows div {
    display: flex;
    justify-content: space-between;
    padding: 6px 0;
    border-bottom: 1px solid var(--line);
    font-size: 0.82rem;
}
.info-rows dt { color: var(--muted); letter-spacing: 0.1em; }
.info-rows dd { font-family: var(--mono); font-size: 0.78rem; color: var(--starlight); }

.info-desc {
    margin-top: 12px;
    font-size: 0.8rem;
    line-height: 1.85;
    color: var(--muted);
}

/* ---- 控制台 ---- */
.console {
    position: fixed;
    bottom: 22px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 10;
    display: flex;
    align-items: center;
    gap: 18px;
    width: min(92vw, 640px);
    padding: 12px 18px;
    background: rgba(8, 13, 26, 0.78);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border: 1px solid var(--line);
    border-top: 1px solid var(--brass-dim);
    border-radius: 16px;
    box-shadow: 0 20px 50px -14px rgba(0, 0, 0, 0.8);
}

.play-btn {
    flex-shrink: 0;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: none;
    cursor: pointer;
    color: #241a04;
    background: linear-gradient(135deg, #ecd27a, var(--brass) 60%, #a8842f);
    box-shadow: 0 6px 18px -4px rgba(212, 169, 78, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}
.play-btn:hover { transform: scale(1.06); box-shadow: 0 8px 24px -4px rgba(212, 169, 78, 0.8); }
.play-btn:active { transform: scale(0.94); }
.play-btn svg { width: 18px; height: 18px; }
.play-btn svg.hidden { display: none; }

.speed-group { flex: 1; min-width: 120px; }
.speed-head {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-bottom: 6px;
}

input[type="range"] {
    width: 100%;
    -webkit-appearance: none;
    appearance: none;
    background: transparent;
    cursor: pointer;
}
input[type="range"]::-webkit-slider-runnable-track {
    height: 3px;
    border-radius: 2px;
    background: rgba(234, 242, 255, 0.15);
}
input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 15px;
    height: 15px;
    margin-top: -6px;
    border-radius: 50%;
    background: var(--brass);
    box-shadow: 0 0 10px rgba(212, 169, 78, 0.7);
}
input[type="range"]::-moz-range-track {
    height: 3px;
    border-radius: 2px;
    background: rgba(234, 242, 255, 0.15);
}
input[type="range"]::-moz-range-thumb {
    width: 15px;
    height: 15px;
    border: none;
    border-radius: 50%;
    background: var(--brass);
    box-shadow: 0 0 10px rgba(212, 169, 78, 0.7);
}

.toggles {
    display: flex;
    align-items: center;
    gap: 14px;
    flex-shrink: 0;
}

.toggle {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.78rem;
    letter-spacing: 0.1em;
    color: var(--muted);
    cursor: pointer;
    user-select: none;
    transition: color 0.2s;
}
.toggle:hover { color: var(--starlight); }
.toggle input { accent-color: var(--brass); width: 15px; height: 15px; cursor: pointer; }

.reset-btn {
    background: transparent;
    border: 1px solid rgba(234, 242, 255, 0.16);
    color: var(--muted);
    font-size: 0.75rem;
    letter-spacing: 0.12em;
    padding: 7px 12px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
}
.reset-btn:hover { border-color: var(--brass); color: var(--brass); }

/* ---- 响应式 ---- */
@media (max-width: 640px) {
    .atlas-title { top: 14px; left: 16px; }
    .atlas-title .hint { display: none; }
    .info-card {
        top: auto;
        bottom: 96px;
        right: 12px;
        left: 12px;
        width: auto;
    }
    .console {
        bottom: 12px;
        gap: 12px;
        padding: 10px 14px;
        flex-wrap: wrap;
        justify-content: center;
    }
    .speed-group { order: 3; flex-basis: 100%; }
}

@media (prefers-reduced-motion: reduce) {
    .sun-glow, .corona, .reticle-ring, .tw1, .tw2, .tw3 { animation: none; }
    * { transition-duration: 0.01ms !important; }
}
