/* Login / Register — game_tgn_0040 CASSETTE TRANSPORT */

.g40-auth-page {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px 16px 48px;
  min-height: 60vh;
}

.g40-auth-card {
  width: 100%;
  max-width: 420px;
  padding: 28px 24px 30px;
  background: var(--g40-deck, #161514);
  color: var(--g40-shell, #ebe4d4);
  border: 2px solid var(--g40-chrome, #9a958c);
  border-radius: 0;
  box-shadow:
    inset 0 1px 0 rgba(235, 228, 212, 0.05),
    0 0 0 1px rgba(15, 14, 13, 0.55),
    0 22px 56px rgba(0, 0, 0, 0.55);
  position: relative;
}

.g40-auth-card::before {
  content: '';
  position: absolute;
  left: 10px;
  right: 10px;
  top: 0;
  height: 3px;
  background: linear-gradient(90deg, transparent, var(--g40-oxide, #c0392b), transparent);
  opacity: 0.9;
  pointer-events: none;
}

.g40-auth-kicker {
  margin: 0 0 6px;
  font-family: var(--g40-mono, ui-monospace, Menlo, Consolas, monospace);
  font-size: 0.68rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--g40-oxide, #c0392b);
  text-align: left;
}

.g40-auth-head {
  margin: 0 0 18px;
  font-family: var(--g40-font, system-ui, sans-serif);
  font-size: 1.45rem;
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -0.02em;
  text-align: left;
  color: #ebe4d4;
}

.g40-auth-tabs {
  display: flex;
  gap: 0;
  margin-bottom: 1.25rem;
  border-bottom: 1px solid var(--g40-line, rgba(154, 149, 140, 0.35));
}

.g40-auth-tab {
  flex: 1;
  padding: 10px 12px;
  font: inherit;
  font-family: var(--g40-mono, ui-monospace, Menlo, Consolas, monospace);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--g40-muted, #7a756c);
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  cursor: pointer;
  transition: color 0.18s ease, border-color 0.18s ease, background 0.18s ease;
}

.g40-auth-tab:hover {
  color: var(--g40-shell, #ebe4d4);
}

.g40-auth-tab.active {
  color: var(--g40-shell, #ebe4d4);
  border-bottom-color: var(--g40-oxide, #c0392b);
  background: rgba(192, 57, 43, 0.12);
}

.g40-auth-panel { display: none; }
.g40-auth-panel.active { display: block; }

.g40-auth-alert {
  display: none;
  padding: 10px 12px;
  margin-bottom: 1rem;
  font-size: 0.875rem;
  border: 1px solid transparent;
}

.g40-auth-alert.show { display: block; }
.g40-auth-alert.success {
  color: #d1fae5;
  background: rgba(107, 158, 74, 0.16);
  border-color: rgba(107, 158, 74, 0.55);
}
.g40-auth-alert.error {
  color: #fecaca;
  background: rgba(192, 57, 43, 0.18);
  border-color: rgba(248, 113, 113, 0.5);
}

.g40-form-group {
  margin-bottom: 0.9rem;
}

.g40-form-group label {
  display: block;
  margin-bottom: 5px;
  font-family: var(--g40-mono, ui-monospace, Menlo, Consolas, monospace);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #c4bfb4;
}

.g40-form-input-wrap {
  position: relative;
}

.g40-form-input {
  width: 100%;
  height: 44px;
  padding: 0 12px;
  font: inherit;
  font-size: 0.9375rem;
  color: #ebe4d4;
  background: #0f0e0d;
  border: 2px solid #9a958c;
  border-radius: 0;
  outline: none;
  transition: border-color 0.18s ease, box-shadow 0.18s ease;
}

.g40-form-input::placeholder {
  color: var(--g40-muted, #7a756c);
}

.g40-form-input:focus {
  border-color: var(--g40-oxide, #c0392b);
  box-shadow: 0 0 0 2px rgba(192, 57, 43, 0.22);
}

.g40-form-group.has-error .g40-form-input {
  border-color: #f87171;
  box-shadow: none;
}

.g40-form-error {
  display: none;
  margin-top: 4px;
  font-size: 0.8125rem;
  color: #fca5a5;
}

.g40-form-group.has-error .g40-form-error { display: block; }

.g40-pwd-toggle {
  position: absolute;
  right: 0;
  top: 0;
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  color: var(--g40-muted, #7a756c);
  cursor: pointer;
}

.g40-pwd-toggle:hover {
  color: var(--g40-oxide, #c0392b);
}

.g40-pwd-icon {
  display: block;
  width: 18px;
  height: 12px;
  border: 1.5px solid currentColor;
  border-radius: 50%;
  position: relative;
}

.g40-pwd-icon::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 5px;
  height: 5px;
  margin: -2.5px 0 0 -2.5px;
  border-radius: 50%;
  background: currentColor;
}

.g40-form-input.has-toggle {
  padding-right: 44px;
}

.g40-auth-forgot {
  margin: -4px 0 12px;
  text-align: right;
  font-size: 0.8rem;
}

.g40-auth-forgot a {
  color: var(--g40-chrome, #9a958c);
  text-decoration: none;
}

.g40-auth-forgot a:hover {
  color: var(--g40-oxide, #c0392b);
}

.g40-btn-auth,
.g40-auth-card .g40-btn-auth,
.g40-login-modal .g40-btn-auth {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 46px;
  margin-top: 0.35rem;
  padding: 0 14px;
  font: inherit;
  font-family: var(--g40-mono, ui-monospace, Menlo, Consolas, monospace);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #fff;
  background: #c0392b;
  border: 2px solid #c0392b;
  border-radius: 0;
  cursor: pointer;
  position: relative;
  transition: filter 0.18s ease, transform 0.18s ease;
}

.g40-btn-auth:hover,
.g40-auth-card .g40-btn-auth:hover,
.g40-login-modal .g40-btn-auth:hover {
  filter: brightness(1.1);
  transform: translateY(-1px);
  color: #fff;
  background: #d44435;
  border-color: #d44435;
}

.g40-btn-auth:active {
  transform: translateY(0);
}

.g40-btn-auth.loading {
  pointer-events: none;
  opacity: 0.75;
}

.g40-btn-auth.loading .g40-btn-auth-text { visibility: hidden; }

.g40-btn-auth.loading::after {
  content: '';
  position: absolute;
  inset: 0;
  margin: auto;
  width: 18px;
  height: 18px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: g40-auth-spin 0.7s linear infinite;
}

@keyframes g40-auth-spin {
  to { transform: rotate(360deg); }
}

.g40-auth-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 1.35rem 0;
  font-family: var(--g40-mono, ui-monospace, Menlo, Consolas, monospace);
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--g40-muted, #7a756c);
}

.g40-auth-divider::before,
.g40-auth-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--g40-line, rgba(154, 149, 140, 0.35));
}

.g40-social-btns {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.g40-social-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  height: 42px;
  font: inherit;
  font-size: 0.875rem;
  font-weight: 700;
  color: #fff;
  text-decoration: none;
  border: none;
  border-radius: 0;
  cursor: pointer;
}

.g40-social-btn--fb { background: #1877f2; }
.g40-social-btn--google { background: #ea4335; }
.g40-social-btn--twitter { background: #1da1f2; }
.g40-social-btn--steam { background: #171a21; }

@media (max-width: 480px) {
  .g40-auth-card {
    padding: 20px 14px 22px;
  }

  .g40-auth-head {
    margin-bottom: 14px;
    font-size: 1.25rem;
  }

  .g40-auth-tabs {
    margin-bottom: 1rem;
  }

  .g40-auth-tab {
    padding: 8px 10px;
    font-size: 0.68rem;
  }

  .g40-form-group {
    margin-bottom: 0.75rem;
  }

  .g40-form-input,
  .g40-pwd-toggle {
    height: 40px;
  }

  .g40-pwd-toggle {
    width: 40px;
  }

  .g40-btn-auth {
    height: 42px;
  }
}

/* Login modal — cassette deck overlay */
.g40-login-modal {
  position: fixed;
  inset: 0;
  z-index: 25000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.g40-login-modal.is-open {
  display: flex;
}

.g40-login-modal[hidden] {
  display: none !important;
}

.g40-login-modal.is-open[hidden] {
  display: flex !important;
}

.g40-login-modal__backdrop {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse at center, rgba(22, 21, 20, 0.5) 0%, rgba(10, 9, 8, 0.9) 100%);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
}

.g40-login-modal__panel {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 420px;
  max-height: calc(100vh - 32px);
  max-height: calc(100dvh - 32px);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  animation: g40-modal-in 0.22s ease-out;
}

@media (prefers-reduced-motion: reduce) {
  .g40-login-modal__panel { animation: none; }
}

@keyframes g40-modal-in {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.g40-login-modal__close {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 2;
  width: 36px;
  height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  font-size: 1.4rem;
  font-weight: 700;
  line-height: 1;
  color: #1a1714;
  background: #ebe4d4;
  border: 2px solid #ebe4d4;
  border-radius: 0;
  cursor: pointer;
  transition: color 0.18s ease, background 0.18s ease, border-color 0.18s ease;
}

.g40-login-modal__close:hover {
  color: #fff;
  background: #c0392b;
  border-color: #c0392b;
}

.g40-auth-card--modal {
  margin: 0;
  max-width: none;
  padding-top: 32px;
  padding-right: 28px;
}

.g40-auth-card--modal .g40-auth-head {
  padding-right: 28px;
}

@media (max-width: 480px) {
  .g40-login-modal {
    align-items: flex-end;
    padding: 0;
  }

  .g40-login-modal__panel {
    max-width: none;
    max-height: min(92vh, 92dvh);
    animation: g40-modal-sheet 0.24s ease-out;
  }

  .g40-auth-card--modal {
    border-left: 0;
    border-right: 0;
    border-bottom: 0;
    padding: 24px 14px 20px;
    padding-bottom: calc(20px + env(safe-area-inset-bottom, 0px));
  }

  .g40-login-modal__close {
    top: 8px;
    right: 8px;
    width: 32px;
    height: 32px;
    font-size: 1.2rem;
  }
}

@keyframes g40-modal-sheet {
  from {
    opacity: 0;
    transform: translateY(24px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (prefers-reduced-motion: reduce) {
  .g40-login-modal__panel { animation: none; }
}

body.g40-login-open {
  overflow: hidden;
}

body.g40-login-open .back-to-top,
body.g40-login-open .g40-back-top {
  visibility: hidden !important;
  pointer-events: none;
}
