:root {
  --bg: #020309;
  --ink: #eef1f8;
  --ink-2: #aab2c5;
  --ink-3: #7c859b;
  --line: rgba(255, 255, 255, 0.12);
  --panel: rgba(12, 14, 26, 0.92);
  --panel-solid: #0c0e1a;
  /* 흐림(backdrop-filter) 없이 짙은 반투명 — 흐림은 3D 가 움직이는 동안 매 장면 다시 계산돼 폰·노트북 그래픽을 잡아먹었다 */
  --glass: rgba(9, 11, 21, 0.8);
  --glass-2: rgba(9, 11, 21, 0.9);
  --lift: 0 8px 28px rgba(0, 0, 0, 0.45);
  --accent: #9fc3ff;
  --gold: #ffd8a0;
  --danger: #ff8a8a;
  --ok: #9be3b8;
  --radius: 14px;
  --font: "Pretendard Variable", Pretendard, -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", "Malgun Gothic", sans-serif;
  color-scheme: dark;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation; /* 두 번 누르기 확대 대기(약 0.3초) 없이 바로 */
}

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* WebGL 판(별)은 뒤, #sky(누르기·고른 별·고리)는 앞. 배경 은하 빛은 body */
body {
  background:
    radial-gradient(ellipse 60% 60% at 72% 28%, rgba(46, 58, 120, 0.16), transparent 70%),
    radial-gradient(ellipse 65% 65% at 22% 78%, rgba(70, 40, 110, 0.10), transparent 70%),
    radial-gradient(ellipse 90% 90% at 50% 50%, rgba(20, 30, 60, 0.18), transparent 75%),
    var(--bg);
}
#sky-gl {
  position: fixed; inset: 0;
  width: 100%; height: 100%;
  display: block;
  pointer-events: none;
}
#sky {
  position: fixed; inset: 0;
  width: 100%; height: 100%;
  display: block;
  touch-action: none;
  cursor: grab;
  outline: none;
}
#sky.on-star { cursor: pointer; }
#sky.dragging { cursor: grabbing; }
#sky:focus-visible { box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.35); }

button, .btn, input { font: inherit; }

button, .btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 40px; padding: 0 16px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--ink);
  font-size: 14px; font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  user-select: none; -webkit-user-select: none;
  transition: background-color .12s, border-color .12s, opacity .12s, transform .08s;
}
/* 누르는 순간 눌린 티 — 그림이 바뀌기 전에도 손끝에 바로 반응 */
button:active:not(:disabled), .btn:active { transform: scale(.96); transition-duration: 0s; }
button:focus-visible, .btn:focus-visible, input:focus-visible, summary:focus-visible, .brand:focus-visible {
  outline: 2px solid #fff; outline-offset: 2px;
}
button:disabled { opacity: .45; cursor: not-allowed; }

.primary { background: #f4f6fb; color: #070912; border-color: #f4f6fb; }
.primary:hover:not(:disabled) { background: #fff; }
.ghost { background: rgba(255, 255, 255, 0.04); }
.ghost:hover:not(:disabled) { background: rgba(255, 255, 255, 0.1); }
.sm { min-height: 34px; padding: 0 12px; font-size: 13px; }

.tag {
  display: inline-block;
  padding: 2px 7px;
  border: 1px solid rgba(255, 216, 160, 0.4);
  border-radius: 999px;
  color: var(--gold);
  font-size: 11px; font-weight: 600; line-height: 1.4;
  letter-spacing: .02em;
}

/* ---------- 상단 ---------- */

.top {
  position: fixed; top: 0; left: 0; right: 0;
  display: flex; align-items: center; gap: 10px;
  padding: max(14px, env(safe-area-inset-top)) max(20px, env(safe-area-inset-right)) 14px max(20px, env(safe-area-inset-left));
  background: linear-gradient(to bottom, rgba(2, 3, 9, 0.85), rgba(2, 3, 9, 0));
  pointer-events: none;
  z-index: 2;
}
.top > * { pointer-events: auto; }

.brand {
  display: inline-flex; align-items: center; gap: 10px;
  color: var(--ink); text-decoration: none;
  border-radius: 8px;
}
.brand-star {
  width: 10px; height: 10px; border-radius: 50%;
  background: #fff;
  box-shadow: 0 0 6px 2px rgba(255, 255, 255, 0.7), 0 0 18px 6px rgba(160, 180, 255, 0.25);
}
.brand-name { font-family: 'Pretendard Variable', Pretendard, -apple-system, 'Apple SD Gothic Neo', 'Malgun Gothic', sans-serif; font-size: 20px; font-weight: 900; letter-spacing: -.01em; line-height: 1; }

.top-actions { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.pill { gap: 1px; background: var(--glass); font-variant-numeric: tabular-nums; }
.pill b { font-weight: 700; }
.top .ghost { background: var(--glass); }
.top .ghost:hover { background: rgba(28, 32, 50, 0.9); }

/* ---------- 이벤트 알림 ---------- */

.notice {
  position: fixed; top: 74px; left: 50%; transform: translateX(-50%);
  min-height: 34px; padding: 0 12px 0 10px;
  font-size: 13px; font-weight: 500;
  color: var(--ink-2);
  background: var(--glass);
  z-index: 2;
  white-space: nowrap;
}
.notice:hover { color: var(--ink); }
.notice-dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--gold);
  box-shadow: 0 0 6px 2px rgba(255, 216, 160, 0.6);
  animation: twinkle 2.4s ease-in-out infinite;
}
.notice.quiet .notice-dot { background: var(--ink-3); box-shadow: none; animation: none; }

@keyframes twinkle { 50% { opacity: .35; } }

/* ---------- 바닥 ---------- */

.hud {
  position: fixed; left: max(20px, env(safe-area-inset-left)); bottom: max(16px, env(safe-area-inset-bottom));
  right: 20px;
  pointer-events: none;
  z-index: 1;
}
.hud { display: flex; flex-direction: column; transition: right .18s ease-out; }
body.side-open .hud { right: calc(var(--side-w, 0px) + 20px); }
.hud p { margin: 0; text-shadow: 0 0 1px #000, 0 0 2px #000, 0 0 4px #000, 0 0 8px rgba(0, 0, 0, .9); } /* 은하 중심처럼 하얗게 밝은 장면에서도 읽히게 */
.hud-row { order: -1; display: flex; align-items: flex-end; justify-content: space-between; gap: 10px; margin-bottom: 10px; }
.hud-row > * { pointer-events: auto; }

/* ---------- 별의 신분증(js/starcard.js) ---------- */

.astro-row {
  display: flex; align-items: center; gap: 8px; width: 100%; margin: 0 0 12px;
  padding: 9px 12px; border-radius: 12px; border: 1px solid var(--line); background: rgba(255, 255, 255, 0.03);
  color: var(--ink-2); font: inherit; font-size: 13px; text-align: left; cursor: pointer;
}
.astro-row[hidden] { display: none; }
.astro-row:hover { border-color: rgba(255, 255, 255, 0.3); }
.astro-row b { color: var(--ink); font-size: 14px; white-space: nowrap; }
.astro-row > span:not(.astro-dot):not(.astro-more) { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.astro-dot { flex: none; width: 10px; height: 10px; border-radius: 50%; }
.astro-more { margin-left: auto; flex: none; color: var(--ink); font-weight: 600; white-space: nowrap; }

dialog.astro { width: min(560px, calc(100% - 32px)); }
.ah { display: flex; align-items: center; gap: 14px; }
.ah-orb { flex: none; width: 54px; height: 54px; border-radius: 50%; }
.ah-spec { margin: 0; font-size: 22px; font-weight: 800; letter-spacing: -0.3px; }
.ah-sub { margin: 2px 0 0; font-size: 13px; color: var(--ink-3); }
.ah-intro { margin: 12px 0 4px; font-size: 14.5px; line-height: 1.6; color: var(--ink-2); }
.as { margin-top: 18px; }
.as h3 { margin: 0 0 8px; font-size: 14px; font-weight: 700; color: var(--ink); }
.agrid { margin: 8px 0 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.af { padding: 10px 12px; border-radius: 12px; background: rgba(255, 255, 255, 0.035); border: 1px solid rgba(255, 255, 255, 0.06); min-width: 0; }
.af dt { font-size: 11.5px; color: var(--ink-3); }
.af dd { margin: 3px 0 0; font-size: 15px; font-weight: 700; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.af-note { margin: 3px 0 0; font-size: 11.5px; color: var(--ink-3); line-height: 1.4; }
.spec, .hzd { display: block; width: 100%; height: auto; }
.spec .ax, .hzd .ax { fill: var(--ink-3); font-size: 9px; }
.hzd .ax.dim { opacity: 0.7; }
.cap { margin: 6px 0 0; font-size: 12.5px; line-height: 1.55; color: var(--ink-3); }
.life { height: 8px; border-radius: 99px; background: rgba(255, 255, 255, 0.08); overflow: hidden; }
.life span { display: block; height: 100%; border-radius: 99px; }
.fate, .light { margin: 10px 0 0; font-size: 14px; line-height: 1.65; color: var(--ink-2); }
.light { margin-top: 0; }
.eqs { margin-top: 18px; border-top: 1px solid var(--line); padding-top: 10px; }
.eqs summary { cursor: pointer; font-size: 13px; font-weight: 600; color: var(--ink-2); }
.eqs p { margin: 6px 0 0; font-size: 12px; line-height: 1.55; color: var(--ink-3); font-family: ui-monospace, Consolas, monospace; overflow-wrap: anywhere; }
.more-link { display: inline-block; margin-top: 14px; font-size: 14px; font-weight: 600; color: var(--ink); }
.count { font-size: 13px; font-weight: 600; color: var(--ink-2); font-variant-numeric: tabular-nums; }
/* 3D 하늘 조작 안내 — 처음 한 번 만지면 사라진다(app.js) */
.sky-hint { font-size: 12px; color: var(--ink-3); margin-bottom: 4px !important; transition: opacity .6s; }
.sky-hint.gone { opacity: 0; }
.sky-hint .for-touch { display: none; }
@media (pointer: coarse) {
  .sky-hint .for-mouse { display: none; }
  .sky-hint .for-touch { display: inline; }
}

.empty-hint {
  position: fixed; left: 50%; top: 50%; transform: translate(-50%, 90px);
  text-align: center; color: var(--ink-3); font-size: 14px;
  pointer-events: none; z-index: 1;
}
.empty-hint p { margin: 4px 0; }
.empty-title { color: var(--ink-2); font-size: 16px; font-weight: 600; }

.toast {
  position: fixed; left: 50%; bottom: 84px; transform: translate(-50%, 8px);
  max-width: calc(100% - 32px);
  padding: 10px 16px;
  border-radius: 999px;
  background: rgba(244, 246, 251, 0.95); color: #070912;
  font-size: 14px; font-weight: 600;
  opacity: 0; pointer-events: none;
  transition: opacity .2s, transform .2s;
  z-index: 10;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---------- 대화창 ---------- */

dialog {
  width: min(440px, calc(100% - 32px));
  max-height: calc(100% - 48px);
  overflow: auto;
  padding: 20px 22px 22px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: var(--panel-solid);
  color: var(--ink);
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.6), 0 0 0 1px rgba(255, 255, 255, 0.02);
}
dialog:focus { outline: none; }
dialog::backdrop { background: rgba(0, 0, 0, 0.6); }
dialog[open] { animation: pop .14s ease-out; }
@keyframes pop { from { opacity: 0; transform: translateY(6px) scale(.98); } }

.dlg-head { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.dlg-head h2 { margin: 0; font-size: 18px; font-weight: 700; }
/* 별 창 제목 옆 남은 시간(실시간) */
.left-time {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 10px; border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.14); background: rgba(255, 255, 255, 0.05);
  color: var(--ink); font-size: 13px; font-weight: 600; white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.left-time:empty { display: none; }
.left-time.soon { border-color: rgba(255, 120, 120, 0.5); color: #ffb4b4; }
.left-time.over { color: var(--ink-3); }
/* 폰: 제목이 보이는 창(사이트)은 제목·✕ 한 줄, 남은 시간은 그 아래 줄. 영상 창은 제목이 없어 남은 시간·✕ 한 줄 */
@media (max-width: 480px) {
  #dlg-star .dlg-head:has(.left-time:not(:empty)) { flex-wrap: wrap; row-gap: 6px; }
  #dlg-star .dlg-head .left-time { order: 3; }
}
.x {
  margin-left: auto;
  width: 36px; height: 36px; min-height: 0; padding: 0;
  border: 0; background: transparent; color: var(--ink-3); font-size: 16px;
}
.x:hover { color: var(--ink); background: rgba(255, 255, 255, 0.06); }

.lead { margin: 0 0 16px; color: var(--ink-2); font-size: 14px; line-height: 1.6; }
.help { margin: 8px 0 0; color: var(--ink-3); font-size: 12.5px; line-height: 1.55; }
.error { margin: 8px 0 0; color: var(--danger); font-size: 13px; line-height: 1.5; }
.error:empty, .ok-msg:empty { display: none; }
.ok-msg { margin: 10px 0 0; color: var(--ok); font-size: 13px; line-height: 1.5; }

.field-label { display: block; margin-bottom: 8px; font-size: 13px; font-weight: 600; color: var(--ink-2); }
input[type="text"], input[type="search"] {
  width: 100%; height: 48px; padding: 0 14px;
  border: 1px solid var(--line); border-radius: 12px;
  background: rgba(255, 255, 255, 0.04); color: var(--ink);
  font-size: 16px;
}
input[type="text"]::placeholder, input[type="search"]::placeholder { color: #5b6377; }
input[type="search"] { font-family: inherit; outline: none; }
input[type="search"]:focus { border-color: rgba(255, 255, 255, 0.35); }
input[aria-invalid="true"] { border-color: var(--danger); }

.cost-row {
  display: flex; justify-content: space-between; align-items: center;
  margin-top: 16px; padding: 12px 14px;
  border-radius: 12px; background: rgba(255, 255, 255, 0.04);
  font-size: 14px; color: var(--ink-2);
}
.cost-row b { color: var(--ink); font-size: 16px; }

.actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 20px; flex-wrap: wrap; }
.actions.stack { flex-direction: column; align-items: stretch; margin-top: 14px; }

.facts { margin: 0; display: grid; gap: 10px; }
.facts > div { display: grid; grid-template-columns: 84px 1fr; gap: 10px; font-size: 14px; line-height: 1.55; }
.facts dt { color: var(--ink-3); }
.facts dd { margin: 0; color: var(--ink); min-width: 0; }
.url { overflow-wrap: anywhere; word-break: break-all; }
.cond { margin: 0; padding-left: 18px; }
.cond li + li { margin-top: 2px; }

.domain { margin: 6px 0 4px; font-size: 22px; font-weight: 700; overflow-wrap: anywhere; }
.small { margin: 0; font-size: 12.5px; color: var(--ink-3); }
.warn {
  margin: 14px 0 0; padding: 12px 14px;
  border-radius: 12px; background: rgba(255, 255, 255, 0.04);
  color: var(--ink-2); font-size: 13px; line-height: 1.6;
}
.mine { margin: 10px 0 0; font-size: 13px; color: var(--gold); }

/* 영상 재생 창 */
dialog.video { width: min(760px, calc(100% - 32px)); }
dialog.video.narrow { width: min(420px, calc(100% - 32px)); }
.player {
  position: relative;
  aspect-ratio: 16 / 9;
  border-radius: 12px; overflow: hidden;
  background: #000;
}
.player.vertical { aspect-ratio: 9 / 16; height: min(68vh, 680px); margin: 0 auto; max-width: 100%; }
/* 인스타 영상 칸 = 임베드 폭 × 1.25 — 높이를 폭에서 정해야 아래 좋아요 칸이 안 비친다 */
.player.insta { aspect-ratio: 4 / 5; height: auto; width: min(100%, 480px, calc(62vh * 0.8)); }
.player.insta.post { aspect-ratio: auto; height: min(72vh, 720px); width: 100%; background: #fff; }
.player > div { position: absolute; inset: 0; }

/* js/player.js — 유튜브는 famytp.js 가 스스로 꾸민다. 나머지는 famytp 와 같은 class 의 단추 + 아래 무대 */
.sbp-stage { width: 100%; height: 100%; aspect-ratio: auto; }
.famytp.sbp[data-fs="1"] .sbp-stage { width: 100%; max-width: none; height: 100%; }
.sbp-ttframe { position: absolute; left: 0; width: 100%; border: 0; pointer-events: none; }
.sbp-tt[data-fs="1"] .sbp-stage { width: auto; height: 100%; aspect-ratio: 9 / 16; margin: 0 auto; }
/* 비메오·영상 파일: 무대 꽉, 영상은 비율대로(남는 곳은 검정). 누르기는 위 덮개가 받는다 */
.sbp-fillframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; pointer-events: none; }
.sbp-video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; background: #000; }
/* 페이스북: SDK 가 data-width 폭의 iframe 을 만든다 → 가운데. 페북 단추는 덮개 아래라 안 뜬다 */
.sbp-fbwrap { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; }
.sbp-fbwrap .fb-video, .sbp-fbwrap .fb-video > span { display: block; }
.sbp-fbwrap iframe { pointer-events: none; border: 0; }
/* 멈춘 동안 페북이 영상 위쪽에 띄우는 제목·이름·「공유하기」 줄을 덮는다(재생 중엔 페북이 안 띄워 걷는다) */
.sbp-fbshade {
  position: absolute; left: 0; right: 0; top: 0; height: 104px; pointer-events: none;
  background: linear-gradient(#000 0, #000 70%, rgba(0, 0, 0, 0));
  opacity: 0; transition: opacity .15s ease;
}
.sbp-fbshade.low { top: auto; bottom: 0; height: 84px; background: linear-gradient(rgba(0, 0, 0, 0), #000 34%, #000); }
.sbp-fb[data-playing="0"] .sbp-fbshade { opacity: 1; }
.sbp-ig { overflow: hidden; background: #000; }
.sbp-igframe { position: absolute; left: -1px; top: 0; width: calc(100% + 2px); height: calc(100% + 480px); border: 0; }
.sbp-ig.post .sbp-igframe { left: 0; width: 100%; height: 100%; }
.sbp-plain .sbp-fillframe { pointer-events: auto; }

.ev-title { margin: 0 0 14px; font-size: 20px; font-weight: 700; }

.events-list, .mine-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.event-item, .mine-item {
  padding: 14px; border: 1px solid var(--line); border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.02);
}
.event-item p { margin: 6px 0 0; font-size: 13px; color: var(--ink-2); line-height: 1.5; }
.event-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.event-head .state { font-size: 12px; color: var(--gold); }

/* 내 별 — 데스크톱은 오른쪽 옆 판 */
dialog.side {
  margin: 0 0 0 auto; height: 100%; max-height: 100%;
  width: min(420px, 100%);
  border-radius: 0; border-width: 0 0 0 1px;
}
dialog.side[open] { animation: slide .2s ease-out; }
@keyframes slide { from { transform: translateX(24px); opacity: 0; } }
.mine-list { margin-top: 14px; }
.mine-item .url { margin: 0 0 10px; font-size: 14px; font-weight: 600; }
.meta { margin: 0; display: grid; grid-template-columns: repeat(3, auto); justify-content: start; gap: 4px 18px; }
.meta div { min-width: 0; }
.meta div.wide { grid-column: 1 / -1; } /* 남은 기간은 길어서 한 줄 전체 */
.meta dt { font-size: 11.5px; color: var(--ink-3); }
.meta dd { margin: 2px 0 0; font-size: 13px; }
.mine-actions { display: flex; gap: 6px; margin-top: 12px; flex-wrap: wrap; }
.mine-empty { margin-top: 30px; text-align: center; color: var(--ink-2); }

.big-points { margin: 4px 0 12px; font-size: 34px; font-weight: 800; font-variant-numeric: tabular-nums; }
.center { text-align: center; }

/* 공지 한 줄(관리자 설정) */
.site-notice {
  position: fixed; top: 70px; left: 50%; transform: translateX(-50%);
  max-width: calc(100% - 32px); margin: 0;
  padding: 7px 14px; border-radius: 999px;
  background: rgba(255, 216, 160, 0.12); border: 1px solid rgba(255, 216, 160, 0.3);
  color: var(--gold); font-size: 13px; font-weight: 600; line-height: 1.4;
  text-align: center; z-index: 2; pointer-events: none;
}
body.has-notice .notice { top: 112px; }

/* 글자만 있는 단추(신고·나가기) */
.link-btn {
  min-height: 40px; padding: 0 6px; border: 0; background: transparent;
  color: var(--ink-3); font-size: 13px; font-weight: 500; text-decoration: underline; text-underline-offset: 3px;
}
.link-btn:hover:not(:disabled) { color: var(--ink); }
.actions .report-btn { margin-right: auto; }

/* 내 구글 계정 카드 */
.account-card {
  padding: 14px 16px; margin-bottom: 4px;
  display: grid; gap: 4px;
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.04);
}
.account-label { font-size: 12px; color: var(--ink-3); font-weight: 500; }
.acc-email { font-size: 16px; font-weight: 700; overflow-wrap: anywhere; }
.account-sub { font-size: 12.5px; color: var(--ink-2); font-weight: 500; line-height: 1.5; }
.acc-actions { display: flex; align-items: center; justify-content: flex-end; gap: 8px; margin-top: 4px; }

/* 구글 로그인 단추(구글 규정: 흰 바탕 + 4색 G) */
.google-btn {
  width: 100%; min-height: 50px; display: flex; align-items: center; justify-content: center; gap: 10px;
  border: 1px solid #dadce0; border-radius: 12px; background: #fff; color: #1f1f1f; font-size: 15px; font-weight: 600;
}
.google-btn:hover:not(:disabled) { background: #f4f6f8; }
.g-logo { width: 20px; height: 20px; flex: none; }
#dlg-login .help { margin-top: 12px; }
.warn-text { color: var(--gold); }

input[type="password"], textarea {
  width: 100%; height: 48px; padding: 0 14px;
  border: 1px solid var(--line); border-radius: 12px;
  background: rgba(255, 255, 255, 0.04); color: var(--ink);
  font: inherit; font-size: 16px;
}
textarea { height: auto; padding: 10px 14px; resize: vertical; line-height: 1.5; }
input[type="password"]::placeholder { color: #5b6377; letter-spacing: 0; }

/* 신고 이유 */
.reasons { margin: 12px 0 14px; padding: 0; border: 0; display: grid; gap: 4px; }
.reasons legend { margin-bottom: 6px; padding: 0; font-size: 13px; font-weight: 600; color: var(--ink-2); }
.reasons label {
  display: flex; align-items: center; gap: 10px; min-height: 44px; padding: 0 12px;
  border: 1px solid var(--line); border-radius: 12px; font-size: 14px; cursor: pointer;
}
.reasons label:has(input:checked) { border-color: rgba(255, 255, 255, 0.5); background: rgba(255, 255, 255, 0.06); }
.reasons input { width: 18px; height: 18px; margin: 0; accent-color: #fff; }

/* ---------- 10-29 「사랑하는 사람은 별이 됩니다」 ---------- */

body { background: #000; }
#sky { background: transparent; }

/* 처음 한 줄 */
.hero {
  position: fixed; left: 50%; top: 21%; transform: translateX(-50%);
  width: min(640px, calc(100% - 32px)); text-align: center; pointer-events: none; z-index: 1;
  transition: opacity 0.5s ease, transform 0.5s ease;
}
.hero h1 {
  margin: 0; font-size: clamp(26px, 5.2vw, 44px); font-weight: 300; letter-spacing: -0.02em; line-height: 1.25;
  text-shadow: 0 0 24px rgba(0, 0, 0, 0.9), 0 0 3px #000;
}
.hero h1 em { font-style: normal; font-weight: 700; color: #fff4e2; text-shadow: 0 0 18px rgba(255, 220, 170, 0.55), 0 0 3px #000; }
.hero p { margin: 12px 0 0; font-size: clamp(14px, 2.4vw, 16px); color: var(--ink-2); line-height: 1.6; text-shadow: 0 0 12px #000, 0 0 2px #000; }
.hero.gone { opacity: 0; transform: translate(-50%, -10px); }

/* 마우스 아래 이름 */
.tip {
  position: fixed; left: 0; top: 0; z-index: 3; pointer-events: none;
  padding: 5px 10px; border-radius: 999px; background: rgba(10, 12, 22, 0.82); border: 1px solid var(--line);
  font-size: 12.5px; font-weight: 600; color: var(--ink); white-space: nowrap;
}

/* 오른쪽 아래 둥근 단추(찾기·우주 여행·수업·공유) — 넓은 화면은 세로 묶음, 마우스를 올리면 왼쪽에 이름 */
.dock { display: grid; gap: 4px; flex: none; padding: 4px; border-radius: 26px; border: 1px solid var(--line); background: var(--glass); box-shadow: var(--lift); }
.round {
  position: relative;
  width: 46px; height: 46px; min-height: 0; padding: 0; border-radius: 50%; border: 0;
  background: transparent;
}
.round svg { width: 21px; height: 21px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.round:hover { background: rgba(255, 255, 255, 0.1); }
.round .lbl {
  position: absolute; right: calc(100% + 10px); top: 50%; transform: translate(4px, -50%); opacity: 0;
  padding: 6px 10px; border-radius: 9px; background: var(--glass-2); border: 1px solid var(--line);
  font-size: 12.5px; font-weight: 600; white-space: nowrap; pointer-events: none; transition: opacity .12s, transform .12s;
}
.round:hover .lbl, .round:focus-visible .lbl { opacity: 1; transform: translate(0, -50%); }
/* 넓은 화면: 처음 온 사람도 바로 알게 아이콘 옆에 이름을 늘 보인다(마우스를 올려야 뜨던 것) */
@media (min-width: 561px) {
  .dock .round { width: auto; justify-content: flex-start; gap: 9px; padding: 0 16px 0 13px; border-radius: 23px; }
  .dock .round .lbl { position: static; opacity: 1; transform: none; padding: 0; background: none; border: 0; box-shadow: none; transition: none; font-size: 13px; color: var(--ink-2); }
  .dock .round:hover .lbl { color: var(--ink); }
}

/* 별 창 */
dialog.star { width: min(480px, calc(100% - 32px)); }
.st-dot { flex: none; width: 14px; height: 14px; border-radius: 50%; align-self: flex-start; margin-top: 6px; }
.st-title { min-width: 0; }
.st-title h2 { overflow-wrap: anywhere; }
.st-sub { margin: 3px 0 0; font-size: 12.5px; color: var(--ink-3); line-height: 1.5; }
.mem {
  margin: 6px 0 14px; padding: 20px 18px 16px; border-radius: 16px; text-align: center;
  background: radial-gradient(120% 90% at 50% 0%, rgba(255, 226, 180, 0.09), rgba(255, 255, 255, 0.02) 70%);
  border: 1px solid rgba(255, 226, 180, 0.16);
}
.mem-photo { margin: 0 auto 14px; width: 132px; height: 132px; border-radius: 50%; overflow: hidden; border: 1px solid rgba(255, 236, 206, 0.35); box-shadow: 0 0 28px rgba(255, 220, 170, 0.18); }
.mem-photo img { width: 100%; height: 100%; object-fit: cover; display: block; }
.mem-kicker { margin: 0; font-size: 12px; letter-spacing: .08em; color: rgba(255, 236, 206, 0.7); }
.mem-name { margin: 6px 0 0; font-size: 26px; font-weight: 300; }
.mem-name b { font-weight: 700; }
.mem-go { font-size: 18px; color: var(--ink-2); }
.mem-dates { margin: 6px 0 0; font-size: 13.5px; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.mem-rel { margin: 4px 0 0; font-size: 13.5px; color: rgba(255, 236, 206, 0.85); }
.mem-msg {
  margin: 14px 0 0; padding: 0; font-size: 15px; line-height: 1.75; color: var(--ink);
  white-space: pre-wrap; overflow-wrap: anywhere; text-align: center;
}
.mem-foot { display: flex; align-items: center; justify-content: center; gap: 10px; margin-top: 16px; flex-wrap: wrap; }
.remember { gap: 6px; border-color: rgba(255, 226, 180, 0.4); color: #ffe9c8; background: rgba(255, 226, 180, 0.06); }
.remember svg { width: 16px; height: 16px; fill: currentColor; }
.remember.done { opacity: .7; }
.remember:hover:not(:disabled) { background: rgba(255, 226, 180, 0.14); }
.mem-count { font-size: 12.5px; color: var(--ink-3); }
.empty { margin: 6px 0 12px; }
.empty .lead { margin: 0; }
.ah-mem { margin: 12px 0 0; font-size: 14px; color: #ffe9c8; }

/* 기리기 창 */
dialog.reg { width: min(520px, calc(100% - 32px)); }
.reg-star { display: grid; gap: 2px; margin: 0 0 16px; padding: 12px 14px; border-radius: 12px; background: rgba(255, 226, 180, 0.06); border: 1px solid rgba(255, 226, 180, 0.16); }
.reg-star b { font-size: 14px; color: #ffe9c8; }
.reg-star span { font-size: 12.5px; color: var(--ink-3); }
#reg-form .field-label { margin-top: 14px; }
#reg-form .field-label:first-of-type { margin-top: 0; }
.req { margin-left: 4px; font-size: 11px; color: var(--gold); font-weight: 500; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
input[type="date"] {
  width: 100%; height: 48px; padding: 0 12px; border: 1px solid var(--line); border-radius: 12px;
  background: rgba(255, 255, 255, 0.04); color: var(--ink); font: inherit; font-size: 15px;
}
.counter { text-align: right; margin-top: 4px; }
.photo-pick { display: flex; align-items: center; gap: 12px; }
.photo-pick img { width: 64px; height: 64px; border-radius: 50%; object-fit: cover; border: 1px solid var(--line); }
.photo-pick label.btn { cursor: pointer; }

/* 찾기 */
.find-list { list-style: none; margin: 12px 0 0; padding: 0; display: grid; gap: 6px; max-height: 50vh; overflow: auto; }
.find-list button { width: 100%; justify-content: space-between; border-radius: 12px; padding: 10px 14px; min-height: 48px; text-align: left; }
.find-list button b { font-weight: 600; }
.find-list button span { font-size: 12px; color: var(--ink-3); font-weight: 500; }
.find-list button.mem b { color: #ffe9c8; }

/* 우주 여행 */
.go-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin-top: 12px; }
.go-grid button { flex-direction: column; align-items: flex-start; gap: 2px; border-radius: 12px; padding: 10px 14px; min-height: 54px; text-align: left; }
.go-grid button span { font-size: 11.5px; color: var(--ink-3); font-weight: 500; }

/* 내 별 */
.mine-head { display: flex; align-items: center; gap: 12px; }
.mine-photo { width: 48px; height: 48px; border-radius: 50%; object-fit: cover; flex: none; }
.mine-name { margin: 0; font-size: 16px; font-weight: 700; }
.mine-star { margin: 2px 0 0; font-size: 12.5px; color: var(--ink-3); }
.mine-dates, .mine-count { margin: 8px 0 0; font-size: 12.5px; color: var(--ink-2); }

/* ---------- 폰 ---------- */

@media (max-width: 560px) {
  .top { padding-left: 16px; padding-right: 16px; gap: 8px; }
  .brand-name { font-size: 17px; }
  .top > .tag { display: none; }
  .top-actions { gap: 6px; }
  .top-actions button { min-height: 36px; padding: 0 12px; font-size: 13px; }
  .notice { top: 64px; }
  .site-notice { top: 62px; font-size: 12.5px; }
  body.has-notice .notice { top: 100px; }
  .actions:not(.stack) > .report-btn { flex: none; }
  .login-row { flex-wrap: wrap; }
  .login-row button { flex: 1 1 100%; }
  .hud { left: 16px; right: 16px; }
  .hero { top: 17%; }
  .round { width: 44px; height: 44px; }
  .mem-photo { width: 112px; height: 112px; }
  .mem-name { font-size: 23px; }

  dialog:not(.side) {
    width: 100%; max-width: 100%;
    margin: auto 0 0; max-height: 88%;
    border-radius: 20px 20px 0 0; border-width: 1px 0 0;
    padding-bottom: max(22px, env(safe-area-inset-bottom));
  }
  dialog:not(.side)[open] { animation: up .2s ease-out; }
  @keyframes up { from { transform: translateY(24px); opacity: 0; } }
  .actions:not(.stack) > * { flex: 1 1 auto; white-space: nowrap; } /* 긴 단추(원래 페이지에서 보기)가 두 줄로 꺾이지 않게 */
  .facts > div { grid-template-columns: 72px 1fr; }
  dialog.video, dialog.video.narrow { width: 100%; max-height: 94%; }
  .player.vertical { height: min(64vh, 620px); }
  .player.insta { height: auto; width: min(100%, calc(58vh * 0.8)); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* ---------- 시간 조절: 한 막대 [⏪ ⏸ ⏩ | 날짜·빠르기 | 지금] ---------- */
.timebar {
  display: inline-flex; align-items: center; gap: 2px; min-width: 0; height: 52px; padding: 0 6px;
  border-radius: 16px; border: 1px solid var(--line); background: var(--glass); box-shadow: var(--lift);
}
.timebar .tb { min-height: 0; width: 38px; height: 38px; padding: 0; border: 0; border-radius: 11px; background: transparent; flex: none; }
.timebar .tb svg { width: 19px; height: 19px; fill: currentColor; }
.timebar .tb:hover { background: rgba(255, 255, 255, 0.09); }
.timebar .tb .i-play, .timebar .tb.paused .i-pause { display: none; }
.timebar .tb.paused .i-play { display: block; }
.timebar .tb.paused { color: var(--gold); }
.timebar .tb.now { width: auto; padding: 0 12px; font-size: 13px; font-weight: 700; color: var(--ink-2); }
.t-read { display: grid; gap: 2px; padding: 0 12px 0 10px; margin: 0 4px; border-left: 1px solid var(--line); border-right: 1px solid var(--line); line-height: 1.15; font-variant-numeric: tabular-nums; white-space: nowrap; min-width: 150px; }
.t-read b { font-size: 13.5px; font-weight: 650; letter-spacing: -.01em; }
.t-read span { font-size: 11.5px; color: var(--ink-3); min-height: 13px; }
body.time-away .timebar { border-color: rgba(255, 216, 160, 0.45); }
body.time-away .t-read span { color: var(--gold); }
body.time-away .timebar .tb.now { color: #070912; background: var(--gold); }

/* ---------- 정보 창·백과 ---------- */
dialog.info, dialog.kb { width: min(520px, 100%); }
.in-body { font-size: 14.5px; line-height: 1.7; color: var(--ink-2); }
.in-body h3 { margin: 18px 0 8px; font-size: 14.5px; color: var(--ink); }
.in-body p { margin: 10px 0 0; }
.kb-sum { color: var(--ink) !important; font-size: 15px; }
.kb-full { display: inline-block; margin: 10px 0 2px; padding: 6px 13px; border-radius: 999px; background: rgba(124, 196, 255, .12); color: #9fd3ff; font-size: 13.5px; font-weight: 700; text-decoration: none; }
.kb-full:hover { background: rgba(124, 196, 255, .2); }
.live { margin-top: 6px; }
.exo-pl { border-top: 1px solid var(--line); padding-top: 12px; margin-top: 12px; }
.exo-pl > b { display: block; font-size: 14px; color: var(--ink); }
.exo-pl.hz > b { color: #5fe3c8; }
.kb-sec { margin-top: 8px; }
.deep { margin-top: 16px; border-top: 1px solid var(--line); padding-top: 10px; }
.deep summary { cursor: pointer; font-size: 13.5px; font-weight: 700; color: var(--gold); }
.kb-view { margin-top: 10px; padding: 9px 12px; border-radius: 10px; background: rgba(255, 255, 255, .03); border-left: 2px solid var(--gold); }
.kb-view p { margin: 0 !important; }
.kb-view .vside { font-size: 12px; font-weight: 700; color: var(--gold); }
.kb-view .vwho { font-size: 12.5px; color: var(--ink-3); margin-bottom: 3px !important; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.chip { min-height: 0; padding: 6px 11px; border-radius: 999px; font-size: 12.5px; font-weight: 600; }
.kb-rel { margin-top: 16px !important; font-size: 12.5px; font-weight: 700; color: var(--ink-3); }
.refs { margin-top: 14px !important; font-size: 11.5px; color: var(--ink-3); line-height: 1.6; }
.refs > b { font-weight: 700; margin-right: 2px; }
.refs a { color: #9fc3ff; text-decoration: underline; text-underline-offset: 2px; text-decoration-color: rgba(159,195,255,.4); }
.refs a::after { content: ' ↗'; font-size: 10px; }
.kb-groups { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
.kbg { min-height: 0; padding: 6px 11px; border-radius: 999px; font-size: 12.5px; font-weight: 600; background: transparent; }
.kbg.on { background: var(--ink); color: #05060c; border-color: var(--ink); }
dialog.kb .find-list { max-height: none; }
/* 백과 사진: 항목 머리 큰 사진 + 띠, 목록 작은 사진, 찾기 사진 칸, 크게 보기 */
.kb-gal { margin: 4px 0 6px; }
.kb-hero { display: block; width: 100%; padding: 0; min-height: 0; border: 0; border-radius: 12px; overflow: hidden; background: #000; cursor: zoom-in; }
.kb-hero img { display: block; width: 100%; height: auto; max-height: 62vh; object-fit: contain; background: #000; }
.in-body .kb-cap { margin: 6px 0 0; font-size: 12.5px; line-height: 1.5; color: var(--ink-3); }
.kb-strip { display: flex; gap: 6px; margin-top: 8px; overflow-x: auto; scroll-snap-type: x proximity; padding-bottom: 4px; }
.kb-th { flex: none; width: 92px; height: 68px; padding: 0; min-height: 0; border: 1px solid var(--line); border-radius: 9px; overflow: hidden; background: #000; scroll-snap-align: start; cursor: zoom-in; }
.kb-th img { display: block; width: 100%; height: 100%; object-fit: cover; }
.kb-th:hover, .kb-th:focus-visible { border-color: var(--gold); }
.find-list button.kb-item { justify-content: flex-start; gap: 12px; padding: 8px 12px 8px 8px; }
.kb-thumb { flex: none; width: 64px; height: 48px; border-radius: 8px; object-fit: cover; background: #000; }
.kb-tx { display: grid; gap: 2px; min-width: 0; }
.kb-tx span { overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.kb-tx em { font-style: normal; font-size: 11.5px; color: var(--gold); font-weight: 600; }
.kb-photos { margin-top: 12px; }
.kb-photos[hidden] { display: none; }
.kb-ph-h { margin: 0 0 6px; font-size: 12.5px; font-weight: 700; color: var(--ink-3); }
.kb-ph-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 6px; }
.kb-ph-grid .kb-th { width: auto; height: auto; aspect-ratio: 4 / 3; }
dialog.photo { width: 100vw; max-width: 100vw; height: 100dvh; max-height: 100dvh; margin: 0; padding: 0; border: 0; border-radius: 0; background: #000; display: none; }
dialog.photo[open] { display: flex; flex-direction: column; }
.ph-stage { position: relative; flex: 1; min-height: 0; overflow: hidden; display: flex; align-items: center; justify-content: center; }
.ph-stage img { max-width: 100%; max-height: 100%; object-fit: contain; cursor: zoom-in; user-select: none; -webkit-user-drag: none; }
.ph-stage.zoom { overflow: auto; display: block; }
.ph-stage.zoom img { max-width: none; max-height: none; cursor: zoom-out; }
.ph-nav { position: absolute; top: 50%; transform: translateY(-50%); width: 48px; height: 64px; min-height: 0; padding: 0; border-radius: 12px; font-size: 34px; line-height: 1; background: rgba(0, 0, 0, .45); border-color: rgba(255, 255, 255, .18); }
.ph-nav.prev { left: max(10px, env(safe-area-inset-left)); }
.ph-nav.next { right: max(10px, env(safe-area-inset-right)); }
.ph-nav[hidden] { display: none; }
.ph-stage.zoom .ph-nav { position: fixed; }
.ph-x { position: fixed; top: max(10px, env(safe-area-inset-top)); right: max(10px, env(safe-area-inset-right)); background: rgba(0, 0, 0, .55); z-index: 2; }
.ph-meta { flex: none; padding: 10px 16px max(12px, env(safe-area-inset-bottom)); background: #05060c; border-top: 1px solid var(--line); }
.ph-cap { margin: 0; font-size: 14px; line-height: 1.5; color: var(--ink); }
.ph-credit { margin: 4px 0 0; font-size: 11.5px; line-height: 1.5; color: var(--ink-3); overflow-wrap: anywhere; }
.ph-credit a { color: #9fc3ff; }
#kb-q, #find-q { width: 100%; margin-top: 10px; }
.go-h { margin: 18px 0 0; font-size: 13px; color: var(--ink-3); font-weight: 700; }
dialog.side .actions { position: sticky; bottom: 0; padding: 12px 0 4px; background: linear-gradient(transparent, var(--panel-solid) 30%); }
@media (max-width: 560px) {
  /* 폰: 맨 아래 = 탭 막대(찾기·우주 여행·수업·공유, 글자 붙은 큰 단추), 그 위 = 시간 막대 한 줄, 그 위 = 숫자 한 줄 */
  .hud { left: max(10px, env(safe-area-inset-left)); right: max(10px, env(safe-area-inset-right)); bottom: max(8px, env(safe-area-inset-bottom)); }
  .hud-row { order: 0; flex-direction: column; align-items: stretch; gap: 8px; margin: 0; }
  .timebar { display: flex; height: 50px; padding: 0 4px; }
  .timebar .tb { width: 40px; height: 40px; }
  .t-read { flex: 1; min-width: 0; padding: 0 8px; margin: 0 2px; }
  .t-read b { font-size: 13px; overflow: hidden; text-overflow: ellipsis; }
  .dock {
    display: grid; grid-template-columns: repeat(4, 1fr); gap: 0; padding: 4px;
    border-radius: 18px; border: 1px solid var(--line); background: var(--glass-2); box-shadow: var(--lift);
  }
  .dock .round { width: auto; height: 54px; border-radius: 14px; flex-direction: column; gap: 3px; border: 0; background: transparent; box-shadow: none; }
  .dock .round svg { width: 22px; height: 22px; }
  .dock .round .lbl { position: static; opacity: 1; transform: none; padding: 0; background: none; border: 0; box-shadow: none; font-size: 11px; font-weight: 600; color: var(--ink-2); pointer-events: none; }
  .dock .round:active { background: rgba(255, 255, 255, 0.1); }
  .hud .count { font-size: 11px; line-height: 1.4; margin-bottom: 8px !important; padding-right: 118px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; } /* 오른쪽 = 축척 자리 */
  .hud .count span:nth-child(n+3) { display: none; }
  .sky-hint { font-size: 11.5px; margin-bottom: 4px !important; }
  .toast { bottom: calc(150px + env(safe-area-inset-bottom)); }
}

/* ---------- 수업 모드(안내 여행)·장면 공유 — js/tour.js ---------- */
.tour-grid { grid-template-columns: 1fr; }
.tour-grid button { min-height: 62px; }
.tour-grid button b { font-size: 15.5px; }
/* 자막 판: 상자 대신 한쪽에서 옅어지는 그늘 — 뒤 우주가 그대로 비친다. 글씨는 교실 뒤에서도 읽히게 크게 */
.tourbar {
  position: fixed; z-index: 30; display: flex; flex-direction: column;
  left: 0; top: 0; bottom: 0; width: clamp(340px, 31vw, 480px);
  padding: 84px 28px max(24px, env(safe-area-inset-bottom)) max(28px, env(safe-area-inset-left));
  /* 글 뒤(앞 3/4)는 별 이름표가 글과 겹치지 않을 만큼 진하게, 오른쪽 끝으로 갈수록 우주가 비친다 */
  background: linear-gradient(to right, rgba(2, 3, 9, 0.9) 0%, rgba(2, 3, 9, 0.86) 74%, rgba(2, 3, 9, 0) 100%);
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.85);
}
.tb-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.tb-step { font-size: 14px; font-weight: 700; color: var(--gold); letter-spacing: .02em; }
.tb-dots { display: flex; gap: 4px; margin: 10px 0 0; padding: 0; list-style: none; }
.tb-dots li { flex: 1; }
.tb-dots button { display: block; width: 100%; min-height: 0; height: 18px; padding: 0; border: 0; border-radius: 0; background: none; position: relative; }
.tb-dots button::before { content: ''; position: absolute; left: 0; right: 0; top: 7px; height: 4px; border-radius: 2px; background: rgba(255, 255, 255, 0.18); }
.tb-dots .done::before { background: rgba(255, 255, 255, 0.55); }
.tb-dots .now::before { background: #fff; }
.tb-dots .now.auto::after { content: ''; position: absolute; left: 0; top: 7px; height: 4px; border-radius: 2px; background: var(--gold); animation: tbfill var(--tb-auto, 15s) linear forwards; }
@keyframes tbfill { from { width: 0; } to { width: 100%; } }
.tb-body { flex: 1; display: flex; flex-direction: column; justify-content: center; min-height: 0; overflow-y: auto; padding: 16px 0; }
.tourbar h2 { margin: 0 0 14px; font-size: clamp(26px, 2.5vw, 40px); line-height: 1.25; letter-spacing: -.01em; }
#tb-text { margin: 0; font-size: clamp(17px, 1.42vw, 22px); line-height: 1.75; color: #dfe4ef; word-break: keep-all; }
.tb-read { align-self: flex-start; margin-top: 16px; font-size: 15px; font-weight: 600; color: #9fc3ff; text-decoration: underline; text-underline-offset: 3px; }
.tb-nav { display: flex; gap: 10px; }
.tb-nav button { flex: 1; min-height: 52px; border-radius: 14px; font-size: 17px; }
.tb-nav .tb-btn { flex: 0 0 34%; }
.tb-tools { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.tb-btn { min-height: 38px; padding: 0 12px; border-radius: 12px; font-size: 13.5px; background: rgba(8, 10, 20, 0.45); }
.tb-tools .tb-btn { flex: 1; padding: 0 8px; white-space: nowrap; }
.tb-btn[aria-pressed="true"] { background: rgba(255, 216, 160, 0.16); border-color: rgba(255, 216, 160, 0.55); color: var(--gold); }
.tb-keys { margin: 10px 0 0; font-size: 12.5px; color: var(--ink-3); line-height: 1.4; }
.tb-show {
  position: fixed; z-index: 30; left: max(16px, env(safe-area-inset-left)); bottom: max(16px, env(safe-area-inset-bottom));
  gap: 10px; min-height: 44px; padding: 0 8px 0 16px; background: rgba(8, 10, 20, 0.6); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
}
.tb-show span { color: var(--ink-2); font-weight: 600; }
.tb-show b { padding: 6px 12px; border-radius: 999px; background: #f4f6fb; color: #070912; font-size: 13px; }
body.touring .hud, body.touring .hero { display: none; }
body.touring .top { background: none; z-index: 31; }
/* 좁거나 세로 화면: 아래에서 올라오는 그늘. 천체는 그 위 빈 곳 한가운데 */
@media (max-width: 899px), (max-aspect-ratio: 1/1) {
  .tourbar {
    top: auto; right: 0; width: auto; max-height: 58%;
    padding: 40px max(16px, env(safe-area-inset-right)) max(14px, env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left));
    background: linear-gradient(to top, rgba(2, 3, 9, 0.88) 0%, rgba(2, 3, 9, 0.74) 72%, rgba(2, 3, 9, 0) 100%);
  }
  .tb-body { flex: 0 1 auto; padding: 8px 0 12px; }
  .tourbar h2 { margin-bottom: 6px; font-size: 21px; }
  #tb-text { font-size: 15.5px; line-height: 1.65; }
  .tb-read { margin-top: 8px; font-size: 14px; }
  .tb-nav button { min-height: 46px; font-size: 16px; }
  .tb-tools { margin-top: 8px; }
  .tb-keys, #tb-full { display: none; }
}
.share-row { display: flex; gap: 8px; margin-top: 12px; }
.share-row input { flex: 1; min-width: 0; height: 44px; padding: 0 12px; border: 1px solid var(--line); border-radius: 12px; background: rgba(255, 255, 255, 0.04); color: var(--ink); font: inherit; font-size: 13px; }
.share-qr { display: flex; justify-content: center; margin: 16px auto 4px; min-height: 40px; color: var(--ink-3); font-size: 13px; }
.share-qr img, .share-qr canvas { padding: 10px; background: #fff; border-radius: 12px; }
#dlg-share { width: min(440px, calc(100% - 32px)); }

/* ---------- 판(모달 없이 연 창: 정보·백과·찾기·여행·수업·공유) — js/app.js open() ---------- */
/* 3D 를 가리지 않고 그대로 움직이게 둔다. 넓은 화면 = 오른쪽 옆 판, 폰 = 아래에서 올라오는 판 */
dialog:not(:modal) { position: fixed; z-index: 20; color: var(--ink); }
dialog.side:not(:modal) { inset: 0 0 0 auto; margin: 0; height: 100%; max-height: 100dvh; box-shadow: -18px 0 48px rgba(0, 0, 0, 0.45); }
dialog:not(.side):not(:modal) { inset: 0; margin: auto; height: fit-content; box-shadow: 0 30px 80px rgba(0, 0, 0, 0.65), 0 0 0 1px rgba(255, 255, 255, 0.03); }
dialog.side { background: #0a0c17; }
/* 머리(제목·닫기)는 판을 내려 읽어도 위에 붙어 있다 */
dialog .dlg-head {
  position: sticky; top: -20px; z-index: 3;
  margin: -20px -22px 12px; padding: 16px 16px 12px 22px;
  background: inherit; border-bottom: 1px solid transparent;
}
dialog.side .dlg-head { background: #0a0c17; border-bottom-color: rgba(255, 255, 255, 0.06); }
dialog:not(.side) .dlg-head { background: var(--panel-solid); }
dialog.photo .dlg-head { display: none; }
.x { border-radius: 10px; color: var(--ink-2); flex: none; }
.x svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.x.back { margin-left: -8px; }
.x.back + .st-dot { margin-left: 0; }
.dlg-head .x:last-child { margin-left: auto; }
.find-list button, .go-grid button { background: rgba(255, 255, 255, 0.025); border-color: rgba(255, 255, 255, 0.08); }
.find-list button:hover, .go-grid button:hover { background: rgba(255, 255, 255, 0.07); border-color: rgba(255, 255, 255, 0.18); }
.go-grid button b { font-size: 14.5px; }
.go-h { letter-spacing: .02em; }
.kbg:hover { background: rgba(255, 255, 255, 0.06); }
dialog.side .actions .primary { min-height: 46px; padding: 0 22px; box-shadow: 0 6px 20px rgba(0, 0, 0, 0.5); }
/* 판 안 스크롤 막대: 얇게 */
dialog { scrollbar-width: thin; scrollbar-color: rgba(255, 255, 255, 0.18) transparent; }
@media (max-width: 560px) {
  /* 폰: 판은 아래에서. 정보 판은 처음 반쯤(위로 3D 가 보이게) — 판 안을 밀어 올리거나 머리를 누르면 크게 */
  dialog.side, dialog.side:not(:modal) {
    inset: auto 0 0 0; margin: 0; width: 100%; max-width: 100%; height: auto; max-height: 50dvh;
    border-radius: 20px 20px 0 0; border-width: 1px 0 0; padding-bottom: max(18px, env(safe-area-inset-bottom));
    box-shadow: 0 -12px 40px rgba(0, 0, 0, 0.5); transition: max-height .2s ease-out;
  }
  dialog.side.full { max-height: 92dvh; }
  dialog.side[open] { animation: up .2s ease-out; }
  dialog:not(.side):not(:modal) { inset: auto 0 0 0; margin: 0; width: 100%; max-width: 100%; }
  dialog .dlg-head { padding-top: 20px; margin-left: -22px; margin-right: -22px; }
  dialog.side .dlg-head, dialog:not(.side):not(:modal) .dlg-head { border-radius: 20px 20px 0 0; cursor: grab; }
  dialog.side .dlg-head::before, dialog:not(.side):not(:modal) .dlg-head::before {
    content: ''; position: absolute; left: 50%; top: 7px; width: 38px; height: 4px; margin-left: -19px; border-radius: 2px; background: rgba(255, 255, 255, 0.22);
  }
  dialog.side .actions { padding-bottom: 0; }
  .go-grid { gap: 6px; }
  .go-grid button { min-height: 56px; padding: 9px 12px; }
}
/* 화면 밖 칸은 그리기·배치를 미룬다 — 긴 백과 목록·정보 판이 열리는 순간 굳지 않게 */
.find-list > li { content-visibility: auto; contain-intrinsic-size: auto 64px; }
.in-body > .kb-sec > p, .in-body > .kb-sec > details, .exo-pl { content-visibility: auto; contain-intrinsic-size: auto 120px; }
.go-grid > button { content-visibility: auto; contain-intrinsic-size: auto 56px; }
body.side-open .hud .count, body.side-open .hud .sky-hint { display: none; }
body.side-tight .hud .timebar { display: none; }
body.side-tight .hud-row { justify-content: flex-end; }
body.side-open .hud-row { margin-bottom: 40px; } /* 숫자 줄을 접어도 오른쪽 아래 축척 자리는 비워 둔다 */
@media (max-height: 500px) { .hud .count, .hud .sky-hint { display: none; } } /* 폰 가로: 바닥 글은 접고 우주를 넓게 */

/* 폰: 머리의 로고·분야 글자는 보이는 크기가 작다 — 누르는 자리만 넓힘 */
@media (pointer: coarse) {
  .fsb-logo, .fsb-field { position: relative; }
  .fsb-logo::after { content: ''; position: absolute; inset: -8px -8px -3px; }
  .fsb-field::after { content: ''; position: absolute; inset: -3px -8px -8px; }
}
