/* ============================================================
   666pay — врата: вход, регистрация, сброс пароля, подтверждение почты.
   Подключается после site.css. Сцена — кованые створки по краям экрана
   (те же прутья с пиками, что ограда над подвалом); при загрузке они
   расходятся, а между ними висит табличка с формой.
   Классы форм (.fm, .fm__box, .pin6, .warnbox, .pass …) — те же, на которые
   опирается логика страниц и auth.js.
   ============================================================ */

body.portal-page { min-height: 100vh; display: flex; flex-direction: column; overflow-x: hidden; }

.gbar {
  position: relative;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 20px var(--gutter);
}
.gbar__brand img { height: 46px; width: auto; }
.gbar__brand .lk-dark { display: none; }
:root[data-theme="dark"] .gbar__brand .lk-light { display: none; }
:root[data-theme="dark"] .gbar__brand .lk-dark { display: block; }
.gbar__act { display: flex; align-items: center; gap: 8px; }

/* ── Створки ──────────────────────────────────────────────────────────── */

.gates { position: fixed; inset: 0; z-index: 0; pointer-events: none; overflow: hidden; }

/* Жар между створками — там, где табличка. */
.gates::before {
  content: "";
  position: absolute;
  left: 50%;
  bottom: -30vh;
  width: 90vw;
  height: 80vh;
  transform: translateX(-50%);
  background: radial-gradient(closest-side, color-mix(in srgb, var(--hx-accent) 26%, transparent), color-mix(in srgb, var(--hx-ember) 6%, transparent) 55%, transparent 75%);
}

.leaf {
  position: absolute;
  top: 9vh;
  bottom: 0;
  width: calc(50% - 250px);
  color: color-mix(in srgb, var(--hx-accent) 55%, var(--hx-line));
  animation: leaf-open 1.4s cubic-bezier(.6, .05, .25, 1) .15s both;
}
:root:not([data-theme="dark"]) .leaf { color: color-mix(in srgb, var(--hx-text) 72%, var(--hx-accent)); }
.leaf--l { left: 0; --from: calc(250px + 2vw); }
.leaf--r { right: 0; --from: calc(-250px - 2vw); transform-origin: right; }
@keyframes leaf-open { from { transform: translateX(var(--from)); opacity: .3; } to { transform: none; opacity: 1; } }

/* Прутья: по одному на 28px, у каждого наверху наконечник-пика. */
.leaf__bars {
  position: absolute;
  inset: 0;
  background: currentColor;
  -webkit-mask:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='28' height='40' viewBox='0 0 28 40'%3E%3Cpath d='M12.6 40V13h2.8v27zM14 1l-6 13 6-3.2 6 3.2z' fill='%23000'/%3E%3C/svg%3E") repeat-x left top / 28px 40px,
    linear-gradient(90deg, transparent 12.6px, #000 12.6px, #000 15.4px, transparent 15.4px) left 40px / 28px 100% repeat-x;
  mask:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='28' height='40' viewBox='0 0 28 40'%3E%3Cpath d='M12.6 40V13h2.8v27zM14 1l-6 13 6-3.2 6 3.2z' fill='%23000'/%3E%3C/svg%3E") repeat-x left top / 28px 40px,
    linear-gradient(90deg, transparent 12.6px, #000 12.6px, #000 15.4px, transparent 15.4px) left 40px / 28px 100% repeat-x;
  -webkit-mask-repeat: repeat-x, repeat-x;
  mask-repeat: repeat-x, repeat-x;
  -webkit-mask-size: 28px 40px, 28px calc(100% - 40px);
  mask-size: 28px 40px, 28px calc(100% - 40px);
  filter: drop-shadow(0 0 6px color-mix(in srgb, var(--hx-accent) 40%, transparent));
  opacity: .9;
}
/* Перекладины. */
.leaf::before, .leaf::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  height: 4px;
  background: currentColor;
}
.leaf::before { top: 120px; }
.leaf::after { top: calc(120px + 26vh); }

/* Медальон с трезубцем на каждой створке, ближе к табличке. */
.leaf__medal {
  position: absolute;
  top: calc(120px + 13vh);
  width: 92px;
  height: 92px;
  transform: translateY(-50%);
  border: 4px solid currentColor;
  border-radius: 50%;
  background: var(--hx-ground);
  display: grid;
  place-items: center;
}
.leaf--l .leaf__medal { right: 48px; }
.leaf--r .leaf__medal { left: 48px; }
.leaf__medal svg { width: 46px; height: 46px; }

/* ── Табличка ─────────────────────────────────────────────────────────── */

.gstage {
  position: relative;
  z-index: 2;
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 12px var(--gutter) 48px;
}

.plaque {
  position: relative;
  width: 100%;
  max-width: 440px;
  padding: 38px 36px 32px;
  background: var(--hx-raise);
  border: 1px solid var(--hx-line);
  box-shadow: 0 40px 90px -40px rgba(30, 4, 3, .55);
  animation: plaque-in .9s var(--ease) .55s both;
}
:root[data-theme="dark"] .plaque { box-shadow: 0 40px 100px -30px rgba(0, 0, 0, .85), 0 0 0 1px rgba(238, 42, 27, .07); }
.plaque::before {
  content: "";
  position: absolute;
  inset: 7px;
  border: 1px solid var(--hx-line-soft);
  pointer-events: none;
}
/* Кольца, на которых табличка висит. */
.plaque::after {
  content: "";
  position: absolute;
  top: -22px;
  left: 50%;
  width: 120px;
  height: 22px;
  transform: translateX(-50%);
  border-left: 2px solid var(--hx-line);
  border-right: 2px solid var(--hx-line);
}
@keyframes plaque-in { from { opacity: 0; transform: translateY(14px); } }

.plaque > * { position: relative; }
.plaque .kicker { margin-bottom: 14px; }
.plaque h1 { font-size: clamp(30px, 4vw, 38px); line-height: 1.05; }
.plaque h1 em { display: block; }
.g-sub { margin-top: 12px; color: var(--hx-dim); font-size: 14.5px; }
.g-sub .to { font-family: var(--hx-data); font-size: .92em; color: var(--hx-text); }

.g-form { margin-top: 26px; display: grid; gap: 18px; }

/* ── Поля ─────────────────────────────────────────────────────────────── */

.fm { display: grid; gap: 8px; }
.fm__lab { font: 500 10.5px/1 var(--hx-data); letter-spacing: .16em; text-transform: uppercase; color: var(--hx-dim); }
.fm__box {
  display: flex;
  align-items: center;
  gap: 10px;
  height: 50px;
  padding: 0 14px;
  border: 1px solid var(--hx-line);
  background: var(--hx-ground);
  transition: border-color .2s var(--ease), box-shadow .2s var(--ease);
}
.fm__box svg { flex: none; color: var(--hx-faint); }
.fm__box input {
  flex: 1;
  min-width: 0;
  height: 100%;
  border: 0;
  background: none;
  outline: 0;
  font: 500 15px/1 var(--hx-body);
  color: var(--hx-text);
}
.fm__box input::placeholder { color: var(--hx-faint); }
.fm__box:focus-within { border-color: var(--hx-accent); box-shadow: 0 0 0 4px color-mix(in srgb, var(--hx-accent) 14%, transparent); }
.fm__box button { border: 0; background: none; padding: 4px; color: var(--hx-faint); display: grid; place-items: center; }
.fm__box button:hover { color: var(--hx-text); }
#peek .glance__slash { display: none; }
#peek.pass-off .glance__slash { display: inline; }

.fm__err { display: none; font-size: 12.5px; color: var(--hx-bad); }
.fm.with-err .fm__err { display: block; }
.fm.with-err .fm__box, .fm.with-err .pin6__d, .fm.with-err .pin6 input { border-color: var(--hx-bad); }
.fm__hint { font-size: 12.5px; color: var(--hx-faint); }
.fm__hint a, .g-link { color: var(--hx-accent); font-weight: 600; }
.fm__hint a:hover, .g-link:hover { text-decoration: underline; text-underline-offset: 3px; }
.g-forgot { justify-self: end; font-size: 12.5px; margin-top: -4px; }

/* Сила пароля — три засечки, огонь разгорается. */
.pass { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; }
.pass i { height: 3px; background: var(--hx-line); transition: background .3s; }
.pass i.on-1 { background: var(--hx-bad); }
.pass i.on-2 { background: var(--hx-ember); }
.pass i.on-3 { background: var(--hx-ok); }

/* Шесть клеток кода. */
.pin6 { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 8px; }
.pin6__d, .pin6 input {
  height: 56px;
  min-width: 0;
  border: 1px solid var(--hx-line);
  background: var(--hx-ground);
  text-align: center;
  font: 500 22px/1 var(--hx-data);
  color: var(--hx-text);
  outline: 0;
  transition: border-color .2s var(--ease), box-shadow .2s var(--ease), background .2s;
}
.pin6__d:focus, .pin6 input:focus { border-color: var(--hx-accent); box-shadow: 0 0 0 4px color-mix(in srgb, var(--hx-accent) 14%, transparent); }
.pin6 input.filled { background: var(--hx-accent-soft); border-color: color-mix(in srgb, var(--hx-accent) 40%, var(--hx-line)); }

.warnbox {
  display: none;
  align-items: flex-start;
  gap: 10px;
  margin-top: 18px;
  padding: 11px 13px;
  border-left: 2px solid var(--hx-bad);
  background: color-mix(in srgb, var(--hx-bad) 9%, transparent);
  font-size: 13.5px;
  color: var(--hx-text);
}
.warnbox.cond-on { display: flex; }
.warnbox svg { flex: none; margin-top: 2px; color: var(--hx-bad); }

.g-submit { width: 100%; margin-top: 4px; }
.g-submit:disabled { opacity: .55; cursor: default; transform: none; box-shadow: none; }

.g-back { display: inline-block; margin-bottom: 14px; font: 500 11px/1 var(--hx-data); letter-spacing: .1em; text-transform: uppercase; color: var(--hx-dim); }
.g-back:hover { color: var(--hx-accent); }

.g-foot { margin-top: 22px; padding-top: 18px; border-top: 1px dashed var(--hx-line); text-align: center; font-size: 13.5px; color: var(--hx-dim); }
.g-legal { margin-top: 14px; font-size: 12px; color: var(--hx-faint); text-align: center; }
.g-legal a { color: var(--hx-dim); text-decoration: underline; text-underline-offset: 2px; }

/* Под табличкой: что будет дальше. */
.after {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px 26px;
  max-width: 640px;
  margin-top: 30px;
  padding: 10px 18px;
  background: var(--hx-ground);
  border: 1px solid var(--hx-line-soft);
  font-size: 13px;
  color: var(--hx-dim);
  animation: plaque-in .9s var(--ease) .8s both;
}
.after span { display: inline-flex; align-items: baseline; gap: 8px; }
.after i { font: italic 600 14px/1 var(--hx-display); color: var(--hx-accent); }

/* Печать при успехе. */
.g-done { text-align: center; }
.g-done .g-seal { display: block; width: 92px; height: 92px; margin: 0 auto 18px; transform: rotate(-10deg); }
.wax { display: block; width: 100%; height: 100%; overflow: visible; }
.wax__glyph { fill: none; stroke: #FFE3D8; stroke-width: 2.6; stroke-linecap: round; stroke-linejoin: round; }
.wax__glyph .fl { fill: #FFE3D8; stroke: none; }
.wax__glyph--shade { stroke: #3A0505; opacity: .55; }
.wax__glyph--shade .fl { fill: #3A0505; }

.g-resend { margin-top: 16px; text-align: center; font-size: 13px; color: var(--hx-dim); }
.g-resend button { border: 0; background: none; padding: 0; font: inherit; font-weight: 600; color: var(--hx-accent); }
.g-resend button:disabled { color: var(--hx-faint); cursor: default; }

.gfoot { position: relative; z-index: 2; align-self: center; margin-bottom: 18px; padding: 9px 16px; background: var(--hx-ground); display: flex; justify-content: center; gap: 22px; font: 400 11px/1 var(--hx-data); letter-spacing: .08em; text-transform: uppercase; color: var(--hx-faint); }
.gfoot a:hover { color: var(--hx-accent); }

/* ── Адаптив ──────────────────────────────────────────────────────────── */

@media (max-width: 900px) {
  .leaf { width: calc(50% - 160px); opacity: .45; animation-name: leaf-open-dim; }
  .leaf__medal { display: none; }
  @keyframes leaf-open-dim { from { transform: translateX(var(--from)); opacity: .1; } to { transform: none; opacity: .45; } }
}
@media (max-width: 560px) {
  .leaf { width: 22vw; opacity: .25; }
  .plaque { padding: 30px 22px 26px; }
  .plaque::after { display: none; }
  .pin6 { gap: 6px; }
  .pin6__d, .pin6 input { height: 50px; font-size: 20px; }
}

@media (prefers-reduced-motion: reduce) {
  .leaf, .plaque, .after { animation: none; }
}

/* ── Большой чёрт у правой створки (boss.js, кадрирование — boss.css) ── */
.portal-page .boss {
  position: fixed;
  z-index: 1;
  right: max(4.5vw, 24px);
  top: 50%;
  width: clamp(340px, 28vw, 520px);
  transform: translateY(-48%);
}
@media (max-width: 1099px) { .portal-page .boss { display: none; } }