/* Signed-out cabinet only. Account pages use the existing cabinet styles. */
html:has(.gate-with-referral) { scrollbar-gutter: stable both-edges; }

.gate-login {
  --cab-ink: #f4f4f4;
  --cab-muted: #a9a9a9;
  --cab-secondary: #b8b8b8;
  --cab-accent: #f1f1f1;
  --cab-accent-hover: #dedede;
  --cab-accent-ink: #141414;
  /* Второстепенные кнопки входа (Яндекс ID, почта) — как .secondary нового кабинета (prototypes/reelo-cabinet/cabinet-ui.css: --raised, нажатие #414147). */
  --cab-control: #2a2a2a;
  --cab-hover: #414147;
  --gate-surface: #171717;
  --gate-line: #292929;
  width: 100%;
  min-height: 100vh;
  min-height: 100svh;
  padding-inline: 22px;
  background: #0b0b0b;
  color: var(--cab-ink);
}

.gate-login .gate-main {
  display: grid;
  align-content: center;
  flex: 1 0 auto;
  width: min(408px, 100%);
  margin: 0 auto;
  padding-block: clamp(28px, 5vh, 48px);
}

.gate-mascot {
  width: min(46%, 172px);
  margin: 0 auto clamp(26px, 5vw, 40px);
}
.gate-mascot svg {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 484 / 396;
}
.gate-mascot .one-brand-wordmark { display: none; }
.gate-with-referral .gate-mascot {
  width: min(34%, 112px);
  margin-bottom: clamp(18px, 4vw, 24px);
}

.gate-login .sign-in {
  padding: 0;
  border: 0;
  border-radius: 0;
  background: none;
  text-align: center;
}
.gate-login .sign-in > h1 {
  margin: 0;
  font-size: clamp(38px, 8vw, 55px);
  line-height: 1.06;
  font-weight: 650;
  letter-spacing: -.04em;
  text-wrap: balance;
}
.gate-login:is(.gate-confirming, .gate-tv) .sign-in > h1 {
  font-size: clamp(32px, 7vw, 42px);
}
.gate-with-referral .sign-in > h1 {
  font-size: clamp(1.625rem, 5.8vw, 2rem);
  line-height: 1.15;
  overflow-wrap: anywhere;
}
.gate-login .sign-in > :is(.gate-start-copy, .gate-confirm-copy) {
  margin: 14px 0 28px;
  color: var(--cab-muted);
  font-size: 16px;
  text-wrap: balance;
}
.gate-login:not(.gate-confirming) .gate-confirm-copy,
.gate-confirming :is(.gate-start-copy, .gate-more) { display: none; }
.gate-with-referral .referral-pass {
  display: grid;
  grid-template-columns: minmax(0, 60%);
  align-content: center;
  gap: var(--cab-space-1);
  position: relative;
  isolation: isolate;
  overflow: hidden;
  min-height: clamp(128px, 30vw, 154px);
  margin-block: var(--cab-space-4) var(--cab-space-5);
  padding: clamp(18px, 4vw, 26px);
  border: 0;
  border-radius: 18px;
  text-align: start;
  color: #fff8ee;
  background: linear-gradient(165deg, #ffda75 0%, #ffbd47 20%, #ff881e 45%, #f26717 68%, #ffa42f 100%);
}
.gate-with-referral .referral-pass::before,
.gate-with-referral .referral-pass::after {
  content: '';
  position: absolute;
  pointer-events: none;
}
.gate-with-referral .referral-pass::before {
  z-index: -2;
  inset: clamp(8px, 2vw, 13px);
  border-radius: inherit;
  background: radial-gradient(ellipse at 54% 55%, #291b17 12%, #492716 48%, #944311 73%, #d76813 100%);
  box-shadow: 0 0 5px 5px #b54f13;
  filter: blur(12px);
}
.gate-with-referral .referral-pass::after {
  z-index: -1;
  inset-inline-end: -2%;
  inset-block-end: -22%;
  width: 49%;
  height: 118%;
  background: url('/me/assets/referral-lumi.webp') right bottom / contain no-repeat;
}
.gate-with-referral .referral-pass strong {
  font-size: clamp(2.5rem, 9vw, 3.125rem);
  font-variant-numeric: proportional-nums;
  letter-spacing: -.04em;
}
.gate-with-referral .referral-pass span { line-height: 1.3; }
.gate-with-referral .referral-pass small { color: #fff0de; }

.gate-login .sign-in .btn.primary {
  min-height: 56px;
  border-radius: 12px;
  font-size: 16px;
  font-weight: 650;
}
.gate-confirming #door-tg { gap: 4px; }
.gate-confirming #door-tg .btn.quiet { justify-self: center; }
.gate-login .gate-more > .text-link { justify-content: center; color: var(--cab-secondary); }

.gate-login .gate-choices {
  margin-top: 16px;
  border-radius: 12px;
  overflow: hidden;
  background: var(--gate-surface);
}
.gate-login .gate-choices .help-disclosure {
  margin: 0;
  border-top: 1px solid var(--gate-line);
  border-radius: 0;
  background: transparent;
}
.gate-login .gate-choices .gate-choice {
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr) 16px;
  align-items: center;
  gap: 11px;
  min-height: 56px;
  padding: 10px 14px;
  border-radius: 0;
  color: var(--cab-ink);
  font-size: 15px;
  font-weight: 530;
  line-height: 1.4;
  text-align: start;
  text-decoration: none;
}
.gate-choice > .icon { width: 20px; height: 20px; color: var(--cab-muted); }
.gate-choice > .icon:last-child { width: 16px; height: 16px; }
.gate-login .gate-choices details[open] summary > .icon:first-child { transform: none; }
.gate-login .gate-choice:focus-visible { outline-offset: -3px; }
@media (hover: hover) {
  .gate-login .gate-choice:hover { background: #222; }
}

.gate-code { padding: 0 16px 16px; }
.gate-login .gate-code .gate-form { margin-top: 4px; gap: 12px; }
.gate-login .sign-in .field { text-align: center; }
.gate-login .sign-in .code-input {
  border: 1px solid #606060;
  background: var(--gate-surface);
}
.gate-login .sign-in .code-input[aria-invalid="true"] { border-color: var(--cab-danger); }
.gate-login #code-hint:empty { display: none; }
.gate-login .gate-code #code-location {
  margin: 12px 0 0;
  color: var(--cab-muted);
  font-size: 13px;
}
.gate-login .sign-in #tv-activation-gate { margin-top: 0; }
.gate-login .status.is-pending { justify-content: center; }

.gate-login .sign-in .gate-consent {
  margin: 14px 0 0;
  color: var(--cab-muted);
  font-size: 12px;
  line-height: 1.5;
  text-align: center;
  text-wrap: pretty;
}
.gate-login .gate-consent a {
  display: inline;
  color: inherit;
  font: inherit;
  text-decoration: underline;
  text-underline-offset: 3px;
}
.gate-login .gate-consent a:hover { color: var(--cab-ink); }

.gate-login .gate-footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 0 16px;
  padding: 4px 0 max(12px, env(safe-area-inset-bottom));
  color: #a2a2a2;
  font-size: 13px;
}
.gate-login .gate-footer > a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  color: inherit;
  text-decoration: none;
  text-underline-offset: 4px;
}
.gate-login .gate-footer > a:hover { color: var(--cab-ink); text-decoration: underline; }
.gate-login .gate-footer .interface-language > span,
.gate-login .gate-footer .language-name { display: none; }
.gate-login .gate-footer .language-code { display: inline; }
.gate-login .gate-footer .interface-language-options {
  gap: 2px;
  padding: 0;
  border: 0;
  background: none;
}
.gate-login .gate-footer .interface-language-options button {
  display: grid;
  place-items: center;
  min-width: 44px;
  min-height: 44px;
  padding: 0 8px;
  color: inherit;
  font-size: 12px;
  text-align: center;
  opacity: 1;
}
.gate-login .gate-footer .interface-language-options button[aria-pressed="true"] {
  color: var(--cab-ink);
  background: transparent;
}
.gate-login .gate-footer .interface-language-options button[aria-pressed="true"] .language-code {
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 5px;
}
.gate-login .gate-footer .interface-language-options button:focus-visible {
  outline-color: var(--cab-ink);
  outline-offset: -5px;
}

@media (prefers-reduced-motion: no-preference) {
  .gate-mascot .one-brand-character {
    transform-box: fill-box;
    transform-origin: 50% 85%;
    animation: gate-character-in 620ms cubic-bezier(.16, 1, .3, 1) both;
  }
  .gate-mascot .one-brand-eye {
    transform-box: fill-box;
    transform-origin: center;
    animation: gate-eye-blink 190ms ease-in-out 720ms;
  }
  .gate-confirming .sign-in { animation: gate-confirm-in 280ms cubic-bezier(.16, 1, .3, 1) both; }
}

@keyframes gate-character-in {
  from { opacity: .25; transform: translateY(32px) scale(.89); }
  70% { opacity: 1; transform: translateY(-7px) scale(1.015); }
  to { opacity: 1; transform: none; }
}
@keyframes gate-eye-blink { 45% { transform: scaleY(.1); } }
@keyframes gate-confirm-in { from { opacity: .4; transform: translateY(4px); } }

/* Вход по почте (me-gate.js, control/cabinet_email.py): дверь под Telegram и экраны почты. */
.gate-login .email-door { margin-top: 10px; }
.gate-login .email-door .btn:not(.primary) { min-height: 56px; border-radius: 12px; font-size: 16px; font-weight: 600; }
.gate-login .mail-form { margin-top: 4px; gap: 14px; }
.gate-login .mail-form .field { text-align: start; }
.gate-login .mail-form .mail-input { border: 1px solid #606060; background: var(--gate-surface); }
.gate-login .mail-form .code-input { text-transform: none; }
.gate-login .mail-links { display: flex; flex-wrap: wrap; justify-content: center; gap: 4px 12px; margin-top: 12px; }
.gate-login #mail-status:empty { display: none; }
.gate-login.gate-mail .gate-more { margin-top: 8px; }

/* Вход через Яндекс ID (me-gate.js, control/cabinet_yandex.py): знак «Я» в красном круге — по правилам бренда Яндекса, кнопка — наша. */
.gate-login .yandex-door { margin-top: 10px; }
.gate-login .yandex-door .btn { min-height: 56px; border-radius: 12px; font-size: 16px; font-weight: 600; gap: 10px; }
.yandex-mark { display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; background: #fc3f1d; color: #fff; font-size: 14px; font-weight: 700; line-height: 1; }

/* Объединить аккаунты (me-account.js, control/account_merge.py): два аккаунта рядом, остающийся отмечен. */
.merge-offer { margin-bottom: 20px; }
.merge-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 240px), 1fr)); gap: 12px; margin: 12px 0; }
.merge-card { padding: 14px 16px; border: 1px solid var(--cab-field-line, #333); border-radius: 12px; }
.merge-card.merge-stays { border-color: var(--cab-accent, #f1f1f1); }
.merge-card h4 { margin: 0 0 8px; font-size: 15px; }
.merge-card h4 small { color: var(--cab-muted, #a9a9a9); font-weight: 500; }
.merge-facts { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 4px 12px; margin: 0; font-size: 14px; }
.merge-facts dt { color: var(--cab-muted, #a9a9a9); }
.merge-facts dd { margin: 0; overflow-wrap: anywhere; }
.merge-choice { display: flex; flex-wrap: wrap; gap: 8px; margin: 8px 0; }
