/* Диалоговый экран «визуальная новелла» (assets/novel-dialog.js). Самодостаточен:
   не зависит от токенов страницы, цвета — свои, под палитру DZENDEX. */
.nv {
  --nv-bg: rgba(10, 11, 16, 0.94);
  --nv-pink: #ff2e88;
  --nv-line: color-mix(in srgb, var(--nv-pink) 55%, transparent);
  --nv-acid: #e6ff3a;
  --nv-text: #f5f5f5;
  --nv-muted: #9aa0ad;
  --nv-font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  --nv-font-brand: "Michroma", "Inter", system-ui, sans-serif;
  position: fixed;
  inset: 0;
  z-index: 2147483000;
  color: var(--nv-text);
  font: 400 16px/1.55 var(--nv-font);
  opacity: 0;
  transition: opacity 0.25s ease;
}
.nv.is-in { opacity: 1; }
.nv.is-leaving { opacity: 0; pointer-events: none; }

.nv__shade { position: absolute; inset: 0; background: rgba(4, 5, 8, 0.62); }
/* При подсветке затемнение даёт тень вокруг «окна», а не сплошной слой. */
.nv:has(.nv__spot:not([hidden])) .nv__shade { background: transparent; }

.nv__spot {
  position: absolute;
  border: 2px solid var(--nv-acid);
  border-radius: 6px;
  box-shadow: 0 0 0 200vmax rgba(4, 5, 8, 0.66), 0 0 24px 2px rgba(230, 255, 58, 0.45);
  pointer-events: none;
  animation: nv-spot 1.6s ease-in-out infinite;
}
@keyframes nv-spot { 50% { box-shadow: 0 0 0 200vmax rgba(4, 5, 8, 0.66), 0 0 36px 6px rgba(230, 255, 58, 0.6); } }

/* Маленький Дзендекс над кнопкой, палец показывает вниз на неё. */
.nv__pointer {
  position: absolute;
  width: 0;
  height: 0;
  pointer-events: none;
}
.nv__mini, .nv__hand { position: absolute; display: block; }
.nv__mini {
  left: -6px;
  bottom: 44px;
  width: 58px;
  height: 58px;
  border: 2px solid var(--nv-acid);
  border-radius: 50%;
  overflow: hidden;
  background: #111;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.6), 0 0 0 3px rgba(255, 46, 136, 0.5);
  animation: nv-bob 1.4s ease-in-out infinite;
}
.nv__mini img { width: 100%; height: 100%; object-fit: cover; }
.nv__hand {
  left: -18px;
  bottom: -2px;
  width: 40px;
  height: 40px;
  color: var(--nv-acid);
  filter: drop-shadow(0 0 6px rgba(230, 255, 58, 0.6));
  transform: rotate(180deg);
  animation: nv-poke 0.9s ease-in-out infinite;
}
.nv__hand svg { display: block; width: 100%; height: 100%; }
.nv__pointer.is-below .nv__mini { top: 44px; bottom: auto; }
.nv__pointer.is-below .nv__hand { top: -2px; bottom: auto; transform: none; animation-name: nv-poke-up; }
@keyframes nv-poke-up { 50% { transform: translateY(7px); } }
@keyframes nv-bob { 50% { transform: translateY(-5px) rotate(-4deg); } }
@keyframes nv-poke { 50% { transform: rotate(180deg) translateY(-7px); } }

/* Окно реплики. */
.nv__box {
  position: absolute;
  left: 50%;
  bottom: max(16px, env(safe-area-inset-bottom));
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 18px;
  width: min(760px, calc(100% - 32px));
  padding: 18px 22px 18px 18px;
  border: 1px solid var(--nv-line);
  border-radius: 6px;
  background:
    linear-gradient(180deg, color-mix(in srgb, var(--nv-pink) 8%, transparent), transparent 40%),
    var(--nv-bg);
  box-shadow: 0 18px 60px rgba(0, 0, 0, 0.7), inset 0 0 0 1px rgba(255, 255, 255, 0.04);
  transform: translateX(-50%);
  backdrop-filter: blur(8px);
}
.nv.is-box-top .nv__box { top: max(16px, env(safe-area-inset-top)); bottom: auto; }
.nv__box.is-swap { animation: nv-swap 0.3s ease; }
@keyframes nv-swap { from { opacity: 0.4; transform: translate(-50%, 6px); } }

.nv__portrait {
  width: 96px;
  height: 96px;
  margin-top: -40px;
  border: 2px solid var(--nv-pink);
  border-radius: 50%;
  overflow: hidden;
  background: #111;
  box-shadow: 0 0 0 4px var(--nv-bg), 0 0 22px color-mix(in srgb, var(--nv-pink) 45%, transparent);
  transition: transform 0.3s ease;
}
.nv__portrait img { width: 100%; height: 100%; object-fit: cover; }
.nv--mood-sorry .nv__portrait { transform: rotate(-8deg) translateY(4px); }

.nv__body { min-width: 0; }
.nv__name {
  display: inline-block;
  margin: 0 0 6px;
  padding: 2px 10px;
  background: var(--nv-pink);
  color: #0a0a0f;
  font: 400 12px/1.6 var(--nv-font-brand);
  letter-spacing: 0.14em;
  clip-path: polygon(0 0, 100% 0, calc(100% - 8px) 100%, 0 100%);
}
.nv__text { min-height: 3.1em; margin: 0; font-size: 17px; }

.nv__choices {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 14px;
  opacity: 0;
  transition: opacity 0.2s ease;
}
.nv.is-typed .nv__choices { opacity: 1; }
.nv__choice {
  min-width: 112px;
  min-height: 44px;
  padding: 10px 18px;
  border: 1px solid rgba(245, 245, 245, 0.22);
  border-radius: 3px;
  background: rgba(255, 255, 255, 0.03);
  color: var(--nv-text);
  font: 600 13px/1 var(--nv-font);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s, color 0.2s;
}
.nv__choice:hover, .nv__choice:focus-visible { border-color: var(--nv-acid); color: var(--nv-acid); outline: none; }
.nv__choice--primary { border-color: var(--nv-pink); background: color-mix(in srgb, var(--nv-pink) 16%, transparent); }

.nv__more {
  position: absolute;
  right: 12px;
  bottom: 6px;
  color: var(--nv-pink);
  font-size: 10px;
  animation: nv-blink 1s steps(2) infinite;
}
.nv.is-typed .nv__more { display: none; }
@keyframes nv-blink { 50% { opacity: 0; } }

@media (max-width: 560px) {
  .nv__box { grid-template-columns: 1fr; gap: 0; padding: 16px; }
  .nv__portrait { position: absolute; top: -34px; right: 14px; width: 68px; height: 68px; margin: 0; }
  .nv__name { margin-right: 80px; }
  .nv__text { font-size: 16px; }
  .nv__choices { justify-content: stretch; }
  .nv__choice { flex: 1; }
  .nv.is-box-top .nv__portrait { top: auto; bottom: -30px; }
}

@media (prefers-reduced-motion: reduce) {
  .nv, .nv__box, .nv__portrait, .nv__choices { transition: none; }
  .nv__spot, .nv__mini, .nv__hand, .nv__more, .nv__box.is-swap { animation: none; }
}
