:root {
  --blue-900: #3852a2;
  --blue-600: #0296da;
  --blue-300: #40b8e9;
  --ink: #172033;
  --ink-soft: #536078;
  --paper: #fbfcff;
  --surface: #ffffff;
  --surface-soft: #f4f8fc;
  --line: #dce6f1;
  --line-strong: #c8d8ea;
  --success: #2d8a64;
  --warning: #a66f00;
  --danger: #b33a3a;
  --shadow: 0 18px 50px rgba(56, 82, 162, 0.08);
  --radius: 18px;
  --radius-sm: 12px;
  --max: 1120px;
  --font-body: "Instrument Sans", ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-display: "Source Serif 4", Georgia, serif;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at 20% 0%, rgba(64, 184, 233, 0.12), transparent 34rem),
    linear-gradient(180deg, #fbfdff 0%, #f7faff 54%, #ffffff 100%);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 15.8px;
  line-height: 1.66;
  text-rendering: optimizeLegibility;
}

a {
  color: inherit;
  text-decoration: none;
}

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

button {
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.68;
}

.wrap {
  width: min(var(--max), calc(100% - 40px));
  margin: 0 auto;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  border-bottom: 1px solid rgba(220, 230, 241, 0.9);
  background: rgba(255, 255, 255, 0.86);
  backdrop-filter: blur(18px);
}

.nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 86px;
  gap: 28px;
}

.brand {
  display: inline-flex;
  align-items: center;
}

.brand img {
  display: block;
  width: 172px;
  height: auto;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 10px;
}

.nav-links a,
.nav-links button {
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--ink-soft);
  padding: 10px 14px;
  font-size: 0.94rem;
  font-weight: 650;
  transition: color 160ms ease, background 160ms ease;
}

.nav-links a:hover,
.nav-links button:hover,
.nav-links a[aria-current="page"] {
  background: rgba(2, 150, 218, 0.08);
  color: var(--blue-900);
}

.nav-toggle {
  display: none;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  color: var(--ink);
  padding: 9px 12px;
}

.hero {
  padding: 66px 0 44px;
}

.hero-copy {
  max-width: none;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 18px;
  color: var(--blue-900);
  font-size: 0.78rem;
  font-weight: 780;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.eyebrow::before {
  content: "";
  width: 28px;
  height: 2px;
  border-radius: 999px;
  background: var(--blue-600);
}

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

h1 {
  max-width: 720px;
  margin-bottom: 18px;
  font-family: var(--font-display);
  font-size: clamp(2.15rem, 4.5vw, 4.15rem);
  font-weight: 650;
  line-height: 1.08;
  letter-spacing: -0.028em;
}

h2 {
  margin-bottom: 14px;
  font-family: var(--font-display);
  font-size: clamp(1.45rem, 2.2vw, 2.25rem);
  font-weight: 650;
  line-height: 1.14;
  letter-spacing: -0.018em;
}

h3 {
  margin-bottom: 8px;
  font-size: 1.15rem;
  line-height: 1.25;
  letter-spacing: -0.015em;
}

.lead {
  max-width: 690px;
  color: var(--ink-soft);
  font-size: clamp(1rem, 1.2vw, 1.12rem);
  line-height: 1.72;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 30px;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 46px;
  border: 1px solid transparent;
  border-radius: 999px;
  padding: 0 20px;
  background: var(--blue-900);
  color: #fff;
  font-weight: 720;
  transition: transform 160ms ease, box-shadow 160ms ease, background 160ms ease;
}

.button:hover {
  transform: translateY(-1px);
  box-shadow: 0 10px 28px rgba(56, 82, 162, 0.18);
}

.button.secondary {
  border-color: var(--line-strong);
  background: rgba(255, 255, 255, 0.78);
  color: var(--blue-900);
  box-shadow: none;
}

.button.danger {
  border-color: rgba(179, 58, 58, 0.28);
  background: rgba(179, 58, 58, 0.08);
  color: var(--danger);
  box-shadow: none;
}

.card,
.table-shell,
.form-shell {
  border: 1px solid rgba(220, 230, 241, 0.95);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.88);
  box-shadow: var(--shadow);
}

.about-section {
  padding-top: 26px;
}

.about-grid {
  display: grid;
  gap: 22px;
  align-items: start;
}

.about-copy {
  max-width: 760px;
  color: var(--ink-soft);
  font-size: 1.02rem;
}

.about-copy p {
  margin-bottom: 0;
}

.about-facts {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 8px;
}

.about-facts span {
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.7);
  color: var(--blue-900);
  padding: 7px 12px;
  font-size: 0.86rem;
  font-weight: 650;
}

.portal-card {
  display: grid;
  gap: 16px;
  padding: 26px;
  transition: transform 160ms ease, border-color 160ms ease, box-shadow 160ms ease;
}

.portal-card:hover {
  transform: translateY(-2px);
  border-color: rgba(2, 150, 218, 0.35);
  box-shadow: 0 20px 54px rgba(56, 82, 162, 0.12);
}

.icon-box {
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  border-radius: 14px;
  background: rgba(2, 150, 218, 0.09);
  color: var(--blue-900);
  font-weight: 800;
}

.grid-2,
.grid-3,
.metrics {
  display: grid;
  gap: 18px;
}

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

.grid-3 {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.metrics {
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  margin-bottom: 22px;
}

.metric {
  padding: 20px;
}

.metric small,
.muted,
.field-hint {
  color: var(--ink-soft);
}

.metric strong {
  display: block;
  margin-top: 5px;
  overflow: hidden;
  font-size: 1.45rem;
  line-height: 1.15;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.stats-visual {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(300px, 0.8fr);
  gap: 18px;
  align-items: start;
}

.stats-panel {
  padding: 22px;
}

.compact-head {
  margin-bottom: 18px;
}

.ladder-list,
.improver-list {
  display: grid;
  gap: 12px;
}

.ladder-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 14px;
  align-items: center;
}

.rank-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 42px;
  border-radius: 999px;
  background: rgba(56, 82, 162, 0.08);
  color: var(--blue-900);
  padding: 6px 10px;
  font-weight: 700;
}

.progress-track {
  height: 8px;
  margin-top: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--surface-soft);
}

.progress-track span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--blue-900), var(--blue-600));
}

.score-text {
  color: var(--blue-900);
  font-weight: 700;
}

.improver-row {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
}

.improver-row:last-child {
  border-bottom: 0;
}

.positive-change {
  color: var(--success);
  font-weight: 700;
}

.negative-change {
  color: var(--danger);
  font-weight: 700;
}

.section {
  padding: 56px 0;
}

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

.controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
}

.filter-controls {
  align-items: end;
}

.control-field {
  display: grid;
  gap: 7px;
}

.control-field label {
  margin: 0;
}

.control-field select {
  min-width: 150px;
}

.tabs {
  display: inline-flex;
  gap: 4px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface-soft);
}

.tab {
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--ink-soft);
  padding: 9px 15px;
  font-weight: 720;
}

.tab.active {
  background: var(--surface);
  color: var(--blue-900);
  box-shadow: 0 8px 20px rgba(56, 82, 162, 0.08);
}

select,
input,
textarea {
  width: 100%;
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  background: #fff;
  color: var(--ink);
  padding: 12px 13px;
  outline: none;
  transition: border-color 160ms ease, box-shadow 160ms ease;
}

select:focus,
input:focus,
textarea:focus {
  border-color: var(--blue-600);
  box-shadow: 0 0 0 4px rgba(2, 150, 218, 0.12);
}

label {
  display: block;
  margin-bottom: 7px;
  color: var(--ink);
  font-size: 0.88rem;
  font-weight: 720;
}

.table-shell {
  overflow: hidden;
}

.result-test {
  display: block;
}

.result-summary,
.record-summary {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: start;
  padding: 18px;
  border-bottom: 1px solid var(--line);
  cursor: pointer;
  list-style: none;
}

.result-summary::-webkit-details-marker,
.record-summary::-webkit-details-marker {
  display: none;
}

.result-summary h3 {
  margin-bottom: 4px;
}

.record-summary {
  border-bottom: 0;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th,
td {
  border-bottom: 1px solid var(--line);
  padding: 15px 18px;
  text-align: left;
  vertical-align: top;
}

th {
  background: var(--surface-soft);
  color: var(--ink-soft);
  font-size: 0.78rem;
  font-weight: 780;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

tr:last-child td {
  border-bottom: 0;
}

.badge {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  background: rgba(56, 82, 162, 0.08);
  color: var(--blue-900);
  padding: 4px 10px;
  font-size: 0.78rem;
  font-weight: 780;
}

.muted-badge {
  background: rgba(83, 96, 120, 0.1);
  color: var(--ink-soft);
}

.resource-group {
  margin-bottom: 28px;
}

.resource-list {
  display: grid;
  gap: 12px;
}

.resource-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 18px;
  align-items: center;
  padding: 18px;
}

.empty,
.notice {
  padding: 26px;
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.72);
  color: var(--ink-soft);
  text-align: center;
}

.notice.success {
  border-color: rgba(45, 138, 100, 0.28);
  background: rgba(45, 138, 100, 0.08);
  color: var(--success);
}

.notice.error {
  border-color: rgba(179, 58, 58, 0.28);
  background: rgba(179, 58, 58, 0.08);
  color: var(--danger);
}

.form-shell {
  padding: 24px;
}

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

.form-grid .wide {
  grid-column: 1 / -1;
}

.marks-list {
  display: grid;
  gap: 10px;
}

.marks-row {
  display: grid;
  grid-template-columns: minmax(160px, 1fr) auto minmax(90px, 120px);
  gap: 10px;
  align-items: center;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.62);
}

.marks-row strong {
  font-weight: 650;
}

.inline-check {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  margin: 0;
  color: var(--ink-soft);
  white-space: nowrap;
}

.inline-check input {
  width: auto;
}

.record-list,
.roster-list {
  display: grid;
  gap: 10px;
  margin-top: 18px;
}

.record-editor {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.62);
  overflow: hidden;
}

.record-editor[open] .record-summary {
  border-bottom: 1px solid var(--line);
}

.record-editor .record-row,
.record-editor .test-edit-marks {
  margin: 10px;
}

.record-row,
.roster-row {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) auto auto;
  gap: 10px;
  align-items: center;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.62);
}

.record-row {
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  align-items: end;
}

.question-row {
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
}

.record-row .button {
  min-height: 44px;
  white-space: nowrap;
}

.admin-layout {
  display: grid;
  grid-template-columns: 260px 1fr;
  gap: 24px;
  align-items: start;
}

.admin-menu {
  position: sticky;
  top: 110px;
  padding: 12px;
  min-width: 0;
}

.admin-menu button {
  display: block;
  width: 100%;
  border: 0;
  border-radius: 12px;
  background: transparent;
  color: var(--ink-soft);
  padding: 12px;
  text-align: left;
  font-weight: 720;
}

.admin-menu button.active,
.admin-menu button:hover {
  background: rgba(2, 150, 218, 0.08);
  color: var(--blue-900);
}

.site-footer {
  margin-top: 56px;
  border-top: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.72);
  padding: 38px 0;
}

.footer-grid {
  display: grid;
  grid-template-columns: 1.2fr 1fr 1fr;
  gap: 28px;
}

.footer-grid img {
  width: 146px;
  height: auto;
}

.stack {
  display: grid;
  gap: 10px;
}

.hide {
  display: none !important;
}

@media (max-width: 860px) {
  .nav {
    min-height: 76px;
  }

  .brand img {
    width: 142px;
  }

  .nav-toggle {
    display: inline-flex;
  }

  .nav-links {
    position: absolute;
    left: 20px;
    right: 20px;
    top: 82px;
    display: none;
    flex-direction: column;
    align-items: stretch;
    border: 1px solid var(--line);
    border-radius: 18px;
    background: #fff;
    padding: 10px;
    box-shadow: var(--shadow);
  }

  .nav-links.open {
    display: flex;
  }

  .about-grid,
  .grid-2,
  .grid-3,
  .metrics,
  .footer-grid,
  .admin-layout,
  .form-grid {
    grid-template-columns: 1fr;
  }

  .hero {
    padding-top: 50px;
  }

  .marks-row {
    grid-template-columns: 1fr;
  }

  .record-row,
  .roster-row {
    grid-template-columns: 1fr;
  }

  .stats-visual {
    grid-template-columns: 1fr;
  }

  .stats-improvers {
    order: -1;
  }

  .section-head {
    display: block;
  }

  .controls {
    margin-top: 16px;
  }

  .filter-controls {
    align-items: stretch;
  }

  .control-field {
    width: 100%;
  }

  .control-field select {
    width: 100%;
  }

  .admin-menu {
    position: static;
    display: flex;
    gap: 6px;
    overflow-x: auto;
    padding: 8px;
    scrollbar-width: none;
  }

  .admin-menu::-webkit-scrollbar {
    display: none;
  }

  .admin-menu button {
    flex: 0 0 auto;
    width: auto;
    min-width: max-content;
    padding: 10px 12px;
    text-align: center;
  }
}

@media (max-width: 560px) {
  .wrap {
    width: min(100% - 28px, var(--max));
  }

  .resource-row {
    grid-template-columns: 1fr;
  }

  .form-shell {
    padding: 18px;
  }

  .actions,
  .actions .button {
    width: 100%;
  }

  .marks-list {
    overflow-x: auto;
    padding-bottom: 2px;
  }

  .ladder-row {
    grid-template-columns: auto minmax(0, 1fr);
  }

  .score-text {
    grid-column: 2;
  }

  th,
  td {
    padding: 13px 12px;
  }
}
