@import url('https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@500;700&family=IBM+Plex+Sans:wght@400;500;600&display=swap');

:root {
  --ink: #1B2430;
  --paper: #F0F3F2;
  --paper-card: #FFFFFF;
  --navy: #1F3A5F;
  --navy-dim: #4C6484;
  --gold: #E8A33D;
  --line: #D7DEDC;
  --error: #C0432F;
  --radius: 10px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: 'IBM Plex Sans', system-ui, sans-serif;
  font-size: 16px;
  line-height: 1.5;
}

h1, h2, h3 {
  font-family: 'Space Grotesk', system-ui, sans-serif;
  font-weight: 700;
  line-height: 1.15;
  margin: 0 0 0.5em 0;
}

h1 { font-size: 1.9rem; }
h2 { font-size: 1.35rem; }
h3 { font-size: 1.1rem; }

p { margin: 0 0 1em 0; max-width: 62ch; }

a { color: var(--navy); }

.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.1rem 1.5rem;
  border-bottom: 1px solid var(--line);
  background: var(--paper-card);
}

.site-header .brand {
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 700;
  font-size: 1.15rem;
  color: var(--navy);
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.site-header .who {
  font-size: 0.9rem;
  color: var(--navy-dim);
  display: flex;
  align-items: center;
  gap: 0.9rem;
}

.site-header button.link {
  background: none;
  border: none;
  color: var(--navy-dim);
  font: inherit;
  text-decoration: underline;
  cursor: pointer;
  padding: 0;
}

main {
  max-width: 720px;
  margin: 0 auto;
  padding: 2.5rem 1.5rem 4rem 1.5rem;
}

.card {
  background: var(--paper-card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.75rem;
}

label {
  display: block;
  font-weight: 600;
  font-size: 0.92rem;
  margin: 1rem 0 0.35rem 0;
}

input[type="text"], input[type="password"] {
  width: 100%;
  padding: 0.65rem 0.75rem;
  border: 1px solid var(--line);
  border-radius: 6px;
  font: inherit;
  background: var(--paper);
}

input:focus, button:focus, .choice:focus {
  outline: 2px solid var(--navy);
  outline-offset: 2px;
}

button.primary {
  background: var(--navy);
  color: #fff;
  border: none;
  padding: 0.7rem 1.4rem;
  border-radius: 6px;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  margin-top: 1.4rem;
}

button.primary:hover { background: #16304F; }
button.primary:disabled { opacity: 0.5; cursor: default; }

button.ghost {
  background: none;
  border: 1px solid var(--line);
  padding: 0.65rem 1.3rem;
  border-radius: 6px;
  font: inherit;
  font-weight: 600;
  color: var(--navy);
  cursor: pointer;
  margin-top: 1.4rem;
}

.error-msg {
  color: var(--error);
  font-size: 0.9rem;
  margin-top: 0.9rem;
}

.tabs {
  display: flex;
  gap: 1.5rem;
  border-bottom: 1px solid var(--line);
  margin-bottom: 1.5rem;
}

.tabs button {
  background: none;
  border: none;
  font: inherit;
  font-weight: 600;
  color: var(--navy-dim);
  padding: 0 0 0.7rem 0;
  cursor: pointer;
  border-bottom: 2px solid transparent;
}

.tabs button.active {
  color: var(--navy);
  border-bottom-color: var(--navy);
}

/* --- Ladder (dashboard) --- */

.ladder {
  position: relative;
  padding-left: 28px;
  margin-top: 2rem;
}

.ladder::before {
  content: "";
  position: absolute;
  left: 8px;
  top: 8px;
  bottom: 8px;
  width: 3px;
  background: var(--line);
  border-radius: 2px;
}

.rung {
  position: relative;
  margin-bottom: 1.1rem;
  padding: 1.1rem 1.3rem;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: var(--paper-card);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  text-decoration: none;
  color: inherit;
}

.rung::before {
  content: "";
  position: absolute;
  left: -28px;
  top: 50%;
  transform: translateY(-50%);
  width: 15px;
  height: 15px;
  border-radius: 50%;
  background: var(--rung-color, var(--navy-dim));
  border: 3px solid var(--paper);
}

.rung.locked { opacity: 0.55; }
.rung.locked::before { background: var(--line); }

.rung .info strong { display: block; font-size: 1.05rem; }
.rung .info span.strand {
  font-size: 0.85rem;
  color: var(--navy-dim);
}

.rung .status {
  font-size: 0.85rem;
  font-weight: 600;
  white-space: nowrap;
}

.badge-icon {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--gold);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 1.1rem;
  flex-shrink: 0;
}

/* --- Question flow --- */

.question-block { margin-bottom: 1.6rem; }

.choices {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  margin-top: 0.8rem;
}

.choice {
  text-align: left;
  padding: 0.75rem 1rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper);
  font: inherit;
  cursor: pointer;
}

.choice:hover { border-color: var(--navy-dim); }
.choice.selected { border-color: var(--navy); background: #E7ECF3; }
.choice.correct { border-color: #3E8659; background: #E6F2EA; }
.choice.incorrect { border-color: var(--error); background: #F7E7E3; }

.progress-track {
  height: 6px;
  background: var(--line);
  border-radius: 4px;
  overflow: hidden;
  margin-bottom: 1.5rem;
}

.progress-fill {
  height: 100%;
  background: var(--navy);
}

.feedback {
  margin-top: 0.8rem;
  font-size: 0.92rem;
  padding: 0.75rem 1rem;
  border-radius: 8px;
}

.feedback.correct { background: #E6F2EA; color: #245234; }
.feedback.incorrect { background: #F7E7E3; color: #7A2E20; }

.worked-example {
  padding: 1.3rem;
  background: var(--paper);
  border-radius: 8px;
  border: 1px solid var(--line);
  margin-bottom: 1.3rem;
}

.badge-award {
  text-align: center;
  padding: 2rem 1rem;
}

.badge-award .medal {
  width: 90px;
  height: 90px;
  border-radius: 50%;
  background: var(--gold);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.4rem;
  margin: 0 auto 1.2rem auto;
  color: #fff;
}

/* --- Home screen: year tabs + strand grid --- */

.year-tabs {
  display: flex;
  gap: 0.6rem;
  flex-wrap: wrap;
  margin: 1.6rem 0 2rem 0;
}

.year-tab {
  padding: 0.55rem 1.2rem;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--paper-card);
  font: inherit;
  font-weight: 600;
  color: var(--navy-dim);
  cursor: pointer;
}

.year-tab.active {
  background: var(--navy);
  border-color: var(--navy);
  color: #fff;
}

.strand-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 1rem;
}

.strand-card {
  display: block;
  padding: 1.3rem;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: var(--paper-card);
  text-decoration: none;
  color: inherit;
  border-top: 4px solid var(--strand-color, var(--navy-dim));
}

.strand-card h3 { margin-bottom: 0.3rem; }

.strand-card .count {
  font-size: 0.88rem;
  color: var(--navy-dim);
  font-weight: 600;
}

.strand-card.empty {
  opacity: 0.5;
  cursor: default;
}

.strand-card:not(.empty):hover {
  border-color: var(--strand-color, var(--navy));
}

.breadcrumb {
  font-size: 0.9rem;
  color: var(--navy-dim);
  margin-bottom: 0.3rem;
}
