/* Family Atlas: shared styles for index.html (Temo) and irakli.html (gift edition) */
:root {
  --ink: #0a0c0f;
  --ink-2: #12151a;
  --ivory: #eef1f5;
  --ivory-2: #c3cad4;
  --muted: #7f8896;
  --faint: rgba(226, 232, 240, 0.12);
  --gold: #dfe6f0;
  --gold-2: #8f9bad;
  --c-main: #dfe6f0;
  --c-paternal: #6fa8c7;
  --c-kalandia: #a394e0;
  --c-lukava: #8fb39a;
  --serif: 'Lora', 'Noto Serif Georgian', Georgia, serif;
  --geo: 'Noto Serif Georgian', 'Lora', Georgia, serif;
  --sans: 'Inter', 'Noto Sans Georgian', system-ui, -apple-system, sans-serif;
  --spring: cubic-bezier(0.2, 0.9, 0.25, 1);
  --soft: cubic-bezier(0.4, 0, 0.2, 1);
  --drawer-w: 440px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; overflow: hidden; background: var(--ink); }
body {
  color: var(--ivory);
  font-family: var(--sans);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
a { color: inherit; text-decoration: none; }

/* ---------- stage ---------- */
#viewport {
  position: fixed; inset: 0;
  overflow: hidden;
  cursor: grab;
  touch-action: none;
  background:
    radial-gradient(1200px 700px at 50% -10%, rgba(190, 205, 225, 0.10), transparent 70%),
    radial-gradient(900px 900px at 100% 100%, rgba(120, 150, 210, 0.05), transparent 70%),
    linear-gradient(180deg, #0e1116 0%, #08090c 100%);
}
#viewport.dragging { cursor: grabbing; }
#world { position: absolute; left: 0; top: 0; transform-origin: 0 0; z-index: 2; }
#edges { position: absolute; left: 0; top: 0; width: 1px; height: 1px; overflow: visible; pointer-events: none; }

/* ---------- Frameless Pre-War Sukhumi Platinum & Iridescent Contour Engraving ---------- */
#sukhumi-bg {
  position: fixed;
  inset: -14px;
  pointer-events: none;
  z-index: 1;
  opacity: 0;
  transform: translate3d(var(--px, 0px), var(--py, 0px), 0) scale(1.015);
  transition: opacity 1.8s var(--soft) 0.3s, transform 0.35s cubic-bezier(0.2, 0.8, 0.2, 1);
  will-change: transform, opacity;
}
body.revealed #sukhumi-bg {
  opacity: 1;
}
body.has-focus #sukhumi-bg {
  opacity: 0.55;
}
#sukhumi-bg .sk-layer {
  position: absolute;
  inset: 0;
  -webkit-mask-image: url('sukhumi_contours.webp?v=7');
  mask-image: url('sukhumi_contours.webp?v=7');
  -webkit-mask-size: cover;
  mask-size: cover;
  -webkit-mask-position: center;
  mask-position: center;
  -webkit-mask-repeat: no-repeat;
  mask-repeat: no-repeat;
}
/* 1. Quiet archival platinum-charcoal base lines */
#sukhumi-bg .sk-base {
  background: linear-gradient(
    90deg,
    rgba(111, 168, 199, 0.42) 0%,
    rgba(223, 230, 240, 0.32) 30%,
    rgba(223, 230, 240, 0.32) 70%,
    rgba(163, 148, 224, 0.42) 100%
  );
}
/* 2. Living ambient iridescent wave traveling along the engraved contours */
#sukhumi-bg .sk-wave {
  background: linear-gradient(
    112deg,
    transparent 15%,
    rgba(111, 168, 199, 0.65) 33%,
    rgba(255, 255, 255, 0.92) 47%,
    rgba(163, 148, 224, 0.75) 61%,
    rgba(143, 179, 154, 0.45) 73%,
    transparent 88%
  );
  background-size: 260% 260%;
  animation: skContourWave 10s ease-in-out infinite alternate;
  mix-blend-mode: screen;
}
@keyframes skContourWave {
  0% { background-position: 0% 20%; opacity: 0.65; }
  50% { background-position: 55% 60%; opacity: 0.95; }
  100% { background-position: 100% 80%; opacity: 0.7; }
}
/* 3. Interactive mouse-reactive specular glint along the contours */
#sukhumi-bg .sk-glint {
  mix-blend-mode: screen;
  transition: opacity 0.3s ease;
}

/* Режим 1: «Закатный луч» (Солнечный янтарь + Тёплый оранж + Платина) */
body[data-light="sunset"] #sukhumi-bg .sk-glint,
body:not([data-light]) #sukhumi-bg .sk-glint {
  background:
    radial-gradient(
      520px circle at var(--mx, 50%) var(--my, 50%),
      rgba(255, 255, 255, 1) 0%,
      rgba(254, 215, 170, 0.95) 15%,
      rgba(249, 115, 22, 0.92) 34%,
      rgba(225, 29, 72, 0.55) 56%,
      rgba(163, 148, 224, 0.3) 76%,
      transparent 100%
    ),
    radial-gradient(
      240px circle at var(--mx, 50%) var(--my, 50%),
      #ffffff 0%,
      rgba(253, 186, 116, 0.85) 45%,
      transparent 100%
    );
  filter: drop-shadow(0 0 14px rgba(249, 115, 22, 0.75));
}

/* Режим 2: «Ювелирный опал» (Многослойный призматический перелив) */
body[data-light="opal"] #sukhumi-bg .sk-glint {
  background:
    radial-gradient(
      560px circle at var(--mx, 50%) var(--my, 50%),
      #ffffff 0%,
      rgba(254, 240, 138, 0.95) 12%,
      rgba(249, 115, 22, 0.88) 25%,
      rgba(236, 72, 153, 0.82) 42%,
      rgba(168, 85, 247, 0.78) 60%,
      rgba(6, 182, 212, 0.65) 78%,
      transparent 100%
    ),
    radial-gradient(
      240px circle at var(--mx, 50%) var(--my, 50%),
      #ffffff 0%,
      rgba(255, 255, 255, 0.8) 50%,
      transparent 100%
    );
  filter: drop-shadow(0 0 14px rgba(236, 72, 153, 0.65));
}

/* Режим 3: «Огни вечернего Сухуми» (Морская лазурь слева и янтарные фонари справа) */
body[data-light="promenade"] #sukhumi-bg .sk-glint {
  background:
    radial-gradient(
      520px circle at var(--mx, 50%) var(--my, 50%),
      #ffffff 0%,
      var(--prom-c1, rgba(254, 215, 170, 0.95)) 16%,
      var(--prom-c2, rgba(249, 115, 22, 0.9)) 38%,
      var(--prom-c3, rgba(225, 29, 72, 0.75)) 62%,
      transparent 100%
    ),
    radial-gradient(
      240px circle at var(--mx, 50%) var(--my, 50%),
      #ffffff 0%,
      transparent 100%
    );
  filter: drop-shadow(0 0 14px var(--prom-drop, rgba(249, 115, 22, 0.7)));
}

#light-switcher button {
  padding: 7px 12px;
  font-size: 11px;
  letter-spacing: 0.04em;
}

.grain {
  position: fixed; inset: 0; pointer-events: none; z-index: 5; opacity: 0.07; mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='220' height='220'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}
.vignette {
  position: fixed; inset: 0; pointer-events: none; z-index: 4;
  background: radial-gradient(ellipse at center, transparent 55%, rgba(0, 0, 0, 0.55) 100%);
}

/* ---------- edges ---------- */
.edge {
  fill: none; stroke: var(--ec, var(--c-main)); stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round;
  opacity: 0.62;
  stroke-dasharray: 1; stroke-dashoffset: 1;
  transition: stroke-dashoffset 1.5s var(--soft), opacity 0.5s var(--soft), stroke-width 0.4s var(--soft), stroke 0.4s;
}
.edge.side { stroke-width: 1.1; opacity: 0.34; }
.edge.union { stroke-width: 1.6; }
.ring {
  fill: var(--ink); stroke: var(--ec, var(--c-main)); stroke-width: 1.5;
  opacity: 0; transform-box: fill-box; transform-origin: center; transform: scale(0.2);
  transition: opacity 0.6s var(--soft), transform 0.8s var(--spring), stroke 0.4s, fill 0.4s;
}
body.revealed .edge { stroke-dashoffset: 0; }
body.revealed .ring { opacity: 0.9; transform: scale(1); }
.edge.h-main { --ec: var(--c-main); } .edge.h-paternal { --ec: var(--c-paternal); }
.edge.h-kalandia { --ec: var(--c-kalandia); } .edge.h-lukava { --ec: var(--c-lukava); }
.ring.h-main { --ec: var(--c-main); } .ring.h-paternal { --ec: var(--c-paternal); }
.ring.h-kalandia { --ec: var(--c-kalandia); } .ring.h-lukava { --ec: var(--c-lukava); }

body.has-focus .edge { opacity: 0.08; transition: opacity 0.4s var(--soft), stroke 0.4s, stroke-width 0.4s; }
body.has-focus .ring { opacity: 0.12; transition: opacity 0.4s var(--soft); }
body.has-focus .edge.lit {
  opacity: 1;
  stroke: #fff7eb;
  stroke-width: 2.8;
  filter: drop-shadow(0 0 6px rgba(255, 255, 255, 0.95)) drop-shadow(0 0 18px rgba(255, 154, 42, 0.78));
  animation: edgeWave 0.68s var(--soft) var(--wave-d, 0ms) both, lineShimmer 2.2s ease-in-out calc(var(--wave-d, 0ms) + 0.68s) infinite alternate;
}
body.has-focus.wave-b .edge.lit {
  animation: edgeWaveB 0.68s var(--soft) var(--wave-d, 0ms) both, lineShimmer 2.2s ease-in-out calc(var(--wave-d, 0ms) + 0.68s) infinite alternate;
}
body.has-focus .ring.lit {
  opacity: 1;
  stroke: #ffffff;
  fill: #ff9a2a;
  filter: drop-shadow(0 0 8px rgba(255, 255, 255, 1)) drop-shadow(0 0 18px rgba(255, 154, 42, 0.88));
  transform: scale(1.45);
  animation: ringWave 0.62s var(--spring) var(--wave-d, 0ms) both;
}
body.has-focus.wave-b .ring.lit {
  animation: ringWaveB 0.62s var(--spring) var(--wave-d, 0ms) both;
}

@keyframes edgeWave {
  0% { opacity: 0.22; stroke: #7fe3d6; stroke-width: 1.8; filter: drop-shadow(0 0 4px rgba(127, 227, 214, 0.5)); }
  45% { opacity: 1; stroke: #eaf6ff; stroke-width: 3.6; filter: drop-shadow(0 0 12px rgba(234, 246, 255, 1)) drop-shadow(0 0 26px rgba(127, 227, 214, 0.95)); }
  100% { opacity: 1; stroke: #fff7eb; stroke-width: 2.8; filter: drop-shadow(0 0 6px rgba(255, 255, 255, 0.95)) drop-shadow(0 0 18px rgba(255, 154, 42, 0.78)); }
}
@keyframes edgeWaveB {
  0% { opacity: 0.22; stroke: #7fe3d6; stroke-width: 1.8; filter: drop-shadow(0 0 4px rgba(127, 227, 214, 0.5)); }
  45% { opacity: 1; stroke: #eaf6ff; stroke-width: 3.6; filter: drop-shadow(0 0 12px rgba(234, 246, 255, 1)) drop-shadow(0 0 26px rgba(127, 227, 214, 0.95)); }
  100% { opacity: 1; stroke: #fff7eb; stroke-width: 2.8; filter: drop-shadow(0 0 6px rgba(255, 255, 255, 0.95)) drop-shadow(0 0 18px rgba(255, 154, 42, 0.78)); }
}

@keyframes ringWave {
  0% { transform: scale(0.75); fill: #7fe3d6; filter: drop-shadow(0 0 4px rgba(127, 227, 214, 0.7)); }
  50% { transform: scale(1.75); fill: #ffffff; filter: drop-shadow(0 0 14px #ffffff) drop-shadow(0 0 28px rgba(127, 227, 214, 1)); }
  100% { transform: scale(1.45); fill: #ff9a2a; filter: drop-shadow(0 0 8px rgba(255, 255, 255, 1)) drop-shadow(0 0 18px rgba(255, 154, 42, 0.88)); }
}
@keyframes ringWaveB {
  0% { transform: scale(0.75); fill: #7fe3d6; filter: drop-shadow(0 0 4px rgba(127, 227, 214, 0.7)); }
  50% { transform: scale(1.75); fill: #ffffff; filter: drop-shadow(0 0 14px #ffffff) drop-shadow(0 0 28px rgba(127, 227, 214, 1)); }
  100% { transform: scale(1.45); fill: #ff9a2a; filter: drop-shadow(0 0 8px rgba(255, 255, 255, 1)) drop-shadow(0 0 18px rgba(255, 154, 42, 0.88)); }
}

@keyframes lineShimmer {
  0% {
    filter: drop-shadow(0 0 5px rgba(255, 255, 255, 0.85)) drop-shadow(0 0 14px rgba(255, 154, 42, 0.52));
  }
  100% {
    filter: drop-shadow(0 0 10px rgba(255, 255, 255, 1)) drop-shadow(0 0 26px rgba(255, 154, 42, 0.92));
  }
}

/* ---------- nodes (Layer Stack edge-lit acrylic slabs) ---------- */
.node { position: absolute; width: 0; height: 0; z-index: 2; transition: opacity 0.5s var(--soft), filter 0.5s var(--soft); }
.anchor { position: absolute; left: calc(var(--w) / -2); width: var(--w); }
.a-top .anchor { top: 0; }
.a-bottom .anchor { bottom: 0; }

.card {
  position: relative;
  width: 100%;
  padding: 15px 16px 14px;
  text-align: center;
  border-radius: 14px;
  border: 1px solid rgba(127, 227, 214, 0.28);
  background:
    linear-gradient(135deg, rgba(234, 246, 255, 0.13) 0%, rgba(234, 246, 255, 0.025) 38%, rgba(127, 227, 214, 0.045) 75%, rgba(255, 154, 42, 0.025) 100%),
    linear-gradient(180deg, rgba(20, 26, 34, 0.78), rgba(10, 14, 19, 0.88));
  -webkit-backdrop-filter: blur(16px) saturate(1.35);
  backdrop-filter: blur(16px) saturate(1.35);
  box-shadow:
    inset 0 1.5px 0 rgba(234, 246, 255, 0.30),
    inset 0 -1.5px 0 rgba(127, 227, 214, 0.24),
    inset 1px 0 0 rgba(127, 227, 214, 0.12),
    inset -1px 0 0 rgba(127, 227, 214, 0.12),
    0 3px 0 rgba(6, 10, 14, 0.94),
    0 22px 44px -18px rgba(0, 0, 0, 0.92),
    0 0 18px -6px rgba(127, 227, 214, 0.16);
  cursor: pointer;
  opacity: 0; transform: translateY(18px) scale(0.97);
  transition: transform 0.7s var(--spring), opacity 0.7s var(--soft), border-color 0.35s, box-shadow 0.45s, background 0.45s;
  transition-delay: var(--d, 0ms);
  outline: none;
}
/* Silkscreen registration corner marks (Layer Stack technical print detail) */
.card::after {
  content: '';
  position: absolute;
  inset: 5px;
  border-radius: 9px;
  pointer-events: none;
  background:
    linear-gradient(90deg, rgba(127, 227, 214, 0.38) 6px, transparent 6px) 0 0 / 100% 1px no-repeat,
    linear-gradient(180deg, rgba(127, 227, 214, 0.38) 6px, transparent 6px) 0 0 / 1px 100% no-repeat,
    linear-gradient(270deg, rgba(127, 227, 214, 0.38) 6px, transparent 6px) 100% 0 / 100% 1px no-repeat,
    linear-gradient(180deg, rgba(127, 227, 214, 0.38) 6px, transparent 6px) 100% 0 / 1px 100% no-repeat,
    linear-gradient(90deg, rgba(127, 227, 214, 0.28) 6px, transparent 6px) 0 100% / 100% 1px no-repeat,
    linear-gradient(0deg, rgba(127, 227, 214, 0.28) 6px, transparent 6px) 0 100% / 1px 100% no-repeat;
  opacity: 0.55;
  transition: opacity 0.35s ease, filter 0.35s ease;
}
body.revealed .card { opacity: 1; transform: none; }
body.settled .card { transition-delay: 0ms; }
.card:hover, .card:focus-visible {
  transform: translateY(-6px) scale(1.012);
  border-color: rgba(127, 227, 214, 0.85);
  box-shadow:
    inset 0 1.5px 0 rgba(255, 255, 255, 0.52),
    inset 0 -2px 0 rgba(127, 227, 214, 0.55),
    inset 1px 0 0 rgba(127, 227, 214, 0.28),
    inset -1px 0 0 rgba(127, 227, 214, 0.28),
    0 4px 0 rgba(5, 9, 13, 0.96),
    0 30px 60px -22px rgba(0, 0, 0, 1),
    0 0 26px -3px rgba(127, 227, 214, 0.42),
    0 0 0 4px rgba(127, 227, 214, 0.09);
}
.card:hover::after, .card:focus-visible::after {
  opacity: 0.95;
}
.card.direct {
  border-color: rgba(127, 227, 214, 0.52);
  background:
    linear-gradient(135deg, rgba(234, 246, 255, 0.17) 0%, rgba(190, 225, 235, 0.05) 42%, rgba(127, 227, 214, 0.08) 78%, rgba(255, 154, 42, 0.04) 100%),
    linear-gradient(180deg, rgba(22, 29, 38, 0.82), rgba(11, 15, 21, 0.90));
  box-shadow:
    inset 0 1.5px 0 rgba(255, 255, 255, 0.38),
    inset 0 -2px 0 rgba(127, 227, 214, 0.38),
    inset 1px 0 0 rgba(127, 227, 214, 0.18),
    inset -1px 0 0 rgba(127, 227, 214, 0.18),
    0 3px 0 rgba(6, 10, 14, 0.95),
    0 24px 48px -18px rgba(0, 0, 0, 0.94),
    0 0 22px -5px rgba(127, 227, 214, 0.25);
}
.card.direct::before {
  content: ''; position: absolute; left: 16%; right: 16%; top: -1px; height: 1.5px;
  background: linear-gradient(90deg, transparent, rgba(127, 227, 214, 0.85), #ffffff, rgba(127, 227, 214, 0.85), transparent);
  box-shadow: 0 0 10px rgba(127, 227, 214, 0.65);
}
.card.collateral {
  padding: 12px 12px 12px;
  border-radius: 12px;
  border-color: rgba(127, 227, 214, 0.20);
  background:
    linear-gradient(135deg, rgba(235, 242, 252, 0.08) 0%, rgba(127, 227, 214, 0.025) 100%),
    linear-gradient(180deg, rgba(17, 22, 29, 0.74), rgba(9, 12, 17, 0.84));
}

.role {
  display: inline-flex; align-items: center; gap: 7px; justify-content: center;
  font-size: 9.5px; font-weight: 600; letter-spacing: 0.16em; text-transform: uppercase;
  color: var(--gold-2); margin-bottom: 8px; line-height: 1.35;
}
.role::before { content: ''; flex: none; width: 6px; height: 6px; border: 1px solid currentColor; opacity: 0.9; }
.f .role::before { border-radius: 50%; }
.grp .role::before { border-radius: 50%; box-shadow: 4px 0 0 -1px var(--ink-2), 4px 0 0 0 currentColor; margin-right: 4px; }
.nm { font-family: var(--geo); font-size: 17px; font-weight: 600; line-height: 1.28; color: var(--ivory); letter-spacing: 0.005em; }
.direct .nm { font-size: 18.5px; }
.collateral .nm { font-size: 15px; font-weight: 500; }
body[data-lang="en"] .nm, body[data-lang="ru"] .nm { font-family: var(--serif); font-size: 18.5px; font-weight: 600; letter-spacing: 0.005em; line-height: 1.24; }
body[data-lang="en"] .collateral .nm, body[data-lang="ru"] .collateral .nm { font-size: 16px; }
.sub { margin-top: 5px; font-size: 10px; letter-spacing: 0.13em; text-transform: uppercase; color: var(--muted); line-height: 1.45; }
body[data-lang="en"] .sub, body[data-lang="ru"] .sub { font-family: var(--geo); text-transform: none; letter-spacing: 0.01em; font-size: 12.5px; color: var(--ivory-2); }
.badge {
  display: inline-block; margin-top: 10px; padding: 3px 10px 4px;
  font-size: 10.5px; letter-spacing: 0.04em; font-variant-numeric: tabular-nums; line-height: 1.4;
  color: var(--ivory-2); border: 1px solid rgba(190, 205, 225, 0.35); border-radius: 999px;
  background: rgba(190, 205, 225, 0.08);
}
.badge.unk { color: var(--muted); border: 1px dashed rgba(226, 232, 240, 0.24); background: transparent; font-style: italic; }

/* hero (Temo, panoramic photo — Top Sheet of the Layer Stack) */
.card.hero {
  padding: 12px 12px 22px;
  border-radius: 20px;
  border-color: rgba(127, 227, 214, 0.72);
  background:
    linear-gradient(135deg, rgba(234, 246, 255, 0.22) 0%, rgba(190, 225, 235, 0.06) 45%, rgba(127, 227, 214, 0.10) 78%, rgba(255, 154, 42, 0.08) 100%),
    linear-gradient(180deg, rgba(24, 32, 42, 0.86), rgba(10, 14, 20, 0.92));
  box-shadow:
    inset 0 2px 0 rgba(255, 255, 255, 0.55),
    inset 0 -2.5px 0 rgba(127, 227, 214, 0.55),
    inset 1.5px 0 0 rgba(127, 227, 214, 0.25),
    inset -1.5px 0 0 rgba(127, 227, 214, 0.25),
    0 4px 0 rgba(5, 9, 14, 0.96),
    0 50px 90px -40px rgba(0, 0, 0, 1),
    0 0 120px -20px rgba(127, 227, 214, 0.32);
}
.hero .photo { border-radius: 11px; overflow: hidden; margin-bottom: 18px; background: #06080c; border: 1px solid rgba(226, 232, 240, 0.14); }
.hero .photo img { display: block; width: 100%; height: auto; }
.hero .nm { font-size: 27px; line-height: 1.2; }
body[data-lang="en"] .hero .nm, body[data-lang="ru"] .hero .nm { font-size: 29px; }
.hero .sub { font-size: 11px; margin-top: 7px; }
.hero .role { font-size: 10.5px; }

/* Irakli hero with arched portrait frame */
.card.hero.portrait { padding: 22px 20px 22px; }
.frame {
  position: relative; width: 170px; height: 210px; margin: 0 auto 18px;
  border-radius: 85px 85px 10px 10px; overflow: hidden;
  border: 1px solid rgba(235, 242, 252, 0.6);
  background: radial-gradient(circle at 50% 30%, rgba(190, 205, 225, 0.2), rgba(235, 242, 252, 0.03) 70%);
  box-shadow: 0 0 0 6px rgba(190, 205, 225, 0.06), inset 0 0 40px rgba(0, 0, 0, 0.5);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px;
  color: var(--gold-2);
}
.frame img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.frame span { font-family: var(--geo); font-size: 11px; line-height: 1.4; padding: 0 22px; color: var(--muted); }
.card.child { border-color: rgba(190, 205, 225, 0.5); }

/* wing + generation labels inside the world */
.wing {
  position: absolute; transform: translateX(-50%); white-space: nowrap; z-index: 1;
  font-size: 9.5px; letter-spacing: 0.2em; text-transform: uppercase; color: var(--muted);
  padding: 0 14px; opacity: 0; transition: opacity 1s var(--soft) 1.6s;
}
.wing::before, .wing::after { content: ''; position: absolute; top: 50%; width: 46px; height: 1px; background: var(--faint); }
.wing::before { right: 100%; } .wing::after { left: 100%; }
body.revealed .wing { opacity: 1; }

.legend-quote {
  position: absolute; transform: translateX(-50%); width: 820px; max-width: 90vw; text-align: center; z-index: 2; opacity: 0; transition: opacity 1.4s var(--soft) 2s;
}
body.revealed .legend-quote { opacity: 1; }
.legend-quote .eyebrow { font-size: 11px; letter-spacing: 0.22em; text-transform: uppercase; color: var(--gold-2); margin-bottom: 18px; line-height: 1.6; }
.legend-quote blockquote { font-family: var(--geo); font-size: 26px; line-height: 1.6; font-weight: 400; color: rgba(235, 242, 252, 0.88); }
.legend-quote blockquote strong { color: #ffffff; font-weight: 600; text-shadow: 0 0 16px rgba(212, 175, 55, 0.4); }
.legend-quote blockquote::before { content: '„'; display: block; font-family: var(--serif); font-size: 90px; line-height: 0.35; color: rgba(212, 175, 55, 0.45); margin: 24px auto 12px; }

.colophon { position: absolute; transform: translateX(-50%); width: 900px; text-align: center; opacity: 0; transition: opacity 1.4s var(--soft) 2.2s; }
body.revealed .colophon { opacity: 1; }
.colophon .mark { width: 1px; height: 60px; margin: 0 auto 26px; background: linear-gradient(180deg, transparent, var(--gold-2)); }
.colophon p { font-family: var(--geo); font-size: 15px; line-height: 1.8; color: var(--muted); }
.colophon .houses { margin-top: 10px; font-size: 13px; letter-spacing: 0.08em; color: var(--gold-2); }

/* focus states: Layer Stack ascending wave (white-aqua flash -> warm amber #ff9a2a edge glow) */
body.has-focus .node { opacity: 0.18; filter: saturate(0.4); }
body.has-focus .node.lit { opacity: 1; filter: none; }
body.has-focus .node.lit .card {
  border-color: rgba(255, 175, 75, 0.92);
  background:
    linear-gradient(135deg, rgba(255, 248, 235, 0.18) 0%, rgba(255, 154, 42, 0.10) 48%, rgba(127, 227, 214, 0.06) 100%),
    linear-gradient(180deg, rgba(28, 24, 20, 0.86), rgba(14, 13, 12, 0.92));
  box-shadow:
    inset 0 1.5px 0 rgba(255, 255, 255, 0.65),
    inset 0 -2px 0 rgba(255, 154, 42, 0.72),
    inset 1px 0 0 rgba(255, 154, 42, 0.32),
    inset -1px 0 0 rgba(255, 154, 42, 0.32),
    0 3px 0 rgba(18, 10, 4, 0.95),
    0 0 0 1px rgba(255, 210, 140, 0.42),
    0 0 26px rgba(255, 154, 42, 0.42),
    0 22px 50px -15px rgba(0, 0, 0, 0.88);
  animation: acrylicWave 0.72s var(--spring) var(--wave-d, 0ms) both;
}
body.has-focus.wave-b .node.lit .card {
  animation: acrylicWaveB 0.72s var(--spring) var(--wave-d, 0ms) both;
}
body.has-focus .node.lit .card.direct::before {
  background: linear-gradient(90deg, transparent, #ff9a2a, #ffffff, #ff9a2a, transparent);
  box-shadow: 0 0 14px rgba(255, 154, 42, 0.9);
}
body.has-focus .node.sel .card {
  border-color: #ffffff;
  box-shadow:
    inset 0 2px 0 #ffffff,
    inset 0 -2.5px 0 #ff9a2a,
    0 4px 0 rgba(24, 12, 4, 0.96),
    0 0 0 2px #ffffff,
    0 0 28px rgba(255, 255, 255, 0.88),
    0 0 54px rgba(255, 154, 42, 0.68),
    0 30px 70px -24px #000;
}
@keyframes acrylicWave {
  0% {
    border-color: rgba(127, 227, 214, 0.45);
    transform: translateY(0) scale(1);
    box-shadow:
      inset 0 1.5px 0 rgba(234, 246, 255, 0.3),
      inset 0 -1.5px 0 rgba(127, 227, 214, 0.3),
      0 20px 40px -18px rgba(0, 0, 0, 0.9);
  }
  42% {
    border-color: #eaf6ff;
    transform: translateY(-6px) scale(1.028);
    box-shadow:
      inset 0 2px 0 #ffffff,
      inset 0 -2.5px 0 #7fe3d6,
      0 0 0 2px rgba(234, 246, 255, 0.95),
      0 0 38px rgba(127, 227, 214, 0.88),
      0 0 64px rgba(255, 154, 42, 0.45),
      0 28px 58px -18px rgba(0, 0, 0, 0.95);
  }
  100% {
    border-color: rgba(255, 175, 75, 0.92);
    transform: translateY(0) scale(1);
    box-shadow:
      inset 0 1.5px 0 rgba(255, 255, 255, 0.65),
      inset 0 -2px 0 rgba(255, 154, 42, 0.72),
      inset 1px 0 0 rgba(255, 154, 42, 0.32),
      inset -1px 0 0 rgba(255, 154, 42, 0.32),
      0 3px 0 rgba(18, 10, 4, 0.95),
      0 0 0 1px rgba(255, 210, 140, 0.42),
      0 0 26px rgba(255, 154, 42, 0.42),
      0 22px 50px -15px rgba(0, 0, 0, 0.88);
  }
}
@keyframes acrylicWaveB {
  0% {
    border-color: rgba(127, 227, 214, 0.45);
    transform: translateY(0) scale(1);
    box-shadow:
      inset 0 1.5px 0 rgba(234, 246, 255, 0.3),
      inset 0 -1.5px 0 rgba(127, 227, 214, 0.3),
      0 20px 40px -18px rgba(0, 0, 0, 0.9);
  }
  42% {
    border-color: #eaf6ff;
    transform: translateY(-6px) scale(1.028);
    box-shadow:
      inset 0 2px 0 #ffffff,
      inset 0 -2.5px 0 #7fe3d6,
      0 0 0 2px rgba(234, 246, 255, 0.95),
      0 0 38px rgba(127, 227, 214, 0.88),
      0 0 64px rgba(255, 154, 42, 0.45),
      0 28px 58px -18px rgba(0, 0, 0, 0.95);
  }
  100% {
    border-color: rgba(255, 175, 75, 0.92);
    transform: translateY(0) scale(1);
    box-shadow:
      inset 0 1.5px 0 rgba(255, 255, 255, 0.65),
      inset 0 -2px 0 rgba(255, 154, 42, 0.72),
      inset 1px 0 0 rgba(255, 154, 42, 0.32),
      inset -1px 0 0 rgba(255, 154, 42, 0.32),
      0 3px 0 rgba(18, 10, 4, 0.95),
      0 0 0 1px rgba(255, 210, 140, 0.42),
      0 0 26px rgba(255, 154, 42, 0.42),
      0 22px 50px -15px rgba(0, 0, 0, 0.88);
  }
}
body.has-focus .wing, body.has-focus .legend-quote { opacity: 0.25; }

body.direct-only .node.k-collateral { opacity: 0 !important; pointer-events: none; }
body.direct-only .node.k-collateral .card { transform: scale(0.9); }
body.direct-only .edge.side, body.direct-only .wing { opacity: 0 !important; }

/* soft scrims so fixed chrome never sits on top of cards */
body::before, body::after { content: ''; position: fixed; left: 0; right: 0; z-index: 6; pointer-events: none; }
body::before { top: 0; height: 110px; background: linear-gradient(180deg, rgba(10, 12, 15, 0.72) 0%, rgba(10, 12, 15, 0.22) 60%, transparent 100%); }
body::after { bottom: 0; height: 200px; background: linear-gradient(0deg, rgba(10, 12, 15, 0.92) 0%, rgba(10, 12, 15, 0.55) 55%, transparent 100%); }

/* ---------- chrome ---------- */
.chrome { position: fixed; z-index: 20; opacity: 0; transition: opacity 1s var(--soft) 0.4s, transform 0.6s var(--spring); }
body.revealed .chrome { opacity: 1; }
.glass {
  background: rgba(16, 19, 24, 0.62);
  -webkit-backdrop-filter: blur(22px) saturate(1.3); backdrop-filter: blur(22px) saturate(1.3);
  border: 1px solid rgba(226, 232, 240, 0.1);
  box-shadow: 0 20px 50px -20px rgba(0, 0, 0, 0.8);
}

#masthead {
  position: fixed;
  left: 50%;
  top: 66px;
  transform: translateX(-50%);
  text-align: center;
  max-width: min(900px, calc(100vw - 120px));
  pointer-events: auto;
  cursor: pointer;
  z-index: 20;
  transition: opacity 1s var(--soft) 0.4s, transform 0.75s var(--spring), border-color 0.35s ease, box-shadow 0.45s ease, background 0.35s ease;
  padding: 12px 34px 14px;
  border-radius: 18px;
  border: 1px solid rgba(127, 227, 214, 0.22);
  background: linear-gradient(180deg, rgba(16, 22, 29, 0.64), rgba(10, 13, 18, 0.48));
  -webkit-backdrop-filter: blur(18px) saturate(1.3);
  backdrop-filter: blur(18px) saturate(1.3);
  box-shadow:
    inset 0 1px 0 rgba(234, 246, 255, 0.26),
    inset 0 -1px 0 rgba(127, 227, 214, 0.16),
    0 18px 42px -22px rgba(0, 0, 0, 0.85),
    0 0 24px -10px rgba(127, 227, 214, 0.18);
}
#masthead::before {
  content: '';
  position: absolute;
  left: 20%; right: 20%; top: -1px; height: 1.5px;
  background: linear-gradient(90deg, transparent, rgba(127, 227, 214, 0.85), #ffffff, rgba(255, 154, 42, 0.75), transparent);
  opacity: 0.75;
  transition: left 0.45s var(--spring), right 0.45s var(--spring), opacity 0.35s ease;
}
#masthead:hover {
  border-color: rgba(127, 227, 214, 0.55);
  background: linear-gradient(180deg, rgba(20, 27, 36, 0.78), rgba(11, 15, 20, 0.62));
  box-shadow:
    inset 0 1.5px 0 rgba(255, 255, 255, 0.42),
    inset 0 -1.5px 0 rgba(255, 154, 42, 0.35),
    0 22px 50px -20px rgba(0, 0, 0, 0.95),
    0 0 32px -6px rgba(127, 227, 214, 0.32);
}
#masthead:hover::before {
  left: 10%; right: 10%; opacity: 1;
}
body.has-drawer #masthead {
  transform: translateX(calc(-50% - 190px));
}
#masthead .eyebrow {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  font-size: 9.5px;
  font-weight: 600;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: rgba(127, 227, 214, 0.85);
  margin-bottom: 6px;
  line-height: 1.5;
}
#masthead .eyebrow::before,
#masthead .eyebrow::after {
  content: '';
  display: inline-block;
  width: 36px;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(127, 227, 214, 0.55));
}
#masthead .eyebrow::after {
  background: linear-gradient(90deg, rgba(255, 154, 42, 0.55), transparent);
}
#masthead h1 {
  font-family: var(--geo);
  font-weight: 500;
  font-size: 25px;
  line-height: 1.25;
  color: #ffffff;
  text-shadow: 0 2px 24px rgba(0, 0, 0, 0.95), 0 0 32px rgba(234, 246, 255, 0.25);
  letter-spacing: 0.015em;
  margin: 0;
}
body[data-lang="en"] #masthead h1, body[data-lang="ru"] #masthead h1 {
  font-family: var(--serif);
  font-size: 28px;
  font-weight: 600;
  line-height: 1.18;
  letter-spacing: 0.01em;
  background: linear-gradient(95deg, #ffffff 0%, #eaf6ff 45%, #ffe6c4 85%, #ffffff 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  filter: drop-shadow(0 2px 18px rgba(0, 0, 0, 0.92));
}
#masthead h1 .t-lead,
#masthead h1 .t-name {
  display: block;
}
#masthead h1 .t-lead {
  font-size: 0.62em;
  font-weight: 500;
  letter-spacing: 0.1em;
  opacity: 0.88;
  margin-bottom: 3px;
}
#masthead h1 .t-name {
  font-size: 1em;
}
#masthead .houses {
  display: inline-block;
  margin-top: 7px;
  font-family: var(--geo);
  font-size: 11.5px;
  color: var(--ivory-2);
  letter-spacing: 0.06em;
  line-height: 1.5;
  opacity: 0.85;
  text-shadow: 0 1px 12px rgba(0, 0, 0, 0.85);
}
body[data-lang="en"] #masthead .houses, body[data-lang="ru"] #masthead .houses {
  font-family: var(--sans);
  font-size: 11px;
  letter-spacing: 0.09em;
  color: rgba(214, 226, 238, 0.82);
}

#toolbar {
  position: fixed;
  right: 24px;
  top: 14px;
  z-index: 25;
  display: flex;
  gap: 4px;
  align-items: center;
  padding: 4px 6px;
  border-radius: 999px;
  background: rgba(13, 16, 22, 0.78);
  -webkit-backdrop-filter: blur(24px) saturate(1.4);
  backdrop-filter: blur(24px) saturate(1.4);
  border: 1px solid rgba(223, 230, 240, 0.14);
  box-shadow: 0 16px 40px -8px rgba(0, 0, 0, 0.75), inset 0 1px 0 rgba(255, 255, 255, 0.08);
}
.tb-sep {
  display: inline-block;
  width: 1px;
  height: 18px;
  background: rgba(223, 230, 240, 0.12);
  margin: 0 2px;
  flex-shrink: 0;
}
.seg { display: flex; padding: 2px; border-radius: 999px; }
.seg button {
  padding: 6px 11px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.03em;
  color: var(--muted);
  background: transparent;
  border: 1px solid transparent;
  transition: all 0.25s ease;
  white-space: nowrap;
}
.seg button:hover {
  color: var(--ivory);
  background: rgba(223, 230, 240, 0.06);
}
.seg button.on {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.16), rgba(255, 255, 255, 0.08));
  border: 1px solid rgba(223, 230, 240, 0.28);
  color: #ffffff;
  font-weight: 600;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.2);
  text-shadow: 0 0 10px rgba(255, 255, 255, 0.4);
}
.pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 13px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.04em;
  color: var(--ivory-2);
  background: transparent;
  border: 1px solid transparent;
  transition: all 0.25s ease;
  white-space: nowrap;
}
.pill:hover {
  color: var(--ivory);
  background: rgba(223, 230, 240, 0.06);
}
.pill .dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  border: 1.5px solid rgba(223, 230, 240, 0.45);
  background: transparent;
  transition: all 0.3s ease;
}
.pill.on {
  background: rgba(56, 189, 248, 0.12);
  border-color: rgba(56, 189, 248, 0.35);
  color: #bae6fd;
}
.pill.on .dot {
  background: #38bdf8;
  border-color: #38bdf8;
  box-shadow: 0 0 10px #38bdf8;
}
#btn-sound.pill.on {
  background: rgba(127, 227, 214, 0.13);
  border-color: rgba(127, 227, 214, 0.42);
  color: #d5faf4;
}
#btn-sound.pill.on .dot {
  background: #7fe3d6;
  border-color: #7fe3d6;
  box-shadow: 0 0 10px #7fe3d6, 0 0 18px rgba(255, 154, 42, 0.45);
}
.pill.gift {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 6px 14px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.05em;
  color: #fed7aa;
  background: linear-gradient(135deg, rgba(249, 115, 22, 0.18), rgba(225, 29, 72, 0.12));
  border: 1px solid rgba(249, 115, 22, 0.42);
  box-shadow: 0 4px 14px -2px rgba(249, 115, 22, 0.25), inset 0 1px 0 rgba(254, 215, 170, 0.25);
  transition: all 0.3s ease;
  text-decoration: none;
}
.pill.gift:hover {
  color: #ffffff;
  background: linear-gradient(135deg, rgba(249, 115, 22, 0.3), rgba(225, 29, 72, 0.22));
  border-color: rgba(249, 115, 22, 0.75);
  box-shadow: 0 0 20px rgba(249, 115, 22, 0.45), inset 0 1px 0 rgba(255, 255, 255, 0.4);
  transform: translateY(-0.5px);
}
.pill.gift .gift-star {
  color: #f97316;
  text-shadow: 0 0 8px #f97316;
}
.pill.gift .gift-arrow {
  color: rgba(254, 215, 170, 0.7);
  transition: transform 0.25s ease;
}
.pill.gift:hover .gift-arrow {
  transform: translateX(2px);
  color: #fff;
}
.pill.gift-badge {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 6px 14px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.05em;
  color: #fef08a;
  background: linear-gradient(135deg, rgba(234, 179, 8, 0.16), rgba(168, 85, 247, 0.14));
  border: 1px solid rgba(234, 179, 8, 0.42);
  box-shadow: 0 4px 14px -2px rgba(234, 179, 8, 0.25), inset 0 1px 0 rgba(254, 240, 138, 0.25);
  pointer-events: none;
  white-space: nowrap;
}
.pill.gift-badge .badge-icon {
  color: #eab308;
  text-shadow: 0 0 8px #eab308;
}

#rail { left: 0; top: 0; bottom: 0; width: 0; pointer-events: none; }
.gen {
  position: absolute; left: 34px; top: 0; display: flex; align-items: baseline; gap: 12px; white-space: nowrap;
  transition: opacity 0.4s; pointer-events: auto; cursor: pointer;
}
.gen b { font-family: var(--serif); font-weight: 500; font-size: 22px; color: var(--gold); min-width: 26px; text-align: left; }
.gen span { font-size: 10px; letter-spacing: 0.18em; text-transform: uppercase; color: var(--muted); width: 210px; white-space: normal; text-shadow: 0 0 12px #0a0c0f, 0 0 4px #0a0c0f; line-height: 1.5; transition: color 0.3s; }
.gen:hover span { color: var(--ivory); }
.gen::after { content: ''; position: absolute; left: -34px; top: 50%; width: 22px; height: 1px; background: var(--gold-2); opacity: 0.6; }

#legend { left: 34px; bottom: 28px; display: flex; flex-direction: column; gap: 7px; font-size: 10.5px; letter-spacing: 0.06em; color: var(--muted); pointer-events: none; }
#legend i { display: inline-block; width: 26px; height: 2px; border-radius: 2px; margin-right: 10px; vertical-align: middle; }
#legend .shapes { margin-top: 5px; display: flex; gap: 16px; }
#legend .shapes em { font-style: normal; display: inline-flex; gap: 7px; align-items: center; }
#legend .shapes em::before { content: ''; width: 7px; height: 7px; border: 1px solid var(--gold-2); }
#legend .shapes em.fe::before { border-radius: 50%; }

#zoom { right: 28px; bottom: 26px; display: flex; align-items: center; border-radius: 999px; padding: 4px; }
#zoom button { width: 36px; height: 36px; border-radius: 50%; font-size: 17px; color: var(--ivory-2); display: grid; place-items: center; transition: background 0.3s, color 0.3s; }
#zoom button:hover { background: rgba(226, 232, 240, 0.1); color: var(--ivory); }
#zoom svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
#zoom output { min-width: 46px; text-align: center; font-size: 10.5px; letter-spacing: 0.08em; color: var(--muted); font-variant-numeric: tabular-nums; }
#hint { left: 50%; bottom: 32px; transform: translateX(-50%); font-size: 10.5px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--muted); pointer-events: none; white-space: nowrap; transition: opacity 0.8s; }
body.has-drawer #hint, body.used #hint { opacity: 0 !important; }
body.has-drawer #toolbar, body.has-drawer #zoom { transform: translateX(calc(-1 * var(--drawer-w) - 8px)); }

/* ---------- dossier drawer (Layer Stack edge-lit acrylic dossier) ---------- */
#drawer {
  position: fixed; z-index: 30; top: 14px; right: 14px; bottom: 14px; width: var(--drawer-w);
  border-radius: 22px; overflow: hidden;
  background:
    radial-gradient(480px 320px at var(--dmx, 50%) var(--dmy, 18%), rgba(127, 227, 214, 0.11), rgba(255, 154, 42, 0.05) 45%, transparent 72%),
    linear-gradient(155deg, rgba(26, 33, 42, 0.86), rgba(10, 13, 18, 0.93));
  -webkit-backdrop-filter: blur(30px) saturate(1.4); backdrop-filter: blur(30px) saturate(1.4);
  border: 1px solid rgba(127, 227, 214, 0.42);
  box-shadow:
    inset 0 1.5px 0 rgba(255, 255, 255, 0.35),
    inset 0 -2px 0 rgba(255, 154, 42, 0.45),
    inset 1px 0 0 rgba(127, 227, 214, 0.22),
    inset -1px 0 0 rgba(255, 154, 42, 0.18),
    -30px 0 90px -30px #000,
    0 0 36px -8px rgba(127, 227, 214, 0.28),
    0 0 60px -18px rgba(255, 154, 42, 0.22);
  transform: translateX(calc(100% + 30px)); opacity: 0;
  transition: transform 0.75s var(--spring), opacity 0.45s var(--soft), border-color 0.4s ease, box-shadow 0.45s ease;
  display: flex; flex-direction: column;
}
#drawer::after {
  content: '';
  position: absolute;
  inset: 8px;
  border-radius: 15px;
  pointer-events: none;
  z-index: 2;
  background:
    linear-gradient(90deg, rgba(127, 227, 214, 0.45) 10px, transparent 10px) 0 0 / 100% 1px no-repeat,
    linear-gradient(180deg, rgba(127, 227, 214, 0.45) 10px, transparent 10px) 0 0 / 1px 100% no-repeat,
    linear-gradient(270deg, rgba(255, 154, 42, 0.45) 10px, transparent 10px) 100% 0 / 100% 1px no-repeat,
    linear-gradient(180deg, rgba(255, 154, 42, 0.45) 10px, transparent 10px) 100% 0 / 1px 100% no-repeat,
    linear-gradient(90deg, rgba(255, 154, 42, 0.35) 10px, transparent 10px) 0 100% / 100% 1px no-repeat,
    linear-gradient(0deg, rgba(255, 154, 42, 0.35) 10px, transparent 10px) 0 100% / 1px 100% no-repeat,
    linear-gradient(270deg, rgba(127, 227, 214, 0.35) 10px, transparent 10px) 100% 100% / 100% 1px no-repeat,
    linear-gradient(0deg, rgba(127, 227, 214, 0.35) 10px, transparent 10px) 100% 100% / 1px 100% no-repeat;
  opacity: 0.72;
}
body.has-drawer #drawer {
  transform: none;
  opacity: 1;
  animation: drawerFrameFlash 0.85s var(--spring) both;
}
body.has-drawer.wave-b #drawer {
  animation: drawerFrameFlashB 0.85s var(--spring) both;
}
@keyframes drawerFrameFlash {
  0% {
    border-color: #eaf6ff;
    box-shadow: inset 0 2px 0 #ffffff, inset 0 -2px 0 #7fe3d6, -30px 0 90px -30px #000, 0 0 46px rgba(127, 227, 214, 0.55);
  }
  100% {
    border-color: rgba(255, 175, 75, 0.62);
    box-shadow: inset 0 1.5px 0 rgba(255, 255, 255, 0.42), inset 0 -2px 0 rgba(255, 154, 42, 0.62), inset 1px 0 0 rgba(255, 154, 42, 0.25), inset -1px 0 0 rgba(127, 227, 214, 0.24), -30px 0 90px -30px #000, 0 0 38px -6px rgba(255, 154, 42, 0.34), 0 0 26px -8px rgba(127, 227, 214, 0.22);
  }
}
@keyframes drawerFrameFlashB {
  0% {
    border-color: #eaf6ff;
    box-shadow: inset 0 2px 0 #ffffff, inset 0 -2px 0 #7fe3d6, -30px 0 90px -30px #000, 0 0 46px rgba(127, 227, 214, 0.55);
  }
  100% {
    border-color: rgba(255, 175, 75, 0.62);
    box-shadow: inset 0 1.5px 0 rgba(255, 255, 255, 0.42), inset 0 -2px 0 rgba(255, 154, 42, 0.62), inset 1px 0 0 rgba(255, 154, 42, 0.25), inset -1px 0 0 rgba(127, 227, 214, 0.24), -30px 0 90px -30px #000, 0 0 38px -6px rgba(255, 154, 42, 0.34), 0 0 26px -8px rgba(127, 227, 214, 0.22);
  }
}
#drawer .close { position: absolute; right: 16px; top: 16px; z-index: 3; width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; color: var(--ivory-2); background: rgba(10, 12, 15, 0.5); border: 1px solid rgba(127, 227, 214, 0.28); transition: transform 0.5s var(--spring), color 0.3s, border-color 0.3s, box-shadow 0.3s; }
#drawer .close:hover { transform: rotate(90deg); color: #ffffff; border-color: #ff9a2a; box-shadow: 0 0 14px rgba(255, 154, 42, 0.45); }
#drawer .scroll { overflow-y: auto; overscroll-behavior: contain; padding: 38px 34px 34px; flex: 1; scrollbar-width: thin; scrollbar-color: rgba(127, 227, 214, 0.25) transparent; }
#drawer .d-photo { margin: -38px -34px 28px; position: relative; }
#drawer .d-photo img { display: block; width: 100%; height: auto; }
#drawer .d-photo::after { content: ''; position: absolute; inset: auto 0 0 0; height: 45%; background: linear-gradient(180deg, transparent, rgba(12, 15, 19, 0.92)); }
.d-in > * { opacity: 0; transform: translateY(14px); animation: rise 0.7s var(--spring) forwards; animation-delay: calc(var(--i, 0) * 55ms + 120ms); }
@keyframes rise { to { opacity: 1; transform: none; } }
.d-role { font-size: 10px; letter-spacing: 0.22em; text-transform: uppercase; color: rgba(127, 227, 214, 0.9); margin-bottom: 14px; padding-right: 40px; line-height: 1.6; }
.d-name { font-family: var(--geo); font-size: 28px; font-weight: 500; line-height: 1.28; color: #ffffff; text-shadow: 0 2px 18px rgba(0, 0, 0, 0.55); }
body[data-lang="en"] .d-name, body[data-lang="ru"] .d-name { font-family: var(--serif); font-size: 30px; font-weight: 600; line-height: 1.2; }
.d-alt { margin-top: 10px; font-family: var(--serif); font-size: 15.5px; font-style: italic; color: var(--muted); line-height: 1.4; }
.d-badge { margin-top: 16px; }
.d-rule { height: 1.5px; margin: 24px 0 22px; background: linear-gradient(90deg, #ff9a2a, rgba(127, 227, 214, 0.65), transparent); opacity: 0.85; box-shadow: 0 0 12px rgba(255, 154, 42, 0.35); }
.d-row { margin-bottom: 18px; font-family: var(--geo); font-size: 15px; line-height: 1.75; color: rgba(226, 232, 240, 0.92); }
body[data-lang="en"] .d-row, body[data-lang="ru"] .d-row { font-family: var(--sans); font-size: 14.5px; line-height: 1.68; }
.d-row .lbl, .d-row .tt-label { font-family: var(--sans); font-size: 10px; font-weight: 600; letter-spacing: 0.13em; text-transform: uppercase; color: rgba(127, 227, 214, 0.9); }
.d-row .lbl { display: block; margin-bottom: 5px; }
.d-row strong { color: #ffffff; font-weight: 600; }
.d-row.story {
  position: relative;
  padding: 18px 20px;
  border-radius: 14px;
  background: linear-gradient(135deg, rgba(255, 154, 42, 0.08), rgba(127, 227, 214, 0.05) 55%, rgba(16, 20, 26, 0.55));
  border: 1px solid rgba(255, 175, 75, 0.28);
  box-shadow: inset 3px 0 0 #ff9a2a, inset 0 1px 0 rgba(255, 255, 255, 0.1), 0 12px 28px -14px rgba(0, 0, 0, 0.7);
}
.d-kin { margin-top: 26px; }
.d-kin h4 { font-size: 10px; font-weight: 600; letter-spacing: 0.18em; text-transform: uppercase; color: rgba(127, 227, 214, 0.78); margin: 18px 0 9px; }
.chips { display: flex; flex-wrap: wrap; gap: 7px; }
.chip {
  font-family: var(--geo); font-size: 12.5px; padding: 6px 12px 7px; border-radius: 999px;
  border: 1px solid rgba(127, 227, 214, 0.24);
  background: rgba(127, 227, 214, 0.04);
  color: var(--ivory-2);
  transition: border-color 0.3s, color 0.3s, background 0.3s, box-shadow 0.3s, transform 0.4s var(--spring);
}
body[data-lang="en"] .chip, body[data-lang="ru"] .chip { font-family: var(--sans); font-size: 12.5px; }
.chip:hover {
  border-color: #ff9a2a;
  color: #ffffff;
  background: rgba(255, 154, 42, 0.14);
  box-shadow: 0 0 16px rgba(255, 154, 42, 0.32);
  transform: translateY(-2px);
}
.d-line { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; padding: 10px 12px; border-radius: 12px; background: rgba(10, 14, 20, 0.45); border: 1px solid rgba(255, 154, 42, 0.2); }
.d-line .arrow { color: #ff9a2a; font-size: 12px; text-shadow: 0 0 8px rgba(255, 154, 42, 0.65); }

/* ---------- intro curtain ---------- */
#curtain {
  position: fixed; inset: 0; z-index: 60; display: grid; place-items: center; text-align: center; padding: 30px;
  background: radial-gradient(ellipse at 50% 40%, #161a21 0%, #08090c 70%);
  transition: opacity 1.3s var(--soft), visibility 1.3s;
}
#curtain.gone { opacity: 0; visibility: hidden; pointer-events: none; }
#curtain .in > * { opacity: 0; transform: translateY(16px); animation: rise 1.1s var(--spring) forwards; }
#curtain .c-eyebrow { font-size: 11px; letter-spacing: 0.34em; text-transform: uppercase; color: var(--gold-2); animation-delay: 0.15s; }
#curtain .c-rule { width: 1px; height: 54px; margin: 22px auto; background: linear-gradient(180deg, var(--gold), transparent); animation-delay: 0.3s; }
#curtain h2 { font-family: var(--geo); font-weight: 400; font-size: clamp(28px, 4.6vw, 58px); line-height: 1.25; color: var(--ivory); max-width: 16em; animation-delay: 0.45s; }
#curtain .c-sub { margin-top: 20px; font-family: var(--geo); font-size: 14px; color: var(--muted); letter-spacing: 0.05em; animation-delay: 0.7s; line-height: 1.7; }

.mobile-only { display: none !important; }

@media (max-width: 900px) {
  :root { --drawer-w: 100vw; }
  .mobile-only { display: inline-flex !important; }
  #sukhumi-bg {
    -webkit-mask-image: linear-gradient(180deg, transparent 6%, #000 24%, #000 76%, transparent 94%);
    mask-image: linear-gradient(180deg, transparent 6%, #000 24%, #000 76%, transparent 94%);
  }
  #sukhumi-bg .sk-layer {
    -webkit-mask-size: 165% auto;
    mask-size: 165% auto;
    -webkit-mask-position: center 45%;
    mask-position: center 45%;
  }
  #sukhumi-bg .sk-base { filter: brightness(1.35); }
  #viewport::after {
    content: '';
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 3;
    opacity: 0;
    transition: opacity 0.28s ease;
    background: radial-gradient(
      240px circle at var(--mx, 50%) var(--my, 50%),
      rgba(254, 215, 170, 0.24) 0%,
      rgba(249, 115, 22, 0.11) 44%,
      transparent 76%
    );
    mix-blend-mode: screen;
  }
  body[data-light="opal"] #viewport::after {
    background: radial-gradient(
      240px circle at var(--mx, 50%) var(--my, 50%),
      rgba(236, 72, 153, 0.22) 0%,
      rgba(168, 85, 247, 0.12) 44%,
      transparent 76%
    );
  }
  body[data-light="promenade"] #viewport::after {
    background: radial-gradient(
      240px circle at var(--mx, 50%) var(--my, 50%),
      var(--prom-c1, rgba(254, 215, 170, 0.24)) 0%,
      var(--prom-c2, rgba(249, 115, 22, 0.11)) 44%,
      transparent 76%
    );
  }
  body.touch-active #viewport::after { opacity: 1; }
  body[data-light="sunset"] #sukhumi-bg .sk-glint,
  body:not([data-light]) #sukhumi-bg .sk-glint {
    background:
      radial-gradient(
        340px circle at var(--mx, 50%) var(--my, 44%),
        rgba(255, 255, 255, 1) 0%,
        rgba(254, 215, 170, 0.95) 18%,
        rgba(249, 115, 22, 0.92) 40%,
        rgba(225, 29, 72, 0.55) 64%,
        transparent 100%
      ),
      radial-gradient(
        150px circle at var(--mx, 50%) var(--my, 44%),
        #ffffff 0%,
        rgba(253, 186, 116, 0.9) 48%,
        transparent 100%
      );
  }
  body[data-light="opal"] #sukhumi-bg .sk-glint {
    background:
      radial-gradient(
        360px circle at var(--mx, 50%) var(--my, 44%),
        #ffffff 0%,
        rgba(254, 240, 138, 0.95) 14%,
        rgba(249, 115, 22, 0.88) 28%,
        rgba(236, 72, 153, 0.84) 46%,
        rgba(168, 85, 247, 0.8) 65%,
        rgba(6, 182, 212, 0.68) 84%,
        transparent 100%
      );
  }
  body[data-light="promenade"] #sukhumi-bg .sk-glint {
    background:
      radial-gradient(
        340px circle at var(--mx, 50%) var(--my, 44%),
        #ffffff 0%,
        var(--prom-c1, rgba(254, 215, 170, 0.95)) 18%,
        var(--prom-c2, rgba(249, 115, 22, 0.9)) 42%,
        var(--prom-c3, rgba(225, 29, 72, 0.75)) 68%,
        transparent 100%
      );
  }
  #masthead {
    left: 50%;
    transform: translateX(-50%);
    top: max(10px, env(safe-area-inset-top, 10px));
    width: calc(100vw - 28px);
    max-width: 100vw;
    padding: 6px 12px;
  }
  body.has-drawer #masthead {
    opacity: 0;
    pointer-events: none;
    transform: translateX(-50%) translateY(-10px);
  }
  #masthead h1 { font-size: 17px; }
  body[data-lang="en"] #masthead h1, body[data-lang="ru"] #masthead h1 { font-size: 19px; }
  #masthead .houses, #legend, #hint, .gen span { display: none; }
  #toolbar {
    left: 50%;
    right: auto;
    top: auto;
    bottom: max(12px, env(safe-area-inset-bottom, 12px));
    transform: translateX(-50%);
    max-width: calc(100vw - 16px);
    justify-content: center;
    gap: 2px;
    padding: 4px 6px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  .pill, .seg button, #light-switcher button { padding: 7px 9px; min-height: 36px; }
  .pill.gift span.long, .pill.gift-badge span.long, #btn-direct .txt, #btn-sound .txt, #light-switcher .l-txt { display: none; }
  #zoom { display: none; }
  .gen { left: 10px; } .gen::after { display: none; }
  .card { touch-action: manipulation; }
  .card:hover { transform: none; }
  #drawer {
    top: auto; left: 0; right: 0; bottom: 0; width: auto;
    max-height: 60vh;
    border-radius: 22px 22px 0 0;
    transform: translateY(105%);
  }
  #drawer::before {
    content: '';
    position: absolute;
    top: 8px; left: 50%;
    transform: translateX(-50%);
    width: 38px; height: 4px;
    border-radius: 99px;
    background: rgba(226, 232, 240, 0.35);
    z-index: 4;
    pointer-events: none;
  }
  #drawer .scroll { padding: 30px 22px max(28px, env(safe-area-inset-bottom, 28px)); }
  #drawer .d-photo { margin: -30px -22px 20px; }
  .d-name { font-size: 24px; }
  body.has-drawer #toolbar { transform: translateX(-50%); opacity: 0; pointer-events: none; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: 0.01ms !important; animation-duration: 0.01ms !important; animation-delay: 0ms !important; transition-delay: 0ms !important; }
}

/* =====================================================================
   Polish pass (2026-11-15): overlaps, legibility, mobile, intro.
   Same visual language; overrides only.
   ===================================================================== */

/* perf: 70+ cards each blurring the backdrop was the heaviest paint on phones.
   A slightly denser slab looks the same on the dark canvas and stays smooth. */
.card {
  -webkit-backdrop-filter: none; backdrop-filter: none;
  background:
    linear-gradient(135deg, rgba(234, 246, 255, 0.13) 0%, rgba(234, 246, 255, 0.025) 38%, rgba(127, 227, 214, 0.045) 75%, rgba(255, 154, 42, 0.025) 100%),
    linear-gradient(180deg, rgba(20, 26, 34, 0.94), rgba(10, 14, 19, 0.97));
}
.card.direct {
  background:
    linear-gradient(135deg, rgba(234, 246, 255, 0.17) 0%, rgba(190, 225, 235, 0.05) 42%, rgba(127, 227, 214, 0.08) 78%, rgba(255, 154, 42, 0.04) 100%),
    linear-gradient(180deg, rgba(22, 29, 38, 0.95), rgba(11, 15, 21, 0.97));
}
.card.collateral {
  background:
    linear-gradient(135deg, rgba(235, 242, 252, 0.08) 0%, rgba(127, 227, 214, 0.025) 100%),
    linear-gradient(180deg, rgba(17, 22, 29, 0.92), rgba(9, 12, 17, 0.95));
}
.card.hero {
  background:
    linear-gradient(135deg, rgba(234, 246, 255, 0.22) 0%, rgba(190, 225, 235, 0.06) 45%, rgba(127, 227, 214, 0.10) 78%, rgba(255, 154, 42, 0.08) 100%),
    linear-gradient(180deg, rgba(24, 32, 42, 0.96), rgba(10, 14, 20, 0.98));
}

/* legibility floor */
.role { font-size: 10px; letter-spacing: 0.12em; }
.hero .role { font-size: 11px; }
.badge { font-size: 11px; }
#zoom output { font-size: 11px; }

/* masthead: one title, no duplicate eyebrow, solid text in every language */
#masthead { top: 64px; padding: 10px 32px 12px; }
#masthead .eyebrow { display: none; }
body[data-lang="en"] #masthead h1, body[data-lang="ru"] #masthead h1 {
  background: none; -webkit-background-clip: border-box; background-clip: border-box;
  color: #ffffff; filter: none;
  text-shadow: 0 2px 24px rgba(0, 0, 0, 0.95), 0 0 32px rgba(234, 246, 255, 0.25);
}
@media (min-width: 901px) {
  body.has-drawer #masthead {
    left: calc((100vw - var(--drawer-w) - 14px) / 2);
    transform: translateX(-50%);
    max-width: min(900px, calc(100vw - var(--drawer-w) - 70px));
  }
}
@media (min-width: 901px) and (max-width: 1420px) {
  body.has-drawer #toolbar { transform: none; opacity: 0; pointer-events: none; }
}

/* toolbar icons (replace emoji and anonymous dots) */
.l-ico, .p-ico { width: 14px; height: 14px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.2; stroke-linecap: round; stroke-linejoin: round; }
#light-switcher button { display: inline-flex; align-items: center; gap: 6px; }
#light-switcher button.on .l-ico, .pill.on .p-ico { filter: drop-shadow(0 0 5px currentColor); }
#btn-sound .wv { transition: opacity 0.3s ease; }
#btn-sound:not(.on) .wv { opacity: 0.2; }

/* legend: its own quiet plate, so cards never show through the text */
#legend {
  left: 24px; bottom: 22px; padding: 12px 18px 12px 14px; border-radius: 16px;
  font-size: 11px; color: var(--ivory-2);
  background: rgba(13, 16, 22, 0.82);
  -webkit-backdrop-filter: blur(18px) saturate(1.3); backdrop-filter: blur(18px) saturate(1.3);
  border: 1px solid rgba(223, 230, 240, 0.12);
  box-shadow: 0 16px 40px -12px rgba(0, 0, 0, 0.75), inset 0 1px 0 rgba(255, 255, 255, 0.07);
}
@media (max-height: 640px) { #legend { display: none; } }

/* generation rail: caption steps aside when a card is underneath */
.gen b { text-shadow: 0 0 10px #0a0c0f, 0 0 3px #0a0c0f; }
.gen span { transition: opacity 0.3s ease, color 0.3s; }
.gen.tight span { opacity: 0; pointer-events: none; }
.gen.tight::after { opacity: 0.25; }

/* Irakli portrait: monogram until a photo (irakli.jpg) is added */
.frame .mono {
  font-family: var(--geo); font-weight: 300; font-size: 104px; line-height: 1; font-style: normal;
  color: rgba(234, 246, 255, 0.92);
  text-shadow: 0 0 34px rgba(127, 227, 214, 0.5), 0 2px 18px rgba(0, 0, 0, 0.8);
}

#hint-m { display: none; }

/* ---------- phones and tablets ---------- */
@media (max-width: 900px) {
  #masthead { top: max(10px, env(safe-area-inset-top, 10px)); padding: 8px 14px 9px; border-radius: 16px; }
  #masthead h1 .t-lead { font-size: 0.66em; margin-bottom: 1px; }
  #toolbar {
    transform: translateX(-50%); overflow: visible; gap: 1px; padding: 4px 5px;
    max-width: calc(100vw - 12px);
  }
  .tb-sep { margin: 0 1px; }
  .pill, .seg button, #light-switcher button { min-width: 38px; min-height: 38px; padding: 7px 8px; justify-content: center; }
  #lang button { min-width: 36px; padding: 7px 6px; }
  /* gift link leaves the crowded bar and sits above it with its full label */
  #toolbar .pill.gift, #toolbar .pill.gift-badge {
    position: absolute; left: 50%; bottom: calc(100% + 10px); transform: translateX(-50%);
    min-height: 34px; padding: 6px 14px;
    -webkit-backdrop-filter: blur(18px); backdrop-filter: blur(18px);
    background-color: rgba(13, 16, 22, 0.72);
  }
  #toolbar .pill.gift:hover { transform: translateX(-50%); }
  #toolbar .pill.gift span.long, #toolbar .pill.gift-badge span.long { display: inline; }
  #toolbar .pill.gift + .tb-sep, #toolbar .pill.gift-badge + .tb-sep { display: none; }
  #hint-m {
    display: block; left: 50%; transform: translateX(-50%);
    bottom: calc(max(12px, env(safe-area-inset-bottom, 12px)) + 104px);
    max-width: calc(100vw - 24px); padding: 7px 14px; border-radius: 16px;
    font-size: 11px; letter-spacing: 0.03em; line-height: 1.45; color: var(--ivory-2); white-space: normal; text-align: center; width: max-content;
    background: rgba(13, 16, 22, 0.82); border: 1px solid rgba(223, 230, 240, 0.14);
    pointer-events: none; transition: opacity 0.6s ease;
  }
  body.used #hint-m, body.has-focus #hint-m, body.has-drawer #hint-m { opacity: 0 !important; }
  #drawer { max-height: 62vh; max-height: 62dvh; }
  .gen b { font-size: 18px; }
}
@media (max-width: 560px) {
  #light-switcher button:not(.on) { display: none; }
}
@media (max-width: 350px) {
  .pill, .seg button, #light-switcher button { min-width: 34px; padding: 7px 6px; }
  #lang button { min-width: 32px; padding: 7px 4px; }
  #masthead h1 { font-size: 15.5px; }
}
/* phones held sideways: dossier becomes a side sheet, title shrinks to one line */
@media (max-width: 900px) and (max-height: 480px) and (orientation: landscape) {
  #masthead { padding: 5px 14px 6px; width: auto; max-width: 62vw; }
  #masthead h1 .t-lead { display: none; }
  #hint-m { display: none; }
  #drawer {
    top: 0; bottom: 0; left: auto; right: 0; width: min(420px, 56vw);
    max-height: none; border-radius: 20px 0 0 20px; transform: translateX(105%);
  }
  #drawer::before { display: none; }
  body.has-drawer #masthead { opacity: 1; pointer-events: auto; left: calc((100vw - min(420px, 56vw)) / 2); transform: translateX(-50%); max-width: 40vw; }
}

/* ---------- intro: the engraving is lit by a passing beam, the thread of the line
   rises through five generations and blooms into the name ---------- */
#curtain {
  display: block; padding: 0; overflow: hidden; cursor: pointer; --s: 1;
  background: radial-gradient(ellipse at 50% 58%, #141a22 0%, #08090c 72%);
}
#curtain.fast { --s: 0.34; }
#curtain .c-eng {
  position: absolute; inset: -10px; opacity: 0;
  -webkit-mask: url('sukhumi_contours.webp?v=7') center / cover no-repeat;
  mask: url('sukhumi_contours.webp?v=7') center / cover no-repeat;
}
#curtain .c-eng::before, #curtain .c-eng::after { content: ''; position: absolute; inset: 0; }
#curtain .c-eng::before {
  opacity: 0;
  background: linear-gradient(90deg, rgba(111, 168, 199, 0.5), rgba(223, 230, 240, 0.3) 30%, rgba(223, 230, 240, 0.3) 70%, rgba(163, 148, 224, 0.5));
}
#curtain .c-eng::after {
  background: linear-gradient(100deg, transparent 40%, rgba(127, 227, 214, 0.8) 47%, #ffffff 50%, rgba(163, 148, 224, 0.85) 53%, transparent 60%);
  background-size: 340% 100%; background-position: 115% 0; mix-blend-mode: screen;
}
#curtain.play .c-eng { animation: cIn calc(var(--s) * 1s) ease both; }
#curtain.play .c-eng::before { animation: cBase calc(var(--s) * 3s) calc(var(--s) * 0.9s) ease both; }
#curtain.play .c-eng::after { animation: cBeam calc(var(--s) * 3.6s) calc(var(--s) * 0.15s) cubic-bezier(0.45, 0, 0.25, 1) both; }
@keyframes cIn { to { opacity: 1; } }
@keyframes cBase { to { opacity: 0.5; } }
@keyframes cBeam { from { background-position: 115% 0; } to { background-position: -15% 0; } }

#curtain .in {
  position: absolute; left: 0; right: 0; top: 0; height: 54%;
  display: flex; flex-direction: column; align-items: center; justify-content: flex-end;
  padding: 0 24px 30px; text-align: center;
}
#curtain .in > * { opacity: 0; transform: none; animation: none; }
#curtain .c-eyebrow { color: rgba(127, 227, 214, 0.85); font-size: 11px; letter-spacing: 0.34em; line-height: 1.7; margin-bottom: 16px; }
#curtain h2 {
  font-size: clamp(25px, 4.4vw, 54px); font-weight: 400; line-height: 1.22; color: #ffffff; max-width: 18em;
  text-shadow: 0 0 40px rgba(234, 246, 255, 0.28), 0 2px 26px rgba(0, 0, 0, 0.9);
}
body[data-lang="en"] #curtain h2, body[data-lang="ru"] #curtain h2 { font-family: var(--serif); font-weight: 500; }
#curtain .c-sub {
  opacity: 1; margin-top: 18px; display: flex; flex-wrap: wrap; justify-content: center; row-gap: 4px;
  font-size: 13px; letter-spacing: 0.06em; color: var(--ivory-2); max-width: 56em;
}
body[data-lang="en"] #curtain .c-sub, body[data-lang="ru"] #curtain .c-sub { font-family: var(--sans); font-size: 12px; letter-spacing: 0.1em; }
#curtain .c-sub span { opacity: 0; display: inline-block; }
#curtain .c-sub span + span::before { content: '\00B7'; margin: 0 0.7em; color: var(--gold-2); }
#curtain.play .c-eyebrow { animation: cRise calc(var(--s) * 1.1s) calc(var(--s) * 2.5s) var(--spring) both; }
#curtain.play h2 { animation: cTitle calc(var(--s) * 1.6s) calc(var(--s) * 3.1s) cubic-bezier(0.2, 0.8, 0.2, 1) both; }
#curtain.play .c-sub span { animation: cRise calc(var(--s) * 0.9s) calc(var(--s) * (3.75s + var(--k, 0) * 0.09s)) var(--spring) both; }
@keyframes cRise { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }
@keyframes cTitle {
  from { opacity: 0; filter: blur(14px); letter-spacing: 0.16em; transform: translateY(8px) scale(0.985); }
  to { opacity: 1; filter: blur(0); letter-spacing: 0.015em; transform: none; }
}

#curtain .c-thread {
  position: absolute; left: 50%; bottom: 0; height: 46%; aspect-ratio: 240 / 400;
  transform: translateX(-50%); overflow: visible;
}
.c-trunk, .c-twig { fill: none; stroke-linecap: round; stroke-dasharray: 1; stroke-dashoffset: 1; }
.c-trunk { stroke: #eaf6ff; stroke-width: 1.5; filter: drop-shadow(0 0 5px rgba(127, 227, 214, 0.9)) drop-shadow(0 0 14px rgba(127, 227, 214, 0.45)); }
.c-twig { stroke: rgba(127, 227, 214, 0.7); stroke-width: 1; }
.c-ring { fill: #0a0c0f; stroke: #eaf6ff; stroke-width: 1.3; transform-box: fill-box; transform-origin: center; transform: scale(0); opacity: 0; }
.c-leaf { fill: #dfe6f0; opacity: 0; }
.c-thread text { font-family: var(--serif); font-size: 11px; letter-spacing: 0.08em; fill: rgba(170, 182, 198, 0.95); opacity: 0; }
.c-bloom {
  fill: #ffffff; transform-box: fill-box; transform-origin: center; transform: scale(0);
  filter: drop-shadow(0 0 8px #ffffff) drop-shadow(0 0 22px rgba(127, 227, 214, 0.95)) drop-shadow(0 0 40px rgba(255, 154, 42, 0.55));
}
#curtain.play .c-trunk { animation: cDraw calc(var(--s) * 2.6s) calc(var(--s) * 0.5s) cubic-bezier(0.45, 0, 0.3, 1) forwards; }
#curtain.play .c-ring { animation: cPop calc(var(--s) * 0.75s) calc(var(--s) * (0.95s + var(--g) * 0.42s)) var(--spring) forwards; }
#curtain.play .c-twig { animation: cDraw calc(var(--s) * 0.9s) calc(var(--s) * (1.05s + var(--g) * 0.42s)) ease-out forwards; }
#curtain.play .c-leaf, #curtain.play .c-thread text { animation: cIn calc(var(--s) * 0.7s) calc(var(--s) * (1.55s + var(--g) * 0.42s)) ease forwards; }
#curtain.play .c-bloom { animation: cBloom calc(var(--s) * 1.2s) calc(var(--s) * 3s) var(--spring) forwards; }
@keyframes cDraw { to { stroke-dashoffset: 0; } }
@keyframes cPop {
  0% { transform: scale(0); opacity: 0; }
  55% { transform: scale(1.8); opacity: 1; fill: #7fe3d6; }
  100% { transform: scale(1); opacity: 1; fill: #0a0c0f; }
}
@keyframes cBloom { 0% { transform: scale(0); } 60% { transform: scale(1.7); } 100% { transform: scale(1); } }

#curtain .c-halo {
  position: absolute; left: 50%; top: 56.5%; width: 12px; height: 12px; border-radius: 50%;
  transform: translate(-50%, -50%) scale(0); opacity: 0; pointer-events: none;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.95) 0%, rgba(127, 227, 214, 0.4) 30%, rgba(255, 154, 42, 0.14) 55%, transparent 70%);
}
#curtain.play .c-halo { animation: cHalo calc(var(--s) * 1.8s) calc(var(--s) * 3s) ease-out forwards; }
#curtain.gone .c-halo { animation: cFlash 1.2s ease-out forwards; }
@keyframes cHalo {
  0% { transform: translate(-50%, -50%) scale(0); opacity: 0; }
  40% { opacity: 0.75; }
  100% { transform: translate(-50%, -50%) scale(46); opacity: 0.4; }
}
@keyframes cFlash {
  0% { transform: translate(-50%, -50%) scale(46); opacity: 0.4; }
  35% { opacity: 0.7; }
  100% { transform: translate(-50%, -50%) scale(240); opacity: 0; }
}
@media (max-width: 900px) {
  #curtain .c-eng { -webkit-mask-size: 165% auto; mask-size: 165% auto; -webkit-mask-position: center 45%; mask-position: center 45%; }
  #curtain .c-sub { font-size: 12px; }
  #curtain .c-eyebrow { font-size: 10px; letter-spacing: 0.26em; }
}
@media (max-height: 480px) { #curtain .c-sub { display: none; } #curtain .in { padding-bottom: 14px; } }

/* ---------- intro v2: "Sukhumi out of light" (canvas light dust, see runIntro) ---------- */
#curtain { background: radial-gradient(ellipse at 50% 50%, #10151c 0%, #07080b 75%); }
#curtain.gone { transition: opacity 2s var(--soft) 0.1s, visibility 2.2s; }
#curtain .c-dust { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
#curtain .c-seed {
  position: absolute; left: 50%; top: 50%; width: 10px; height: 10px; border-radius: 50%;
  transform: translate(-50%, -50%) scale(0); opacity: 0;
  background: radial-gradient(circle, #ffffff 0%, rgba(234, 246, 255, 0.9) 22%, rgba(127, 227, 214, 0.45) 46%, rgba(255, 154, 42, 0.16) 66%, transparent 74%);
}
#curtain.play .c-seed { animation: cSeed calc(var(--s) * 2.6s) ease-out both; }
@keyframes cSeed {
  0% { transform: translate(-50%, -50%) scale(0); opacity: 0; }
  10% { transform: translate(-50%, -50%) scale(2.4); opacity: 1; }
  16% { transform: translate(-50%, -50%) scale(1.6); opacity: 1; }
  45% { transform: translate(-50%, -50%) scale(26); opacity: 0.5; }
  100% { transform: translate(-50%, -50%) scale(60); opacity: 0; }
}
/* crisp engraving fades in under the settled dust, then one beam of light crosses it */
#curtain.play .c-eng { animation: cIn calc(var(--s) * 0.4s) calc(var(--s) * 3s) ease both; }
#curtain.play .c-eng::before { animation: cBase2 calc(var(--s) * 2s) calc(var(--s) * 3.1s) ease both; }
#curtain.play .c-eng::after { animation: cBeam calc(var(--s) * 1.5s) calc(var(--s) * 3.45s) cubic-bezier(0.45, 0, 0.3, 1) both; }
@keyframes cBase2 { to { opacity: 0.9; } }
#curtain.nodust .c-eng { animation-delay: 0s; }
#curtain.nodust .c-eng::before { animation-delay: calc(var(--s) * 0.6s); }
#curtain.nodust .c-eng::after { animation-delay: calc(var(--s) * 0.4s); animation-duration: calc(var(--s) * 3s); }
/* title sits in the dark centre of the bay */
#curtain .in { height: 100%; justify-content: center; padding: 0 24px 4vh; z-index: 2; }
#curtain .in::before {
  content: ''; position: absolute; left: 50%; top: 48%; width: min(1100px, 96vw); height: 46vh;
  transform: translate(-50%, -50%); z-index: -1; opacity: 0;
  background: radial-gradient(ellipse at center, rgba(7, 8, 11, 0.86) 0%, rgba(7, 8, 11, 0.6) 45%, transparent 72%);
}
#curtain.play .in::before { animation: cIn calc(var(--s) * 1.4s) calc(var(--s) * 2.6s) ease both; }
#curtain.play .c-eyebrow { animation-delay: calc(var(--s) * 3s); }
#curtain.play h2 { animation-delay: calc(var(--s) * 3.4s); }
#curtain.play .c-sub span { animation-delay: calc(var(--s) * (4.1s + var(--k, 0) * 0.09s)); }
#curtain.fast { --s: 0.4; }
/* title must not re-wrap while its letter-spacing settles */
#curtain h2 { max-width: min(24em, 94vw); text-wrap: balance; }
@keyframes cTitle {
  from { opacity: 0; filter: blur(14px); letter-spacing: 0.055em; transform: translateY(8px) scale(0.985); }
  to { opacity: 1; filter: blur(0); letter-spacing: 0.015em; transform: none; }
}

/* ---------- intro v3: "Tide of light" (canvas etch + dust, see runIntro) ---------- */
#curtain { --yw: 60vh; }
#curtain .c-etch { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
#curtain .c-seed { display: none; }
#curtain.play:not(.nodust) .c-eng, #curtain.play:not(.nodust) .c-eng::before, #curtain.play:not(.nodust) .c-eng::after { animation: none; opacity: 0; }
#curtain .in { top: 0; height: var(--yw); justify-content: flex-end; padding: 0 24px 0.08em; }
#curtain .in::before { top: 100%; height: 52vh; }
#curtain .c-eyebrow { margin-bottom: 14px; }
#curtain h2 { line-height: 1.12; }
#curtain .c-under {
  position: absolute; left: 0; right: 0; top: var(--yw); z-index: 2;
  display: flex; flex-direction: column; align-items: center; padding: 0 24px; text-align: center; pointer-events: none;
}
#curtain .c-refl {
  font-family: var(--geo); font-weight: 400; font-size: clamp(25px, 4.4vw, 54px); line-height: 1.12;
  max-width: min(24em, 94vw); text-wrap: balance; color: #dfe9f5;
  transform: scaleY(-0.78); transform-origin: 50% 50%; opacity: 0; filter: blur(1.4px); margin-top: -0.12em;
  -webkit-mask-image: linear-gradient(0deg, rgba(0,0,0,0.75) 0%, rgba(0,0,0,0.25) 45%, transparent 85%);
  mask-image: linear-gradient(0deg, rgba(0,0,0,0.75) 0%, rgba(0,0,0,0.25) 45%, transparent 85%);
}
body[data-lang="en"] #curtain .c-refl, body[data-lang="ru"] #curtain .c-refl { font-family: var(--serif); font-weight: 500; }
#curtain .c-sub { margin-top: 4px; }
/* name rises out of its own reflection */
@keyframes cTitle {
  from { opacity: 0; filter: blur(10px); letter-spacing: 0.05em; transform: translateY(0.55em); clip-path: inset(100% 0 -10% 0); }
  to { opacity: 1; filter: blur(0); letter-spacing: 0.015em; transform: none; clip-path: inset(-20% 0 -10% 0); }
}
@keyframes cRefl {
  0% { opacity: 0; transform: scaleY(-0.2); }
  100% { opacity: 0.32; transform: scaleY(-0.78); }
}
@keyframes cRipple {
  0%, 100% { transform: scaleY(-0.78) skewX(0deg); }
  50% { transform: scaleY(-0.74) skewX(-1.2deg); }
}
#curtain.play .c-eyebrow { animation-delay: calc(var(--s) * 3.0s); }
#curtain.play h2 { animation: cTitle calc(var(--s) * 1.7s) calc(var(--s) * 3.2s) cubic-bezier(0.2, 0.8, 0.2, 1) both; }
#curtain.play .c-refl { animation: cRefl calc(var(--s) * 1.7s) calc(var(--s) * 3.2s) cubic-bezier(0.2, 0.8, 0.2, 1) forwards, cRipple calc(var(--s) * 3.2s) calc(var(--s) * 4.9s) ease-in-out infinite; }
#curtain.play .c-sub span { animation-delay: calc(var(--s) * (4.3s + var(--k, 0) * 0.1s)); }
@media (max-width: 900px) {
  #curtain h2, #curtain .c-refl { font-size: clamp(22px, 6.6vw, 34px); }
}
@media (max-height: 480px) { #curtain .c-refl { display: none; } }

/* ---------- desktop: clean sky, every control lives on one bar at the bottom ---------- */
@media (min-width: 901px) {
  #masthead { top: 22px; }
  #toolbar { top: auto; right: auto; left: 50%; bottom: 20px; transform: translateX(-50%); }
  body.has-drawer #toolbar { left: calc((100vw - var(--drawer-w) - 14px) / 2); transform: translateX(-50%); }
  #legend { bottom: 88px; }
  #hint { bottom: 92px; }
  #zoom { bottom: 20px; }
  body::before { height: 150px; }
}
@media (min-width: 901px) and (max-width: 1420px) {
  body.has-drawer #toolbar { transform: translateX(-50%); }
}
@media (min-width: 901px) and (max-width: 1520px) {
  #zoom { bottom: 88px; right: 24px; }
  #hint { display: none; }
}
@media (min-width: 901px) and (max-width: 1280px) {
  #light-switcher .l-txt, #btn-direct .txt, #btn-sound .txt { display: none; }
  #light-switcher button, #toolbar .pill:not(.gift):not(.gift-badge) { min-width: 34px; justify-content: center; }
}
@media (min-width: 901px) and (max-width: 1520px) {
  body.has-drawer #legend, body.has-drawer #zoom { opacity: 0 !important; pointer-events: none; }
}
@media (min-width: 1521px) {
  body.has-drawer #legend { opacity: 0 !important; pointer-events: none; }
}

@media (max-width: 900px) {
  #curtain .c-etch, #curtain .c-dust { transform-origin: 50% 60%; transition: transform 2.2s cubic-bezier(0.5, 0, 0.2, 1); }
  #curtain.gone .c-etch, #curtain.gone .c-dust { transform: scale(1.12); }
}

#curtain.split .c-refl { display: none; }
#curtain.split .c-sub { margin-top: 14px; }

/* title plate: stays put, fades out while a card passes under it, fades back after */
body.revealed #masthead { transition: opacity 0.9s var(--soft), transform 0.75s var(--spring), border-color 0.35s ease, box-shadow 0.45s ease, background 0.35s ease, filter 0.9s var(--soft); }
body.revealed.mast-hide #masthead { opacity: 0; filter: blur(3px); pointer-events: none; transition-duration: 0.6s; }

/* ---------- Sex sigils: sun (male) / moon (female) ---------- */
:root {
  --sx-m: #84b8de;
  --sx-f: #e0a2c1;
  --sun: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='none' stroke='%23000' stroke-width='1.8' stroke-linecap='round'%3E%3Ccircle cx='10' cy='10' r='3.7'/%3E%3Cpath d='M10 1.6v2.5M10 15.9v2.5M1.6 10h2.5M15.9 10h2.5M4.1 4.1l1.8 1.8M14.1 14.1l1.8 1.8M4.1 15.9l1.8-1.8M14.1 5.9l1.8-1.8'/%3E%3C/svg%3E");
  --moon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='none' stroke='%23000' stroke-width='1.8' stroke-linejoin='round'%3E%3Cpath d='M12.6 2.4a7.7 7.7 0 1 0 5 12.4A6.4 6.4 0 0 1 12.6 2.4z'/%3E%3C/svg%3E");
}
.card:not(.grp) .role::before {
  width: 13px; height: 13px; border: 0; border-radius: 0; opacity: 1;
  background: var(--sx-m);
  -webkit-mask: var(--sun) center / contain no-repeat; mask: var(--sun) center / contain no-repeat;
  filter: drop-shadow(0 0 3px rgba(132, 184, 222, 0.35));
  transition: filter 0.5s ease, transform 0.6s cubic-bezier(.2,.7,.2,1);
}
.card.f .role::before {
  background: var(--sx-f);
  -webkit-mask-image: var(--moon); mask-image: var(--moon);
  filter: drop-shadow(0 0 3px rgba(224, 162, 193, 0.35));
}
.hero .role::before, .direct .role::before { width: 15px !important; height: 15px !important; }
body.has-focus .node.lit .card:not(.grp) .role::before { filter: drop-shadow(0 0 6px rgba(132, 184, 222, 0.75)); transform: rotate(22.5deg); }
body.has-focus .node.lit .card.f .role::before { filter: drop-shadow(0 0 6px rgba(224, 162, 193, 0.75)); transform: none; }
#legend .shapes em::before {
  width: 12px; height: 12px; border: 0; border-radius: 0; background: var(--sx-m);
  -webkit-mask: var(--sun) center / contain no-repeat; mask: var(--sun) center / contain no-repeat;
}
#legend .shapes em.fe::before { background: var(--sx-f); -webkit-mask-image: var(--moon); mask-image: var(--moon); }
