/* ── 셀프 호스팅 웹폰트 — 모든 클라이언트(호스트/게스트)에서 동일하게 보인다 ── */
@font-face {
  font-family: "IBM Plex Sans KR";
  font-weight: 400; font-style: normal; font-display: swap;
  src: url("/fonts/ibm-plex-sans-kr-korean-400-normal.woff2") format("woff2");
  unicode-range: U+AC00-D7A3, U+1100-11FF, U+3130-318F, U+A960-A97F, U+D7B0-D7FF;
}
@font-face {
  font-family: "IBM Plex Sans KR";
  font-weight: 500; font-style: normal; font-display: swap;
  src: url("/fonts/ibm-plex-sans-kr-korean-500-normal.woff2") format("woff2");
  unicode-range: U+AC00-D7A3, U+1100-11FF, U+3130-318F, U+A960-A97F, U+D7B0-D7FF;
}
@font-face {
  font-family: "IBM Plex Sans KR";
  font-weight: 700; font-style: normal; font-display: swap;
  src: url("/fonts/ibm-plex-sans-kr-korean-700-normal.woff2") format("woff2");
  unicode-range: U+AC00-D7A3, U+1100-11FF, U+3130-318F, U+A960-A97F, U+D7B0-D7FF;
}
@font-face {
  font-family: "IBM Plex Sans KR";
  font-weight: 400; font-style: normal; font-display: swap;
  src: url("/fonts/ibm-plex-sans-kr-latin-400-normal.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+2000-206F, U+2192, U+2212;
}
@font-face {
  font-family: "IBM Plex Sans KR";
  font-weight: 500; font-style: normal; font-display: swap;
  src: url("/fonts/ibm-plex-sans-kr-latin-500-normal.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+2000-206F, U+2192, U+2212;
}
@font-face {
  font-family: "IBM Plex Sans KR";
  font-weight: 700; font-style: normal; font-display: swap;
  src: url("/fonts/ibm-plex-sans-kr-latin-700-normal.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+2000-206F, U+2192, U+2212;
}
@font-face {
  font-family: "IBM Plex Mono";
  font-weight: 400; font-style: normal; font-display: swap;
  src: url("/fonts/ibm-plex-mono-latin-400-normal.woff2") format("woff2");
}
@font-face {
  font-family: "IBM Plex Mono";
  font-weight: 500; font-style: normal; font-display: swap;
  src: url("/fonts/ibm-plex-mono-latin-500-normal.woff2") format("woff2");
}
@font-face {
  font-family: "IBM Plex Mono";
  font-weight: 700; font-style: normal; font-display: swap;
  src: url("/fonts/ibm-plex-mono-latin-700-normal.woff2") format("woff2");
}

:root {
  --bg: #222222;
  --fg: #f4f4f4;
  --muted: #888;
  --accent: #4cc2ff;
  --bar: rgba(20, 20, 20, 0.85);
}

* { box-sizing: border-box; }

html, body {
  margin: 0; padding: 0;
  width: 100%; height: 100%;
  background: var(--bg); color: var(--fg);
  font-family: "IBM Plex Sans KR", -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", "Noto Sans KR", sans-serif;
  overflow: hidden;
  overscroll-behavior: none;
  -webkit-tap-highlight-color: transparent;
  touch-action: none;
}

input, button, textarea, select { touch-action: auto; }
input[type="range"] { touch-action: pan-x; }

.stage {
  position: fixed; inset: 0;
  display: flex; align-items: center; justify-content: center;
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
}
body.has-host-bar .stage { bottom: 76px; }

button {
  font: inherit;
  padding: 12px 22px;
  border-radius: 999px;
  border: 1px solid #333;
  background: #1a1a1a; color: var(--fg);
  cursor: pointer;
}
button.primary { background: var(--accent); color: #001018; border-color: var(--accent); }
button:active { transform: scale(0.97); }

/* 발표자 메모 패널 (호스트 전용) */
.notes-panel {
  position: fixed; left: 0; right: 0; bottom: 76px;
  z-index: 40;
  background: rgba(15, 15, 15, 0.94);
  border-top: 1px solid #333;
  padding: 12px 18px;
  max-height: 32vh; overflow-y: auto;
}
.notes-label {
  font-size: 10px; letter-spacing: 0.2em; text-transform: uppercase;
  color: var(--muted); margin-bottom: 6px;
}
.notes-body {
  font-size: 17px; line-height: 1.6;
  white-space: pre-line;
  color: var(--fg);
}

/* sound — 1KB sound (스피커 픽토그램, 클릭 재생) */
.slide-sound {
  width: 100%; height: 100%;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 18px; cursor: pointer; user-select: none;
}
.ss-icon { width: clamp(120px, 28vmin, 260px); color: var(--fg); }
.ss-icon svg { width: 100%; height: auto; display: block; }
.ss-icon.pulse { animation: ss-pulse 0.4s ease-out; }
@keyframes ss-pulse {
  0% { transform: scale(1); }
  30% { transform: scale(1.12); }
  100% { transform: scale(1); }
}
.ss-title { margin: 0; font-size: clamp(36px, 7vw, 80px); font-weight: 700; letter-spacing: -0.02em; }
.ss-hint { font-size: clamp(14px, 2.5vw, 18px); color: var(--muted); }

/* gb-matter — 1KB = 0.000001 GB → Matter Matters 디졸브 */
.slide-gbm {
  position: relative; width: 100%; height: 100%;
  display: flex; flex-direction: column; align-items: center; justify-content: flex-start;
  gap: 10px; text-align: center; padding: 10vh 5vmin 5vmin;
}
.gbm-title { margin: 0; font-size: clamp(36px, 8vw, 130px); font-weight: 500; line-height: 1.1; }
.gbm-gb { transition: color 1s ease; }
.slide-gbm.revealed .gbm-gb { color: #F04E23; }
.gbm-matter {
  /* 위치·크기는 JS(alignMatter)가 "0.000001 GB" 너비에 맞춰 계산 */
  position: absolute;
  text-align: left;
  font-weight: 800; letter-spacing: -0.02em; line-height: 1.08;
  color: #F04E23;
  opacity: 0;
  transition: opacity 1.4s ease;
  pointer-events: none;
  white-space: nowrap;
}
.slide-gbm.revealed .gbm-matter { opacity: 1; }
.gbm-hint {
  position: absolute; bottom: 18px; left: 50%; transform: translateX(-50%);
  font-size: 26px; color: #fff; white-space: nowrap;
}

/* tn-live — (t * n) = 결과값 라이브 수식 */
.slide-tnlive {
  position: relative; width: 100%; height: 100%;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 14px; text-align: center; padding: 5vmin;
}
.tn-formula {
  margin: 0;
  font-size: clamp(32px, 7.5vw, 120px);
  font-weight: 500; line-height: 1.1;
  font-variant-numeric: tabular-nums;
  white-space: nowrap; /* 수식은 항상 한 줄 유지 */
}
.tn-n { color: #F04E23; }
.tn-result { color: #fff; }
/* 기호(t, n) ↔ 수치 크로스페이드 — 같은 자리에 겹쳐두고 2초 디졸브 */
.tn-slot { position: relative; display: inline-grid; justify-items: center; }
.tn-slot > .sym, .tn-slot > .num { grid-area: 1 / 1; transition: opacity 2s ease; }
.tn-slot .sym { opacity: 1; }
.tn-slot .num { opacity: 0; }
/* 수치로 바뀐 뒤 각 숫자 위에 떠 있는 변수명 표기 */
.tn-tag {
  position: absolute; bottom: calc(100% + 8px);
  left: 50%; transform: translateX(-50%);
  font-size: 0.96em; line-height: 1;
  color: var(--muted);
  opacity: 0; transition: opacity 2s ease;
}
.tn-tag-n { color: #F04E23; }
.slide-tnlive.numeric .tn-tag { opacity: 1; }
.slide-tnlive.numeric .tn-slot .sym { opacity: 0; }
.slide-tnlive.numeric .tn-slot .num { opacity: 1; }
/* 8비트 게이지 — 결과값 위 물통형 게이지. (t*n) & 255가 아래에서 차오르다 256마다 비워진다 */
.tn-r-slot { position: relative; }
.tn-bar {
  position: absolute;
  bottom: calc(100% + 16px);
  left: 50%; transform: translateX(-50%);
  width: clamp(100px, 20vw, 240px); height: clamp(80px, 16vmin, 160px);
  background: #2a2a2a;
  opacity: 0; transition: opacity 2s ease;
}
.slide-tnlive.numeric .tn-bar { opacity: 1; }
.tn-bar-fill {
  position: absolute; bottom: 0; left: 0;
  width: 100%; height: 0%;
  background: #F04E23;
}
.tn-body { margin: 0; color: #fff; font-size: clamp(24px, 5vw, 44px); }
.tn-hint {
  position: absolute; bottom: 18px; left: 50%; transform: translateX(-50%);
  font-size: 26px; color: #fff; white-space: nowrap;
}

/* keywords — 좌/우 키워드 비교 (같은 순번 항목은 같은 행에 정렬) */
.slide-keywords {
  width: 100%; height: 100%;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  align-content: start;
  column-gap: clamp(40px, 8vw, 120px);
  row-gap: 0.85em;
  padding: 8vh 6vmin 6vmin;
  overflow-y: auto;
  touch-action: pan-y;
  font-size: clamp(26px, 3.6vw, 45px);
}
.kw-head {
  font-family: "IBM Plex Mono", ui-monospace, monospace;
  font-size: clamp(28px, 4vw, 40px);
  font-weight: 700;
  letter-spacing: 0.18em; text-transform: uppercase;
  color: #FF8C1A;
  margin-bottom: 0.6em;
}
.kw-item {
  line-height: 1.45;
  animation: title-fade-up 0.8s cubic-bezier(0.16, 1, 0.3, 1) both;
}
/* 영문 키워드 아래 한글 번역 — 70% 크기, 밝은 그레이 */
.kw-ko {
  display: block;
  font-size: 70%;
  color: #b5b5b5;
  margin-top: 0.15em;
}
@media (max-width: 700px) {
  /* 모바일: 세로 나열 — order 값으로 PROTOROOM 전체 → p-code 전체 순 */
  .slide-keywords { display: flex; flex-direction: column; gap: 0.6em; padding-top: 8vh; }
  .kw-head { margin-bottom: 0.2em; margin-top: 0.6em; }
}

/* intro — 이미지 위, 타이틀 아래 중앙 정렬 */
.slide-intro {
  --intro-scale: min(9cqw, 5.8cqh);
  container-type: size;
  width: 100%; height: 100%;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 5vmin;
  text-align: center;
}
.intro-image {
  display: block;
  font-size: var(--intro-scale);
  width: 9em; height: auto;
  max-width: 100%;
  flex: none;
  margin-bottom: 0.7em;
  object-fit: contain;
}
.intro-title {
  margin: 0;
  max-width: 100%;
  font-size: var(--intro-scale);
  font-weight: 700; letter-spacing: -0.02em; line-height: 1.15;
  word-break: keep-all;
}
.intro-title span { display: block; }
.intro-subtitle { margin-top: 0.2em; font-size: 0.8em; }


/* text */
.slide-text {
  width: 100%; height: 100%;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  text-align: center; padding: 5vmin;
}
.slide-text h1 { margin: 0 0 0.4em; line-height: 1.1; font-weight: 700; letter-spacing: -0.02em; }
.slide-text p  { margin: 0; color: var(--muted); line-height: 1.5; max-width: 28em; font-size: 22px; }

/* revealOnClick — 진입 시 숨김, 호스트 클릭 시 페이드업으로 떠오름 */
.slide-text.revealable h1,
.slide-text.revealable p {
  opacity: 0;
  transform: translateY(40px);
  transition: opacity 1.2s cubic-bezier(0.16, 1, 0.3, 1), transform 1.2s cubic-bezier(0.16, 1, 0.3, 1);
}
.slide-text.revealable.revealed h1,
.slide-text.revealable.revealed p {
  opacity: 1;
  transform: none;
}

/* ja-sub — 한글 문장 아래 일본어 번역 (원문의 60%, 밝은 그레이)
   본문 애니메이션 종료 후 디졸브로 등장 */
.ja-sub {
  display: block;
  font-size: 60%;
  font-weight: 400;
  color: #b5b5b5;
  margin-top: 0.5em;
  line-height: 1.5;
  letter-spacing: 0;
  opacity: 0;
  transition: opacity 1.2s ease;
}
.ja-sub.show { opacity: 1; }

/* title-justify — 여러 줄 타이틀을 같은 폭의 직사각형 블록으로 (자간 자동 조정) */
.title-justify { display: inline-block; text-align: left; }
.title-justify .tj-line { display: block; white-space: pre; }

/* title animations (titleAnim: 1 | 2 | 3) */
.title-anim-1 { animation: title-fade-up 0.9s cubic-bezier(0.16, 1, 0.3, 1) both; }
@keyframes title-fade-up {
  from { opacity: 0; transform: translateY(40px); }
  to   { opacity: 1; transform: translateY(0); }
}
.title-anim-2 span {
  display: inline-block;
  animation: title-letter-pop 0.5s cubic-bezier(0.16, 1, 0.3, 1) both;
}
@keyframes title-letter-pop {
  from { opacity: 0; transform: translateY(0.4em) scale(0.8); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}
.title-anim-4 {
  font-family: "IBM Plex Mono", ui-monospace, "SF Mono", Menlo, monospace;
  font-weight: 500; letter-spacing: 0;
}
.typo-cursor {
  display: inline-block;
  width: 0.55em; height: 1em;
  margin-left: 0.08em;
  /* 커서가 줄 폭에 포함되지 않도록 — 가운데 정렬이 커서 때문에 밀리지 않게 */
  margin-right: -0.63em;
  vertical-align: text-bottom;
  background: var(--accent);
  animation: cursor-blink 0.9s steps(1) infinite;
}
@keyframes cursor-blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0; }
}
.title-anim-3 { animation: title-zoom-blur 1s cubic-bezier(0.16, 1, 0.3, 1) both; }
@keyframes title-zoom-blur {
  from { opacity: 0; transform: scale(1.6); filter: blur(14px); }
  to   { opacity: 1; transform: scale(1); filter: blur(0); }
}

/* writing — 1KB 쓰기 장치 (prototype/1kb-writing.html 팔레트) */
.slide-writing {
  --sw-paper: #F2F2EE;
  --sw-panel: #FAFAF8;
  --sw-ink: #1B1D1B;
  --sw-ink-soft: #6B6E69;
  --sw-line: #D6D7D1;
  --sw-signal: #1C5BFF;
  --sw-signal-deep: #0B3BB8;
  --sw-field: #FFFFFF;
  --sw-cell-empty: #EDEEE9;
  --sw-ok: #2F6B4F;
  --sw-danger: #C92A2A;
  --sw-mono: "IBM Plex Mono", ui-monospace, monospace;
  position: fixed; inset: 0;
  overflow-y: auto;
  background: var(--sw-paper);
  color: var(--sw-ink);
  font-size: 16px; line-height: 1.7;
  transition: background 0.05s;
  touch-action: auto;
}
body.has-host-bar .slide-writing { bottom: 76px; }
.slide-writing.over.inv {
  --sw-paper: #0D0D11;
  --sw-panel: #050507;
  --sw-line: #3F424C;
  --sw-field: #16171C;
  --sw-cell-empty: #26282F;
  --sw-ink: #F2F2EE;
  --sw-ink-soft: #A2A5AE;
}
.slide-writing.over.inv .sw-header,
.slide-writing.over.inv .sw-main { border-color: var(--sw-ink); }
.sw-frame { max-width: 1060px; margin: 0 auto; padding: 28px 20px 60px; }
.sw-header {
  border: 1px solid var(--sw-ink);
  background: var(--sw-panel);
  padding: 18px 22px 16px;
  display: flex; justify-content: space-between; align-items: flex-end;
  gap: 16px; flex-wrap: wrap;
}
.sw-nameplate h1 { margin: 0; font-size: 22px; font-weight: 500; letter-spacing: 0.02em; }
.sw-latin { font-family: var(--sw-mono); font-size: 11px; letter-spacing: 0.22em; text-transform: uppercase; color: var(--sw-ink-soft); margin-top: 2px; }
.sw-spec { font-family: var(--sw-mono); font-size: 11px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--sw-ink-soft); text-align: right; line-height: 1.9; }
.sw-spec b { color: var(--sw-ink); font-weight: 500; }
.sw-main {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(300px, 1fr);
  border: 1px solid var(--sw-ink);
  border-top: none;
  background: var(--sw-panel);
}
.sw-write { padding: 22px; border-right: 1px solid var(--sw-line); display: flex; flex-direction: column; }
.sw-label { font-family: var(--sw-mono); font-size: 10px; letter-spacing: 0.22em; text-transform: uppercase; color: var(--sw-ink-soft); margin-bottom: 10px; }
.sw-input, .sw-mirror {
  width: 100%; flex: none;
  height: 570px; min-height: 570px; /* 190px의 3배 */
  border: 1px solid var(--sw-line); border-radius: 0;
  background: var(--sw-field); color: var(--sw-ink);
  font: inherit; font-size: 34px; line-height: 1.7;
  padding: 18px;
  overflow-y: scroll; /* 스크롤바 항상 표시 */
}
.sw-input { resize: none; }
/* 보이는 스크롤바 (macOS 오버레이 스크롤바 대비) */
.sw-input::-webkit-scrollbar, .sw-mirror::-webkit-scrollbar { width: 10px; }
.sw-input::-webkit-scrollbar-track, .sw-mirror::-webkit-scrollbar-track { background: var(--sw-cell-empty); }
.sw-input::-webkit-scrollbar-thumb, .sw-mirror::-webkit-scrollbar-thumb {
  background: var(--sw-ink-soft); border-radius: 5px;
}
.sw-input:focus { outline: 2px solid var(--sw-signal); outline-offset: -1px; border-color: var(--sw-signal); }
.sw-input::placeholder { color: #B5B7B0; }
.sw-mirror { white-space: pre-wrap; word-break: break-word; overflow-y: auto; }
.sw-gauge { padding: 22px; display: flex; flex-direction: column; gap: 20px; }
.sw-readout { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.sw-bytes { font-family: var(--sw-mono); font-size: 40px; font-weight: 500; font-variant-numeric: tabular-nums; letter-spacing: -0.02em; transition: color 0.15s; }
.sw-of { font-family: var(--sw-mono); font-size: 13px; color: var(--sw-ink-soft); }
.sw-pct { margin-left: auto; font-family: var(--sw-mono); font-size: 13px; color: var(--sw-ink-soft); font-variant-numeric: tabular-nums; }
.sw-grid { width: 100%; image-rendering: pixelated; border: 1px solid var(--sw-line); background: var(--sw-field); display: block; }
.sw-caption { font-family: var(--sw-mono); font-size: 10px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--sw-ink-soft); margin-top: 6px; }
.sw-status { font-size: 13px; min-height: 20px; color: var(--sw-ink-soft); margin: 0; }
.sw-status.warn { color: var(--sw-signal-deep); }
.sw-status.over { color: var(--sw-danger); }
.sw-status.exact { color: var(--sw-ok); }
.sw-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 1px; background: var(--sw-line); border: 1px solid var(--sw-line); }
.sw-stat { background: var(--sw-panel); padding: 12px 14px; }
.sw-stat .k { font-family: var(--sw-mono); font-size: 10px; letter-spacing: 0.16em; text-transform: uppercase; color: var(--sw-ink-soft); }
.sw-stat .v { font-family: var(--sw-mono); font-size: 20px; font-weight: 500; font-variant-numeric: tabular-nums; margin-top: 2px; }
.sw-stat .v small { font-size: 12px; color: var(--sw-ink-soft); font-weight: 400; }
@media (max-width: 820px) {
  .sw-main { grid-template-columns: 1fr; }
  .sw-write { border-right: none; border-bottom: 1px solid var(--sw-line); }
  /* 모바일: 모든 요소가 한 화면에 들어오도록 압축 */
  .sw-frame { padding: 8px 12px 12px; }
  .sw-header { padding: 10px 14px 9px; }
  .sw-nameplate h1 { font-size: 17px; }
  .sw-latin, .sw-spec { display: none; }
  .sw-write { padding: 12px 14px; }
  .sw-label { margin-bottom: 6px; }
  .sw-input, .sw-mirror {
    min-height: 0; height: 16vh; max-height: 16vh;
    overflow-y: auto; resize: none;
    font-size: 30px; line-height: 1.7; padding: 10px 12px;
  }
  .sw-gauge { padding: 12px 14px; gap: 8px; }
  .sw-bytes { font-size: 24px; }
  .sw-caption { text-align: center; margin-top: 4px; }
  .sw-status { min-height: 14px; font-size: 12px; }
  .sw-stat { padding: 5px 8px; }
  .sw-stat .k { font-size: 9px; }
  .sw-stat .v { font-size: 13px; margin-top: 0; }
  .sw-stats { grid-template-columns: 1fr 1fr 1fr; }
}

/* units — 데이터 크기 단위 줌인 */
.slide-units {
  position: relative; width: 100%; height: 100%;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 20px; overflow: hidden;
}
.su-scene { display: flex; align-items: center; justify-content: center; will-change: transform; }
.su-square {
  position: relative;
  width: 60vmin; height: 60vmin;
  border: 2px solid var(--accent);
  background-color: rgba(76, 194, 255, 0.06);
  /* 트론 그리드 — 테두리 네온 발광 (바깥 번짐 + 안쪽 은은한 빛) */
  box-shadow:
    0 0 18px rgba(76, 194, 255, 0.45),
    0 0 50px rgba(76, 194, 255, 0.18),
    inset 0 0 22px rgba(76, 194, 255, 0.16);
  display: flex; justify-content: center;
}
/* 32 × 32 = 1,024칸 격자 — 캔버스에 칸칸이 생성 애니메이션으로 그려진다 */
.su-gridcanvas {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
}
.su-name {
  /* 격자 사각형 위, 일반 흐름 — 단위명+격자+캡션 묶음 전체가 화면 정중앙에 온다 */
  font-size: clamp(36px, 8vmin, 90px);
  font-weight: 800; letter-spacing: -0.02em;
  white-space: nowrap;
  text-align: center;
  transition: opacity 0.4s;
}
.su-tile {
  /* 1,024칸 중 하나 — 16열 / 16행 셀 (셀 중심: 51.5625%, 51.5625%) */
  position: absolute; left: 50%; top: 50%;
  width: 3.125%; height: 3.125%;
  background: #ff8c1a;
  box-shadow: 0 0 12px #ff8c1a;
  animation: overlay-blink 0.8s steps(1) infinite;
}
.su-caption {
  font-size: clamp(16px, 3vmin, 24px);
  color: var(--muted); min-height: 1.5em;
  transition: opacity 0.4s;
  font-variant-numeric: tabular-nums;
}
.su-hint {
  position: absolute; bottom: 18px; left: 50%; transform: translateX(-50%);
  font-size: 13px; color: var(--muted); white-space: nowrap;
}
.slide-units.zooming .su-name,
.slide-units.zooming .su-caption { opacity: 0; }
/* 줌 중에는 점멸을 멈추고 단색 오렌지로 — 피크에서 화면이 깜빡이지 않게 */
.slide-units.zooming .su-tile { animation: none; opacity: 1; }
/* 줌 피크에서 도트 위에 표시되는 "1 KB" */
.su-peak {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: clamp(80px, 18vw, 240px);
  font-weight: 800; letter-spacing: -0.02em;
  color: #fff;
  opacity: 0; transition: opacity 0.5s ease;
  pointer-events: none; z-index: 2;
}
.su-peak.show { opacity: 1; }
/* 줌아웃 복귀 후: 1 MB 화면의 오렌지 도트 옆에 붙는 "1 KB" 라벨 (도트와 함께 점멸) */
.su-tile-tag {
  display: none;
  position: absolute; left: calc(100% + 8px); top: 50%;
  transform: translateY(-50%);
  font-size: 17px; font-weight: 700; line-height: 1;
  color: #ff8c1a; white-space: nowrap;
}
.slide-units.final-dot .su-tile-tag { display: block; }
.slide-units.zooming .su-tile-tag { display: none; }

/* mul-explain — (t * n) 계산 구조 시각화 */
.slide-mulviz {
  position: relative; width: 100%; height: 100%;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 18px; padding: 4vmin; overflow: hidden;
}
.mv-formula {
  font-family: "IBM Plex Mono", ui-monospace, monospace;
  font-size: clamp(22px, 4vmin, 34px); font-weight: 600;
  color: var(--muted);
}
.mv-canvas {
  width: min(88vw, 880px); max-height: 52vh;
  aspect-ratio: 880 / 430;
}
.mv-caption { text-align: center; min-height: 3.2em; }
.mv-caption b { display: block; font-size: clamp(22px, 4.5vmin, 36px); font-weight: 700; }
.mv-caption span { display: block; margin-top: 4px; font-size: clamp(14px, 2.6vmin, 20px); color: var(--muted); }
.mv-play[hidden] { display: none; }
.mv-play {
  display: flex; align-items: center; justify-content: center;
  width: 56px; height: 56px; padding: 0;
  background: #ff8c1a; border-color: #ff8c1a; color: #1a0e00;
}
.mv-hint {
  position: absolute; bottom: 18px; left: 50%; transform: translateX(-50%);
  font-size: 13px; color: var(--muted); white-space: nowrap;
}

/* image */
.slide-image { width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; overflow: hidden; position: relative; }
.slide-image-overlay {
  position: absolute; left: 50%; top: 54%;
  transform: translateX(-50%);
  display: flex; flex-direction: column; align-items: center;
  font-size: clamp(64px, 14vw, 180px);
  font-weight: 800; letter-spacing: -0.02em; line-height: 1.05;
  color: #fff;
  text-shadow: 0 0 24px rgba(0, 0, 0, 0.85), 0 0 4px rgba(0, 0, 0, 0.9);
  pointer-events: none;
  /* 기본 opacity 0 + 2초 딜레이 — 슬라이드 진입 2초 후부터 점멸 시작 */
  opacity: 0;
  animation: overlay-blink 1s steps(1) 2s infinite;
}
.slide-image-overlay .oa-arrow { font-size: 0.45em; line-height: 1; }
@keyframes overlay-blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0; }
}
.slide-image img { width: 100%; height: auto; max-height: 100%; display: block; }
.slide-image-cover img { width: 100%; height: 100%; object-fit: cover; }
.slide-image-contain img { width: 100%; height: 100%; object-fit: contain; }
/* 픽셀 아트는 확대할 때 보간 없이 선명하게 표시 */
.slide-image-pixelated img { image-rendering: pixelated; }
/* original: 확대 없이 원본 픽셀 크기로 중앙 배치 (화면보다 크면 축소만) */
.slide-image-original img { width: auto; height: auto; max-width: 100%; max-height: 100%; }

/* color */
.slide-color { width: 100%; height: 100%; position: relative; }
.slide-color .swatch { width: 100%; height: 100%; }
.slide-color .controls {
  position: absolute; left: 0; right: 0; bottom: 0;
  padding: 16px 20px calc(16px + env(safe-area-inset-bottom));
  background: var(--bar);
  display: grid; grid-template-columns: auto 1fr; gap: 8px 14px; align-items: center;
  font-size: 14px;
}
.slide-color .controls label { color: var(--muted); }
.slide-color .controls .full { grid-column: 1 / -1; color: var(--fg); }

/* ────────── bytebeat (cream / editorial theme) ────────── */

body.theme-cream {
  background: #ebe8e1;
  color: #1a1a1a;
}
body.theme-cream .host-bar {
  background: rgba(255, 255, 255, 0.78);
  border-top: 1px solid #d8d4ca;
  color: #1a1a1a;
}
body.theme-cream .host-bar button {
  background: #fff;
  color: #1a1a1a;
  border-color: #d8d4ca;
}
body.theme-cream .host-bar .meta { color: #999; }

.bb {
  width: 100%;
  max-width: 720px;
  padding: 6vmin 5vmin;
  display: flex;
  flex-direction: column;
  gap: 28px;
  font-family: "IBM Plex Sans KR", -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", "Noto Sans KR", sans-serif;
  color: #1a1a1a;
}
/* 모바일: 좌우 여백 확보 + 간격 압축 */
@media (max-width: 600px) {
  .bb {
    padding: 20px 24px calc(20px + env(safe-area-inset-bottom));
    gap: 20px;
  }
}

.bb-title {
  font-size: 16px;
  letter-spacing: 0.06em;
  color: #F04E23;
  font-weight: 700;
  margin-bottom: -10px;
}

.bb-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.bb-reset {
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid #d8d4ca;
  background: #fff;
  color: #5b5448;
  font-size: 12px;
  font-weight: 600;
  line-height: 1;
}

.bb-reset:hover {
  background: #f6f3ec;
}

.bb-field { display: flex; flex-direction: column; gap: 10px; }

.bb-label {
  font-size: 11px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: #F04E23;
  font-weight: 600;
}
.bb-label:has(.bb-n) { font-size: 23px; letter-spacing: 0.06em; }
.bb-vol .bb-label { font-size: 16px; letter-spacing: 0.06em; }
.bb-label .bb-n {
  font-family: "IBM Plex Mono", "SF Mono", ui-monospace, Menlo, monospace;
  margin-left: 8px;
  color: #1a1a1a;
  letter-spacing: 0;
  font-weight: 700;
}

.bb-box {
  background: #fff;
  border: 1px solid #e0ddd5;
  border-radius: 6px;
  padding: 18px 20px;
  min-height: 120px;
}
.bb-box-readonly {
  display: flex;
  align-items: center;
  min-height: 80px;
}

.bb-expr {
  width: 100%;
  min-height: 84px;
  border: 0;
  outline: 0;
  resize: none;
  background: transparent;
  color: #1a1a1a;
  font-family: "IBM Plex Mono", "SF Mono", ui-monospace, Menlo, monospace;
  font-size: clamp(28px, 4.8vw, 36px);
  line-height: 1.5;
}
.bb-expr-display {
  width: 100%;
  font-family: "IBM Plex Mono", "SF Mono", ui-monospace, Menlo, monospace;
  font-size: clamp(24px, 4.5vw, 33px);
  color: #1a1a1a;
}

.bb-row {
  display: flex;
  align-items: center;
  gap: 24px;
}

.bb-play {
  flex: 0 0 auto;
  width: 62px; height: 62px;
  padding: 0;
  border-radius: 50%;
  background: #F04E23;
  border: 0;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.08s ease;
}
.bb-play:hover { background: #ff6336; }
.bb-play:active { transform: scale(0.94); }
.bb-play svg { width: 25px; height: 25px; }

.bb-vol {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* minimal range (used by VOLUME and N) */
.bb-vol-range {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 36px;
  background: transparent;
  outline: none;
}
.bb-vol-range::-webkit-slider-runnable-track {
  height: 2px;
  background: #999;
  border: none;
}
.bb-vol-range::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 28px; height: 28px;
  border-radius: 50%;
  background: #4a4a4a;
  border: none;
  margin-top: -13px;
  cursor: pointer;
}
.bb-vol-range::-moz-range-track {
  height: 2px;
  background: #999;
  border: none;
}
.bb-vol-range::-moz-range-thumb {
  width: 28px; height: 28px;
  border-radius: 50%;
  background: #4a4a4a;
  border: none;
  cursor: pointer;
}

.bb-counter-row {
  display: flex; justify-content: space-between; align-items: center;
  gap: 16px;
}
.bb-volsync {
  display: flex; align-items: center; gap: 8px;
  font-family: "IBM Plex Mono", "SF Mono", ui-monospace, Menlo, monospace;
  font-size: 14px; letter-spacing: 0.06em;
  color: #999;
  cursor: pointer; user-select: none;
}
.bb-volsync input { width: 18px; height: 18px; accent-color: #F04E23; cursor: pointer; }

/* 호스트가 볼륨을 컨트롤 중일 때 게스트 볼륨 dot 위에 표시되는 레드 X */
.bb-vol-wrap { position: relative; }
.bb-vol-x {
  position: absolute; top: 50%;
  transform: translate(-50%, -50%);
  pointer-events: none;
}
.bb-vol-x svg { width: 59px; height: 59px; display: block; }
.bb-vol-x[hidden] { display: none; }

.bb-counter {
  font-family: "IBM Plex Mono", "SF Mono", ui-monospace, Menlo, monospace;
  font-size: 39px;
  color: #999;
  margin-top: 8px;
}
.bb-counter i {
  font-style: italic;
  font-family: "Times New Roman", Georgia, serif;
}
.bb-counter b {
  color: #1a1a1a;
  font-weight: 700;
}

.bb-editor-pad .bb-box {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.bb-editor-pad .bb-expr {
  font-size: clamp(20px, 3.6vw, 28px);
}

body.layout-editor-top .stage {
  align-items: flex-start;
}

body.layout-editor-top .bb.bb-editor-pad {
  padding-top: clamp(8px, 2vmin, 16px);
}

.bb-pad {
  width: 100%;
}

.bb-pad-grid {
  display: grid;
  gap: 6px;
  grid-template-columns: repeat(6, minmax(0, 1fr));
}

.bb-pad-key {
  min-height: 34px;
  padding: 0 8px;
  border-radius: 4px;
  border: 1px solid #dfdbd2;
  background: #f5f2ea;
  color: #1a1a1a;
  font-family: "IBM Plex Mono", "SF Mono", ui-monospace, Menlo, monospace;
  font-size: 13px;
}

.bb-pad-key:active {
  transform: translateY(1px);
}

@media (max-width: 640px) {
  .bb-pad-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

/* mute bytebeat viewer */
.bb.bb-viewer {
  gap: 18px;
}

.bb-viewer .bb-row {
  justify-content: flex-start;
}

.bb-viz {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 12px;
  border: 1px solid #e0ddd5;
  border-radius: 6px;
  background: #fff;
}

.bb-readout {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 16px;
  font-family: "IBM Plex Mono", "SF Mono", ui-monospace, Menlo, monospace;
  font-size: 12px;
  color: #8d8678;
}

.bb-readout b {
  color: #1a1a1a;
  font-weight: 700;
  margin-left: 6px;
}

.bb-bits {
  display: grid;
  grid-template-columns: repeat(8, minmax(0, 1fr));
  gap: 6px;
}

.bb-bit {
  height: clamp(22px, 3vw, 30px);
  display: grid;
  place-items: center;
  border-radius: 4px;
  border: 1px solid #ddd8ce;
  background: #f8f6f1;
  color: #6e695f;
  font-family: "IBM Plex Mono", "SF Mono", ui-monospace, Menlo, monospace;
  font-size: 12px;
  font-weight: 700;
  line-height: 1;
  transition: background-color 120ms ease, border-color 120ms ease, color 120ms ease;
}

.bb-bit.on {
  background: #ee7c2b;
  border-color: #d87027;
  color: #fff;
}

.bb-history {
  width: 100%;
  height: 112px;
  display: block;
  border: 1px solid #ddd8ce;
  border-radius: 4px;
  background: #f8f6f1;
}

.bb-history-compact {
  margin-top: 6px;
  height: 72px;
}

@media (max-width: 640px) {
  .bb-history {
    height: 96px;
  }

  .bb-history-compact {
    height: 60px;
  }
}

/* p5 */
.slide-p5 { width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; }
.slide-p5 canvas { display: block; max-width: 100%; max-height: 100%; }

/* host bar */
.host-bar {
  position: fixed; left: 0; right: 0; bottom: 0;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  padding: 10px 14px calc(10px + env(safe-area-inset-bottom));
  background: var(--bar);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  z-index: 10;
}
.host-bar[hidden] { display: none; }
.host-nav-edge {
  justify-self: start;
  min-width: 52px;
  padding: 12px 18px;
}
.host-bar #next.host-nav-edge {
  justify-self: end;
}
.host-center {
  display: flex;
  align-items: center;
  gap: 12px;
  justify-self: center;
}
.host-front {
  text-transform: lowercase;
}
.host-bar .host-meta-inline {
  color: var(--fg);
}
.host-bar .meta {
  font-family: "SF Mono", ui-monospace, monospace;
  font-size: 13px; color: var(--muted);
}
.host-bar .sep { margin: 0 4px; }

/* 7번 슬라이드 배경색 (호스트 전용) */
.host-background-control {
  display: flex; align-items: center; gap: 6px;
  color: var(--fg); font-size: 12px;
}
.host-background-control input[type="color"] {
  width: 32px; height: 32px; padding: 2px;
  border: 1px solid #555; border-radius: 6px;
  background: #1a1a1a; cursor: pointer;
}
.host-background-code {
  width: 84px; padding: 7px 6px;
  border: 1px solid #555; border-radius: 6px;
  background: #1a1a1a; color: var(--fg);
  font: 13px "SF Mono", ui-monospace, monospace;
}
.host-background-control input:focus-visible {
  outline: 2px solid var(--accent); outline-offset: 2px;
}
.host-background-code:invalid { border-color: #F04E23; }
body.theme-cream .host-background-control { color: #1a1a1a; }
body.theme-cream .host-background-control input {
  background: #fff; color: #1a1a1a; border-color: #d8d4ca;
}
@media (max-width: 600px) {
  body.has-background-picker .host-bar {
    height: 112px;
    grid-template-columns: auto minmax(0, 1fr) auto;
    gap: 8px;
  }
  body.has-background-picker .host-center {
    flex-wrap: wrap; justify-content: center; gap: 6px;
  }
  body.has-background-picker .stage,
  body.has-background-picker .notes-panel,
  body.has-background-picker .qr-overlay { bottom: 112px; }
}

/* QR toggle button in host bar */
.host-qr-btn {
  padding: 6px 10px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  border-radius: 6px;
  min-width: auto;
  margin-left: 8px;
}
.host-qr-btn.active {
  background: var(--accent);
  color: #001018;
  border-color: var(--accent);
}

/* QR overlay — centered on stage */
.qr-overlay {
  position: fixed; inset: 0;
  display: flex; align-items: center; justify-content: center;
  background: none;
  pointer-events: none;
  z-index: 5;
}
.qr-overlay[hidden] { display: none; }
body.has-host-bar .qr-overlay { bottom: 76px; }
.qr-overlay-img {
  max-width: 70vmin;
  max-height: 70vmin;
  width: auto; height: auto;
  border-radius: 12px;
  box-shadow: 0 8px 40px rgba(0, 0, 0, 0.5);
}

/* Slide 6 only: original sharp image layers, translated at their native size. */
.slide-mario-animation {
  position: relative;
  width: 100%; height: 100%;
  display: flex; align-items: center; justify-content: center;
}
.slide-mario-animation canvas {
  display: block;
  width: 100%; height: 100%;
  object-fit: contain;
  image-rendering: pixelated;
}
.mario-animation-control {
  position: absolute;
  bottom: max(18px, env(safe-area-inset-bottom));
  left: 50%; transform: translateX(-50%);
  padding: 10px 18px;
  border: 1px solid rgba(255, 255, 255, 0.45);
  border-radius: 0;
  background: rgba(0, 0, 0, 0.8);
  color: #fff;
  font-size: clamp(14px, 2.5vmin, 20px);
  white-space: nowrap;
}
.mario-animation-control:active { transform: translateX(-50%); }
.mario-animation-control:focus-visible { outline: 3px solid #fff; outline-offset: 4px; }
.mario-animation-control:disabled { cursor: default; }
