/* Register-only overlay. Existing form and tail boxes retain geometry. */
[data-registration-gate-root] .auth-form-stage,
[data-registration-gate-root] .auth-tail-stage { position: relative; }

[data-registration-gate-main],
[data-registration-gate-tail] {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: none;
  opacity: 0;
  transform: scale(.97) translateY(6px);
  transition: opacity 180ms ease, transform 180ms ease, display 180ms allow-discrete;
  transition-behavior: allow-discrete;
}

[data-registration-gate-root][data-auth-mode="register"][data-registration-gate-state]:not([data-registration-gate-state="open"]):not([data-registration-gate-state="unlocked"]) [data-registration-gate-form-owner],
[data-registration-gate-root][data-auth-mode="register"][data-registration-gate-state]:not([data-registration-gate-state="open"]):not([data-registration-gate-state="unlocked"]) [data-registration-gate-legal-owner] {
  visibility: hidden;
  pointer-events: none;
}

[data-registration-gate-root][data-auth-mode="register"][data-registration-gate-state]:not([data-registration-gate-state="open"]):not([data-registration-gate-state="unlocked"]) [data-registration-gate-main],
[data-registration-gate-root][data-auth-mode="register"][data-registration-gate-state]:not([data-registration-gate-state="open"]):not([data-registration-gate-state="unlocked"]) [data-registration-gate-tail] {
  display: grid;
  color: #fff8e5;
  opacity: 1;
  transform: none;
  transition: opacity 180ms ease, transform 180ms ease, display 180ms allow-discrete;
  transition-behavior: allow-discrete;
  @starting-style {
    opacity: 0;
    transform: scale(.97) translateY(6px);
  }
}

[data-registration-gate-root][data-auth-mode="register"][data-registration-gate-state]:not([data-registration-gate-state="open"]):not([data-registration-gate-state="unlocked"]) [data-registration-gate-main] {
  place-items: center;
}

[data-registration-gate-root][data-auth-mode="register"][data-registration-gate-state]:not([data-registration-gate-state="open"]):not([data-registration-gate-state="unlocked"]) [data-registration-gate-tail] {
  align-content: start;
  justify-items: center;
  padding-top: 10px;
}

[data-registration-gate-panel] {
  display: grid;
  inline-size: min(100%, 420px);
  gap: 10px;
  padding: 12px;
  text-align: center;
}

[data-registration-gate-copy], [data-registration-gate-feedback] { margin: 0; font-size: 13px; line-height: 1.35; }
[data-registration-gate-feedback] { min-block-size: 18px; color: rgba(247, 241, 219, .86); }
[data-registration-gate-root][data-registration-gate-feedback-kind="error"] [data-registration-gate-feedback] { color: #ffc8c8; }

.registration-code-gate__retry {
  min-height: 44px;
  margin-top: 8px;
  padding: 8px 14px;
  border: 1px solid color-mix(in srgb, var(--gold) 44%, transparent);
  border-radius: 999px;
  color: var(--ink);
  background: color-mix(in srgb, var(--panel-strong) 88%, transparent);
  font: inherit;
  font-weight: 750;
  cursor: pointer;
}

.registration-code-gate__retry[hidden] { display: none !important; }

.registration-code-gate__retry:focus-visible {
  outline: 2px solid #fff2af;
  outline-offset: 2px;
}

.registration-code-gate__eyebrow {
  margin: 0;
  color: color-mix(in srgb, var(--gold) 88%, transparent);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .14em;
  text-transform: uppercase;
}

.registration-code-gate__mechanism {
  display: grid;
  width: min(100%, 276px);
  margin-inline: auto;
}

.registration-code-gate__wheels {
  display: grid;
  grid-template-columns: repeat(4, minmax(36px, 1fr));
  gap: 5px;
  /* Нижняя стрелка тянет свою 44px цель вниз; без этого поля она легла бы
     поверх кнопки разблокировки. */
  margin-bottom: 18px;
}

.registration-code-gate__wheel {
  box-sizing: border-box;
  min-width: 0;
  min-height: 44px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 3px;
  border: 1px solid rgba(241, 208, 113, .38);
  border-radius: 10px;
  background: linear-gradient(180deg, #4a3a1a, #c79a3f 30%, #8a6a2f 70%, #4a3a1a);
  touch-action: pinch-zoom;
}

.registration-code-gate__wheel[data-registration-gate-selected="true"] {
  border-color: #fff2af;
  box-shadow: 0 0 0 1px rgba(255, 242, 175, .36);
}

.registration-code-gate__wheel input,
.registration-code-gate__handle {
  box-sizing: border-box;
  min-height: 44px;
  border: 0;
  color: inherit;
  font: inherit;
}

.registration-code-gate__wheel input {
  width: 100%;
  min-width: 0;
  padding: 0;
  border-radius: 9px;
  background: rgba(4, 5, 8, .48);
  color: #eae6da;
  text-align: center;
  font-size: 27px;
  font-variant-numeric: tabular-nums;
  font-weight: 900;
  text-shadow: 0 0 5px rgba(234, 230, 218, .28);
  outline: none;
}

.registration-code-gate__step {
  position: relative;
  box-sizing: border-box;
  flex: 0 0 20px;
  min-height: 20px;
  min-width: 0;
  width: 100%;
  border: none;
  border-radius: 9px;
  color: rgba(35, 26, 10, .65);
  background: transparent;
  font: inherit;
  font-size: 16px;
  line-height: 1;
  padding: 0;
  transition: color .1s ease, transform .1s ease;
}

/* Видимая стрелка компактная, но цель указателя остаётся 44px и уходит
   наружу от цифры — так же, как в Apps. */
.registration-code-gate__step::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  height: 44px;
}

.registration-code-gate__step[data-registration-gate-step="up"]::after { bottom: 0; }
.registration-code-gate__step[data-registration-gate-step="down"]::after { top: 0; }

.registration-code-gate__step:hover { color: rgba(35, 26, 10, .95); }
.registration-code-gate__step:active { transform: scale(.85); }

.registration-code-gate__handle {
  width: min(100%, 276px);
  margin-inline: auto;
  min-height: 48px;
  border: 1px solid rgba(241, 208, 113, .5);
  border-radius: 999px;
  color: #3a2606;
  background: linear-gradient(180deg, #fce8ac, #e9bc58 55%, #c49735);
  font-weight: 900;
  box-shadow: 0 12px 30px rgba(0, 0, 0, .2);
  animation: registration-gate-gold-pulse 3.8s ease-in-out infinite;
}

@keyframes registration-gate-gold-pulse {
  0% { box-shadow: -4px 3px 15px -4px color-mix(in srgb, var(--gold) 32%, transparent); }
  50% { box-shadow: 4px 3px 15px -4px color-mix(in srgb, var(--gold) 48%, transparent); }
  100% { box-shadow: -4px 3px 15px -4px color-mix(in srgb, var(--gold) 32%, transparent); }
}

[data-registration-gate-root] .registration-code-gate__mechanism :is(input, button):focus-visible,
[data-registration-gate-root] .registration-code-gate__handle:focus-visible {
  outline: 2px solid #fff2af;
  outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
  [data-registration-gate-main],
  [data-registration-gate-tail] {
    transition: none;
  }

  .registration-code-gate__handle {
    animation: none;
  }
}

/* STORYCAST-AUTH-ENTRY-002: the gate is a first-class pane in the shared
 * auth zone. Main content and feedback own separate, non-overlapping layers. */
html[data-ui-release] [data-auth-entry-canon="storycast-entry-v2"] [data-auth-pane-stack],
html[data-ui-release] [data-auth-entry-canon="storycast-entry-v2"] [data-auth-status] {
  position: relative;
}

html[data-ui-release] [data-auth-entry-canon="storycast-entry-v2"] [data-registration-gate-main],
html[data-ui-release] [data-auth-entry-canon="storycast-entry-v2"] [data-registration-gate-tail] {
  display: none;
  opacity: 0;
  pointer-events: none;
  transform: scale(.97) translateY(6px);
}

html[data-ui-release] [data-auth-entry-canon="storycast-entry-v2"][data-auth-mode="register"][data-registration-gate-state]:not([data-registration-gate-state="open"]):not([data-registration-gate-state="unlocked"]) [data-registration-gate-main] {
  position: absolute;
  top: 0;
  right: 0;
  bottom: auto;
  left: 0;
  z-index: 4;
  display: grid;
  place-items: start center;
  color: var(--ink);
  opacity: 1;
  pointer-events: auto;
  transform: none;
  animation: registration-gate-pane-appear 180ms cubic-bezier(.22, .68, .24, 1) both;
}

html[data-ui-release] [data-auth-entry-canon="storycast-entry-v2"][data-auth-mode="register"][data-registration-gate-state]:not([data-registration-gate-state="open"]):not([data-registration-gate-state="unlocked"]) [data-registration-gate-tail] {
  position: absolute;
  inset: 0;
  z-index: 4;
  display: grid;
  align-content: center;
  justify-items: center;
  padding: 0;
  opacity: 1;
  pointer-events: auto;
  transform: none;
  animation: registration-gate-pane-appear 180ms cubic-bezier(.22, .68, .24, 1) both;
}

html[data-ui-release] [data-auth-entry-canon="storycast-entry-v2"] [data-registration-gate-panel] {
  box-sizing: border-box;
  inline-size: min(100%, 420px);
  gap: 10px;
  padding: 2px 0 0;
}

html[data-ui-release] [data-auth-entry-canon="storycast-entry-v2"] [data-registration-gate-copy],
html[data-ui-release] [data-auth-entry-canon="storycast-entry-v2"] [data-registration-gate-feedback] {
  color: color-mix(in srgb, var(--muted) 88%, var(--ink));
}

html[data-ui-release] [data-auth-entry-canon="storycast-entry-v2"] .registration-code-gate__wheel,
html[data-ui-release] [data-auth-entry-canon="storycast-entry-v2"] .registration-code-gate__handle,
html[data-ui-release] [data-auth-entry-canon="storycast-entry-v2"] .registration-code-gate__step {
  cursor: pointer;
}

html[data-ui-release] [data-auth-entry-canon="storycast-entry-v2"] .registration-code-gate__handle {
  transition: filter 160ms ease, transform 160ms ease;
}

html[data-ui-release] [data-auth-entry-canon="storycast-entry-v2"] .registration-code-gate__handle:hover:not(:disabled) {
  filter: brightness(1.08);
  transform: translateY(-1px);
}

html[data-ui-release] [data-auth-entry-canon="storycast-entry-v2"] .registration-code-gate__handle:disabled,
html[data-ui-release] [data-auth-entry-canon="storycast-entry-v2"] .registration-code-gate__step:disabled {
  cursor: progress;
  opacity: .62;
}

html[data-ui-release] [data-auth-entry-canon="storycast-entry-v2"][data-registration-gate-state="unlocking"] [data-registration-gate-main],
html[data-ui-release] [data-auth-entry-canon="storycast-entry-v2"][data-registration-gate-state="unlocking"] [data-registration-gate-tail] {
  animation: registration-gate-pane-yield 180ms cubic-bezier(.22, .68, .24, 1) both;
}

@keyframes registration-gate-pane-appear {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: none; }
}

@keyframes registration-gate-pane-yield {
  from { opacity: 1; transform: none; }
  to { opacity: 0; transform: scale(.98) translateY(-4px); }
}

@media (prefers-reduced-motion: reduce) {
  html[data-ui-release] [data-auth-entry-canon="storycast-entry-v2"] [data-registration-gate-main],
  html[data-ui-release] [data-auth-entry-canon="storycast-entry-v2"] [data-registration-gate-tail],
  html[data-ui-release] [data-auth-entry-canon="storycast-entry-v2"] .registration-code-gate__handle {
    animation: none;
    transition: none;
  }
}
