/* 대한민국 인터넷 천문대 — 전체 화면 밤하늘 + 오버레이 UI */
:root {
  /* 밤하늘이 비치는 어두운 반투명 유리 */
  --glass: rgba(10, 14, 24, 0.55);
  --glass-strong: rgba(10, 14, 24, 0.72);
  --glass-border: rgba(255, 255, 255, 0.14);
  --glass-shadow: 0 6px 24px rgba(0, 0, 0, 0.45);
  --ink: #eef2f8;
  --ink-soft: #a7b3c4;
  --accent: #8fbcff;
  --accent-strong: #3d7ce0;
  --accent-soft: rgba(143, 188, 255, 0.16);
  --line: rgba(255, 255, 255, 0.12);
  --radius: 12px;
  --drawer-w: 360px;
  --topbar-h: 64px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Pretendard, "Apple SD Gothic Neo", "Noto Sans KR", "Malgun Gothic", sans-serif;
}
html, body { margin: 0; padding: 0; height: 100%; overflow: hidden; background: #000; }
body { font: 14px/1.55 var(--font); color: var(--ink); }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
button { font: inherit; }

/* 지도 */
#mapContent { position: fixed; inset: 0; background: #000; }
#aladin { position: absolute; inset: 0; }
#aladin .aladin-logo-container, #aladin .aladin-logo, #aladin .aladin-reticleCanvas { display: none !important; }
.hud { position: absolute; color: #fff; font-size: 12px; text-shadow: 0 0 4px #000, 0 0 2px #000; pointer-events: none; z-index: 5; }
#coordText { position: absolute; left: 16px; top: calc(var(--topbar-h) + 14px); color: #fff; font-size: 12.5px; letter-spacing: .01em; text-shadow: 0 0 4px #000, 0 0 2px #000; pointer-events: none; z-index: 5; font-variant-numeric: tabular-nums; }
#chartStatus { position: absolute; left: 16px; bottom: 40px; color: #ffe082; font-size: 11.5px; text-shadow: 0 0 4px #000; pointer-events: none; z-index: 5; }
#scaleBar { position: absolute; left: 16px; bottom: 14px; color: #fff; font-size: 12px; text-shadow: 0 0 4px #000; z-index: 5; }
#scaleLine { border-bottom: 2px solid #fff; border-left: 2px solid #fff; border-right: 2px solid #fff; box-sizing: border-box; height: 7px; margin-bottom: 3px; }
#credit { position: absolute; right: 16px; bottom: 14px; background: rgba(6, 9, 16, 0.55); border: 1px solid var(--line); color: #e6e6e6; font-size: 11px; padding: 3px 9px; border-radius: 999px; z-index: 5; backdrop-filter: blur(6px); transition: right .25s ease; }
body.drawer-open #credit { right: calc(var(--drawer-w) + 32px); }

/* 줌 컨트롤 */
#zoomBox { position: absolute; right: 16px; top: calc(var(--topbar-h) + 14px); width: 40px; display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 6px 0; background: var(--glass); border: 1px solid var(--glass-border); border-radius: 999px; box-shadow: var(--glass-shadow); backdrop-filter: blur(10px); z-index: 6; transition: right .25s ease; }
body.drawer-open #zoomBox { right: calc(var(--drawer-w) + 32px); }
#zoomBox button { width: 28px; height: 28px; border: 0; border-radius: 50%; background: transparent; color: var(--ink); font-size: 18px; line-height: 28px; cursor: pointer; padding: 0; }
#zoomBox button:hover { background: rgba(255, 255, 255, 0.12); }
#zoomSlider { writing-mode: vertical-lr; direction: rtl; height: 130px; width: 22px; margin: 2px 0; cursor: pointer; accent-color: var(--accent); }
#zoomLevel { font-size: 12px; color: var(--ink-soft); font-variant-numeric: tabular-nums; }

/* 상단 바 */
#topbar { position: fixed; top: 0; left: 0; right: 0; height: var(--topbar-h); display: flex; align-items: center; gap: 14px; padding: 0 16px; box-sizing: border-box; background: linear-gradient(to bottom, rgba(6, 9, 16, 0.72), rgba(6, 9, 16, 0.38)); border-bottom: 1px solid var(--line); backdrop-filter: blur(6px); z-index: 20; }
#topbar .brand { display: flex; align-items: center; flex: 0 0 auto; }
#topbar .brand { gap: 10px; color: var(--ink); text-decoration: none; }
#topbar .brand:hover { text-decoration: none; }
#topbar .brand img { display: block; width: 38px; height: 38px; }
.brand-text { display: flex; flex-direction: column; line-height: 1.15; white-space: nowrap; }
.brand-text b { font-size: 16px; font-weight: 700; letter-spacing: -0.01em; }
.brand-text small { font-size: 10.5px; color: var(--ink-soft); letter-spacing: .04em; }
@media (max-width: 1100px) { .brand-text small { display: none; } }
#topbar .search { display: flex; align-items: center; gap: 6px; flex: 1 1 420px; max-width: 560px; min-width: 200px; }
#searchName { flex: 1; height: 36px; padding: 0 14px; border: 1px solid var(--line); border-radius: 999px; background: rgba(255, 255, 255, 0.1); font: inherit; color: var(--ink); outline: none; }
#searchName::placeholder { color: rgba(238, 242, 248, 0.55); }
#searchName:focus { border-color: var(--accent); background: rgba(255, 255, 255, 0.16); box-shadow: 0 0 0 3px rgba(143, 188, 255, .2); }
#search { height: 36px; padding: 0 16px; border: 0; border-radius: 999px; background: var(--accent-strong); color: #fff; cursor: pointer; white-space: nowrap; }
#search:hover { filter: brightness(1.1); }
#loading { height: 16px; }
.segmented { display: inline-flex; flex: 0 0 auto; padding: 3px; background: rgba(255, 255, 255, 0.1); border: 1px solid var(--line); border-radius: 999px; }
.segmented .tab { display: inline-flex; align-items: center; padding: 0 14px; height: 30px; border-radius: 999px; color: var(--ink-soft); font-size: 13px; white-space: nowrap; }
.segmented .tab.active { background: rgba(255, 255, 255, 0.92); color: #101826; box-shadow: 0 1px 3px rgba(0, 0, 0, .3); font-weight: 600; }
.segmented .tab:hover { text-decoration: none; color: var(--ink); }
#topbar .links { margin-left: auto; display: flex; gap: 14px; font-size: 13px; white-space: nowrap; }
#drawerToggle { flex: 0 0 auto; width: 38px; height: 38px; border: 1px solid var(--line); border-radius: 10px; background: rgba(255, 255, 255, 0.1); cursor: pointer; position: relative; }
#drawerToggle:hover { background: rgba(255, 255, 255, 0.18); }
#drawerToggle .bars, #drawerToggle .bars::before, #drawerToggle .bars::after { position: absolute; left: 10px; width: 16px; height: 2px; background: var(--ink); border-radius: 2px; content: ""; }
#drawerToggle .bars { top: 18px; }
#drawerToggle .bars::before { top: -5px; left: 0; }
#drawerToggle .bars::after { top: 5px; left: 0; }

/* 우측 드로어 */
#navigation { position: fixed; top: calc(var(--topbar-h) + 14px); right: 16px; bottom: 48px; width: var(--drawer-w); box-sizing: border-box; padding: 18px 18px 14px; background: var(--glass-strong); border: 1px solid var(--glass-border); border-radius: var(--radius); box-shadow: var(--glass-shadow); backdrop-filter: blur(12px); overflow-y: auto; z-index: 15; transform: translateX(calc(100% + 32px)); transition: transform .28s ease; }
body.drawer-open #navigation { transform: none; }
#drawerClose { position: absolute; top: 10px; right: 10px; width: 30px; height: 30px; border: 0; border-radius: 50%; background: transparent; color: var(--ink-soft); font-size: 20px; cursor: pointer; }
#drawerClose:hover { background: rgba(255, 255, 255, 0.12); color: var(--ink); }
#navigation h2 { margin: 0 0 4px; font-size: 15px; font-weight: 700; }
#navigation .lead { margin: 0 0 10px; color: var(--ink-soft); font-size: 12.5px; }
#navigation section + section { margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--line); }
.objects { list-style: none; margin: 0; padding: 0; }
.objects li { padding: 8px 10px; border-radius: 8px; }
.objects li:hover { background: rgba(255, 255, 255, 0.07); }
.objects li a { display: block; font-weight: 600; }
.objects li span { display: block; color: var(--ink-soft); font-size: 12px; line-height: 1.5; margin-top: 2px; }
.objects.favorites li { display: flex; align-items: center; justify-content: space-between; }
.objects.favorites em { font-style: normal; color: var(--ink-soft); font-size: 12px; }
.objects li.empty { color: var(--ink-soft); font-size: 12.5px; }
#navigation footer { margin-top: 18px; padding-top: 12px; border-top: 1px solid var(--line); color: var(--ink-soft); font-size: 11.5px; }

/* 좁은 화면 */
@media (max-width: 900px) {
  #topbar .links { display: none; }
}
@media (max-width: 640px) {
  :root { --drawer-w: calc(100vw - 32px); --topbar-h: 108px; }
  #topbar { flex-wrap: wrap; row-gap: 8px; padding: 10px 12px; height: auto; }
  #topbar .brand { order: 1; }
  #drawerToggle { order: 2; margin-left: auto; }
  #topbar .search { order: 3; flex: 1 1 100%; max-width: none; }
  .segmented { order: 4; }
  #topbar .segmented .tab { padding: 0 10px; }
  body.drawer-open #zoomBox, body.drawer-open #credit { right: 16px; }
  body.drawer-open #navigation { top: calc(var(--topbar-h) + 10px); }
}

#navigation { scrollbar-width: thin; scrollbar-color: rgba(255,255,255,.25) transparent; }

/* 대상 설명 패널 (좌상단, 좌표 아래) */
#objectInfo { position: absolute; left: 16px; top: calc(var(--topbar-h) + 38px); max-height: calc(100vh - var(--topbar-h) - 110px); overflow-y: auto; scrollbar-width: thin; width: min(360px, calc(100vw - 110px)); box-sizing: border-box; padding: 12px 36px 12px 14px; background: var(--glass); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--glass-shadow); backdrop-filter: blur(8px); color: var(--ink); z-index: 6; opacity: 1; transform: none; transition: opacity .35s ease, transform .35s ease; }
#objectInfo[hidden] { display: block; opacity: 0; transform: translateY(-6px); pointer-events: none; }
#objectInfo h1 { margin: 0 0 4px; font-size: 16px; font-weight: 700; line-height: 1.35; }
#objectInfo p { margin: 0; font-size: 12.5px; line-height: 1.6; color: var(--ink-soft); }
#objectClose { position: absolute; top: 6px; right: 6px; width: 26px; height: 26px; border: 0; border-radius: 50%; background: transparent; color: var(--ink-soft); font-size: 18px; cursor: pointer; }
#objectClose:hover { background: rgba(255,255,255,.12); color: var(--ink); }

.obj-bar { display: flex; align-items: center; gap: 8px; margin-top: 10px; }
.obj-nav { display: inline-flex; align-items: center; gap: 2px; margin-right: auto; background: rgba(255,255,255,.08); border: 1px solid var(--line); border-radius: 999px; padding: 2px; }
.obj-nav button { width: 28px; height: 26px; border: 0; border-radius: 999px; background: transparent; color: var(--ink); font-size: 18px; line-height: 24px; cursor: pointer; }
.obj-nav button:hover { background: rgba(255,255,255,.14); }
#objIndex { min-width: 44px; text-align: center; font-size: 11.5px; color: var(--ink-soft); font-variant-numeric: tabular-nums; }
.chip { height: 30px; padding: 0 11px; border: 1px solid var(--line); border-radius: 999px; background: rgba(255,255,255,.08); color: var(--ink); font-size: 12.5px; cursor: pointer; white-space: nowrap; }
.chip:hover { background: rgba(255,255,255,.16); }
#objLike[aria-pressed="true"] { background: rgba(255, 92, 122, .22); border-color: rgba(255, 92, 122, .55); }
#objLike[aria-pressed="true"] .heart { color: #ff6b88; }
#objComments { margin-top: 10px; border-top: 1px solid var(--line); padding-top: 8px; }
#objComments[hidden] { display: none; }
#objCommentList { list-style: none; margin: 0 0 8px; padding: 0; max-height: 220px; overflow-y: auto; }
#objCommentList li { padding: 6px 0; border-bottom: 1px solid var(--line); font-size: 12.5px; line-height: 1.55; }
#objCommentList li b { font-weight: 600; margin-right: 6px; }
#objCommentList li time { color: var(--ink-soft); font-size: 11px; }
#objCommentList li p { margin: 2px 0 0; white-space: pre-wrap; word-break: break-word; }
#objCommentList li.empty { color: var(--ink-soft); border: 0; }
#objCommentForm { display: grid; grid-template-columns: 1fr auto; gap: 6px; }
#objCommentForm input, #objCommentForm textarea { box-sizing: border-box; width: 100%; padding: 6px 10px; border: 1px solid var(--line); border-radius: 8px; background: rgba(255,255,255,.08); color: var(--ink); font: inherit; font-size: 12.5px; outline: none; }
#objCommentForm input::placeholder, #objCommentForm textarea::placeholder { color: rgba(238,242,248,.5); }
#objCommentName { grid-column: 1 / 3; }
#objCommentBody { resize: vertical; min-height: 38px; }
#objCommentForm button { align-self: stretch; padding: 0 14px; border: 0; border-radius: 8px; background: var(--accent-strong); color: #fff; cursor: pointer; }
.hp { position: absolute !important; left: -9999px !important; width: 1px; height: 1px; }

/* 하단 댓글 흐름 */
#ticker { position: absolute; left: 50%; bottom: 44px; transform: translateX(-50%); max-width: min(560px, calc(100vw - 180px)); padding: 9px 16px; background: var(--glass); border: 1px solid var(--line); border-radius: 999px; box-shadow: var(--glass-shadow); backdrop-filter: blur(8px); color: var(--ink); font-size: 13px; line-height: 1.45; cursor: pointer; z-index: 6; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; transition: opacity .5s ease; }
#ticker[hidden] { display: block; opacity: 0; pointer-events: none; }
#ticker.fade { opacity: 0; }
#ticker .q { color: var(--accent); font-size: 16px; margin-right: 4px; }
#ticker .who { color: var(--ink-soft); font-size: 11.5px; margin-left: 8px; }
#ticker:hover { background: var(--glass-strong); }
body.drawer-open #ticker { left: calc(50% - (var(--drawer-w) + 32px) / 2); }
@media (max-width: 640px) { #ticker { max-width: calc(100vw - 32px); bottom: 64px; } body.drawer-open #ticker { left: 50%; } }

/* 표시 층: 유리 캡슐 안의 둥근 아이콘 버튼 */
.chips { display: inline-flex; flex: 0 0 auto; gap: 4px; padding: 3px; background: rgba(255,255,255,.07); border: 1px solid var(--line); border-radius: 999px; }
.chips .chip { --c: #ffffff; position: relative; width: 32px; height: 32px; padding: 0; display: grid; place-items: center; border: 1px solid transparent; border-radius: 50%; background: transparent; color: var(--ink-soft); cursor: pointer; transition: background .2s, color .2s, box-shadow .2s, border-color .2s; }
.chips .chip svg { width: 19px; height: 19px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.chips .chip svg circle, .chips .chip svg .f { fill: currentColor; stroke: none; }
.chips .chip svg .t { fill: currentColor; stroke: none; font-family: var(--font); }
.chips .chip:hover { background: rgba(255,255,255,.1); color: var(--ink); }
.chips .chip[aria-pressed="true"] { color: #0b1322; background: var(--c); border-color: var(--c); box-shadow: 0 0 0 3px color-mix(in srgb, var(--c) 25%, transparent), 0 0 14px color-mix(in srgb, var(--c) 45%, transparent); }
.chips .chip[data-layer="photo"] { --c: #e8eef8; }
.chips .chip[data-layer="stars"] { --c: #8cdcff; }
.chips .chip[data-layer="lines"] { --c: #9cc3ff; }
.chips .chip[data-layer="bounds"] { --c: #f2c14e; }
.chips .chip[data-layer="names"] { --c: #d9c8ff; }
.chips .chip[data-layer="planets"] { --c: #ffd45a; }
.chips .chip[data-layer="planets"] svg circle.f { fill: currentColor; }
/* 이름표: 마우스를 올리면 버튼 아래에 */
.chips .chip span { position: absolute; top: calc(100% + 8px); left: 50%; transform: translateX(-50%) translateY(-3px); padding: 3px 8px; border-radius: 6px; background: rgba(6,9,16,.85); color: var(--ink); font-size: 11.5px; font-weight: 500; white-space: nowrap; opacity: 0; pointer-events: none; transition: opacity .15s, transform .15s; }
.chips .chip:hover span, .chips .chip:focus-visible span { opacity: 1; transform: translateX(-50%); }
@media (max-width: 640px) { .chips { order: 4; } }

/* 언어 선택 */
#langBox { position: relative; flex: 0 0 auto; }
#langBtn { width: 38px; height: 38px; display: grid; place-items: center; border: 1px solid var(--line); border-radius: 10px; background: rgba(255,255,255,.1); cursor: pointer; padding: 0; }
#langBtn:hover { background: rgba(255,255,255,.18); }
#langBtn img { width: 24px; height: 16px; border-radius: 2px; box-shadow: 0 0 0 1px rgba(255,255,255,.25); display: block; }
#langMenu { position: absolute; top: calc(100% + 8px); right: 0; min-width: 150px; margin: 0; padding: 6px; list-style: none; background: var(--glass-strong); border: 1px solid var(--line); border-radius: 10px; box-shadow: var(--glass-shadow); backdrop-filter: blur(12px); z-index: 30; }
#langMenu[hidden] { display: none; }
#langMenu a { display: flex; align-items: center; gap: 10px; padding: 7px 10px; border-radius: 7px; color: var(--ink); font-size: 13px; text-decoration: none; }
#langMenu a:hover { background: rgba(255,255,255,.1); }
#langMenu a[aria-current="true"] { background: rgba(143,188,255,.18); font-weight: 600; }
#langMenu img { width: 22px; height: 15px; border-radius: 2px; box-shadow: 0 0 0 1px rgba(255,255,255,.25); }
@media (max-width: 640px) { #langBox { order: 2; margin-left: auto; } #drawerToggle { margin-left: 0; } }
