/* ===== 宇宙主題 · 摩比拼音（適合5歲幼童） ===== */
@import url('https://fonts.googleapis.com/css2?family=Noto+Sans+HK:wght@400;500;700;900&display=swap');

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

:root {
    --space-dark: #0a0a2e;
    --space-mid: #1a1a4e;
    --star-yellow: #FFD700;
    --star-white: #FFF8E7;
    --planet-red: #FF6B6B;
    --planet-blue: #4ECDC4;
    --planet-green: #7BC67E;
    --planet-orange: #FF9F43;
    --planet-purple: #A29BFE;
    --planet-pink: #FD79A8;
    --rocket-red: #FF4757;
    --neon-cyan: #00E5FF;
    --neon-green: #39FF14;
    --text-bright: #FFFFFF;
    --text-soft: #CCD6F6;
    --card-glass: rgba(255,255,255,0.08);
    --card-border: rgba(255,255,255,0.15);
    --radius-lg: 24px;
    --radius-md: 16px;
    --radius-sm: 12px;
    --font-size-xl: 2.2rem;
    --font-size-lg: 1.6rem;
    --font-size-md: 1.15rem;
    --font-size-sm: 0.95rem;
}

/* ===== 星空背景 Canvas ===== */
#stars-canvas {
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    z-index: 0;
    pointer-events: none;
}

body {
    font-family: 'Noto Sans HK', 'Microsoft YaHei', 'PingFang HK', sans-serif;
    background: linear-gradient(180deg, #0a0a2e 0%, #12124a 30%, #1a1040 60%, #0d0d35 100%);
    color: var(--text-bright);
    min-height: 100vh;
    overflow-x: hidden;
    position: relative;
}

/* 大氣層光暈 */
body::before {
    content: '';
    position: fixed;
    bottom: -200px; left: 50%;
    transform: translateX(-50%);
    width: 800px; height: 400px;
    background: radial-gradient(ellipse at center, 
        rgba(0,229,255,0.08) 0%, 
        rgba(0,229,255,0.03) 40%, 
        transparent 70%);
    pointer-events: none;
    z-index: 0;
}

a { text-decoration: none; color: inherit; }
button { font-family: inherit; cursor: pointer; border: none; outline: none; }

/* ===== 主容器 ===== */
.container {
    max-width: 1000px;
    margin: 0 auto;
    padding: 0 20px;
    position: relative;
    z-index: 1;
}

/* ===== Header ===== */
.site-header {
    position: sticky;
    top: 0;
    z-index: 100;
    padding: 14px 0;
    backdrop-filter: blur(20px);
    background: rgba(10,10,46,0.85);
    border-bottom: 1px solid rgba(255,255,255,0.1);
}

.site-header .container {
    display: flex;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
}

.logo {
    font-size: 1.6rem;
    font-weight: 900;
    letter-spacing: 3px;
    background: linear-gradient(135deg, var(--star-yellow), var(--planet-orange));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    display: flex;
    align-items: center;
    gap: 8px;
}

.logo::before {
    content: '🚀';
    -webkit-text-fill-color: initial;
    font-size: 1.5rem;
    animation: rocketFloat 2s ease-in-out infinite;
}

@keyframes rocketFloat {
    0%, 100% { transform: translateY(0) rotate(-5deg); }
    50% { transform: translateY(-6px) rotate(0deg); }
}

.subtitle {
    font-size: 0.8rem;
    opacity: 0.6;
    color: var(--text-soft);
}

/* ===== Main ===== */
main.container {
    padding-top: 32px;
    padding-bottom: 64px;
    min-height: calc(100vh - 200px);
}

/* ===== Footer ===== */
.site-footer {
    background: rgba(10,10,46,0.9);
    border-top: 1px solid rgba(255,255,255,0.08);
    padding: 20px 0;
    text-align: center;
    font-size: 0.8rem;
    color: rgba(255,255,255,0.4);
    position: relative;
    z-index: 1;
}

.site-footer::before {
    content: '🌍 🌙 ⭐ 🪐 ☄️';
    display: block;
    font-size: 1.2rem;
    margin-bottom: 8px;
    letter-spacing: 10px;
}

/* ===== 共通動畫 ===== */
@keyframes twinkle {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.4; transform: scale(0.7); }
}

@keyframes floatUpDown {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

@keyframes pulse {
    0%, 100% { box-shadow: 0 0 10px var(--neon-cyan); }
    50% { box-shadow: 0 0 30px var(--neon-cyan), 0 0 60px rgba(0,229,255,0.3); }
}

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

@keyframes bounceIn {
    0% { transform: scale(0.3); opacity: 0; }
    50% { transform: scale(1.08); }
    70% { transform: scale(0.95); }
    100% { transform: scale(1); opacity: 1; }
}

@keyframes orbitSpin {
    from { transform: rotate(0deg) translateX(80px) rotate(0deg); }
    to { transform: rotate(360deg) translateX(80px) rotate(-360deg); }
}

@keyframes shootingStar {
    0% { transform: translateX(0) translateY(0); opacity: 1; }
    100% { transform: translateX(-600px) translateY(400px); opacity: 0; }
}

/* ===== Hero ===== */
.hero {
    text-align: center;
    padding: 50px 20px;
    margin-bottom: 40px;
    position: relative;
    background: linear-gradient(135deg, 
        rgba(0,229,255,0.05) 0%, 
        rgba(162,155,254,0.05) 50%, 
        rgba(255,107,107,0.05) 100%);
    border-radius: var(--radius-lg);
    border: 1px solid rgba(255,255,255,0.1);
    animation: slideInUp 0.8s ease-out;
}

.hero::before {
    content: '🌌';
    font-size: 4rem;
    display: block;
    margin-bottom: 12px;
    animation: floatUpDown 3s ease-in-out infinite;
}

.hero h1 {
    font-size: 2.2rem;
    font-weight: 900;
    background: linear-gradient(135deg, var(--star-yellow), var(--planet-orange), var(--planet-pink));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 12px;
    letter-spacing: 3px;
}

.hero-desc {
    font-size: 1.15rem;
    color: var(--text-soft);
    margin-bottom: 8px;
    line-height: 1.6;
}

.hero-desc strong {
    color: var(--star-yellow);
}

.hero-note {
    display: inline-block;
    font-size: 0.95rem;
    color: var(--planet-green);
    background: rgba(123,198,126,0.1);
    padding: 6px 20px;
    border-radius: 20px;
    border: 1px solid rgba(123,198,126,0.3);
}

/* ===== Stage Section ===== */
.stage-section {
    margin-bottom: 40px;
    animation: slideInUp 0.6s ease-out;
    animation-fill-mode: both;
}

.stage-section:nth-child(2) { animation-delay: 0.1s; }
.stage-section:nth-child(3) { animation-delay: 0.2s; }
.stage-section:nth-child(4) { animation-delay: 0.3s; }
.stage-section:nth-child(5) { animation-delay: 0.4s; }
.stage-section:nth-child(6) { animation-delay: 0.5s; }

.stage-title {
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--star-yellow);
    padding: 12px 20px;
    position: relative;
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 20px;
    background: rgba(255,215,0,0.06);
    border-radius: var(--radius-sm);
    border-left: 4px solid var(--star-yellow);
}

/* 階段星球 icon */
.stage-icon {
    font-size: 2rem;
    animation: floatUpDown 3s ease-in-out infinite;
}

.lesson-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
    gap: 14px;
}

.lesson-card {
    background: var(--card-glass);
    backdrop-filter: blur(10px);
    border: 1px solid var(--card-border);
    border-radius: var(--radius-md);
    padding: 18px 12px;
    text-align: center;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
    gap: 8px;
    position: relative;
    overflow: hidden;
}

.lesson-card::before {
    content: '';
    position: absolute;
    top: -50%; left: -50%;
    width: 200%; height: 200%;
    background: radial-gradient(circle, rgba(255,255,255,0.1) 0%, transparent 60%);
    opacity: 0;
    transition: opacity 0.3s;
}

.lesson-card:hover {
    transform: translateY(-4px) scale(1.03);
    border-color: var(--neon-cyan);
    box-shadow: 0 8px 32px rgba(0,229,255,0.2);
}

.lesson-card:hover::before { opacity: 1; }

.lesson-card.completed-card {
    border-color: var(--planet-green);
    background: rgba(123,198,126,0.1);
}

.lesson-card.completed-card::after {
    content: '⭐';
    position: absolute;
    top: 6px; right: 10px;
    font-size: 0.9rem;
}

.lesson-num {
    font-size: 0.7rem;
    color: var(--text-soft);
    opacity: 0.7;
}

.lesson-pinyin {
    font-size: 1.6rem;
    font-weight: 900;
    background: linear-gradient(135deg, var(--neon-cyan), var(--planet-blue));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.lesson-name {
    font-size: 0.85rem;
    color: var(--text-soft);
}

/* ===== Lesson Navigation ===== */
.lesson-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    margin-bottom: 28px;
    flex-wrap: wrap;
}

.lesson-nav-bottom { margin-top: 40px; margin-bottom: 0; }

.nav-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 12px 24px;
    background: linear-gradient(135deg, rgba(0,229,255,0.2), rgba(78,205,196,0.2));
    color: var(--neon-cyan);
    border-radius: 50px;
    font-size: 1rem;
    font-weight: 700;
    transition: all 0.3s;
    border: 1px solid rgba(0,229,255,0.3);
}

.nav-btn:hover {
    background: linear-gradient(135deg, rgba(0,229,255,0.35), rgba(78,205,196,0.35));
    box-shadow: 0 0 24px rgba(0,229,255,0.3);
    transform: scale(1.05);
}

.nav-home {
    background: linear-gradient(135deg, rgba(255,159,67,0.2), rgba(253,121,168,0.2));
    color: var(--planet-orange);
    border-color: rgba(255,159,67,0.3);
}

.nav-home:hover {
    background: linear-gradient(135deg, rgba(255,159,67,0.35), rgba(253,121,168,0.35));
    box-shadow: 0 0 24px rgba(255,159,67,0.3);
}

.nav-disabled {
    padding: 12px 24px;
    background: rgba(255,255,255,0.05);
    color: rgba(255,255,255,0.3);
    border-radius: 50px;
    font-size: 1rem;
    cursor: not-allowed;
}

/* ===== Lesson Detail ===== */
.lesson-detail {
    animation: slideInUp 0.5s ease-out;
}

.lesson-header {
    text-align: center;
    margin-bottom: 32px;
}

.stage-badge {
    display: inline-block;
    background: rgba(0,229,255,0.1);
    color: var(--neon-cyan);
    padding: 6px 20px;
    border-radius: 20px;
    font-size: 0.85rem;
    border: 1px solid rgba(0,229,255,0.25);
    margin-bottom: 14px;
}

.lesson-header h1 {
    font-size: 1.8rem;
    font-weight: 900;
    background: linear-gradient(135deg, var(--star-yellow), var(--star-white));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* ===== Pinyin Display ===== */
.pinyin-display {
    display: flex;
    justify-content: center;
    margin-bottom: 32px;
}

.pinyin-card {
    background: var(--card-glass);
    backdrop-filter: blur(20px);
    border: 2px solid var(--neon-cyan);
    border-radius: var(--radius-lg);
    padding: 32px 56px;
    text-align: center;
    animation: pulse 3s ease-in-out infinite;
    position: relative;
}

.pinyin-card::before {
    content: '🛸';
    position: absolute;
    top: -20px; left: -16px;
    font-size: 1.5rem;
    animation: floatUpDown 2.5s ease-in-out infinite;
}

.pinyin-big {
    display: block;
    font-size: 5rem;
    font-weight: 900;
    background: linear-gradient(135deg, var(--neon-cyan), var(--planet-blue), var(--planet-purple));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 16px;
    text-shadow: none;
}

.btn-speak {
    padding: 14px 36px;
    font-size: 1.2rem;
    font-weight: 700;
    background: linear-gradient(135deg, var(--planet-green), #45a049);
    color: #fff;
    border-radius: 50px;
    transition: all 0.3s;
    letter-spacing: 2px;
    box-shadow: 0 4px 20px rgba(123,198,126,0.4);
}

.btn-speak:hover {
    transform: scale(1.08);
    box-shadow: 0 6px 28px rgba(123,198,126,0.6);
}

.btn-speak:active { transform: scale(0.95); }

/* ===== Mnemonic Box ===== */
.mnemonic-box {
    background: linear-gradient(135deg, 
        rgba(255,215,0,0.08), 
        rgba(255,159,67,0.08));
    border-left: 4px solid var(--star-yellow);
    padding: 20px 24px;
    border-radius: 0 var(--radius-md) var(--radius-md) 0;
    margin-bottom: 32px;
}

.mnemonic-box h3 {
    font-size: 1.05rem;
    color: var(--star-yellow);
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.mnemonic-box h3::before { content: '💡'; }

.mnemonic-box p {
    font-size: 1.2rem;
    line-height: 1.7;
    color: var(--text-soft);
}

/* ===== Tones Section ===== */
.tones-section { margin-bottom: 32px; }

.tones-section h2,
.examples-section h2,
.practice-section h2 {
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--neon-cyan);
    margin-bottom: 18px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.tones-section h2::before { content: '🎵'; }
.examples-section h2::before { content: '📖'; }
.practice-section h2::before { content: '✏️'; }

.tone-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(270px, 1fr));
    gap: 14px;
}

.tone-card {
    display: flex;
    align-items: center;
    gap: 14px;
    background: var(--card-glass);
    backdrop-filter: blur(10px);
    border: 1px solid var(--card-border);
    border-radius: var(--radius-md);
    padding: 16px 20px;
    transition: all 0.3s;
}

.tone-card:hover {
    border-color: var(--planet-purple);
    box-shadow: 0 4px 20px rgba(162,155,254,0.2);
}

.tone-mark {
    font-size: 2.4rem;
    font-weight: 900;
    min-width: 70px;
    text-align: center;
    background: linear-gradient(135deg, var(--neon-cyan), var(--planet-blue));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.tone-info {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.tone-label {
    font-size: 0.75rem;
    color: rgba(255,255,255,0.5);
}

.tone-word {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--star-yellow);
}

.tone-char {
    font-size: 0.85rem;
    color: var(--text-soft);
}

.btn-speak-small {
    padding: 10px 16px;
    font-size: 0.95rem;
    font-weight: 700;
    background: linear-gradient(135deg, rgba(0,229,255,0.3), rgba(78,205,196,0.3));
    color: var(--neon-cyan);
    border: 1px solid rgba(0,229,255,0.3);
    border-radius: 50px;
    transition: all 0.3s;
}

.btn-speak-small:hover {
    background: linear-gradient(135deg, rgba(0,229,255,0.5), rgba(78,205,196,0.5));
    box-shadow: 0 0 18px rgba(0,229,255,0.3);
    transform: scale(1.08);
}

.btn-speak-small:active { transform: scale(0.93); }

/* ===== Examples ===== */
.examples-section { margin-bottom: 32px; }

.tone-example-group {
    margin-bottom: 18px;
}

.tone-group-title {
    font-size: 1rem;
    font-weight: 700;
    color: var(--star-yellow);
    margin-bottom: 10px;
    padding-left: 12px;
    border-left: 3px solid var(--star-yellow);
    display: flex;
    align-items: center;
    gap: 8px;
}

.tone-group-title::before {
    font-size: 1.1rem;
}

.tone-example-group:nth-child(1) .tone-group-title::before { content: '1️⃣'; }
.tone-example-group:nth-child(2) .tone-group-title::before { content: '2️⃣'; }
.tone-example-group:nth-child(3) .tone-group-title::before { content: '3️⃣'; }
.tone-example-group:nth-child(4) .tone-group-title::before { content: '4️⃣'; }

.example-list {
    display: flex;
    flex-wrap: wrap;
    gap: 14px;
}

.example-card {
    display: flex;
    align-items: center;
    gap: 10px;
    background: linear-gradient(135deg, 
        rgba(162,155,254,0.1), 
        rgba(0,229,255,0.1));
    padding: 12px 18px;
    border-radius: var(--radius-md);
    border: 1px solid rgba(162,155,254,0.25);
    transition: all 0.3s;
    min-width: 180px;
}

.example-card:hover {
    background: linear-gradient(135deg, 
        rgba(162,155,254,0.2), 
        rgba(0,229,255,0.2));
    border-color: rgba(162,155,254,0.5);
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(162,155,254,0.15);
}

.example-word {
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--text-bright);
    min-width: 50px;
}

.example-pinyin {
    font-size: 0.85rem;
    color: var(--neon-cyan);
    font-weight: 500;
    flex: 1;
}

.btn-speak-tiny {
    width: 34px; height: 34px;
    font-size: 0.85rem;
    background: linear-gradient(135deg, rgba(123,198,126,0.3), rgba(123,198,126,0.15));
    border: 1px solid rgba(123,198,126,0.3);
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.btn-speak-tiny:hover {
    background: linear-gradient(135deg, rgba(123,198,126,0.5), rgba(123,198,126,0.3));
    transform: scale(1.12);
    box-shadow: 0 0 12px rgba(123,198,126,0.35);
}

.btn-speak-tiny:active { transform: scale(0.92); }

/* ===== Write Practice ===== */
.practice-section { margin-bottom: 32px; }

.write-practice {
    background: var(--card-glass);
    backdrop-filter: blur(10px);
    border: 1px solid var(--card-border);
    border-radius: var(--radius-lg);
    padding: 24px;
}

.write-zone {
    min-height: 130px;
    border: 2px dashed rgba(255,255,255,0.2);
    border-radius: var(--radius-md);
    padding: 20px;
    font-size: 1.5rem;
    margin: 16px 0;
    outline: none;
    line-height: 2;
    background: rgba(255,255,255,0.03);
    color: var(--text-bright);
    transition: border-color 0.3s;
}

.write-zone:focus {
    border-color: var(--neon-cyan);
    border-style: solid;
    background: rgba(0,229,255,0.04);
}

.write-zone:empty::before {
    content: attr(placeholder);
    color: rgba(255,255,255,0.2);
}

.btn-clear-write {
    padding: 10px 28px;
    background: rgba(255,255,255,0.1);
    color: var(--text-soft);
    border-radius: 50px;
    font-size: 0.95rem;
    font-weight: 600;
    transition: all 0.3s;
}

.btn-clear-write:hover {
    background: rgba(255,255,255,0.2);
}

/* ===== Complete Section ===== */
.complete-section {
    text-align: center;
    background: linear-gradient(135deg, 
        rgba(57,255,20,0.05), 
        rgba(123,198,126,0.05));
    border: 2px solid var(--planet-green);
    border-radius: var(--radius-lg);
    padding: 32px;
    margin-bottom: 20px;
    position: relative;
    overflow: hidden;
}

.complete-section::before {
    content: '🎯';
    font-size: 2.5rem;
    display: block;
    margin-bottom: 8px;
    animation: floatUpDown 2s ease-in-out infinite;
}

.complete-hint {
    font-size: 1.15rem;
    margin-bottom: 14px;
    color: var(--text-soft);
}

.btn-complete {
    padding: 16px 48px;
    font-size: 1.3rem;
    font-weight: 900;
    background: linear-gradient(135deg, var(--rocket-red), var(--planet-orange));
    color: #fff;
    border-radius: 50px;
    transition: all 0.3s;
    letter-spacing: 3px;
    box-shadow: 0 4px 24px rgba(255,71,87,0.5);
    position: relative;
}

.btn-complete::after {
    content: '🚀';
    position: absolute;
    right: -8px; top: -16px;
    font-size: 1.5rem;
    transition: all 0.5s;
}

.btn-complete:hover {
    transform: scale(1.06);
    box-shadow: 0 6px 32px rgba(255,71,87,0.7);
}

.btn-complete:hover::after {
    animation: rocketLaunch 0.6s ease-out forwards;
}

@keyframes rocketLaunch {
    0% { transform: translateY(0) scale(1); opacity: 1; }
    50% { transform: translateY(-40px) scale(1.3); opacity: 1; }
    100% { transform: translateY(-100px) scale(0.3); opacity: 0; }
}

.btn-complete:active { transform: scale(0.95); }

.btn-complete.completed {
    background: linear-gradient(135deg, var(--planet-green), #45a049);
    box-shadow: 0 4px 20px rgba(123,198,126,0.4);
    cursor: default;
}

.complete-status {
    display: block;
    margin-top: 14px;
    font-size: 0.9rem;
    color: var(--planet-green);
}

/* ===== 慶祝動畫 ===== */
.celebrate-overlay {
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    pointer-events: none;
    z-index: 999;
}

.celebrate-star {
    position: absolute;
    font-size: 2rem;
    animation: celebrateBurst 1.5s ease-out forwards;
}

@keyframes celebrateBurst {
    0% { transform: translate(0, 0) scale(1); opacity: 1; }
    100% { transform: translate(var(--dx), var(--dy)) scale(0); opacity: 0; }
}

/* ===== RWD ===== */
@media (max-width: 600px) {
    :root {
        --font-size-xl: 1.6rem;
        --font-size-lg: 1.3rem;
    }

    .hero h1 { font-size: 1.5rem; }
    .hero::before { font-size: 3rem; }
    
    .lesson-header h1 { font-size: 1.3rem; }
    .pinyin-big { font-size: 3.5rem; }
    .pinyin-card { padding: 24px 32px; }
    
    .lesson-grid { grid-template-columns: repeat(auto-fill, minmax(100px, 1fr)); }
    .tone-grid { grid-template-columns: 1fr; }
    
    .lesson-nav { gap: 6px; }
    .nav-btn { padding: 10px 16px; font-size: 0.9rem; }
    
    .tone-mark { font-size: 1.8rem; min-width: 50px; }
}
