/* Тайный Жнец — мрачная готика: сливовая ночь, гранитная плита, свечной воск */

:root {
  --night-deep: #0d0711;
  --night: #1c1022;
  --granite-hi: #2e2635;
  --granite-lo: #17111b;
  --wax: #e9dfca;
  --silver: #9d96a8;
  --oxblood: #7d1a2b;
  --oxblood-hi: #a8293e;
  --flame: #f2aa4c;
  --flame-glow: rgba(242, 170, 76, .45);

  --font: "Cormorant Garamond", "Cormorant", Georgia, "Times New Roman", serif;
  --font-caps: "Cormorant SC", "Cormorant Garamond", Georgia, serif;

  --arch: 50% 50% 6px 6px / 7.5rem 7.5rem 6px 6px;
}

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

html { height: 100%; }

body {
  margin: 0;
  min-height: 100%;
  font-family: var(--font);
  font-size: 1.2rem;
  font-weight: 500;
  line-height: 1.6;
  color: var(--wax);
  background:
    radial-gradient(ellipse 60% 45% at 78% 8%, #3a1a33 0%, transparent 70%),
    linear-gradient(180deg, var(--night) 0%, var(--night-deep) 75%);
  background-attachment: fixed;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

/* ---------- Ночная сцена ---------- */

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

.moon {
  position: absolute;
  top: 7vh;
  right: 9vw;
  width: clamp(72px, 11vw, 140px);
  aspect-ratio: 1;
  border-radius: 50%;
  background:
    radial-gradient(circle at 64% 60%, rgba(120, 100, 76, .28), transparent 16%),
    radial-gradient(circle at 34% 68%, rgba(120, 100, 76, .2), transparent 11%),
    radial-gradient(circle at 56% 28%, rgba(120, 100, 76, .18), transparent 9%),
    radial-gradient(circle at 28% 40%, rgba(120, 100, 76, .12), transparent 14%),
    radial-gradient(circle at 38% 34%, #fbf3e1 0%, #e6d8b8 50%, #bfa87c 100%);
  box-shadow:
    0 0 50px 14px rgba(230, 216, 184, .16),
    0 0 140px 60px rgba(125, 26, 43, .14);
}

.bat {
  position: absolute;
  top: 15vh;
  left: -70px;
  width: 44px;
  fill: #07030a;
  animation: bat-flight 32s linear infinite, bat-flap .32s ease-in-out infinite alternate;
  animation-delay: 4s, 0s;
  transform-origin: 50% 60%;
}

@keyframes bat-flight {
  0%   { translate: 0 0; }
  12%  { translate: 35vw -5vh; }
  24%  { translate: 70vw 3vh; }
  34%  { translate: calc(100vw + 140px) -4vh; }
  100% { translate: calc(100vw + 140px) -4vh; }
}

@keyframes bat-flap {
  from { scale: 1 1; }
  to   { scale: 1 .35; }
}

.fog {
  position: absolute;
  left: -25%;
  width: 150%;
  height: 40vh;
  background:
    radial-gradient(ellipse 30% 50% at 18% 62%, rgba(205, 190, 215, .10), transparent 70%),
    radial-gradient(ellipse 28% 45% at 55% 70%, rgba(205, 190, 215, .08), transparent 70%),
    radial-gradient(ellipse 30% 50% at 88% 58%, rgba(205, 190, 215, .09), transparent 70%);
  filter: blur(10px);
  animation: fog-drift 50s ease-in-out infinite alternate;
}
.fog--back  { bottom: 2vh; }
.fog--front { bottom: -12vh; opacity: .8; animation-duration: 70s; animation-direction: alternate-reverse; }

@keyframes fog-drift {
  from { transform: translateX(-8%); }
  to   { transform: translateX(8%); }
}

.graveyard {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: clamp(90px, 18vh, 190px);
}
.graveyard__ground { fill: #08040a; }
.graveyard__tree   { stroke: #08040a; }

/* ---------- Сцена и плита ---------- */

.stage {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 5vh 1.25rem 16vh;
}

.slab {
  position: relative;
  width: min(100%, 29rem);
  padding: 2.75rem 2.25rem 2.5rem;
  text-align: center;
  border-radius: var(--arch);
  background:
    radial-gradient(ellipse 80% 40% at 50% 0%, rgba(242, 170, 76, .07), transparent 70%),
    linear-gradient(170deg, var(--granite-hi) 0%, var(--granite-lo) 100%);
  box-shadow:
    inset 0 2px 0 rgba(255, 255, 255, .05),
    inset 0 -30px 60px rgba(0, 0, 0, .35),
    0 40px 80px -20px rgba(0, 0, 0, .85);
  animation: slab-rise 1.4s cubic-bezier(.2, .7, .15, 1) both;
}

/* Высеченная рамка по контуру плиты */
.slab::before {
  content: "";
  position: absolute;
  inset: 10px;
  border-radius: var(--arch);
  border: 1px solid rgba(0, 0, 0, .45);
  box-shadow: 0 1px 0 rgba(255, 255, 255, .05), inset 0 1px 0 rgba(255, 255, 255, .04);
  pointer-events: none;
}

@keyframes slab-rise {
  from { opacity: 0; transform: translateY(48px); }
  to   { opacity: 1; transform: none; }
}

.slab > * { position: relative; }

.slab__title {
  margin: 0 0 .5rem;
  font-family: var(--font-caps);
  font-weight: 700;
  font-size: clamp(2.5rem, 9vw, 3.4rem);
  line-height: 1.05;
  letter-spacing: .02em;
  color: #cfc4b3;
  text-shadow: 0 -1px 0 rgba(0, 0, 0, .7), 0 1px 0 rgba(255, 255, 255, .08);
}
.slab__title--small { font-size: clamp(1.8rem, 6vw, 2.3rem); }

.slab__lead {
  margin: 0 auto 1.5rem;
  max-width: 22rem;
  font-style: italic;
  font-size: 1.2rem;
  color: var(--silver);
}

/* ---------- Свеча ---------- */

.candle {
  position: relative;
  width: 12px;
  height: 34px;
  margin: 1.25rem auto 1.5rem;
  border-radius: 3px 3px 1px 1px;
  background: linear-gradient(90deg, #cdbf9f, #f1e7d1 45%, #ad9f82);
}
.candle::before {
  content: "";
  position: absolute;
  top: -6px;
  left: 50%;
  width: 2px;
  height: 7px;
  margin-left: -1px;
  background: #1a1210;
}
.candle__flame {
  position: absolute;
  left: 50%;
  bottom: calc(100% + 3px);
  width: 12px;
  height: 24px;
  margin-left: -6px;
  border-radius: 50% 50% 50% 50% / 62% 62% 38% 38%;
  background: radial-gradient(ellipse at 50% 78%, #fffbe8 0 14%, #ffd88a 34%, var(--flame) 58%, rgba(168, 41, 62, 0) 76%);
  box-shadow: 0 0 16px 6px var(--flame-glow), 0 0 60px 22px rgba(242, 170, 76, .12);
  transform-origin: 50% 90%;
  animation: flame 1.8s ease-in-out infinite alternate;
}

@keyframes flame {
  0%   { transform: scale(1, 1) rotate(-2deg); }
  30%  { transform: scale(1.06, .94) rotate(2deg); }
  55%  { transform: scale(.94, 1.08) rotate(-1deg); }
  80%  { transform: scale(1.03, .97) rotate(3deg); }
  100% { transform: scale(1, 1.05) rotate(-2deg); }
}

/* ---------- Предупреждение ---------- */

.epitaph {
  margin: 0 0 1.75rem;
  padding: 1rem 1.1rem;
  font-size: 1.08rem;
  line-height: 1.5;
  color: #e4cfc6;
  background: rgba(125, 26, 43, .22);
  border-top: 1px solid rgba(168, 41, 62, .7);
  border-bottom: 1px solid rgba(168, 41, 62, .7);
}
.epitaph p { margin: 0; }
.epitaph p + p { margin-top: .35rem; }
.epitaph strong {
  font-family: var(--font-caps);
  font-size: 1.15rem;
  font-weight: 700;
  color: #ffd9cf;
}

.notice {
  margin: 0 0 1.25rem;
  font-style: italic;
  color: var(--flame);
}

/* ---------- Форма ---------- */

.form { text-align: left; }

.field { margin-bottom: 1.15rem; }

.field label {
  display: block;
  margin-bottom: .3rem;
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--silver);
}

.input {
  width: 100%;
  padding: .65rem .85rem;
  font: inherit;
  font-size: 1.15rem;
  color: var(--wax);
  background: rgba(8, 4, 10, .55);
  border: 1px solid rgba(157, 150, 168, .28);
  border-radius: 3px;
  box-shadow: inset 0 2px 6px rgba(0, 0, 0, .5);
  transition: border-color .2s, box-shadow .2s;
}
.input:focus {
  outline: none;
  border-color: var(--flame);
  box-shadow: inset 0 2px 6px rgba(0, 0, 0, .5), 0 0 0 3px rgba(242, 170, 76, .22);
}

.field__wrap { position: relative; }
.field__wrap .input { padding-right: 3rem; }
.field__peek {
  position: absolute;
  top: 50%;
  right: .35rem;
  display: grid;
  place-items: center;
  width: 2.3rem;
  height: 2.3rem;
  padding: 0;
  color: var(--silver);
  background: none;
  border: 0;
  border-radius: 3px;
  cursor: pointer;
  transform: translateY(-50%);
}
.field__peek:hover { color: var(--wax); }
.field__peek[aria-pressed="true"] { color: var(--flame); }
.field__peek:focus-visible { outline: 2px solid var(--flame); outline-offset: 1px; }

.field__error,
.form__error p {
  margin: .35rem 0 0;
  font-size: 1rem;
  color: #ff9f93;
}
.form__error {
  margin-bottom: 1.1rem;
  padding: .6rem .85rem;
  border-left: 2px solid var(--oxblood-hi);
  background: rgba(125, 26, 43, .25);
}
.form__error p:first-child { margin-top: 0; }

/* ---------- Кнопки ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  margin-top: .4rem;
  padding: .75rem 1.25rem;
  font-family: var(--font-caps);
  font-size: 1.3rem;
  font-weight: 700;
  letter-spacing: .05em;
  color: #fff3e8;
  background: linear-gradient(180deg, var(--oxblood-hi), var(--oxblood));
  border: 1px solid #b8384d;
  border-radius: 3px;
  box-shadow: 0 10px 24px -8px rgba(125, 26, 43, .8), inset 0 1px 0 rgba(255, 255, 255, .14);
  cursor: pointer;
  transition: box-shadow .25s, filter .25s, transform .1s;
}
.btn:hover {
  filter: brightness(1.1);
  box-shadow: 0 10px 30px -6px rgba(242, 170, 76, .35), inset 0 1px 0 rgba(255, 255, 255, .18);
}
.btn:active { transform: translateY(1px); }
.btn:focus-visible { outline: 2px solid var(--flame); outline-offset: 3px; }
.btn:disabled { opacity: .6; cursor: wait; }

.btn--ghost {
  color: var(--wax);
  background: transparent;
  border-color: rgba(157, 150, 168, .4);
  box-shadow: none;
}
.btn--ghost:hover {
  filter: none;
  background: rgba(233, 223, 202, .06);
  border-color: var(--silver);
  box-shadow: none;
}

.btn--small {
  width: auto;
  margin: 0 0 1.75rem;
  padding: .35rem 1rem;
  font-size: 1rem;
}

/* ---------- Имя получателя: главный момент ---------- */

.summoned {
  margin: .25rem 0 1.25rem;
  font-family: var(--font-caps);
  font-weight: 700;
  font-size: clamp(2.2rem, 8.5vw, 3.1rem);
  line-height: 1.1;
  overflow-wrap: anywhere;
  color: #ffe9c4;
  animation:
    summon 2.6s .9s cubic-bezier(.2, .6, .2, 1) both,
    ember-glow 5s 3.5s ease-in-out infinite;
}

@keyframes summon {
  0%   { opacity: 0; filter: blur(18px); letter-spacing: .5em; text-shadow: 0 0 60px var(--flame); }
  55%  { opacity: 1; }
  100% { opacity: 1; filter: blur(0); letter-spacing: .01em; text-shadow: 0 0 18px var(--flame-glow), 0 0 50px rgba(168, 41, 62, .45); }
}

@keyframes ember-glow {
  0%, 100% { text-shadow: 0 0 18px var(--flame-glow), 0 0 50px rgba(168, 41, 62, .45); }
  50%      { text-shadow: 0 0 26px rgba(242, 170, 76, .65), 0 0 70px rgba(168, 41, 62, .6); }
}

/* ---------- Окно подтверждения ---------- */

.modal {
  width: min(92vw, 25rem);
  padding: 0;
  color: var(--wax);
  background: linear-gradient(170deg, var(--granite-hi), var(--granite-lo));
  border: 1px solid rgba(168, 41, 62, .65);
  border-radius: 4px;
  box-shadow: 0 30px 90px rgba(0, 0, 0, .85), 0 0 50px rgba(125, 26, 43, .3);
}
.modal[open] { animation: modal-in .3s cubic-bezier(.2, .7, .2, 1); }
.modal::backdrop {
  background: rgba(6, 2, 8, .78);
  backdrop-filter: blur(3px);
}

@keyframes modal-in {
  from { opacity: 0; transform: translateY(14px) scale(.97); }
  to   { opacity: 1; transform: none; }
}

.modal__body { padding: 1.9rem 1.75rem 1.6rem; text-align: center; }
.modal h2 {
  margin: 0 0 .75rem;
  font-family: var(--font-caps);
  font-size: 1.9rem;
  font-weight: 700;
  line-height: 1.1;
}
.modal p { margin: 0 0 .6rem; color: #dccfc3; }
.modal__actions { display: flex; gap: .75rem; margin-top: 1.4rem; }
.modal__actions .btn { flex: 1; margin: 0; font-size: 1.15rem; }

/* ---------- Адаптив и доступность ---------- */

@media (max-width: 480px) {
  :root { --arch: 50% 50% 6px 6px / 5.5rem 5.5rem 6px 6px; }
  body { font-size: 1.12rem; }
  .slab { padding: 2.25rem 1.4rem 2rem; }
  .modal__actions { flex-direction: column-reverse; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-delay: 0s !important;
    animation-iteration-count: 1 !important;
    transition: none !important;
  }
  .bat { display: none; }
}
