/* NOVA — 은하 속 AI 코어. 소파에서 2~3m 떨어져 읽는 TV 화면.
   성능: 무거운 backdrop-filter·큰 blur 는 쓰지 않음 (슬레이트 내장 그래픽). 움직임은 transform·opacity 위주. */
:root {
  --c: 111, 227, 255;            /* 지금 상태 색 (JS 가 바꿈) */
  --ink: #eaf6ff; --dim: rgba(190, 220, 245, .55); --faint: rgba(150, 200, 240, .25);
  --gold: 255, 196, 92; --warn: 255, 138, 64; --bad: 255, 84, 112;
  --big: clamp(22px, 2.35vw, 104px);   /* 화면 너비에 비례 (4K TV에서도 같은 비율) */
  --hud: clamp(13px, 1.12vw, 48px);
  --mono: "Noto Sans Mono CJK KR", "D2Coding", "DejaVu Sans Mono", ui-monospace, monospace;
  --sans: "Noto Sans CJK KR", "Noto Sans KR", "Pretendard", "Malgun Gothic", sans-serif;
  --ease: cubic-bezier(.22, .8, .2, 1);
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: #010207; color: var(--ink); font-family: var(--sans); overflow: hidden; cursor: none; }
body.pointer { cursor: default; }
[hidden] { display: none !important; }
kbd { font-family: var(--mono); font-size: .8em; padding: .05em .45em; border: 1px solid rgba(var(--c), .45); border-radius: 4px; color: rgb(var(--c)); background: rgba(var(--c), .07); margin-right: .35em; }

/* ---- 배경 ---- */
/* 배경 (backdrop.js): 움직이지 않는 어두운 바탕 한 장. 쉬는 동안 화면에 움직이는 것이 없어야 CPU를 쓰지 않습니다 */
#space { position: fixed; inset: 0; background: radial-gradient(ellipse 85% 80% at 50% 46%, #0c1228 0%, #070b1a 42%, #03040c 78%, #010207 100%); }
#space .tint { position: absolute; left: 50%; top: 50%; width: min(120vh, 86vw); height: min(120vh, 86vw); transform: translate(-50%, -50%); opacity: .35; transition: opacity .6s; pointer-events: none;
  background: radial-gradient(circle closest-side, rgba(var(--tc, 111, 227, 255), .16), rgba(var(--tc, 111, 227, 255), .05) 55%, rgba(0, 0, 0, 0)); }
#vignette { position: fixed; inset: 0; pointer-events: none;
  background: radial-gradient(ellipse at center, transparent 45%, rgba(0, 0, 6, .55) 80%, rgba(0, 0, 6, .9) 100%); }
#scan { position: fixed; inset: 0; pointer-events: none; opacity: .03;
  background: repeating-linear-gradient(0deg, rgba(255, 255, 255, .5) 0 1px, transparent 1px 4px); }

/* ---- 모서리 틀 ---- */
.frame { position: fixed; width: 7vw; height: 7vw; max-width: 260px; max-height: 260px; pointer-events: none; border: 0 solid rgba(var(--c), .45); transition: border-color .8s; }
.frame.tl { top: 2vh; left: 1.6vw; border-top-width: 2px; border-left-width: 2px; }
.frame.tr { top: 2vh; right: 1.6vw; border-top-width: 2px; border-right-width: 2px; }
.frame.bl { bottom: 2vh; left: 1.6vw; border-bottom-width: 2px; border-left-width: 2px; }
.frame.br { bottom: 2vh; right: 1.6vw; border-bottom-width: 2px; border-right-width: 2px; }

.hud { position: fixed; font-family: var(--mono); font-size: var(--hud); color: var(--dim); letter-spacing: .04em; transition: opacity .6s; }

/* 왼쪽 위 */
#sys { top: 4.2vh; left: 3.4vw; }
.brand { display: flex; align-items: center; gap: .7em; margin-bottom: 1.4vh; }
.brand b { font-size: 1.9em; color: var(--ink); letter-spacing: .38em; font-weight: 700; text-shadow: 0 0 18px rgba(var(--c), .6); }
.brand small { color: var(--dim); letter-spacing: .12em; }
.logo { width: 1.5em; height: 1.5em; border: 2px solid rgb(var(--c)); border-radius: 50%; position: relative; box-shadow: 0 0 12px rgba(var(--c), .7), inset 0 0 8px rgba(var(--c), .6); }
.logo::after { content: ""; position: absolute; inset: 28%; border-radius: 50%; background: rgb(var(--c)); box-shadow: 0 0 10px rgb(var(--c)); }
#sys dl { margin: 0; display: grid; gap: .45em; }
#sys dl div { display: flex; gap: 1.2em; }
#sys dt { width: 3.2em; color: var(--faint); letter-spacing: .2em; }
#sys dd { margin: 0; color: var(--ink); display: flex; align-items: center; gap: .5em; }
.led { width: .62em; height: .62em; border-radius: 50%; background: #556; display: inline-block; }
.led.on { background: #5cf2a0; box-shadow: 0 0 8px #5cf2a0; }
.led.off { background: rgb(var(--bad)); box-shadow: 0 0 8px rgb(var(--bad)); }
@keyframes blink { 50% { opacity: .45; } }
.chip { display: inline-block; margin-top: 1.2vh; padding: .25em .8em; border: 1px solid; border-radius: 99px; }
.chip.warn { color: rgb(var(--gold)); border-color: rgba(var(--gold), .5); background: rgba(var(--gold), .08); animation: blink 1.6s steps(1) infinite; }

/* 오른쪽 위 시계 */
#time { top: 3.6vh; right: 3.4vw; text-align: right; }
#clock { font-family: var(--sans); font-weight: 200; font-size: clamp(40px, 4.6vw, 200px); line-height: 1; color: var(--ink); letter-spacing: .02em; text-shadow: 0 0 24px rgba(var(--c), .35); font-variant-numeric: tabular-nums; }
#date { margin-top: .6vh; letter-spacing: .14em; }
.secbar { margin: 1vh 0 0 auto; width: 12vw; height: 2px; background: var(--faint); overflow: hidden; }
.secbar i { display: block; height: 100%; width: 100%; transform-origin: 0 50%; transform: scaleX(0); will-change: transform; background: rgb(var(--c)); }

/* ---- 코어 ---- */
#coreWrap { position: fixed; left: 50%; top: 50%; width: min(64vh, 46vw); height: min(64vh, 46vw);
  transform: translate(-50%, -50%) scale(1); transition: transform 1.1s var(--ease); }
/* 코어 (core.js): 고리마다 한 장씩 그려 둔 그림을 그래픽 칩이 돌립니다. #core 는 실제 소리가 있을 때만 보이는 소리 막대 */
#coreLayers { position: absolute; inset: 0; }
#coreLayers canvas { position: absolute; will-change: transform; }
#core { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
#core[hidden] { display: none; }
#coreText { position: absolute; left: 50%; top: 100%; transform: translate(-50%, -1.5vh); text-align: center; white-space: nowrap; transition: opacity .5s; }
#coreLabel { font-family: var(--mono); font-size: calc(var(--hud) * 1.35); letter-spacing: .5em; color: rgb(var(--c)); text-shadow: 0 0 14px rgba(var(--c), .8); padding-left: .5em; transition: color .6s; }
#coreSub { margin-top: .6vh; font-family: var(--mono); font-size: var(--hud); color: var(--dim); letter-spacing: .08em; min-height: 1.3em; }

/* 첫 화면 인사 */
#home { position: fixed; left: 0; right: 0; bottom: 13vh; text-align: center; transition: opacity .7s, transform .9s var(--ease); }
#greet { font-size: clamp(24px, 2.4vw, 100px); font-weight: 300; letter-spacing: .12em; color: var(--ink); text-shadow: 0 0 20px rgba(var(--c), .35); }
#hint { margin-top: 1.2vh; font-size: var(--hud); color: var(--dim); letter-spacing: .06em; }
#home, body.idle #coreText { opacity: 1; }
body:not(.idle) #home, body.has-answer #home { opacity: 0; transform: translateY(2vh); }
body.idle:not(.has-answer) #coreText { opacity: 0; }  /* 첫 화면에서는 인사가 대신함 */

/* ---- 답 패널 ---- */
#panel { position: fixed; right: 3vw; top: 9.5vh; bottom: 13vh; width: 67vw; padding: 3vh 2.8vw 2.2vh;
  display: grid; grid-template-rows: auto 1fr auto; gap: 2vh;
  background: linear-gradient(135deg, rgba(10, 30, 60, .55), rgba(6, 14, 34, .42));
  border: 1px solid rgba(var(--c), .22);
  box-shadow: 0 0 40px rgba(var(--c), .08), inset 0 0 60px rgba(var(--c), .05);
  clip-path: polygon(0 0, calc(100% - 28px) 0, 100% 28px, 100% 100%, 28px 100%, 0 calc(100% - 28px));
  opacity: 0; transform: translateX(6vw); pointer-events: none;
  transition: opacity .7s, transform 1s var(--ease), border-color .8s; }
#panel::before { content: ""; position: absolute; left: 0; right: 0; top: 0; height: 2px;
  background: linear-gradient(90deg, transparent, rgba(var(--c), .9), transparent); animation: sweep 2.4s ease-out 1 both; }
@keyframes sweep { from { transform: translateX(-100%); } to { transform: translateX(100%); } }
.corner { position: absolute; width: 18px; height: 18px; border: 0 solid rgb(var(--c)); }
.corner.a { top: 8px; left: 8px; border-top-width: 2px; border-left-width: 2px; }
.corner.b { top: 8px; right: 36px; border-top-width: 2px; }
.corner.c { bottom: 8px; right: 8px; border-bottom-width: 2px; border-right-width: 2px; }
.corner.d { bottom: 36px; left: 8px; border-left-width: 2px; }
#panel header { display: flex; gap: 1.2vw; align-items: baseline; padding-bottom: 1.6vh; border-bottom: 1px dashed rgba(var(--c), .2); }
.tag { flex: none; font-family: var(--mono); font-size: var(--hud); letter-spacing: .3em; color: rgb(var(--c)); border: 1px solid rgba(var(--c), .4); padding: .1em .6em; }
#heard { margin: 0; font-size: calc(var(--big) * .62); color: rgba(200, 235, 255, .85); line-height: 1.45; }
#answer { overflow-y: auto; scroll-behavior: smooth; font-size: var(--big); line-height: 1.6; font-weight: 400; word-break: keep-all; overflow-wrap: anywhere; scrollbar-width: none;
  -webkit-mask-image: linear-gradient(180deg, #000 88%, transparent); mask-image: linear-gradient(180deg, #000 88%, transparent); padding-bottom: 2em; }
#answer::-webkit-scrollbar { display: none; }
#answer p { margin: 0 0 .45em; text-shadow: 0 0 14px rgba(var(--c), .15); }
#answer p.in { animation: rise .6s var(--ease) both; }
#answer .new { animation: glow 1.2s ease-out both; }
#answer .err { color: rgb(var(--bad)); }
#answer .wait { color: var(--dim); }
#answer .wait::after { content: "▍"; animation: blink 1s steps(1) infinite; color: rgb(var(--c)); }
@keyframes rise { from { opacity: 0; transform: translateY(.6em); filter: blur(2px); } to { opacity: 1; transform: none; filter: none; } }
@keyframes glow { from { color: #fff; text-shadow: 0 0 18px rgba(var(--c), 1); } to { color: inherit; text-shadow: inherit; } }
#panel footer { display: flex; justify-content: space-between; font-family: var(--mono); font-size: var(--hud); color: var(--dim); letter-spacing: .08em; }
#more { color: rgb(var(--c)); animation: blink 1.4s steps(1) infinite; }

/* 답이 있을 때: 코어는 왼쪽으로 물러나고 패널이 들어옴. 듣는 중에는 다시 가운데로 */
body.has-answer:not(.listening) #coreWrap { transform: translate(calc(-50% - 36vw), calc(-50% + 4vh)) scale(.4); }
/* 답이 떠 있는 동안: 왼쪽 정보는 꼭 필요한 것만, 시계는 작게 (답이 주인공) */
body.has-answer:not(.viewing) #date, body.has-answer:not(.viewing) .secbar, body.has-answer:not(.viewing) #log, body.has-answer:not(.viewing) #coreText { display: none; }
body.has-answer:not(.viewing) #time { top: 2.2vh; } body.has-answer:not(.viewing) #clock { font-size: clamp(22px, 2.4vw, 90px); }
body.has-answer:not(.listening) #panel { opacity: 1; transform: none; pointer-events: auto; }
body.listening #coreWrap { transform: translate(-50%, -50%) scale(1.08); }

/* ---- 통신 기록 ---- */
#log { left: 3.4vw; bottom: 4.6vh; width: 26vw; }
#log h3 { margin: 0 0 .8vh; font-weight: 400; font-size: 1em; letter-spacing: .3em; color: var(--faint); }
#logList { list-style: none; margin: 0; padding: 0; display: grid; gap: .3em; }
#logList li { display: flex; gap: .9em; opacity: .85; animation: logIn .5s var(--ease) both; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#logList li time { color: var(--faint); }
#logList li.hi { color: rgb(var(--c)); }
#logList li:nth-last-child(n+4) { opacity: .45; }
@keyframes logIn { from { opacity: 0; transform: translateX(-1em); } }

/* ---- 조작 안내 ---- */
#keys { right: 3.4vw; bottom: 4.6vh; display: grid; grid-template-columns: repeat(4, auto); gap: .7em 1.4em; justify-items: start; }
body.has-answer #keys { display: none; } /* 답이 떠 있는 동안에는 숨김 — 커진 답 패널과 겹치지 않게 */
body.busy #keys { opacity: .45; }

/* ---- 글로 묻기 ---- */
#typeForm { position: fixed; left: 50%; bottom: 4vh; width: 40vw; transform: translateX(-50%); display: flex; align-items: center; gap: 1vw;
  padding: 1.2vh 1.4vw; background: rgba(6, 16, 36, .85); border: 1px solid rgba(var(--c), .6); box-shadow: 0 0 30px rgba(var(--c), .25); animation: rise .4s var(--ease); z-index: 3; }
#typeBox { flex: 1; font: inherit; font-size: calc(var(--big) * .72); background: transparent; color: var(--ink); border: 0; outline: none; caret-color: rgb(var(--c)); }
#typeBox::placeholder { color: var(--faint); }

/* ---- 허락 묻기 ---- */
#confirm { position: fixed; inset: 0; display: grid; place-items: center; background: radial-gradient(ellipse at center, rgba(40, 14, 0, .55), rgba(0, 0, 0, .8)); z-index: 4; animation: fade .3s; }
@keyframes fade { from { opacity: 0; } }
#confirm .box { position: relative; min-width: 46vw; max-width: 70vw; padding: 5vh 4vw 4vh; font-size: calc(var(--big) * .8); overflow: hidden;
  background: rgba(30, 14, 4, .88); border: 2px solid rgb(var(--warn)); box-shadow: 0 0 60px rgba(var(--warn), .35);
  clip-path: polygon(30px 0, calc(100% - 30px) 0, 100% 30px, 100% calc(100% - 30px), calc(100% - 30px) 100%, 30px 100%, 0 calc(100% - 30px), 0 30px); animation: rise .45s var(--ease); }
#confirm .stripes { position: absolute; left: 0; right: 0; top: 0; height: 8px; background: repeating-linear-gradient(-45deg, rgb(var(--warn)) 0 14px, transparent 14px 28px); animation: slide 1s linear infinite; }
@keyframes slide { to { background-position: 39.6px 0; } }
#confirm h2 { margin: 0 0 2.4vh; color: rgb(var(--warn)); letter-spacing: .08em; font-weight: 600; }
#confirmText { margin: 0 0 3.4vh; line-height: 1.5; }
#confirm .choices { display: flex; gap: 3vw; font-size: .72em; color: var(--dim); }
#confirm .yes kbd { color: #5cf2a0; border-color: rgba(92, 242, 160, .5); }
#confirm .no kbd { color: rgb(var(--bad)); border-color: rgba(var(--bad), .5); }

/* ---- 설정 ---- */
#setup { position: fixed; inset: 0; display: grid; place-items: center; background: rgba(0, 2, 10, .82); z-index: 7; cursor: default; }
#setup .box { width: min(820px, 76vw); padding: 5vh 4vw; display: flex; flex-direction: column; gap: 2.4vh; font-size: clamp(16px, 1.6vw, 28px);
  background: rgba(6, 16, 36, .92); border: 1px solid rgba(var(--c), .45); box-shadow: 0 0 50px rgba(var(--c), .18); }
#setup h1 { margin: 0 0 1vh; font-weight: 300; letter-spacing: .1em; color: rgb(var(--c)); }
#setup label { display: flex; flex-direction: column; gap: .6vh; font-family: var(--mono); font-size: .8em; color: var(--dim); letter-spacing: .1em; }
#setup input { font: inherit; font-family: var(--sans); font-size: 1.2em; letter-spacing: 0; padding: .45em .7em; background: rgba(0, 0, 0, .35); color: var(--ink); border: 1px solid var(--faint); }
#setup input:focus { border-color: rgb(var(--c)); outline: none; box-shadow: 0 0 14px rgba(var(--c), .3); }
#setup .note { color: var(--dim); font-size: .7em; margin: 0; }
#setup code { color: rgb(var(--c)); }
#setup .row { display: flex; gap: 1.5vw; }
#setup button { font: inherit; padding: .45em 1.6em; border: 1px solid rgb(var(--c)); background: rgba(var(--c), .15); color: var(--ink); letter-spacing: .2em; cursor: pointer; }
#setup button.ghost { border-color: var(--faint); background: transparent; color: var(--dim); }
#setup .msg { min-height: 1.4em; margin: 0; color: rgb(var(--gold)); font-size: .8em; }
/* 로그인 화면 (2026-11-30 새 모양): 처음 들어온 사람에게는 뒤 화면을 가리고 이 상자만 */
#setup.first { background: radial-gradient(120% 90% at 50% 0%, #0a2340, #010207 70%); } /* 불투명: 뒤의 상태 표시가 비치지 않게 */
#setup .box { border-radius: 18px; max-width: 520px; }
#setup .welcome { text-align: center; margin-bottom: 1vh; }
#setup .welcome .mark { font-size: 2.6em; font-weight: 700; letter-spacing: .42em; padding-left: .42em; color: var(--ink); text-shadow: 0 0 22px rgba(var(--c), .65); }
#setup .welcome .sub { margin: .5em 0 0; color: var(--dim); font-size: .78em; letter-spacing: .04em; }
#setup input { border-radius: 10px; }
#setup .row button { border-radius: 10px; }
#setup #setSave { flex: 1; font-weight: 600; letter-spacing: .3em; padding: .6em 1em; }
#setup .note { text-align: center; line-height: 1.6; word-break: keep-all; }
#setup .msg:empty { min-height: 0; }

/* ---- 부팅 ---- */
#boot { position: fixed; inset: 0; display: grid; place-items: center; background: #010207; z-index: 6; transition: opacity 1.2s; pointer-events: none; }
body:not(.booting) #boot { opacity: 0; }
#boot .inner { font-family: var(--mono); font-size: var(--hud); color: var(--dim); min-width: 34vw; }
#boot .title { font-size: 3.2em; letter-spacing: .6em; color: var(--ink); text-shadow: 0 0 30px rgba(var(--c), .9); margin-bottom: 3vh; animation: fade 1.4s; }
#bootLines { list-style: none; margin: 0; padding: 0; display: grid; gap: .5em; }
#bootLines li { animation: logIn .4s var(--ease) both; }
#bootLines li b { color: #5cf2a0; font-weight: 400; margin-left: .6em; }
#bootLines li b.no { color: rgb(var(--bad)); }

/* 코어가 등장할 때 */
body.booting #coreWrap { transform: translate(-50%, -50%) scale(.3); }

/* ---- 화면에 띄운 것 (웹 페이지·유튜브·사진) ----
   NOVA 화면 안의 큰 패널에 띄웁니다. 그동안 코어는 왼쪽 아래로 작아지고, 답은 아래쪽에 자막처럼 떴다가 사라집니다. */
#view { position: fixed; left: 2.4vw; right: 2.4vw; top: 9vh; bottom: 11vh; z-index: 1; display: grid; grid-template-rows: auto 1fr;
  background: rgba(3, 8, 20, .92); border: 1px solid rgba(var(--c), .35);
  box-shadow: 0 0 50px rgba(var(--c), .12), inset 0 0 40px rgba(var(--c), .04);
  animation: viewIn .7s var(--ease) both; transition: border-color .8s; }
@keyframes viewIn { from { opacity: 0; transform: scale(.96); } }
#view > header { display: flex; align-items: center; gap: 1vw; padding: .7vh 1vw; font-family: var(--mono); font-size: var(--hud); color: var(--dim);
  border-bottom: 1px solid rgba(var(--c), .18); background: linear-gradient(90deg, rgba(var(--c), .1), transparent 60%); }
#view > header .grow { flex: 1; }
#viewTitle { color: var(--ink); letter-spacing: .04em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 60vw; }
#viewBody { position: relative; min-height: 0; background: #000; }
#viewBody iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; background: #fff; }
#viewBody > img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; background: #000; }
/* 유튜브: 찾는 중 안내, 보이지 않게 불러 목록만 읽는 틀, NOVA 가 직접 그리는 번호 목록 */
#viewBody .ytwait { position: absolute; inset: 0; display: grid; place-content: center; justify-items: center; gap: 1.6vh; background: rgba(3, 8, 22, .94); font-family: var(--mono); text-align: center; padding: 0 8vw; }
#viewBody .ytwait b { font-weight: 400; font-size: calc(var(--hud) * 1.5); letter-spacing: .4em; color: rgb(var(--c)); }
#viewBody .ytwait span { font-family: inherit; font-size: calc(var(--big) * .7); color: var(--ink); letter-spacing: .02em; }
#viewBody iframe.ytloader { inset: auto; left: 0; top: 0; width: 640px; height: 360px; opacity: 0; pointer-events: none; }
#viewBody .ytlist { position: absolute; inset: 0; margin: 0; padding: 1.6vh 1.6vw; list-style: none; overflow: auto; display: grid; grid-template-columns: 1fr 1fr; grid-auto-rows: min-content; gap: 1.2vh 1.4vw; background: rgba(3, 8, 22, .94); }
#viewBody .ytlist::-webkit-scrollbar { width: 6px; } #viewBody .ytlist::-webkit-scrollbar-thumb { background: rgba(var(--c), .35); } #viewBody .ytlist::-webkit-scrollbar-track { background: transparent; }
.ytlist li { display: grid; grid-template-columns: 2.2em 24% 1fr; gap: .9vw; align-items: center; padding: .8vh .7vw; border: 1px solid rgba(var(--c), .22); background: rgba(10, 22, 46, .5); cursor: pointer; }
.ytlist li.now { border-color: rgb(var(--c)); }
.ytlist li.blocked { opacity: .38; }
.ytlist li > b { font-family: var(--mono); font-weight: 400; font-size: calc(var(--big) * .95); color: rgb(var(--c)); text-align: center; }
.ytlist li > img { width: 100%; aspect-ratio: 16 / 9; object-fit: cover; display: block; background: #000; }
.ytlist .t { margin: 0; font-size: calc(var(--big) * .48); line-height: 1.32; color: var(--ink); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.ytlist .m { margin: .45em 0 0; font-family: var(--mono); font-size: var(--hud); color: var(--dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

#mini { position: fixed; left: 9.5vw; bottom: 3.6vh; z-index: 3; display: none; align-items: baseline; gap: 1vw; font-family: var(--mono); font-size: var(--hud); color: var(--dim); }
#mini b { font-weight: 400; font-size: 1.25em; letter-spacing: .4em; color: rgb(var(--c)); text-shadow: 0 0 12px rgba(var(--c), .8); }

body.viewing #mini { display: flex; }
body.viewing #home, body.viewing #log, body.viewing #keys, body.viewing #coreText { display: none; }
body.viewing #sys dl, body.viewing #sys .chip, body.viewing #date, body.viewing .secbar { display: none; }
body.viewing #sys { top: 2.6vh; } body.viewing #time { top: 2.2vh; }
body.viewing .brand { margin: 0; } body.viewing .brand b { font-size: 1.3em; }
body.viewing #clock { font-size: clamp(22px, 2.4vw, 90px); }
body.viewing .frame { opacity: .35; }
/* 코어: 평소엔 왼쪽 아래 작게, 듣는 동안에는 가운데로 떠올라 "듣고 있음"을 분명히 */
body.viewing #coreWrap, body.viewing.has-answer:not(.listening) #coreWrap { transform: translate(calc(-50% - 44.6vw), calc(-50% + 44.6vh)) scale(.15); z-index: 3; }
body.viewing.listening #coreWrap { transform: translate(-50%, -50%) scale(.62); z-index: 3; filter: drop-shadow(0 0 60px rgba(0, 0, 0, .9)); }
/* 답: 아래쪽 자막 */
body.viewing #panel { top: auto; bottom: 12.4vh; left: 15vw; right: 15vw; width: auto; z-index: 2; padding: 1.8vh 2vw 1.2vh; gap: .8vh;
  background: rgba(3, 8, 22, .9); grid-template-rows: auto auto auto; }
body.viewing #panel header { padding-bottom: .8vh; }
body.viewing #heard { font-size: calc(var(--big) * .5); }
body.viewing #answer { font-size: calc(var(--big) * .62); max-height: 12.5vh; padding-bottom: .3em; }
/* 띄운 화면과 글이 겹치지 않게: 자막이 떠 있는 동안에는 띄운 화면을 위로 줄이고, 자막은 그 아래 빈 자리에 둠 */
#view { transition: bottom .5s var(--ease), border-color .8s; }
body.viewing.has-answer:not(.quiet):not(.nocap) #view { bottom: 33vh; }
body.viewing.nocap #panel { display: none; } /* "자막 꺼 줘": 띄운 화면 위의 답 글을 숨김 (caption 도구) */
body.viewing #panel { bottom: 10.5vh; left: 12vw; right: 4vw; max-height: 21vh; }
body.viewing #panel header { display: none; }
body.viewing.quiet #panel { opacity: 0 !important; pointer-events: none; }
#view .corner { display: none; } /* 제목 줄과 겹치지 않게 (패널 테두리만으로 충분) */

/* ---- 성능 ----
   가장자리 어둡게·가로 줄무늬는 은하 그림판 안에서 한 번에 그립니다(galaxy.js). 화면 전체를 덮는 겹으로 두면
   그래픽 가속이 약한 기기에서 매 장마다 화면 전체를 다시 섞어야 해서 느려집니다. */
#vignette, #scan { display: none; }
/* 느린 기기(품질 "가벼움" 이하): 계속 움직이거나 흐리게 만드는 꾸밈을 끔 */
@keyframes riseLite { from { opacity: 0; } to { opacity: 1; } }
body.lowgfx #answer p.in, body.lowgfx #typeForm, body.lowgfx #confirm .box { animation-name: riseLite; animation-duration: .25s; }
body.lowgfx #answer .new { animation: none; }
body.lowgfx #panel::before, body.lowgfx #confirm .stripes { animation: none; }
body.lowgfx .led.on, body.lowgfx #more, body.lowgfx .chip.warn, body.lowgfx #answer .wait::after { animation: none; }
body.lowgfx #answer p, body.lowgfx #clock, body.lowgfx .brand b, body.lowgfx #greet, body.lowgfx #coreLabel { text-shadow: none; }
body.lowgfx #panel, body.lowgfx #view { box-shadow: none; }

/* ---- 손동작 (hand.js, H 키): 손이 보일 때만 오른쪽 아래에 뜨는 작은 창 ---- */
#hand { position: fixed; right: 2.4vw; bottom: 12vh; width: min(22vw, 300px); z-index: 5; padding: 1vh 1vw 1.2vh; background: rgba(4, 10, 26, .94); border: 1px solid rgba(var(--c), .45); font-family: var(--mono); font-size: var(--hud); color: var(--dim); }
#hand.rest { opacity: 0; pointer-events: none; } /* display:none 으로 숨기면 카메라 화면이 멈출 수 있어 보이지 않게만 함 */
#hand.active { border-color: #5cf2a0; box-shadow: 0 0 24px rgba(92, 242, 160, .35); }
#hand .cam { position: relative; background: #000; aspect-ratio: 4 / 3; overflow: hidden; }
#hand video { width: 100%; height: 100%; object-fit: cover; transform: scaleX(-1); display: block; }
#hand .cam i { position: absolute; left: 0; right: 0; bottom: 0; height: 6px; background: #5cf2a0; transform-origin: 0 50%; transform: scaleX(0); }
#hand .cam i::after { content: attr(data-name); position: absolute; left: .6em; bottom: 10px; font-style: normal; font-size: 1.5em; color: #fff; text-shadow: 0 0 6px #000, 0 0 2px #000; white-space: nowrap; transform: none; }
#hand p { margin: .7vh 0 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#hand .st { color: var(--ink); font-size: 1.15em; } #hand.active .st { color: #5cf2a0; }
#hand .now { color: rgb(var(--c)); min-height: 1.3em; }

/* ---- 정보 카드 (view.js 의 card): 왼쪽 사진, 오른쪽 제목과 핵심 정보 ---- */
#viewBody .card { position: absolute; inset: 0; display: grid; grid-template-columns: 46% 1fr; background: rgba(3, 8, 22, .96); }
#viewBody .card .pic { position: relative; background: #000; overflow: hidden; }
#viewBody .card .pic img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; background: #000; }
#viewBody .card .txt { padding: 4vh 3vw; overflow: auto; display: flex; flex-direction: column; justify-content: center; gap: 2.4vh; }
#viewBody .card h2 { margin: 0; font-weight: 500; font-size: calc(var(--big) * 1.25); line-height: 1.25; color: #fff; letter-spacing: .01em; }
#viewBody .card ul { margin: 0; padding: 0; list-style: none; display: grid; gap: 1.5vh; }
#viewBody .card li { position: relative; padding-left: 1.2em; font-size: calc(var(--big) * .72); line-height: 1.45; color: var(--ink); word-break: keep-all; }
#viewBody .card li::before { content: ''; position: absolute; left: 0; top: .62em; width: .5em; height: 2px; background: rgb(var(--c)); }

/* ---- 사진 갤러리 (view.js 의 gallery): 찾은 사진을 NOVA 모양으로 ---- */
#viewBody .gallery { position: absolute; inset: 0; display: grid; grid-template-columns: repeat(4, 1fr); grid-template-rows: repeat(2, 1fr); gap: 1.2vh 1vw; padding: 1.6vh 1.2vw; background: rgba(3, 8, 22, .96); }
#viewBody .gallery figure { position: relative; margin: 0; overflow: hidden; background: #000; border: 1px solid rgba(var(--c), .2); cursor: pointer; }
#viewBody .gallery img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
#viewBody .gallery figcaption { position: absolute; left: 0; right: 0; bottom: 0; padding: 1.6em .7em .45em; font-size: var(--hud); color: #e8f4ff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; background: linear-gradient(transparent, rgba(0, 0, 0, .78)); }
#viewBody img.one { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; background: #000; cursor: pointer; }
#viewBody .card .pic.finding::after { content: '사진을 찾는 중'; position: absolute; inset: 0; display: grid; place-items: center; font-family: var(--mono); font-size: var(--hud); letter-spacing: .3em; color: rgb(var(--c)); }
#viewBody .card .pic iframe.ytloader, #viewBody > iframe.ytloader { position: absolute; }

/* ---- 다듬기 (2026-11-29 저녁): 더 정돈되고 가볍게. 모두 움직이지 않는 꾸밈이라 쉬는 동안 CPU를 쓰지 않습니다 ---- */
/* 글: 한글은 고딕(가늘게), 영문 이름표와 숫자만 고정폭 — 고정폭 한글은 자간이 벌어져 거칠어 보였음 */
.hud { font-family: var(--sans); font-weight: 300; letter-spacing: .02em; }
.brand { padding-bottom: 1.3vh; margin-bottom: 1.5vh; position: relative; }
.brand::after { content: ""; position: absolute; left: 0; bottom: 0; width: 15vw; height: 1px; background: linear-gradient(90deg, rgba(var(--c), .55), transparent); }
.brand b { font-family: var(--mono); font-weight: 500; letter-spacing: .42em; }
.brand small { font-size: .88em; letter-spacing: .18em; opacity: .8; }
#sys dl { gap: .38em; font-size: .94em; }
#sys dt { width: 4.4em; white-space: nowrap; letter-spacing: .12em; color: rgba(150, 200, 240, .42); }
#sys dd { color: rgba(234, 246, 255, .86); }
#clock { font-weight: 100; letter-spacing: 0; }
#date { letter-spacing: .1em; opacity: .85; }
.secbar { height: 1px; }
/* 가운데: 링을 조금 올려 인사와 겹치지 않게 */
#coreWrap { top: 46.5%; }
#home { bottom: 11vh; }
#greet { font-weight: 200; letter-spacing: .16em; }
#hint { margin-top: 1.5vh; opacity: .8; }
#hint .by-voice, body.wake-on #hint .by-key { display: none; }
body.wake-on #hint .by-voice { display: inline; }
#hint b { font-weight: 400; color: rgb(var(--c)); }
/* 아래: 기록과 키 안내는 한 걸음 물러나 있게 */
#log { opacity: .8; }
#log h3 { font-family: var(--mono); font-size: .82em; }
#keys { font-size: .88em; gap: .55em 1.3em; opacity: .62; }
kbd { border-color: rgba(var(--c), .3); background: rgba(var(--c), .05); border-radius: 3px; }
.frame { border-color: rgba(var(--c), .3); }
/* 답 패널: 글이 주인공 — 테두리는 가늘게, 줄 사이는 넉넉하게 */
#answer { line-height: 1.62; font-weight: 300; }
#answer p { text-shadow: none; }
#answer strong, #answer b { font-weight: 500; color: #fff; }

/* ---- 답 글자 크기 (2026-11-29): 사용자가 "너무 커서 정보가 적게 보인다"고 해 30% 줄임. --txt 는 tv.js 가 바꿈(- + 키, 말로) ---- */
:root { --txt: .7; }
#answer { font-size: calc(var(--big) * var(--txt)); }
#heard { font-size: calc(var(--big) * .62 * var(--txt)); }
body.viewing #answer { font-size: calc(var(--big) * .62 * var(--txt)); }
body.viewing #heard { font-size: calc(var(--big) * .5 * var(--txt)); }

/* NOVA 가 직접 트는 영상 파일 (jw.org 영상 등) */
#viewBody > video { position: absolute; inset: 0; width: 100%; height: 100%; background: #000; object-fit: contain; }

/* 번호 목록 (view.js 의 menu): 사진이 없는 목록은 번호와 글만 */
.ytlist.plain li { grid-template-columns: 2.2em 1fr; padding: 1.4vh 1vw; }
.ytlist li > img:not([src]) { visibility: hidden; }

/* ---- 영상은 화면 가득 (body.cinema — view.js 가 영상을 띄울 때 붙임) ---- */
body.cinema #view { left: 0; right: 0; top: 0; bottom: 0 !important; border: 0; box-shadow: none; z-index: 2; animation: none; transition: none; grid-template-rows: 1fr; background: #000; }
body.cinema #view > header { display: none; }
body.cinema #sys, body.cinema #time, body.cinema .frame, body.cinema #hand:not(.active) { display: none; }
/* 상태 표시: 쉬는 동안에는 숨기고, 듣기·생각 때만 왼쪽 아래에 작게 */
body.cinema #mini { z-index: 4; left: 8vw; padding: .4em 1em; background: rgba(0, 0, 0, .6); }
body.cinema.idle #mini { display: none; }
body.cinema.idle #coreWrap { opacity: 0; }
body.cinema #coreWrap { z-index: 4; transition: transform .5s var(--ease), opacity .4s; }
/* 답 글: 영상을 줄이지 않고 아래쪽에 자막처럼 겹쳐 잠깐만. "받아쓰는 중·생각하는 중" 같은 대기 글은 아예 띄우지 않음(왼쪽 아래 작은 표시가 대신함) */
body.cinema #panel { z-index: 3; left: 14vw; right: 14vw; bottom: 7vh; max-height: 20vh; background: rgba(0, 0, 0, .72); border: 0; box-shadow: none; }
body.cinema #panel::before { display: none; }
body.cinema #panel:has(#answer[data-kind="msg"] p.wait) { opacity: 0 !important; }
/* 영상 제목: 시작할 때 5초만 */
#viewBody .vtitle { position: absolute; left: 0; right: 0; top: 0; padding: 2.2vh 3vw 5vh; font-size: calc(var(--big) * .6); font-weight: 300; color: #fff; background: linear-gradient(rgba(0, 0, 0, .7), transparent); pointer-events: none; animation: vtitle 5s ease-in both; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
@keyframes vtitle { 0%, 80% { opacity: 1; } 100% { opacity: 0; } }
