:root {
  --ink: #15130f;
  --muted: #5b554d;
  --line: #ded6c8;
  --paper: #fffaf1;
  --accent: #1f6f5b;
  --accent-dark: #134536;
  --gold: #d69b25;
  --red: #a63432;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  color: var(--ink);
  background: var(--paper);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
a { color: inherit; text-decoration: none; }
button, input, select { font: inherit; }

.topbar {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 24px;
  align-items: center;
  padding: 16px 28px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 250, 241, 0.94);
  position: sticky;
  top: 0;
  z-index: 5;
}
.brand {
  display: block;
  width: min(360px, 36vw);
}
.brand img,
.login-logo {
  display: block;
  width: 100%;
  height: auto;
}
.topbar nav { display: flex; gap: 18px; color: var(--muted); }
.preference-pill {
  border: 1px solid rgba(31, 111, 91, 0.25);
  border-radius: 999px;
  color: var(--accent-dark);
  background: #eef7f1;
  font-size: 12px;
  font-weight: 800;
  padding: 5px 8px;
  white-space: nowrap;
}
.user { display: flex; gap: 12px; align-items: center; }
.user form { margin: 0; }
main { width: min(1180px, calc(100% - 32px)); margin: 0 auto; }

.hero {
  min-height: 68vh;
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(280px, 0.8fr);
  gap: 36px;
  align-items: center;
  padding: 56px 0 28px;
}
.hero h1, .page-head h1 {
  font-size: clamp(36px, 6vw, 72px);
  line-height: 1;
  margin: 0;
  letter-spacing: 0;
}
.lede { color: var(--muted); font-size: 20px; max-width: 640px; }
.eyebrow { color: var(--accent); text-transform: uppercase; font-size: 13px; font-weight: 800; }
.actions, .page-head { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; }
.primary, .secondary, button {
  border: 1px solid var(--accent);
  border-radius: 6px;
  padding: 10px 14px;
  cursor: pointer;
}
.primary, button { background: var(--accent); color: white; }
.secondary, .button { background: transparent; color: var(--accent-dark); }
.quick-panel, .lane, .detail, .login, .auth-required {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fffdf8;
  padding: 22px;
}
.lane-link { display: grid; gap: 4px; padding: 14px 0; border-top: 1px solid var(--line); }
.lane-link span, small, .muted { color: var(--muted); }
.scope-note {
  border: 1px solid rgba(31, 111, 91, 0.25);
  border-radius: 999px;
  color: var(--accent-dark);
  background: #eef7f1;
  font-size: 13px;
  font-weight: 800;
  padding: 7px 10px;
}
.band, .style-list, .syllabus-topics, .lanes, .review-list, .metrics, .attempts, .detail, .auth-required { margin: 38px 0; }
.category-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 10px;
}
.category, .style-row, .metric, .attempt {
  display: flex;
  gap: 12px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fffdf8;
  padding: 14px;
}
.category span, .code {
  min-width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  background: #efe5d2;
  border-radius: 6px;
  font-weight: 850;
}
.style-row { margin-bottom: 8px; }
.style-row > span:nth-child(2) { display: grid; gap: 3px; min-width: 0; }
.section-head {
  display: flex;
  gap: 16px;
  align-items: baseline;
  justify-content: space-between;
  flex-wrap: wrap;
}
.section-head h2 { margin: 0; }
.section-head p {
  color: var(--muted);
  margin: 0;
  max-width: 720px;
}
.topic-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 8px;
  margin-top: 14px;
}
.topic-row {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 10px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fffdf8;
  padding: 12px;
}
.topic-row > span:last-child {
  display: grid;
  gap: 3px;
  min-width: 0;
}
.topic-type {
  border: 1px solid rgba(214, 155, 37, 0.45);
  border-radius: 999px;
  color: #5d4420;
  background: #fff7df;
  font-size: 12px;
  font-weight: 800;
  line-height: 1;
  padding: 6px 8px;
  text-transform: capitalize;
  white-space: nowrap;
}
.exam-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-left: auto;
}
.exam-tag {
  border: 1px solid rgba(31, 111, 91, 0.25);
  border-radius: 999px;
  color: var(--accent-dark);
  background: #eef7f1;
  font-size: 12px;
  font-weight: 750;
  line-height: 1;
  padding: 6px 8px;
  white-space: nowrap;
}
.advanced-note {
  border-left: 4px solid var(--gold);
  color: #5d4420;
  background: #fff7df;
  padding: 10px 12px;
}
.profile { margin: 38px 0 64px; }
.profile-intro { margin-bottom: 18px; }
.profile-card {
  border-top: 1px solid var(--line);
  padding-top: 24px;
}
.advanced-profile .profile-card {
  border-top-color: rgba(214, 155, 37, 0.7);
}
.profile-card-head {
  display: flex;
  gap: 12px;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 12px;
}
.profile-card-head h3 { margin: 0; }
.profile-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(270px, 1fr));
  gap: 16px;
}
.profile-section {
  min-width: 0;
  margin-bottom: 18px;
}
.profile-section h3 {
  margin: 0 0 6px;
  color: var(--accent-dark);
  font-size: 17px;
}
.profile-section p {
  margin: 0;
  color: var(--ink);
  line-height: 1.55;
}
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
  gap: 8px;
  margin: 0;
}
.stats-grid dt,
.stats-grid dd {
  margin: 0;
  border: 1px solid var(--line);
  background: #fffdf8;
  padding: 8px 10px;
}
.stats-grid dt {
  color: var(--muted);
  font-weight: 800;
  border-bottom: 0;
}
.stats-grid dd {
  font-weight: 750;
  margin-top: -8px;
}
.attribute-tags {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.attribute-tags span {
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  background: #fffdf8;
  font-size: 12px;
  padding: 5px 8px;
}
.variant-list {
  display: grid;
  gap: 26px;
}
.variant-profile {
  padding-top: 18px;
}
.muted-tag {
  border-color: var(--line);
  color: var(--muted);
  background: #f6efe3;
}
.search { display: flex; gap: 8px; margin-left: auto; }
.search input, .answer, select {
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 11px 12px;
  background: white;
}
.page-head { padding-top: 36px; }
.back-link { flex-basis: 100%; width: fit-content; }
.lanes { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 16px; }
.lane { display: grid; gap: 12px; }
.lane-disabled {
  opacity: 0.58;
}
.lane-disabled select,
.lane-disabled button {
  cursor: not-allowed;
}
.lane-disabled button {
  border-color: var(--line);
  background: #9a948b;
}
.lane-message {
  border-left: 4px solid var(--gold);
  color: #5d4420;
  background: #fff7df;
  margin: 0;
  padding: 10px 12px;
}
.auth-required { max-width: 620px; }
.auth-required h2 { margin-top: 0; }
.auth-required .primary { display: inline-flex; }
.quiz { max-width: 760px; padding: 52px 0; }
.quiz-meta { display: flex; justify-content: space-between; color: var(--muted); margin-bottom: 18px; }
.quiz h1 {
  font-size: clamp(30px, 4vw, 52px);
  line-height: 1.08;
  margin: 0;
  letter-spacing: 0;
}
.choices { display: grid; gap: 10px; margin: 28px 0; }
.choices label {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: #fffdf8;
}
.review { border-left: 6px solid var(--line); background: #fffdf8; padding: 16px; margin-bottom: 12px; }
.review.ok { border-color: var(--accent); }
.review.miss { border-color: var(--red); }
.feedback-box {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 18px;
  background: #fffdf8;
  margin: 24px 0;
}
.feedback.ok .eyebrow { color: var(--accent); }
.feedback.miss .eyebrow { color: var(--red); }
.metrics { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 12px; }
.metric { justify-content: space-between; }
.preferences {
  display: grid;
  grid-template-columns: minmax(220px, 0.35fr) minmax(0, 1fr);
  gap: 18px;
  align-items: start;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fffdf8;
  padding: 22px;
  margin: 28px 0;
}
.preferences h2 {
  margin: 0 0 6px;
}
.preference-form {
  display: grid;
  gap: 10px;
}
.preference-option {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  padding: 12px;
}
.preference-option input {
  margin-top: 4px;
}
.preference-option span {
  display: grid;
  gap: 3px;
}
.preference-form button {
  justify-self: start;
}
.profile-scope {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
  color: var(--muted);
  margin: 28px 0 -18px;
}
.profile-scope strong {
  color: var(--accent-dark);
}
.attempt {
  justify-content: space-between;
  margin-bottom: 8px;
}
.attempt-summary {
  display: grid;
  gap: 3px;
  min-width: 0;
}
.metric > span:first-child { min-width: 0; }
.metric-score {
  display: grid;
  gap: 2px;
  justify-items: end;
  margin-left: auto;
  text-align: right;
  white-space: nowrap;
}
.metric strong { font-size: 30px; color: var(--accent-dark); }
.login-body { display: grid; place-items: center; min-height: 100vh; }
.login { width: min(420px, calc(100% - 32px)); }
.login-logo {
  margin-bottom: 14px;
}

@media (max-width: 760px) {
  .topbar { grid-template-columns: 1fr; gap: 10px; }
  .brand { width: min(330px, 100%); }
  .topbar nav { flex-wrap: wrap; }
  .hero { grid-template-columns: 1fr; min-height: auto; }
  .preferences { grid-template-columns: 1fr; }
  .search { width: 100%; }
  .search input { flex: 1; min-width: 0; }
  .style-row { align-items: flex-start; }
  .exam-tags { margin-left: 0; }
}
