/* Header: account button (user icon) */
.header-right {
  display: flex;
  align-items: center;
  gap: 4px;
  flex: 1;
  justify-content: flex-end;
  min-width: 0;
}

header .header-inner {
  flex-wrap: wrap;
  row-gap: 10px;
}

.header-account-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  flex-shrink: 0;
  padding: 0;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: rgba(255, 255, 255, 0.06);
  color: var(--color-text-muted, #b4b5b9);
  cursor: pointer;
  transition: color 0.2s, border-color 0.2s, background 0.2s;
}

.header-account-btn:hover {
  color: #fff;
  border-color: rgba(123, 108, 196, 0.55);
  background: rgba(83, 73, 151, 0.25);
}

.header-account-btn svg {
  width: 22px;
  height: 22px;
}

.header-account-btn--logged {
  color: #c4b5fd;
  border-color: rgba(123, 108, 196, 0.45);
  background: rgba(83, 73, 151, 0.2);
}

/* Auth modal */
.flux-auth-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: rgba(6, 7, 22, 0.72);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.25s, visibility 0.25s;
}

.flux-auth-overlay.is-open {
  opacity: 1;
  visibility: visible;
}

.flux-auth-modal {
  width: 100%;
  max-width: 420px;
  max-height: min(90vh, 640px);
  overflow-y: auto;
  background: #0d0f22;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 20px;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.55);
  position: relative;
  transform: translateY(12px);
  transition: transform 0.25s;
}

.flux-auth-overlay.is-open .flux-auth-modal {
  transform: translateY(0);
}

.flux-auth-close {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 36px;
  height: 36px;
  border: none;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.06);
  color: #b4b5b9;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  transition: background 0.2s, color 0.2s;
}

.flux-auth-close:hover {
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
}

.flux-auth-inner {
  padding: 28px 26px 30px;
}

.flux-auth-inner h2 {
  font-family: var(--font-display, 'Sora', system-ui, sans-serif);
  font-size: 22px;
  font-weight: 700;
  margin-bottom: 6px;
  color: #fff;
}

.flux-auth-inner .flux-auth-lead {
  font-size: 14px;
  color: #6c6d7a;
  margin-bottom: 22px;
  line-height: 1.5;
}

.flux-auth-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 22px;
}

.flux-auth-tab {
  flex: 1;
  padding: 10px 14px;
  font-family: var(--font-display, 'Sora', system-ui, sans-serif);
  font-size: 13px;
  font-weight: 600;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: transparent;
  color: #b4b5b9;
  cursor: pointer;
  transition: all 0.2s;
}

.flux-auth-tab:hover {
  color: #fff;
  border-color: rgba(255, 255, 255, 0.2);
}

.flux-auth-tab.is-active {
  background: rgba(83, 73, 151, 0.45);
  border-color: rgba(123, 108, 196, 0.5);
  color: #fff;
}

.flux-auth-panel {
  display: none;
}

.flux-auth-panel.is-active {
  display: block;
}

.flux-auth-field {
  margin-bottom: 16px;
}

.flux-auth-field label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #7b6cc4;
  margin-bottom: 6px;
}

.flux-auth-field input {
  width: 100%;
  padding: 12px 14px;
  font-size: 15px;
  font-family: inherit;
  color: #fff;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 12px;
  outline: none;
  transition: border-color 0.2s;
}

.flux-auth-field input:focus {
  border-color: rgba(123, 108, 196, 0.65);
}

.flux-auth-field input::placeholder {
  color: #6c6d7a;
}

.flux-auth-submit {
  width: 100%;
  margin-top: 8px;
  padding: 14px 20px;
  font-family: var(--font-display, 'Sora', system-ui, sans-serif);
  font-size: 15px;
  font-weight: 600;
  color: #534997;
  background: #fff;
  border: none;
  border-radius: 14px;
  cursor: pointer;
  transition: opacity 0.2s, transform 0.15s;
}

.flux-auth-submit:hover {
  opacity: 0.92;
  transform: translateY(-1px);
}

.flux-auth-msg {
  font-size: 13px;
  margin-top: 14px;
  padding: 10px 12px;
  border-radius: 10px;
  line-height: 1.45;
  display: none;
}

.flux-auth-msg.is-visible {
  display: block;
}

.flux-auth-msg--error {
  background: rgba(239, 68, 68, 0.12);
  border: 1px solid rgba(239, 68, 68, 0.35);
  color: #fca5a5;
}

.flux-auth-msg--ok {
  background: rgba(34, 197, 94, 0.12);
  border: 1px solid rgba(34, 197, 94, 0.35);
  color: #86efac;
}

body.flux-auth-open {
  overflow: hidden;
}

/* Login-first auth flow */
.flux-auth-tabs[aria-hidden="true"] {
  display: none;
}

.flux-auth-switch {
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  color: #8e90a0;
  font-size: 14px;
}

.flux-auth-link {
  border: 0;
  padding: 0;
  background: transparent;
  color: #c4b5fd;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  transition: color 0.18s, transform 0.18s;
}

.flux-auth-link:hover {
  color: #ffffff;
  transform: translateY(-1px);
}

/* AMN Labs premium auth polish */
.flux-auth-overlay {
  background:
    radial-gradient(circle at 50% 18%, rgba(94, 102, 255, 0.22), transparent 34%),
    radial-gradient(circle at 82% 72%, rgba(91, 217, 255, 0.13), transparent 30%),
    rgba(3, 5, 16, 0.78);
  backdrop-filter: blur(18px) saturate(125%);
}

.flux-auth-modal {
  position: relative;
  width: min(460px, calc(100vw - 28px));
  border-radius: 28px;
  border: 1px solid rgba(154, 164, 255, 0.22);
  background:
    linear-gradient(145deg, rgba(20, 23, 48, 0.96), rgba(7, 9, 24, 0.98)),
    radial-gradient(circle at top left, rgba(94, 102, 255, 0.35), transparent 42%);
  box-shadow:
    0 30px 100px rgba(0, 0, 0, 0.58),
    0 0 0 1px rgba(255, 255, 255, 0.04) inset,
    0 0 70px rgba(94, 102, 255, 0.16);
  overflow: hidden;
}

.flux-auth-modal::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(120deg, rgba(255,255,255,0.13), transparent 28%, transparent 70%, rgba(94,102,255,0.12)),
    radial-gradient(circle at 30% 0%, rgba(255,255,255,0.12), transparent 26%);
}

.flux-auth-modal::after {
  content: "AMN";
  position: absolute;
  right: -18px;
  top: 10px;
  font-family: var(--font-display, 'Sora', system-ui, sans-serif);
  font-size: 92px;
  font-weight: 800;
  letter-spacing: -0.09em;
  color: rgba(255, 255, 255, 0.035);
  pointer-events: none;
}

.flux-auth-inner {
  position: relative;
  z-index: 1;
  padding: 34px;
}

.flux-auth-inner::before {
  content: "";
  display: block;
  width: 54px;
  height: 54px;
  margin-bottom: 18px;
  border-radius: 18px;
  background:
    linear-gradient(135deg, #5e66ff, #7dd3fc),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='28' height='28' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20 21v-2a4 4 0 0 0-4-4H8a4 4 0 0 0-4 4v2'/%3E%3Ccircle cx='12' cy='7' r='4'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: center;
  background-size: cover, 26px 26px;
  box-shadow: 0 16px 44px rgba(94, 102, 255, 0.36);
}

.flux-auth-inner h2 {
  margin-bottom: 8px;
  font-size: 27px;
  line-height: 1.1;
  letter-spacing: -0.045em;
  color: #ffffff;
}

.flux-auth-inner .flux-auth-lead {
  margin-bottom: 24px;
  max-width: 360px;
  color: #b4b8d0;
  font-size: 14px;
  line-height: 1.65;
}

.flux-auth-field {
  margin-bottom: 14px;
}

.flux-auth-field label {
  color: #a8b0ff;
  letter-spacing: 0.065em;
}

.flux-auth-field input {
  min-height: 48px;
  padding: 13px 15px;
  border-radius: 15px;
  color: #ffffff;
  background: rgba(255, 255, 255, 0.075);
  border: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.05) inset;
}

.flux-auth-field input:hover {
  border-color: rgba(154, 164, 255, 0.28);
  background: rgba(255, 255, 255, 0.09);
}

.flux-auth-field input:focus {
  border-color: rgba(125, 211, 252, 0.72);
  background: rgba(255, 255, 255, 0.105);
  box-shadow:
    0 0 0 4px rgba(94, 102, 255, 0.14),
    0 1px 0 rgba(255, 255, 255, 0.05) inset;
}

.flux-auth-submit {
  min-height: 52px;
  margin-top: 12px;
  border-radius: 16px;
  color: #060716;
  background: linear-gradient(135deg, #ffffff, #dbeafe 48%, #a5b4fc);
  box-shadow:
    0 18px 42px rgba(94, 102, 255, 0.28),
    0 1px 0 rgba(255,255,255,.55) inset;
}

.flux-auth-submit:hover {
  opacity: 1;
  transform: translateY(-2px);
  box-shadow:
    0 22px 54px rgba(94, 102, 255, 0.36),
    0 1px 0 rgba(255,255,255,.55) inset;
}

.flux-auth-switch {
  margin-top: 20px;
  padding: 14px 16px 0;
  border-top: 1px solid rgba(255, 255, 255, 0.09);
  color: #9da3bd;
}

.flux-auth-link {
  color: #9aa4ff;
  text-shadow: 0 0 24px rgba(154, 164, 255, 0.28);
}

.flux-auth-link:hover {
  color: #7dd3fc;
}

.flux-auth-close {
  top: 18px;
  right: 18px;
  z-index: 2;
  width: 36px;
  height: 36px;
  border-radius: 12px;
  color: #b4b8d0;
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.flux-auth-close:hover {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.12);
  transform: translateY(-1px);
}

.flux-auth-msg {
  border-radius: 14px;
}

@media (max-width: 520px) {
  .flux-auth-inner {
    padding: 28px 22px 24px;
  }
  .flux-auth-modal::after {
    font-size: 70px;
  }
  .flux-auth-switch {
    flex-direction: column;
    gap: 6px;
    text-align: center;
  }
}

/* AMN Labs logo in auth modal */
.flux-auth-inner::before {
  width: 72px;
  height: 62px;
  margin-bottom: 18px;
  border-radius: 18px;
  background:
    linear-gradient(135deg, rgba(94, 102, 255, 0.32), rgba(125, 211, 252, 0.18)),
    rgba(255, 255, 255, 0.055);
  border: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow:
    0 18px 48px rgba(94, 102, 255, 0.30),
    0 1px 0 rgba(255, 255, 255, 0.10) inset;
  background-image: url('/kartinki/flux-logo-white.png'), linear-gradient(135deg, rgba(94, 102, 255, 0.32), rgba(125, 211, 252, 0.18));
  background-repeat: no-repeat, no-repeat;
  background-position: center, center;
  background-size: 46px auto, cover;
}

/* Mobile auth modal scrolling fix */
.flux-auth-overlay {
  align-items: flex-start;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: max(18px, env(safe-area-inset-top)) 14px max(24px, env(safe-area-inset-bottom));
}

.flux-auth-modal {
  margin: auto 0;
  max-height: calc(100dvh - 36px);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.flux-auth-inner {
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  max-height: calc(100dvh - 36px);
  scrollbar-width: thin;
  scrollbar-color: rgba(154, 164, 255, 0.55) rgba(255, 255, 255, 0.06);
}

.flux-auth-inner::-webkit-scrollbar {
  width: 6px;
}

.flux-auth-inner::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.06);
}

.flux-auth-inner::-webkit-scrollbar-thumb {
  background: rgba(154, 164, 255, 0.55);
  border-radius: 999px;
}

@supports not (height: 100dvh) {
  .flux-auth-modal,
  .flux-auth-inner {
    max-height: calc(100vh - 36px);
  }
}

@media (max-width: 520px) {
  .flux-auth-overlay {
    padding: 10px 6px 14px;
  }
  .flux-auth-modal {
    width: min(100%, calc(100vw - 12px));
    max-height: calc(100dvh - 20px);
    border-radius: 24px;
  }
  .flux-auth-inner {
    max-height: calc(100dvh - 20px);
    padding-bottom: 30px;
  }
}

/* Compact mobile auth modal refinement */
@media (max-width: 520px) {
  .flux-auth-overlay {
    padding: 14px 12px 18px !important;
    align-items: flex-start !important;
  }

  .flux-auth-modal {
    width: calc(100vw - 32px) !important;
    max-width: 420px !important;
    max-height: calc(100dvh - 32px) !important;
    margin: 0 auto !important;
    border-radius: 22px !important;
    box-shadow:
      0 22px 72px rgba(0, 0, 0, 0.52),
      0 0 0 1px rgba(255, 255, 255, 0.035) inset,
      0 0 42px rgba(94, 102, 255, 0.12) !important;
  }

  .flux-auth-inner {
    max-height: calc(100dvh - 32px) !important;
    padding: 24px 20px 24px !important;
  }

  .flux-auth-inner::before {
    width: 58px !important;
    height: 50px !important;
    border-radius: 15px !important;
    margin-bottom: 14px !important;
    background-size: 36px auto, cover !important;
  }

  .flux-auth-modal::after {
    right: -8px !important;
    top: 10px !important;
    font-size: 58px !important;
    opacity: 0.75 !important;
  }

  .flux-auth-close {
    top: 14px !important;
    right: 14px !important;
    width: 34px !important;
    height: 34px !important;
    border-radius: 12px !important;
  }

  .flux-auth-inner h2 {
    max-width: calc(100% - 48px) !important;
    font-size: 24px !important;
    line-height: 1.12 !important;
    margin-bottom: 8px !important;
  }

  .flux-auth-inner .flux-auth-lead {
    max-width: 100% !important;
    margin-bottom: 20px !important;
    font-size: 13.5px !important;
    line-height: 1.55 !important;
  }

  .flux-auth-field {
    margin-bottom: 12px !important;
  }

  .flux-auth-field label {
    font-size: 11px !important;
    margin-bottom: 5px !important;
  }

  .flux-auth-field input {
    min-height: 44px !important;
    padding: 11px 13px !important;
    border-radius: 14px !important;
    font-size: 14px !important;
  }

  .flux-auth-submit {
    min-height: 48px !important;
    margin-top: 10px !important;
    border-radius: 15px !important;
    font-size: 14.5px !important;
  }

  .flux-auth-switch {
    margin-top: 16px !important;
    padding-top: 13px !important;
    font-size: 13.5px !important;
  }
}

@media (max-width: 380px) {
  .flux-auth-overlay {
    padding-left: 10px !important;
    padding-right: 10px !important;
  }
  .flux-auth-modal {
    width: calc(100vw - 24px) !important;
  }
  .flux-auth-inner {
    padding-left: 17px !important;
    padding-right: 17px !important;
  }
}

/* Strong mobile auth modal resize — visible fix */
@media (max-width: 520px) {
  .flux-auth-overlay {
    padding: 18px 0 22px !important;
    justify-content: center !important;
    align-items: flex-start !important;
  }

  .flux-auth-modal {
    width: min(360px, calc(100vw - 54px)) !important;
    max-width: min(360px, calc(100vw - 54px)) !important;
    min-width: 0 !important;
    margin: 0 auto !important;
    border-radius: 20px !important;
  }

  .flux-auth-inner {
    padding: 20px 16px 22px !important;
    max-height: calc(100dvh - 42px) !important;
  }

  .flux-auth-inner::before {
    width: 50px !important;
    height: 44px !important;
    margin-bottom: 12px !important;
    border-radius: 13px !important;
    background-size: 31px auto, cover !important;
  }

  .flux-auth-modal::after {
    display: none !important;
  }

  .flux-auth-close {
    top: 12px !important;
    right: 12px !important;
    width: 31px !important;
    height: 31px !important;
  }

  .flux-auth-inner h2 {
    font-size: 22px !important;
    max-width: calc(100% - 42px) !important;
  }

  .flux-auth-inner .flux-auth-lead {
    font-size: 13px !important;
    line-height: 1.45 !important;
    margin-bottom: 16px !important;
  }

  .flux-auth-field input {
    min-height: 42px !important;
    padding: 10px 12px !important;
    font-size: 13.5px !important;
  }

  .flux-auth-submit {
    min-height: 45px !important;
    font-size: 14px !important;
  }
}
