:root {
  --ga-bg-base: #0f1117;
  --ga-bg-surface: rgba(22, 27, 39, 0.84);
  --ga-bg-surface-strong: rgba(15, 17, 23, 0.88);
  --ga-border: rgba(255, 255, 255, 0.08);
  --ga-text-primary: #e2e8f0;
  --ga-text-secondary: #94a3b8;
  --ga-text-muted: #64748b;
  --ga-accent-light: #818cf8;
  --ga-white: #ffffff;
  --ga-shadow: 0 24px 60px rgba(2, 8, 23, 0.45);
  --ga-radius-md: 14px;
  --ga-radius-xl: 28px;
}

html.aisk-env-sandbox {
  --ga-bg-base: #141106;
  --ga-bg-surface: rgba(27, 26, 18, 0.88);
  --ga-bg-surface-strong: rgba(20, 17, 6, 0.9);
  --ga-border: rgba(251, 191, 36, 0.18);
  --ga-accent-light: #fbbf24;
}

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

html,
body {
  min-height: 100%;
  margin: 0;
}

body.google-auth-page {
  position: relative;
  overflow-x: hidden;
  color: var(--ga-text-primary);
  font: 15px/1.6 Inter, "Segoe UI", system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
  background:
    radial-gradient(circle at top left, rgba(99, 102, 241, 0.18), transparent 28%),
    radial-gradient(circle at right center, rgba(14, 165, 233, 0.14), transparent 22%),
    linear-gradient(180deg, #0a0d14 0%, #0f1117 45%, #0a0d14 100%);
}

html.aisk-env-sandbox body.google-auth-page {
  background:
    radial-gradient(circle at top left, rgba(245, 158, 11, 0.2), transparent 28%),
    radial-gradient(circle at right center, rgba(251, 191, 36, 0.12), transparent 22%),
    linear-gradient(180deg, #0f0d05 0%, #141106 45%, #0f0d05 100%);
}

body.google-auth-page::before {
  content: "";
  position: fixed;
  inset: 0;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.025) 1px, transparent 1px);
  background-size: 72px 72px;
  mask-image: linear-gradient(180deg, rgba(0, 0, 0, 0.45), transparent 88%);
  pointer-events: none;
}

html.aisk-env-sandbox body.google-auth-page::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 20;
  pointer-events: none;
  border: 5px solid rgba(245, 158, 11, 0.92);
  box-shadow:
    inset 0 0 0 1px rgba(251, 191, 36, 0.28),
    inset 0 0 36px rgba(245, 158, 11, 0.16);
}

a {
  color: inherit;
  text-decoration: none;
}

.ga-env-badge {
  position: fixed;
  top: 16px;
  left: 16px;
  z-index: 30;
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 3px 11px;
  border: 1px solid rgba(251, 191, 36, 0.72);
  border-radius: 10px;
  background: rgba(20, 17, 6, 0.88);
  color: #fde68a;
  box-shadow: 0 0 20px rgba(245, 158, 11, 0.28);
  font-size: 12px;
  font-weight: 800;
  line-height: 1;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.ga-particle-canvas {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 0;
  opacity: 0.7;
}

.ga-page {
  position: relative;
  z-index: 1;
  min-height: 100svh;
  padding: 28px 24px;
  display: flex;
  align-items: center;
}

.ga-shell {
  width: 100%;
  max-width: 1080px;
  margin: 0 auto;
}

.ga-frame {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(320px, 390px);
  overflow: hidden;
  border: 1px solid var(--ga-border);
  border-radius: var(--ga-radius-xl);
  background: var(--ga-bg-surface);
  box-shadow: var(--ga-shadow);
  backdrop-filter: blur(18px);
}

.ga-frame::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.025), transparent 28%);
  pointer-events: none;
}

.ga-panel {
  position: relative;
  z-index: 1;
}

.ga-panel-story {
  padding: 42px 40px 38px;
}

.ga-panel-auth {
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 30px;
  border-left: 1px solid rgba(255, 255, 255, 0.06);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.02), transparent 34%),
    var(--ga-bg-surface-strong);
}

.ga-wordmark {
  display: flex;
  align-items: flex-end;
  gap: 0.06em;
  margin: 0 0 16px;
  font-size: clamp(4.8rem, 12vw, 8.8rem);
  line-height: 0.84;
  letter-spacing: -0.09em;
  font-weight: 800;
}

.ga-wordmark-ai {
  color: #f8fafc;
}

.ga-wordmark-sk {
  color: var(--ga-accent-light);
  text-shadow: 0 0 28px rgba(129, 140, 248, 0.18);
}

.ga-wordmark-sub {
  margin: 0 0 18px;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ga-text-muted);
}

.ga-headline {
  margin: 0;
  max-width: 14ch;
  font-size: clamp(1.5rem, 3vw, 2.25rem);
  line-height: 1.08;
  letter-spacing: -0.04em;
  color: var(--ga-text-primary);
}

.ga-status-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 24px;
}

.ga-status-pill {
  padding: 8px 12px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.03);
  font-size: 13px;
  color: var(--ga-text-primary);
}

.ga-card-label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 14px;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ga-text-muted);
}

.ga-auth-title {
  margin: 0;
  font-size: clamp(1.85rem, 3vw, 2.4rem);
  line-height: 1.08;
  letter-spacing: -0.04em;
}

.ga-auth-copy {
  margin: 14px 0 0;
  font-size: 15px;
  color: var(--ga-text-secondary);
}

.ga-google-btn {
  margin-top: 26px;
  min-height: 56px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 0 18px;
  border-radius: var(--ga-radius-md);
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: var(--ga-white);
  color: #0f172a;
  font-size: 15px;
  font-weight: 600;
  box-shadow: 0 18px 40px rgba(15, 23, 42, 0.2);
  transition: transform 0.18s ease, box-shadow 0.18s ease;
}

.ga-google-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 22px 44px rgba(15, 23, 42, 0.26);
}

.ga-auth-divider {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 20px 0 0;
  color: var(--ga-text-muted);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.ga-auth-divider::before,
.ga-auth-divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: rgba(255, 255, 255, 0.12);
}

.ga-auth-error {
  color: #f87171;
}

.ga-local-form {
  display: grid;
  gap: 10px;
  margin-top: 14px;
}

.ga-local-form input {
  width: 100%;
  background: rgba(15, 17, 23, 0.72);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: var(--ga-radius-md);
  padding: 11px 12px;
  color: var(--ga-text);
  font: inherit;
  outline: none;
}

.ga-local-form input:focus {
  border-color: rgba(16, 185, 129, 0.45);
}

.ga-local-submit {
  margin-top: 4px;
  width: 100%;
}

.ga-auth-link {
  display: inline-flex;
  margin-top: 14px;
  color: var(--ga-text-secondary);
  text-decoration: none;
  font-size: 13px;
}

.ga-auth-link:hover {
  color: var(--ga-text);
}

.ga-google-icon {
  width: 28px;
  height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: #ffffff;
  flex: 0 0 auto;
}

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

  .ga-panel-auth {
    border-left: none;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
  }
}

@media (max-width: 640px) {
  .ga-page {
    padding: 18px 16px;
  }

  .ga-panel-story,
  .ga-panel-auth {
    padding: 24px 22px;
  }

  .ga-wordmark {
    font-size: clamp(4rem, 22vw, 6.5rem);
  }

  .ga-headline,
  .ga-auth-title {
    max-width: none;
  }

  .ga-google-btn {
    width: 100%;
  }
}

/* ── PWA install button (sign-in page, beside the wordmark) ──────────────
   Shipped `hidden`; pwa-install.js reveals it only when the browser reports
   the app is installable — so an already-installed AISK never shows it. */
.ga-wordmark-row {
  display: flex;
  align-items: center;
  gap: 18px;
  flex-wrap: wrap;
  margin: 0 0 16px;
}
/* The wordmark carried the bottom margin; the row owns it now. */
.ga-wordmark-row .ga-wordmark { margin-bottom: 0; }

.ga-install-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 14px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(255, 255, 255, 0.04);
  color: var(--ga-text-primary);
  font: inherit;
  font-size: 13px;
  font-weight: 500;
  line-height: 1;
  white-space: nowrap;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, transform 0.1s;
}
/* Must out-specify the display above, or [hidden] does nothing. */
.ga-install-btn[hidden] { display: none; }
.ga-install-btn:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.24);
}
.ga-install-btn:active { transform: translateY(1px); }
.ga-install-btn svg { flex: 0 0 auto; }

.ga-install-btn--inline { align-self: center; }

@media (max-width: 720px) {
  .ga-wordmark-row { gap: 12px; }
  .ga-install-btn--inline { font-size: 12px; padding: 7px 11px; }
}
@media (prefers-reduced-motion: reduce) {
  .ga-install-btn { transition: none; }
  .ga-install-btn:active { transform: none; }
}
