:root {
    --bg-color: #0b0d17;
    --panel-bg: #15192b;
    --text-color: #e0e6ed;
    --text-muted: #a0a8c0;
    --accent-color: #ffd700;
    --accent-hover: #ffea70;
    --border-color: #2a304a;
    --lunar-color: #64ffda; /* 青色，用於區分農曆 */
    --nav-height: 70px;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    margin: 0;
    padding: 15px;
    display: flex;
    flex-direction: column;
    align-items: center;
    min-height: 100vh;
    box-sizing: border-box;
}

/* ====== 導覽列 (三欄式佈局) ====== */
.main-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    max-width: 900px;
    height: var(--nav-height);
    padding: 0 20px;
    background: var(--panel-bg);
    border-radius: 0 0 15px 15px;
    margin-bottom: 25px;
    box-sizing: border-box;
    box-shadow: 0 4px 20px rgba(0,0,0,0.2);
}

.nav-left, .nav-right {
    flex: 1;
    display: flex;
    align-items: center;
}
.nav-right { justify-content: flex-end; }
.nav-center {
    flex: 2;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.nav-brand {
    font-size: 1.2rem;
    font-weight: bold;
    color: var(--text-color);
    letter-spacing: 1px;
}

.nav-back-btn {
    background: transparent;
    color: var(--accent-color);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 6px 12px;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 5px;
    cursor: pointer;
    opacity: 0;
    pointer-events: none;
    transition: all 0.3s ease;
}

.nav-back-btn.visible {
    opacity: 1;
    pointer-events: auto;
}

.nav-back-btn:hover {
    background: rgba(255, 215, 0, 0.1);
    border-color: var(--accent-color);
}

/* ====== 首頁視圖 ====== */
.view-section {
    display: none;
    width: 100%;
    max-width: 900px;
    animation: fadeIn 0.4s ease-out;
}
.view-section.active { display: block; }

.home-container {
    width: 100%;
    margin: 0 auto;
}


.menu-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
    padding: 0 5px;
}

.menu-card {
    background: var(--panel-bg);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 25px;
    cursor: pointer;
    transition: transform 0.3s, box-shadow 0.3s, border-color 0.3s;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

.menu-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    border-color: var(--accent-color);
    background: #1a1d2e;
}

.card-icon {
    font-size: 3rem;
    margin-bottom: 15px;
    width: 70px;
    height: 70px;
    line-height: 70px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 50%;
    transition: transform 0.3s;
}
.menu-card:hover .card-icon { transform: scale(1.1) rotate(10deg); }

.menu-card h3 { margin: 0 0 10px 0; color: var(--text-color); font-size: 1.3rem; }
.menu-card p { color: var(--text-muted); font-size: 0.9rem; line-height: 1.5; margin-bottom: 20px; flex-grow: 1; }
.card-link { color: var(--accent-color); font-weight: bold; font-size: 0.9rem; opacity: 0.8; }
.menu-card:hover .card-link { opacity: 1; text-decoration: underline; }

.menu-card.disabled { opacity: 0.5; cursor: not-allowed; filter: grayscale(0.8); }
.menu-card.disabled:hover { transform: none; box-shadow: none; border-color: var(--border-color); }

/* ====== 實驗一：月相觀測 ====== */
.controls-container {
    background: var(--panel-bg);
    padding: 20px;
    border-radius: 12px;
    margin-bottom: 25px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
}

.control-row {
    display: flex;
    justify-content: center;
    gap: 10px;
    flex-wrap: wrap;
    align-items: center;
}

/* 通用按鈕樣式 */
button {
    background: #2a304a;
    color: white;
    border: none;
    padding: 8px 14px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: background 0.2s;
}
button:hover { background: #3b4261; }
button:active { transform: translateY(1px); }
.btn-primary { background: var(--accent-color); color: var(--bg-color); font-weight: bold; }
.btn-primary:hover { background: var(--accent-hover); }

input[type="date"] {
    background: #0b0d17;
    border: 1px solid var(--border-color);
    color: white;
    padding: 7px 10px;
    border-radius: 6px;
    font-size: 0.95rem;
    font-family: inherit;
}

.toggle-group {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 5px;
    background: rgba(0,0,0,0.2);
    padding: 4px;
    border-radius: 8px;
    margin-top: 15px;
    flex-wrap: wrap;
}
button.toggle-btn {
    background: transparent;
    color: var(--text-muted);
    font-size: 0.85rem;
    padding: 6px 12px;
}
button.toggle-btn.active {
    background: var(--border-color);
    color: white;
    font-weight: bold;
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
}

.predict-controls select {
    background: #0b0d17;
    color: white;
    border: 1px solid var(--border-color);
    padding: 6px;
    border-radius: 4px;
    font-size: 0.9rem;
}


/* 統一控制列中所有元素的高度 */
.toggle-group .toggle-btn,
.toggle-group .toggle-select {
    height: 34px; /* 設定固定高度 */
    box-sizing: border-box; /* 確保 padding 不會撐開高度 */
    vertical-align: middle;
    font-size: 0.85rem;
}

.toggle-select {
    background: #0b0d17;
    color: var(--text-muted);
    border: 1px solid var(--border-color);
    padding: 0 8px; /* 調整左右間距 */
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
    outline: none;
}

.toggle-select:hover {
    border-color: var(--accent-color);
    color: white;
}
/* 單日視圖排版 */
.single-view-layout {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 40px;
    align-items: center;
}
.large-moon {
    width: 260px;
    height: 260px;
    flex-shrink: 0;
    filter: drop-shadow(0 0 25px rgba(255, 215, 0, 0.15));
}
.info-panel {
    flex: 1;
    min-width: 280px;
    background: var(--panel-bg);
    padding: 25px;
    border-radius: 16px;
}
.phase-title { font-size: 2rem; color: var(--accent-color); margin: 10px 0; }
.phase-meta { display: flex; gap: 10px; color: var(--text-muted); font-size: 0.9rem; margin-bottom: 15px; }
.description { color: #a0a8c0; line-height: 1.6; }

/* 月曆網格 */
.calendar-grid, .predict-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 8px;
    margin-top: 20px;
}
.predict-grid { grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); }

.cal-day {
    background: var(--panel-bg);
    border-radius: 8px;
    padding: 8px;
    display: flex;
    flex-direction: column;
    align-items: center;
    min-height: 110px;
    cursor: pointer;
    border: 1px solid transparent;
    transition: all 0.2s;
    position: relative;
}
.cal-day:hover { transform: translateY(-3px); background: #1f2438; border-color: #555; z-index: 5; }
.cal-day.is-today { border: 1px solid var(--accent-color); box-shadow: 0 0 10px rgba(255, 215, 0, 0.1); }

.cal-gregorian { font-size: 0.85rem; font-weight: bold; }
.cal-weekday { font-size: 0.7rem; color: var(--text-muted); }
.cal-moon svg { width: 45px; height: 45px; margin: 5px 0; }
.cal-lunar { font-size: 0.8rem; color: var(--lunar-color); }

/* ====== 實驗二：軌跡觀測 ====== */
.sky-container {
    width: 100%;
    height: 350px;
    background: linear-gradient(to bottom, #05070a 0%, #15192b 100%);
    border-radius: 12px;
    position: relative;
    overflow: hidden;
    border: 2px solid var(--border-color);
    box-shadow: inset 0 0 50px rgba(0,0,0,0.5);
}

.sky-bg {
    width: 100%;
    height: 100%;
    position: relative;
}

/* 天空格線 */
.sky-grids { position: absolute; width: 100%; height: 100%; pointer-events: none; }
.grid-line {
    position: absolute;
    width: 100%;
    border-top: 1px dashed rgba(255, 255, 255, 0.2);
    left: 0;
}
.grid-label {
    position: absolute;
    left: 8px;
    bottom: 4px;
    font-size: 0.7rem;
    color: rgba(255, 255, 255, 0.9);
}

/* 天空中的月亮 */
.sky-moon {
    position: absolute;
    width: 0;
    height: 0;
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 10;
    pointer-events: none;
    flex-direction: column;
}

.moon-visual {
    position: absolute;
    left: 0; 
    top: 0;    
    transform: translate(-50%, -50%);
    width: 45px;
    height: 45px;
    display: flex;
    justify-content: center;
    align-items: center;
}



/* 資訊氣泡 (單日模式用) */
.moon-info-bubble {
    position: absolute;
    top: 25px; /* 位於月亮下方 */
    left: 0;
    transform: translateX(-50%);
    background: rgba(0,0,0,0.6);
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.7rem;
    white-space: nowrap;
    color: #ccc;
    pointer-events: none;
}



/* 軌跡點 */
.path-point { opacity: 0.7; z-index: 5; transition: opacity 0.3s; }
.path-point:hover { opacity: 1; z-index: 20; }
.path-label {
    font-size: 0.6rem;
    color: var(--accent-color);
    background: rgba(0,0,0,0.6);
    padding: 1px 4px;
    border-radius: 3px;
    margin-top: 2px;
}

/* 底部滑桿區 */
.sky-bottom-area {
    position: absolute;
    bottom: 0;
    width: 100%;
    background: linear-gradient(to top, rgba(0,0,0,0.8), transparent);
    padding-bottom: 2px;
}
.compass-labels {
    display: flex;
    justify-content: space-between;
    padding: 0 5%;
    font-size: 0.8rem;
    color: var(--accent-color);
    margin-bottom: 2px;
    font-weight: bold;
    text-shadow: 0 0 5px rgba(0,0,0,0.8);
}
.integrated-slider {
    width: 100%;
    margin: 0;
    cursor: pointer;
    appearance: none;
    background: rgba(255, 215, 0, 0.3);
    height: 4px;
    display: block;
}
.integrated-slider::-webkit-slider-thumb {
    appearance: none;
    width: 18px;
    height: 18px;
    background: var(--accent-color);
    border-radius: 50%;
    box-shadow: 0 0 10px rgba(255, 215, 0, 0.5);
    cursor: grab;
    margin-top: -7px; /* 修正位置 */
}
.integrated-slider::-webkit-slider-runnable-track { height: 4px; }

.astro-meta {
    position: absolute;
    top: 15px;
    right: 15px;
    font-size: 0.75rem;
    color: var(--text-muted);
    background: rgba(0,0,0,0.5);
    padding: 4px 8px;
    border-radius: 4px;
}

/* ====== 工具列與日期膠囊 (Exp2) ====== */
.compact-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--panel-bg);
    padding: 10px 15px;
    border-radius: 12px;
    margin-top: 15px;
    border: 1px solid var(--border-color);
    gap: 10px;
    flex-wrap: nowrap;
}

/* 左側：模式切換 */
.toolbar-left { flex-shrink: 0; }
.mode-pills { display: flex; background: rgba(0,0,0,0.2); border-radius: 8px; padding: 3px; }
.pill { padding: 5px 12px; font-size: 0.8rem; background: transparent; border: none; color: var(--text-muted); }
.pill.active { background: #2a304a; color: var(--accent-color); font-weight: bold; box-shadow: 0 2px 4px rgba(0,0,0,0.2); }

/* 中間：時間控制 */
.toolbar-center { display: flex; align-items: center; gap: 8px; flex-grow: 1; justify-content: center; }
.step-ctrls button {
    background: transparent;
    color: var(--text-muted);
    font-size: 1.2rem;
    padding: 4px;
    min-width: 30px;
    border: 1px solid transparent;
}
.step-ctrls button:hover { color: var(--accent-color); border-color: var(--border-color); }
.toolbar-time { font-size: 1.5rem; font-weight: bold; color: var(--accent-color); font-family: monospace; min-width: 70px; text-align: center; }

/* 右側：日期顯示 */
.toolbar-right { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }

/* 日期膠囊：核心樣式 (Exp1 也可使用) */
.date-capsule {
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 5px 12px;
    cursor: pointer;
    text-align: right;
    transition: all 0.2s;
    min-width: 90px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    user-select: none;
}
.date-capsule:hover {
    background: rgba(255, 255, 255, 0.05);
    border-color: var(--accent-color);
}
.date-main { font-size: 0.85rem; color: var(--text-color); font-weight: bold; line-height: 1.2; }
.date-sub { font-size: 0.75rem; color: var(--lunar-color); line-height: 1.2; }

/* 圓形今天按鈕 */
.btn-today-circle {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--accent-color);
    color: var(--bg-color);
    border: none;
    font-weight: bold;
    font-size: 0.8rem;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 2px 5px rgba(0,0,0,0.3);
    flex-shrink: 0;
    transition: transform 0.2s;
}
.btn-today-circle:hover { background: white; transform: scale(1.1); }

/* ====== 動畫與 RWD ====== */
@keyframes fadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }

/* 平板與手機版優化 */
@media (max-width: 768px) {
    .calendar-grid { grid-template-columns: repeat(4, 1fr); }
    .nav-brand { font-size: 1rem; }
    .large-moon { width: 200px; height: 200px; }
}

@media (max-width: 600px) {
    /* 導覽列縮小 */
    .main-nav { padding: 0 15px; height: 60px; margin-bottom: 15px; }
    .nav-back-btn { font-size: 0.8rem; padding: 4px 8px; }
    
    /* 工具列優化：隱藏次要按鈕，縮小字體 */
    .compact-toolbar { padding: 8px; gap: 5px; }
    .toolbar-time { font-size: 1.2rem; min-width: 60px; }
    .pill { padding: 4px 8px; font-size: 0.75rem; }
    .step-ctrls button { font-size: 1rem; min-width: 25px; padding: 2px; }
    
    /* 手機直式時，隱藏 +/- 1小時按鈕 (假設 HTML onclick 裡分別是 ±60) */
    .step-ctrls button[onclick*="60"] { display: none; }
    
    /* 日期膠囊微調 */
    .date-capsule { padding: 4px 8px; min-width: auto; }
    .date-main { font-size: 0.8rem; }
    .date-sub { font-size: 0.7rem; }
    .btn-today-circle { width: 32px; height: 32px; }

    /* 首頁選單 */
    .menu-grid { grid-template-columns: 1fr; }
    
    /* 實驗一 */
    .single-view-layout { gap: 20px; }
    .info-panel { padding: 15px; }
    .phase-title { font-size: 1.6rem; }
    
    /* 實驗二 */
    .sky-container { height: 280px; }
}

@media (max-width: 768px) {
    .cycle-grid-container { 
        height: 400px; /* 手機版高度與寬度比例接近，維持圓形感 */
    }
}
.multi-controls-panel {
    background: #15192b;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 12px 15px;
    margin-top: 15px;
    font-size: 0.9rem;
}



.multi-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border-color);
    flex-wrap: wrap;
    gap: 10px;
}


.header-left {
    display: flex;
    align-items: center;
    gap: 15px;
}

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




.checkbox-label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.85rem;
    cursor: pointer;
    color: var(--text-muted);
    user-select: none;
}
.checkbox-label:hover { color: #fff; }
.checkbox-label input { accent-color: var(--accent-color); }


.count-text {
    font-size: 0.8rem;
    color: #888;
}




.setting-group {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
    color: var(--text-muted);
    font-size: 0.8rem;
    margin-bottom: 5px;
}
.setting-group label {
    display: flex;
    align-items: center;
    gap: 4px;
    cursor: pointer;
}
.setting-group label:hover { color: #ddd; }

.setting-group input[type="checkbox"] {
    accent-color: var(--accent-color);
}

.multi-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 10px;
}


.btn-action {
    background: var(--accent-color);
    color: #0b0d17; /* 深色文字增加對比 */
    border: none;
    border-radius: 4px;
    padding: 5px 12px;
    font-size: 0.85rem;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
}
.btn-action:hover {
    background: #ffffff; /* 懸停變白 */
    color: #000;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.3);
}
.btn-action:disabled {
    background: #444;
    color: #888;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.multi-list-item {
    background: rgba(0,0,0,0.3);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 5px 8px;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.8rem;
}
.multi-list-item .info { display: flex; flex-direction: column; line-height: 1.2; }
.multi-list-item .date { color: var(--accent-color); font-weight: bold; }
.multi-list-item .time, .multi-list-item .alt { color: var(--text-muted); font-size: 0.75rem; }

.btn-del {
    background: transparent;
    border: none;
    color: #ff6b6b;
    cursor: pointer;
    font-size: 1.2rem;
    line-height: 1;
    padding: 0;
}
.btn-del:hover { color: #ff4c4c; }

.multi-hint {
    margin: 0;
    font-size: 0.75rem;
    color: var(--text-muted);
    text-align: center;
}

/* 新增：多日模式 - 天空上的詳細標籤 */
.multi-moon-item {
    position: absolute;
    transform: translate(-50%, 50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    z-index: 15; /* 比軌跡點高 */
    pointer-events: none;
}

.multi-moon-label {
    position: absolute;
    top: 22px; /* 稍微拉近一點 */
    left: 0;
    transform: translateX(-50%);
    text-align: center;
    min-width: 80px; /* 縮小寬度限制 */
    pointer-events: none;
    text-shadow: 0 1px 4px rgba(0,0,0,1), 0 0 2px rgba(0,0,0,0.8); /* 加強陰影 */
}


.label-row {
    line-height: 1.25;
    white-space: nowrap;
}
.row-date { font-size: 0.7rem; color: #fff; font-weight: bold; margin-bottom: 1px; }
.row-week { font-size: 0.7rem; color: #ddd; } /* 獨立的星期樣式 */
.row-time { font-size: 0.75rem; color: var(--accent-color); font-family: monospace; font-weight: bold; }
.row-lunar { font-size: 0.65rem; color: var(--lunar-color); opacity: 0.9; }
.row-pos { font-size: 0.65rem; color: #a0a8c0; margin-top: 1px; }



/* 讓多日模式的預覽月亮 (Ghost Moon) 有點不同 */
#skyMoon[style*="opacity: 0.5"] {
    filter: grayscale(0.5);
    z-index: 20; /* 確保正在操作的這顆在最上面 */
}


/* ====== 地面景物層 ====== */
.ground-layer {
    position: absolute;
    bottom: -10px;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 0;
    overflow: hidden;
    opacity: 0;
    transition: opacity 0.5s ease;
}

.ground-layer.visible {
    opacity: 0.4;
}

/* 幾何圖形通用樣式 */
.geo-shape {
    fill: #5b7c99;
    stroke: none;
    transition: all 0.3s ease;
}

/* 如果需要夜間模式下的景物稍微變暗，可選 */
.sky-container:hover .geo-shape {
    fill: #6a8ba8; 
}

/* 新增：景物控制按鈕 (放在工具列中) */
.scenery-ctrl-group {
    display: flex;
    align-items: center;
    gap: 5px;
    margin-right: 10px;
    padding-right: 10px;
    border-right: 1px solid var(--border-color);
}

.btn-icon {
    background: transparent;
    border: 1px solid transparent;
    color: var(--text-muted);
    border-radius: 4px;
    cursor: pointer;
    padding: 4px 8px;
    font-size: 1rem;
    transition: all 0.2s;
}

.btn-icon:hover {
    color: var(--accent-color);
    background: rgba(255, 255, 255, 0.05);
}

.btn-icon.active {
    color: var(--accent-color);
    border-color: var(--accent-color);
    background: rgba(255, 215, 0, 0.1);
}

@media (max-width: 600px) {
    .scenery-ctrl-group {
        margin-right: 5px;
        padding-right: 5px;
    }
}





/* --- 1. 觀測器主容器 --- */
.obs-container {
    width: 100%;
    height: 400px;
    background: #05070a;
    border-radius: 16px;
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
    border: 2px solid var(--border-color);
}

/* 觀測畫布：寬度設為 600px 以確保 0-90 度線條完整顯示 */
.observer-box {
    width: 600px;
    height: 400px;
    position: relative;
    margin: 0 auto;
    transition: transform 0.6s cubic-bezier(0.4, 0, 0.2, 1);
    transform-origin: center center;
}

/* --- 2. 核心元件樣式 --- */

/* 圓心 Emoji 圖示 */
.obs-center-icon {
    position: absolute;
    top: 350px;       /* 與 JS CENTER_Y 一致 */
    left: 300px;      /* 與 JS CENTER_X 一致，位於 600px 正中間 */
    transform: translate(-50%, -50%);
    font-size: 4rem;
    cursor: pointer;
    z-index: 5;
    user-select: none;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* 月亮圖示 */
.obs-moon {
    position: absolute;
    z-index: 10;
    transform: translate(-50%, -50%);
    transition: left 0.1s, top 0.1s;
    pointer-events: none;
}

/* SVG 刻度文字渲染優化 */
.protractor-text {
    font-size: 15px;
    fill: #ddd;
    font-weight: bold;
    transform-box: fill-box;
    transform-origin: center;
    transition: transform 0.3s;
}

/* --- 3. 翻轉邏輯控制 --- */

/** * 當月亮在東側 (progress < 0.5) 時，加上 .east-side
 * 整個容器水平翻轉，使量角器開口朝左
 */
.observer-box.east-side {
    transform: scaleX(-1);
}

/** * 補償修正：抵消父層翻轉，防止內部元件變鏡像文字
 * 注意：翻轉後的 translate X 軸向需改為正值 (50%)
 */
.observer-box.east-side .obs-center-icon,
.observer-box.east-side .obs-moon,
.observer-box.east-side .protractor-text {
    transform: scaleX(-1) translate(50%, -50%);
}

/* --- 4. 下方工具列與資訊顯示 --- */

/* 狀態資訊膠囊 (高度、方位) */
.obs-status-capsule {
    display: flex;
    gap: 15px;
    background: rgba(255, 255, 255, 0.05);
    padding: 5px 15px;
    border-radius: 20px;
    border: 1px solid var(--border-color);
}

.status-item {
    font-size: 0.9rem;
    color: var(--text-muted);
}

.status-item span {
    color: var(--accent-color);
    font-weight: bold;
    font-family: monospace;
}

/* 時間滑桿區域：與控制列緊湊排列 */
.slider-area {
    width: 100%;
    padding: 10px 0 20px 0;
    margin-top: -10px;
}

/* 舊有的資訊氣泡 (若已整合至工具列可視需求移除) */
.obs-info-overlay {
    position: absolute;
    top: 20px;
    left: 20px;
    background: rgba(0, 0, 0, 0.6);
    padding: 10px 15px;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    pointer-events: none;
    z-index: 20;
}

/* --- 週期模式專用樣式 (修正置中) --- */
.cycle-grid-container {
    position: relative;
    width: 100%;
    max-width: 900px; 
    height: 450px;    
    margin: 20px auto;
    display: flex;
    justify-content: center;
    align-items: center;
}

.cycle-center-mark {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 100px;
    height: 100px;
    border: 2px dashed var(--lunar-color);
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    color: var(--lunar-color);
    font-size: 0.9rem;
    text-align: center;
    z-index: 1;
    background: rgba(100, 255, 218, 0.05);
}

.cycle-card-absolute {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 110px;
    display: flex;
    flex-direction: column;
    align-items: center;
    cursor: pointer;
    /* 僅保留 hover 的微調效果，移除 entry 載入動畫 */
    transition: border-color 0.2s, box-shadow 0.2s, transform 0.2s;
    z-index: 2;
    /* 直接顯示，不再使用 opacity: 0 或 animation */
    opacity: 1; 
    transform: translate(calc(-50% + var(--tx)), calc(-50% + var(--ty)));
}

.cycle-card-absolute.is-selected {
}

.cycle-card-absolute:hover {
}

@keyframes cycleFadeIn {
    to { opacity: 1; transform: translate(calc(-50% + var(--tx)), calc(-50% + var(--ty))) scale(1); }
}

@media (max-width: 600px) {
    .cycle-grid-container { height: 450px; }
    .cycle-card-absolute { width: 90px; padding: 8px; }
}
/* --- 軌道環 SVG 容器 --- */
.cycle-direction-svg {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 100%;
    height: 100%;
    pointer-events: none; /* 不干擾卡片點擊 */
    z-index: 1;
}

/* 軌道線條樣式 */
.orbit-path {
    fill: none;
    stroke: var(--accent-color);
    stroke-width: 2;
    stroke-dasharray: 5, 5; /* 虛線感 */
    opacity: 0.5;
    transition: all 0.4s ease;
}

/* 箭頭樣式 */
.orbit-arrow {
    fill: var(--accent-color);
    filter: drop-shadow(0 0 5px var(--accent-color));
}

.cycle-center-mark {
    z-index: 10;
    /* 移除原本的文字提示顏色設定，維持乾淨 */
}









/**
 * 實驗三：高度角觀測專用樣式
 * 修正內容：
 * 1. 修正 Emoji 翻轉邏輯，確保觀測者會轉身面向刻度。
 * 2. 維持月球幾何中心精確對齊。
 * 3. 確保文字不變鏡像。
 */

/* ====== 1. HUD 控制區 ====== */
.obs-hud-left {
    position: absolute;
    top: 15px;
    left: 15px;
    z-index: 50;
    background: rgba(15, 19, 35, 0.85);
    padding: 10px 14px;
    border-radius: 10px;
    border: 1px solid var(--border-color);
    backdrop-filter: blur(5px);
    box-shadow: 0 4px 15px rgba(0,0,0,0.3);
}

.hud-check-group {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.hud-check-group .checkbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.85rem;
    color: var(--text-color);
    cursor: pointer;
    user-select: none;
}

.hud-check-group input[type="checkbox"] {
    accent-color: var(--accent-color);
    width: 15px;
    height: 15px;
}

/* ====== 2. 觀測器主容器 ====== */
.obs-container {
    width: 100%;
    height: 420px;
    background: #05070a;
    border-radius: 16px;
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
    border: 2px solid var(--border-color);
}

/* ====== 3. 畫布座標與翻轉邏輯 ====== */
.observer-box {
    width: 600px;
    height: 400px;
    position: relative;
    margin: 0 auto;
    transition: transform 0.6s cubic-bezier(0.4, 0, 0.2, 1);
    transform-origin: 300px 340px; 
}

/* 當進度小於 0.5 (東側) 時，父容器水平翻轉 */
.observer-box.east-side {
    transform: scaleX(-1);
}

/* --- 文字與月亮修正 (抵消父層翻轉) --- */

.observer-box.east-side .flip-fix {
    transform: scaleX(-1);
    transform-box: fill-box;
    transform-origin: center;
}

.observer-box.east-side .obs-moon {
    /* 必須包含置中 translate 與翻轉 scaleX */
    transform: translate(-50%, -50%) scaleX(-1);
    transform-origin: center;
}

/* ====== 4. 觀測元件細節樣式 ====== */

/* 觀測者 Emoji 翻轉修正 */
.obs-center-icon {
    position: absolute;
    /* 關鍵：預設就給予 scaleX(-1) 讓它面向右側軌道 */
    transform: translate(-50%, -50%) scaleX(-1);
    font-size: 2.2rem;
    z-index: 5;
    user-select: none;
    transition: left 0.1s, top 0.1s;
}

/* 東側模式時的 Emoji (維持 scaleX(-1) 以達到轉向效果) */
.observer-box.east-side .obs-center-icon {
    /* 因為父層已經 scaleX(-1)，子層再 scaleX(-1) 會在螢幕上呈現「正向」 */
    transform: translate(-50%, -50%) scaleX(-1) !important;
}

.obs-moon {
    position: absolute;
    z-index: 10;
    transform: translate(-50%, -50%);
    pointer-events: none;
    transition: left 0.1s, top 0.1s;
}

.protractor-text {
    font-size: 14px;
    fill: rgba(255,255,255,0.7);
    font-weight: bold;
}

.guide-text {
    font-size: 13px;
    fill: #6aa;
    font-weight: bold;
}

/* ====== 5. 底部控制列與響應式 ====== */
.slider-full-width {
    padding: 15px 20px 5px 20px;
}

@media (max-width: 600px) {
    .observer-box {
        transform: scale(0.6);
        transform-origin: 300px 340px;
    }
    .observer-box.east-side {
        transform: scale(-0.6, 0.6);
    }
    .obs-hud-left {
        top: 10px;
        left: 10px;
        padding: 6px 10px;
    }
}









/* ====== 實驗四：日月食專用樣式 ====== */
.eclipse-container {
    width: 100%;
    max-width: 900px;
    background: #000;
    border-radius: 16px;
    overflow: hidden;
    border: 2px solid var(--border-color);
    position: relative;
}

.eclipse-canvas {
    width: 100%;
    height: 350px;
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
    background: radial-gradient(circle at center, #050a15 0%, #000 100%);
}

.view-label {
    position: absolute;
    top: 15px;
    left: 15px;
    color: var(--text-muted);
    font-size: 0.75rem;
    background: rgba(255,255,255,0.1);
    padding: 3px 8px;
    border-radius: 4px;
}

/* 天體樣式 */
.celestial {
    position: absolute;
    border-radius: 50%;
    transition: transform 0.1s linear;
}

.sun-glow {
    width: 120px;
    height: 120px;
    background: #fff;
    box-shadow: 0 0 60px #ffcc00, 0 0 100px #ff6600;
    z-index: 1;
}

.corona {
    position: absolute;
    width: 140px;
    height: 140px;
    background: radial-gradient(circle, rgba(255,255,255,0.8) 0%, transparent 70%);
    border-radius: 50%;
    opacity: 0;
    transition: opacity 0.5s;
    z-index: 0;
}

.earth-shadow {
    width: 180px;
    height: 180px;
    background: rgba(30, 0, 0, 0.8);
    box-shadow: inset 0 0 40px #000;
    z-index: 1;
    border: 1px solid rgba(255,255,255,0.1);
}

.penumbra {
    position: absolute;
    width: 280px;
    height: 280px;
    background: radial-gradient(circle, rgba(50, 50, 50, 0.4) 0%, transparent 70%);
    border-radius: 50%;
    z-index: 0;
}

.moon-body {
    width: 110px;
    height: 110px;
    background: #333;
    z-index: 2;
    box-shadow: inset -10px -10px 20px #000;
}

/* 月食時的月亮變色 */
.moon-lunar-eclipse {
    background: #666;
    transition: background 0.5s;
}

.eclipse-info-panel {
    background: var(--panel-bg);
    padding: 20px;
    border-top: 1px solid var(--border-color);
}

#eclipseTitle {
    color: var(--accent-color);
    margin: 0 0 10px 0;
}

.eclipse-details {
    display: flex;
    gap: 20px;
    margin-top: 10px;
    font-size: 0.9rem;
    color: var(--text-muted);
}

#eclipsePercent {
    color: #fff;
    font-weight: bold;
}

@media (max-width: 600px) {
    .eclipse-canvas { height: 250px; }
    .sun-glow, .moon-body { width: 80px; height: 80px; }
    .earth-shadow { width: 120px; height: 120px; }
}
/* 實驗四擴充樣式 */
.dir-label {
    position: absolute;
    bottom: 60px;
    font-size: 0.8rem;
    color: var(--accent-color);
    opacity: 0.6;
    font-weight: bold;
}
.dir-label.left { left: 30px; }
.dir-label.right { right: 30px; }

/* 日環食的金環效果 */
.mode-annular .sun-glow {
    box-shadow: 0 0 20px #fff, 0 0 40px #ffcc00;
}

/* 蝕甚時的環境變暗 */
.eclipse-canvas {
    transition: background 0.5s ease;
}

/* 當進度接近 50% 時，畫布變更深黑 */
#eclipseSlider[value="50"] + .eclipse-canvas {
    background: #000;
}

/* 強化日冕 */
.corona {
    width: 160px;
    height: 160px;
    background: radial-gradient(circle, rgba(255,255,255,0.9) 10%, rgba(200,220,255,0.4) 40%, transparent 70%);
    filter: blur(2px);
    animation: corona-wave 3s infinite alternate;
}

@keyframes corona-wave {
    from { transform: scale(1); opacity: 0.8; }
    to { transform: scale(1.1); opacity: 1; }
}