:root {
  --bg: #0f172a;
  --surface: rgba(255,255,255,.08);
  --surface-2: rgba(255,255,255,.06);
  --border: rgba(255,255,255,.14);
  --text: #f8fafc;
  --muted: #cbd5e1;
  --primary: #6366f1;
  --primary-2: #4f46e5;
  --success: #22c55e;
  --danger: #ef4444;
  --warning: #f59e0b;
  --shadow: 0 20px 60px rgba(0,0,0,.28);
}

html[data-theme="light"] {
  --bg: #f8fafc;
  --surface: rgba(255,255,255,.78);
  --surface-2: rgba(255,255,255,.88);
  --border: rgba(15,23,42,.08);
  --text: #0f172a;
  --muted: #475569;
  --primary: #4f46e5;
  --primary-2: #4338ca;
  --success: #16a34a;
  --danger: #dc2626;
  --warning: #d97706;
  --shadow: 0 20px 60px rgba(15,23,42,.10);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: 'Public Sans', sans-serif;
  background:
    radial-gradient(circle at top left, rgba(99,102,241,.25), transparent 28%),
    radial-gradient(circle at top right, rgba(14,165,233,.18), transparent 24%),
    linear-gradient(135deg, #0f172a, #111827 55%, #1e293b);
  color: var(--text);
  min-height: 100vh;
}

html[data-theme="light"] body {
  background:
    radial-gradient(circle at top left, rgba(99,102,241,.10), transparent 28%),
    radial-gradient(circle at top right, rgba(14,165,233,.08), transparent 24%),
    linear-gradient(135deg, #eef2ff, #f8fafc 55%, #e2e8f0);
}

.container {
  width: 100%;
  max-width: 1180px;
  margin: 0 auto;
  padding: 24px 20px 60px;
}

.page-topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin-bottom: 20px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  font-weight: 700;
  letter-spacing: .02em;
}

.brand-badge {
  width: 44px;
  height: 44px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, var(--primary), var(--primary-2));
  box-shadow: 0 12px 30px rgba(99,102,241,.32);
  font-size: 18px;
}

.brand small {
  display: block;
  color: var(--muted);
  font-weight: 500;
  font-size: 12px;
  margin-top: 2px;
}

.hero {
  position: relative;
  overflow: hidden;
  border-radius: 32px;
  min-height: 420px;
  background:
    linear-gradient(120deg, rgba(15,23,42,.85), rgba(15,23,42,.65)),
    url('../img/gradia/school-hero.jpg') center/cover no-repeat;
  border: 1px solid rgba(255,255,255,.12);
  box-shadow: var(--shadow);
  margin-bottom: 28px;
}

html[data-theme="light"] .hero {
  background:
    linear-gradient(120deg, rgba(255,255,255,.82), rgba(255,255,255,.62)),
    url('../img/gradia/school-hero.jpg') center/cover no-repeat;
}

.hero::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 15% 20%, rgba(99,102,241,.24), transparent 22%),
    radial-gradient(circle at 80% 15%, rgba(14,165,233,.18), transparent 20%);
  pointer-events: none;
}

.hero-content {
  position: relative;
  z-index: 2;
  display: grid;
  grid-template-columns: 1.2fr .8fr;
  gap: 24px;
  align-items: center;
  min-height: 420px;
  padding: 38px;
}

.hero-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: 999px;
  background: rgba(255,255,255,.08);
  border: 1px solid rgba(255,255,255,.12);
  color: #e2e8f0;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 18px;
}

html[data-theme="light"] .hero-eyebrow,
html[data-theme="light"] .achievement-badge {
  color: #312e81;
  background: rgba(99,102,241,.10);
  border: 1px solid rgba(99,102,241,.12);
}

.hero h1 {
  margin: 0 0 14px;
  font-size: clamp(30px, 4.4vw, 54px);
  line-height: 1.08;
  font-weight: 800;
  letter-spacing: -.03em;
  max-width: 760px;
}

.hero p {
  margin: 0;
  max-width: 680px;
  font-size: 16px;
  line-height: 1.8;
  color: var(--muted);
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 26px;
  backdrop-filter: blur(12px);
  box-shadow: var(--shadow);
}

.card-body {
  padding: 28px;
}

.hero-form-card {
  background: rgba(15,23,42,.52);
  border: 1px solid rgba(255,255,255,.14);
  border-radius: 26px;
  backdrop-filter: blur(12px);
  box-shadow: var(--shadow);
}

.hero-form-card .card-body {
  padding: 24px;
}

.section-title {
  margin: 0 0 8px;
  font-size: 22px;
  font-weight: 700;
}

.section-desc {
  margin: 0 0 20px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.7;
}

.form-label {
  display: block;
  margin-bottom: 8px;
  font-weight: 600;
}

.form-control {
  width: 100%;
  border: 1px solid rgba(255,255,255,.14);
  background: rgba(255,255,255,.08);
  color: var(--text);
  border-radius: 16px;
  padding: 14px 16px;
  font-size: 16px;
  outline: none;
  transition: .2s ease;
}

html[data-theme="light"] .form-control {
  background: rgba(255,255,255,.78);
  color: #0f172a;
  border-color: rgba(15,23,42,.10);
}

.form-control::placeholder {
  color: #94a3b8;
}

html[data-theme="light"] .form-control::placeholder {
  color: #64748b;
}

.form-control:focus {
  border-color: rgba(99,102,241,.85);
  box-shadow: 0 0 0 4px rgba(99,102,241,.16);
  background: rgba(255,255,255,.10);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: none;
  border-radius: 16px;
  padding: 14px 20px;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  text-decoration: none;
  transition: .2s ease;
}

.btn:hover {
  transform: translateY(-1px);
}

.btn-primary {
  background: linear-gradient(135deg, var(--primary), var(--primary-2));
  color: white;
  box-shadow: 0 12px 28px rgba(99,102,241,.28);
}

.btn-secondary {
  background: rgba(255,255,255,.08);
  color: white;
  border: 1px solid rgba(255,255,255,.14);
}

html[data-theme="light"] .btn-secondary,
html[data-theme="light"] .modal-close,
html[data-theme="light"] .toast-link.ghost {
  color: #0f172a;
  background: rgba(15,23,42,.04);
  border: 1px solid rgba(15,23,42,.08);
}

.alert {
  padding: 14px 16px;
  border-radius: 16px;
  margin-bottom: 16px;
  font-size: 14px;
  line-height: 1.6;
}

.alert-danger {
  background: rgba(239,68,68,.12);
  border: 1px solid rgba(239,68,68,.28);
  color: #fecaca;
}

.result-title {
  margin: 0 0 8px;
  font-size: 30px;
  font-weight: 800;
  letter-spacing: -.02em;
}

.result-subtitle {
  margin: 0 0 22px;
  color: var(--muted);
  line-height: 1.7;
}

.meta-list {
  display: grid;
  gap: 12px;
}

.meta-item {
  background: var(--surface-2);
  border: 1px solid rgba(255,255,255,.08);
  border-radius: 18px;
  padding: 14px 16px;
}

.meta-label {
  display: block;
  font-size: 12px;
  color: #94a3b8;
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: .05em;
}

.meta-value {
  font-size: 16px;
  font-weight: 700;
}

.status-box {
  margin-top: 24px;
  padding: 22px;
  border-radius: 22px;
  border: 1px solid rgba(255,255,255,.12);
}

.status-box.success {
  background: rgba(34,197,94,.12);
  border-color: rgba(34,197,94,.3);
}

.status-box.danger {
  background: rgba(239,68,68,.12);
  border-color: rgba(239,68,68,.3);
}

.status-box.warning {
  background: rgba(245,158,11,.12);
  border-color: rgba(245,158,11,.3);
}

.status-heading {
  margin: 0 0 10px;
  font-size: 24px;
  font-weight: 800;
}

.status-text,
.achievement-message,
.modal-message {
  margin: 0;
  line-height: 1.8;
  color: #e2e8f0;
}

html[data-theme="light"] .status-text,
html[data-theme="light"] .achievement-message,
html[data-theme="light"] .modal-message {
  color: #1e293b;
}

.actions {
  margin-top: 24px;
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.loading-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15,23,42,.82);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  backdrop-filter: blur(8px);
}

.loading-overlay.show {
  display: flex;
}

.loading-box {
  text-align: center;
  padding: 28px 30px;
  border-radius: 24px;
  background: rgba(255,255,255,.08);
  border: 1px solid rgba(255,255,255,.14);
  min-width: 260px;
  box-shadow: var(--shadow);
}

.spinner {
  width: 54px;
  height: 54px;
  margin: 0 auto 16px;
  border: 4px solid rgba(255,255,255,.18);
  border-top-color: white;
  border-radius: 50%;
  animation: spin .85s linear infinite;
}

.toast-wrap {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 9998;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.toast-card {
  min-width: 320px;
  max-width: 420px;
  background: rgba(15,23,42,.92);
  border: 1px solid rgba(99,102,241,.28);
  border-radius: 20px;
  box-shadow: var(--shadow);
  padding: 16px 18px;
  color: white;
  transform: translateY(20px);
  opacity: 0;
  pointer-events: none;
  transition: .35s ease;
}

html[data-theme="light"] .toast-card {
  background: rgba(255,255,255,.96);
  color: #0f172a;
  border-color: rgba(99,102,241,.16);
}

.toast-card.show {
  transform: translateY(0);
  opacity: 1;
  pointer-events: auto;
}

.toast-eyebrow {
  font-size: 12px;
  color: #c7d2fe;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .05em;
  margin-bottom: 8px;
}

html[data-theme="light"] .toast-eyebrow {
  color: #4338ca;
}

.toast-title {
  font-size: 18px;
  font-weight: 800;
  margin-bottom: 12px;
}

.toast-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.toast-link {
  border: none;
  border-radius: 12px;
  padding: 10px 14px;
  font-weight: 700;
  cursor: pointer;
}

.toast-link.primary {
  background: linear-gradient(135deg, var(--primary), var(--primary-2));
  color: white;
}

.toast-link.ghost {
  background: rgba(255,255,255,.08);
  color: white;
  border: 1px solid rgba(255,255,255,.12);
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(2,6,23,.72);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 10000;
  padding: 20px;
  backdrop-filter: blur(6px);
}

.modal-backdrop.show {
  display: flex;
}

.modal-card {
  width: 100%;
  max-width: 620px;
  background: linear-gradient(180deg, rgba(15,23,42,.98), rgba(17,24,39,.98));
  border: 1px solid rgba(255,255,255,.12);
  border-radius: 28px;
  box-shadow: var(--shadow);
  overflow: hidden;
}

html[data-theme="light"] .modal-card {
  background: linear-gradient(180deg, rgba(255,255,255,.98), rgba(248,250,252,.98));
}

.modal-head {
  padding: 22px 24px 16px;
  border-bottom: 1px solid rgba(255,255,255,.08);
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
}

.modal-title-wrap small {
  display: block;
  color: #c7d2fe;
  margin-bottom: 8px;
  font-weight: 700;
  letter-spacing: .05em;
  text-transform: uppercase;
}

.modal-title {
  margin: 0;
  font-size: 28px;
  font-weight: 800;
  letter-spacing: -.02em;
}

.modal-close {
  border: none;
  background: rgba(255,255,255,.08);
  color: white;
  width: 42px;
  height: 42px;
  border-radius: 14px;
  cursor: pointer;
  font-size: 18px;
  flex: 0 0 auto;
}

.modal-body {
  padding: 24px;
}

.modal-actions {
  margin-top: 24px;
  display: flex;
  justify-content: flex-end;
}

.footer-note {
  text-align: center;
  color: #94a3b8;
  font-size: 13px;
  margin-top: 20px;
}

.theme-toggle {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-radius: 16px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  font-weight: 700;
  backdrop-filter: blur(10px);
}

.theme-toggle:hover {
  transform: translateY(-1px);
}

.theme-toggle .icon {
  font-size: 16px;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

@media (max-width: 960px) {
  .hero-content {
    grid-template-columns: 1fr;
  }

  .hero {
    min-height: auto;
  }

  .hero-content {
    min-height: auto;
    padding: 24px;
  }

  .card-body {
    padding: 22px;
  }

  .toast-card {
    min-width: auto;
    width: calc(100vw - 40px);
  }
}