:root {
  --ink: #14121f;
  --ink-soft: rgba(20, 18, 31, 0.6);
  --paper: #ffffff;
  --line: rgba(20, 18, 31, 0.1);
  --accent: #6c5ce7;
  --accent-soft: rgba(108, 92, 231, 0.12);
  --error: #e0475c;
  --error-soft: rgba(224, 71, 92, 0.1);
  --success: #1f9d63;
  --success-soft: rgba(31, 157, 99, 0.1);
  --radius-lg: 24px;
  --radius-md: 14px;
  --font-display: "Fraunces", Georgia, serif;
  --font-body: "Inter", system-ui, -apple-system, sans-serif;
}

* {
  box-sizing: border-box;
}

html, body {
  height: 100%;
}

body {
  margin: 0;
  font-family: var(--font-body);
  color: var(--ink);
  background: var(--paper);
}

.layout {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1.1fr 1fr;
}

/* ---------- Left brand panel ---------- */

.brand-panel {
  position: relative;
  overflow: hidden;
  background: linear-gradient(160deg, #1c1730 0%, #2b1f4a 45%, #452a5c 100%);
  color: #f4f2fb;
  display: flex;
  align-items: center;
  padding: 64px;
}

.mesh {
  position: absolute;
  inset: 0;
  filter: blur(60px);
  opacity: 0.75;
}

.blob {
  position: absolute;
  border-radius: 50%;
  mix-blend-mode: screen;
  animation: drift 18s ease-in-out infinite;
}

.blob-1 {
  width: 420px;
  height: 420px;
  background: #6c5ce7;
  top: -80px;
  left: -100px;
  animation-delay: 0s;
}

.blob-2 {
  width: 360px;
  height: 360px;
  background: #ff8a5c;
  bottom: -60px;
  left: 20%;
  animation-delay: -6s;
}

.blob-3 {
  width: 300px;
  height: 300px;
  background: #3fd6c0;
  top: 30%;
  right: -60px;
  animation-delay: -12s;
}

@keyframes drift {
  0%, 100% { transform: translate(0, 0) scale(1); }
  33% { transform: translate(30px, -20px) scale(1.08); }
  66% { transform: translate(-20px, 25px) scale(0.95); }
}

.brand-content {
  position: relative;
  z-index: 1;
  max-width: 420px;
}

.brand-mark {
  display: inline-block;
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: #d8d2f5;
  margin-bottom: 40px;
}

.brand-content h1 {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 2.4rem;
  line-height: 1.2;
  margin: 0 0 16px;
}

.brand-content > p {
  font-size: 0.98rem;
  line-height: 1.6;
  color: #cfc9e8;
  margin: 0 0 48px;
}

.quote {
  border-left: 2px solid rgba(255, 255, 255, 0.25);
  padding-left: 18px;
}

.quote p {
  font-family: var(--font-display);
  font-style: italic;
  font-size: 1.05rem;
  margin: 0 0 8px;
  color: #f4f2fb;
}

.quote span {
  font-size: 0.8rem;
  color: #a89bd6;
}

/* ---------- Right form panel ---------- */

.form-panel {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px 24px;
  background:
    radial-gradient(circle at 15% 20%, rgba(108, 92, 231, 0.06), transparent 40%),
    radial-gradient(circle at 85% 80%, rgba(63, 214, 192, 0.06), transparent 40%);
}

.glass-card {
  width: 100%;
  max-width: 380px;
  background: rgba(255, 255, 255, 0.7);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.6);
  border-radius: var(--radius-lg);
  padding: 36px 32px;
  box-shadow: 0 20px 60px rgba(20, 18, 31, 0.08), 0 2px 8px rgba(20, 18, 31, 0.04);
  animation: rise 0.5s ease both;
}

@keyframes rise {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

.card-header h2 {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.6rem;
  margin: 0 0 4px;
}

.card-header p {
  margin: 0 0 24px;
  font-size: 0.88rem;
  color: var(--ink-soft);
}

.oauth-row {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 20px;
}

.oauth-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  padding: 11px 14px;
  border-radius: var(--radius-md);
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.6);
  font-family: var(--font-body);
  font-size: 0.88rem;
  font-weight: 500;
  color: var(--ink);
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease, transform 0.05s ease;
}

.oauth-btn:hover {
  border-color: rgba(20, 18, 31, 0.25);
  background: #fff;
}

.oauth-btn:active {
  transform: scale(0.98);
}

.divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 22px 0 18px;
  font-size: 0.76rem;
  color: var(--ink-soft);
}

.divider::before,
.divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--line);
}

.field {
  margin-bottom: 16px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.field-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

label {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--ink);
}

.link-btn {
  background: none;
  border: none;
  padding: 0;
  font-family: var(--font-body);
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--accent);
  cursor: pointer;
}

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

input[type="text"],
input[type="password"] {
  width: 100%;
  padding: 11px 13px;
  border-radius: var(--radius-md);
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.75);
  font-family: var(--font-body);
  font-size: 0.92rem;
  color: var(--ink);
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}

input::placeholder {
  color: rgba(20, 18, 31, 0.35);
}

input[type="text"]:focus,
input[type="password"]:focus {
  border-color: var(--accent);
  background: #fff;
  box-shadow: 0 0 0 4px var(--accent-soft);
}

input.invalid {
  border-color: var(--error);
  box-shadow: 0 0 0 4px var(--error-soft);
}

.message {
  min-height: 0;
  margin: 0;
  font-size: 0.82rem;
  border-radius: var(--radius-md);
  overflow: hidden;
  max-height: 0;
  opacity: 0;
  transition: max-height 0.25s ease, opacity 0.2s ease, margin 0.25s ease, padding 0.25s ease;
  padding: 0 12px;
}

.message.show {
  max-height: 60px;
  opacity: 1;
  margin-bottom: 14px;
  padding: 9px 12px;
}

.message.error {
  color: var(--error);
  background: var(--error-soft);
}

.message.success {
  color: var(--success);
  background: var(--success-soft);
}

.btn-primary {
  width: 100%;
  padding: 12px 14px;
  border: none;
  border-radius: var(--radius-md);
  background: var(--ink);
  color: #fff;
  font-family: var(--font-body);
  font-size: 0.92rem;
  font-weight: 600;
  cursor: pointer;
  position: relative;
  transition: background 0.15s ease, transform 0.05s ease;
}

.btn-primary:hover {
  background: #2a2540;
}

.btn-primary:active {
  transform: scale(0.98);
}

.btn-primary.loading .btn-label {
  visibility: hidden;
}

.btn-primary.loading::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 15px;
  height: 15px;
  margin: -8px 0 0 -8px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

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

.btn-primary.success {
  background: var(--success);
}

.btn-text {
  display: block;
  width: 100%;
  margin-top: 10px;
  padding: 8px;
  background: none;
  border: none;
  font-family: var(--font-body);
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--ink-soft);
  cursor: pointer;
  border-radius: var(--radius-md);
  transition: background 0.15s ease, color 0.15s ease;
}

.btn-text:hover {
  background: rgba(20, 18, 31, 0.05);
  color: var(--ink);
}

.hint {
  margin-top: 24px;
  padding-top: 16px;
  border-top: 1px dashed var(--line);
  display: flex;
  flex-direction: column;
  gap: 3px;
  font-size: 0.78rem;
  color: var(--ink-soft);
}

.hint code {
  background: rgba(20, 18, 31, 0.06);
  padding: 1px 6px;
  border-radius: 4px;
  color: var(--ink);
}

/* shake on failed login */
.shake {
  animation: shake 0.4s ease;
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-6px); }
  40% { transform: translateX(6px); }
  60% { transform: translateX(-4px); }
  80% { transform: translateX(4px); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
}

@media (max-width: 860px) {
  .layout {
    grid-template-columns: 1fr;
  }
  .brand-panel {
    display: none;
  }
  .form-panel {
    padding: 60px 20px;
  }
}
