/* auth.css — вынесен из auth-history.css */
/* styles/auth-history.css — split from styles.css (structural only) */

/* --- Auth / History panels (URL routing + persistence) --- */
.panel-screen {
  width: min(720px, 100%);
  margin: 0 auto;
  padding: 0.35rem 1rem 2.4rem;
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.auth-screen .subtitle,
.history-screen .subtitle {
  text-align: center;
  margin: 0;
}

.auth-form,
.auth-actions,
.history-actions,
.daily-result-actions,
.result-actions {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

/* full-width auth/history/daily: morph + силуэтный ореол (btn-shell-stretch), не прямоугольный halo */
.auth-actions .btn-shell-stretch,
.history-actions .btn-shell-stretch,
.daily-result-actions .btn-shell-stretch,
.result-actions .btn-shell-stretch {
  display: flex;
  width: 100%;
  overflow: visible;
}

.auth-oauth {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  margin-top: 0;
  width: max-content;
  max-width: 100%;
  box-sizing: border-box;
}

/* display:flex выше иначе перебивает [hidden] без !important */
.auth-oauth[hidden] {
  display: none !important;
}

.auth-oauth-divider {
  margin: 0;
  text-align: center;
  font-size: 0.85rem;
  opacity: 0.72;
}

.auth-oauth-buttons {
  display: flex;
  flex-direction: row;
  flex-wrap: nowrap;
  justify-content: center;
  align-items: center;
  gap: 0.75rem;
  width: max-content;
  max-width: 100%;
  box-sizing: border-box;
  min-height: 3.85rem;
  overflow: visible;
}

.auth-oauth-buttons > .btn-shell {
  display: inline-flex;
  width: 3.85rem;
  height: 3.85rem;
  flex: 0 0 3.85rem;
  overflow: visible;
}

/* Глобальный `.btn-shell > .app-button { min-width: 0 }` схлопывал круглые иконки */
.auth-oauth-buttons > .btn-shell > .app-button {
  flex: 0 0 auto;
  width: 3.85rem !important;
  min-width: 3.85rem !important;
  max-width: 3.85rem !important;
  height: 3.85rem !important;
  min-height: 3.85rem !important;
}

.auth-oauth-buttons .btn-shell-stretch {
  display: flex;
  width: auto;
  overflow: visible;
}

/* OAuth + guest: ширина ряда иконок; guest растягивается под него */
.auth-social-block {
  display: inline-flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0.75rem;
  width: max-content;
  max-width: 100%;
  margin-inline: auto;
  box-sizing: border-box;
  align-self: center;
}

/* Перебить `.auth-actions .btn-shell-stretch { width: 100% }` — guest = ширина ряда иконок */
.auth-actions .auth-social-block > .btn-shell-stretch:has(.auth-guest-btn) {
  width: 0;
  min-width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}

.auth-guest-btn.app-plaque-button {
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  justify-content: center;
  text-align: center;
  white-space: normal;
}

/* Soft-swap login ↔ register: только opacity + translate (без blur) */
.auth-screen {
  --auth-swap-x: 0px;
}

.auth-screen.auth-swap-out {
  opacity: 0;
  transform: translate3d(var(--auth-swap-x), 0, 0);
  pointer-events: none;
  transition:
    opacity 170ms ease,
    transform 190ms cubic-bezier(0.22, 0.61, 0.36, 1);
}

.auth-screen.auth-swap-to-left {
  --auth-swap-x: -12px;
}

.auth-screen.auth-swap-to-right {
  --auth-swap-x: 12px;
}

.auth-screen.auth-swap-prep {
  opacity: 0;
  transform: translate3d(var(--auth-swap-x), 0, 0);
  transition: none;
  pointer-events: none;
}

.auth-screen.auth-swap-from-right {
  --auth-swap-x: 12px;
}

.auth-screen.auth-swap-from-left {
  --auth-swap-x: -12px;
}

.auth-screen.auth-swap-in {
  opacity: 1;
  transform: translate3d(0, 0, 0);
  transition:
    opacity 210ms ease,
    transform 230ms cubic-bezier(0.22, 0.61, 0.36, 1);
}

@media (prefers-reduced-motion: reduce) {
  .auth-screen.auth-swap-out,
  .auth-screen.auth-swap-prep,
  .auth-screen.auth-swap-in {
    opacity: 1;
    transform: none;
    transition: none;
    pointer-events: auto;
  }
}

/* Круглые OAuth-иконки: неровный «ломаный» круг в духе plaque, не идеальный border-radius */
.auth-oauth-icon-btn.app-button.btn-variant-icon,
.auth-oauth-icon-btn.app-plaque-button.btn-variant-icon {
  width: 3.85rem !important;
  min-width: 3.85rem !important;
  height: 3.85rem !important;
  min-height: 3.85rem !important;
  padding: 0 !important;
  justify-content: center;
  align-items: center;
  place-content: center;
  --btn-border-radius: 50%;
  clip-path: polygon(
    50% 1.5%,
    61.5% 3.5%,
    72% 7.5%,
    81% 14%,
    88% 22.5%,
    93.5% 33%,
    97% 44.5%,
    98% 56%,
    95.5% 67%,
    90% 77%,
    82% 85.5%,
    71.5% 92%,
    59.5% 96%,
    47% 97.5%,
    35% 95.5%,
    24% 90.5%,
    15% 83%,
    8.5% 73.5%,
    4% 62.5%,
    2% 51%,
    2.5% 39%,
    6% 28%,
    12% 18.5%,
    20.5% 11%,
    31% 5.5%,
    41% 2.5%
  );
  -webkit-clip-path: polygon(
    50% 1.5%,
    61.5% 3.5%,
    72% 7.5%,
    81% 14%,
    88% 22.5%,
    93.5% 33%,
    97% 44.5%,
    98% 56%,
    95.5% 67%,
    90% 77%,
    82% 85.5%,
    71.5% 92%,
    59.5% 96%,
    47% 97.5%,
    35% 95.5%,
    24% 90.5%,
    15% 83%,
    8.5% 73.5%,
    4% 62.5%,
    2% 51%,
    2.5% 39%,
    6% 28%,
    12% 18.5%,
    20.5% 11%,
    31% 5.5%,
    41% 2.5%
  );
}

.auth-oauth-icon-btn .app-button-label,
.auth-oauth-icon-btn .btn-label {
  display: none;
}

.auth-oauth-icon-btn.app-plaque-button.has-section-icon > .profile-section-icon {
  position: absolute;
  left: 50%;
  top: 50%;
  right: auto;
  bottom: auto;
  margin: 0;
  width: 1.95rem;
  height: 1.95rem;
  transform: translate(-50%, -50%);
  opacity: 0.98;
}

.auth-oauth-icon-btn.app-plaque-button.has-section-icon > .profile-section-icon svg {
  width: 100%;
  height: 100%;
  display: block;
}

/* Пастельные фирменные оттенки (Яндекс / VK / OK / Mail) */
.auth-oauth-icon-btn .profile-section-icon[data-icon="yandex"] {
  color: #e2a090;
}

.auth-oauth-icon-btn .profile-section-icon[data-icon="vk"] {
  color: #8fb4e6;
}

/* VK-логотип: квадрат 2…22 в viewBox — слегка уменьшаем, поля ровные */
.auth-oauth-icon-btn .profile-section-icon[data-icon="vk"] svg {
  width: 100%;
  height: 100%;
  margin: 0;
  transform: scale(0.9);
  transform-origin: center center;
}

.auth-oauth-icon-btn .profile-section-icon[data-icon="ok"] {
  color: #e4b57a;
}

.auth-oauth-icon-btn .profile-section-icon[data-icon="mailru"] {
  color: #8fa8dc;
}

html[data-design="classic"] .auth-oauth-icon-btn .profile-section-icon[data-icon="yandex"] {
  color: #d4a090;
}

html[data-design="classic"] .auth-oauth-icon-btn .profile-section-icon[data-icon="vk"] {
  color: #7fa6d4;
}

html[data-design="classic"] .auth-oauth-icon-btn .profile-section-icon[data-icon="ok"] {
  color: #d4a86a;
}

html[data-design="classic"] .auth-oauth-icon-btn .profile-section-icon[data-icon="mailru"] {
  color: #7f98c8;
}

.auth-callback-screen .subtitle {
  text-align: center;
}

.auth-field {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.auth-field-label {
  font-size: 0.85rem;
  opacity: 0.82;
}

.auth-input-row {
  display: flex;
  align-items: stretch;
  gap: 0.45rem;
}

.auth-input-row .auth-input {
  flex: 1 1 auto;
  min-width: 0;
}

.auth-input {
  appearance: none;
  border: 1px solid color-mix(in srgb, var(--cyan) 35%, transparent);
  background: color-mix(in srgb, var(--bg-soft) 78%, transparent);
  color: inherit;
  border-radius: 12px;
  padding: 0.75rem 0.9rem;
  font: inherit;
}

.auth-input:focus {
  outline: 2px solid color-mix(in srgb, var(--cyan) 55%, transparent);
  outline-offset: 1px;
}

.auth-login-check-btn {
  appearance: none;
  flex: 0 0 auto;
  width: 44px;
  min-height: 44px;
  display: inline-grid;
  place-items: center;
  padding: 0;
  border-radius: 12px;
  border: 1px solid color-mix(in srgb, var(--cyan) 40%, transparent);
  background: color-mix(in srgb, var(--bg-soft) 82%, transparent);
  color: color-mix(in srgb, var(--cyan) 88%, #fff 12%);
  cursor: pointer;
  transition: border-color 180ms ease, background 180ms ease, color 180ms ease, transform 160ms ease;
}

.auth-password-toggle-btn {
  appearance: none;
  flex: 0 0 auto;
  width: 44px;
  min-height: 44px;
  display: inline-grid;
  place-items: center;
  padding: 0;
  border-radius: 12px;
  border: 1px solid color-mix(in srgb, var(--cyan) 40%, transparent);
  background: color-mix(in srgb, var(--bg-soft) 82%, transparent);
  color: color-mix(in srgb, var(--cyan) 88%, #fff 12%);
  cursor: pointer;
  transition: border-color 180ms ease, background 180ms ease, color 180ms ease, transform 160ms ease;
}

.auth-login-check-btn:hover,
.auth-login-check-btn:focus-visible,
.auth-password-toggle-btn:hover,
.auth-password-toggle-btn:focus-visible {
  border-color: color-mix(in srgb, var(--cyan) 70%, transparent);
  background: color-mix(in srgb, var(--cyan) 16%, var(--bg-soft));
  outline: none;
}

.auth-login-check-btn:active,
.auth-password-toggle-btn:active {
  transform: translateY(1px);
}

.auth-login-check-btn:disabled {
  opacity: 0.55;
  cursor: wait;
}

.auth-login-check-icon,
.auth-password-toggle-icon {
  width: 20px;
  height: 20px;
  display: block;
}

.auth-password-toggle-btn[aria-pressed="true"] {
  color: color-mix(in srgb, var(--cyan) 70%, #fff 30%);
  border-color: color-mix(in srgb, var(--cyan) 58%, transparent);
}

.auth-checklist {
  list-style: none;
  margin: 0.15rem 0 0;
  padding: 0.35rem 0.55rem;
  display: grid;
  gap: 0.2rem;
  border-radius: 10px;
  background: color-mix(in srgb, var(--bg-soft) 55%, transparent);
  border: 1px solid color-mix(in srgb, var(--cyan) 16%, transparent);
}

/* display:grid иначе перебивает [hidden] — чеклист виден до ввода */
.auth-checklist[hidden] {
  display: none !important;
}

.auth-checklist-item {
  position: relative;
  padding-left: 1.15rem;
  font-size: 0.8rem;
  line-height: 1.35;
  opacity: 0.88;
}

.auth-checklist-item::before {
  content: "○";
  position: absolute;
  left: 0;
  top: 0;
  font-size: 0.78rem;
}

.auth-checklist-item.is-ok {
  color: color-mix(in srgb, #8dffb5 78%, #fff 22%);
}

.auth-checklist-item.is-ok::before {
  content: "✓";
}

.auth-checklist-item.is-bad {
  color: color-mix(in srgb, #ffb0bc 72%, #fff 28%);
}

.auth-checklist-item.is-bad::before {
  content: "×";
}

.auth-login-status {
  margin: 0.1rem 0 0;
  font-size: 0.84rem;
  line-height: 1.35;
}

.auth-login-status.is-ok {
  color: color-mix(in srgb, #8dffb5 78%, #fff 22%);
}

.auth-login-status.is-bad {
  color: #ff8f9f;
}

.auth-login-status.is-pending {
  opacity: 0.78;
}

.auth-error {
  color: #ff8f9f;
  margin: 0;
  font-size: 0.92rem;
}

.auth-session-note {
  opacity: 0.8;
  margin: 0;
}

/* Auth brand: «Чертог» | ворон | «Ворона»; крупная типографика. */
.app-shell[data-stage="auth-login"],
.app-shell[data-stage="auth-register"] {
  padding-top: calc(28px + env(safe-area-inset-top, 0px));
}

.app-shell[data-stage="auth-login"] > .top-bar.top-bar-auth-brand,
.app-shell[data-stage="auth-register"] > .top-bar.top-bar-auth-brand {
  position: relative;
  display: block;
  justify-content: center;
  width: 100%;
  max-width: 100%;
  min-height: clamp(210px, 32vw, 300px);
  margin: 0 0 0.65rem;
  padding: 18px 0 10px;
  box-sizing: border-box;
  overflow: visible;
}

.app-shell[data-stage="auth-login"] > .top-bar.top-bar-auth-brand > .top-bar-brand-auth,
.app-shell[data-stage="auth-register"] > .top-bar.top-bar-auth-brand > .top-bar-brand-auth {
  --raven-w: clamp(220px, 32vw, 340px);
  --raven-h: clamp(145px, 21vw, 220px);
  --brand-gap: clamp(8px, 1.6vw, 24px);
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  bottom: 0;
  grid-column: 1 / -1;
  justify-self: stretch;
  display: block;
  width: 100%;
  max-width: none;
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  pointer-events: none;
  z-index: 2;
  overflow: visible;
}

.app-shell[data-stage="auth-login"] > .top-bar.top-bar-auth-brand > .top-bar-brand-auth > .top-bar-auth-raven-stack,
.app-shell[data-stage="auth-register"] > .top-bar.top-bar-auth-brand > .top-bar-brand-auth > .top-bar-auth-raven-stack {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  width: max-content;
  z-index: 3;
  pointer-events: none;
}

.app-shell[data-stage="auth-login"] > .top-bar.top-bar-auth-brand > .top-bar-brand-auth .top-bar-raven,
.app-shell[data-stage="auth-register"] > .top-bar.top-bar-auth-brand > .top-bar-brand-auth .top-bar-raven {
  position: relative;
  left: auto;
  top: auto;
  width: var(--raven-w);
  height: var(--raven-h);
  margin: 0;
  transform: none;
  pointer-events: auto;
}

.app-shell[data-stage="auth-login"] > .top-bar.top-bar-auth-brand > .top-bar-brand-auth > .top-bar-title-wrap:first-child,
.app-shell[data-stage="auth-register"] > .top-bar.top-bar-auth-brand > .top-bar-brand-auth > .top-bar-title-wrap:first-child {
  position: absolute;
  top: 50%;
  right: calc(50% + (var(--raven-w) / 2) + var(--brand-gap));
  left: auto;
  transform: translateY(-50%);
  display: grid;
  width: max-content;
  max-width: min(40vw, 360px);
  padding: 8px 10px 14px;
  justify-items: end;
  box-sizing: border-box;
  overflow: visible;
}

.app-shell[data-stage="auth-login"] > .top-bar.top-bar-auth-brand > .top-bar-brand-auth > .top-bar-title-wrap:last-of-type,
.app-shell[data-stage="auth-register"] > .top-bar.top-bar-auth-brand > .top-bar-brand-auth > .top-bar-title-wrap:last-of-type {
  position: absolute;
  top: 50%;
  left: calc(50% + (var(--raven-w) / 2) + var(--brand-gap));
  right: auto;
  transform: translateY(-50%);
  display: grid;
  width: max-content;
  max-width: min(40vw, 360px);
  padding: 8px 10px 14px;
  justify-items: start;
  box-sizing: border-box;
  overflow: visible;
}

.app-shell[data-stage="auth-login"] > .top-bar.top-bar-auth-brand > .top-bar-brand-auth .top-bar-app-title,
.app-shell[data-stage="auth-login"] > .top-bar.top-bar-auth-brand > .top-bar-brand-auth .top-bar-path-title,
.app-shell[data-stage="auth-register"] > .top-bar.top-bar-auth-brand > .top-bar-brand-auth .top-bar-app-title,
.app-shell[data-stage="auth-register"] > .top-bar.top-bar-auth-brand > .top-bar-brand-auth .top-bar-path-title {
  max-width: 100%;
  font-size: clamp(2.4rem, 6.5vw, 4.4rem);
  white-space: nowrap;
  overflow: visible;
  animation: modeTitleLevitate 5.8s ease-in-out infinite;
  line-height: 1.05;
  text-shadow:
    0 0 10px rgba(210, 180, 255, 0.55),
    0 0 22px rgba(150, 210, 255, 0.4),
    0 0 36px rgba(174, 132, 255, 0.32),
    0 6px 18px rgba(8, 6, 24, 0.45);
}

.app-shell[data-stage="auth-login"] > .top-bar.top-bar-auth-brand > .top-bar-brand-auth .top-bar-app-title,
.app-shell[data-stage="auth-register"] > .top-bar.top-bar-auth-brand > .top-bar-brand-auth .top-bar-app-title {
  text-align: right;
  justify-self: end;
}

.app-shell[data-stage="auth-login"] > .top-bar.top-bar-auth-brand > .top-bar-brand-auth .top-bar-path-title,
.app-shell[data-stage="auth-register"] > .top-bar.top-bar-auth-brand > .top-bar-brand-auth .top-bar-path-title {
  text-align: left;
  justify-self: start;
}

.app-shell[data-stage="auth-login"] > .top-bar.top-bar-auth-brand > .top-bar-brand-auth .top-bar-title-wrap::before,
.app-shell[data-stage="auth-register"] > .top-bar.top-bar-auth-brand > .top-bar-brand-auth .top-bar-title-wrap::before {
  left: 6%;
  right: 6%;
  bottom: 4px;
  height: 28px;
  filter: blur(14px);
  opacity: 0.78;
  pointer-events: none;
}

.app-shell[data-stage="auth-login"] > .top-bar.top-bar-auth-brand > .top-bar-brand-auth .top-bar-title-sparks,
.app-shell[data-stage="auth-register"] > .top-bar.top-bar-auth-brand > .top-bar-brand-auth .top-bar-title-sparks {
  position: absolute;
  inset: auto 4% 2px 4%;
  height: 34px;
  overflow: visible;
  z-index: 2;
  pointer-events: none;
}

@media (max-width: 760px) {
  .auth-oauth-buttons {
    gap: 0.4rem;
    min-height: 3.6rem;
  }

  .auth-oauth-buttons > .btn-shell {
    width: 3.6rem;
    height: 3.6rem;
    flex: 0 0 3.6rem;
  }

  .auth-oauth-buttons > .btn-shell > .app-button,
  .auth-oauth-icon-btn.app-button.btn-variant-icon,
  .auth-oauth-icon-btn.app-plaque-button.btn-variant-icon {
    width: 3.6rem !important;
    min-width: 3.6rem !important;
    max-width: 3.6rem !important;
    height: 3.6rem !important;
    min-height: 3.6rem !important;
  }

  .app-shell[data-stage="auth-login"] > .top-bar.top-bar-auth-brand,
  .app-shell[data-stage="auth-register"] > .top-bar.top-bar-auth-brand {
    min-height: calc(28px + 210px);
    padding: 14px 0 8px;
  }

  .app-shell[data-stage="auth-login"] > .top-bar.top-bar-auth-brand > .top-bar-brand-auth,
  .app-shell[data-stage="auth-register"] > .top-bar.top-bar-auth-brand > .top-bar-brand-auth {
    --raven-w: clamp(180px, 46vw, 240px);
    --raven-h: clamp(118px, 30vw, 158px);
    --brand-gap: clamp(4px, 1.4vw, 12px);
    --brand-side: max(8px, env(safe-area-inset-left, 0px), env(safe-area-inset-right, 0px));
  }

  .app-shell[data-stage="auth-login"] > .top-bar.top-bar-auth-brand > .top-bar-brand-auth > .top-bar-title-wrap:first-child,
  .app-shell[data-stage="auth-login"] > .top-bar.top-bar-auth-brand > .top-bar-brand-auth > .top-bar-title-wrap:last-of-type,
  .app-shell[data-stage="auth-register"] > .top-bar.top-bar-auth-brand > .top-bar-brand-auth > .top-bar-title-wrap:first-child,
  .app-shell[data-stage="auth-register"] > .top-bar.top-bar-auth-brand > .top-bar-brand-auth > .top-bar-title-wrap:last-of-type {
    max-width: calc(50% - (var(--raven-w) / 2) - var(--brand-gap) - var(--brand-side));
    padding: 4px 2px 10px;
  }

  .app-shell[data-stage="auth-login"] > .top-bar.top-bar-auth-brand > .top-bar-brand-auth .top-bar-app-title,
  .app-shell[data-stage="auth-login"] > .top-bar.top-bar-auth-brand > .top-bar-brand-auth .top-bar-path-title,
  .app-shell[data-stage="auth-register"] > .top-bar.top-bar-auth-brand > .top-bar-brand-auth .top-bar-app-title,
  .app-shell[data-stage="auth-register"] > .top-bar.top-bar-auth-brand > .top-bar-brand-auth .top-bar-path-title {
    font-size: clamp(1.55rem, 8.2vw, 2.35rem);
  }

  /* Без рывка/полосы при enter: brand не раздувает ширину, enter без translateY */
  #app:has(> .app-shell[data-stage="auth-login"]),
  #app:has(> .app-shell[data-stage="auth-register"]) {
    overflow-x: clip;
    overflow-y: auto;
    max-height: var(--app-vh);
  }

  .app-shell[data-stage="auth-login"],
  .app-shell[data-stage="auth-register"] {
    overflow-x: clip;
    max-width: 100%;
    box-sizing: border-box;
  }

  .app-shell[data-stage="auth-login"].stage-enter,
  .app-shell[data-stage="auth-register"].stage-enter,
  .app-shell[data-stage="auth-login"].stage-enter[data-transition-direction="forward"],
  .app-shell[data-stage="auth-login"].stage-enter[data-transition-direction="back"],
  .app-shell[data-stage="auth-register"].stage-enter[data-transition-direction="forward"],
  .app-shell[data-stage="auth-register"].stage-enter[data-transition-direction="back"] {
    transform: none;
  }

  .app-shell[data-stage="auth-login"].stage-leave-active,
  .app-shell[data-stage="auth-register"].stage-leave-active,
  .app-shell[data-stage="auth-login"].stage-leave[data-transition-direction="forward"].stage-leave-active,
  .app-shell[data-stage="auth-login"].stage-leave[data-transition-direction="back"].stage-leave-active,
  .app-shell[data-stage="auth-register"].stage-leave[data-transition-direction="forward"].stage-leave-active,
  .app-shell[data-stage="auth-register"].stage-leave[data-transition-direction="back"].stage-leave-active {
    transform: none;
  }

  .app-shell[data-stage="auth-login"] > .top-bar.top-bar-auth-brand,
  .app-shell[data-stage="auth-register"] > .top-bar.top-bar-auth-brand {
    overflow: hidden;
  }
}

