:root {
  --bg: #f4f7fb;
  --bg-glow: rgba(78, 114, 255, 0.12);
  --card: rgba(255, 255, 255, 0.92);
  --card-line: rgba(25, 34, 62, 0.1);
  --input-line: #d9dfeb;
  --text: #1e2433;
  --muted: #7f8798;
  --accent: #3977f6;
  --accent-strong: #275fe0;
  --success-bg: #eefbf3;
  --success-text: #1d6b43;
  --error-bg: #fff0f3;
  --error-text: #b9375d;
  --info-bg: #eff5ff;
  --info-text: #33589f;
  --shadow: 0 32px 80px rgba(35, 54, 102, 0.12);
}

* {
  box-sizing: border-box;
  -webkit-font-smoothing: antialiased;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: 'Outfit', 'Inter', sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at top left, var(--bg-glow) 0%, transparent 32%),
    radial-gradient(circle at bottom right, rgba(122, 167, 255, 0.08) 0%, transparent 28%),
    var(--bg);
}

.auth-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.auth-card {
  width: min(540px, 100%);
}

.brand-strip {
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 24px;
}

.brand-logo-img {
  width: 136px;
  max-width: 42vw;
  height: auto;
}

.auth-panel {
  padding: clamp(30px, 6vw, 42px);
  border-radius: 28px;
  background: var(--card);
  border: 1px solid var(--card-line);
  box-shadow: var(--shadow);
}

.entry-badge {
  margin: 0 0 12px;
  color: var(--muted);
  font-size: 0.95rem;
  font-weight: 500;
  text-align: center;
}

.entry-kicker {
  margin: 0 0 8px;
  color: var(--muted);
  font-size: clamp(1rem, 1.7vw, 1.1rem);
  text-align: center;
}

h1 {
  margin: 0 0 14px;
  font-size: clamp(2.4rem, 5vw, 3.2rem);
  line-height: 0.98;
  letter-spacing: -0.04em;
  text-align: center;
}

.page-subtitle {
  margin: 0 0 26px;
  color: var(--muted);
  font-size: 1.02rem;
  line-height: 1.55;
  text-align: center;
}

.status-card,
.session-panel,
.debug-panel,
.motion-card {
  border-radius: 18px;
}

.status-card {
  margin-bottom: 18px;
  padding: 14px 16px;
}

.status-card strong {
  display: block;
  margin-bottom: 6px;
  font-size: 0.98rem;
}

.status-card p {
  margin: 0;
  line-height: 1.5;
}

.status-card.info {
  background: var(--info-bg);
  color: var(--info-text);
}

.status-card.success {
  background: var(--success-bg);
  color: var(--success-text);
}

.status-card.error {
  background: var(--error-bg);
  color: var(--error-text);
}

.motion-card {
  margin-bottom: 18px;
  border: 1px solid rgba(57, 119, 246, 0.12);
  background:
    radial-gradient(circle at center, rgba(57, 119, 246, 0.08), transparent 62%),
    #f8fbff;
  overflow: hidden;
}

#auth-rive {
  display: block;
  width: 100%;
  height: 220px;
}

.login-form {
  display: grid;
  gap: 16px;
}

.field {
  display: grid;
  gap: 8px;
}

.field span {
  color: var(--text);
  font-size: 0.95rem;
  font-weight: 500;
}

.field input {
  width: 100%;
  height: 60px;
  padding: 0 18px;
  border-radius: 16px;
  border: 1px solid var(--input-line);
  background: #fff;
  color: var(--text);
  font: inherit;
  font-size: 1rem;
  outline: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
}

.field input::placeholder {
  color: #9ba4b7;
}

.field input:focus {
  border-color: rgba(57, 119, 246, 0.48);
  box-shadow: 0 0 0 4px rgba(57, 119, 246, 0.12);
}

.primary-button,
.secondary-button {
  width: 100%;
  min-height: 58px;
  border: 0;
  border-radius: 16px;
  font: inherit;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease, opacity 0.2s ease;
}

.primary-button {
  margin-top: 8px;
  background: linear-gradient(135deg, var(--accent), var(--accent-strong));
  color: #fff;
  box-shadow: 0 18px 32px rgba(57, 119, 246, 0.22);
}

.secondary-button {
  background: #fff;
  border: 1px solid var(--input-line);
  color: var(--text);
}

.primary-button:hover,
.secondary-button:hover {
  transform: translateY(-1px);
}

.primary-button:disabled,
.secondary-button:disabled {
  opacity: 0.66;
  cursor: wait;
  transform: none;
}

.session-panel {
  margin-top: 16px;
  padding: 18px;
  border: 1px solid var(--card-line);
  background: rgba(244, 247, 251, 0.9);
}

.session-copy {
  margin: 0 0 14px;
  color: var(--text);
  line-height: 1.5;
}

.session-actions {
  display: grid;
  gap: 12px;
}

.entry-note {
  margin: 22px 0 0;
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.5;
  text-align: center;
}

.brand-footer {
  margin: 12px 0 0;
  text-align: center;
  display: grid;
  gap: 4px;
}

.brand-footer a {
  color: var(--accent-strong);
  font-size: 0.84rem;
  text-decoration: none;
  transition: color 0.2s ease;
}

.brand-footer a:hover {
  color: var(--accent);
}

.brand-footer span {
  color: rgba(127, 135, 152, 0.88);
  font-size: 0.75rem;
  line-height: 1.45;
}

.debug-panel {
  margin-top: 18px;
  padding: 14px 16px;
  border: 1px dashed var(--card-line);
  background: rgba(255, 255, 255, 0.64);
}

.debug-panel summary {
  cursor: pointer;
  font-weight: 600;
}

.debug-panel pre {
  margin: 14px 0 0;
  white-space: pre-wrap;
  word-break: break-word;
}

.hidden {
  display: none !important;
}

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

  .auth-panel {
    padding: 26px 20px;
    border-radius: 22px;
  }

  h1 {
    font-size: 2.25rem;
  }

  #auth-rive {
    height: 180px;
  }

  .brand-logo-img {
    width: 124px;
    max-width: 46vw;
  }
}
