:root {
  --grid-scroll-x: 0px;
  --grid-scroll-y: 0px;
  --hero-grid-scroll-x: 0px;
  --hero-grid-scroll-y: 0px;
  --grid-opacity: 0.72;
  --hero-grid-opacity: 0.9;
}

[hidden] {
  display: none !important;
}

body::before {
  background-position:
    var(--grid-scroll-x) var(--grid-scroll-y),
    var(--grid-scroll-x) var(--grid-scroll-y);
  opacity: var(--grid-opacity);
  animation: none;
}

.hero-grid {
  background-position:
    var(--hero-grid-scroll-x) var(--hero-grid-scroll-y),
    var(--hero-grid-scroll-x) var(--hero-grid-scroll-y);
  opacity: var(--hero-grid-opacity);
  animation: none;
}

.auth-shell {
  position: relative;
}

.auth-actions,
.auth-user {
  display: flex;
  align-items: center;
  gap: 10px;
}

.auth-link,
.auth-button,
.auth-close,
.auth-mode-toggle button {
  appearance: none;
  border: 0;
  cursor: pointer;
  font-weight: 800;
}

.auth-link {
  padding: 0;
  color: var(--muted);
  background: transparent;
}

.auth-link:hover {
  color: var(--blue-dark);
}

.auth-button {
  min-height: 40px;
  padding: 0 14px;
  color: var(--blue-dark);
  background: rgba(255, 255, 255, 0.7);
  border: 1px solid rgba(16, 50, 74, 0.12);
  border-radius: 8px;
}

.auth-button-muted {
  color: var(--muted);
  cursor: default;
}

.auth-button:disabled {
  opacity: 1;
}

.auth-user span {
  max-width: 170px;
  overflow: hidden;
  color: var(--ink);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.auth-panel {
  position: absolute;
  top: calc(100% + 14px);
  right: 0;
  z-index: 40;
  width: min(330px, calc(100vw - 32px));
  padding: 18px;
  background: rgba(255, 255, 255, 0.94);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.auth-panel-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 16px;
}

.auth-kicker {
  margin-bottom: 2px;
  color: var(--blue-dark);
  font-size: 0.74rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.auth-close {
  position: relative;
  width: 34px;
  height: 34px;
  background: transparent;
  border-radius: 8px;
}

.auth-close::before,
.auth-close::after {
  content: "";
  position: absolute;
  top: 16px;
  left: 9px;
  width: 16px;
  height: 2px;
  background: var(--muted);
}

.auth-close::before {
  transform: rotate(45deg);
}

.auth-close::after {
  transform: rotate(-45deg);
}

.auth-mode-toggle {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 6px;
  margin-bottom: 14px;
  padding: 4px;
  background: rgba(238, 242, 245, 0.82);
  border: 1px solid rgba(215, 225, 234, 0.9);
  border-radius: 8px;
}

.auth-mode-toggle button {
  min-height: 36px;
  color: var(--muted);
  background: transparent;
  border-radius: 6px;
}

.auth-mode-toggle button.is-active {
  color: var(--blue-dark);
  background: #fff;
  box-shadow: var(--shadow-soft);
}

.auth-form {
  display: grid;
  gap: 12px;
}

.auth-form label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 800;
}

.auth-form input {
  width: 100%;
  min-height: 44px;
  padding: 0 12px;
  color: var(--ink);
  background: rgba(248, 251, 253, 0.92);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.auth-message {
  min-height: 20px;
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 700;
}

.auth-message.is-error {
  color: #a33b3b;
}

.auth-message.is-success {
  color: var(--blue-dark);
}

@media (max-width: 980px) {
  .auth-panel {
    right: auto;
    left: 0;
  }
}

@media (max-width: 760px) {
  .auth-shell {
    padding: 12px;
  }

  .auth-actions,
  .auth-user {
    justify-content: space-between;
  }

  .auth-panel {
    position: static;
    width: 100%;
    margin-top: 12px;
    box-shadow: var(--shadow-soft);
  }
}

@media (prefers-reduced-motion: reduce) {
  body::before,
  .hero-grid {
    background-position: 0 0, 0 0;
    opacity: 0.72;
  }
}
