:root {
    --primary: #00d2ff;
    --secondary: #3a7bd5;
    --bg-dark: #050814;
    --text-light: #f0f4f8;
    --sub-text: #9ca3af;
    --glass-bg: rgba(255, 255, 255, 0.05);
    --glass-border: rgba(255, 255, 255, 0.1);
    --sim-bg: #f0f2f5;
    --sim-card: #ffffff;
    --sim-text: #1e293b;
}

* {
    margin: 0; padding: 0; box-sizing: border-box;
    font-family: 'Pretendard', sans-serif; touch-action: manipulation;
}

body {
    background-color: var(--sim-bg); color: var(--sim-text);
    display: flex; flex-direction: column; min-height: 100vh;
}

header.site-nav {
    padding: 1.5rem 5%; display: flex; justify-content: space-between; align-items: center;
    position: fixed; width: 100%; top: 0; z-index: 1000;
    background: rgba(5, 8, 20, 0.95); backdrop-filter: blur(10px); border-bottom: 1px solid var(--glass-border);
}

.logo {
    font-size: 1.2rem; font-weight: 800;
    background: linear-gradient(to right, var(--primary), var(--secondary));
    -webkit-background-clip: text; -webkit-text-fill-color: transparent; text-decoration: none;
}

.nav-tag {
    font-size: 0.85rem; font-weight: 700; color: var(--primary);
    border: 1px solid var(--primary); padding: 4px 12px; border-radius: 20px;
    letter-spacing: 0.5px; text-decoration: none; transition: all 0.3s ease;
}
.nav-tag:hover { background: var(--primary); color: var(--bg-dark); }

main { flex: 1; padding: 140px 20px 60px; display: flex; flex-direction: column; align-items: center; }

.sim-header { max-width: 1100px; width: 100%; text-align: center; margin-bottom: 30px; }
.sim-header h1 { font-size: 2.2rem; color: #0f172a; margin-bottom: 12px; font-weight: 800; }
.sim-header p { font-size: 1.05rem; color: #64748b; line-height: 1.7; margin-top: 0; word-break: keep-all; }

.ma-info {
    display: inline-block; margin-top: 15px; padding: 6px 18px;
    background-color: #e2e8f0; border-radius: 20px; font-size: 0.9rem;
    color: #475569; font-weight: 600;
}

.sim-container {
    background: var(--sim-card); padding: 40px; border-radius: 24px;
    box-shadow: 0 20px 50px rgba(0,0,0,0.08); display: flex; flex-direction: column;
    gap: 20px; max-width: 1100px; width: 100%; margin-bottom: 40px;
}

#p5-wrapper {
    position: relative; width: 100%; height: 650px; background-color: #0a0e1a;
    border-radius: 16px; overflow: hidden; box-shadow: inset 0 0 30px rgba(0,0,0,0.6);
}
#p5-wrapper.fullscreen {
    position: fixed; top: 0; left: 0; width: 100vw; height: 100vh; height: 100dvh;
    max-width: none; border-radius: 0; z-index: 9999; margin: 0;
}

/* 컨트롤 레이아웃 */
#top-left-controls { position: absolute; top: 20px; left: 20px; z-index: 30; }
#top-right-controls { position: absolute; top: 20px; right: 20px; z-index: 30; display: flex; flex-direction: column; align-items: flex-end; gap: 8px; }

.icon-horizontal { display: flex; gap: 8px; }
.icon-vertical { display: flex; flex-direction: column; gap: 8px; }

.icon-btn {
    background: rgba(15, 23, 42, 0.8); color: white; border: 1px solid #444;
    border-radius: 8px; width: 42px; height: 42px; cursor: pointer; 
    display: flex; justify-content: center; align-items: center; font-size: 1.1rem;
    transition: all 0.3s ease;
}
.icon-btn:hover { background: #333; }
.active-play { background: var(--primary); color: #000; border-color: var(--primary); }
.active-tool { background: var(--secondary); color: #fff; border-color: var(--secondary); }

#time-badge { 
    background: rgba(0,0,0,0.6); padding: 8px 12px; border-radius: 8px; color: white; 
    text-align: center; border: 1px solid rgba(255,255,255,0.2); font-weight: 500; font-size: 0.95rem; 
}

/* 팝업 슬라이더 공통 스타일 */
.popup-slider-container {
    position: absolute; right: 20px; z-index: 40;
    background: rgba(15, 23, 42, 0.95); padding: 15px 20px; border-radius: 12px;
    border: 1px solid #444; display: flex; flex-direction: column; gap: 10px;
    box-shadow: 0 8px 25px rgba(0,0,0,0.7); backdrop-filter: blur(8px);
    min-width: 250px; visibility: hidden; opacity: 0; transform: translateY(-10px);
    transition: all 0.3s ease;
}
.popup-slider-container.active { visibility: visible; opacity: 1; transform: translateY(0); }
.popup-slider-container input[type="range"] { accent-color: var(--primary); cursor: pointer; width: 100%; }

#lat-slider-container { top: 120px; }
#star-slider-container { top: 170px; }

/* 메인 설정 패널 */
#ui-panel {
    position: absolute; top: 75px; right: 20px; z-index: 40;
    background: rgba(15, 23, 42, 0.95); padding: 24px; border-radius: 12px;
    border: 1px solid #444; display: flex; flex-direction: column; gap: 15px;
    box-shadow: 0 8px 25px rgba(0,0,0,0.7); backdrop-filter: blur(8px);
    min-width: 280px; visibility: hidden; opacity: 0; transform: translateY(-10px);
    transition: all 0.3s ease;
}
#ui-panel.active { visibility: visible; opacity: 1; transform: translateY(0); }
.ui-group { display: flex; flex-direction: column; gap: 5px; color: white; font-size: 0.85rem; }
.ui-group label { font-weight: 600; color: var(--primary); }
.ui-group input[type="range"] { accent-color: var(--primary); cursor: pointer; }

/* 체크박스 그룹 스타일 */
.checkbox-group {
    display: flex; flex-direction: column; gap: 12px;
    margin-top: 5px; padding-top: 15px; border-top: 1px solid rgba(255, 255, 255, 0.1);
}
.checkbox-group label {
    display: flex; align-items: center; gap: 10px;
    color: #f0f4f8; font-size: 0.9rem; cursor: pointer; font-weight: 500;
}
.checkbox-group input[type="checkbox"] {
    accent-color: var(--primary); width: 16px; height: 16px; cursor: pointer;
}

/* 하단 설명 섹션 */
.table-section { 
    background: var(--sim-card); padding: 40px; border-radius: 24px; 
    box-shadow: 0 20px 40px rgba(0,0,0,0.05); max-width: 1100px; width: 100%; 
    box-sizing: border-box; overflow-x: auto;
}
.table-section h2 { margin-top: 0; color: #0f172a; border-left: 6px solid var(--primary); padding-left: 15px; font-size: 1.5rem; margin-bottom: 25px; }
.ref-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 24px; }
.ref-card { background: #fff; padding: 24px; border-radius: 16px; box-shadow: 0 4px 12px rgba(0,0,0,0.04); border: 1px solid #f1f5f9; }
.ref-card h3 { color: var(--secondary); margin-bottom: 12px; font-size: 1.1rem; }
.ref-card p { color: #475569; line-height: 1.65; font-size: 0.95rem; margin-bottom: 12px; word-break: keep-all; }

.site-footer {
    padding: 60px 5%; border-top: 1px solid var(--glass-border);
    text-align: center; background: #050814; color: var(--sub-text);
}
.contact-info { color: #fff; margin-bottom: 20px; font-size: 0.95rem; }
.contact-info a { color: var(--sub-text); text-decoration: none; margin-left: 10px; transition: color 0.3s; }
.contact-info a:hover { color: var(--primary); }
.footer-links { display: flex; justify-content: center; align-items: center; gap: 15px; flex-wrap: wrap; }
.footer-links a { color: var(--sub-text); text-decoration: none; font-size: 0.85rem; transition: color 0.3s; }
.footer-links a:hover { color: var(--primary); }

@media (max-width: 800px) {
    main { padding-top: 100px; }
    .sim-container { padding: 20px; }
    #ui-panel { left: 20px; right: 20px; top: 130px; }
    #lat-slider-container { right: 20px; top: 130px; width: auto; left: 20px; }
    #star-slider-container { right: 20px; top: 130px; width: auto; left: 20px; }
}