/* ============================================================
   galaxy.css — 갤럭시 오브 어스 (lessonType: galaxy)
   .gx-* 로 스코프. 우주 다크 테마(앱 라이트 테마와 독립).
   ============================================================ */
.gx-stage, .gx-host {
  --gx-bg: #05060f; --gx-panel: rgba(18,20,38,.72); --gx-line: rgba(140,160,255,.18);
  --gx-ink: #eef0ff; --gx-muted: #9aa3d0; --accent: #8aa0ff;
  /* flex:1 로 부모(stage-*) 컬럼의 남는 높이만 채운다. 100dvh 를 강제하면
     전역 푸터(© minssam)가 화면 밖으로 밀리므로 min-height:0 으로 둔다. */
  position: relative; flex: 1; min-height: 0; color: var(--gx-ink);
  background:
    radial-gradient(1200px 800px at 70% -10%, rgba(90,80,200,.25), transparent 60%),
    radial-gradient(900px 700px at 10% 110%, rgba(40,120,180,.18), transparent 55%),
    var(--gx-bg);
}
.gx-stage { display: flex; flex-direction: column; padding: 16px; }
.gx-stage.scroll { overflow-y: auto; }
.gx-center-stage { align-items: center; justify-content: center; }
.gx-stage > div { width: 100%; max-width: 520px; margin: 0 auto; }

.gx-glass { background: var(--gx-panel); border: 1px solid var(--gx-line); border-radius: 18px; backdrop-filter: blur(10px); }
.gx-label { font-size: 12.5px; font-weight: 700; color: var(--gx-muted); letter-spacing: .02em; }
.gx-hint { font-size: 11.5px; color: var(--gx-muted); margin-top: 6px; line-height: 1.5; }
.gx-err { color: #ff9aa2; font-size: 13px; margin-top: 10px; }
.gx-sheet-sub { color: var(--gx-muted); font-size: 13px; margin: 2px 0 4px; line-height: 1.5; }
.gx-note-ok { color: #9be7b0; font-size: 13px; }

.gx-btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 12px 20px;
  border-radius: 999px; font-weight: 700; font-size: 15px; border: 1px solid transparent; cursor: pointer;
  color: #0a0c1a; background: var(--accent); transition: transform .12s ease, box-shadow .15s, opacity .15s; font-family: inherit; }
.gx-btn:hover { transform: translateY(-1px); box-shadow: 0 8px 24px rgba(138,160,255,.3); }
.gx-btn:active { transform: translateY(0) scale(.98); }
.gx-btn:disabled { opacity: .4; cursor: not-allowed; box-shadow: none; transform: none; }
.gx-btn.ghost { background: transparent; color: var(--gx-ink); border-color: var(--gx-line); }
.gx-btn.ghost:hover { background: rgba(140,160,255,.12); box-shadow: none; }
.gx-link { background: none; border: none; color: var(--gx-muted); font-size: 13px; cursor: pointer; font-family: inherit; }
.gx-link:hover { color: var(--gx-ink); }

.gx-input { width: 100%; padding: 12px 14px; border-radius: 12px; background: rgba(10,12,28,.6);
  border: 1.5px solid var(--gx-line); color: var(--gx-ink); font-size: 15px; outline: none; font-family: inherit; }
.gx-input:focus { border-color: var(--accent); }

.gx-chip { padding: 7px 12px; border-radius: 999px; font-size: 12.5px; font-weight: 700; border: 1.5px solid var(--gx-line);
  background: rgba(10,12,28,.5); color: var(--gx-muted); cursor: pointer; transition: all .12s ease; font-family: inherit; }
.gx-chip:hover { border-color: var(--accent); color: var(--gx-ink); }
.gx-chip.on { background: var(--accent); color: #0a0c1a; border-color: var(--accent); }
.gx-chip:disabled { opacity: .5; cursor: not-allowed; }
.gx-tags { display: flex; flex-wrap: wrap; gap: 7px; }

.gx-canvas { border-radius: 14px; overflow: hidden; }
.gx-canvas canvas { display: block; width: 100%; height: 100%; }
.gx-canvas-fallback { display: flex; align-items: center; justify-content: center; height: 100%;
  font-size: 40px; color: var(--gx-muted, #9aa3d0); background: rgba(10,12,28,.4); border-radius: 14px; }

/* 입장/생성 */
.gx-entry { max-width: 380px; width: 100%; padding: 28px; text-align: center; }
.gx-entry-title { font-size: 26px; margin: 6px 0 2px; }
.gx-field { margin-bottom: 14px; }

/* 라이브 */
.gx-topbar { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; font-size: 13px; color: var(--gx-muted); }
.gx-topbar b { color: var(--gx-ink); }
.gx-banner { padding: 10px 14px; margin-bottom: 12px; font-size: 14px; font-weight: 700; text-align: center; }
.gx-explore-head { display: flex; align-items: center; justify-content: space-between; margin: 4px 2px 10px; }
.gx-sentcount { font-size: 12.5px; color: var(--gx-muted); }
.gx-sentcount.ok { color: #9be7b0; }
.gx-buddy { padding: 10px 14px; margin-bottom: 10px; font-size: 13px; }
.gx-planet-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 10px; }
.gx-planet-tile { padding: 12px; text-align: center; cursor: pointer; border: 1px solid var(--gx-line); color: var(--gx-ink); font-family: inherit; }
.gx-planet-tile:hover { transform: translateY(-2px); transition: transform .12s; }
.gx-tile-name { font-weight: 800; font-size: 14px; margin-top: 4px; }
.gx-tile-sub { font-size: 11px; color: var(--gx-muted); }
.gx-note-ok { text-align: center; margin-top: 12px; }
.gx-received { font-size: 13px; }
/* 💌 받은 방명록 (본인 것만 · 작성자 익명) */
.gx-guestbook { text-align: left; }
.gx-gb-list { display: flex; flex-direction: column; gap: 6px; max-height: 180px; overflow-y: auto; }
.gx-gb-item { display: flex; align-items: baseline; gap: 8px; border: 1px solid var(--gx-line); border-radius: 10px; padding: 8px 12px; background: rgba(140,160,255,.06); }
.gx-gb-tag { flex: none; font-size: 10.5px; font-weight: 800; color: #8aa0ff; border: 1px solid rgba(140,160,255,.35); border-radius: 99px; padding: 1px 8px; }
.gx-gb-msg { font-size: 13px; line-height: 1.5; color: #dfe4ff; }
/* 케어 패널 요약(이름 숨김 기본) */
.gx-care-sum { font-size: 13px; color: var(--gx-muted); margin-bottom: 6px; }
.gx-care-sum b { color: #ffd45e; }
.gx-reccard { border: 1px solid; border-radius: 10px; padding: 8px 12px; animation: gxFloat .4s ease both; }
@keyframes gxFloat { from { transform: translateY(8px); opacity: 0; } to { transform: none; opacity: 1; } }

/* 이벤트 타이머 */
.gx-event { padding: 16px; margin-bottom: 12px; text-align: center; border-color: #ffb05e55; }
.gx-event-timer { font-size: 30px; font-weight: 900; color: #ffd45e; }
.gx-event-live { background: rgba(255,180,90,.12); border: 1px solid #ffb05e55; border-radius: 9px; padding: 8px 10px; margin-bottom: 8px; }

/* 모달 */
.gx-overlay { position: fixed; inset: 0; z-index: 60; background: rgba(2,3,10,.6); display: flex; align-items: center; justify-content: center; padding: 16px; }
.gx-sheet { width: 100%; max-width: 420px; padding: 22px; background: var(--gx-panel, rgba(18,20,38,.95)); border: 1px solid rgba(140,160,255,.18); border-radius: 18px; backdrop-filter: blur(10px); color: #eef0ff; max-height: 92vh; overflow-y: auto; animation: gxFloat .35s ease both; }
.gx-sheet.wide { max-width: 440px; }
.gx-sheet-title { margin: 4px 0 2px; font-size: 20px; }
.gx-card-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.gx-starcard { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 12px 6px; border-radius: 14px;
  border: 1.5px solid rgba(140,160,255,.18); background: rgba(10,12,28,.5); color: #eef0ff; cursor: pointer; font-family: inherit; }
.gx-starcard.used { opacity: .4; cursor: not-allowed; }
.gx-starcard-emoji { font-size: 26px; }
.gx-starcard-label { font-size: 12.5px; font-weight: 800; }
.gx-starcard-used { font-size: 10px; color: #9aa3d0; }
.gx-talks { margin-top: 12px; display: flex; flex-direction: column; gap: 6px; }
.gx-talk { background: rgba(10,12,28,.5); border: 1px solid rgba(140,160,255,.18); border-radius: 10px; padding: 8px 12px; }
.gx-talk-label { font-size: 11px; color: #9aa3d0; font-weight: 700; }
.gx-talk-body { font-size: 14px; }

/* 포스터 */
.gx-poster { padding: 18px; text-align: center; }
.gx-poster h2 { font-size: 20px; margin: 0 0 4px; }
.gx-poster-preview { border-radius: 16px; padding: 26px 18px; margin-top: 8px; }
.gx-poster-name { font-size: 22px; font-weight: 900; color: #fff; margin-top: 6px; }
.gx-poster-title { color: #ffd45e; font-weight: 800; font-size: 15px; margin-top: 4px; text-shadow: 0 1px 8px #0008; }
.gx-poster-iam { color: #ffffffcc; font-size: 14px; margin-top: 4px; }
/* 🏅 REVEAL 칭호 배지 — 받은 별빛 조합의 언어화 */
.gx-title-badge { display: flex; flex-direction: column; align-items: center; gap: 2px;
  margin: 10px auto 14px; padding: 12px 18px; max-width: 340px; border-radius: 16px;
  background: linear-gradient(135deg, #ffd45e22, #ff6ec722); border: 1px solid #ffd45e55; }
.gx-title-emoji { font-size: 28px; }
.gx-title-name { font-size: 17px; font-weight: 900; color: #ffd45e; letter-spacing: .5px; }
.gx-title-sub { font-size: 12px; color: #aab4ff; }
.gx-poster-count { color: #fff; font-weight: 800; margin-top: 12px; }

.gx-center { text-align: center; color: var(--gx-muted, #9aa3d0); padding: 40px; font-size: 16px; }
.gx-center.small { padding: 18px; font-size: 13.5px; }

/* ===== 교사 호스트 ===== */
.gx-host { display: flex; flex-direction: column; }
.gx-host-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; padding: 12px 20px; border-bottom: 1px solid var(--gx-line); }
.gx-host-room { display: flex; align-items: center; gap: 12px; }
.gx-back { flex: none; }
.gx-host-id { display: flex; flex-direction: column; gap: 2px; }
.gx-kicker { font-size: 11.5px; font-weight: 800; color: var(--gx-muted); letter-spacing: .02em; }
.gx-host-idrow { display: flex; align-items: baseline; gap: 12px; }
.gx-roomcode { font-size: 32px; font-weight: 900; letter-spacing: .12em; line-height: 1; }
.gx-host-count { font-size: 13px; color: var(--gx-muted); } .gx-host-count b { color: var(--gx-ink); font-size: 15px; }
.gx-phasebar { display: flex; align-items: center; gap: 5px; flex-wrap: wrap; }
/* Phase 칩 — 번호 배지 + 현재/완료 상태 시각화 */
.gx-phasechip { display: inline-flex; align-items: center; gap: 5px; padding: 6px 11px 6px 7px; }
.gx-phasechip-no { display: inline-flex; align-items: center; justify-content: center; width: 17px; height: 17px;
  border-radius: 50%; background: rgba(140,160,255,.18); color: var(--gx-muted); font-size: 10.5px; font-weight: 900; }
.gx-phasechip.on { background: var(--accent); color: #0a0c1a; border-color: var(--accent); }
.gx-phasechip.on .gx-phasechip-no { background: #0a0c1a; color: var(--accent); }
.gx-phasechip.done { color: var(--gx-ink); border-color: rgba(140,160,255,.4); }
.gx-phasechip.done .gx-phasechip-no { background: var(--accent); color: #0a0c1a; }
.gx-host-body { flex: 1; display: flex; min-height: 0; }
.gx-host-side { width: 320px; flex: none; padding: 16px; overflow-y: auto; border-right: 1px solid var(--gx-line); }
.gx-host-main { flex: 1; position: relative; min-width: 0; }
.gx-host-empty { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; text-align: center; color: var(--gx-muted); line-height: 1.7; }
.gx-host-empty b { color: var(--gx-ink); }
.gx-galaxy-canvas canvas { display: block; }
.gx-phase-label { position: absolute; left: 16px; bottom: 16px; z-index: 5; padding: 8px 16px; font-weight: 800;
  background: var(--gx-panel); border: 1px solid var(--gx-line); border-radius: 12px; }

/* 학생 입장 QR 패널 */
.gx-join { display: flex; gap: 12px; align-items: center; }
.gx-join-qr { flex: none; background: #fff; padding: 6px; border-radius: 10px; line-height: 0; }
.gx-join-qr img { display: block; border-radius: 4px; }
.gx-join-qr-fallback { width: 150px; height: 150px; display: flex; align-items: center; justify-content: center; color: var(--gx-muted); }
.gx-join-info { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.gx-join-code { font-size: 28px; font-weight: 900; letter-spacing: .1em; }
.gx-join-url { font-size: 12px; color: var(--gx-muted); word-break: break-all; }

.gx-panel { padding: 14px; margin-bottom: 12px; }
.gx-panel-title { font-weight: 800; font-size: 14px; }
.gx-panel-hint { font-size: 11.5px; color: var(--gx-muted); margin: 2px 0 10px; }
.gx-group-name { font-size: 11px; color: var(--gx-muted); margin: 4px 0; }
.gx-care-row { display: flex; justify-content: space-between; align-items: center; border: 1px solid var(--gx-line);
  border-radius: 9px; padding: 6px 10px; font-size: 13px; margin-bottom: 5px; background: rgba(255,200,120,.1); }
.gx-care-row.zero { background: rgba(255,120,120,.12); }
.gx-care-n { color: #ffcf8a; font-weight: 800; }
.gx-care-row.zero .gx-care-n { color: #ff9aa2; }
.gx-stats { display: flex; gap: 8px; }
.gx-stat { flex: 1; background: rgba(10,12,28,.5); border: 1px solid var(--gx-line); border-radius: 10px; padding: 8px 4px; text-align: center; }
.gx-stat b { display: block; font-size: 22px; font-weight: 900; }
.gx-stat span { font-size: 11px; color: var(--gx-muted); }

@media (max-width: 768px) {
  /* 모바일: 호스트를 flex:1(뷰포트 채움)에서 자연 높이로 풀어 head+side+main 이
     푸터 위로 오버플로하지 않게 한다. 길어지면 페이지가 스크롤됨. */
  .gx-host { flex: none; }
  .gx-host-head { padding: 10px 14px; gap: 10px; }
  /* Phase 바는 줄바꿈(헤더가 2~3줄로 길어져 본문과 겹침) 대신 가로 스크롤 */
  .gx-phasebar { flex-wrap: nowrap; overflow-x: auto; -webkit-overflow-scrolling: touch; max-width: 100%; padding-bottom: 2px; }
  .gx-phasebar .gx-chip { flex: none; white-space: nowrap; }
  .gx-host-body { flex-direction: column; }
  .gx-host-side { width: 100%; border-right: none; border-bottom: 1px solid var(--gx-line); max-height: none; }
  .gx-host-main { flex: none; min-height: 62vh; }
  .gx-roomcode { font-size: 24px; }
  .gx-host-room { flex-wrap: wrap; gap: 8px; }
}
@media (prefers-reduced-motion: reduce) { .gx-reccard, .gx-sheet { animation: none !important; } }

/* 행성 만들기 위저드 (메모장형 한 단계=질문 2개) */
.gx-wiz-bar { display: flex; gap: 5px; margin-bottom: 14px; }
.gx-wiz-seg { flex: 1; height: 4px; border-radius: 2px; background: var(--gx-line); transition: background .3s ease; }
.gx-wiz-seg.on { background: var(--accent); }
.gx-wiz-q { font-size: 16px; font-weight: 700; color: var(--gx-ink); margin: 12px 0 4px; line-height: 1.45; }
.gx-wiz-hint { font-size: 12.5px; color: var(--gx-muted); line-height: 1.5; margin-bottom: 8px; }
.gx-wiz-ta { resize: vertical; min-height: 56px; line-height: 1.5; }
.gx-wiz-count { text-align: right; font-size: 11.5px; color: var(--gx-muted); margin-top: 3px; }
.gx-wiz-nav { display: flex; gap: 8px; margin-top: 18px; }

/* 입장 시 실명 선택 (명렬 학급 — classmate 매핑용) */
.gx-namepick { display: flex; flex-wrap: wrap; gap: 8px; max-height: 168px; overflow-y: auto; }
.gx-namechip {
  padding: 8px 12px; border-radius: 999px; border: 1px solid rgba(255,255,255,.25);
  background: rgba(255,255,255,.08); color: #eef0ff; font-size: 13px; font-weight: 600; cursor: pointer;
}
.gx-namechip:hover { background: rgba(255,255,255,.18); }
.gx-namechip.used { opacity: .4; cursor: not-allowed; text-decoration: line-through; }
.gx-namepick-done {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 10px 14px; border-radius: 12px; background: rgba(120,200,160,.18);
  border: 1px solid rgba(120,200,160,.5); color: #eafff2; font-weight: 700;
}
