/* ==========================================================================
   KUROKAMI — OCCULT-MANGA INK & WATER DESIGN SYSTEM
   Distinctive, Hand-Inked, Monochrome Woodcut / Xerox Aesthetic
   ========================================================================== */

:root {
  /* Light Mode Palette: Bone Washi Paper & Jet Carbon Ink */
  --bg-color: #f4f1ea;
  --bg-translucent: rgba(244, 241, 234, 0.88);
  --ink-solid: #0d0c0b;
  --ink-secondary: #242220;
  --ink-wash: rgba(13, 12, 11, 0.45);
  --ink-ghost: rgba(13, 12, 11, 0.12);
  --cloud-ink: rgba(13, 12, 11, 0.32);
  --cloud-shadow: rgba(13, 12, 11, 0.08);
  --grain-opacity: 0.14;
  --font-display: 'Cinzel', serif;
  --font-kanji: 'Shippori Mincho', serif;
  --transition-mode: 0.9s cubic-bezier(0.16, 1, 0.3, 1);

  /* =========================================================================
     1. EMAIL CONTACT CAT BUTTON (Right Bottom of the Screen)
     Adjust the position and size of the floating contact cat here:
     ========================================================================= */
  --cat-size: clamp(76px, 6vw, 92px);                 /* Desktop cat button diameter */
  --cat-size-mobile: clamp(56px, 14vw, 72px);          /* Mobile cat button diameter */
  --cat-right: clamp(1.2rem, 3.2vw, 2.5rem);          /* Distance from right screen edge */
  --cat-bottom: clamp(1.2rem, 3.2vh, 2.4rem);         /* Distance from bottom screen edge */

  /* Backwards compatibility aliases */
  --owl-size: var(--cat-size);
  --owl-size-mobile: var(--cat-size-mobile);

  /* =========================================================================
     2. NAVIGATION DOCK (Inner Window of the Frame)
     ========================================================================= */
  --nav-dock-x: 50%;
  --nav-dock-y: 47%;
  --nav-dock-width: 78%;
  --nav-dock-height: 40%;

  --nav-dock-x-mobile: 50%;
  --nav-dock-y-mobile: 47%;
  --nav-dock-width-mobile: 78%;
  --nav-dock-height-mobile: 40%;

  /* =========================================================================
     3. PORTAL LINKS (table of contents inside the frame)
     ========================================================================= */
  /* Sized from the frame's width (cqw) so the row always sits between the vines */
  --nav-font: 'Almendra SC', 'Cinzel', serif;
  --nav-size: 3.8cqw;
  --nav-weight: 400;
  --nav-tracking: 0.04em;
  --nav-gap: 0.85em;
  --nav-mono: 'JetBrains Mono', ui-monospace, 'Cascadia Mono', monospace;
}

body.theme-dark {
  /* Dark Mode Palette: Abyssal Obsidian & Bleached Bone Luminescence */
  --bg-color: #060607;
  --bg-translucent: rgba(6, 6, 7, 0.88);
  --ink-solid: #ede8dc;
  --ink-secondary: #c8c2b5;
  --ink-wash: rgba(237, 232, 220, 0.5);
  --ink-ghost: rgba(237, 232, 220, 0.12);
  --cloud-ink: rgba(237, 232, 220, 0.36);
  --cloud-shadow: rgba(237, 232, 220, 0.12);
  --grain-opacity: 0.22;
}

/* Reset & Global Canvas Setup */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

html,
body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  overscroll-behavior: none; /* prevent rubber-band bounce stealing touch events on mobile */
  background-color: var(--bg-color);
  color: var(--ink-solid);
  font-family: var(--font-display);
  transition: background-color var(--transition-mode), color var(--transition-mode);
  user-select: none;
  /* Custom ink-dot cursor: small filled circle with contrasting halo ring — visible on both themes */
  cursor: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24'%3E%3Ccircle cx='12' cy='12' r='5' fill='%230d0c0b' fill-opacity='0.7' stroke='%23f4f1ea' stroke-width='1.5' stroke-opacity='0.85'/%3E%3Ccircle cx='12' cy='12' r='1.5' fill='%23f4f1ea' fill-opacity='0.9'/%3E%3C/svg%3E") 12 12, default;
}

/* Hidden SVG Filters Container */
.svg-filters {
  position: absolute;
  width: 0;
  height: 0;
  pointer-events: none;
}

/* Visually Hidden Utility (accessible to search engines & screen readers) */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border-width: 0;
}

/* Canvas Layers */
canvas {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: block;
}

#canvas-water {
  z-index: 1;
  pointer-events: none;
  opacity: 0.85;
}

#canvas-ripples {
  z-index: 2;
  pointer-events: none;
}

#canvas-wind {
  z-index: 3;
  pointer-events: none;
}

#canvas-particles {
  z-index: 5;
  pointer-events: none;
}

/* Dynamic Xerox / Woodcut Grain Overlay */
.grain-overlay {
  position: fixed;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  z-index: 15;
  pointer-events: none;
  filter: url(#grain-filter);
  opacity: var(--grain-opacity);
  animation: grainShift 0.7s steps(4) infinite;
  mix-blend-mode: multiply;
}

body.theme-dark .grain-overlay {
  mix-blend-mode: screen;
}

@keyframes grainShift {
  0% {
    transform: translate(0, 0);
  }

  25% {
    transform: translate(-3%, -4%);
  }

  50% {
    transform: translate(2%, 3%);
  }

  75% {
    transform: translate(-4%, 2%);
  }

  100% {
    transform: translate(0, 0);
  }
}

/* ==========================================================================
   INTRICATE INK CLOUDS VIEWPORT (Reacts to Click Wind Effects!)
   ========================================================================== */

.clouds-viewport {
  position: fixed;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  overflow: hidden;
}

.cloud-layer {
  position: absolute;
  will-change: transform;
  pointer-events: none;
  transition: filter var(--transition-mode);
}

.cloud-layer svg {
  width: 100%;
  height: 100%;
  display: block;
  overflow: visible;
}

.cloud-ink-path {
  fill: var(--cloud-ink);
  stroke: none;
  stroke-width: 0;
  transition: fill var(--transition-mode);
}

/* Light mode cloud aesthetic */
body.theme-light .cloud-layer svg {
  filter: drop-shadow(0 15px 30px var(--cloud-shadow));
}

/* Dark mode cloud aesthetic: glowing occult lunar mist */
body.theme-dark .cloud-layer svg {
  filter: drop-shadow(0 0 24px var(--cloud-shadow)) drop-shadow(0 0 50px rgba(237, 232, 220, 0.08));
}

/* ==========================================================================
   NON-INTERACTABLE DIAGONAL DRAGON FLOCK (Bottom-Left to Top-Right)
   ========================================================================== */

.dragon-flock-viewport {
  position: fixed;
  inset: 0;
  z-index: 4;
  pointer-events: none !important;
  overflow: hidden;
}

.flock-dragon {
  position: absolute;
  width: 320px;
  height: 320px;
  pointer-events: none !important;
  user-select: none;
  will-change: transform;
  transform-origin: 50% 50%;
}

.flock-dragon svg {
  width: 100%;
  height: 100%;
  display: block;
  overflow: visible;
}

.flock-dragon .dragon-ink-path {
  fill: var(--ink-solid);
  stroke: var(--ink-solid);
  stroke-width: 0.35px;
  transition: fill var(--transition-mode), stroke var(--transition-mode);
}

/* Light mode dragon glow */
body.theme-light .flock-dragon svg {
  filter: drop-shadow(0 6px 14px rgba(13, 12, 11, 0.15));
}

/* Dark mode dragon ethereal white glow */
body.theme-dark .flock-dragon svg {
  filter: drop-shadow(0 0 14px rgba(237, 232, 220, 0.45)) drop-shadow(0 0 32px rgba(237, 232, 220, 0.18));
}

/* ==========================================================================
   MINIMALIST UI CONTROLS (Top Corners)
   ========================================================================== */

.interface-header {
  position: fixed;
  top: 2rem;
  left: 2rem;
  right: 2rem;
  display: flex;
  align-items: center;
  z-index: 1000;
  /* Top-most layer */
  pointer-events: none;
}

body.theme-light .interface-header {
  justify-content: flex-start;
}

body.theme-dark .interface-header {
  justify-content: flex-end;
}

.glyph-btn {
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 0.65rem;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--ink-solid);
  pointer-events: auto !important;
  /* Fully interactive and pressable */
  z-index: 1001;
  border-radius: 50%;
  transition: transform 0.4s ease, color var(--transition-mode), background-color 0.3s ease;
}

.glyph-btn:hover {
  transform: scale(1.2) rotate(8deg);
  background-color: var(--dock-plate);
}

.glyph-btn:active {
  transform: scale(0.92);
}


.toggle-glyph {
  width: 32px;
  height: 32px;
  fill: none;
  stroke: var(--ink-solid);
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.glyph-crescent {
  fill: var(--ink-solid);
  transition: transform 0.6s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.glyph-core {
  fill: var(--ink-solid);
}

.audio-glyph .audio-wave {
  opacity: 0.5;
  transition: opacity 0.3s;
}

.audio-glyph.active .wave-1 {
  animation: audioPulse 1.2s ease-in-out infinite;
}

.audio-glyph.active .wave-2 {
  animation: audioPulse 1.2s ease-in-out infinite 0.4s;
}

@keyframes audioPulse {

  0%,
  100% {
    opacity: 0.3;
    stroke-width: 1.2;
  }

  50% {
    opacity: 1;
    stroke-width: 2.2;
  }
}

/* ==========================================================================
   CENTERPIECE: BREATHING OCCULT TITLE
   ========================================================================== */

.centerpiece-stage {
  position: absolute;
  inset: 0;
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 10;
  pointer-events: none;
}

.title-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 0.8rem;
  will-change: transform, opacity;
  animation: breathCycle 8s ease-in-out infinite;
}

@keyframes breathCycle {

  0%,
  100% {
    transform: scale(1);
    opacity: 0.92;
    /* letter-spacing removed — animating it triggers full text layout recalculation
       every frame on mobile (expensive). transform+opacity are GPU-composited only. */
  }

  50% {
    transform: scale(1.04);
    opacity: 1;
  }
}

.kanji-glyph {
  font-family: var(--font-kanji);
  font-size: clamp(2rem, 4.5vw, 4rem);
  font-weight: 700;
  color: var(--ink-solid);
  letter-spacing: 0.4em;
  text-indent: 0.4em;
  line-height: 1;
  text-shadow: 0 0 1px var(--ink-solid);
  transition: color var(--transition-mode);
}

.glyph-char {
  display: inline-block;
  transition: transform 0.5s ease;
}

.title-alphabet {
  font-size: clamp(0.95rem, 1.8vw, 1.4rem);
  font-weight: 400;
  text-transform: uppercase;
  color: var(--ink-solid);
  letter-spacing: 0.45em;
  text-indent: 0.45em;
  opacity: 0.9;
  transition: color var(--transition-mode);
}

.title-axis-line {
  width: 42px;
  height: 1.5px;
  background-color: var(--ink-solid);
  margin-top: 0.4rem;
  opacity: 0.5;
  transition: width 0.6s ease, background-color var(--transition-mode);
}

/* Centerpiece Title: "VOID" (虚空) in Dark Mode / "HOPE" (希望) in Light Mode */
body.theme-dark .title-void,
body.theme-dark .kanji-void {
  display: inline-block;
}

body.theme-dark .title-hope,
body.theme-dark .kanji-hope {
  display: none !important;
}

body.theme-light .title-void,
body.theme-light .kanji-void {
  display: none !important;
}

body.theme-light .title-hope,
body.theme-light .kanji-hope {
  display: inline-block;
}


/* ==========================================================================
   SINGLE CORNER CELESTIAL BODY (Sun in Light Mode / Moon in Dark Mode)
   Positioned on the edge/corner towards which the dragons fly
   ========================================================================== */

.celestial-corner {
  position: fixed;
  z-index: 30;
  pointer-events: auto;
  cursor: pointer;
  user-select: none;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  padding: 0;
  margin: 0;
  outline: none;
  -webkit-appearance: none;
  transition: top 1.2s cubic-bezier(0.16, 1, 0.3, 1),
    left 1.2s cubic-bezier(0.16, 1, 0.3, 1),
    right 1.2s cubic-bezier(0.16, 1, 0.3, 1),
    width 1.2s cubic-bezier(0.16, 1, 0.3, 1),
    height 1.2s cubic-bezier(0.16, 1, 0.3, 1),
    opacity 0.6s ease;
}

.celestial-corner:focus-visible {
  outline: 2px dashed var(--ink-solid);
  outline-offset: 8px;
  border-radius: 50%;
}

/* Light mode: Sun at Top-Right Corner (Dragons fly towards top-right) */
body.theme-light .celestial-corner {
  top: clamp(1rem, 3vw, 2.2rem);
  right: clamp(3.5rem, 5vw, 5.5rem);
  left: auto;
  bottom: auto;
  width: clamp(110px, 14vw, 175px);
  height: clamp(98px, 12.5vw, 155px);
  animation: celestialBreatheSun 8s ease-in-out infinite alternate;
}

/* Dark mode: Moon at Top-Left Corner (Dragons fly towards top-left) */
body.theme-dark .celestial-corner {
  top: clamp(1rem, 3vw, 2.2rem);
  left: clamp(3.5rem, 5vw, 5.5rem);
  right: auto;
  bottom: auto;
  width: clamp(90px, 11vw, 145px);
  height: clamp(75px, 9vw, 120px);
  animation: celestialBreatheMoon 9s ease-in-out infinite alternate;
}

.celestial-vector {
  width: 100%;
  height: 100%;
  display: block;
  overflow: visible;
  transition: transform 0.35s cubic-bezier(0.2, 0.8, 0.2, 1), filter var(--transition-mode);
}

.celestial-corner:hover .celestial-vector {
  transform: scale(1.1);
}

.celestial-corner:active .celestial-vector {
  transform: scale(0.92);
  transition: transform 0.12s ease;
}

body.theme-light .celestial-vector {
  filter: drop-shadow(0 0 25px rgba(13, 12, 11, 0.12)) drop-shadow(0 0 50px rgba(13, 12, 11, 0.06));
}

body.theme-light .celestial-corner:hover .celestial-vector {
  filter: drop-shadow(0 0 35px rgba(13, 12, 11, 0.28)) drop-shadow(0 0 70px rgba(13, 12, 11, 0.16));
}

body.theme-dark .celestial-vector {
  filter: drop-shadow(0 0 28px rgba(237, 232, 220, 0.3)) drop-shadow(0 0 60px rgba(237, 232, 220, 0.15));
}

body.theme-dark .celestial-corner:hover .celestial-vector {
  filter: drop-shadow(0 0 40px rgba(237, 232, 220, 0.7)) drop-shadow(0 0 80px rgba(237, 232, 220, 0.35));
}

.celestial-path,
.celestial-ink-path {
  fill: var(--ink-solid);
  stroke: var(--ink-solid);
  stroke-width: 0.25px;
  transition: fill var(--transition-mode), stroke var(--transition-mode);
}

@keyframes celestialBreatheSun {
  0% {
    transform: scale(1) rotate(0deg);
  }

  50% {
    transform: scale(1.04) rotate(1.5deg);
  }

  100% {
    transform: scale(0.98) rotate(-1deg);
  }
}

@keyframes celestialBreatheMoon {
  0% {
    transform: scale(1) translateY(0);
  }

  50% {
    transform: scale(1.05) translateY(-3px);
  }

  100% {
    transform: scale(0.97) translateY(2px);
  }
}

/* ==========================================================================
   BOTTOM NAVIGATION WITH BRANCH FRAME & PERCHED OWL/CLOUD
   Uses navigation-bottom.svg frame instead of the floating dock pane
   Widened and grouped with container queries to scale on all viewports
   ========================================================================== */

.navigation-dock-container {
  position: fixed;
  bottom: clamp(0.4rem, 1.8vh, 1.2rem);
  left: 50%;
  transform: translateX(-50%);
  width: clamp(400px, 44vw, 580px);
  max-width: 95vw;
  max-height: 35vh;
  z-index: 25;
  pointer-events: none;
}

/* On mobile, scale cleanly to screen width without overflow */
@media (max-width: 768px) {
  .navigation-dock-container {
    width: clamp(285px, 88vw, 410px);
    max-width: 96vw;
    bottom: calc(0.3rem + 8px);
  }
}

.navigation-dock-stage {
  position: relative;
  width: 100%;
  aspect-ratio: 640 / 330;
  container-type: inline-size;
  container-name: navstage;
}

.navigation-branch-svg {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  pointer-events: none;
  user-select: none;
  -webkit-user-drag: none;
  transition: filter var(--transition-mode);
}

/* In Dark mode, invert black ink paths to glowing bone-white ink */
body.theme-dark .navigation-branch-svg {
  filter: invert(0.93) sepia(0.12) brightness(0.96) drop-shadow(0 0 14px rgba(237, 232, 220, 0.25));
}

/* In Light mode, keep crisp jet-carbon ink on bone washi paper */
body.theme-light .navigation-branch-svg {
  filter: drop-shadow(0 4px 12px rgba(0, 0, 0, 0.12));
}

/* Links: written across the frame's inner window, ink diamonds between them */
.navigation-dock {
  position: absolute;
  top: var(--nav-dock-y, 50%);
  left: var(--nav-dock-x, 50%);
  transform: translate(-50%, -50%);
  width: var(--nav-dock-width, 78%);
  height: var(--nav-dock-height, 46%);
  z-index: 5;
  pointer-events: auto;
  display: flex;
  align-items: center;
  justify-content: center;
}

.nav-link {
  position: relative;
  padding: 0.35em var(--nav-gap);
  color: var(--ink-solid);
  text-decoration: none;
  font-family: var(--nav-font);
  font-size: var(--nav-size);
  font-weight: var(--nav-weight);
  letter-spacing: var(--nav-tracking);
  line-height: 1;
  white-space: nowrap;
  /* Halo in the paper colour lifts the words off the clouds behind the frame */
  text-shadow: 0 0 4px var(--bg-color), 0 0 10px var(--bg-color), 0 0 18px var(--bg-color);
  transition: color var(--transition-mode), opacity 0.3s ease;
}

/* Ink diamond between neighbours */
.nav-link + .nav-link::before {
  content: '';
  position: absolute;
  left: 0;
  top: 50%;
  width: 0.22em;
  height: 0.22em;
  background: var(--ink-solid);
  opacity: 0.55;
  transform: translate(-50%, -50%) rotate(45deg);
}

/* Brush underline drawn out from the centre on hover */
.nav-link::after {
  content: '';
  position: absolute;
  left: var(--nav-gap);
  right: var(--nav-gap);
  bottom: 0.08em;
  height: 1px;
  background: var(--ink-solid);
  transform: scaleX(0);
  transition: transform 0.4s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.navigation-dock:hover .nav-link {
  opacity: 0.55;
}

.navigation-dock .nav-link:hover,
.navigation-dock .nav-link:focus-visible {
  opacity: 1;
}

.nav-link:hover::after,
.nav-link:focus-visible::after {
  transform: scaleX(1);
}

.nav-link:focus-visible {
  outline: none;
}

/* ==========================================================================
   MODAL CODEX PLATES
   ========================================================================== */

.sigil-modal {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.5s ease;
}

.sigil-modal.active {
  pointer-events: auto;
  opacity: 1;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: var(--bg-translucent);
  backdrop-filter: blur(6px);
}

.modal-plate {
  position: relative;
  width: min(90vw, 420px);
  padding: 3.5rem 2.5rem;
  background: var(--bg-color);
  border: 1px solid var(--ink-solid);
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.2);
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  transform: scale(0.92);
  transition: transform 0.5s cubic-bezier(0.16, 1, 0.3, 1), background-color var(--transition-mode);
}

.sigil-modal.active .modal-plate {
  transform: scale(1);
}

.modal-close {
  position: absolute;
  top: 1.2rem;
  right: 1.2rem;
  background: transparent;
  border: none;
  font-size: 1.2rem;
  color: var(--ink-solid);
  cursor: pointer;
  padding: 0.5rem;
}

.plate-title {
  font-size: 1.1rem;
  letter-spacing: 0.35em;
  text-transform: uppercase;
  margin-bottom: 2rem;
  color: var(--ink-solid);
}

.blinking-eye-stage {
  position: relative;
  width: min(85vw, 360px);
  height: 220px;
  margin: 0 auto 1.5rem auto;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  border-radius: 4px;
  background: radial-gradient(circle at 50% 50%, rgba(13, 12, 11, 0.05) 0%, transparent 70%);
}

body.theme-dark .blinking-eye-stage {
  background: radial-gradient(circle at 50% 50%, rgba(237, 232, 220, 0.07) 0%, transparent 70%);
}

.eye-wrapper {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--ink-solid);
  animation: eyeBlink 3.6s ease-in-out infinite, eyeDrift 7s ease-in-out infinite alternate;
  will-change: transform, opacity;
  transform-origin: 50% 50%;
}

.eye-wrapper svg {
  width: 100%;
  height: 100%;
  display: block;
  filter: drop-shadow(0 4px 12px rgba(0, 0, 0, 0.18));
}

body.theme-dark .eye-wrapper svg {
  filter: drop-shadow(0 0 16px rgba(237, 232, 220, 0.45)) drop-shadow(0 0 35px rgba(237, 232, 220, 0.2));
}

/* Saccadic looking around & subtle pupil dilation / drift */
@keyframes eyeDrift {
  0% {
    transform: translate(0px, 0px) scale(1);
  }

  20% {
    transform: translate(-6px, -3px) scale(1.02);
  }

  45% {
    transform: translate(8px, 4px) scale(0.98);
  }

  70% {
    transform: translate(-4px, 5px) scale(1.03);
  }

  90% {
    transform: translate(5px, -4px) scale(0.99);
  }

  100% {
    transform: translate(0px, 0px) scale(1);
  }
}

/* Realistic periodic blinking lid animation */
@keyframes eyeBlink {

  0%,
  42%,
  48%,
  92%,
  98%,
  100% {
    transform: scaleY(1);
  }

  45% {
    transform: scaleY(0.04);
  }

  95% {
    transform: scaleY(0.04);
  }
}

.modal-text {
  font-family: var(--font-body);
  font-size: 0.9rem;
  line-height: 1.6;
  max-width: 320px;
  color: var(--ink-solid);
  opacity: 0.85;
  margin-top: 1rem;
}

.plate-kanji {
  font-family: var(--font-kanji);
  font-size: 2.2rem;
  letter-spacing: 0.2em;
  text-indent: 0.2em;
  color: var(--ink-solid);
}

/* ==========================================================================
   EMAIL CONTACT WIDGET (Fixed at Right Bottom of the Screen)
   ========================================================================== */

.email-contact-widget {
  position: fixed;
  right: var(--cat-right, clamp(1.2rem, 3.2vw, 2.5rem));
  bottom: var(--cat-bottom, clamp(1.2rem, 3.2vh, 2.4rem));
  z-index: 100;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  pointer-events: none;
}

.email-btn {
  pointer-events: auto !important;
  cursor: pointer;
  width: var(--cat-size, 76px);
  height: var(--cat-size, 76px);
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  box-shadow: none;
  padding: 0;
  margin: 0;
  outline: none;
  -webkit-appearance: none;
  transition: transform 0.35s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.email-btn:hover {
  transform: scale(1.12) translateY(-3px);
}

.email-btn:active {
  transform: scale(0.94);
}

.email-icon {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
  user-select: none;
  -webkit-user-drag: none;
  transition: transform 0.35s ease, filter 0.35s ease;
}

/* Contact Cat in Dark Mode (Bone-white / Ivory with luminous lunar glow) */
body.theme-dark .email-icon.icon-cat {
  display: block;
  filter: drop-shadow(0 0 10px rgba(253, 253, 253, 0.75)) drop-shadow(0 0 24px rgba(253, 253, 253, 0.35));
}

body.theme-dark .email-btn:hover .email-icon.icon-cat {
  filter: drop-shadow(0 0 16px rgba(253, 253, 253, 0.95)) drop-shadow(0 0 32px rgba(253, 253, 253, 0.55));
}

/* Contact Cat in Light Mode (Inverted to Jet-Carbon Ink on Bone Washi) */
body.theme-light .email-icon.icon-cat {
  display: block;
  filter: invert(0.92) sepia(0.08) brightness(0.9) drop-shadow(0 4px 10px rgba(0, 0, 0, 0.25));
}

body.theme-light .email-btn:hover .email-icon.icon-cat {
  filter: invert(0.92) sepia(0.08) brightness(0.78) drop-shadow(0 6px 16px rgba(0, 0, 0, 0.38));
}

/* Popup message anchored directly above the cat button at bottom-right */
.email-popup {
  position: absolute;
  bottom: calc(100% + 12px);
  right: 0;
  transform: translateY(8px) scale(0.96);
  transform-origin: bottom right;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.25s cubic-bezier(0.16, 1, 0.3, 1),
    transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  white-space: nowrap;
}

.email-popup.active {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0) scale(1);
}

/* The card: a small ink-framed scroll with a misty cloud wash, in the nav's font */
.email-popup-content {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.3rem;
  padding: 0.85rem 1.4rem 0.7rem;
  color: var(--ink-solid);
  font-family: var(--nav-font);
  background:
    radial-gradient(ellipse 60% 70% at 0% 100%, var(--ink-ghost), transparent 70%),
    radial-gradient(ellipse 55% 65% at 100% 0%, var(--ink-ghost), transparent 70%),
    var(--bg-color);
  border: 1px solid var(--ink-solid);
  border-radius: 2px;
  /* Inner hairline = the double rule of the nav frame */
  box-shadow: inset 0 0 0 3px var(--bg-color), inset 0 0 0 4px var(--ink-wash),
    0 12px 32px rgba(0, 0, 0, 0.22);
  cursor: pointer;
  outline: none;
  -webkit-appearance: none;
  transition: transform 0.25s cubic-bezier(0.2, 0.8, 0.2, 1), box-shadow 0.25s ease,
    background var(--transition-mode), border-color var(--transition-mode);
}

/* Ink diamond on the top rule, like the separators between the nav links */
.email-popup-content::before {
  content: '';
  position: absolute;
  top: 0;
  left: 50%;
  width: 7px;
  height: 7px;
  background: var(--ink-solid);
  transform: translate(-50%, -50%) rotate(45deg);
  box-shadow: 0 0 0 3px var(--bg-color);
}

/* Diamond caret pointing down at the cat */
.email-popup-content::after {
  content: '';
  position: absolute;
  bottom: -6px;
  right: calc(var(--cat-size, 84px) / 2 - 6px);
  width: 11px;
  height: 11px;
  background: var(--bg-color);
  border-right: 1px solid var(--ink-solid);
  border-bottom: 1px solid var(--ink-solid);
  transform: rotate(45deg);
  pointer-events: none;
}

.email-popup-content:hover {
  transform: translateY(-2px);
  box-shadow: inset 0 0 0 3px var(--bg-color), inset 0 0 0 4px var(--ink-solid),
    0 16px 38px rgba(0, 0, 0, 0.28);
}

.email-popup-content:active {
  transform: translateY(0) scale(0.98);
}

body.theme-dark .email-popup-content {
  box-shadow: inset 0 0 0 3px var(--bg-color), inset 0 0 0 4px var(--ink-wash),
    0 14px 40px rgba(0, 0, 0, 0.75), 0 0 22px rgba(237, 232, 220, 0.08);
}

body.theme-dark .email-popup-content:hover {
  box-shadow: inset 0 0 0 3px var(--bg-color), inset 0 0 0 4px var(--ink-solid),
    0 16px 44px rgba(0, 0, 0, 0.8), 0 0 28px rgba(237, 232, 220, 0.14);
}

.email-popup-label {
  font-size: 0.68rem;
  letter-spacing: 0.32em;
  opacity: 0.55;
}

.email-popup-address {
  font-size: 1.05rem;
  letter-spacing: 0.05em;
}

/* "copy" sits under a short rule; on copy it turns into solid ink */
.email-copy-badge {
  position: relative;
  margin-top: 0.15rem;
  padding: 0.2rem 0.7rem 0.15rem;
  font-size: 0.66rem;
  letter-spacing: 0.24em;
  opacity: 0.6;
  border-top: 1px solid var(--ink-ghost);
  transition: opacity 0.25s ease, background 0.25s ease, color 0.25s ease;
}

.email-popup-content:hover .email-copy-badge {
  opacity: 1;
}

.email-copy-badge.copied {
  opacity: 1;
  background: var(--ink-solid);
  color: var(--bg-color);
  border-top-color: transparent;
}

.email-popup-content.copied-glow {
  animation: emailCopyPulse 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes emailCopyPulse {
  35% { transform: scale(1.03); }
}

/* ==========================================================================
   RESPONSIVE ADJUSTMENTS (Positioned after base styles for proper cascade)
   ========================================================================== */

@media (max-width: 768px) {
  /* =========================================================================
     MOBILE STABILITY & GPU OPTIMIZATIONS (Leaves PC 100% untouched)
     ========================================================================= */

  /* 1. Disable real-time SVG procedural noise filter that exhausts mobile GPU & crashes WebKit */
  .grain-overlay {
    display: none !important;
  }

  /* 2. Hardware composite hint for mobile canvas layers */
  #canvas-water,
  #canvas-ripples,
  #canvas-wind,
  #canvas-particles {
    transform: translateZ(0);
    -webkit-transform: translateZ(0);
  }

  /* 3. Strip expensive 50px drop-shadow blurs from continuously moving 130KB SVG cloud layers */
  .cloud-layer {
    will-change: transform;
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
  }

  body.theme-light .cloud-layer svg,
  body.theme-dark .cloud-layer svg {
    filter: none !important;
  }

  /* 4. Streamline dragon glow on mobile */
  .flock-dragon {
    will-change: transform;
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
  }

  body.theme-light .flock-dragon svg {
    filter: drop-shadow(0 2px 4px rgba(13, 12, 11, 0.2)) !important;
  }

  body.theme-dark .flock-dragon svg {
    filter: drop-shadow(0 0 6px rgba(237, 232, 220, 0.35)) !important;
  }

  /* 5. Streamline celestial corner glow on mobile */
  body.theme-light .celestial-vector,
  body.theme-dark .celestial-vector {
    filter: drop-shadow(0 0 10px rgba(237, 232, 220, 0.3)) !important;
  }

  /* 6. Shrink moon/sun on small screens so they never overlap the centered title */
  body.theme-light .celestial-corner {
    width: clamp(68px, 16vw, 140px);
    height: clamp(60px, 14.5vw, 124px);
    top: clamp(0.6rem, 2vw, 1.6rem);
    right: clamp(2.5rem, 4vw, 4.5rem);
  }

  body.theme-dark .celestial-corner {
    width: clamp(58px, 14vw, 120px);
    height: clamp(48px, 11.5vw, 100px);
    top: clamp(0.6rem, 2vw, 1.6rem);
    left: clamp(2.5rem, 4vw, 4.5rem);
  }

  .interface-header {
    top: 1.2rem;
    left: 1.2rem;
    right: 1.2rem;
  }

  /* 7. Eliminate 300ms tap delay on all interactive elements */
  .glyph-btn,
  .celestial-corner,
  .nav-link,
  .email-btn,
  .email-popup-content {
    touch-action: manipulation;
  }

  .email-contact-widget {
    right: clamp(0.8rem, 3.2vw, 1.6rem);
    bottom: clamp(0.8rem, 2.5vh, 1.6rem);
    left: auto;
    top: auto;
  }

  .email-btn {
    width: var(--cat-size-mobile, 60px);
    height: var(--cat-size-mobile, 60px);
  }

  .navigation-dock {
    top: var(--nav-dock-y-mobile, var(--nav-dock-y, 50%));
    left: var(--nav-dock-x-mobile, var(--nav-dock-x, 50%));
    width: var(--nav-dock-width-mobile, var(--nav-dock-width, 78%));
    height: var(--nav-dock-height-mobile, var(--nav-dock-height, 46%));
  }

  /* =========================================================================
     MOBILE EMAIL POPUP (Anchored right above the contact cat)
     ========================================================================= */
  .email-popup {
    position: absolute !important;
    bottom: calc(100% + 10px) !important;
    right: 0 !important;
    left: auto !important;
    transform: translateY(8px) scale(0.96) !important;
    transform-origin: bottom right !important;
    width: auto !important;
    max-width: min(92vw, 380px) !important;
    z-index: 1200 !important;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.3s cubic-bezier(0.16, 1, 0.3, 1),
      transform 0.3s cubic-bezier(0.16, 1, 0.3, 1) !important;
  }

  .email-popup.active {
    opacity: 1 !important;
    pointer-events: auto !important;
    transform: translateY(0) scale(1) !important;
  }

  .email-popup-content {
    padding: 0.75rem 1.15rem 0.6rem;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
  }

  .email-popup-content::after {
    right: calc(var(--cat-size-mobile, 60px) / 2 - 6px);
  }

  .email-popup-address {
    font-size: clamp(0.88rem, 4vw, 1rem);
  }

  /* =========================================================================
     PREFERS-REDUCED-MOTION: Honour user's accessibility preference on mobile
     ========================================================================= */
  @media (prefers-reduced-motion: reduce) {
    .title-container,
    .celestial-corner,
    .grain-overlay {
      animation: none !important;
    }

    .cloud-layer,
    .flock-dragon {
      transition: none !important;
    }
  }
}

@media (max-width: 480px) {
  .email-btn {
    width: calc(var(--owl-size-mobile, 36px) * 1.15);
    height: calc(var(--owl-size-mobile, 36px) * 1.15);
  }
}

/* ==========================================================================
   MOBILE INTERSTITIAL / LOADING SCREEN
   Shown on mobile while SVG resources load. Hidden on PC entirely.
   ========================================================================== */

.mobile-interstitial {
  display: none; /* Hidden on desktop — no PC paint cost */
}

@media (max-width: 768px) {
  #pc-loader {
    display: none !important;
  }

  .mobile-interstitial {
    display: flex;
    position: fixed;
    inset: 0;
    z-index: 9000;
    align-items: center;
    justify-content: center;
    background: #060607;
    padding: 2rem 1.5rem;
    transition: transform 0.65s cubic-bezier(0.16, 1, 0.3, 1),
                opacity  0.55s cubic-bezier(0.16, 1, 0.3, 1);
    will-change: transform, opacity;
    touch-action: none;
  }

  body.theme-light .mobile-interstitial {
    background: #f4f1ea;
  }

  /* JS adds .mi-exit to slide overlay up and fade it out */
  .mobile-interstitial.mi-exit {
    transform: translateY(-100%);
    opacity: 0;
    pointer-events: none;
  }

  /* After transition ends, JS adds .mi-gone to remove from paint tree */
  .mobile-interstitial.mi-gone {
    display: none !important;
  }

  .mi-inner {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    width: 100%;
    max-width: 360px;
  }

  /* SAD-MAN FIGURE — SVG is now #ffffff (white) on transparent background.
     Dark mode: white on dark = perfectly visible, add a soft luminous glow.
     Light mode: invert(1) flips white→near-black for visibility on light bg. */
  .mi-figure {
    width: clamp(150px, 46vw, 210px);
    margin-bottom: 1.6rem;
    animation: miManFloat 5s ease-in-out infinite alternate;
    will-change: transform;
  }

  .mi-sad-man {
    width: 100%;
    height: auto;
    display: block;
    user-select: none;
    -webkit-user-drag: none;
    /* Dark mode default: white figure glows softly on dark overlay */
    filter: drop-shadow(0 0 22px rgba(237, 232, 220, 0.28))
            drop-shadow(0 0 60px rgba(237, 232, 220, 0.10));
  }

  body.theme-light .mi-sad-man {
    /* Light mode: invert white→black so figure shows on light background */
    filter: invert(1)
            drop-shadow(0 2px 12px rgba(13, 12, 11, 0.18));
  }

  @keyframes miManFloat {
    0%   { transform: translateY(0px)   rotate(-0.5deg); }
    40%  { transform: translateY(-7px)  rotate(0.3deg);  }
    100% { transform: translateY(-12px) rotate(-0.8deg); }
  }

  /* COPY */
  .mi-headline {
    font-family: var(--font-display);
    font-size: clamp(1rem, 5.5vw, 1.28rem);
    font-weight: 600;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: #ede8dc;
    line-height: 1.35;
    margin-bottom: 0.75rem;
  }

  body.theme-light .mi-headline {
    color: #0d0c0b;
  }

  .mi-subtext {
    font-family: var(--font-kanji), var(--font-display);
    font-size: clamp(0.76rem, 3.4vw, 0.9rem);
    font-weight: 400;
    letter-spacing: 0.08em;
    line-height: 1.55;
    color: rgba(237, 232, 220, 0.72);
    margin: 0 0 1.6rem 0;
  }

  body.theme-light .mi-subtext {
    color: rgba(13, 12, 11, 0.72);
  }

  /* LOADING PROGRESS LINE */
  .mi-loader-track {
    width: 100%;
    max-width: 200px;
    height: 3px;
    background: rgba(237, 232, 220, 0.16);
    border-radius: 999px;
    overflow: hidden;
    margin-bottom: 0.6rem;
  }

  body.theme-light .mi-loader-track {
    background: rgba(13, 12, 11, 0.16);
  }

  .mi-loader-bar {
    height: 100%;
    width: 0%;
    background: #ede8dc;
    border-radius: 999px;
    box-shadow: 0 0 10px rgba(237, 232, 220, 0.65);
    transition: width 0.35s cubic-bezier(0.2, 0.8, 0.2, 1);
  }

  body.theme-light .mi-loader-bar {
    background: #0d0c0b;
    box-shadow: 0 0 8px rgba(13, 12, 11, 0.3);
  }

  .mi-loading-label {
    font-family: var(--font-display);
    font-size: 0.66rem;
    letter-spacing: 0.22em;
    text-transform: uppercase;
    color: rgba(237, 232, 220, 0.6);
    margin-bottom: 1.4rem;
    transition: color 0.3s ease;
  }

  body.theme-light .mi-loading-label {
    color: rgba(13, 12, 11, 0.6);
  }

  /* PURE TEXT PROMPT — NO BOX */
  .mi-continue-btn {
    background: transparent;
    border: none;
    outline: none;
    box-shadow: none;
    padding: 0.5rem 0.8rem;
    font-family: var(--font-display);
    font-size: clamp(0.76rem, 3.4vw, 0.86rem);
    font-weight: 500;
    letter-spacing: 0.18em;
    text-transform: lowercase;
    color: rgba(237, 232, 220, 0.8);
    text-decoration: underline;
    text-underline-offset: 5px;
    text-decoration-color: rgba(237, 232, 220, 0.35);
    cursor: pointer;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
    transition: color 0.3s ease, text-decoration-color 0.3s ease, transform 0.15s ease;
  }

  .mi-continue-btn:active {
    transform: scale(0.96);
    color: #ede8dc;
    text-decoration-color: #ede8dc;
  }

  body.theme-light .mi-continue-btn {
    color: rgba(13, 12, 11, 0.75);
    text-decoration-color: rgba(13, 12, 11, 0.35);
  }

  body.theme-light .mi-continue-btn:active {
    color: #0d0c0b;
    text-decoration-color: #0d0c0b;
  }
}

/* ==========================================================================
   PC DESKTOP LOADING SCREEN
   The brush-drawn ensō is the progress indicator: main.js draws it as resources
   load. The theme kanji (希望 HOPE / 虚空 VOID) ink in, ink motes and petals
   (canvas #pc-loader-ink) gather into the circle, a vermilion seal is stamped on
   completion, and the exit opens like a portal through the ensō. Hidden on mobile.
   ========================================================================== */

@property --pc-hole {
  syntax: '<percentage>';
  inherits: false;
  initial-value: 0%;
}

.pc-loader {
  --pc-ink: #ede8dc;
  --pc-ink-rgb: 237, 232, 220;
  --pc-seal: #c8432b;
  --pc-hole: 0%;
  position: fixed;
  inset: 0;
  z-index: 9500;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(ellipse 70% 60% at 50% 42%, #121115 0%, #060607 72%);
  color: var(--pc-ink);
  /* The exit punches a growing hole through the centre of the ensō */
  -webkit-mask-image: radial-gradient(circle at 50% 42%, transparent calc(var(--pc-hole) - 7%), #000 var(--pc-hole));
  mask-image: radial-gradient(circle at 50% 42%, transparent calc(var(--pc-hole) - 7%), #000 var(--pc-hole));
  transition: --pc-hole 1.05s cubic-bezier(0.7, 0, 0.2, 1),
              opacity 0.7s ease 0.45s;
  contain: strict;
  cursor: default;
  user-select: none;
  overflow: hidden;
}

body.theme-light .pc-loader {
  --pc-ink: #0d0c0b;
  --pc-ink-rgb: 13, 12, 11;
  --pc-seal: #b8351f;
  background: radial-gradient(ellipse 70% 60% at 50% 42%, #fbf9f4 0%, #ebe6da 78%);
}

.pc-loader.pc-loader-exit {
  --pc-hole: 160%;
  opacity: 0;
  pointer-events: none;
}

.pc-loader.pc-loader-gone {
  display: none !important;
}

/* Ink motes / petals canvas behind everything */
.pc-loader-ink {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.pc-loader-inner {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  transition: transform 1.05s cubic-bezier(0.7, 0, 0.2, 1);
}

/* Emblem */
.pc-loader-emblem {
  position: relative;
  width: 260px;
  height: 260px;
  margin-bottom: 1.6rem;
  transition: transform 1.05s cubic-bezier(0.7, 0, 0.2, 1), opacity 0.6s ease 0.3s;
}

.pc-loader-exit .pc-loader-emblem {
  transform: scale(2.4);
  opacity: 0;
}

.pc-loader-exit .pc-loader-meta {
  opacity: 0;
  transform: translateY(14px);
}

.pc-loader-svg {
  width: 100%;
  height: 100%;
  overflow: visible;
}

.pc-ambient-glow {
  transform-origin: 130px 130px;
  animation: pcGlowBreathe 4s ease-in-out infinite;
}

.pc-glow-inner { stop-color: rgba(var(--pc-ink-rgb), 0.22); }
.pc-glow-mid   { stop-color: rgba(var(--pc-ink-rgb), 0.05); }
.pc-glow-outer { stop-color: rgba(var(--pc-ink-rgb), 0); }

/* Dark ink would make the glow a grey disc on paper: light mode gets a faint warm wash */
body.theme-light .pc-glow-inner { stop-color: rgba(255, 252, 244, 0.95); }
body.theme-light .pc-glow-mid   { stop-color: rgba(255, 252, 244, 0.4); }
body.theme-light .pc-glow-outer { stop-color: rgba(255, 252, 244, 0); }

/* Outer astrolabe ring: fades in, then turns */
.pc-astrolabe-group {
  transform-origin: 130px 130px;
  animation: pcFadeIn 1s ease 0.1s both, pcSpinCW 30s linear infinite;
}

.pc-astral-track {
  fill: none;
  stroke: rgba(var(--pc-ink-rgb), 0.2);
  stroke-width: 1px;
  stroke-dasharray: 3 6;
}

.pc-tick {
  stroke: rgba(var(--pc-ink-rgb), 0.35);
  stroke-width: 1.1px;
  stroke-linecap: round;
}

.pc-tick.pc-cardinal {
  stroke: rgba(var(--pc-ink-rgb), 0.8);
  stroke-width: 2px;
}

.pc-astral-pearl {
  fill: var(--pc-ink);
  filter: drop-shadow(0 0 6px rgba(var(--pc-ink-rgb), 0.9));
}

/* Middle ring */
.pc-harmonic-group {
  transform-origin: 130px 130px;
  animation: pcFadeIn 1s ease 0.35s both, pcSpinCCW 22s linear infinite;
}

.pc-harmonic-ring {
  fill: none;
  stroke: rgba(var(--pc-ink-rgb), 0.22);
  stroke-width: 1.1px;
  stroke-dasharray: 1.5 9;
}

/* The ensō: a rough brush stroke whose length is the load progress (set by main.js) */
.pc-enso-stroke,
.pc-enso-dry {
  fill: none;
  stroke: var(--pc-ink);
  stroke-linecap: round;
  stroke-dasharray: 620;
  stroke-dashoffset: 620;
  transform-origin: 130px 130px;
}

.pc-enso-stroke {
  stroke-width: 7px;
  filter: url(#pc-brush) drop-shadow(0 0 10px rgba(var(--pc-ink-rgb), 0.35));
  transition: stroke-dashoffset 0.5s cubic-bezier(0.25, 0.8, 0.3, 1);
  animation: pcEnsoPulse 3.6s ease-in-out infinite;
}

.pc-enso-dry {
  stroke-width: 1.4px;
  stroke-dasharray: 2 4 1 6;
  opacity: 0;
  transition: opacity 0.6s ease;
}

.pc-loader-done .pc-enso-dry {
  opacity: 0.45;
}

/* Ink splatter flicked off the end of the brush */
.pc-splatter circle {
  fill: var(--pc-ink);
  opacity: 0;
  transform-box: fill-box;
  transform-origin: center;
}

.pc-loader-done .pc-splatter circle {
  animation: pcSplat 0.5s cubic-bezier(0.2, 1.6, 0.4, 1) forwards;
}

.pc-loader-done .pc-splatter circle:nth-child(2) { animation-delay: 0.06s; }
.pc-loader-done .pc-splatter circle:nth-child(3) { animation-delay: 0.1s; }
.pc-loader-done .pc-splatter circle:nth-child(4) { animation-delay: 0.16s; }

/* Kanji: outlines are inked stroke by stroke, then the ink floods in */
.pc-kanji-glyph-group {
  transform-origin: 130px 137px;
  animation: pcKanjiBreathe 3.4s ease-in-out 2.2s infinite;
}

.pc-kanji-text {
  font-family: 'Shippori Mincho', serif;
  font-size: 30px;
  font-weight: 700;
  fill: var(--pc-ink);
  fill-opacity: 0;
  stroke: var(--pc-ink);
  stroke-width: 0.8px;
  stroke-dasharray: 160;
  stroke-dashoffset: 160;
  dominant-baseline: central;
  animation: pcKanjiInk 1.3s ease-out forwards;
}

.pc-kanji-top    { animation-delay: 0.7s; }
.pc-kanji-bottom { animation-delay: 1.05s; }

/* Vermilion seal, stamped when loading completes */
.pc-loader-seal {
  position: absolute;
  right: 6px;
  bottom: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border: 2px solid var(--pc-seal);
  border-radius: 4px;
  color: var(--pc-seal);
  font-family: 'Cinzel', serif;
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.04em;
  opacity: 0;
  transform: scale(2.2) rotate(-14deg);
  filter: url(#pc-brush);
}

.pc-loader-done .pc-loader-seal {
  animation: pcStamp 0.45s cubic-bezier(0.3, 1.5, 0.5, 1) forwards;
}

.pc-loader-done .pc-enso-stroke {
  filter: url(#pc-brush) drop-shadow(0 0 18px rgba(var(--pc-ink-rgb), 0.7));
}

/* Text block */
.pc-loader-meta {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 300px;
  transition: opacity 0.5s ease, transform 0.6s ease;
}

.pc-loader-title {
  display: flex;
  gap: 0.55em;
  padding-left: 0.55em; /* balance the trailing gap so the word sits centred */
  font-family: 'Cinzel', serif;
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--pc-ink);
  margin-bottom: 0.35rem;
}

.pc-loader-title span {
  display: inline-block;
  opacity: 0;
  filter: blur(8px);
  transform: translateY(10px);
  animation: pcLetterIn 0.9s cubic-bezier(0.16, 1, 0.3, 1) forwards;
  animation-delay: calc(0.9s + var(--i) * 0.12s);
}

.pc-loader-reading {
  font-family: var(--nav-mono);
  font-size: 0.68rem;
  letter-spacing: 0.14em;
  color: rgba(var(--pc-ink-rgb), 0.55);
  margin-bottom: 0.9rem;
  animation: pcFadeIn 1s ease 1.2s both;
}

.pc-loader-sub {
  font-family: var(--nav-mono);
  font-size: 0.62rem;
  letter-spacing: 0.2em;
  text-transform: lowercase;
  color: rgba(var(--pc-ink-rgb), 0.4);
  transition: opacity 0.22s ease, transform 0.22s ease, filter 0.22s ease;
}

.pc-loader-sub.is-swapping {
  opacity: 0;
  transform: translateY(-4px);
  filter: blur(3px);
}

/* Keyframes */
@keyframes pcFadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

@keyframes pcSpinCW {
  to { transform: rotate(360deg); }
}

@keyframes pcSpinCCW {
  to { transform: rotate(-360deg); }
}

@keyframes pcEnsoPulse {
  0%, 100% { transform: scale(1); }
  50%      { transform: scale(1.025); }
}

@keyframes pcSplat {
  0%   { opacity: 0; transform: scale(0); }
  100% { opacity: 0.85; transform: scale(1); }
}

@keyframes pcKanjiInk {
  70%  { stroke-dashoffset: 0; fill-opacity: 0; }
  100% { stroke-dashoffset: 0; fill-opacity: 1; }
}

@keyframes pcKanjiBreathe {
  0%, 100% { transform: scale(1); }
  50%      { transform: scale(1.04); }
}

@keyframes pcGlowBreathe {
  0%, 100% { opacity: 0.45; transform: scale(0.94); }
  50%      { opacity: 1;    transform: scale(1.04); }
}

@keyframes pcLetterIn {
  to { opacity: 1; filter: blur(0); transform: translateY(0); }
}

@keyframes pcStamp {
  0%   { opacity: 0; transform: scale(2.2) rotate(-14deg); }
  60%  { opacity: 1; transform: scale(0.92) rotate(-8deg); }
  100% { opacity: 0.92; transform: scale(1) rotate(-8deg); }
}

@media (prefers-reduced-motion: reduce) {
  .pc-loader,
  .pc-loader *,
  .pc-loader *::after {
    animation-duration: 0.01ms !important;
    animation-delay: 0s !important;
    animation-iteration-count: 1 !important;
  }

  .pc-loader {
    transition: opacity 0.4s ease;
  }

  .pc-loader-ink {
    display: none;
  }
}
