@import url('https://gs.jurieo.com/gemini/fonts-googleapis/css2?family=Noto+Serif+SC:wght@400;700&family=Noto+Sans+SC:wght@300;400&display=swap');

:root {
    --space-black: #050505;
    --star-gold: #fde047;
    --accent-blue: #60a5fa;
}

body {
    background-color: var(--space-black);
    color: #f3f4f6;
    font-family: 'Noto Sans SC', sans-serif;
    margin: 0;
    overflow: hidden;
    height: 100vh;
}

.serif { font-family: 'Noto Serif SC', serif; }

canvas {
    display: block;
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    touch-action: none;
}

.bottom-gradient {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 60vh;
    background: linear-gradient(to top,
        rgba(5, 5, 5, 1) 0%,
        rgba(5, 5, 5, 0.9) 20%,
        rgba(5, 5, 5, 0.5) 50%,
        transparent 100%);
    z-index: 5;
    pointer-events: none;
}

#ui-layer {
    position: relative;
    z-index: 10;
    height: 100vh;
    width: 100vw;
    pointer-events: none;
}

.quote-container {
    position: fixed;
    top: 3rem;
    right: 3rem;
    max-width: 320px;
    text-align: right;
    z-index: 20;
    transition: opacity 0.8s ease;
    pointer-events: none;
}

.fact-container {
    position: fixed;
    top: 3rem;
    left: 3rem;
    max-width: 340px;
    text-align: left;
    z-index: 20;
    transition: opacity 0.8s ease;
    pointer-events: none;
}

@media (max-width: 768px) {
    .quote-container { top: 1.5rem; right: 1rem; max-width: 42%; }
    .fact-container { top: 1.5rem; left: 1.1rem; max-width: 48%; }
    .quote-text { font-size: 0.85rem !important; line-height: 1.4 !important; }
    .fact-text { font-size: 0.75rem !important; line-height: 1.5 !important; }
    .fact-label, .quote-author { font-size: 0.65rem !important; }
}

.fade-out { opacity: 0; }

.quote-text {
    font-family: 'Noto Serif SC', serif;
    font-style: italic;
    color: rgba(255, 255, 255, 0.9);
    font-size: 1rem;
    line-height: 1.6;
    margin-bottom: 0.75rem;
    text-shadow: 0 2px 4px rgba(0,0,0,0.8);
}

.quote-author {
    font-family: 'Noto Sans SC', sans-serif;
    color: var(--star-gold);
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.15em;
    text-shadow: 0 2px 4px rgba(0,0,0,0.8);
}

.fact-label {
    font-family: 'Noto Sans SC', sans-serif;
    color: var(--accent-blue);
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    margin-bottom: 0.5rem;
    display: block;
    font-weight: bold;
    text-shadow: 0 2px 4px rgba(0,0,0,0.8);
}

.fact-text {
    font-family: 'Noto Sans SC', sans-serif;
    color: rgba(255, 255, 255, 0.8);
    font-size: 0.9rem;
    line-height: 1.7;
    text-shadow: 0 2px 4px rgba(0,0,0,0.8);
    white-space: pre-line;
}

.step {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-end;
    padding-bottom: 12vh;
    text-align: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 1s ease, transform 1s cubic-bezier(0.2, 0.8, 0.2, 1);
    transform: translateY(30px);
    pointer-events: none;
    z-index: 1;
}

@media (max-width: 768px) { .step { padding-bottom: 16vh; } }

.step.active {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
    pointer-events: auto;
    z-index: 20;
}

.step.hidden {
    opacity: 0;
    transform: translateY(-20px);
    pointer-events: none;
    visibility: hidden;
}

.action-btn {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.15);
    color: rgba(255, 255, 255, 0.7);
    padding: 0.6rem 1.8rem;
    border-radius: 9999px;
    font-family: 'Noto Serif SC', serif;
    font-size: 0.95rem;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.25, 1, 0.5, 1);
    letter-spacing: 0.05em;
    backdrop-filter: blur(4px);
    white-space: nowrap;
}

.action-btn:hover:not(:disabled) {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.5);
    color: white;
    transform: translateY(-2px);
}

.action-btn:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

.action-btn.primary-path {
    border-color: rgba(253, 224, 71, 0.5);
    color: #fefce8;
    background: rgba(253, 224, 71, 0.05);
    box-shadow: 0 0 15px rgba(253, 224, 71, 0.1);
    font-weight: 700;
    font-size: 1.1rem;
    padding: 0.9rem 3rem;
    letter-spacing: 0.15em;
}

.action-btn.primary-path:hover:not(:disabled) {
    background: rgba(253, 224, 71, 0.15);
    border-color: var(--star-gold);
    box-shadow: 0 0 30px rgba(253, 224, 71, 0.3);
}

.branch-container {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    align-items: center;
    margin-top: 1.5rem;
}

.sub-options {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
    justify-content: center;
}

@media (max-width: 640px) {
    .sub-options { flex-direction: column; gap: 0.8rem; width: 80%; }
    .action-btn { width: 100%; }
}

.badge {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.4em;
    color: var(--star-gold);
    margin-bottom: 1rem;
    display: inline-block;
    border-bottom: 1px solid rgba(253, 224, 71, 0.3);
    padding-bottom: 4px;
}

.progress-container {
    position: fixed;
    bottom: 3rem;
    left: 0;
    width: 100%;
    display: flex;
    justify-content: center;
    gap: 1rem;
    z-index: 50;
    pointer-events: none;
}

.dot {
    width: 6px; height: 6px;
    background: rgba(255,255,255,0.15);
    border-radius: 50%;
    transition: all 0.5s ease;
}
.dot.active { background: var(--star-gold); transform: scale(1.3); box-shadow: 0 0 10px var(--star-gold); }

.preview-note {
    margin-top: 1.2rem;
    font-size: 0.7rem;
    letter-spacing: 0.2em;
    color: rgba(147, 169, 176, 0.55);
}

@media (max-width: 640px) {
    #step-3 .branch-container { gap: 0.9rem; margin-top: 0.9rem; }
    #step-3 .sub-options { flex-direction: row; gap: 0.5rem; width: auto; }
    #step-3 .sub-options .action-btn { width: auto; font-size: 0.75rem; padding: 0.5rem 0.8rem; }
}

@media (max-width: 640px) {
    #step-5 > div { width: 100%; }
    #step-5 .branch-container { gap: 0.9rem; margin-top: 0.9rem; }
    #step-5 .primary-path { width: auto; max-width: 100%; font-size: 0.9rem; padding: 0.8rem 1.2rem; letter-spacing: 0.08em; }
    #step-5 .sub-options { flex-direction: row; gap: 0.5rem; width: auto; }
    #step-5 .sub-options .action-btn { width: auto; font-size: 0.75rem; padding: 0.5rem 0.8rem; }
}

/* 地球信息位于球体下方；底部为固定进度点留出空间。 */
#step-6 {
    top: 70%;
    bottom: calc(3rem + 1rem);
    justify-content: flex-start;
    padding: 0 1rem;
    box-sizing: border-box;
}

#step-6 .earth-info {
    box-sizing: border-box;
    width: 100%;
    max-width: 36rem;
    min-height: 0;
    padding: 0 0.25rem 0.25rem;
    overflow-y: auto;
    overflow-wrap: anywhere;
    overscroll-behavior: contain;
}

#step-6 .badge { margin-bottom: 0.375rem; line-height: 1.4; }
#step-6 h1 { margin: 0 0 0.5rem; font-size: clamp(1.5rem, 3vw, 2rem); line-height: 1.15; }
#step-6 p { margin: 0 0 0.75rem; font-size: 0.875rem; line-height: 1.65; }
#step-6 .action-btn {
    box-sizing: border-box;
    width: auto;
    max-width: 100%;
    padding: 0.5rem 1.4rem;
    font-size: 0.875rem;
    line-height: 1.4;
    white-space: normal;
}

@media (max-height: 760px) {
    #step-6 .badge { margin-bottom: 0.25rem; }
    #step-6 h1 { margin-bottom: 0.25rem; font-size: 1.5rem; }
    #step-6 p { margin-bottom: 0.375rem; font-size: 0.8rem; line-height: 1.45; }
    #step-6 .action-btn { padding: 0.375rem 1.2rem; font-size: 0.8rem; }
}

@media (max-height: 640px) {
    #step-6 { top: 67%; bottom: 3.75rem; }
    #step-6 .badge { font-size: 0.6rem; margin-bottom: 0.125rem; }
    #step-6 h1 { font-size: 1.2rem; }
    #step-6 p { font-size: 0.72rem; margin-bottom: 0.25rem; }
    #step-6 .action-btn { font-size: 0.72rem; padding: 0.3rem 1.1rem; }
}

@media (max-height: 440px) and (min-width: 600px) {
    #step-6 .earth-info { display: grid; grid-template-columns: auto 1fr auto; align-items: center; column-gap: 1rem; max-width: 48rem; }
    #step-6 .badge { grid-column: 1; grid-row: 1; }
    #step-6 h1 { grid-column: 1; grid-row: 2; margin: 0; }
    #step-6 p { grid-column: 2; grid-row: 1 / 3; margin: 0; }
    #step-6 .action-btn { grid-column: 3; grid-row: 1 / 3; }
}

/* ---- WebGL 降级 ---- */
.fallback {
    position: fixed;
    inset: 0;
    display: none;
    place-items: center;
    padding: 2em;
    text-align: center;
    font-size: 14px;
    line-height: 2;
    letter-spacing: 0.06em;
    color: #93a9b0;
    z-index: 100;
    background: var(--space-black);
}
.fallback b {
    display: block;
    margin-bottom: 0.6em;
    font-weight: 600;
    letter-spacing: 0.2em;
    color: #e9f4f6;
}
.fallback a { color: var(--accent-blue); }
body.no-webgl .fallback { display: grid; }
body.no-webgl canvas,
body.no-webgl #ui-layer,
body.no-webgl .fact-container,
body.no-webgl .quote-container,
body.no-webgl .progress-container,
body.no-webgl .bottom-gradient { display: none; }

@media (prefers-reduced-motion: reduce) {
    .step { transition: none; }
}
