/* ==========================================================================
   WINDOW ESCAPE / 瀏覽器密室 — EDITION 2.0
   Museum-Grade Swiss International Typographic Style Design System
   ========================================================================== */

:root {
  --bg: #f5f3ec;
  --surface: #ffffff;
  --surface-subtle: #eceae1;
  --ink: #111111;
  --ink-secondary: #484640;
  --ink-muted: #848178;
  --border: rgba(17, 17, 17, 0.13);
  --border-strong: rgba(17, 17, 17, 0.88);
  --grid-line: rgba(17, 17, 17, 0.05);
  --accent: #e30613; /* Swiss International Vermilion */
  --accent-soft: rgba(227, 6, 19, 0.09);
  --ghost-glow: none;
  --shadow-card: 0 22px 54px rgba(17, 17, 17, 0.065),
    0 2px 6px rgba(17, 17, 17, 0.03);

  --font-sans: "Helvetica Neue", "Inter", -apple-system, BlinkMacSystemFont,
    "PingFang TC", "Noto Sans TC", "Microsoft JhengHei", sans-serif;
  --font-mono: "SF Mono", "JetBrains Mono", "Menlo", "Monaco", "Consolas",
    monospace;

  --ease-swiss: cubic-bezier(0.22, 1, 0.36, 1);
  --grid-size: 48px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #09090b;
    --surface: #111115;
    --surface-subtle: #18181f;
    --ink: #f3f1e9;
    --ink-secondary: #b5b2a7;
    --ink-muted: #6c6a63;
    --border: rgba(243, 241, 233, 0.13);
    --border-strong: rgba(243, 241, 233, 0.88);
    --grid-line: rgba(243, 241, 233, 0.042);
    --accent: #ff2e3b;
    --accent-soft: rgba(255, 46, 59, 0.16);
    --ghost-glow: 0 0 32px rgba(210, 236, 255, 0.38);
    --shadow-card: 0 26px 64px rgba(0, 0, 0, 0.55);
  }
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  width: 100%;
  min-height: 100vh;
  background-color: var(--bg);
  color: var(--ink);
  font-family: var(--font-sans);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  transition: background-color 0.55s var(--ease-swiss),
    color 0.55s var(--ease-swiss);
  overflow-x: hidden;
}

::selection {
  background: var(--accent);
  color: #ffffff;
}

/* Swiss Architectural Background Grid */
.swiss-grid-bg {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background-image:
    linear-gradient(to right, var(--grid-line) 1px, transparent 1px),
    linear-gradient(to bottom, var(--grid-line) 1px, transparent 1px);
  background-size: var(--grid-size) var(--grid-size);
  background-position: -1px -1px;
}

/* Subtle Lithograph Paper Grain */
.paper-grain {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  opacity: 0.035;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* Minimalist Particle FX Canvas */
.fx-canvas {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  pointer-events: none;
  z-index: 60;
}

/* Main Shell Layout */
.app-shell {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: 58px 1fr 48px;
}

/* Top Bar */
.top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  border-bottom: 1px solid var(--border);
  background: color-mix(in srgb, var(--bg) 86%, transparent);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  gap: 14px;
}

.brand-mark {
  display: inline-flex;
  align-items: baseline;
  gap: 10px;
  background: none;
  border: none;
  padding: 0;
  color: var(--ink);
  cursor: pointer;
  font-family: var(--font-sans);
}

.brand-dot {
  width: 9px;
  height: 9px;
  background: var(--accent);
  display: inline-block;
  transform: translateY(-1px);
  transition: transform 0.35s var(--ease-swiss);
}

.brand-mark:hover .brand-dot {
  transform: translateY(-1px) rotate(45deg);
}

.brand-title {
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.08em;
}

.brand-sub {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.14em;
  color: var(--ink-muted);
}

/* 12-Room Progress Navigation with 3-Act Dividers */
.room-progress-nav {
  display: flex;
  align-items: center;
  gap: 4px;
  overflow-x: auto;
  scrollbar-width: none;
}

.room-progress-nav::-webkit-scrollbar {
  display: none;
}

.act-divider {
  width: 1px;
  height: 14px;
  background: var(--border-strong);
  opacity: 0.25;
  margin: 0 4px;
  flex-shrink: 0;
}

.room-pip {
  position: relative;
  height: 24px;
  min-width: 24px;
  padding: 0 4px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--ink-muted);
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.22s var(--ease-swiss);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.room-pip:hover:not(:disabled) {
  border-color: var(--ink);
  color: var(--ink);
}

.room-pip.is-active {
  background: var(--ink);
  border-color: var(--ink);
  color: var(--bg);
}

.room-pip.is-solved {
  border-color: var(--ink);
  color: var(--ink);
}

.room-pip.is-solved::after {
  content: "";
  position: absolute;
  top: 2px;
  right: 2px;
  width: 4px;
  height: 4px;
  background: var(--accent);
}

.room-pip:disabled {
  opacity: 0.28;
  cursor: not-allowed;
}

/* Utility Cluster */
.utility-cluster {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.util-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: none;
  border: 1px solid var(--border);
  color: var(--ink-secondary);
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.1em;
  padding: 5px 9px;
  cursor: pointer;
  transition: all 0.2s var(--ease-swiss);
}

.util-btn:hover {
  border-color: var(--ink);
  color: var(--ink);
}

.util-indicator {
  width: 6px;
  height: 6px;
  background: var(--accent);
  border-radius: 50%;
  transition: opacity 0.2s ease;
}

.util-btn[aria-pressed="false"] .util-indicator {
  opacity: 0.25;
  background: var(--ink-muted);
}

/* Stage Frame & Left Swiss Architectural Ruler */
.stage-frame {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr);
  min-height: 0;
}

.arch-ruler {
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  padding: 24px 0;
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.16em;
  color: var(--ink-muted);
  user-select: none;
}

.ruler-act,
.ruler-coord {
  writing-mode: vertical-rl;
  transform: rotate(180deg);
}

.ruler-act {
  color: var(--accent);
  font-weight: 700;
}

.ruler-ticks {
  display: flex;
  flex-direction: column;
  gap: 10px;
  align-items: flex-end;
  width: 100%;
  padding-right: 0;
}

.ruler-ticks span {
  display: block;
  width: 8px;
  height: 1px;
  background: var(--border);
}

.ruler-ticks span.major {
  width: 18px;
  background: var(--ink-muted);
}

.stage {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px 28px;
  outline: none;
}

/* Bottom Bar */
.bottom-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  border-top: 1px solid var(--border);
  background: color-mix(in srgb, var(--bg) 90%, transparent);
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.1em;
  color: var(--ink-muted);
}

.telemetry-strip {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.tele-item {
  transition: color 0.25s ease;
}

.tele-item.is-highlight {
  color: var(--accent);
  font-weight: 700;
}

.tele-sep {
  opacity: 0.35;
}

.hint-trigger {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  background: none;
  border: none;
  color: var(--ink-secondary);
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.1em;
  cursor: pointer;
  padding: 6px 4px;
  transition: color 0.2s ease;
}

.hint-trigger:hover {
  color: var(--accent);
}

.hint-dot {
  width: 6px;
  height: 6px;
  border: 1px solid currentColor;
  display: inline-block;
}

/* ==========================================================================
   COMMON ROOM ARCHITECTURE & TYPOGRAPHY
   ========================================================================== */

.room-shell {
  width: 100%;
  max-width: 820px;
  display: flex;
  flex-direction: column;
  gap: 24px;
  animation: roomEnter 0.55s var(--ease-swiss) both;
}

@keyframes roomEnter {
  from {
    opacity: 0;
    transform: translateY(14px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.room-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  border-bottom: 2px solid var(--ink);
  padding-bottom: 14px;
  gap: 16px;
}

.room-act-tag {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.18em;
  color: var(--ink-muted);
  margin-bottom: 4px;
}

.room-index {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.16em;
  color: var(--accent);
  font-weight: 700;
  margin-bottom: 6px;
}

.room-title {
  margin: 0;
  font-size: clamp(28px, 4.2vw, 44px);
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.04;
}

.room-subtitle-en {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.14em;
  color: var(--ink-muted);
  text-transform: uppercase;
  text-align: right;
}

.room-prompt {
  margin: 0;
  font-size: 15px;
  line-height: 1.75;
  color: var(--ink-secondary);
  max-width: 600px;
}

/* Museum Gallery Canvas */
.gallery-canvas {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--border);
  padding: 40px 32px;
  min-height: 300px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-card);
  transition: border-color 0.35s var(--ease-swiss),
    background-color 0.55s var(--ease-swiss);
}

.gallery-canvas.is-solved {
  border-color: var(--ink);
}

.gallery-canvas::before,
.gallery-canvas::after {
  content: "+";
  position: absolute;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--ink-muted);
  opacity: 0.48;
  pointer-events: none;
}

.gallery-canvas::before { top: 10px; left: 12px; }
.gallery-canvas::after { bottom: 10px; right: 12px; }

/* Cleared Vermilion Museum Stamp */
.cleared-stamp {
  position: absolute;
  top: 16px;
  right: 18px;
  border: 1.5px solid var(--accent);
  color: var(--accent);
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.18em;
  padding: 3px 8px;
  transform: rotate(-3deg);
  animation: stampSlam 0.32s var(--ease-swiss) both;
  pointer-events: none;
}

@keyframes stampSlam {
  from { opacity: 0; transform: scale(1.6) rotate(-10deg); }
  to { opacity: 1; transform: scale(1) rotate(-3deg); }
}

/* Swiss Buttons */
.swiss-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 12px 24px;
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  border: 1.5px solid var(--ink);
  background: transparent;
  color: var(--ink);
  cursor: pointer;
  transition: all 0.24s var(--ease-swiss);
}

.swiss-btn:hover:not(:disabled) {
  background: var(--ink);
  color: var(--bg);
}

.swiss-btn-primary {
  background: var(--ink);
  color: var(--bg);
}

.swiss-btn-primary:hover:not(:disabled) {
  background: var(--accent);
  border-color: var(--accent);
  color: #ffffff;
}

.swiss-btn-accent {
  background: var(--accent);
  border-color: var(--accent);
  color: #ffffff;
}

.swiss-btn-accent:hover:not(:disabled) {
  background: var(--ink);
  border-color: var(--ink);
  color: var(--bg);
}

.swiss-btn:disabled {
  opacity: 0.32;
  cursor: not-allowed;
}

/* ==========================================================================
   4-CELL MECHANICAL SWISS TUMBLER PASSCODE INPUT
   ========================================================================== */

.tumbler-form {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-top: 22px;
  flex-wrap: wrap;
  justify-content: center;
}

.tumbler-cells {
  display: flex;
  gap: 8px;
}

.tumbler-cell {
  width: 46px;
  height: 54px;
  border: 1.5px solid var(--border-strong);
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-mono);
  font-size: 24px;
  font-weight: 700;
  text-align: center;
  text-transform: uppercase;
  outline: none;
  transition: border-color 0.18s ease, transform 0.18s var(--ease-swiss), background-color 0.2s ease;
}

.tumbler-cell:focus {
  border-color: var(--accent);
  background: var(--surface);
  transform: translateY(-2px);
}

.tumbler-cell:disabled {
  opacity: 0.7;
  background: var(--surface-subtle);
}

.tumbler-cells.is-error .tumbler-cell {
  border-color: var(--accent);
  animation: shake 0.34s ease;
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-6px); }
  50% { transform: translateX(6px); }
  75% { transform: translateX(-4px); }
}

/* Solved Banner */
.solved-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border: 1.5px solid var(--ink);
  background: var(--surface);
  gap: 16px;
  animation: roomEnter 0.4s var(--ease-swiss) both;
}

.solved-meta {
  display: flex;
  align-items: center;
  gap: 12px;
}

.solved-badge {
  width: 10px;
  height: 10px;
  background: var(--accent);
  flex-shrink: 0;
}

.solved-text {
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.03em;
}

/* ==========================================================================
   COVER SCREEN WITH KINETIC SWISS EMBLEM
   ========================================================================== */

.cover-shell {
  width: 100%;
  max-width: 840px;
  display: grid;
  grid-template-columns: 1fr;
  gap: 32px;
  animation: roomEnter 0.65s var(--ease-swiss) both;
}

.cover-hero-row {
  display: grid;
  grid-template-columns: 1fr 164px;
  gap: 28px;
  align-items: center;
  border-top: 2px solid var(--ink);
  border-bottom: 1px solid var(--border);
  padding: 28px 0 32px;
}

.cover-kicker {
  display: flex;
  align-items: center;
  gap: 12px;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.18em;
  color: var(--accent);
  font-weight: 700;
}

.cover-h1 {
  margin: 0;
  font-size: clamp(44px, 7.6vw, 80px);
  font-weight: 700;
  letter-spacing: -0.04em;
  line-height: 0.96;
}

.cover-h1-en {
  display: block;
  margin-top: 12px;
  font-size: clamp(14px, 2vw, 20px);
  font-weight: 400;
  letter-spacing: 0.18em;
  color: var(--ink-muted);
}

.cover-emblem {
  width: 156px;
  height: 156px;
  border: 1.5px solid var(--ink);
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--surface);
  overflow: hidden;
}

.cover-emblem-inner {
  width: 88px;
  height: 88px;
  border: 1.5px solid var(--border-strong);
  position: relative;
  transition: transform 0.25s var(--ease-swiss);
}

.cover-emblem-dot {
  position: absolute;
  width: 24px;
  height: 24px;
  background: var(--accent);
  bottom: 10px;
  right: 10px;
}

.cover-grid {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: 32px;
  align-items: start;
}

.cover-manifesto {
  margin: 0;
  font-size: 15px;
  line-height: 1.85;
  color: var(--ink-secondary);
}

.cover-specs {
  border-left: 1px solid var(--border);
  padding-left: 24px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--ink-muted);
}

.spec-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.spec-row strong {
  color: var(--ink);
  font-weight: 600;
}

.cover-actions {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}

/* ==========================================================================
   ROOM 01: THE GAP
   ========================================================================== */

.gap-stage {
  width: 100%;
  height: 210px;
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  overflow: hidden;
}

.gap-floor-row {
  width: 100%;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  position: relative;
  height: 110px;
}

.cliff {
  height: 64px;
  background: var(--ink);
  position: relative;
  flex-shrink: 0;
}

.gap-void {
  flex: 1;
  height: 64px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  position: relative;
  min-width: 0;
  overflow: hidden;
}

.gap-measure-line {
  width: calc(100% - 12px);
  height: 1px;
  background: var(--accent);
  position: relative;
  opacity: 0.75;
}

.gap-measure-line::before,
.gap-measure-line::after {
  content: "";
  position: absolute;
  top: -4px;
  width: 1px;
  height: 9px;
  background: var(--accent);
}

.gap-measure-line::before { left: 0; }
.gap-measure-line::after { right: 0; }

.gap-measure-label {
  margin-top: 8px;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  color: var(--accent);
  letter-spacing: 0.08em;
  white-space: nowrap;
}

.traveler {
  position: absolute;
  bottom: 64px;
  left: 36px;
  width: 24px;
  height: 24px;
  background: var(--ink);
  border: 2px solid var(--ink);
  cursor: pointer;
  z-index: 3;
  will-change: left, bottom, transform;
}

.traveler::after {
  content: "";
  position: absolute;
  top: 5px;
  right: 5px;
  width: 5px;
  height: 5px;
  background: var(--bg);
}

.traveler.is-facing-left::after {
  right: auto;
  left: 5px;
}

.traveler.is-edge-bump {
  animation: edgeBump 0.24s var(--ease-swiss);
}

@keyframes edgeBump {
  0% { transform: rotate(0deg); }
  45% { transform: translateX(4px) rotate(10deg); }
  100% { transform: rotate(0deg); }
}

.exit-door-mini {
  position: absolute;
  bottom: 64px;
  right: 40px;
  width: 28px;
  height: 44px;
  border: 2px solid var(--accent);
  background: var(--accent-soft);
  cursor: pointer;
}

.exit-door-mini::after {
  content: "EXIT";
  position: absolute;
  top: -20px;
  left: 50%;
  transform: translateX(-50%);
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.14em;
  color: var(--accent);
}

.gap-status-note {
  margin-top: 18px;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.1em;
  color: var(--ink-muted);
  text-align: center;
}

/* ==========================================================================
   ROOM 02: GRAVITY WELL (WINDOW SCREENX/Y INERTIA)
   ========================================================================== */

.inertia-arena {
  width: 100%;
  max-width: 540px;
  height: 210px;
  border: 2px solid var(--ink);
  background: var(--bg);
  position: relative;
  overflow: hidden;
}

.inertia-grid-cross {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(to right, var(--grid-line) 1px, transparent 1px),
    linear-gradient(to bottom, var(--grid-line) 1px, transparent 1px);
  background-size: 36px 36px;
  pointer-events: none;
}

.inertia-baffle {
  position: absolute;
  left: 52%;
  top: 0;
  width: 8px;
  height: 112px;
  background: var(--ink);
}

.inertia-socket {
  position: absolute;
  right: 48px;
  top: 50%;
  transform: translateY(-50%);
  width: 44px;
  height: 44px;
  border: 2px solid var(--ink);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.inertia-socket::after {
  content: "";
  width: 10px;
  height: 10px;
  border: 1px solid var(--ink-muted);
  border-radius: 50%;
}

.inertia-socket.is-locked {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.inertia-ball {
  position: absolute;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 4px 14px rgba(227, 6, 19, 0.35);
  will-change: transform;
  pointer-events: none;
}

/* ==========================================================================
   ROOM 03: STEP BACK (ZOOM OUT)
   ========================================================================== */

.zoom-canvas-wrap {
  width: 100%;
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
}

.zoom-billboard {
  width: 100%;
  height: 185px;
  border: 1px solid var(--border);
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg);
}

.zoom-giant-bars {
  font-family: var(--font-sans);
  font-size: 168px;
  font-weight: 800;
  letter-spacing: -0.14em;
  color: var(--ink);
  line-height: 0.85;
  transform: scale(4.8) translateY(12%);
  transition: transform 0.75s var(--ease-swiss), color 0.5s ease, letter-spacing 0.75s var(--ease-swiss);
  user-select: none;
  white-space: nowrap;
}

.zoom-billboard.is-revealed .zoom-giant-bars {
  transform: scale(0.56) translateY(0);
  color: var(--accent);
  letter-spacing: 0.16em;
}

.zoom-outer-reveal {
  position: fixed;
  top: 50%;
  right: 26px;
  transform: translateY(-50%);
  writing-mode: vertical-rl;
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.24em;
  color: var(--accent);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.5s ease;
}

.zoom-outer-reveal.is-visible {
  opacity: 1;
}

/* ==========================================================================
   ROOM 04: THE CEILING (FULLSCREEN / VERTICAL EXPANSION)
   ========================================================================== */

.ceiling-stage {
  width: 100%;
  max-width: 440px;
  height: 210px;
  border: 1px solid var(--border);
  background: var(--bg);
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
}

.ceiling-beam {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 76px;
  background: var(--ink);
  color: var(--bg);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding-bottom: 12px;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.22em;
  z-index: 3;
  transition: transform 0.75s var(--ease-swiss), opacity 0.6s ease;
}

.ceiling-stage.is-shattered .ceiling-beam {
  transform: translateY(-110%);
  opacity: 0;
}

.tower-spire {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding-bottom: 18px;
}

.tower-code {
  font-family: var(--font-mono);
  font-size: 38px;
  font-weight: 800;
  letter-spacing: 0.28em;
  color: var(--accent);
  opacity: 0;
  transform: translateY(16px);
  transition: all 0.65s var(--ease-swiss);
}

.ceiling-stage.is-shattered .tower-code {
  opacity: 1;
  transform: translateY(0);
}

.tower-pillar {
  width: 84px;
  height: 74px;
  border: 2px solid var(--ink);
  border-bottom: none;
  display: flex;
  flex-direction: column;
  justify-content: space-evenly;
  padding: 0 12px;
}

.tower-pillar span {
  height: 2px;
  background: var(--border-strong);
}

/* ==========================================================================
   ROOM 05: INVISIBLE INK
   ========================================================================== */

.invisible-sheet {
  width: 100%;
  padding: 28px 20px;
  border: 1px dashed var(--border);
  text-align: center;
  user-select: text;
  -webkit-user-select: text;
  cursor: text;
}

.invisible-secret-line {
  font-family: var(--font-mono);
  font-size: clamp(30px, 5vw, 46px);
  font-weight: 700;
  letter-spacing: 0.34em;
  color: var(--surface);
  margin: 12px 0;
  line-height: 1.3;
  transition: color 0.3s ease;
}

.invisible-secret-sub {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.16em;
  color: var(--surface);
  margin: 0;
}

.invisible-secret-line::selection,
.invisible-secret-sub::selection {
  background: var(--accent);
  color: #ffffff;
}

.sheet-stamp {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.18em;
  color: var(--ink-muted);
  user-select: none;
}

/* ==========================================================================
   ROOM 06: THE ECHO (CLIPBOARD COPY/PASTE)
   ========================================================================== */

.echo-plaque {
  width: 100%;
  max-width: 440px;
  border: 1.5px solid var(--ink);
  background: var(--bg);
  padding: 24px 20px;
  text-align: center;
}

.echo-word {
  font-family: var(--font-mono);
  font-size: 42px;
  font-weight: 800;
  letter-spacing: 0.24em;
  margin: 10px 0 4px;
  user-select: text;
  -webkit-user-select: text;
  cursor: text;
}

.echo-receiver {
  margin-top: 20px;
  width: 100%;
  max-width: 440px;
  height: 52px;
  border: 1.5px dashed var(--border-strong);
  background: transparent;
  color: var(--ink);
  font-family: var(--font-mono);
  font-size: 13px;
  letter-spacing: 0.12em;
  text-align: center;
  outline: none;
  transition: border-color 0.2s ease, background-color 0.2s ease;
}

.echo-receiver:focus {
  border-color: var(--accent);
  border-style: solid;
  background: var(--bg);
}

/* ==========================================================================
   ROOM 07: SPECTRAL MODE
   ========================================================================== */

.spectral-frame {
  width: 100%;
  max-width: 440px;
  min-height: 215px;
  border: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 26px;
  position: relative;
  overflow: hidden;
}

.spectral-frame-label {
  position: absolute;
  top: 12px;
  left: 14px;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.14em;
  color: var(--ink-muted);
}

.ghost-entity {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  opacity: 0;
  transform: translateY(12px) scale(0.95);
  transition: opacity 0.8s var(--ease-swiss), transform 0.8s var(--ease-swiss);
  pointer-events: none;
}

.ghost-entity.is-manifested {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}

.ghost-svg {
  width: 68px;
  height: 82px;
  animation: ghostFloat 3.4s ease-in-out infinite;
}

@keyframes ghostFloat {
  0%, 100% { transform: translateY(0px); }
  50% { transform: translateY(-7px); }
}

.ghost-code {
  font-family: var(--font-mono);
  font-size: 26px;
  font-weight: 700;
  letter-spacing: 0.34em;
  color: var(--ink);
  text-shadow: var(--ghost-glow);
}

.spectral-empty-note {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.12em;
  color: var(--ink-muted);
  text-align: center;
  position: absolute;
  transition: opacity 0.45s ease;
}

.spectral-empty-note.is-hidden {
  opacity: 0;
  pointer-events: none;
}

/* ==========================================================================
   ROOM 08: DON'T LOOK (TAB VISIBILITY)
   ========================================================================== */

.watcher-stage {
  width: 100%;
  max-width: 520px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 28px;
}

.swiss-eye {
  width: 116px;
  height: 64px;
  border: 2px solid var(--ink);
  border-radius: 50%;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  background: var(--bg);
}

.swiss-eye.is-shocked {
  border-color: var(--accent);
}

.swiss-pupil {
  width: 24px;
  height: 24px;
  background: var(--ink);
  border-radius: 50%;
  position: relative;
  transition: transform 0.08s linear;
}

.swiss-pupil::after {
  content: "";
  position: absolute;
  top: 5px;
  left: 5px;
  width: 6px;
  height: 6px;
  background: var(--accent);
  border-radius: 50%;
}

.stealth-track {
  width: 100%;
  height: 36px;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  position: relative;
  display: flex;
  align-items: center;
}

.stealth-runner {
  position: absolute;
  left: 12px;
  width: 18px;
  height: 18px;
  background: var(--accent);
  transition: left 0.9s var(--ease-swiss);
}

.stealth-goal {
  position: absolute;
  right: 12px;
  width: 24px;
  height: 24px;
  border: 1.5px solid var(--ink);
}

.stealth-status {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.14em;
  color: var(--ink-muted);
}

/* ==========================================================================
   ROOM 09: THE OFFERING (FILE DRAG & DROP)
   ========================================================================== */

.offering-zone {
  width: 100%;
  max-width: 460px;
  min-height: 215px;
  border: 2px dashed var(--border-strong);
  background: var(--bg);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 28px 24px;
  gap: 14px;
  text-align: center;
  transition: all 0.25s var(--ease-swiss);
}

.offering-zone.is-dragover {
  border-color: var(--accent);
  border-style: solid;
  background: var(--accent-soft);
  transform: scale(1.015);
}

.offering-zone.is-exhibited {
  border-style: solid;
  border-color: var(--ink);
}

.offering-thumb {
  max-width: 180px;
  max-height: 110px;
  object-fit: cover;
  filter: grayscale(100%) contrast(1.1);
  border: 1px solid var(--ink);
}

.offering-glyph {
  width: 44px;
  height: 44px;
  border: 1.5px solid var(--ink);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-mono);
  font-size: 20px;
}

/* ==========================================================================
   ROOM 10: THE ADDRESS (URL PARAMETER)
   ========================================================================== */

.vault-blueprint {
  width: 100%;
  max-width: 480px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
}

.vault-door-frame {
  width: 200px;
  height: 150px;
  border: 2px solid var(--ink);
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--surface-subtle);
}

.vault-panel {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 50%;
  background: var(--ink);
  transition: transform 0.85s var(--ease-swiss);
  z-index: 2;
}

.vault-panel-left { left: 0; border-right: 1px solid var(--bg); }
.vault-panel-right { right: 0; border-left: 1px solid var(--bg); }

.vault-door-frame.is-open .vault-panel-left { transform: translateX(-100%); }
.vault-door-frame.is-open .vault-panel-right { transform: translateX(100%); }

.vault-interior {
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.2em;
  color: var(--accent);
}

.url-mirror-box {
  width: 100%;
  padding: 12px 16px;
  border: 1px solid var(--border);
  background: var(--bg);
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--ink-secondary);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  word-break: break-all;
}

.url-param-pill {
  padding: 3px 8px;
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 700;
  white-space: nowrap;
}

.url-param-pill.is-open {
  background: var(--ink);
  color: var(--bg);
}

/* ==========================================================================
   ROOM 11: PRINT PROOF & ROOM 12: FOURTH WALL
   ========================================================================== */

.print-preview-card {
  width: 100%;
  max-width: 400px;
  border: 1px solid var(--border);
  padding: 26px 22px;
  text-align: center;
  background: var(--bg);
}

.print-icon-grid {
  width: 54px;
  height: 66px;
  margin: 0 auto 14px;
  border: 1.5px solid var(--ink);
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 6px;
  padding: 10px;
}

.print-icon-line {
  height: 2px;
  background: var(--ink);
  opacity: 0.25;
}

.print-icon-line.accent {
  background: var(--accent);
  opacity: 1;
  width: 60%;
}

.monolith-box {
  width: 100%;
  max-width: 460px;
  border: 2px solid var(--ink);
  padding: 36px 28px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
  background: var(--bg);
  text-align: center;
}

.monolith-tag {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.2em;
  color: var(--accent);
}

.monolith-code-hint {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--ink-muted);
  padding: 8px 12px;
  border: 1px dashed var(--border);
}

/* ==========================================================================
   EXHIBITION CERTIFICATE & INDEX MODAL & HINT DRAWER
   ========================================================================== */

.cert-shell {
  width: 100%;
  max-width: 740px;
  border: 2px solid var(--ink);
  background: var(--surface);
  padding: 40px 36px;
  box-shadow: var(--shadow-card);
  animation: roomEnter 0.65s var(--ease-swiss) both;
}

.cert-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  border-bottom: 1px solid var(--border);
  padding-bottom: 20px;
  margin-bottom: 24px;
  gap: 16px;
}

.cert-seal {
  width: 58px;
  height: 58px;
  background: var(--accent);
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-mono);
  font-size: 14px;
  font-weight: 700;
  flex-shrink: 0;
}

.cert-blocks {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: 6px;
  margin-bottom: 24px;
}

.cert-block {
  height: 10px;
  background: var(--ink);
}

.cert-block.accent {
  background: var(--accent);
}

.cert-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin: 24px 0;
  padding: 20px 0;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}

.cert-stat-label {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.14em;
  color: var(--ink-muted);
  margin-bottom: 6px;
}

.cert-stat-val {
  font-family: var(--font-mono);
  font-size: 20px;
  font-weight: 700;
}

/* Side Drawer */
.drawer {
  position: fixed;
  top: 58px;
  right: 0;
  bottom: 48px;
  width: min(370px, 100vw);
  background: var(--surface);
  border-left: 1.5px solid var(--ink);
  z-index: 40;
  transform: translateX(100%);
  transition: transform 0.35s var(--ease-swiss);
  display: flex;
  flex-direction: column;
}

.drawer.is-open {
  transform: translateX(0);
}

.drawer-inner {
  display: flex;
  flex-direction: column;
  height: 100%;
  padding: 24px;
}

.drawer-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border);
}

.drawer-kicker {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.14em;
  color: var(--accent);
}

.icon-close-btn {
  background: none;
  border: none;
  color: var(--ink);
  font-size: 16px;
  cursor: pointer;
  padding: 4px 8px;
}

.drawer-body {
  flex: 1;
  overflow-y: auto;
  padding: 20px 0;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.hint-card {
  padding: 14px 16px;
  border: 1px solid var(--border);
  background: var(--bg);
  animation: roomEnter 0.3s var(--ease-swiss) both;
}

.hint-card-level {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.14em;
  color: var(--accent);
  margin-bottom: 6px;
}

.hint-card-body {
  margin: 0;
  font-size: 13px;
  line-height: 1.65;
  color: var(--ink-secondary);
}

.drawer-foot {
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

.drawer-foot .swiss-btn {
  width: 100%;
}

/* Exhibition Index Modal */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(10, 10, 12, 0.55);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.28s ease;
}

.modal-backdrop.is-open {
  opacity: 1;
  pointer-events: auto;
}

.modal-panel {
  width: 100%;
  max-width: 780px;
  max-height: 85vh;
  overflow-y: auto;
  background: var(--surface);
  border: 2px solid var(--ink);
  padding: 28px;
  box-shadow: var(--shadow-card);
}

.index-grid {
  display: flex;
  flex-direction: column;
  gap: 22px;
  margin-top: 20px;
}

.index-act-heading {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.18em;
  color: var(--ink-muted);
  margin-bottom: 10px;
}

.index-cards-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
}

.index-card {
  border: 1px solid var(--border);
  background: var(--bg);
  padding: 14px 12px;
  text-align: left;
  cursor: pointer;
  color: var(--ink);
  display: flex;
  flex-direction: column;
  gap: 6px;
  transition: all 0.2s var(--ease-swiss);
  position: relative;
}

.index-card:hover:not(:disabled) {
  border-color: var(--ink);
  transform: translateY(-2px);
}

.index-card.is-active {
  border-color: var(--accent);
}

.index-card.is-solved::after {
  content: "■";
  position: absolute;
  top: 10px;
  right: 10px;
  font-size: 8px;
  color: var(--accent);
}

.index-card:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.index-card-num {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--ink-muted);
}

.index-card-title {
  font-size: 14px;
  font-weight: 700;
}

.index-card-en {
  font-family: var(--font-mono);
  font-size: 9px;
  color: var(--ink-muted);
}

/* Toast */
.toast {
  position: fixed;
  bottom: 64px;
  left: 50%;
  transform: translateX(-50%) translateY(14px);
  background: var(--ink);
  color: var(--bg);
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.08em;
  padding: 10px 18px;
  opacity: 0;
  pointer-events: none;
  transition: all 0.3s var(--ease-swiss);
  z-index: 70;
}

.toast.is-visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ==========================================================================
   PRINT MEDIA (ROOM 11)
   ========================================================================== */

.print-only {
  display: none;
}

@media print {
  body {
    background: #ffffff !important;
    color: #111111 !important;
  }

  .app-shell,
  .swiss-grid-bg,
  .paper-grain,
  .fx-canvas,
  .drawer,
  .modal-backdrop,
  .toast,
  .zoom-outer-reveal {
    display: none !important;
  }

  .print-only {
    display: flex !important;
    align-items: center;
    justify-content: center;
    min-height: 92vh;
    padding: 36px;
  }

  .print-frame {
    width: 100%;
    max-width: 640px;
    border: 3px solid #111111;
    padding: 40px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    min-height: 560px;
  }

  .print-header,
  .print-footer {
    display: flex;
    justify-content: space-between;
    font-family: var(--font-mono);
    font-size: 11px;
    letter-spacing: 0.14em;
    color: #555555;
  }

  .print-body {
    text-align: center;
    padding: 48px 0;
  }

  .print-kicker {
    font-family: var(--font-mono);
    font-size: 12px;
    letter-spacing: 0.2em;
    color: #e30613;
    margin-bottom: 18px;
  }

  .print-code {
    font-family: var(--font-mono);
    font-size: 92px;
    font-weight: 800;
    letter-spacing: 0.22em;
    color: #111111;
    border-top: 2px solid #111111;
    border-bottom: 2px solid #111111;
    padding: 20px 0;
    margin: 0 0 28px;
  }

  .print-caption {
    font-size: 14px;
    line-height: 1.8;
    color: #333333;
  }
}

/* ==========================================================================
   RESPONSIVE REFINEMENTS
   ========================================================================== */

@media (max-width: 820px) {
  .stage-frame {
    grid-template-columns: minmax(0, 1fr);
  }

  .arch-ruler {
    display: none;
  }

  .brand-sub {
    display: none;
  }

  .cover-hero-row {
    grid-template-columns: 1fr;
  }

  .cover-emblem {
    display: none;
  }

  .cover-grid {
    grid-template-columns: 1fr;
  }

  .cover-specs {
    border-left: none;
    border-top: 1px solid var(--border);
    padding-left: 0;
    padding-top: 16px;
  }

  .index-cards-row {
    grid-template-columns: repeat(2, 1fr);
  }

  .cert-stats {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 640px) {
  .top-bar,
  .bottom-bar {
    padding: 0 14px;
  }

  .room-progress-nav {
    display: none;
  }

  .gallery-canvas {
    padding: 26px 16px;
  }

  .stage {
    padding: 20px 14px;
  }
}
