@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

:root {
  color-scheme: light;
  --primary-400: #8c7bff;
  --primary-500: #6c5ce7;
  --primary-600: #594adf;
  --accent-500: #b26efb;
  --surface: rgba(255, 255, 255, 0.88);
  --surface-strong: rgba(255, 255, 255, 0.96);
  --border-soft: rgba(108, 92, 231, 0.2);
  --border-strong: rgba(108, 92, 231, 0.4);
  --text-strong: #1c2040;
  --text-muted: #5f6484;
  --text-subtle: #787c97;
  --success-500: #16a34a;
  --error-500: #e11d48;
  --shadow-lg: 0 32px 64px rgba(15, 23, 42, 0.16);
  --shadow-md: 0 22px 45px rgba(15, 23, 42, 0.12);
  --radius-xl: 28px;
}

*, *::before, *::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  padding: 48px 18px;
  font-family: 'Inter', 'Segoe UI', sans-serif;
  color: var(--text-strong);
  background:
    radial-gradient(60% 60% at 10% 10%, rgba(108, 92, 231, 0.18), transparent 60%),
    radial-gradient(45% 45% at 90% 15%, rgba(178, 110, 251, 0.18), transparent 70%),
    linear-gradient(135deg, #f8f9ff 0%, #eef1ff 100%);
  display: flex;
  align-items: center;
  justify-content: center;
}

main, .page-wrapper {
  width: 100%;
}

.glass-card {
  width: 100%;
  max-width: 520px;
  background: var(--surface);
  border-radius: var(--radius-xl);
  padding: 40px 42px;
  box-shadow: var(--shadow-lg);
  backdrop-filter: blur(18px);
}

.page-heading {
  font-size: 1.95rem;
  font-weight: 600;
  margin: 0 0 0.5rem;
  color: var(--text-strong);
}

.page-subtext {
  color: var(--text-muted);
  line-height: 1.7;
  margin: 0 0 1.5rem;
  font-size: 1rem;
}

.form-grid {
  display: grid;
  gap: 18px;
}

.form-label {
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text-muted);
}

.form-control {
  width: 100%;
  border: 1px solid var(--border-soft);
  border-radius: 14px;
  padding: 14px 16px;
  font-size: 1rem;
  background: var(--surface-strong);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.form-control:focus {
  outline: none;
  border-color: rgba(108, 92, 231, 0.55);
  box-shadow: 0 0 0 4px rgba(108, 92, 231, 0.18);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 52px;
  padding: 0 24px;
  border-radius: 16px;
  font-size: 1rem;
  font-weight: 600;
  border: none;
  cursor: pointer;
  transition: transform 0.18s ease, box-shadow 0.18s ease, filter 0.18s ease, background-position 0.3s ease;
  text-decoration: none;
}

.btn.solid {
  position: relative;
  overflow: hidden;
  background: linear-gradient(135deg, var(--primary-500), var(--accent-500));
  background-size: 200% 200%;
  color: #ffffff;
  box-shadow: 0 18px 34px rgba(108, 92, 231, 0.22);
}

.btn.solid:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 24px 40px rgba(108, 92, 231, 0.28);
  background-position: 100% 0;
}

.btn.solid:disabled {
  opacity: 0.7;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.btn.solid::after {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 20% 20%, rgba(255, 255, 255, 0.4), transparent 55%);
  opacity: 0;
  transition: opacity 0.3s ease;
  pointer-events: none;
}

.btn.solid:hover::after {
  opacity: 1;
}

.btn.solid:focus-visible {
  outline: 3px solid rgba(108, 92, 231, 0.35);
  outline-offset: 3px;
}

.btn.outline {
  background: transparent;
  border: 1px solid rgba(108, 92, 231, 0.3);
  color: var(--text-strong);
}

.btn.outline:hover {
  border-color: rgba(108, 92, 231, 0.5);
}

.feedback {
  display: none;
  padding: 12px 14px;
  border-radius: 14px;
  font-size: 0.95rem;
  line-height: 1.6;
  border: 1px solid transparent;
}

.feedback[data-variant="success"] {
  display: block;
  border-color: rgba(22, 163, 74, 0.3);
  color: var(--success-500);
  background: rgba(22, 163, 74, 0.12);
}

.feedback[data-variant="error"] {
  display: block;
  border-color: rgba(225, 29, 72, 0.3);
  color: var(--error-500);
  background: rgba(225, 29, 72, 0.12);
}

.support-text {
  font-size: 0.9rem;
  color: var(--text-subtle);
  line-height: 1.6;
}

.support-text strong {
  color: var(--text-muted);
}

.link-quiet {
  color: var(--primary-600);
  font-weight: 600;
  text-decoration: none;
}

.link-quiet:hover {
  text-decoration: underline;
}

.section-divider {
  height: 1px;
  background: rgba(108, 92, 231, 0.12);
  margin: 28px 0;
}

.tag-list {
  margin-top: 12px;
  padding-left: 20px;
  display: grid;
  gap: 6px;
  color: var(--text-subtle);
  font-size: 0.9rem;
  list-style: disc;
}

.action-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 24px;
  justify-content: center;
  width: 100%;
  align-items: center;
}

/* Stacked actions for auth forms */
.action-stack {
  margin-top: 24px;
  display: grid;
  gap: 12px;
  justify-items: center;
}

.action-stack .btn,
.action-stack .google-btn {
  width: 100%;
  max-width: 320px;
}

.action-row.centered {
  justify-content: center;
}

.google-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  border-radius: 16px;
  padding: 0 20px;
  height: 52px;
  border: 1px solid var(--border-soft);
  background: var(--surface-strong);
  cursor: pointer;
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease, background-color 0.18s ease;
}

.status-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 500;
  color: var(--text-muted);
}

.auth-panel.alt .status-chip {
  color: rgba(255, 255, 255, 0.9);
}

.auth-panel.alt .status-chip span {
  color: inherit;
}

/* Default icon-only Google button (kept for other pages);
   Auth page overrides below provide full-width labeled style. */

.card-layout {
  width: 100%;
  max-width: 880px;
  background: var(--surface);
  border-radius: 36px;
  box-shadow: var(--shadow-lg);
  backdrop-filter: blur(20px);
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  overflow: hidden;
}

.card-layout .panel {
  padding: 48px;
}

.card-layout .panel.alt {
  background: linear-gradient(135deg, var(--primary-500), var(--accent-500));
  color: #fff;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.card-layout .panel.alt h3 {
  font-size: 2rem;
  margin: 0 0 1rem;
}

.card-layout .panel.alt p {
  margin: 0;
  line-height: 1.8;
  opacity: 0.88;
}

.card-layout .panel.alt .illustration {
  margin-top: 32px;
  display: grid;
  gap: 12px;
}

@media (max-width: 960px) {
  .card-layout {
    grid-template-columns: 1fr;
  }

  .card-layout .panel.alt {
    order: -1;
    min-height: 240px;
  }
}

@media (max-width: 640px) {
  body {
    padding: 32px 14px;
  }

  .glass-card {
    padding: 32px 28px;
    border-radius: 22px;
  }

  .card-layout .panel {
    padding: 32px 26px;
  }
}

.text-muted {
  color: var(--text-muted);
}

.text-subtle {
  color: var(--text-subtle);
}

.text-center {
  text-align: center;
}

pre.session-output {
  background: var(--surface-strong);
  border-radius: 16px;
  border: 1px solid var(--border-soft);
  padding: 18px;
  max-height: 320px;
  overflow: auto;
  font-size: 0.92rem;
  line-height: 1.6;
}

.grid-inline {
  display: inline-grid;
  gap: 6px;
  align-items: center;
}

.page-footer {
  margin-top: 24px;
  font-size: 0.9rem;
  color: var(--text-subtle);
  text-align: center;
}

.page-footer a {
  color: var(--primary-600);
  font-weight: 600;
  text-decoration: none;
}

.page-footer a:hover {
  text-decoration: underline;
}

.auth-container {
  width: 100%;
  max-width: 960px;
  background: var(--surface);
  border-radius: 36px;
  box-shadow: var(--shadow-lg);
  backdrop-filter: blur(20px);
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  overflow: hidden;
}

.auth-panel {
  padding: 48px;
  display: flex;
  flex-direction: column;
  gap: 28px;
  position: relative;
}

.auth-panel.alt {
  background: linear-gradient(135deg, var(--primary-500), var(--accent-500));
  color: #fff;
  justify-content: space-between;
  overflow: hidden;
}

.auth-panel.alt h2 {
  font-size: 2.2rem;
  margin: 0;
}

.auth-panel.alt p {
  margin: 0;
  font-size: 1.05rem;
  line-height: 1.7;
  opacity: 0.9;
}

.auth-forms {
  --form-height: auto;
  position: relative;
  height: var(--form-height);
  min-height: 520px;
}

.auth-forms form {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  gap: 18px;
  padding-bottom: 12px;
  opacity: 0;
  pointer-events: none;
  transform: translateY(16px);
  transition: opacity 0.25s ease, transform 0.25s ease;
}

.auth-container:not(.sign-up-mode) .sign-in-form,
.auth-container.sign-up-mode .sign-up-form {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

/* Full-width Google button style in auth forms */
.auth-forms .google-btn {
  width: 100%;
  height: 52px;
  border-radius: 16px;
  border: 1px solid var(--border-soft);
  background: var(--surface-strong);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  cursor: pointer;
  padding: 0 20px;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-strong);
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease, background-color 0.18s ease;
}

.auth-forms .google-btn:hover {
  transform: translateY(-2px);
  border-color: var(--primary-500);
  box-shadow: 0 16px 32px rgba(108, 92, 231, 0.18);
  background-color: rgba(108, 92, 231, 0.05);
}

.auth-forms .google-btn:focus-visible {
  outline: 3px solid rgba(108, 92, 231, 0.35);
  outline-offset: 3px;
}

.auth-forms .google-btn img {
  width: 24px;
  height: 24px;
}

.auth-forms .google-btn span {
  line-height: 1;
}

.or-sep {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--text-subtle);
  font-size: 0.95rem;
}

.or-sep::before,
.or-sep::after {
  content: '';
  display: block;
  height: 1px;
  width: 64px;
  background: rgba(0,0,0,0.06);
  align-self: center;
}

.action-stack .btn {
  margin-bottom: 6px;
}

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

.form-header .form-heading {
  font-size: 2.1rem;
}

.auth-forms .page-subtext {
  margin: 0;
}

.auth-forms .form-heading {
  margin: 0;
  font-size: 2rem;
  font-weight: 600;
}

.auth-forms .form-switch {
  font-size: 0.95rem;
  color: var(--text-muted);
  text-align: center;
}

.auth-forms .form-switch a {
  color: var(--primary-600);
  font-weight: 600;
  text-decoration: none;
}

.auth-forms .form-switch a:hover {
  text-decoration: underline;
}

.input-field {
  display: grid;
  grid-template-columns: 42px 1fr 42px;
  align-items: center;
  border-radius: 16px;
  border: 1px solid var(--border-soft);
  background: var(--surface-strong);
  padding: 0 12px;
}

.input-field i {
  color: var(--text-subtle);
  justify-self: center;
  font-size: 1rem;
}

.input-field input {
  border: none;
  background: transparent;
  font-size: 1rem;
  padding: 14px 8px;
  color: var(--text-strong);
}

.input-field input:focus {
  outline: none;
}

.toggle-password {
  cursor: pointer;
  color: var(--text-subtle);
  transition: color 0.2s ease;
}

.toggle-password:hover {
  color: var(--primary-600);
}

/* Use opacity + transforms to switch forms instead of display toggles */

.footnote {
  font-size: 0.9rem;
  color: var(--text-muted);
  text-align: center;
}

.footnote a {
  color: var(--primary-600);
  text-decoration: none;
  font-weight: 600;
}

.footnote a:hover {
  text-decoration: underline;
}

.geometry {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.geom {
  position: absolute;
  display: block;
  backdrop-filter: blur(4px);
}

.geom-circle {
  width: 220px;
  height: 220px;
  background: radial-gradient(circle at 30% 30%, rgba(255, 255, 255, 0.35), transparent 70%);
  border-radius: 50%;
  top: -60px;
  right: -40px;
  animation: geom-float 18s ease-in-out infinite;
}

.geom-diamond {
  width: 160px;
  height: 160px;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.3), rgba(255, 255, 255, 0));
  transform: rotate(45deg);
  border-radius: 24px;
  bottom: 18%;
  right: 18%;
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.08);
  animation: geom-drift 16s ease-in-out infinite alternate;
}

.geom-triangle {
  width: 0;
  height: 0;
  border-left: 90px solid transparent;
  border-right: 90px solid transparent;
  border-bottom: 150px solid rgba(255, 255, 255, 0.18);
  bottom: -40px;
  left: -20px;
  filter: drop-shadow(0 30px 30px rgba(0, 0, 0, 0.1));
  animation: geom-wobble 20s ease-in-out infinite;
}

.alt-content {
  position: relative;
  z-index: 1;
  display: grid;
  gap: 14px;
}

.illustration {
  position: relative;
  z-index: 1;
  display: grid;
  gap: 14px;
}

@keyframes geom-float {
  0% {
    transform: translate3d(0, 0, 0);
  }
  50% {
    transform: translate3d(-20px, 18px, 0);
  }
  100% {
    transform: translate3d(4px, -12px, 0);
  }
}

@keyframes geom-drift {
  0% {
    transform: rotate(45deg) translate3d(0, 0, 0);
  }
  50% {
    transform: rotate(45deg) translate3d(12px, -18px, 0);
  }
  100% {
    transform: rotate(45deg) translate3d(-10px, 12px, 0);
  }
}

@keyframes geom-wobble {
  0% {
    transform: translate3d(0, 0, 0);
  }
  50% {
    transform: translate3d(24px, -10px, 0);
  }
  100% {
    transform: translate3d(-18px, -6px, 0);
  }
}

@media (max-width: 680px) {
  .auth-forms {
    min-height: 520px;
  }
}

.status-card {
  width: 100%;
  max-width: 600px;
  background: var(--surface);
  border-radius: var(--radius-xl);
  padding: 36px 40px;
  box-shadow: var(--shadow-md);
  text-align: center;
  backdrop-filter: blur(16px);
}

.status-card h1,
.status-card h2 {
  margin: 0 0 0.75rem;
  font-size: 2.15rem;
}

.status-card p {
  margin: 0 0 1.5rem;
  color: var(--text-muted);
  line-height: 1.7;
  font-size: 1rem;
}

.status-card .icon-ring {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  margin: 0 auto 24px;
  display: grid;
  place-items: center;
  background: rgba(108, 92, 231, 0.14);
  color: var(--primary-600);
  font-size: 2rem;
}

.status-card .actions {
  display: flex;
  justify-content: center;
  gap: 12px;
  flex-wrap: wrap;
}

.status-card .muted {
  color: var(--text-subtle);
  margin-top: 1.5rem;
  font-size: 0.95rem;
}

.stacked-card {
  width: 100%;
  max-width: 720px;
  background: var(--surface);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
  padding: 44px 48px;
  display: grid;
  gap: 28px;
  backdrop-filter: blur(18px);
}

.stacked-card header h1 {
  margin: 0 0 0.5rem;
  font-size: 2.05rem;
}

.stacked-card header p {
  margin: 0;
  color: var(--text-muted);
  line-height: 1.7;
}

.stacked-card .grid-twin {
  display: grid;
  gap: 20px;
}

@media (max-width: 960px) {
  .auth-container {
    grid-template-columns: 1fr;
  }

  .auth-panel.alt {
    min-height: 240px;
    order: -1;
  }
}

@media (max-width: 680px) {
  body {
    padding: 28px 14px;
  }

  .auth-panel,
  .stacked-card,
  .glass-card,
  .status-card {
    padding: 32px 26px;
  }

  .auth-panel.alt {
    padding: 28px 24px;
    min-height: 0;
  }

  .auth-panel.alt .alt-content {
    gap: 6px;
    text-align: center;
  }

  .auth-panel.alt .alt-content p,
  .auth-panel.alt .geometry {
    display: none;
  }
}
