:root {
  --night: #080b1f;
  --night-deep: #050713;
  --panel: #11162f;
  --panel-raised: #171d3b;
  --panel-soft: #1d2447;
  --paper: #f5f7ff;
  --muted: #aab1c7;
  --muted-strong: #d0d5e6;
  --line: rgba(200, 208, 255, 0.16);
  --line-strong: rgba(200, 208, 255, 0.3);
  --accent: #8c94ff;
  --accent-bright: #b9beff;
  --accent-soft: rgba(140, 148, 255, 0.13);
  --rose: #ff7f96;
  --mint: #6ad6a0;
  --amber: #f1bd67;
  --display: "Avenir Next", Avenir, "PingFang SC", "Microsoft YaHei", "Segoe UI", Helvetica, Arial, sans-serif;
  --body: Inter, "Avenir Next", Avenir, "PingFang SC", "Microsoft YaHei", "Segoe UI", Helvetica, Arial, sans-serif;
  --mono: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  --content-width: 1180px;
  --radius: 18px;
  --radius-small: 11px;
  --shadow: 0 28px 80px rgba(1, 4, 18, 0.36);
}

* {
  box-sizing: border-box;
}

html {
  background: var(--night);
  scroll-behavior: smooth;
}

body {
  min-width: 320px;
  margin: 0;
  background:
    radial-gradient(circle at 78% 7%, rgba(85, 98, 218, 0.19), transparent 30rem),
    linear-gradient(180deg, var(--night), #0b0f25 64%, var(--night-deep));
  color: var(--paper);
  font-family: var(--body);
  font-size: 16px;
  font-weight: 400;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

body::before {
  position: fixed;
  inset: 0;
  z-index: -1;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.017) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.017) 1px, transparent 1px);
  background-size: 72px 72px;
  mask-image: linear-gradient(to bottom, black, transparent 72%);
  content: "";
  pointer-events: none;
}

h1,
h2,
h3 {
  font-weight: 700;
}

button,
input,
select,
textarea {
  font: inherit;
}

button,
select {
  cursor: pointer;
}

a {
  color: inherit;
}

a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 3px solid var(--accent-bright);
  outline-offset: 3px;
}

.skip-link {
  position: fixed;
  top: 12px;
  left: 12px;
  z-index: 100;
  padding: 10px 14px;
  border-radius: 8px;
  background: var(--paper);
  color: var(--night);
  transform: translateY(-160%);
  transition: transform 160ms ease;
}

.skip-link:focus {
  transform: translateY(0);
}

.review-header {
  position: sticky;
  top: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 72px;
  padding: 14px max(24px, calc((100vw - var(--content-width)) / 2));
  border-bottom: 1px solid var(--line);
  background: rgba(8, 11, 31, 0.88);
  backdrop-filter: blur(18px);
}

.review-brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
}

.brand-mark {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border: 1px solid var(--line-strong);
  border-radius: 50%;
  background: var(--panel);
  color: var(--accent-bright);
  font: 400 12px var(--mono);
  letter-spacing: 0.08em;
}

.review-header nav {
  display: flex;
  align-items: center;
  gap: 24px;
  color: var(--muted-strong);
  font-size: 14px;
}

.review-header nav a {
  text-decoration: none;
  transition: color 160ms ease, border-color 160ms ease, background-color 160ms ease, transform 160ms ease;
}

.review-header nav a:hover {
  color: var(--paper);
}

.review-header .language-switch {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: rgba(140, 148, 255, 0.07);
  color: var(--paper);
  line-height: 1;
}

.review-header .language-switch::before {
  width: 15px;
  height: 15px;
  flex: 0 0 15px;
  background: currentColor;
  content: "";
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.8' stroke-linecap='round'%3E%3Ccircle cx='12' cy='12' r='9'/%3E%3Cpath d='M3 12h18M12 3c2.8 2.7 4.2 5.7 4.2 9s-1.4 6.3-4.2 9M12 3C9.2 5.7 7.8 8.7 7.8 12s1.4 6.3 4.2 9'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.8' stroke-linecap='round'%3E%3Ccircle cx='12' cy='12' r='9'/%3E%3Cpath d='M3 12h18M12 3c2.8 2.7 4.2 5.7 4.2 9s-1.4 6.3-4.2 9M12 3C9.2 5.7 7.8 8.7 7.8 12s1.4 6.3 4.2 9'/%3E%3C/svg%3E") center / contain no-repeat;
}

.review-header .language-switch:hover {
  border-color: var(--accent-bright);
  background: var(--accent-soft);
  color: var(--paper);
  transform: translateY(-1px);
}

.portfolio-link {
  padding: 8px 17px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
}

.portfolio-link:hover {
  border-color: var(--accent-bright);
}

.review-hero,
.stats-ledger,
.review-browser,
.review-footer {
  width: min(calc(100% - 48px), var(--content-width));
  margin-right: auto;
  margin-left: auto;
}

.review-hero {
  padding: 104px 0 78px;
  animation: enter 540ms both cubic-bezier(0.2, 0.75, 0.25, 1);
}

.eyebrow,
.section-label,
.stat-label,
.course-semester,
.course-status,
.controls-panel label > span:first-child {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.eyebrow,
.section-label {
  margin: 0;
  color: var(--accent-bright);
}

.review-hero h1 {
  margin: 18px 0 24px;
  font-size: clamp(58px, 9vw, 108px);
  letter-spacing: -0.065em;
  line-height: 0.92;
}

.review-hero > p:last-child {
  max-width: 760px;
  margin: 0;
  color: var(--muted-strong);
  font-size: clamp(18px, 2vw, 21px);
}

.stats-ledger {
  display: grid;
  grid-template-columns: repeat(4, 1fr) 1.35fr;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  background: rgba(17, 22, 47, 0.72);
  box-shadow: var(--shadow);
}

.stats-ledger > div {
  display: flex;
  min-height: 112px;
  flex-direction: column;
  justify-content: space-between;
  padding: 22px;
}

.stats-ledger > div + div {
  border-left: 1px solid var(--line);
}

.stat-label {
  color: var(--muted);
  font-size: 9px;
}

.stat-value {
  font-size: clamp(24px, 3vw, 34px);
  letter-spacing: -0.04em;
}

.progress-cell {
  gap: 20px;
}

.progress-track {
  height: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
}

.progress-track span {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--accent), var(--accent-bright));
  transition: width 240ms ease;
}

.review-browser {
  padding: 106px 0;
}

.section-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 30px;
  margin-bottom: 38px;
}

.section-heading h2 {
  margin: 10px 0 0;
  font-size: clamp(38px, 5vw, 62px);
  letter-spacing: -0.05em;
  line-height: 1.02;
}

.result-count {
  margin: 0 0 7px;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 11px;
}

.controls-panel {
  display: grid;
  grid-template-columns: minmax(280px, 1.5fr) repeat(3, minmax(150px, 0.75fr));
  gap: 1px;
  margin-bottom: 30px;
  border: 1px solid var(--line);
  border-radius: var(--radius-small);
  overflow: hidden;
  background: var(--line);
}

.controls-panel label {
  display: grid;
  gap: 10px;
  padding: 16px 18px;
  background: rgba(17, 22, 47, 0.96);
}

.controls-panel label > span:first-child {
  color: var(--muted);
  font-size: 9px;
}

.controls-panel input,
.controls-panel select {
  width: 100%;
  min-width: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  appearance: none;
  background: transparent;
  color: var(--paper);
  outline: 0;
}

.controls-panel select {
  padding-right: 22px;
  background-image:
    linear-gradient(45deg, transparent 50%, var(--muted) 50%),
    linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 11px) 9px, calc(100% - 6px) 9px;
  background-repeat: no-repeat;
  background-size: 5px 5px;
}

.controls-panel input::placeholder {
  color: #717991;
}

.course-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.course-card {
  position: relative;
  display: flex;
  min-height: 315px;
  flex-direction: column;
  padding: 28px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(17, 22, 47, 0.74);
  transition: transform 170ms ease, border-color 170ms ease, background 170ms ease;
}

.course-card::before {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  width: 3px;
  background: var(--course-color, var(--accent));
  content: "";
}

.course-card:hover {
  transform: translateY(-3px);
  border-color: var(--line-strong);
  background: var(--panel-raised);
}

.course-card[data-subject="ASIAN"] { --course-color: #ff8fa3; }
.course-card[data-subject="CS"] { --course-color: #8c94ff; }
.course-card[data-subject="ED POL"] { --course-color: #6ad6a0; }
.course-card[data-subject="MATH"] { --course-color: #f1bd67; }
.course-card[data-subject="CS/MATH"] { --course-color: #a88cff; }
.course-card[data-subject="ESL"] { --course-color: #6bc9e8; }
.course-card[data-subject="MUSIC"] { --course-color: #e39cff; }

.course-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}

.course-semester {
  margin: 0;
  color: var(--muted);
  font-size: 9px;
}

.course-status {
  padding: 6px 9px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  font-size: 8px;
}

.course-card.reviewed .course-status {
  border-color: rgba(106, 214, 160, 0.38);
  background: rgba(106, 214, 160, 0.09);
  color: var(--mint);
}

.course-code {
  margin: 52px 0 8px;
  font-size: clamp(32px, 4vw, 48px);
  letter-spacing: -0.05em;
  line-height: 1;
}

.subject-name {
  margin: 0;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.pending-copy {
  margin: auto 0 24px;
  padding-top: 40px;
  color: var(--muted);
}

.review-data {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 1px;
  margin: 30px 0 22px;
  border: 1px solid var(--line);
  border-radius: 9px;
  overflow: hidden;
  background: var(--line);
}

.review-data div {
  min-width: 0;
  padding: 13px;
  background: rgba(8, 11, 31, 0.72);
}

.review-data dt,
.review-data dd {
  margin: 0;
}

.review-data dt {
  margin-bottom: 5px;
  color: var(--muted);
  font: 400 8px var(--mono);
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

.review-data dd {
  color: var(--paper);
  font-size: 13px;
  overflow-wrap: anywhere;
}

.difficulty-dots {
  display: flex;
  gap: 4px;
  margin-top: 6px;
}

.difficulty-dots i {
  width: 7px;
  height: 7px;
  border: 1px solid var(--line-strong);
  border-radius: 50%;
}

.difficulty-dots i.filled {
  border-color: var(--course-color, var(--accent));
  background: var(--course-color, var(--accent));
}

.review-feedback {
  margin: 0 0 24px;
  color: var(--muted-strong);
  font-size: 14px;
  white-space: pre-wrap;
}

.review-feedback.no-metadata {
  margin-top: 30px;
}

.review-link {
  align-self: flex-start;
  color: var(--accent-bright);
  font-size: 14px;
  text-decoration-color: rgba(185, 190, 255, 0.48);
  text-underline-offset: 4px;
}

.review-link:hover {
  color: var(--paper);
  text-decoration-color: var(--accent-bright);
}

.secondary-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 9px 16px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: transparent;
  color: var(--paper);
  font-weight: 400;
  text-decoration: none;
}

.secondary-button:hover {
  border-color: var(--accent-bright);
  background: var(--accent-soft);
}

.empty-state {
  padding: 68px 24px;
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius);
  text-align: center;
}

.empty-state h3,
.empty-state p {
  margin-top: 0;
}

.empty-state p {
  color: var(--muted);
}

.empty-state .secondary-button {
  margin-top: 8px;
}

.review-footer {
  display: flex;
  justify-content: space-between;
  gap: 30px;
  padding: 30px 0 38px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font: 400 11px var(--mono);
}

.review-footer p {
  margin: 0;
}

.review-footer a {
  text-decoration-color: var(--accent);
  text-underline-offset: 4px;
}

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

@media (max-width: 980px) {
  .stats-ledger {
    grid-template-columns: repeat(2, 1fr);
  }

  .stats-ledger > div + div {
    border-left: 0;
  }

  .stats-ledger > div:nth-child(even) {
    border-left: 1px solid var(--line);
  }

  .stats-ledger > div:nth-child(n + 3) {
    border-top: 1px solid var(--line);
  }

  .stats-ledger .progress-cell {
    grid-column: 1 / -1;
  }

  .controls-panel {
    grid-template-columns: repeat(2, 1fr);
  }

}

@media (max-width: 720px) {
  .review-header {
    padding-right: 18px;
    padding-left: 18px;
  }

  .review-header nav {
    gap: 10px;
  }

  .review-header nav > a:first-child {
    display: none;
  }

  .review-brand > span:last-child {
    display: none;
  }

  .review-hero,
  .stats-ledger,
  .review-browser,
  .review-footer {
    width: min(calc(100% - 30px), var(--content-width));
  }

  .review-hero {
    padding: 70px 0 58px;
  }

  .review-hero h1 {
    font-size: clamp(52px, 15vw, 74px);
  }

  .review-browser {
    padding: 76px 0;
  }

  .section-heading {
    align-items: flex-start;
    flex-direction: column;
    gap: 14px;
  }

  .controls-panel,
  .course-grid {
    grid-template-columns: 1fr;
  }

  .course-card {
    min-height: 300px;
    padding: 24px;
  }

  .course-code {
    margin-top: 40px;
  }

  .review-data {
    grid-template-columns: 1fr;
  }

  .review-data div + div {
    border-top: 1px solid var(--line);
  }

  .review-footer {
    flex-direction: column;
  }
}

@media (max-width: 480px) {
  .stats-ledger {
    grid-template-columns: 1fr;
  }

  .stats-ledger > div:nth-child(even) {
    border-left: 0;
  }

  .stats-ledger > div + div {
    border-top: 1px solid var(--line);
  }

  .stats-ledger .progress-cell {
    grid-column: auto;
  }
}

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