/* ============================================================
   SmaugBrain Auth Pages
   ============================================================ */

.smaug-route-auth {
  --sm-auth-accent: #96eaff;
  --sm-auth-accent-soft: rgba(150, 234, 255, 0.2);
  --sm-auth-secondary: #f5fcff;
}

.sm-auth-stage {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 100vh;
  padding: 128px 20px 32px;
  overflow: hidden;
}

.sm-auth-background {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 16% 28%, rgba(150, 234, 255, 0.12), transparent 22%),
    radial-gradient(circle at 84% 30%, rgba(255, 255, 255, 0.05), transparent 16%),
    linear-gradient(180deg, rgba(6, 8, 14, 0.78), rgba(2, 4, 10, 0.99));
}

.sm-auth-background::after {
  content: '';
  position: absolute;
  inset: 0;
  background:
    linear-gradient(90deg, rgba(255, 255, 255, 0.012) 1px, transparent 1px),
    linear-gradient(180deg, rgba(255, 255, 255, 0.012) 1px, transparent 1px),
    radial-gradient(circle at center, rgba(255, 255, 255, 0.04), transparent 58%);
  background-size: 96px 96px, 96px 96px, auto;
  mask-image: radial-gradient(circle at center, rgba(0, 0, 0, 0.8), transparent 80%);
  opacity: 0.22;
}

.sm-auth-canvas {
  display: block;
  width: 100%;
  height: 100%;
  opacity: 0.34;
  filter: saturate(0.68) blur(0.2px);
}

.sm-auth-background-glow {
  position: absolute;
  width: 34vw;
  height: 34vw;
  border-radius: 50%;
  filter: blur(130px);
  opacity: 0.12;
  pointer-events: none;
}

.sm-auth-background-glow-a {
  top: 4%;
  left: -4%;
  background: var(--sm-auth-accent);
}

.sm-auth-background-glow-b {
  right: -10%;
  bottom: -18%;
  background: var(--sm-auth-secondary);
}

.sm-auth-schematic {
  position: absolute;
  inset: 0;
  perspective: 1800px;
  transform-style: preserve-3d;
  pointer-events: none;
}

.sm-auth-line {
  position: absolute;
  left: 24px;
  right: 24px;
  height: 1px;
  background: linear-gradient(90deg, rgba(255, 255, 255, 0.06), rgba(255, 255, 255, 0.18), rgba(255, 255, 255, 0.06));
  opacity: 0.42;
}

.sm-auth-line-top {
  top: 30px;
}

.sm-auth-line-bottom {
  bottom: 28px;
}

.sm-auth-hud,
.sm-auth-side-label,
.sm-auth-code-label,
.sm-auth-code-card code {
  font-family: 'Space Grotesk', 'Noto Sans SC', sans-serif;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.sm-auth-hud,
.sm-auth-side-label {
  position: absolute;
  color: rgba(245, 252, 255, 0.48);
}

.sm-auth-hud-top-left {
  top: 22px;
  left: 24px;
}

.sm-auth-hud-top-right {
  top: 22px;
  right: 24px;
}

.sm-auth-hud-bottom-left {
  left: 24px;
  bottom: 18px;
}

.sm-auth-hud-bottom-right {
  right: 24px;
  bottom: 18px;
}

.sm-auth-side-label {
  top: 50%;
  left: 10px;
  transform: rotate(-90deg) translateX(-50%);
  transform-origin: left top;
  color: rgba(150, 234, 255, 0.58);
}

.sm-auth-word,
.sm-auth-plane,
.sm-auth-code-card {
  position: absolute;
  transform-style: preserve-3d;
  will-change: transform;
}

.sm-auth-word {
  top: 18%;
  left: 50%;
  width: 100%;
  transform: translateX(-50%);
  text-align: center;
  font-family: 'Space Grotesk', 'Noto Sans SC', sans-serif;
  font-size: clamp(120px, 21vw, 360px);
  font-weight: 700;
  letter-spacing: 0;
  color: transparent;
  -webkit-text-stroke: 1px rgba(245, 252, 255, 0.1);
  text-shadow: 0 0 80px rgba(255, 255, 255, 0.03);
  user-select: none;
}

.sm-auth-plane {
  border: 1px solid rgba(255, 255, 255, 0.04);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.015), rgba(255, 255, 255, 0.005));
}

.sm-auth-plane-left {
  top: 40%;
  left: 7%;
  width: 33vw;
  height: 34vh;
}

.sm-auth-plane-right {
  top: 28%;
  right: 11%;
  width: 24vw;
  height: 48vh;
}

.sm-auth-code-card {
  display: grid;
  gap: 10px;
  width: min(20vw, 220px);
  min-height: 170px;
  padding: 18px;
  border: 1px solid rgba(255, 255, 255, 0.06);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.035), rgba(255, 255, 255, 0.012));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

.sm-auth-code-card-left {
  top: 38%;
  left: 42%;
}

.sm-auth-code-card-right {
  top: 44%;
  right: 25%;
}

.sm-auth-code-label {
  color: rgba(245, 252, 255, 0.42);
}

.sm-auth-code-card strong {
  color: rgba(255, 255, 255, 0.92);
  font-family: 'Space Grotesk', 'Noto Sans SC', sans-serif;
  font-size: clamp(22px, 2vw, 34px);
  font-weight: 700;
  line-height: 1;
  letter-spacing: 0;
}

.sm-auth-code-card code {
  color: rgba(255, 255, 255, 0.46);
  line-height: 1.5;
}

.sm-auth-card {
  position: relative;
  z-index: 1;
  width: min(100%, 560px);
  display: grid;
  gap: 22px;
  padding: clamp(22px, 3vw, 30px);
  border-color: rgba(255, 255, 255, 0.14);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.12), rgba(255, 255, 255, 0.02)),
    rgba(4, 8, 15, 0.72);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.12),
    0 32px 120px rgba(0, 0, 0, 0.46),
    0 0 0 1px rgba(255, 255, 255, 0.04);
  backdrop-filter: blur(28px);
}

.sm-auth-card::before {
  content: '';
  position: absolute;
  inset: -1px;
  border-radius: inherit;
  background: linear-gradient(140deg, var(--sm-auth-accent-soft), transparent 34%, transparent 70%, rgba(255, 255, 255, 0.08));
  opacity: 0.8;
  pointer-events: none;
}

.sm-auth-panels,
.sm-auth-form {
  position: relative;
  z-index: 1;
}

.sm-auth-panels {
  display: grid;
}

.sm-auth-panel {
  display: none;
  gap: 18px;
}

.sm-auth-panel.is-active {
  display: grid;
}

.sm-auth-switch {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  padding: 6px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.045);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.06);
  overflow: hidden;
}

.sm-auth-switch-indicator {
  position: absolute;
  top: 6px;
  left: 6px;
  width: 0;
  height: 40px;
  border-radius: 14px;
  background:
    linear-gradient(135deg, rgba(150, 234, 255, 0.24), rgba(255, 255, 255, 0.12)),
    rgba(255, 255, 255, 0.06);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.18),
    0 12px 30px rgba(0, 0, 0, 0.16),
    0 0 32px rgba(150, 234, 255, 0.14);
  transform: translate3d(0, 0, 0);
  transition: transform 0.42s cubic-bezier(0.22, 1, 0.36, 1), width 0.42s cubic-bezier(0.22, 1, 0.36, 1), opacity 0.22s ease;
  opacity: 0;
  pointer-events: none;
}

.sm-auth-switch.is-ready .sm-auth-switch-indicator {
  opacity: 1;
}

.sm-auth-switch-link {
  position: relative;
  z-index: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  padding: 0 12px;
  border-radius: 14px;
  color: rgba(246, 244, 239, 0.7);
  text-decoration: none;
  font-family: 'Space Grotesk', 'Noto Sans SC', sans-serif;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.02em;
  transition: color 0.24s ease, transform 0.32s ease;
}

.sm-auth-switch-link:hover,
.sm-auth-switch-link.is-active {
  color: rgba(255, 255, 255, 0.98);
  transform: translateY(-1px);
}

.sm-auth-switch-link.is-active {
  text-shadow: 0 0 18px rgba(150, 234, 255, 0.2);
}

.sm-auth-head {
  position: relative;
  z-index: 1;
  display: grid;
  gap: 10px;
}

.sm-auth-head h1 {
  margin: 0;
  font-family: 'Space Grotesk', 'Noto Sans SC', sans-serif;
  font-size: clamp(30px, 4.4vw, 42px);
  line-height: 0.98;
  letter-spacing: 0;
}

.sm-auth-head p,
.sm-auth-actions p {
  margin: 0;
  color: rgba(246, 244, 239, 0.7);
  line-height: 1.68;
}

.sm-auth-social {
  position: relative;
  z-index: 1;
  display: grid;
  gap: 10px;
  margin-top: 8px;
}

.sm-auth-social-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  color: rgba(246, 244, 239, 0.4);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.sm-auth-social-divider::before,
.sm-auth-social-divider::after {
  content: '';
  flex: 1 1 auto;
  height: 1px;
  background: rgba(255, 255, 255, 0.08);
}

.sm-auth-social-grid {
  display: grid;
  gap: 10px;
}

.sm-auth-social-button {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  width: 100%;
  min-height: 56px;
  padding: 0 18px;
  border: 1px solid #d2d7e0;
  border-radius: 999px;
  background: #ffffff;
  color: #3c4043;
  text-align: left;
  box-shadow: none;
  opacity: 1;
  cursor: not-allowed;
  transition: border-color 0.18s ease, background-color 0.18s ease;
}

a.sm-auth-social-button {
  cursor: pointer;
  text-decoration: none;
}

a.sm-auth-social-button:hover,
a.sm-auth-social-button:focus-visible {
  border-color: #aeb7c5;
  background: #f8fafc;
}

.sm-auth-social-mark {
  display: inline-grid;
  place-items: center;
  width: 18px;
  height: 18px;
  background-position: center;
  background-repeat: no-repeat;
  background-size: contain;
}

.sm-auth-social-copy {
  display: grid;
  gap: 2px;
}

.sm-auth-social-copy strong {
  font-family: Arial, 'Noto Sans SC', sans-serif;
  color: #3c4043;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0;
}

.sm-auth-social-google .sm-auth-social-mark {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 18 18'%3E%3Cpath fill='%23EA4335' d='M17.64 9.2c0-.64-.06-1.25-.16-1.84H9v3.48h4.84a4.14 4.14 0 0 1-1.8 2.72v2.26h2.91c1.7-1.56 2.69-3.86 2.69-6.62Z'/%3E%3Cpath fill='%234285F4' d='M9 18c2.43 0 4.47-.8 5.96-2.18l-2.91-2.26c-.81.54-1.84.86-3.05.86-2.35 0-4.35-1.58-5.06-3.7H.94v2.33A9 9 0 0 0 9 18Z'/%3E%3Cpath fill='%23FBBC05' d='M3.94 10.71A5.41 5.41 0 0 1 3.66 9c0-.59.1-1.16.28-1.71V4.96H.94A9 9 0 0 0 0 9c0 1.45.35 2.82.94 4.04l3-2.33Z'/%3E%3Cpath fill='%2334A853' d='M9 3.58c1.32 0 2.5.45 3.43 1.33l2.57-2.57C13.46.9 11.42 0 9 0A9 9 0 0 0 .94 4.96l3 2.33c.7-2.12 2.7-3.71 5.06-3.71Z'/%3E%3C/svg%3E");
}

.sm-auth-social-github .sm-auth-social-mark {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%231f2328'%3E%3Cpath d='M12 .5a12 12 0 0 0-3.79 23.39c.6.11.82-.26.82-.58l-.02-2.04c-3.34.73-4.04-1.42-4.04-1.42-.55-1.38-1.33-1.75-1.33-1.75-1.09-.74.08-.72.08-.72 1.2.09 1.84 1.24 1.84 1.24 1.07 1.84 2.8 1.31 3.48 1 .11-.78.42-1.31.77-1.61-2.67-.3-5.47-1.34-5.47-5.95 0-1.31.47-2.38 1.23-3.22-.12-.3-.53-1.52.12-3.17 0 0 1-.32 3.3 1.23a11.5 11.5 0 0 1 6 0c2.3-1.55 3.29-1.23 3.29-1.23.65 1.65.24 2.87.12 3.17.77.84 1.23 1.91 1.23 3.22 0 4.62-2.81 5.64-5.49 5.94.43.38.82 1.1.82 2.23l-.01 3.31c0 .32.21.69.83.57A12 12 0 0 0 12 .5Z'/%3E%3C/svg%3E");
}

.sm-auth-social-microsoft .sm-auth-social-mark {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 18 18'%3E%3Cpath fill='%23F25022' d='M0 0h8.1v8.1H0z'/%3E%3Cpath fill='%237FBA00' d='M9.9 0H18v8.1H9.9z'/%3E%3Cpath fill='%2300A4EF' d='M0 9.9h8.1V18H0z'/%3E%3Cpath fill='%23FFB900' d='M9.9 9.9H18V18H9.9z'/%3E%3C/svg%3E");
}

.sm-auth-form {
  gap: 16px;
}

.sm-auth-field span {
  margin-bottom: 8px;
}

.smaug-route-auth .sm-surface-field input {
  background: rgba(255, 255, 255, 0.045);
  border-color: rgba(255, 255, 255, 0.1);
  color: rgba(255, 255, 255, 0.94);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

.smaug-route-auth .sm-surface-field input::placeholder {
  color: rgba(246, 244, 239, 0.42);
}

.smaug-route-auth .sm-surface-field input:focus {
  border-color: var(--sm-auth-accent);
  box-shadow:
    0 0 0 4px rgba(255, 255, 255, 0.03),
    0 0 0 1px var(--sm-auth-accent-soft);
}

.smaug-route-auth .sm-surface-button-solid {
  width: 100%;
  justify-content: center;
  background: linear-gradient(135deg, var(--sm-auth-accent), var(--sm-auth-secondary));
  color: #08111f;
  box-shadow: 0 18px 34px rgba(0, 0, 0, 0.24);
}

.smaug-route-auth .sm-surface-button-solid[disabled] {
  cursor: wait;
  opacity: 0.74;
}

.sm-auth-actions {
  margin-top: 6px;
}

.sm-auth-actions p {
  text-align: center;
}

.sm-auth-actions a {
  color: rgba(255, 255, 255, 0.96);
}

.smaug-route-auth .sm-home-header {
  z-index: 3;
}

.smaug-route-auth .sm-home-header::before {
  background: linear-gradient(180deg, rgba(4, 8, 15, 0.78), rgba(4, 8, 15, 0));
}

.smaug-route-login,
.smaug-route-register,
.smaug-route-forgot-password {
  --route-grid-size: 64px;
  --route-orb-x: 70%;
  --route-orb-y: 18%;
  --route-glow-a: rgba(255, 118, 54, 0.22);
  --route-glow-b: rgba(111, 231, 255, 0.16);
  --route-shadow: rgba(255, 118, 54, 0.18);
}

html[data-theme='light'] .smaug-route-auth {
  --sm-auth-accent: #5a74ff;
  --sm-auth-accent-soft: rgba(90, 116, 255, 0.14);
  --sm-auth-secondary: #1b3566;
}

html[data-theme='light'] .sm-auth-background {
  background:
    radial-gradient(circle at 16% 28%, rgba(90, 116, 255, 0.14), transparent 24%),
    radial-gradient(circle at 84% 30%, rgba(27, 53, 102, 0.08), transparent 18%),
    linear-gradient(180deg, rgba(246, 249, 255, 0.96), rgba(228, 236, 248, 0.99));
}

html[data-theme='light'] .sm-auth-background::after {
  background:
    linear-gradient(90deg, rgba(15, 24, 40, 0.05) 1px, transparent 1px),
    linear-gradient(180deg, rgba(15, 24, 40, 0.05) 1px, transparent 1px),
    radial-gradient(circle at center, rgba(50, 72, 219, 0.09), transparent 58%);
  opacity: 0.44;
}

html[data-theme='light'] .sm-auth-canvas {
  opacity: 0.28;
}

html[data-theme='light'] .sm-auth-line {
  background: linear-gradient(90deg, rgba(15, 24, 40, 0.07), rgba(50, 72, 219, 0.28), rgba(15, 24, 40, 0.07));
  opacity: 0.72;
}

html[data-theme='light'] .sm-auth-hud,
html[data-theme='light'] .sm-auth-code-label,
html[data-theme='light'] .sm-auth-code-card code {
  color: rgba(15, 24, 40, 0.62);
}

html[data-theme='light'] .sm-auth-side-label {
  color: rgba(50, 72, 219, 0.72);
}

html[data-theme='light'] .sm-auth-word {
  -webkit-text-stroke: 1px rgba(15, 24, 40, 0.18);
  text-shadow: 0 0 80px rgba(50, 72, 219, 0.08);
}

html[data-theme='light'] .sm-auth-plane {
  border-color: rgba(15, 24, 40, 0.06);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.55), rgba(240, 245, 255, 0.28));
}

html[data-theme='light'] .sm-auth-code-card {
  border-color: rgba(15, 24, 40, 0.08);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.86), rgba(241, 246, 255, 0.6));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.9), 0 16px 40px rgba(41, 56, 88, 0.1);
}

html[data-theme='light'] .sm-auth-code-card strong {
  color: rgba(15, 24, 40, 0.92);
}

html[data-theme='light'] .sm-auth-card {
  border-color: rgba(15, 24, 40, 0.12);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.9), rgba(243, 247, 255, 0.8)),
    rgba(255, 255, 255, 0.84);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.94),
    0 28px 72px rgba(41, 56, 88, 0.16),
    0 0 0 1px rgba(15, 24, 40, 0.04);
}

html[data-theme='light'] .sm-auth-card::before {
  background: linear-gradient(140deg, var(--sm-auth-accent-soft), transparent 38%, transparent 72%, rgba(50, 72, 219, 0.06));
}

html[data-theme='light'] .sm-auth-switch {
  background: rgba(255, 255, 255, 0.72);
  box-shadow: inset 0 0 0 1px rgba(15, 24, 40, 0.08);
}

html[data-theme='light'] .sm-auth-switch-indicator {
  background:
    linear-gradient(135deg, rgba(90, 116, 255, 0.16), rgba(255, 255, 255, 0.92)),
    rgba(255, 255, 255, 0.8);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.9),
    0 12px 26px rgba(41, 56, 88, 0.1),
    0 0 22px rgba(90, 116, 255, 0.1);
}

html[data-theme='light'] .sm-auth-head p,
html[data-theme='light'] .sm-auth-actions p {
  color: rgba(15, 24, 40, 0.62);
}

html[data-theme='light'] .sm-auth-social-divider {
  color: rgba(15, 24, 40, 0.44);
}

html[data-theme='light'] .sm-auth-social-divider::before,
html[data-theme='light'] .sm-auth-social-divider::after {
  background: rgba(15, 24, 40, 0.08);
}

html[data-theme='light'] .sm-auth-social-button {
  border-color: #d2d7e0;
  background: #ffffff;
  color: #3c4043;
}

html[data-theme='light'] .sm-auth-social-mark {
  background-color: transparent;
  color: rgba(15, 24, 40, 0.88);
}

html[data-theme='light'] .sm-auth-social-copy strong {
  color: #3c4043;
}

html[data-theme='light'] .sm-auth-switch-link {
  color: rgba(15, 24, 40, 0.5);
}

html[data-theme='light'] .sm-auth-switch-link:hover,
html[data-theme='light'] .sm-auth-switch-link.is-active {
  color: rgba(15, 24, 40, 0.94);
}

html[data-theme='light'] .sm-auth-actions a {
  color: var(--sm-cobalt);
}

html[data-theme='light'] .smaug-route-auth .sm-surface-button-solid {
  color: rgba(255, 255, 255, 0.98);
  box-shadow: 0 18px 34px rgba(61, 78, 161, 0.22);
}

html[data-theme='light'] .smaug-route-auth .sm-surface-field input {
  background: rgba(255, 255, 255, 0.92);
  border-color: rgba(15, 24, 40, 0.12);
  color: var(--sm-text);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.94);
}

html[data-theme='light'] .smaug-route-auth .sm-surface-field input::placeholder {
  color: rgba(15, 24, 40, 0.44);
}

@media (max-width: 760px) {
  .sm-auth-stage {
    padding: 108px 18px 18px;
  }

  .sm-auth-word {
    top: 25%;
    font-size: clamp(72px, 22vw, 140px);
  }

  .sm-auth-plane,
  .sm-auth-code-card,
  .sm-auth-side-label,
  .sm-auth-hud-top-right,
  .sm-auth-hud-bottom-right {
    display: none;
  }

  .sm-auth-line {
    left: 16px;
    right: 16px;
  }

  .sm-auth-hud-top-left,
  .sm-auth-hud-bottom-left {
    left: 16px;
  }

  .sm-auth-card {
    gap: 18px;
    padding: 20px;
    border-radius: 24px;
  }

  .sm-auth-switch {
    grid-template-columns: 1fr;
  }
}
