@font-face {
  font-family: 'JetBrains Mono';
  font-style: normal;
  font-weight: 100 800;
  font-display: swap;
  src: url('/assets/fonts/JetBrainsMono-Variable.woff2') format('woff2');
}
@font-face {
  font-family: 'Unbounded';
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url('/assets/fonts/Unbounded-Variable.woff2') format('woff2');
}

:root {
  --bg: #05070f;
  --bg-code: #090b13;
  --bar: #0d1019;
  --glass: rgba(10, 15, 28, 0.72);
  --glass-strong: rgba(11, 16, 30, 0.90);
  --line: rgba(255, 255, 255, 0.13);
  --ink: #f1f5f9;
  --muted: rgba(241, 245, 249, 0.64);
  --faint: rgba(241, 245, 249, 0.36);
  --emerald: #2dd467;
  --gold: #ffbe3b;
  --ruby: #ff476c;
  --cyan: #38e8ff;
  --mono: 'JetBrains Mono', ui-monospace, 'Cascadia Code', Consolas, monospace;
  --display: 'Unbounded', -apple-system, BlinkMacSystemFont, 'Apple SD Gothic Neo', 'Malgun Gothic', sans-serif;
  --ui: -apple-system, BlinkMacSystemFont, 'Pretendard', 'Apple SD Gothic Neo', 'Malgun Gothic', sans-serif;
}

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

html, body {
  width: 100%;
  height: 100%;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--ui);
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
  user-select: none;
}

/* ============================================================
   COMMON PILLS
   ============================================================ */
.glass-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 13px;
  border-radius: 999px;
  background: var(--glass);
  border: 1px solid var(--line);
  color: var(--ink);
  text-decoration: none;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.06em;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  transition: border-color 0.2s, background 0.2s, transform 0.2s;
}
.glass-pill:hover {
  border-color: var(--emerald);
  background: rgba(45, 212, 103, 0.16);
  transform: translateY(-1px);
}

/* ============================================================
   PHASE 1: ASCII TREE 10S OPENING
   ============================================================ */
.ascii-intro {
  position: fixed;
  inset: 0;
  z-index: 60;
  background: #05050a;
  transition: opacity 0.75s cubic-bezier(0.22, 1, 0.36, 1), visibility 0.75s;
}
.ascii-intro.is-leaving {
  opacity: 0;
  pointer-events: none;
}
.ascii-intro.is-closed {
  display: none;
}

.ascii-app {
  display: grid;
  grid-template-columns: minmax(0, 62fr) minmax(350px, 38fr);
  grid-template-rows: auto minmax(0, 1fr);
  grid-template-areas:
    "stage bar"
    "stage code";
  width: 100%;
  height: 100dvh;
  background: #05050a;
  overflow: hidden;
  font-family: var(--mono);
}
.ascii-app.is-full {
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: minmax(0, 1fr) auto 0px;
  grid-template-areas:
    "stage"
    "bar"
    "code";
}

.ascii-stage {
  grid-area: stage;
  position: relative;
  min-width: 0;
  min-height: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background:
    radial-gradient(65% 70% at 50% 45%, rgba(16, 28, 24, 0.45), rgba(5, 5, 10, 0.96) 72%),
    #05050a;
  cursor: grab;
  touch-action: none;
}
.ascii-stage:active { cursor: grabbing; }
#ascii-canvas { display: block; width: 100%; height: 100%; }

.ascii-stage::after {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(circle at 50% 48%, transparent 56%, rgba(3, 3, 7, 0.65) 100%),
    repeating-linear-gradient(0deg, rgba(255, 255, 255, 0.012) 0 1px, transparent 1px 3px);
}

.ascii-top-left {
  position: absolute;
  top: clamp(12px, 2vw, 20px);
  left: clamp(12px, 2.2vw, 24px);
  z-index: 4;
  display: flex;
  align-items: center;
  gap: 8px;
}
.ascii-hint-pill {
  padding: 6px 11px;
  border-radius: 999px;
  background: rgba(13, 15, 23, 0.62);
  border: 1px solid rgba(255, 255, 255, 0.1);
  font-size: 9.5px;
  letter-spacing: 0.08em;
  color: var(--faint);
  pointer-events: none;
}
.ascii-timer {
  position: absolute;
  top: clamp(14px, 2.2vw, 22px);
  right: clamp(14px, 2.4vw, 26px);
  z-index: 4;
  font-size: clamp(10.5px, 1.1vw, 12.5px);
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  pointer-events: none;
}
.ascii-stats {
  position: absolute;
  top: 58px;
  left: clamp(12px, 2.4vw, 26px);
  z-index: 4;
  font-size: clamp(10px, 1.0vw, 11.5px);
  line-height: 1.5;
  color: rgba(238, 242, 247, 0.72);
  font-variant-numeric: tabular-nums;
  pointer-events: none;
}
.ascii-stats .tag { color: var(--ink); font-weight: 700; margin-bottom: 2px; }
.ascii-stats .dim { color: var(--muted); }
.ascii-stats b { color: var(--ink); font-weight: 600; }

/* Intro Portal Gateway Bar */
.intro-portal-bar {
  position: absolute;
  left: clamp(12px, 2.2vw, 24px);
  right: clamp(12px, 2.2vw, 24px);
  bottom: clamp(12px, 2.2vw, 20px);
  z-index: 30;
  pointer-events: auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 12px 16px;
  border-radius: 16px;
  background: rgba(9, 13, 24, 0.86);
  border: 1px solid rgba(255, 190, 59, 0.34);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  box-shadow: 0 14px 40px rgba(0, 0, 0, 0.55);
  font-family: var(--ui);
}
.intro-portal-info {
  flex: 1;
  min-width: 0;
  display: grid;
  gap: 5px;
}
.intro-portal-kicker {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.14em;
  color: var(--gold);
  font-weight: 700;
}
.intro-portal-sub {
  font-size: 12.5px;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.intro-progress-track {
  width: 100%;
  height: 5px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.12);
  overflow: hidden;
}
.intro-progress-fill {
  width: 0%;
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, #2dd467, #ffbe3b, #ff476c);
  transition: width 0.18s ease-out;
}
.intro-portal-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: none;
}
.intro-countdown-badge {
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 700;
  color: var(--gold);
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(255, 190, 59, 0.12);
  border: 1px solid rgba(255, 190, 59, 0.3);
  font-variant-numeric: tabular-nums;
}
.intro-enter-btn {
  position: relative;
  z-index: 35;
  pointer-events: auto;
  appearance: none;
  border: 0;
  cursor: pointer;
  padding: 10px 18px;
  border-radius: 999px;
  background: linear-gradient(135deg, #2dd467, #10b981);
  color: #03150c;
  font-family: var(--ui);
  font-size: 13px;
  font-weight: 800;
  box-shadow: 0 6px 20px rgba(45, 212, 103, 0.35);
  transition: transform 0.18s, filter 0.18s;
}
.intro-enter-btn:hover { transform: translateY(-1px) scale(1.02); filter: brightness(1.08); }

/* IDE bar & code pane */
.ascii-bar {
  grid-area: bar;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
  padding: 9px 14px;
  background: var(--bar);
  border-bottom: 1px solid var(--line);
  border-left: 1px solid var(--line);
  font-size: 11.5px;
  z-index: 5;
}
.ascii-app.is-full .ascii-bar {
  border-left: none;
  border-top: 1px solid var(--line);
  border-bottom: none;
}
.ascii-bar-left { display: flex; align-items: center; gap: 10px; min-width: 0; }
.file-tab { display: inline-flex; align-items: center; gap: 7px; color: var(--ink); font-weight: 600; }
.file-py {
  display: inline-grid;
  place-items: center;
  width: 17px;
  height: 17px;
  border-radius: 4px;
  background: rgba(59, 232, 255, 0.14);
  border: 1px solid rgba(59, 232, 255, 0.35);
  color: var(--cyan);
  font-size: 9px;
  font-weight: 700;
}
.bar-sub { color: var(--faint); font-size: 10.5px; }
.ascii-bar-right { display: flex; align-items: center; gap: 6px; }
.bar-btn {
  font-family: var(--mono);
  font-size: 10px;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 6px;
  padding: 4px 8px;
  cursor: pointer;
}
.bar-btn:hover { background: rgba(255, 255, 255, 0.14); }
.run-status { display: inline-flex; align-items: center; gap: 6px; font-size: 10.5px; color: var(--muted); }
.run-dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--emerald); box-shadow: 0 0 10px var(--emerald);
  animation: pulse 1.6s ease-in-out infinite;
}
.run-dot.is-mono { background: #e2e8f0; box-shadow: 0 0 8px rgba(226, 232, 240, 0.7); }
@keyframes pulse { 50% { opacity: 0.35; } }

.ascii-code-pane {
  grid-area: code;
  position: relative;
  background: var(--bg-code);
  border-left: 1px solid var(--line);
  overflow-y: auto;
  overflow-x: auto;
  scrollbar-width: thin;
}
.ascii-app.is-full .ascii-code-pane { overflow: hidden; border-left: none; }
.code-track { padding: 12px 14px 32px; min-width: max-content; }
.code-line {
  display: grid;
  grid-template-columns: 34px 1fr;
  gap: 10px;
  font-size: clamp(10px, 0.84vw, 11.8px);
  line-height: 1.62;
  white-space: pre;
  padding: 0 6px;
  border-radius: 4px;
}
.code-line.is-hl { background: rgba(45, 212, 103, 0.08); }
.ln { text-align: right; color: rgba(238, 242, 247, 0.24); }
.code-line.is-hl .ln { color: var(--emerald); }
.kw { color: #ff6b9e; }
.fn { color: #5ce1ff; }
.cls { color: #ffd23f; }
.num { color: #ffaa2b; }
.str { color: #7ee787; }
.cm { color: #6a738b; font-style: italic; }
.op { color: #a5b4fc; }

/* ============================================================
   PHASE 2: 3D WORLD STAGE & SANCTUARY HUD
   ============================================================ */
.world-stage {
  position: relative;
  width: 100vw;
  height: 100dvh;
  overflow: hidden;
  background: radial-gradient(circle at 50% 20%, #131c38 0%, #070a14 80%);
}
#xmas-canvas {
  display: block;
  width: 100%;
  height: 100%;
  touch-action: none;
}

/* Flash & Dissolve */
.camera-flash {
  position: absolute;
  inset: 0;
  z-index: 50;
  background: #ffffff;
  opacity: 0;
  pointer-events: none;
}
.camera-flash.is-flashing {
  animation: snap-flash 0.55s ease-out forwards;
}
@keyframes snap-flash {
  0% { opacity: 0.95; }
  100% { opacity: 0; }
}

.snow-dissolve {
  position: absolute;
  inset: 0;
  z-index: 48;
  background: radial-gradient(circle at 50% 50%, rgba(255, 255, 255, 0.96), rgba(226, 240, 255, 0.92));
  pointer-events: none;
  animation: snow-fade 1.1s ease-out forwards;
}
@keyframes snow-fade {
  0% { opacity: 0.95; }
  100% { opacity: 0; }
}

/* Top HUD */
.hud-top {
  position: absolute;
  top: clamp(10px, 1.8vw, 18px);
  left: clamp(10px, 1.8vw, 18px);
  right: clamp(10px, 1.8vw, 18px);
  z-index: 20;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  pointer-events: none;
}
.hud-left-cluster,
.hud-right-cluster {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  pointer-events: auto;
}

.visitor-pill {
  appearance: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  border-radius: 999px;
  background: var(--glass);
  border: 1px solid var(--line);
  color: var(--ink);
  font-family: var(--ui);
  font-size: 12px;
  font-weight: 700;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  transition: border-color 0.2s, transform 0.18s;
}
.visitor-pill:hover { border-color: var(--gold); transform: translateY(-1px); }
.visitor-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--emerald);
  box-shadow: 0 0 8px var(--emerald);
}
.visitor-tag {
  padding: 2px 7px;
  border-radius: 999px;
  background: rgba(255, 190, 59, 0.16);
  border: 1px solid rgba(255, 190, 59, 0.35);
  color: var(--gold);
  font-size: 11px;
}

.clock-pill {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  padding: 5px 13px;
  border-radius: 999px;
  background: var(--glass);
  border: 1px solid var(--line);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  font-variant-numeric: tabular-nums;
}
.clock-pill.is-fever {
  border-color: var(--gold);
  background: rgba(65, 18, 36, 0.82);
  box-shadow: 0 0 22px rgba(255, 190, 59, 0.35);
}
.clock-icon { font-size: 16px; }
.clock-meta { display: grid; line-height: 1.2; }
.clock-now { font-family: var(--mono); font-size: 10.5px; color: var(--muted); }
.clock-next { font-size: 11.5px; font-weight: 700; color: var(--gold); }
.online-badge {
  font-size: 11px;
  color: #bae6fd;
  padding-left: 8px;
  border-left: 1px solid var(--line);
}

.hud-btn {
  appearance: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 7px 12px;
  border-radius: 999px;
  background: var(--glass);
  border: 1px solid var(--line);
  color: var(--ink);
  font-family: var(--ui);
  font-size: 12px;
  font-weight: 700;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  transition: transform 0.18s, border-color 0.2s, background 0.2s;
}
.hud-btn:hover { transform: translateY(-1px); border-color: rgba(255, 255, 255, 0.38); }
.hud-btn.small { padding: 6px 11px; font-size: 11px; }
.hud-btn.accent-gold {
  background: linear-gradient(135deg, rgba(255, 190, 59, 0.24), rgba(255, 71, 108, 0.24));
  border-color: rgba(255, 190, 59, 0.55);
  color: #fde68a;
}
.hud-btn.accent-gold:hover {
  border-color: var(--gold);
  background: linear-gradient(135deg, rgba(255, 190, 59, 0.38), rgba(255, 71, 108, 0.38));
}
.hud-btn.accent-santa {
  background: linear-gradient(135deg, rgba(56, 189, 248, 0.22), rgba(168, 85, 247, 0.24));
  border-color: rgba(125, 211, 252, 0.5);
  color: #e0f2fe;
}
.hud-btn.accent-santa:hover {
  border-color: var(--cyan);
  background: linear-gradient(135deg, rgba(56, 189, 248, 0.38), rgba(168, 85, 247, 0.38));
}
.hud-btn.is-active {
  border-color: var(--emerald);
  background: rgba(45, 212, 103, 0.2);
}

/* ASMR Audio Mixer Popover */
.asmr-panel {
  position: absolute;
  top: 64px;
  right: clamp(10px, 1.8vw, 18px);
  z-index: 30;
  width: min(290px, 90vw);
  padding: 14px 16px;
  border-radius: 16px;
  background: var(--glass-strong);
  border: 1px solid rgba(255, 255, 255, 0.18);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  box-shadow: 0 18px 46px rgba(0, 0, 0, 0.6);
  display: grid;
  gap: 10px;
}
.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 13px;
}
.mini-close {
  appearance: none;
  cursor: pointer;
  width: 26px; height: 26px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.06);
  color: var(--ink);
  font-size: 12px;
  display: grid;
  place-items: center;
}
.mini-close:hover { background: rgba(255, 71, 108, 0.25); border-color: var(--ruby); }
.slider-row {
  display: grid;
  gap: 4px;
  font-size: 11.5px;
  color: var(--muted);
}
.slider-row input[type="range"] { width: 100%; accent-color: var(--gold); }

/* Fever Banner */
.fever-banner {
  position: absolute;
  top: 68px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 22;
  width: min(460px, 92vw);
  padding: 10px 16px;
  border-radius: 18px;
  background: linear-gradient(135deg, rgba(127, 29, 29, 0.88), rgba(20, 83, 45, 0.88));
  border: 1.5px solid var(--gold);
  box-shadow: 0 14px 40px rgba(255, 190, 59, 0.28);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  display: grid;
  gap: 6px;
  animation: fever-pop 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}
@keyframes fever-pop {
  from { opacity: 0; transform: translate(-50%, -12px) scale(0.94); }
  to { opacity: 1; transform: translate(-50%, 0) scale(1); }
}
.fever-banner-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 13px;
  color: #fef08a;
}
.fever-bell-anim { display: inline-block; animation: bell-ring 0.6s ease-in-out infinite alternate; }
@keyframes bell-ring {
  from { transform: rotate(-18deg); }
  to { transform: rotate(18deg); }
}
.fever-timer-pill {
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 800;
  padding: 2px 9px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.35);
  color: #ffffff;
}
.fever-perks {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
  font-size: 11px;
  font-weight: 700;
  color: #fde68a;
}
.fever-bar-track {
  height: 4px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.16);
  overflow: hidden;
}
.fever-bar-fill {
  height: 100%;
  width: 100%;
  background: linear-gradient(90deg, #ffbe3b, #2dd467, #ff476c);
  transition: width 0.2s linear;
}

.santa-banner {
  position: absolute;
  top: 68px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 23;
  width: min(460px, 92vw);
  padding: 10px 16px;
  border-radius: 999px;
  background: linear-gradient(135deg, rgba(15, 23, 42, 0.92), rgba(76, 29, 149, 0.88));
  border: 1.5px solid #fde047;
  box-shadow: 0 14px 40px rgba(250, 204, 21, 0.25);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  animation: fever-pop 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* Toast & Interact Prompt */
.toast-banner {
  position: absolute;
  top: 134px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 25;
  padding: 9px 18px;
  border-radius: 999px;
  background: var(--glass-strong);
  border: 1px solid rgba(255, 190, 59, 0.5);
  color: #fef3c7;
  font-size: 12.5px;
  font-weight: 700;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(10px);
  pointer-events: none;
  text-align: center;
  max-width: 90vw;
}

.interact-prompt {
  position: absolute;
  bottom: 136px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 24;
  appearance: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.9);
  border: 1.5px solid var(--gold);
  color: #fffbeb;
  font-family: var(--ui);
  font-size: 13px;
  font-weight: 800;
  box-shadow: 0 8px 26px rgba(0, 0, 0, 0.5);
}
.interact-prompt kbd {
  padding: 2px 7px;
  border-radius: 6px;
  background: var(--gold);
  color: #1e1b4b;
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 800;
}

/* Train Ride Floating Controls */
.train-ride-banner {
  position: absolute;
  bottom: 118px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 26;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  justify-content: center;
  gap: 12px;
  padding: 10px 14px 10px 16px;
  border-radius: 999px;
  background: linear-gradient(135deg, rgba(15, 23, 42, 0.92), rgba(30, 58, 138, 0.9));
  border: 1.5px solid var(--gold);
  box-shadow: 0 14px 38px rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  max-width: 94vw;
}
.train-ride-info {
  display: flex;
  align-items: center;
  gap: 10px;
}
.train-ride-info .train-ico {
  font-size: 22px;
  animation: train-bob 0.55s ease-in-out infinite alternate;
}
@keyframes train-bob {
  from { transform: translateY(0px); }
  to { transform: translateY(-3px); }
}
.train-ride-info strong {
  display: block;
  font-size: 12.5px;
  color: #fef08a;
}
.train-ride-info small {
  display: block;
  font-size: 10.5px;
  color: #bfdbfe;
}
.train-exit-btn {
  appearance: none;
  cursor: pointer;
  border: 0;
  padding: 8px 16px;
  border-radius: 999px;
  background: linear-gradient(135deg, #ff476c, #f97316);
  color: #ffffff;
  font-family: var(--ui);
  font-size: 12.5px;
  font-weight: 800;
  box-shadow: 0 4px 16px rgba(255, 71, 108, 0.4);
  transition: transform 0.16s, filter 0.16s;
}
.train-exit-btn:hover { transform: translateY(-1px) scale(1.02); filter: brightness(1.08); }

.dock-btn.is-riding {
  background: linear-gradient(135deg, rgba(56, 232, 255, 0.28), rgba(255, 190, 59, 0.28));
  border-color: var(--gold);
  color: #fef08a;
}

/* Bottom Dock & Photo Angle Controls */
.hud-bottom {
  position: absolute;
  left: 50%;
  bottom: clamp(10px, 2vw, 18px);
  transform: translateX(-50%);
  z-index: 22;
  display: grid;
  justify-items: center;
  gap: 8px;
  width: min(96vw, 840px);
  pointer-events: none;
}
.hud-bottom > * { pointer-events: auto; }

.photo-angle-strip {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  justify-content: center;
  gap: 12px;
  padding: 10px 16px;
  border-radius: 18px;
  background: var(--glass-strong);
  border: 1px solid rgba(56, 232, 255, 0.45);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  box-shadow: 0 12px 34px rgba(0, 0, 0, 0.55);
}
.angle-strip-title {
  display: grid;
  font-size: 11.5px;
  font-weight: 800;
  color: var(--cyan);
}
.angle-strip-title small { font-size: 10px; color: var(--muted); font-weight: 500; }
.angle-sliders {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}
.angle-ctrl {
  display: grid;
  gap: 2px;
  font-size: 10.5px;
  color: var(--muted);
}
.angle-ctrl input[type="range"] { width: 108px; accent-color: var(--cyan); }

.sanctuary-dock {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px;
  padding: 7px 10px;
  border-radius: 22px;
  background: var(--glass);
  border: 1px solid var(--line);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  box-shadow: 0 14px 36px rgba(0, 0, 0, 0.55);
}
.dock-btn {
  appearance: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  border-radius: 14px;
  border: 1px solid transparent;
  background: rgba(255, 255, 255, 0.06);
  color: var(--ink);
  font-family: var(--ui);
  font-size: 12px;
  font-weight: 700;
  transition: transform 0.16s, background 0.18s, border-color 0.18s;
}
.dock-btn:hover { background: rgba(255, 255, 255, 0.14); transform: translateY(-1px); }
.dock-btn.is-active {
  background: rgba(56, 232, 255, 0.2);
  border-color: var(--cyan);
  color: #cffafe;
}
.dock-btn.is-locked {
  opacity: 0.62;
}
.dock-btn.is-unlocked {
  background: rgba(45, 212, 103, 0.24);
  border-color: var(--emerald);
  color: #dcfce7;
}
.dock-btn.is-photo-cta {
  background: linear-gradient(135deg, #ffbe3b, #ff476c);
  color: #fff;
  border-color: rgba(255, 255, 255, 0.35);
  box-shadow: 0 4px 18px rgba(255, 71, 108, 0.35);
}
.dock-btn.is-photo-cta:hover { filter: brightness(1.08); }
.dock-ico { font-size: 15px; }
.dock-lbl em { font-style: normal; color: var(--gold); margin-left: 2px; }
.dock-divider { width: 1px; height: 22px; background: var(--line); margin: 0 2px; }

.controls-legend {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 12px;
  font-size: 10.5px;
  color: var(--ink);
  background: rgba(8, 12, 24, 0.72);
  padding: 5px 14px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  backdrop-filter: blur(8px);
}
.controls-legend kbd {
  padding: 1px 5px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.18);
  font-family: var(--mono);
  font-size: 9.5px;
  color: var(--ink);
}

/* ============================================================
   NAMETAGS & FLOATING EMOJI (WORLD OVERLAY)
   ============================================================ */
.nametag-layer {
  position: absolute;
  inset: 0;
  z-index: 10;
  pointer-events: none;
  overflow: hidden;
}
.avatar-tag {
  position: absolute;
  left: 0;
  top: 0;
  will-change: transform;
  transform: translate(-50%, -100%);
  padding: 3px 9px;
  border-radius: 999px;
  background: rgba(8, 12, 24, 0.66);
  border: 1px solid rgba(255, 255, 255, 0.18);
  color: #f8fafc;
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
  backdrop-filter: blur(4px);
  transition: opacity 0.2s;
}
.avatar-tag.is-player {
  background: rgba(20, 34, 66, 0.85);
  border-color: var(--gold);
  color: #fef08a;
}
.avatar-emote {
  position: absolute;
  left: 0;
  top: 0;
  will-change: transform;
  transform: translate(-50%, -100%);
  font-size: 20px;
  filter: drop-shadow(0 2px 6px rgba(0, 0, 0, 0.6));
}

.npc-speech-bubble {
  position: absolute;
  left: 0;
  top: 0;
  will-change: transform;
  transform: translate(-50%, -100%);
  padding: 5px 11px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.94);
  border: 2px solid #93c5fd;
  color: #0f172a;
  font-size: 11.5px;
  font-weight: 800;
  white-space: nowrap;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.38);
  transition: opacity 0.2s;
}
.npc-speech-bubble::after {
  content: '';
  position: absolute;
  left: 50%;
  bottom: -6px;
  transform: translateX(-50%);
  border-left: 6px solid transparent;
  border-right: 6px solid transparent;
  border-top: 6px solid #ffffff;
}
.npc-speech-bubble.is-heart {
  background: linear-gradient(135deg, #fff1f2, #ffe4e6);
  border-color: #fb7185;
  color: #9f1239;
}

.secret-pill {
  border-color: rgba(250, 204, 21, 0.48);
  background: rgba(30, 27, 75, 0.72);
  color: #fef08a;
}
.secret-pill strong { color: #ffbe3b; font-family: var(--mono); }
.secret-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  max-height: 52vh;
  overflow-y: auto;
}
.secret-item {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 9px 11px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.12);
  font-size: 11.5px;
  cursor: pointer;
  transition: transform 0.15s, border-color 0.15s, background 0.15s;
}
.secret-item:hover {
  transform: translateY(-1px);
  border-color: rgba(255, 190, 59, 0.7);
  background: rgba(255, 190, 59, 0.12);
}
.mini-nick-btn {
  padding: 6px 10px;
  font-size: 11.5px;
}
.secret-item.is-done {
  background: rgba(250, 204, 21, 0.14);
  border-color: rgba(250, 204, 21, 0.55);
}
.secret-item strong { color: #fef08a; font-size: 12px; }
.secret-item span { color: var(--muted); font-size: 11px; }

/* ============================================================
   DIALOGS (SNAPSHOT & WISH)
   ============================================================ */
.xmas-dialog {
  margin: auto;
  border: 1px solid rgba(255, 190, 59, 0.45);
  border-radius: 22px;
  background: var(--glass-strong);
  color: var(--ink);
  width: min(92vw, 560px);
  padding: 20px;
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.72);
  backdrop-filter: blur(18px);
}
.xmas-dialog.small { width: min(92vw, 420px); }
.xmas-dialog::backdrop {
  background: rgba(4, 6, 14, 0.72);
  backdrop-filter: blur(4px);
}

.snap-card, .wish-card { display: grid; gap: 12px; }
.snap-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.snap-kicker { font-family: var(--mono); font-size: 10px; letter-spacing: 0.12em; color: var(--gold); font-weight: 700; }
.snap-head h2 { font-size: 17px; font-weight: 800; margin-top: 2px; }
.snap-frame {
  border-radius: 14px;
  overflow: hidden;
  border: 1px solid var(--line);
  background: #070a14;
}
.snap-frame img { display: block; width: 100%; height: auto; }
.snap-status {
  font-size: 12.5px;
  color: #bbf7d0;
  background: rgba(20, 83, 45, 0.35);
  border: 1px solid rgba(45, 212, 103, 0.35);
  padding: 9px 12px;
  border-radius: 12px;
}
.snap-status.is-warn {
  color: #fef08a;
  background: rgba(120, 53, 15, 0.4);
  border-color: rgba(255, 190, 59, 0.4);
}
.snap-actions { display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-end; }
.snap-btn {
  appearance: none;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 15px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.08);
  color: var(--ink);
  font-family: var(--ui);
  font-size: 12.5px;
  font-weight: 700;
}
.snap-btn.primary {
  background: linear-gradient(135deg, #ffbe3b, #ff476c);
  border-color: transparent;
  color: #ffffff;
}
.wish-desc { font-size: 12.5px; color: var(--muted); }
.wish-card input[type="text"] {
  width: 100%;
  padding: 11px 14px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.22);
  background: rgba(5, 7, 15, 0.8);
  color: #fff;
  font-family: var(--ui);
  font-size: 13.5px;
}

/* Mobile Joystick */
.mobile-joy {
  display: none;
  position: absolute;
  left: 18px;
  bottom: 126px;
  z-index: 21;
}
.joy-base {
  width: 96px;
  height: 96px;
  border-radius: 50%;
  background: rgba(15, 23, 42, 0.48);
  border: 1.5px solid rgba(255, 255, 255, 0.24);
  display: grid;
  place-items: center;
  touch-action: none;
}
.joy-knob {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: rgba(255, 190, 59, 0.82);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.45);
}

@media (max-width: 900px) {
  .ascii-app {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: minmax(0, 62fr) auto minmax(0, 38fr);
    grid-template-areas: "stage" "bar" "code";
  }
  .ascii-app.is-full { grid-template-rows: minmax(0, 1fr) auto 0px; }
  .ascii-hint-pill, .bar-sub, .run-word { display: none; }
  .intro-portal-bar { flex-direction: column; align-items: stretch; gap: 8px; padding: 10px 12px; }
  .intro-portal-actions { justify-content: space-between; }
  .controls-legend { display: none; }
  .online-badge { display: none; }
  .mobile-joy { display: block; }
}

@media (pointer: coarse) {
  .mobile-joy { display: block; }
}
