/* リアルタイム2D太陽系ウィジェット CSS */

/* --- 公転周期（秒）: 1日=86400秒スケール --- */
:root {
    --mercury-period: 7600848s;      /* 水星 87.97日 */
    --venus-period:   19414080s;     /* 金星 224.70日 */
    --earth-period:   31557600s;     /* 地球 365.25日 */
    --mars-period:    59378688s;     /* 火星 686.98日 */
    --jupiter-period: 374537576s;    /* 木星 4332.59日 */
    --saturn-period:  930000448s;    /* 土星 10759.22日 */
    --uranus-period:  2653298400s;   /* 天王星 30688.5日 */
    --neptune-period: 5199736800s;   /* 海王星 60182日 */
}

/* --- 背景キャンバス --- */
#stars {
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    background: black;
}

/* --- ウィジェット本体 --- */
.solar-system-widget-container {
    position: relative;
    margin: 0 auto;
    background: transparent;
    aspect-ratio: 1 / 1;
    overflow: hidden;
    max-width: 100%;
}

.solar-system-widget-container .solar-system {
    position: relative;
    width: 100%;
    height: 100%;
    aspect-ratio: 1 / 1;
}

/* 太陽 */
.solar-system-widget-container #sun {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 6%;
    height: 6%;
    border-radius: 50%;
    background: radial-gradient(circle, #ffd700, #ff8c00, #ff4500);
    box-shadow:
        0 0 30px #ffc700,
        0 0 45px #ff8c00,
        0 0 75px #ff4500;
    transform: translate(-50%, -50%);
    z-index: 10;
    cursor: pointer;
    transition: transform 0.3s ease;
}
.solar-system-widget-container #sun:hover {
    transform: translate(-50%, -50%) scale(1.2);
}

/* 軌道 */
.solar-system-widget-container .orbit {
    position: absolute;
    top: 50%;
    left: 50%;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    animation-name: revolve;
    animation-timing-function: linear;
    animation-iteration-count: infinite;
    transition: border-color 0.3s ease, border-width 0.3s ease;
    pointer-events: none;
}
@keyframes revolve {
    from { transform: translate(-50%, -50%) rotate(0deg); }
    to   { transform: translate(-50%, -50%) rotate(360deg); }
}

/* 惑星 */
.solar-system-widget-container .planet {
    position: absolute;
    top: 50%;
    left: 0;
    border-radius: 50%;
    transform: translate(-50%, -50%);
    cursor: pointer;
    transition: transform 0.3s ease;
    pointer-events: auto;
}
.solar-system-widget-container .planet:hover {
    transform: translate(-50%, -50%) scale(1.6);
}

/* 各惑星サイズ */
#mercury-orbit { width: 11%; height: 11%; animation-duration: var(--mercury-period); }
#mercury { width: 20%; height: 20%; background: #a9a9a9; }

#venus-orbit { width: 17%; height: 17%; animation-duration: var(--venus-period); }
#venus { width: 18%; height: 18%; background: #e6d3a2; }

#earth-orbit { width: 24%; height: 24%; animation-duration: var(--earth-period); }
#earth { width: 18%; height: 18%; background: #4b89e0; }

#mars-orbit { width: 33%; height: 33%; animation-duration: var(--mars-period); }
#mars { width: 14%; height: 14%; background: #c1440e; }

#jupiter-orbit { width: 45%; height: 45%; animation-duration: var(--jupiter-period); }
#jupiter { width: 16%; height: 16%; background: #d8ca9d; }

#saturn-orbit { width: 57%; height: 57%; animation-duration: var(--saturn-period); }
#saturn { width: 15%; height: 15%; background: #f0e6c5; }
#saturn::before {
    content: '';
    position: absolute;
    top: 50%; left: 50%;
    width: 200%; height: 200%;
    border: 2px solid rgba(255, 255, 255, 0.4);
    border-radius: 50%;
    transform: translate(-50%, -50%) rotateX(70deg);
}

#uranus-orbit { width: 69%; height: 69%; animation-duration: var(--uranus-period); }
#uranus { width: 10%; height: 10%; background: #a9d5f0; }

#neptune-orbit { width: 81%; height: 81%; animation-duration: var(--neptune-period); }
#neptune { width: 10%; height: 10%; background: #3f54ba; }

/* ツールチップ */
.solar-system-tooltip {
    position: fixed;
    display: none;
    padding: 8px 12px;
    background: rgba(0,0,0,0.85);
    color: white;
    border-radius: 5px;
    font-size: 12px;
    pointer-events: none;
    z-index: 1000;
}

.solar-system-widget-wrapper {
    position: relative;   /* ← これ重要 */
    overflow: hidden;     /* 背景がはみ出さないようにする */
}

.solar-system-widget-wrapper canvas#stars {
    position: absolute;
    top: 0;
    left: 0;
    width: 100% !important;
    height: 100% !important;
    z-index: 0;           /* コンテンツより後ろに配置 */
}

