/* 같이 공부하는 방 — 밤의 독서실. Bar, dialog, sound and 3D button come from the lab's shared CSS (copied). */
:root {
  --accent: #ffcf8a;
  --ghost: rgba(160, 186, 255, 0.82);
  --bg: #07080f;
  --glass: rgba(12, 13, 24, 0.62);
}

canvas.stage { touch-action: none; -webkit-touch-callout: none; cursor: default; }

/* AI 번역 안내: 막대 바로 아래 한 줄 띠 (fixed). 언어는 첫 그림 전에 정해지므로(lang-boot) html.ai-on 이 위쪽 글자를 미리 내려 둠 */
.ai-note {
  position: fixed; z-index: 66; left: 0; right: 0; top: calc(var(--bar-h) + env(safe-area-inset-top, 0px));
  display: flex; align-items: center; justify-content: center; gap: 8px; height: 28px; padding: 0 12px;
  background: rgba(30, 24, 12, 0.9); border-bottom: 1px solid rgba(255, 207, 138, 0.3); color: #ffe7c2;
  font-size: 11.5px; line-height: 1; white-space: nowrap;
}
.ai-note[hidden] { display: none; }
.ai-note span { overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.ai-note button { flex: none; appearance: none; border: 0; background: none; color: #fff; text-decoration: underline; font: inherit; cursor: pointer; padding: 6px 2px; }
html.ai-on .hud-top { padding-top: calc(env(safe-area-inset-top) + var(--bar-h) + 38px); }
html.ai-on .screen { padding-top: calc(var(--bar-h, 52px) + 48px); }
html.ai-on .scene-view--tr { top: calc(var(--bar-h, 52px) + 36px + env(safe-area-inset-top, 0px)); }
html.ai-on .gather-pill { top: calc(var(--bar-h, 52px) + 36px + env(safe-area-inset-top, 0px)); }

/* ───────── 들어가기 ───────── */
.intro {
  background: radial-gradient(ellipse 120% 80% at 50% 40%, rgba(7, 8, 15, 0.84), rgba(7, 8, 15, 0.5) 64%, rgba(7, 8, 15, 0.2));
  gap: 12px;
}
html.scene-3d .intro { background: radial-gradient(ellipse 120% 80% at 50% 40%, rgba(7, 8, 15, 0.78), rgba(7, 8, 15, 0.42) 64%, rgba(7, 8, 15, 0.12)); }
.intro .title { font-size: clamp(30px, 8vw, 54px); letter-spacing: 0.16em; padding-left: 0.16em; font-weight: 250; text-shadow: 0 0 30px rgba(255, 207, 138, 0.28); }
html:is(:lang(en), :lang(ru), :lang(id), :lang(uz), :lang(fil), :lang(vi), :lang(mn)) .intro .title { letter-spacing: 0.04em; padding-left: 0.04em; }
.intro .live.wait, .phase-line.wait { opacity: 0; }
.intro .live, .phase-line { transition: opacity 0.5s ease; }
.phase-line { font-size: 13px; color: var(--dim); min-height: 1.5em; font-variant-numeric: tabular-nums; }
.pick { border: 0; display: flex; flex-direction: column; align-items: center; gap: 8px; min-width: 0; }
.pick legend { font-size: 12.5px; color: var(--faint); letter-spacing: 0.04em; margin-bottom: 8px; float: left; width: 100%; text-align: center; }
.chips { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; width: min(440px, 100%); clear: both; }
.chip {
  appearance: none; display: inline-flex; align-items: center; justify-content: center; gap: 7px; min-height: 44px; padding: 6px 10px;
  border-radius: 14px; border: 1px solid var(--line); background: rgba(243, 239, 230, 0.05); color: var(--ink);
  font: inherit; font-size: 13.5px; line-height: 1.2; cursor: pointer; transition: background 0.2s, border-color 0.2s;
}
.chip i { flex: none; width: 10px; height: 10px; border-radius: 50%; background: var(--tint, #fff0d4); box-shadow: 0 0 10px var(--tint, #fff0d4); opacity: 0.55; }
.chip[aria-pressed='true'] { border-color: var(--tint, var(--accent)); background: rgba(255, 207, 138, 0.12); }
.chip[aria-pressed='true'] i { opacity: 1; }
.chip:hover { background: rgba(243, 239, 230, 0.1); }
.opts { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px 22px; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 999px; padding: 3px; gap: 2px; clear: both; }
.seg button {
  appearance: none; border: 0; background: none; color: var(--dim); font: inherit; font-size: 12.5px; padding: 0 12px; min-height: 38px;
  border-radius: 999px; cursor: pointer; white-space: nowrap;
}
.seg button[aria-pressed='true'] { background: rgba(255, 207, 138, 0.16); color: var(--ink); }
.stepper { display: inline-flex; align-items: center; gap: 4px; clear: both; }
.stepper button {
  appearance: none; width: 40px; height: 40px; border-radius: 50%; border: 1px solid var(--line); background: rgba(243, 239, 230, 0.05);
  color: var(--ink); font: inherit; font-size: 18px; cursor: pointer;
}
.stepper output { min-width: 7.5em; text-align: center; font-size: 13.5px; font-variant-numeric: tabular-nums; }
.intro .btn.primary { background: var(--accent); color: #1d1408; box-shadow: 0 0 30px rgba(255, 207, 138, 0.32); min-width: min(260px, 100%); }
.intro .btn.primary:hover { background: #ffe0b0; }
.intro .note { margin-top: 2px; }

/* ───────── 방 안 ───────── */
.hud-top {
  position: absolute; top: 0; left: 0; right: 0; text-align: center;
  padding: calc(env(safe-area-inset-top) + var(--bar-h) + 10px) 16px 22px;
  background: linear-gradient(rgba(7, 8, 15, 0.7), rgba(7, 8, 15, 0.3) 72%, rgba(7, 8, 15, 0));
}
html.scene-3d .hud-top { background: linear-gradient(rgba(7, 8, 15, 0.6), rgba(7, 8, 15, 0.18) 72%, rgba(7, 8, 15, 0)); }
.eyebrow { font-size: 13px; color: var(--accent); letter-spacing: 0.12em; font-weight: 600; min-height: 1.4em; }
body.is-break .eyebrow { color: #b9d3ff; }
.timer {
  font-size: clamp(46px, 13vw, 76px); font-weight: 200; line-height: 1.05; letter-spacing: 0.02em;
  font-variant-numeric: tabular-nums; color: #fff4e2; text-shadow: 0 0 26px rgba(255, 207, 138, 0.36);
}
body.is-break .timer { color: #e6efff; text-shadow: 0 0 26px rgba(150, 185, 255, 0.32); }
.cap { font-size: 12px; color: var(--faint); min-height: 1.4em; }
.together { margin-top: 6px; font-size: 14px; color: var(--ink); min-height: 1.5em; }
.subjects { display: flex; flex-wrap: wrap; justify-content: center; gap: 4px 12px; font-size: 12px; color: var(--dim); min-height: 1.6em; margin-top: 2px; }
.subjects span { display: inline-flex; align-items: center; gap: 5px; white-space: nowrap; font-variant-numeric: tabular-nums; }
.subjects i { width: 7px; height: 7px; border-radius: 50%; background: var(--tint); box-shadow: 0 0 6px var(--tint); }
.conn { margin-top: 2px; font-size: 12px; color: var(--faint); }
.ghostline { margin: 4px auto 0; max-width: 24em; min-height: 3em; font-size: 12px; line-height: 1.55; color: var(--ghost); word-break: keep-all; transition: opacity 0.8s; }
.ghostline:empty { opacity: 0; }
html.scene-3d :is(.timer, .eyebrow, .together, .ghostline, .subjects, .cap) { text-shadow: 0 1px 14px rgba(0, 0, 0, 0.8); }

.hud-bottom {
  position: absolute; left: 0; right: 0; bottom: 0;
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  padding: 40px 12px calc(env(safe-area-inset-bottom) + 12px);
  background: linear-gradient(rgba(7, 8, 15, 0), rgba(7, 8, 15, 0.66) 46%, rgba(7, 8, 15, 0.84));
}
html.scene-3d .hud-bottom { background: linear-gradient(rgba(7, 8, 15, 0), rgba(7, 8, 15, 0.5) 50%, rgba(7, 8, 15, 0.7)); }
.mine { display: flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: 4px 10px; font-size: 13px; color: var(--dim); min-height: 44px; font-variant-numeric: tabular-nums; }
.subj-btn {
  appearance: none; display: inline-flex; align-items: center; gap: 7px; min-height: 36px; padding: 0 12px; border-radius: 999px;
  border: 1px solid var(--line); background: rgba(243, 239, 230, 0.06); color: var(--ink); font: inherit; font-size: 13px; cursor: pointer;
  pointer-events: auto; position: relative;
}
.subj-btn::before { content: ''; position: absolute; inset: -4px 0; }
.subj-btn i { width: 9px; height: 9px; border-radius: 50%; background: var(--tint, #fff0d4); box-shadow: 0 0 8px var(--tint, #fff0d4); }
.subj-btn::after { content: ''; width: 6px; height: 6px; border-right: 1.5px solid currentColor; border-bottom: 1.5px solid currentColor; transform: rotate(45deg) translateY(-2px); opacity: 0.6; }
.dots { display: inline-flex; gap: 4px; }
.dots b { width: 8px; height: 8px; border-radius: 50%; border: 1px solid rgba(255, 207, 138, 0.6); }
.dots b.on { background: var(--accent); box-shadow: 0 0 6px var(--accent); }
.actions { gap: 6px; flex-wrap: nowrap; max-width: min(520px, 100%); width: 100%; justify-content: center; }
.actions .btn.small { flex: 1 1 0; min-width: 0; max-width: 180px; padding: 8px 10px; font-size: 12.5px; line-height: 1.25; white-space: normal; word-break: keep-all; }
#blinkBtn:disabled { opacity: 0.5; }
body.is-break #blinkBtn:not(:disabled) { border-color: rgba(185, 211, 255, 0.6); box-shadow: 0 0 16px rgba(150, 185, 255, 0.25); }
.ghost-btn { background: transparent !important; }
.tools { align-items: center; gap: 6px 14px; }
.legend { display: inline-flex; gap: 10px; font-size: 11.5px; color: var(--faint); }
.lg { display: inline-flex; align-items: center; gap: 5px; white-space: nowrap; }
.lg::before { content: ''; width: 7px; height: 7px; border-radius: 50%; }
.lg-live::before { background: #ffcf8a; box-shadow: 0 0 6px #ffcf8a; }
.lg-me::before { background: transparent; border: 1.5px solid #ffd77a; width: 8px; height: 8px; }
.lg-ghost::before { background: #8eaaff; opacity: 0.7; }
@media (max-width: 380px) {
  .actions .btn.small { padding: 10px 10px; font-size: 12px; }
  .legend { display: none; }
}
.toast { top: calc(env(safe-area-inset-top) + var(--bar-h) + 214px); bottom: auto; }

/* labels over the scene: mine only (others stay anonymous; ghosts are named in the legend and the ghost line) */
.scene-chip { color: #ffe6b0; }

/* ───────── 끝나고 ───────── */
.summary { background: rgba(7, 8, 15, 0.9); gap: 12px; }
.sum-h { font-size: 20px; font-weight: 500; letter-spacing: 0.08em; }
.card-box { width: min(240px, 52vw); aspect-ratio: 1080 / 1350; border-radius: 14px; overflow: hidden; border: 1px solid var(--line); box-shadow: 0 16px 50px rgba(0, 0, 0, 0.5); background: #0b0c18; }
.card-box canvas { width: 100%; height: 100%; display: block; }
.sum-line { font-size: 15px; color: var(--ink); max-width: 26em; word-break: keep-all; min-height: 1.5em; }
.streak { font-size: 13px; color: var(--accent); min-height: 1.4em; }
.cal { display: grid; grid-template-columns: repeat(7, 14px); gap: 4px; justify-content: center; }
.cal i { width: 14px; height: 14px; border-radius: 4px; background: rgba(243, 239, 230, 0.07); }
.cal i.l1 { background: rgba(255, 207, 138, 0.35); }
.cal i.l2 { background: rgba(255, 207, 138, 0.62); }
.cal i.l3 { background: #ffcf8a; box-shadow: 0 0 6px rgba(255, 207, 138, 0.6); }
.cal i.today { outline: 1.5px solid rgba(243, 239, 230, 0.7); outline-offset: 1px; }
.summary .btn.primary { background: var(--accent); color: #1d1408; }
.summary a.btn { display: inline-flex; align-items: center; justify-content: center; text-decoration: none; }

/* dialogs */
.links { list-style: none; padding: 0 !important; display: grid !important; gap: 6px !important; }
.links a {
  display: flex; align-items: center; gap: 10px; min-height: 46px; padding: 0 14px; border-radius: 12px;
  border: 1px solid var(--chrome-line); color: var(--chrome-ink); text-decoration: none; font-size: 14px;
}
.links a:hover { background: rgba(255, 255, 255, 0.05); }
.links i { width: 9px; height: 9px; border-radius: 50%; background: var(--tint, #fff0d4); box-shadow: 0 0 8px var(--tint, #fff0d4); }
.links a.is-mine { border-color: rgba(255, 207, 138, 0.6); }
.chips--dlg { width: 100%; }
.gather-pill { text-decoration: none; }

/* 특별한 밤 (shared/special.js, 실험실 specials.json): 따뜻한 한 줄 */
.special-line { margin: 10px 0 0; padding: 8px 14px; border-radius: 12px; background: rgba(255, 205, 90, 0.12); border: 1px solid rgba(255, 205, 90, 0.5);
  color: #ffe6a3; font-weight: 600; line-height: 1.5; }
.special-line[hidden] { display: none; }

/* 쉬는 시간에만 보이는 정각 퀴즈 입구 (quiz/, 새 탭): 아래쪽 띠의 빈 위쪽 여백에 떠 있어서 아무것도 밀지 않음. 누르는 자리는 44px */
.quiz-pill {
  position: absolute; left: 50%; top: 0; transform: translateX(-50%); z-index: 1;
  display: inline-flex; align-items: center; gap: 8px; max-width: calc(100vw - 24px); height: 32px; padding: 0 14px;
  border-radius: 999px; border: 1px solid rgba(185, 211, 255, 0.5); background: rgba(10, 12, 24, 0.82); color: #e6efff;
  font-size: 12.5px; font-weight: 600; line-height: 1; text-decoration: none; white-space: nowrap; font-variant-numeric: tabular-nums;
}
.quiz-pill::before { content: ''; position: absolute; left: 0; right: 0; top: -6px; bottom: -6px; }
.quiz-pill[hidden] { display: none; }
.quiz-pill i { flex: none; width: 7px; height: 7px; border-radius: 50%; background: #ffcf8a; box-shadow: 0 0 8px #ffcf8a; }
.quiz-pill span { overflow: hidden; text-overflow: ellipsis; }
