/* Login page: brand panel on the left, sign-in card with the drag-the-piece check on the right. */
:root {
  --ink: #142e2b;
  --muted: #5d6d69;
  --green: #086b5b;
  --green-dark: #074e44;
  --green-soft: #e3efe8;
  --line: #d8e3dc;
  --paper: #f6f8f5;
  --danger: #b4423a;
  color-scheme: light;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", "Noto Sans CJK SC", "Source Han Sans SC", sans-serif;
  color: var(--ink);
  background: var(--paper);
}
* { box-sizing: border-box; }
body { margin: 0; }
a { color: inherit; text-decoration: none; }
button, input { font: inherit; }
[hidden] { display: none !important; }
svg { fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

.auth { min-height: 100svh; display: grid; grid-template-columns: minmax(380px, 46%) 1fr; }

/* ---- brand panel ---- */
.auth-brand {
  position: relative; overflow: hidden; color: #eef6f1; padding: 44px 56px; display: flex; flex-direction: column;
  background:
    radial-gradient(circle at 18% 12%, #2a8a7455, transparent 42%),
    radial-gradient(circle at 92% 88%, #3aa38833, transparent 40%),
    linear-gradient(155deg, #12493f 0%, #0d3832 55%, #0a2a25 100%);
}
.auth-brand::before {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background-image: linear-gradient(#ffffff0c 1px, transparent 1px), linear-gradient(90deg, #ffffff0c 1px, transparent 1px);
  background-size: 34px 34px;
  mask-image: radial-gradient(ellipse at 40% 45%, #000 20%, transparent 75%);
}
.auth-brand > * { position: relative; }
.auth-logo { display: inline-flex; align-items: center; gap: 12px; font-weight: 700; font-size: 19px; letter-spacing: .2px; }
.auth-logo small { display: block; font-size: 13px; font-weight: 400; opacity: 1; letter-spacing: 1px; margin-top: 2px; }
.auth-logo-mark {
  display: grid; place-items: center; width: 40px; height: 40px; border-radius: 11px; font: 600 22px/1 Georgia, serif;
  background: linear-gradient(145deg, #18765f, #0b5a4c); box-shadow: inset 0 1px 0 #ffffff33, 0 6px 18px #0006; color: #fff;
}
.auth-brand-body { margin: auto 0; max-width: 470px; padding: 40px 0; }
.auth-kicker { font-size: 13px; letter-spacing: 1.5px; color: #d8ece1; margin: 0 0 18px; }
.auth-brand h2 { font-size: 34px; line-height: 1.45; font-weight: 650; letter-spacing: -.5px; margin: 0 0 26px; }
.auth-points { list-style: none; margin: 0 0 36px; padding: 0; display: grid; gap: 13px; }
.auth-points li { position: relative; padding-left: 30px; font-size: 14px; line-height: 1.7; color: #edf6ef; }
.auth-points li::before {
  content: "✓"; position: absolute; left: 0; top: 2px; width: 19px; height: 19px; border-radius: 50%;
  display: grid; place-items: center; font-size: 13px; color: #0d3832; background: #8fd6bb;
}
.auth-sample {
  margin: 0; padding: 18px 20px; border-radius: 16px; max-width: 400px;
  background: linear-gradient(160deg, #ffffff16, #ffffff08); border: 1px solid #ffffff22;
  box-shadow: 0 20px 40px #00000030; backdrop-filter: blur(6px); transform: rotate(-1.5deg);
}
.auth-sample figcaption { font-size: 13px; letter-spacing: 1px; color: #d8ece1; margin-bottom: 12px; }
.auth-sample-row { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.auth-matrix {
  display: grid; grid-template-columns: repeat(3, 18px); gap: 2px 6px; padding: 4px 9px; position: relative;
  font: italic 15px/1.35 Georgia, serif; text-align: center;
}
.auth-matrix::before, .auth-matrix::after {
  content: ""; position: absolute; top: 0; bottom: 0; width: 6px; border: 1.5px solid #e8f3ee; border-radius: 2px;
}
.auth-matrix::before { left: 0; border-right: 0; }
.auth-matrix::after { right: 0; border-left: 0; }
.auth-matrix i { font-style: italic; }
.auth-sample-eq { font: italic 18px Georgia, serif; }
.auth-sample-tag { font-size: 13px; padding: 3px 9px; border-radius: 999px; background: #8fd6bb10; color: #effff7; border: 1px solid #8fd6bb44; }
.auth-sample p { margin: 13px 0 0; font-size: 13px; color: #edf6ef; }
.auth-sample p b { font-weight: 600; color: #fff1c9; margin-right: 8px; }
.auth-foot { margin: 0; font-size: 13px; color: #d8ece1; display: flex; gap: 18px; }
.auth-foot a { color: #edf6ef; }
.auth-foot a:hover { color: #fff; }

/* ---- sign-in card ---- */
.auth-panel {
  position: relative; display: grid; place-items: center; padding: 40px 24px;
  background: radial-gradient(circle at 70% 10%, #e6f1ea, transparent 50%), var(--paper);
}
.auth-card {
  width: 100%; max-width: 420px; background: #fff; border: 1px solid #e3ebe5; border-radius: 22px;
  padding: 40px 40px 30px; box-shadow: 0 30px 60px -30px #0e3f3740, 0 2px 6px #0e3f370a;
}
.auth-card h1 { font-size: 27px; font-weight: 700; letter-spacing: -.3px; margin: 0 0 6px; }
.auth-intro { color: var(--muted); font-size: 14px; margin: 0 0 26px; }
.auth-form { display: grid; gap: 18px; }
.auth-field { display: grid; gap: 7px; }
.auth-label { font-size: 13px; font-weight: 600; color: #34504a; }
.auth-label--split { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.auth-label-note { font-size: 12px; font-weight: 400; color: var(--muted); }
.school-combo { position: relative; }
.school-suggest {
  position: absolute; left: 0; right: 0; top: calc(100% + 6px); z-index: 4; margin: 0; padding: 6px;
  list-style: none; border-radius: 12px; border: 1px solid #d5e2da; background: #fff;
  box-shadow: 0 18px 36px -14px #0e3f3745, 0 2px 6px #0e3f3712;
  max-height: 220px; overflow-y: auto;
}
.school-suggest-item {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  width: 100%; padding: 9px 11px; border: 0; border-radius: 8px; background: transparent;
  color: var(--ink); text-align: left; cursor: pointer; transition: background .12s;
}
.school-suggest-item:hover, .school-suggest-item.is-active { background: #edf6f1; }
.school-suggest-name { font-size: 14px; font-weight: 600; color: var(--ink); min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.school-suggest-code {
  flex: none; font-size: 12px; font-weight: 500; color: var(--green-dark);
  background: var(--green-soft); padding: 2px 8px; border-radius: 999px;
}
.school-match {
  display: flex; align-items: center; gap: 6px; flex-wrap: wrap;
  font-size: 12.5px; line-height: 1.5; padding: 2px 2px 0;
}
.school-match.is-ok { color: var(--green-dark); }
.school-match.is-ok .school-match-check {
  display: inline-grid; place-items: center; width: 16px; height: 16px; border-radius: 50%;
  background: var(--green-soft); color: var(--green); font-size: 11px; font-weight: 700; flex: none;
}
.school-match.is-ok .school-match-name { font-weight: 600; color: var(--ink); }
.school-match.is-ok .school-match-code { color: var(--muted); font-size: 12px; }
.school-match-trial {
  display: inline-flex; align-items: center; padding: 1px 8px; border-radius: 999px;
  font-size: 11.5px; font-weight: 600; color: #0b6554; background: #e1f3ec; border: 1px solid #b5dfd0;
}
.school-match.is-miss { color: #8c5a2b; }
.auth-input {
  display: flex; align-items: center; gap: 10px; height: 48px; padding: 0 14px; border-radius: 12px;
  border: 1px solid var(--line); background: #fbfcfb; transition: border-color .15s, box-shadow .15s, background .15s;
}
.auth-input:focus-within { border-color: #4f9c84; background: #fff; box-shadow: 0 0 0 4px #4f9c8422; }
.auth-input > svg { width: 19px; height: 19px; color: #5f6964; flex: none; }
.auth-input input { flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; color: var(--ink); font-size: 15px; height: 100%; }
.auth-input input::placeholder { color: #5f6964; }
.auth-eye { flex: none; border: 0; background: none; padding: 6px; margin-right: -6px; border-radius: 8px; color: #5f6964; cursor: pointer; display: grid; }
.auth-eye:hover { color: var(--green); background: var(--green-soft); }
.auth-eye svg { width: 19px; height: 19px; }
.auth-eye[aria-pressed="true"] .auth-eye-off { display: none; }

.auth-submit {
  margin-top: 6px; height: 50px; border: 0; border-radius: 13px; cursor: pointer; color: #fff; font-size: 16px; font-weight: 600;
  display: flex; align-items: center; justify-content: center; gap: 10px; letter-spacing: 2px;
  background: linear-gradient(135deg, #0d7a66, #075446); box-shadow: 0 12px 24px -12px #075446cc;
  transition: transform .15s, box-shadow .15s, filter .15s;
}
.auth-submit svg { width: 18px; height: 18px; stroke-width: 2.2; transition: transform .15s; }
.auth-submit:hover { filter: brightness(1.06); box-shadow: 0 16px 28px -12px #075446; }
.auth-submit:hover svg { transform: translateX(3px); }
.auth-submit:active { transform: translateY(1px); }
.auth-submit:disabled { cursor: wait; filter: saturate(.6) brightness(1.1); }
.auth-submit.is-busy span::after { content: "…"; }
.auth-secondary { height: 44px; border-radius: 12px; border: 1px solid var(--line); background: #fff; color: var(--ink); cursor: pointer; }
.auth-hint { margin: -6px 0 0; font-size: 13px; color: var(--muted); }
.auth-status { min-height: 22px; margin: 16px 0 0; font-size: 13.5px; line-height: 1.6; color: var(--danger); }
.auth-status:empty { margin: 0; min-height: 0; }
.auth-status.is-ok { color: var(--green); }
.auth-note { margin: 22px 0 0; padding-top: 18px; border-top: 1px solid #edf2ee; font-size: 13px; color: #5f6964; text-align: center; }

/* ---- drag-the-piece check ---- */
.slider { position: relative; }
.auth-field:has(.slider-pop:not([hidden])) > .auth-label { visibility: hidden; } /* the open puzzle sits over it */
.slider-track {
  position: relative; height: 48px; border-radius: 12px; border: 1px solid var(--line); background: #f2f6f3; overflow: hidden;
  user-select: none; -webkit-user-select: none; touch-action: none;
}
.slider-fill {
  position: absolute; inset: 0 auto 0 0; width: 0; border-radius: 12px 0 0 12px;
  background: linear-gradient(90deg, #d6ece2, #bfe2d3);
}
.slider-text {
  position: absolute; inset: 0; display: grid; place-items: center; padding-left: 48px; font-size: 13.5px; color: #5f6964;
  pointer-events: none; transition: opacity .2s;
  background: linear-gradient(90deg, #5f6964 0%, #5f6964 40%, #18765f 50%, #5f6964 60%, #5f6964 100%);
  background-size: 220% 100%; -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent;
  animation: slider-shine 2.8s linear infinite;
}
@keyframes slider-shine { from { background-position: 110% 0; } to { background-position: -110% 0; } }
.slider-handle {
  position: absolute; top: 0; left: 0; width: 48px; height: 46px; border: 0; border-radius: 11px; cursor: grab;
  background: #fff; color: var(--green); display: grid; place-items: center; touch-action: none;
  box-shadow: 0 1px 2px #0e3f3722, 0 4px 12px #0e3f3720;
}
.slider-handle svg { width: 20px; height: 20px; stroke-width: 2.2; }
.slider-handle:focus-visible { outline: 3px solid #4f9c8466; outline-offset: 2px; }
.slider-check { display: none; }
.slider.is-dragging .slider-handle { cursor: grabbing; background: var(--green); color: #fff; }
.slider.is-dragging .slider-text, .slider.is-checking .slider-text, .slider.is-fail .slider-text { opacity: 0; }
.slider.is-checking .slider-handle { background: var(--green); color: #fff; }
.slider.is-success .slider-track { border-color: #7cc3a8; }
.slider.is-success .slider-fill { width: 100% !important; background: linear-gradient(90deg, #d2ecdf, #b9e3cf); }
.slider.is-success .slider-text { animation: none; -webkit-text-fill-color: var(--green); color: var(--green); font-weight: 600; padding: 0 48px 0 0; }
.slider.is-success .slider-handle { background: var(--green); color: #fff; cursor: default; }
.slider.is-success .slider-arrow { display: none; }
.slider.is-success .slider-check { display: block; }
.slider.is-fail .slider-track { border-color: #e3a49e; animation: slider-shake .4s; }
.slider.is-fail .slider-fill { background: linear-gradient(90deg, #f6dcd9, #f0c6c1); }
.slider.is-fail .slider-handle { background: var(--danger); color: #fff; }
.slider.is-checking .slider-handle svg { animation: slider-pulse .7s ease-in-out infinite alternate; }
@keyframes slider-pulse { to { opacity: .35; } }
.slider.is-settling .slider-handle { transition: transform .3s ease; }
.slider.is-settling .slider-fill { transition: width .3s ease; }
.slider.is-settling .slider-piece { transition: left .3s ease; }
@keyframes slider-shake { 20%, 60% { transform: translateX(-5px); } 40%, 80% { transform: translateX(5px); } }

.slider-pop {
  position: absolute; left: 0; right: 0; bottom: calc(100% + 12px); z-index: 5; padding: 12px; border-radius: 16px;
  background: #fff; border: 1px solid #e1e9e4; box-shadow: 0 24px 50px -18px #0e3f3755, 0 4px 14px #0e3f3714;
  animation: slider-pop-in .18s ease-out;
}
.slider-pop::after {
  content: ""; position: absolute; left: 22px; bottom: -7px; width: 12px; height: 12px; background: #fff;
  border-right: 1px solid #e1e9e4; border-bottom: 1px solid #e1e9e4; transform: rotate(45deg);
}
.slider-pop::before { content: ""; position: absolute; left: 0; right: 0; bottom: -14px; height: 14px; } /* keeps hover across the gap */
@keyframes slider-pop-in { from { opacity: 0; transform: translateY(6px) scale(.98); } }
.slider-pop-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: 0 2px 10px; font-size: 13px; color: var(--muted); }
.slider-refresh { border: 0; background: none; padding: 5px; border-radius: 8px; color: #52665e; cursor: pointer; display: grid; }
.slider-refresh:hover { color: var(--green); background: var(--green-soft); }
.slider-refresh svg { width: 17px; height: 17px; }
.slider-stage { position: relative; aspect-ratio: 2 / 1; border-radius: 10px; overflow: hidden; background: #dfe9e3; user-select: none; }
.slider-stage > img:first-child { display: block; width: 100%; height: 100%; object-fit: cover; }
.slider-piece { position: absolute; left: 0; filter: drop-shadow(0 3px 5px #0008) drop-shadow(0 0 1px #fff); will-change: transform; }
.slider-loading { position: absolute; inset: 0; display: grid; place-items: center; font-size: 13px; color: #52665e; background: #e6eee9; }
.slider-result {
  position: absolute; left: 0; right: 0; bottom: 0; margin: 0; padding: 7px 12px; font-size: 13px; color: #fff;
  transform: translateY(100%); transition: transform .2s ease-out;
}
.slider-result.is-ok { background: #0b7a65e6; transform: none; }
.slider-result.is-bad { background: #b4423ae6; transform: none; }

/* ---- small screens: the brand panel becomes a header ---- */
@media (max-width: 900px) {
  .auth { grid-template-columns: 1fr; }
  .auth-brand { padding: 22px 24px 60px; }
  .auth-brand-body { margin: 20px 0 0; padding: 0; }
  .auth-brand h2 { font-size: 22px; margin: 0; }
  .auth-points, .auth-sample, .auth-foot { display: none; }
  .auth-kicker { margin-bottom: 8px; font-size: 13px; }
  .auth-panel { place-items: start center; padding: 0 16px 40px; background: var(--paper); }
  .auth-card { padding: 30px 24px 24px; border-radius: 18px; margin-top: -36px; }
}
@media (max-width: 380px) {
  .auth-card { padding: 26px 18px 20px; }
  .slider-pop { left: -6px; right: -6px; }
}
@media (prefers-reduced-motion: reduce) {
  .slider-text, .slider.is-fail .slider-track, .slider-pop { animation: none; }
  .slider-result, .auth-submit, .auth-submit svg { transition: none; }
}

small { font-size:13px; }

/* ---- first-time school provisioning progress overlay ---- */
.lp-mask {
  position: fixed; inset: 0; z-index: 60;
  display: grid; place-items: center; padding: 20px;
  background: rgba(10, 38, 33, .46);
  backdrop-filter: blur(7px); -webkit-backdrop-filter: blur(7px);
  animation: lp-fade .18s ease-out;
}
@keyframes lp-fade { from { opacity: 0; } to { opacity: 1; } }
.lp-card {
  width: min(470px, 100%);
  background: #fff; border: 1px solid #d7e5de; border-radius: 20px;
  padding: 26px 26px 22px;
  box-shadow: 0 28px 64px -18px rgba(7, 45, 38, .42), 0 4px 12px rgba(7, 45, 38, .1);
  display: grid; gap: 16px;
}
.lp-head { display: flex; align-items: center; gap: 13px; }
.lp-mark {
  flex: none; width: 42px; height: 42px; border-radius: 12px;
  display: grid; place-items: center; font: 700 22px/1 Georgia, serif; color: #fff;
  background: linear-gradient(145deg, #0f7b66, #084d41);
  box-shadow: 0 8px 18px -8px rgba(8, 77, 65, .6);
}
.lp-head-copy h2 { margin: 0; font-size: 18px; font-weight: 700; color: var(--ink); line-height: 1.35; }
.lp-head-copy p { margin: 3px 0 0; font-size: 13px; color: var(--muted); line-height: 1.5; }
.lp-bar-wrap { display: grid; gap: 6px; }
.lp-bar {
  height: 9px; border-radius: 999px; background: #e8f1ec; overflow: hidden;
  border: 1px solid #d5e5dd;
}
.lp-bar-fill {
  height: 100%; width: 10%; border-radius: 999px;
  background: linear-gradient(90deg, #0c7b67, #1ea386, #0c7b67);
  background-size: 200% 100%;
  transition: width .28s ease-out;
  animation: lp-shimmer 1.8s linear infinite;
}
@keyframes lp-shimmer { from { background-position: 0% 0; } to { background-position: 200% 0; } }
.lp-bar-meta {
  display: flex; justify-content: space-between; align-items: center;
  font-size: 12.5px; color: var(--muted); font-variant-numeric: tabular-nums;
}
.lp-bar-meta #lpPct { font-weight: 700; color: var(--green); }
.lp-steps {
  list-style: none; margin: 0; padding: 0; display: grid; gap: 9px;
}
.lp-steps li {
  display: flex; align-items: flex-start; gap: 9px;
  font-size: 13px; line-height: 1.5; color: #7a8a85;
  transition: color .2s;
}
.lp-dot {
  flex: none; width: 17px; height: 17px; margin-top: 2px; border-radius: 50%;
  border: 1.5px solid #cbd9d2; background: #f6faf8;
  display: grid; place-items: center; font-size: 11px; font-weight: 700;
}
.lp-steps li.is-active { color: var(--ink); font-weight: 600; }
.lp-steps li.is-active .lp-dot {
  border-color: var(--green); background: #e1f3ec;
  box-shadow: 0 0 0 3px rgba(8, 107, 91, .16);
}
.lp-steps li.is-active .lp-dot::after {
  content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--green);
}
.lp-steps li.is-done { color: #19594c; }
.lp-steps li.is-done .lp-dot { border-color: var(--green); background: var(--green); color: #fff; }
.lp-steps li.is-done .lp-dot::after { content: "✓"; }
.lp-demo-note {
  padding: 11px 13px; border-radius: 11px;
  background: #f2f8f5; border: 1px solid #cfe3da;
  font-size: 12.5px; line-height: 1.6; color: #2b4a43;
}
.lp-demo-note strong { color: #0a5849; }
