@font-face {
  font-family: "CalligraphyZH";
  src: url("./vendor/fonts/calligraphy-zh.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: block;
}

@font-face {
  font-family: "CalligraphyEN";
  src: url("./vendor/fonts/calligraphy-en.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: block;
}

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

html,
body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #02050d;
  color: #e2f1ff;
  user-select: none;
  -webkit-user-select: none;
  touch-action: none;
  font-family: "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
}

#webgl-stage {
  position: fixed;
  inset: 0;
  z-index: 1;
}

#webgl-stage canvas {
  display: block;
}

/* Subtle cinema theater radial vignette deepening peripheral black level */
#cinema-vignette {
  position: fixed;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  background: radial-gradient(
    ellipse at 50% 48%,
    rgba(2, 5, 13, 0.0) 54%,
    rgba(1, 3, 9, 0.42) 100%
  );
}

/* Soft dark bottom atmosphere gradient ensuring C3 calligraphy reads crisply over mirror water & glowing roses */
#bottom-vignette {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  height: 22vh;
  z-index: 2;
  pointer-events: none;
  background: linear-gradient(
    to top,
    rgba(2, 5, 13, 0.72) 0%,
    rgba(2, 5, 13, 0.36) 46%,
    rgba(2, 5, 13, 0.0) 100%
  );
}

body.is-portrait #bottom-vignette {
  height: 31vh;
  background: linear-gradient(
    to top,
    rgba(3, 7, 18, 0.84) 0%,
    rgba(4, 9, 23, 0.56) 54%,
    rgba(4, 9, 23, 0.0) 100%
  );
}

/* Left-side softly scrolling translucent Python romance code */
#code-overlay {
  position: fixed;
  top: 6.5vh;
  left: 2.2vw;
  width: 28vw;
  max-width: 460px;
  height: 68vh;
  overflow: hidden;
  z-index: 3;
  pointer-events: none;
  opacity: 0.32;
  transition: opacity 0.45s ease;
  -webkit-mask-image: linear-gradient(
    to bottom,
    transparent 0%,
    rgba(0, 0, 0, 1) 12%,
    rgba(0, 0, 0, 1) 82%,
    transparent 100%
  );
  mask-image: linear-gradient(
    to bottom,
    transparent 0%,
    rgba(0, 0, 0, 1) 12%,
    rgba(0, 0, 0, 1) 82%,
    transparent 100%
  );
}

#code-overlay.is-dim-hidden {
  opacity: 0;
}

#code-scroll-inner {
  padding: 28px 0 44px 0;
  font-family: "Cascadia Code", "JetBrains Mono", "Consolas", "Courier New", monospace;
  font-size: clamp(10px, 0.78vw, 13px);
  line-height: 1.62;
  white-space: pre;
  color: rgba(186, 224, 255, 0.92);
  text-shadow: 0 0 10px rgba(96, 165, 250, 0.28);
  will-change: transform;
}

.py-comment {
  color: rgba(148, 197, 240, 0.86);
  font-style: italic;
}

.py-kw {
  color: rgba(192, 168, 255, 0.96);
}

.py-fn {
  color: rgba(125, 211, 252, 0.98);
}

.py-string {
  color: rgba(167, 243, 208, 0.95);
}

.py-love {
  color: rgba(251, 207, 232, 0.98);
  text-shadow: 0 0 12px rgba(216, 180, 254, 0.55);
}

/* Portrait adaptation: place dimmed code safely below HUD controls so zero overlap occurs on mobile */
body.is-portrait #code-overlay {
  top: max(58px, calc(env(safe-area-inset-top, 16px) + 42px));
  left: 3.5vw;
  width: 74vw;
  max-width: 440px;
  height: 23vh;
  opacity: 0.16;
}

body.capture-mode.is-portrait #code-overlay {
  top: 24px;
}

body.is-portrait #code-scroll-inner {
  font-size: clamp(8.5px, 2.25vw, 11.5px);
  line-height: 1.48;
}

#text-morph-canvas {
  position: fixed;
  inset: 0;
  z-index: 4;
  pointer-events: none;
  display: block;
}

/* Minimal romantic tap-to-start veil */
#entry-veil {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  background: radial-gradient(
    circle at 50% 48%,
    rgba(8, 18, 42, 0.56) 0%,
    rgba(3, 7, 18, 0.82) 100%
  );
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
  transition: opacity 0.85s ease, visibility 0.85s ease;
}

#entry-veil.is-hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.entry-card {
  text-align: center;
  padding: 28px 42px;
  border-radius: 20px;
  background: rgba(10, 22, 48, 0.42);
  border: 1px solid rgba(165, 220, 255, 0.28);
  box-shadow: 0 0 42px rgba(56, 189, 248, 0.22);
}

.entry-star {
  font-size: 34px;
  color: #fbcfe8;
  text-shadow: 0 0 18px rgba(216, 180, 254, 0.85), 0 0 36px rgba(125, 211, 252, 0.65);
  margin-bottom: 12px;
  animation: gentlePulse 2.4s ease-in-out infinite;
}

.entry-title {
  font-family: "CalligraphyZH", "STXingkai", "KaiTi", serif;
  font-size: clamp(28px, 4.2vw, 44px);
  letter-spacing: 0.12em;
  color: #f8fbff;
  text-shadow: 0 0 18px rgba(147, 215, 255, 0.72);
}

.entry-sub {
  margin-top: 10px;
  font-size: 13px;
  letter-spacing: 0.26em;
  color: rgba(186, 230, 253, 0.78);
}

@keyframes gentlePulse {
  0%,
  100% {
    transform: scale(1);
    opacity: 0.88;
  }
  50% {
    transform: scale(1.16);
    opacity: 1;
  }
}

/* Unobtrusive minimal corner controls */
#hud-controls {
  position: fixed;
  top: max(16px, env(safe-area-inset-top, 16px));
  right: max(16px, env(safe-area-inset-right, 16px));
  z-index: 10;
  display: flex;
  gap: 8px;
  opacity: 0.56;
  transition: opacity 0.25s ease;
}

#hud-controls:hover {
  opacity: 1;
}

#hud-controls button {
  background: rgba(8, 19, 44, 0.52);
  color: rgba(224, 242, 254, 0.92);
  border: 1px solid rgba(147, 210, 255, 0.26);
  border-radius: 999px;
  padding: 6px 13px;
  font-size: 12px;
  letter-spacing: 0.08em;
  cursor: pointer;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  transition: background 0.2s ease, border-color 0.2s ease;
}

#hud-controls button:hover {
  background: rgba(28, 62, 118, 0.68);
  border-color: rgba(186, 230, 253, 0.58);
}

/* Deterministic capture mode: strictly hide all web UI overlays & buttons */
body.capture-mode #entry-veil,
body.capture-mode #hud-controls {
  display: none !important;
}
