:root, [data-auth-theme="dark"] {
  --bg-base: #0A0C10;
  --bg-panel: #0D1017;
  --bg-surface: rgba(255,255,255,0.035);
  --bg-surface-hover: rgba(255,255,255,0.055);
  --bg-input: rgba(255,255,255,0.045);
  --border-subtle: rgba(255,255,255,0.08);
  --border-strong: rgba(255,255,255,0.14);
  --indigo-300: #A5B4FC;
  --indigo-400: #818CF8;
  --indigo-500: #6366F1;
  --indigo-600: #4F46E5;
  --text-100: #EEF0F5;
  --text-300: #B7BDCB;
  --text-500: #7B8296;
  --text-600: #5C6377;
  --radius-card: 24px;
  --radius-feature: 18px;
  --radius-input: 14px;
  --radius-btn: 14px;
  --radius-pill: 999px;
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
  --shadow-card: 0 40px 80px -20px rgba(0,0,0,0.55), 0 10px 30px -10px rgba(0,0,0,0.4);
  --shadow-feature: 0 10px 30px -12px rgba(0,0,0,0.5);

  --strength-weak: #ef4444;
  --strength-fair: #f59e0b;
  --strength-strong: #10b981;

  --alert-danger-bg: rgba(239, 68, 68, 0.18);
  --alert-danger-text: #fca5a5;
  --alert-danger-border: rgba(239, 68, 68, 0.35);

  --alert-success-bg: rgba(16, 185, 129, 0.18);
  --alert-success-text: #6ee7b7;
  --alert-success-border: rgba(16, 185, 129, 0.35);

  --alert-info-bg: rgba(99, 102, 241, 0.18);
  --alert-info-text: #a5b4fc;
  --alert-info-border: rgba(99, 102, 241, 0.35);
}

html.light, [data-auth-theme="classic"] {
  --bg-base: #F3F4F8;
  --bg-panel: #EDEEF4;
  --bg-surface: rgba(20,22,35,0.035);
  --bg-surface-hover: rgba(20,22,35,0.06);
  --bg-input: rgba(20,22,35,0.045);
  --border-subtle: rgba(20,22,35,0.09);
  --border-strong: rgba(20,22,35,0.16);
  --text-100: #161821;
  --text-300: #4A4F62;
  --text-500: #767C90;
  --text-600: #9195A6;
  --shadow-card: 0 40px 80px -24px rgba(30,34,60,0.22), 0 10px 30px -12px rgba(30,34,60,0.14);
  --shadow-feature: 0 10px 26px -14px rgba(30,34,60,0.18);

  --strength-weak: #dc3545;
  --strength-fair: #ffc107;
  --strength-strong: #28a745;

  --alert-danger-bg: #f8d7da;
  --alert-danger-text: #721c24;
  --alert-danger-border: #f5c6cb;

  --alert-success-bg: #d4edda;
  --alert-success-text: #155724;
  --alert-success-border: #c3e6cb;

  --alert-info-bg: #d1ecf1;
  --alert-info-text: #0c5460;
  --alert-info-border: #bee5eb;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html { color-scheme: dark; }
html.light { color-scheme: light; }

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg-base);
  color: var(--text-100);
  min-height: 100vh;
  overflow-x: hidden;
  transition: background .4s var(--ease), color .4s var(--ease);
}

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: 0.001ms !important; transition-duration: 0.001ms !important; }
}

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

/* ---------- LEFT PANEL ---------- */
.panel-left {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 72px 88px;
  overflow: hidden;
  background: var(--bg-panel);
}

.mesh {
  position: absolute; inset: 0; z-index: 0; pointer-events: none;
}
.mesh::before {
  content: "";
  position: absolute;
  top: -20%; left: -10%;
  width: 70%; height: 70%;
  background: radial-gradient(circle at 30% 30%, rgba(99,102,241,0.35), transparent 65%);
  filter: blur(70px);
}
.mesh::after {
  content: "";
  position: absolute;
  bottom: -25%; right: -15%;
  width: 65%; height: 65%;
  background: radial-gradient(circle at 70% 70%, rgba(79,70,229,0.22), transparent 65%);
  filter: blur(90px);
}

html.light .mesh::before { background: radial-gradient(circle at 30% 30%, rgba(99,102,241,0.16), transparent 65%); }
html.light .mesh::after { background: radial-gradient(circle at 70% 70%, rgba(79,70,229,0.10), transparent 65%); }

.vignette {
  position: absolute; inset: 0; z-index: 1; pointer-events: none;
  background: radial-gradient(ellipse at 50% 50%, transparent 40%, rgba(0,0,0,0.35) 100%);
}
html.light .vignette { background: radial-gradient(ellipse at 50% 50%, transparent 40%, rgba(20,22,40,0.06) 100%); }

.grain {
  position: absolute; inset: 0; z-index: 1; pointer-events: none; opacity: 0.035;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

.brand {
  position: relative; z-index: 2;
  display: flex; align-items: center; gap: 10px;
  margin-bottom: 64px;
  opacity: 0; animation: rise .7s var(--ease) forwards; animation-delay: .05s;
}
.brand-mark {
  width: 30px; height: 30px; border-radius: 9px;
  background: linear-gradient(155deg, var(--indigo-400), var(--indigo-600));
  box-shadow: 0 4px 16px -4px rgba(99,102,241,0.6), inset 0 1px 0 rgba(255,255,255,0.35);
}
.brand-name {
  font-family: 'Inter Tight', sans-serif;
  font-weight: 700; font-size: 16px; letter-spacing: -0.01em;
  color: var(--text-100);
}

.content-block { position: relative; z-index: 2; max-width: 520px; }
h1.hero {
  font-family: 'Inter Tight', sans-serif;
  font-weight: 800;
  font-size: 56px;
  line-height: 1.04;
  letter-spacing: -0.025em;
  color: var(--text-100);
  opacity: 0; animation: rise .7s var(--ease) forwards; animation-delay: .12s;
}
h1.hero span {
  background: linear-gradient(100deg, var(--indigo-300), var(--indigo-500));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
p.lede {
  margin-top: 22px;
  font-size: 18px;
  line-height: 1.6;
  color: var(--text-300);
  max-width: 420px;
  opacity: 0; animation: rise .7s var(--ease) forwards; animation-delay: .18s;
}

.features {
  position: relative; z-index: 2;
  margin-top: 56px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  opacity: 0; animation: rise .7s var(--ease) forwards; animation-delay: .26s;
}
.feature-card {
  padding: 20px;
  border-radius: var(--radius-feature);
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  box-shadow: var(--shadow-feature);
  transition: transform .28s var(--ease), border-color .28s var(--ease), box-shadow .28s var(--ease), background .28s var(--ease);
}
.feature-card:hover {
  transform: translateY(-4px);
  border-color: var(--border-strong);
  background: var(--bg-surface-hover);
  box-shadow: 0 20px 40px -16px rgba(0,0,0,0.5);
}
.feature-icon {
  width: 34px; height: 34px;
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(155deg, rgba(129,140,248,0.28), rgba(79,70,229,0.14));
  border: 1px solid rgba(129,140,248,0.25);
  margin-bottom: 14px;
  transition: box-shadow .28s var(--ease), background .28s var(--ease);
}
.feature-card:hover .feature-icon {
  box-shadow: 0 0 0 4px rgba(129,140,248,0.08);
  background: linear-gradient(155deg, rgba(129,140,248,0.4), rgba(79,70,229,0.2));
}
.feature-icon svg { width: 17px; height: 17px; stroke: var(--indigo-300); }
.feature-title {
  font-family: 'Inter Tight', sans-serif;
  font-weight: 600; font-size: 14.5px;
  color: var(--text-100);
  margin-bottom: 5px;
  letter-spacing: -0.005em;
}
.feature-desc {
  font-size: 13px; line-height: 1.5;
  color: var(--text-500);
}

/* ---------- RIGHT PANEL ---------- */
.panel-right {
  position: relative;
  display: flex; align-items: center; justify-content: center;
  padding: 48px;
  background: var(--bg-base);
}
.theme-toggle {
  position: absolute; top: 32px; right: 32px;
  display: flex; align-items: center; gap: 6px;
  padding: 5px;
  border-radius: var(--radius-pill);
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  backdrop-filter: blur(10px);
  z-index: 5;
}
.theme-toggle button {
  width: 28px; height: 28px;
  border: none; border-radius: 50%;
  background: transparent;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; color: var(--text-500);
  transition: background .22s var(--ease), color .22s var(--ease);
}
.theme-toggle button.active {
  background: var(--indigo-500);
  color: #fff;
}
.theme-toggle svg { width: 14px; height: 14px; }

.auth-card {
  width: 100%; max-width: 440px;
  padding: 40px 36px 36px;
  border-radius: var(--radius-card);
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  box-shadow: var(--shadow-card), inset 0 1px 0 rgba(255,255,255,0.06);
  opacity: 0; animation: rise .7s var(--ease) forwards; animation-delay: .2s;
}
html.light .auth-card { box-shadow: var(--shadow-card), inset 0 1px 0 rgba(255,255,255,0.6); }

.auth-header { margin-bottom: 22px; }
.auth-header h2 {
  font-family: 'Inter Tight', sans-serif;
  font-weight: 700; font-size: 23px;
  letter-spacing: -0.015em;
  color: var(--text-100);
}
.auth-header p {
  margin-top: 5px;
  font-size: 14px;
  color: var(--text-500);
}

.tabs {
  position: relative;
  display: grid; grid-template-columns: 1fr 1fr;
  padding: 4px;
  border-radius: var(--radius-pill);
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  margin-bottom: 26px;
}
.tab-indicator {
  position: absolute; top: 4px; left: 4px;
  width: calc(50% - 4px); height: calc(100% - 8px);
  border-radius: var(--radius-pill);
  background: linear-gradient(155deg, var(--indigo-500), var(--indigo-600));
  box-shadow: 0 4px 14px -4px rgba(99,102,241,0.55);
  transition: transform .32s var(--ease);
}
.tabs.tab-1 .tab-indicator { transform: translateX(100%); }
.tab-btn {
  position: relative; z-index: 1;
  border: none; background: transparent;
  padding: 9px 0;
  font-family: 'Inter', sans-serif;
  font-weight: 600; font-size: 13.5px;
  color: var(--text-500);
  cursor: pointer;
  border-radius: var(--radius-pill);
  transition: color .28s var(--ease);
}
.tab-btn.active { color: #fff; }

/* Tab Panes */
.tab-pane {
  display: none;
}
.tab-pane.active {
  display: block;
  animation: rise 0.35s var(--ease);
}

form { display: flex; flex-direction: column; gap: 18px; }

.field label, .form-label {
  display: block;
  font-size: 12.5px; font-weight: 600;
  color: var(--text-300);
  margin-bottom: 8px;
  letter-spacing: 0.01em;
}

.input-wrap { position: relative; }
.input-wrap input, .form-control {
  width: 100%;
  padding: 12px 14px;
  font-family: 'Inter', sans-serif;
  font-size: 14.5px;
  color: var(--text-100);
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-input);
  outline: none;
  transition: border-color .22s var(--ease), box-shadow .22s var(--ease), background .22s var(--ease);
}
.input-wrap input::placeholder, .form-control::placeholder { color: var(--text-600); }
.input-wrap input:hover, .form-control:hover { border-color: var(--border-strong); }
.input-wrap input:focus, .form-control:focus {
  border-color: var(--indigo-400);
  box-shadow: 0 0 0 4px rgba(129,140,248,0.16);
  background: var(--bg-surface-hover);
}
.input-wrap input:focus-visible, .form-control:focus-visible { outline: 2px solid var(--indigo-300); outline-offset: 2px; }
.input-wrap.has-icon input { padding-right: 44px; }

.password-toggle-wrapper { position: relative; }
.password-toggle-btn, .icon-btn {
  position: absolute; right: 4px; top: 50%; transform: translateY(-50%);
  width: 36px; height: 36px;
  border: none; background: transparent;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; color: var(--text-500);
  border-radius: 10px;
  transition: color .2s var(--ease), background .2s var(--ease);
}
.password-toggle-btn:hover, .icon-btn:hover { color: var(--text-100); background: var(--bg-surface-hover); }
.password-toggle-btn svg, .icon-btn svg { width: 17px; height: 17px; }

/* Password Strength Indicator */
.password-strength {
  margin-top: 8px;
  height: 4px;
  background: var(--border-subtle);
  border-radius: 2px;
  overflow: hidden;
}
.strength-bar {
  height: 100%;
  width: 0%;
  transition: all 0.3s var(--ease);
}
.strength-weak { background: var(--strength-weak); width: 33.33%; }
.strength-fair { background: var(--strength-fair); width: 66.66%; }
.strength-strong { background: var(--strength-strong); width: 100%; }

.strength-text, .password-match {
  font-size: 0.8rem;
  margin-top: 5px;
  font-weight: 600;
}
.strength-weak-text, .match-error { color: var(--strength-weak); }
.strength-fair-text { color: var(--strength-fair); }
.strength-strong-text, .match-success { color: var(--strength-strong); }

/* Role Selection Options */
.role-selection {
  display: flex;
  gap: 12px;
  margin-bottom: 6px;
}
.role-option {
  flex: 1;
  position: relative;
}
/* Visually hidden but still focusable and exposed to assistive tech.
   `display: none` would drop these radios out of the tab order and the
   accessibility tree, leaving keyboard and screen-reader users stuck on the
   default role (Student) with no way to register as a Teacher. */
.role-option input[type="radio"] {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: 0;
  padding: 0;
  border: 0;
  opacity: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
}
/* Keyboard focus must be visible on the label, since the input itself is not. */
.role-option input[type="radio"]:focus-visible + .role-label {
  outline: 2px solid var(--indigo-400);
  outline-offset: 2px;
}
.role-label {
  display: block;
  padding: 14px;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-input);
  text-align: center;
  cursor: pointer;
  transition: all 0.25s var(--ease);
  background: var(--bg-input);
}
.role-label i, .role-label svg {
  font-size: 1.4rem;
  display: block;
  margin: 0 auto 6px;
  color: var(--indigo-300);
}
.role-label span {
  display: block;
  font-weight: 600;
  font-size: 13.5px;
  color: var(--text-100);
}
.role-label small {
  display: block;
  font-size: 11.5px;
  color: var(--text-500);
  margin-top: 2px;
}
.role-option input[type="radio"]:checked + .role-label {
  border-color: var(--indigo-400);
  background: rgba(99,102,241,0.15);
  box-shadow: 0 0 0 3px rgba(129,140,248,0.16);
}

.tutor-code-container {
  background: var(--bg-input);
  padding: 14px;
  border-radius: var(--radius-input);
  border: 1px solid var(--border-subtle);
}
.tutor-code-hint {
  font-size: 12px;
  color: var(--text-500);
  margin-top: 6px;
}

.field-row {
  display: flex; align-items: center; justify-content: space-between;
  margin-top: -4px;
}
.remember { display: flex; align-items: center; gap: 8px; }
.remember input[type=checkbox] {
  appearance: none; width: 16px; height: 16px;
  border-radius: 5px; border: 1px solid var(--border-strong);
  background: var(--bg-input); cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: background .2s var(--ease), border-color .2s var(--ease);
}
.remember input[type=checkbox]:checked {
  background: var(--indigo-500); border-color: var(--indigo-500);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='white' stroke-width='2.4'%3E%3Cpath d='M3.5 8.2l3 3 6-6.4'/%3E%3C/svg%3E");
  background-size: 11px; background-repeat: no-repeat; background-position: center;
}
.remember label { font-size: 13px; color: var(--text-300); cursor: pointer; margin-bottom: 0; }
.link-muted {
  font-size: 13px; font-weight: 500;
  color: var(--text-500);
  text-decoration: none;
  transition: color .2s var(--ease);
}
.link-muted:hover { color: var(--indigo-300); }

.btn-primary, .btn-auth {
  margin-top: 4px;
  padding: 13px 0;
  width: 100%;
  border: none; border-radius: var(--radius-btn);
  font-family: 'Inter', sans-serif;
  font-weight: 600; font-size: 14.5px;
  color: #fff;
  cursor: pointer;
  background: linear-gradient(155deg, var(--indigo-400), var(--indigo-600));
  box-shadow: 0 1px 0 rgba(255,255,255,0.25) inset, 0 12px 24px -10px rgba(99,102,241,0.55);
  transition: transform .22s var(--ease), box-shadow .22s var(--ease), filter .22s var(--ease);
}
.btn-primary:hover, .btn-auth:hover {
  transform: translateY(-2px);
  box-shadow: 0 1px 0 rgba(255,255,255,0.3) inset, 0 18px 32px -10px rgba(99,102,241,0.65);
  filter: brightness(1.05);
}
.btn-primary:active, .btn-auth:active { transform: translateY(0); }
.btn-primary:focus-visible, .btn-auth:focus-visible { outline: 2px solid var(--indigo-300); outline-offset: 2px; }

.divider {
  display: flex; align-items: center; gap: 14px;
  margin: 22px 0 18px;
  color: var(--text-600);
  font-size: 12px;
}
.divider::before, .divider::after {
  content: ""; flex: 1; height: 1px;
  background: var(--border-subtle);
}

.footer-note, .auth-footer {
  text-align: center;
  font-size: 13.5px;
  color: var(--text-500);
}
.footer-note a, .auth-footer a { color: var(--indigo-300); font-weight: 600; text-decoration: none; }
.footer-note a:hover, .auth-footer a:hover { text-decoration: underline; }

.verification-info {
  background: rgba(99,102,241,0.12);
  border-left: 4px solid var(--indigo-400);
  padding: 12px 14px;
  border-radius: 8px;
  margin-bottom: 16px;
  font-size: 13px;
  color: var(--text-300);
}

/* Alerts */
.alert {
  border-radius: var(--radius-input);
  border: 1px solid transparent;
  padding: 12px 15px;
  margin-bottom: 18px;
  font-size: 0.95rem;
}
.alert-danger {
  background: var(--alert-danger-bg);
  color: var(--alert-danger-text);
  border-color: var(--alert-danger-border);
}
.alert-success {
  background: var(--alert-success-bg);
  color: var(--alert-success-text);
  border-color: var(--alert-success-border);
}
.alert-info {
  background: var(--alert-info-bg);
  color: var(--alert-info-text);
  border-color: var(--alert-info-border);
}

/* Modals */
.modal-radius {
  border: none;
  border-radius: var(--radius-card);
  background: var(--bg-panel);
  color: var(--text-100);
  border: 1px solid var(--border-subtle);
}
.modal-header-brand {
  background: linear-gradient(155deg, var(--indigo-400), var(--indigo-600));
  color: #fff;
  border: none;
}
.modal-body-padding {
  padding: 30px;
}

.visually-hidden {
  position: absolute;
  left: -9999px;
  height: 1px;
  width: 1px;
  overflow: hidden;
}

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

/* ---------- RESPONSIVE ---------- */
@media (max-width: 1080px) {
  .panel-left { padding: 56px 56px; }
  h1.hero { font-size: 44px; }
  .features { gap: 10px; }
}

@media (max-width: 860px) {
  .layout { grid-template-columns: 1fr; }
  .panel-left {
    padding: 48px 32px 40px;
    min-height: auto;
  }
  h1.hero { font-size: 36px; }
  p.lede { font-size: 16px; }
  .features { grid-template-columns: 1fr 1fr; margin-top: 36px; gap: 10px; }
  .panel-right { padding: 32px; }
  .theme-toggle { top: 20px; right: 20px; }
}

@media (max-width: 520px) {
  .panel-left { padding: 40px 22px 32px; }
  h1.hero { font-size: 30px; }
  .brand { margin-bottom: 36px; }
  .features { grid-template-columns: 1fr; margin-top: 28px; }
  .auth-card { padding: 30px 22px 26px; border-radius: 20px; }
  .panel-right { padding: 22px 16px 40px; }
}
