body.login-page,
body.signup-page,
body.recovery-page,
body.profile-page {
  --nv-area-accent: var(--nv-gold);
  min-height: 100vh;
  color: var(--nv-text-primary);
  background:
    radial-gradient(circle at 50% 4%, rgba(40, 103, 178, 0.24), transparent 34%),
    linear-gradient(180deg, var(--nv-bg-section), var(--nv-bg-page) 48%, var(--nv-bg-deep));
}

.auth-page {
  width: min(100% - 2rem, 560px);
  margin-inline: auto;
  padding: 1rem 0 clamp(3rem, 7vw, 5rem);
}

.auth-page--wide {
  width: min(100% - 2rem, 640px);
}

.auth-illustration {
  width: min(270px, 58vw);
  max-height: 250px;
  margin: 0 auto 0.8rem;
  object-fit: contain;
  filter:
    drop-shadow(0 0 16px rgba(224, 169, 27, 0.24))
    drop-shadow(0 0 28px rgba(72, 148, 232, 0.10));
  transform-origin: center bottom;
  animation: authPresence 3.8s ease-in-out infinite;
}

.login-page .auth-illustration {
  animation: authFloat 4s ease-in-out infinite;
}

@keyframes authFloat {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-7px); }
}

@keyframes authPresence {
  0%, 100% {
    transform: scale(1);
    filter: drop-shadow(0 0 14px rgba(224, 169, 27, 0.20));
  }
  50% {
    transform: scale(1.012);
    filter: drop-shadow(0 0 20px rgba(224, 169, 27, 0.30));
  }
}

.auth-card,
.profile-card,
.profile-hero {
  position: relative;
  overflow: hidden;
  border: 1px solid var(--nv-border-default);
  border-radius: var(--nv-radius-lg);
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.025), transparent 45%),
    rgba(3, 8, 18, 0.94);
  box-shadow: var(--nv-shadow-lg);
  backdrop-filter: blur(8px);
}

.auth-card::before,
.profile-card::before,
.profile-hero::before {
  content: "";
  position: absolute;
  top: -1px;
  left: 20px;
  width: 92px;
  height: 2px;
  background: var(--nv-gold-bright);
}

.auth-card {
  padding: clamp(1.25rem, 4vw, 2rem);
  text-align: left;
}

.auth-kicker {
  margin: 0 0 0.45rem;
  color: var(--nv-gold-bright);
  font-size: 0.73rem;
  font-weight: 900;
  letter-spacing: 0.15em;
  text-transform: uppercase;
}

.auth-card h1,
.profile-hero h1,
.profile-card h2 {
  margin: 0;
  line-height: 1.15;
}

.auth-card h1 {
  font-size: clamp(1.65rem, 5vw, 2.35rem);
}

.auth-intro,
.profile-card > p,
.profile-member {
  margin: 0.7rem 0 1.2rem;
  color: var(--nv-text-secondary);
  line-height: 1.65;
}

.auth-field {
  margin-top: 0.9rem;
  display: grid;
  gap: 0.35rem;
}

.auth-field label {
  color: var(--nv-text-primary);
  font-size: 0.84rem;
  font-weight: 800;
}

.auth-field input {
  width: 100%;
  min-height: 49px;
  padding: 0.72rem 0.85rem;
  border: 1px solid var(--nv-border-default);
  border-radius: var(--nv-radius-sm);
  outline: none;
  color: var(--nv-text-primary);
  background: rgba(3, 7, 18, 0.88);
  box-shadow: inset 0 0 14px rgba(0, 0, 0, 0.30);
  transition:
    border-color var(--nv-transition),
    box-shadow var(--nv-transition),
    background var(--nv-transition);
}

.auth-field input[type="file"] {
  min-height: 52px;
  padding: 0.55rem;
  color: var(--nv-text-secondary);
}

.auth-field input[type="file"]::file-selector-button {
  margin-right: 0.7rem;
  padding: 0.48rem 0.7rem;
  border: 1px solid var(--nv-border-gold);
  border-radius: var(--nv-radius-sm);
  color: var(--nv-gold-bright);
  background: rgba(224, 169, 27, 0.07);
  cursor: pointer;
  font-weight: 800;
}

.auth-field input:hover {
  border-color: var(--nv-border-strong);
  background: rgba(5, 10, 24, 0.94);
}

.auth-field input:focus {
  border-color: var(--nv-gold-bright);
  box-shadow: var(--nv-focus-ring), inset 0 0 14px rgba(0, 0, 0, 0.26);
}

.auth-field input[aria-invalid="true"] {
  border-color: rgba(214, 58, 72, 0.90);
  background: rgba(59, 8, 14, 0.82);
  box-shadow: 0 0 0 3px rgba(214, 58, 72, 0.12);
}

.auth-field-help,
.auth-field-error {
  min-height: 1.1em;
  color: var(--nv-text-muted);
  font-size: 0.75rem;
  line-height: 1.45;
}

.auth-field-error {
  color: #ff8994;
}

.auth-primary-button,
.auth-secondary-button,
.profile-logout-button {
  min-height: 46px;
  margin-top: 1.1rem;
  padding: 0.72rem 1.1rem;
  border-radius: var(--nv-radius-md);
  cursor: pointer;
  font-size: 0.83rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  transition:
    transform var(--nv-transition-fast),
    background var(--nv-transition),
    border-color var(--nv-transition),
    box-shadow var(--nv-transition);
}

.auth-primary-button {
  width: 100%;
  border: 1px solid var(--nv-gold-bright);
  color: var(--nv-text-dark);
  background: var(--nv-gold);
  box-shadow: var(--nv-shadow-sm);
}

.auth-secondary-button {
  border: 1px solid var(--nv-border-gold);
  color: var(--nv-gold-bright);
  background: rgba(224, 169, 27, 0.05);
}

.auth-primary-button:hover,
.auth-secondary-button:hover,
.profile-logout-button:hover {
  transform: translateY(-1px);
}

.auth-primary-button:hover {
  background: var(--nv-gold-bright);
  box-shadow: var(--nv-shadow-gold), var(--nv-shadow-md);
}

.auth-primary-button:disabled,
.auth-secondary-button:disabled,
.profile-logout-button:disabled {
  cursor: wait;
  opacity: 0.58;
  transform: none;
}

.auth-links {
  margin-top: 1.15rem;
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.auth-links a {
  color: var(--nv-text-secondary);
  font-size: 0.82rem;
  text-decoration-color: rgba(245, 197, 66, 0.34);
  text-underline-offset: 3px;
}

.auth-links a:hover {
  color: var(--nv-gold-bright);
}

.auth-notice {
  width: min(100% - 2rem, 1120px);
  margin: 1rem auto;
  padding: 0.85rem 0.95rem;
  border: 1px solid var(--nv-border-default);
  border-radius: var(--nv-radius-sm);
  color: var(--nv-text-secondary);
  background: rgba(40, 103, 178, 0.10);
  line-height: 1.55;
  text-align: left;
}

.auth-card .auth-notice {
  width: 100%;
  margin: 1rem 0;
}

.auth-notice--success {
  border-color: rgba(72, 166, 107, 0.56);
  color: #9be4b8;
  background: rgba(72, 166, 107, 0.10);
}

.auth-notice--warning {
  border-color: rgba(224, 169, 27, 0.56);
  color: var(--nv-gold-light);
  background: rgba(224, 169, 27, 0.09);
}

.auth-notice--error {
  border-color: rgba(214, 58, 72, 0.62);
  color: #ff9ca5;
  background: rgba(214, 58, 72, 0.10);
}

.auth-success-state {
  display: grid;
  justify-items: center;
  padding: clamp(0.8rem, 3vw, 1.4rem) 0 0.35rem;
  text-align: center;
}

.auth-success-state[hidden],
#signupIntro[hidden],
#signupForm[hidden],
#signupLinks[hidden] {
  display: none !important;
}

.auth-success-state:focus {
  outline: none;
}

.auth-success-state:focus-visible {
  outline: 2px solid var(--nv-gold-bright);
  outline-offset: 8px;
  border-radius: var(--nv-radius-md);
}

.auth-success-state__icon {
  width: 74px;
  height: 74px;
  margin-bottom: 1rem;
  display: grid;
  place-items: center;
  border: 1px solid rgba(72, 166, 107, 0.72);
  border-radius: 50%;
  color: #b8f3ce;
  background:
    radial-gradient(circle at 35% 25%, rgba(255, 255, 255, 0.18), transparent 34%),
    rgba(72, 166, 107, 0.13);
  box-shadow:
    0 0 0 7px rgba(72, 166, 107, 0.05),
    0 0 28px rgba(72, 166, 107, 0.18);
  font-size: 2rem;
  font-weight: 900;
}

.auth-success-state h2 {
  margin: 0;
  color: var(--nv-text-primary);
  font-size: clamp(1.55rem, 5vw, 2.15rem);
  line-height: 1.15;
}

.auth-success-state > p:not(.auth-kicker) {
  max-width: 440px;
  margin: 0.75rem 0 0;
  color: var(--nv-text-secondary);
  line-height: 1.65;
}

.auth-success-state > p strong {
  color: #b8f3ce;
  overflow-wrap: anywhere;
}

.auth-success-state .auth-success-state__hint {
  margin-top: 0.55rem;
  color: var(--nv-text-muted);
  font-size: 0.82rem;
}

.auth-success-state__actions {
  width: 100%;
  margin-top: 1.25rem;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.7rem;
}

.auth-success-state__actions .auth-primary-button,
.auth-success-state__actions .auth-secondary-button {
  min-height: 48px;
  margin: 0;
  display: grid;
  place-items: center;
  text-align: center;
  text-decoration: none;
}

.auth-secondary-panel {
  margin-top: 1.25rem;
  padding: 0.85rem;
  border: 1px solid var(--nv-border-subtle);
  border-radius: var(--nv-radius-sm);
  background: rgba(255, 255, 255, 0.025);
}

.auth-secondary-panel summary {
  color: var(--nv-text-secondary);
  cursor: pointer;
  font-weight: 800;
}

.profile-shell {
  width: min(var(--nv-container), calc(100% - 2rem));
  margin-inline: auto;
  padding: 1.3rem 0 4rem;
  text-align: left;
}

.profile-hero {
  padding: clamp(1.15rem, 3vw, 2rem);
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 1.15rem;
}

.profile-avatar {
  width: clamp(88px, 11vw, 132px);
  aspect-ratio: 1;
  border: 2px solid var(--nv-gold-bright);
  border-radius: 50%;
  object-fit: cover;
  background: var(--nv-bg-elevated);
  box-shadow: var(--nv-shadow-gold), var(--nv-shadow-md);
}

.profile-hero h1 {
  font-size: clamp(1.7rem, 4vw, 2.8rem);
}

.profile-private-value {
  margin-top: 0.35rem;
  color: var(--nv-text-muted);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}

.profile-member {
  margin-bottom: 0;
  font-size: 0.82rem;
}

.profile-coins {
  width: fit-content;
  margin-top: 0.65rem;
  padding: 0.45rem 0.7rem 0.45rem 0.5rem;
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  border: 1px solid rgba(245, 197, 66, 0.38);
  color: var(--nv-gold-light);
  background:
    radial-gradient(circle at 18% 22%, rgba(245, 197, 66, 0.18), transparent 42%),
    rgba(245, 197, 66, 0.06);
  font-size: 0.82rem;
  font-weight: 900;
}

.profile-coin-icon {
  width: 34px;
  height: 34px;
  flex: 0 0 auto;
  object-fit: contain;
  filter: drop-shadow(0 0 8px rgba(245, 197, 66, 0.28));
  animation: profile-coin-float 4s ease-in-out infinite;
}

.profile-coin-copy,
.profile-coin-copy strong,
.profile-coin-copy span {
  display: block;
}

.profile-coin-copy {
  line-height: 1.15;
}

.profile-coin-copy strong {
  color: var(--nv-gold-bright);
  font-size: 1rem;
}

.profile-coin-copy span {
  margin-top: 0.15rem;
  color: var(--nv-text-secondary);
  font-size: 0.64rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

@keyframes profile-coin-float {
  0%,
  100% {
    transform: translateY(0);
  }

  50% {
    transform: translateY(-2px);
  }
}

.profile-switcher {
  margin-bottom: 1rem;
  padding: 0.5rem;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.5rem;
  border: 1px solid var(--nv-border-default);
  border-radius: var(--nv-radius-lg);
  background: rgba(3, 7, 20, 0.88);
  box-shadow: var(--nv-shadow-md);
}

.profile-switch {
  min-height: 66px;
  padding: 0.7rem;
  border: 1px solid transparent;
  color: var(--nv-text-secondary);
  background: transparent;
  cursor: pointer;
  text-align: left;
}

.profile-switch:hover,
.profile-switch.is-active {
  border-color: var(--nv-border-default);
  color: var(--nv-text-primary);
  background:
    linear-gradient(90deg, rgba(201, 45, 61, 0.12), transparent),
    rgba(245, 197, 66, 0.035);
}

.profile-switch span,
.profile-switch small {
  display: block;
}

.profile-switch span {
  font-weight: 900;
}

.profile-switch small {
  margin-top: 0.18rem;
  color: var(--nv-text-muted);
}

.profile-panel {
  padding: 1rem;
  border: 1px solid var(--nv-border-default);
  border-radius: var(--nv-radius-lg);
  background: rgba(3, 7, 20, 0.86);
  box-shadow: var(--nv-shadow-md);
}

.profile-panel--plain {
  padding: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
}

.profile-panel-toolbar {
  margin-bottom: 1rem;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1rem;
}

.profile-panel-toolbar h2 {
  margin: 0;
}

.profile-panel-toolbar label {
  min-width: 190px;
  display: grid;
  gap: 0.35rem;
  color: var(--nv-text-secondary);
  font-size: 0.8rem;
  font-weight: 800;
}

.profile-panel-toolbar select {
  min-height: 42px;
  padding: 0.55rem 0.7rem;
  border: 1px solid var(--nv-border-default);
  color: var(--nv-text-primary);
  background: rgba(2, 6, 17, 0.92);
}

.profile-user-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 0.65rem;
}

.profile-user-card {
  padding: 0.75rem;
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.7rem;
  border: 1px solid var(--nv-border-subtle);
  color: inherit;
  background: rgba(255, 255, 255, 0.025);
  text-decoration: none;
}

.profile-user-card:hover {
  border-color: var(--nv-border-gold);
  background: rgba(245, 197, 66, 0.045);
}

.profile-user-card img {
  width: 48px;
  height: 48px;
  border: 1px solid var(--nv-border-default);
  border-radius: 50%;
  object-fit: cover;
}

.profile-user-card strong,
.profile-user-card small {
  display: block;
}

.profile-user-card small {
  margin-top: 0.2rem;
  color: var(--nv-text-muted);
}

.auth-field textarea {
  width: 100%;
  min-height: 120px;
  padding: 0.75rem 0.8rem;
  border: 1px solid var(--nv-border-default);
  border-radius: var(--nv-radius-sm);
  outline: none;
  color: var(--nv-text-primary);
  background: rgba(3, 7, 18, 0.88);
  resize: vertical;
}

.auth-field textarea:focus {
  border-color: var(--nv-gold-bright);
  box-shadow: var(--nv-focus-ring);
}

.profile-logout-button {
  margin: 0;
  border: 1px solid rgba(214, 58, 72, 0.55);
  color: #ff9ca5;
  background: rgba(214, 58, 72, 0.07);
}

.profile-logout-button:hover {
  border-color: rgba(214, 58, 72, 0.9);
  background: rgba(214, 58, 72, 0.14);
}

.profile-grid {
  margin-top: 1rem;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
}

.profile-card {
  padding: clamp(1rem, 2.5vw, 1.5rem);
}

.profile-card h2 {
  font-size: 1.35rem;
}

.profile-card--protected::before {
  background: var(--nv-red-bright);
}

.profile-card--danger {
  border-color: rgba(214, 58, 72, 0.42);
  background:
    linear-gradient(145deg, rgba(214, 58, 72, 0.09), transparent 48%),
    rgba(3, 8, 18, 0.94);
}

.profile-card--danger::before {
  width: 118px;
  background: var(--nv-red-bright);
  box-shadow: 0 0 18px rgba(214, 58, 72, 0.28);
}

.profile-card--danger .auth-kicker,
.profile-card--danger h2 {
  color: #ff8e98;
}

.profile-delete-button,
.profile-delete-confirm-button {
  min-height: 46px;
  padding: 0.72rem 1rem;
  border: 1px solid rgba(214, 58, 72, 0.72);
  border-radius: var(--nv-radius-md);
  color: #ffadb4;
  background: rgba(214, 58, 72, 0.09);
  cursor: pointer;
  font-size: 0.8rem;
  font-weight: 900;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  transition:
    transform var(--nv-transition-fast),
    border-color var(--nv-transition),
    background var(--nv-transition),
    box-shadow var(--nv-transition);
}

.profile-delete-button:hover,
.profile-delete-confirm-button:hover {
  transform: translateY(-1px);
  border-color: #ff7a86;
  background: rgba(214, 58, 72, 0.17);
  box-shadow: 0 0 20px rgba(214, 58, 72, 0.14);
}

.profile-delete-button:disabled,
.profile-delete-confirm-button:disabled {
  opacity: 0.58;
  cursor: wait;
  transform: none;
}

.profile-delete-dialog {
  width: min(540px, calc(100% - 1.5rem));
  max-height: min(760px, calc(100vh - 2rem));
  padding: 0;
  overflow: auto;
  border: 1px solid rgba(214, 58, 72, 0.55);
  border-radius: var(--nv-radius-lg);
  outline: none;
  color: var(--nv-text-primary);
  background:
    linear-gradient(145deg, rgba(214, 58, 72, 0.10), transparent 45%),
    rgba(3, 8, 18, 0.985);
  box-shadow:
    0 30px 80px rgba(0, 0, 0, 0.72),
    0 0 30px rgba(214, 58, 72, 0.12);
}

.profile-delete-dialog::backdrop {
  background: rgba(0, 0, 0, 0.82);
  backdrop-filter: blur(5px);
}

.profile-delete-dialog form {
  padding: clamp(1.1rem, 4vw, 1.75rem);
}

.profile-delete-dialog-heading h2 {
  margin: 0;
  color: #ff9ca5;
  font-size: clamp(1.4rem, 5vw, 2rem);
}

.profile-delete-dialog-heading > p:last-child {
  margin: 0.65rem 0 0;
  color: var(--nv-text-secondary);
  line-height: 1.65;
}

.profile-delete-warning {
  margin-top: 1rem;
  padding: 0.75rem;
  border: 1px solid rgba(214, 58, 72, 0.42);
  color: #ffadb4;
  background: rgba(214, 58, 72, 0.08);
  font-size: 0.8rem;
  font-weight: 800;
  line-height: 1.55;
}

.profile-delete-dialog .auth-field input:focus {
  border-color: #ff7a86;
  box-shadow:
    0 0 0 3px rgba(214, 58, 72, 0.13),
    inset 0 0 14px rgba(0, 0, 0, 0.26);
}

.profile-delete-dialog-actions {
  margin-top: 1.2rem;
  display: grid;
  grid-template-columns: 1fr 1.35fr;
  gap: 0.65rem;
}

.profile-delete-dialog-actions .auth-secondary-button,
.profile-delete-dialog-actions .profile-delete-confirm-button {
  width: 100%;
  min-height: 48px;
  margin: 0;
}

.profile-card--wide {
  grid-column: 1 / -1;
}

.profile-password-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.8rem;
}

.profile-password-grid .auth-primary-button {
  grid-column: 1 / -1;
}

@media (max-width: 760px) {
  .profile-hero {
    grid-template-columns: auto 1fr;
  }

  .profile-logout-button {
    grid-column: 1 / -1;
    width: 100%;
  }

  .profile-grid,
  .profile-password-grid {
    grid-template-columns: 1fr;
  }

  .profile-switcher {
    grid-template-columns: 1fr;
  }

  .profile-panel-toolbar {
    align-items: stretch;
    flex-direction: column;
  }

  .profile-card--wide,
  .profile-password-grid .auth-primary-button {
    grid-column: auto;
  }

  .profile-delete-dialog-actions {
    grid-template-columns: 1fr;
  }

  .auth-success-state__actions {
    grid-template-columns: 1fr;
  }

  .profile-delete-confirm-button {
    order: -1;
  }
}

@media (max-width: 520px) {
  .auth-page,
  .profile-shell {
    width: min(100% - 1rem, var(--nv-container));
  }

  .auth-illustration {
    width: min(58%, 220px);
  }

  .auth-card {
    padding: 1.1rem;
  }

  .auth-links {
    flex-direction: column;
  }

  .profile-hero {
    grid-template-columns: 1fr;
    text-align: center;
  }

  .profile-avatar {
    margin-inline: auto;
  }

  .profile-coins {
    margin-inline: auto;
  }
}

@media (prefers-reduced-motion: reduce) {
  .profile-coin-icon {
    animation: none;
  }
}