:root {
  font-family:
    Inter, "Microsoft YaHei", "PingFang SC", "Noto Sans SC", system-ui, sans-serif;
  color: #102033;
  background: #eaf4ff;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  min-height: 100vh;
  margin: 0;
  background:
    radial-gradient(circle at 12% 8%, rgba(59, 130, 246, 0.32), transparent 20rem),
    radial-gradient(circle at 86% 10%, rgba(14, 165, 233, 0.26), transparent 18rem),
    linear-gradient(135deg, #f8fbff 0%, #eaf4ff 46%, #dcecff 100%);
}

button {
  font: inherit;
}

.app {
  width: min(960px, calc(100% - 28px));
  margin: 0 auto;
  padding: 34px 0;
}

.top {
  margin-bottom: 18px;
  animation: enter-up 420ms ease both;
}

.eyebrow {
  margin: 0 0 8px;
  color: #0369a1;
  font-size: 13px;
  font-weight: 900;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 10px;
  color: #0f2f66;
  font-size: clamp(36px, 7vw, 62px);
  line-height: 1;
}

.subtitle {
  margin-bottom: 20px;
  color: #48627f;
  font-size: 18px;
}

.school-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.school-tab {
  min-width: 92px;
  border: 0;
  border-radius: 8px;
  padding: 12px 18px;
  background: #ffffff;
  color: #16407d;
  box-shadow: inset 0 0 0 2px rgba(37, 99, 235, 0.16);
  cursor: pointer;
  font-weight: 900;
  transition:
    transform 160ms ease,
    box-shadow 160ms ease,
    background 160ms ease;
}

.school-tab:hover {
  transform: translateY(-1px);
  box-shadow: inset 0 0 0 2px rgba(37, 99, 235, 0.35);
}

.school-tab.active {
  background: linear-gradient(135deg, #1d4ed8, #0284c7);
  color: #ffffff;
  box-shadow: 0 14px 28px rgba(37, 99, 235, 0.24);
}

.result-card {
  border: 2px solid rgba(37, 99, 235, 0.12);
  border-radius: 8px;
  padding: 22px;
  background: rgba(255, 255, 255, 0.88);
  box-shadow: 0 24px 70px rgba(30, 64, 175, 0.16);
  animation: enter-up 520ms ease 80ms both;
}

.result-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

h2 {
  margin-bottom: 0;
  color: #0f2f66;
  font-size: 28px;
}

.source-badge {
  border-radius: 999px;
  padding: 9px 13px;
  background: #dbeafe;
  color: #1d4ed8;
  font-size: 13px;
  font-weight: 900;
  white-space: nowrap;
}

.progress-block {
  display: grid;
  grid-template-columns: 132px minmax(0, 1fr);
  gap: 18px;
  align-items: center;
  margin-bottom: 18px;
  border-radius: 8px;
  padding: 16px;
  background: linear-gradient(135deg, #eff6ff, #f8fbff);
}

.progress-ring {
  width: 112px;
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background:
    radial-gradient(circle, #ffffff 57%, transparent 58%),
    conic-gradient(#2563eb var(--progress), rgba(148, 163, 184, 0.25) 0);
  transition: background 320ms ease;
}

.progress-ring span {
  color: #0f2f66;
  font-size: 26px;
  font-weight: 950;
}

.progress-block strong {
  display: block;
  margin-bottom: 6px;
  color: #102033;
  font-size: 20px;
}

.progress-block p {
  margin-bottom: 0;
  color: #5b708a;
}

.loading {
  min-height: 260px;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 16px;
  color: #1d4ed8;
  font-size: 18px;
  font-weight: 900;
}

.spinner {
  width: 66px;
  aspect-ratio: 1;
  border: 7px solid rgba(37, 99, 235, 0.16);
  border-top-color: #1d4ed8;
  border-right-color: #0ea5e9;
  border-radius: 50%;
  animation: spin 0.85s linear infinite;
}

.celebration {
  position: relative;
  margin-bottom: 14px;
  border-radius: 8px;
  padding: 16px;
  overflow: hidden;
  background: linear-gradient(135deg, #dbeafe, #bfdbfe);
  color: #0f2f66;
  text-align: center;
  font-size: 20px;
  font-weight: 950;
  animation: pop 260ms ease;
}

.confetti {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.confetti span {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 9px;
  aspect-ratio: 1;
  border-radius: 2px;
  background: #2563eb;
  animation: confetti 900ms ease-out infinite;
}

.confetti span:nth-child(2) {
  background: #0ea5e9;
  animation-delay: 80ms;
}

.confetti span:nth-child(3) {
  background: #22c55e;
  animation-delay: 160ms;
}

.confetti span:nth-child(4) {
  background: #f97316;
  animation-delay: 240ms;
}

.confetti span:nth-child(5) {
  background: #ef4444;
  animation-delay: 320ms;
}

.confetti span:nth-child(6) {
  background: #38bdf8;
  animation-delay: 400ms;
}

.materials {
  display: grid;
  gap: 12px;
}

.material-row {
  width: 100%;
  min-height: 86px;
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr) 156px;
  gap: 14px;
  align-items: center;
  border: 1px solid rgba(37, 99, 235, 0.14);
  border-radius: 8px;
  padding: 16px;
  background: #ffffff;
  color: inherit;
  text-align: left;
  cursor: pointer;
  animation: enter-up 360ms ease both;
  transition:
    transform 160ms ease,
    border-color 160ms ease,
    background 160ms ease,
    box-shadow 160ms ease;
}

.material-row:nth-child(2) {
  animation-delay: 40ms;
}

.material-row:nth-child(3) {
  animation-delay: 80ms;
}

.material-row:nth-child(4) {
  animation-delay: 120ms;
}

.material-row:nth-child(5) {
  animation-delay: 160ms;
}

.material-row:hover {
  border-color: rgba(37, 99, 235, 0.38);
  box-shadow: 0 12px 28px rgba(37, 99, 235, 0.1);
  transform: translateY(-1px);
}

.material-row.done {
  border-color: rgba(34, 197, 94, 0.55);
  background: #f0fdf4;
  animation: tick 240ms ease;
}

.check-box {
  width: 28px;
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  border: 2px solid #60a5fa;
  border-radius: 7px;
  background: #eff6ff;
  color: #ffffff;
  font-weight: 950;
  transition:
    background 160ms ease,
    border-color 160ms ease,
    transform 160ms ease;
}

.check-box::after {
  content: "";
}

.done .check-box {
  border-color: #22c55e;
  background: #22c55e;
  transform: scale(1.04);
}

.done .check-box::after {
  content: "✓";
}

.material-main {
  min-width: 0;
  display: grid;
  gap: 6px;
}

.material-main strong {
  color: #102033;
  font-size: 18px;
  overflow-wrap: anywhere;
}

.material-main small {
  color: #526985;
  font-size: 14px;
  line-height: 1.55;
  overflow-wrap: anywhere;
}

.done .material-main > strong,
.done .material-main > small:not(.verified-date) {
  text-decoration: line-through;
  text-decoration-thickness: 2px;
  text-decoration-color: rgba(22, 163, 74, 0.6);
}

.school-search { margin-top: 20px; }
.school-search label { display: block; margin-bottom: 8px; color: #16407d; font-weight: 700; }
.search-controls { display: flex; gap: 10px; }
.search-controls input { flex: 1; min-width: 0; border: 1px solid #93baf0; border-radius: 8px; padding: 12px; font: inherit; color: #102033; background: white; }
button:disabled { opacity: .6; cursor: wait; }
button:focus-visible, input:focus-visible, a:focus-visible { outline: 3px solid #0284c7; outline-offset: 3px; }
.query-notice { color: #526985; line-height: 1.6; padding: 12px; border-radius: 8px; background: #eff6ff; }
.source-link { justify-self: start; color: #0369a1; font-size: 13px; }
.material-main .verified-date { font-size: 12px; color: #64748b; }
.check-box { cursor: pointer; padding: 0; }
h2 { overflow-wrap: anywhere; }
.result-head > div { min-width: 0; }
.source-badge { white-space: normal; }
@media (max-width: 420px) {
  .search-controls { flex-direction: column; }
  .search-controls input { width: 100%; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

.deadline-badge {
  min-width: 136px;
  display: grid;
  gap: 3px;
  justify-items: center;
  border-radius: 8px;
  padding: 10px 12px;
  text-align: center;
  white-space: nowrap;
}

.deadline-badge strong {
  font-size: 14px;
  font-weight: 950;
}

.deadline-badge small {
  font-size: 11px;
  font-weight: 800;
  opacity: 0.78;
}

.deadline-badge.normal {
  background: #e0f2fe;
  color: #075985;
}

.deadline-badge.unknown {
  background: #f1f5f9;
  color: #475569;
}

.deadline-badge.warning {
  background: #ffedd5;
  color: #c2410c;
  animation: soft-alert 1.6s ease-in-out infinite;
}

.deadline-badge.danger {
  background: #fee2e2;
  color: #b91c1c;
  animation: urgent-alert 1.1s ease-in-out infinite;
}

.empty {
  border-radius: 8px;
  padding: 24px;
  background: #eff6ff;
  color: #1d4ed8;
  text-align: center;
  font-weight: 900;
}

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

@keyframes tick {
  45% {
    transform: scale(1.015);
  }
}

@keyframes enter-up {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
}

@keyframes pop {
  from {
    opacity: 0;
    transform: translateY(8px) scale(0.98);
  }
}

@keyframes soft-alert {
  50% {
    box-shadow: 0 0 0 4px rgba(249, 115, 22, 0.12);
  }
}

@keyframes urgent-alert {
  50% {
    transform: scale(1.035);
    box-shadow: 0 0 0 5px rgba(239, 68, 68, 0.14);
  }
}

@keyframes confetti {
  0% {
    opacity: 1;
    transform: rotate(0deg) translate(0, 0);
  }
  100% {
    opacity: 0;
    transform: rotate(220deg) translate(calc((var(--x, 1) * 68px)), calc((var(--y, 1) * 32px)));
  }
}

.confetti span:nth-child(1) {
  --x: -1.2;
  --y: -1.1;
}

.confetti span:nth-child(2) {
  --x: -0.4;
  --y: 1.2;
}

.confetti span:nth-child(3) {
  --x: 0.7;
  --y: -1.3;
}

.confetti span:nth-child(4) {
  --x: 1.2;
  --y: 1.1;
}

.confetti span:nth-child(5) {
  --x: -0.8;
  --y: 0.4;
}

.confetti span:nth-child(6) {
  --x: 0.3;
  --y: -0.6;
}

@media (max-width: 640px) {
  .app {
    width: min(100% - 20px, 520px);
    padding: 22px 0;
  }

  .result-card {
    padding: 18px;
  }

  .result-head,
  .progress-block {
    grid-template-columns: 1fr;
  }

  .result-head {
    display: grid;
  }

  .source-badge {
    justify-self: start;
  }

  .progress-ring {
    width: 104px;
  }

  .material-row {
    grid-template-columns: 34px minmax(0, 1fr);
    align-items: start;
  }

  .deadline-badge {
    grid-column: 2;
    justify-self: start;
    min-width: 0;
    white-space: normal;
  }
}
