/* ---------------------------------------------------
   RevisionRoost — shared styles
--------------------------------------------------- */
:root {
  --roost-amber: #c9711a;
  --roost-amber-dark: #a1590f;
  --roost-green: #2f5d4f;
  --roost-green-dark: #203f36;
  --roost-cream: #fbf5ea;
  --roost-cream-2: #f3e8d4;
  --roost-ink: #2a241d;
  --roost-ink-soft: #5c5346;
  --roost-line: #e6d9c1;
  --roost-white: #ffffff;
  --roost-easy: #3f8f5c;
  --roost-medium: #c9711a;
  --roost-hard: #b3401f;
  --radius: 14px;
  --shadow: 0 6px 20px rgba(42, 36, 29, 0.08);
  --shadow-sm: 0 2px 8px rgba(42, 36, 29, 0.06);
  --max-width: 1120px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
}

body {
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--roost-cream);
  color: var(--roost-ink);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 {
  font-family: "Poppins", "Inter", sans-serif;
  font-weight: 600;
  line-height: 1.2;
  margin: 0 0 0.5em;
  color: var(--roost-green-dark);
}

p { margin: 0 0 1em; }

a { color: var(--roost-amber-dark); text-decoration: none; }
a:hover { text-decoration: underline; }

img { max-width: 100%; display: block; }

.wrap {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 24px;
}

/* ---------------- Header / nav ---------------- */
.site-header {
  background: var(--roost-white);
  border-bottom: 1px solid var(--roost-line);
  position: sticky;
  top: 0;
  z-index: 40;
}

.site-header .wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 14px;
  padding-bottom: 14px;
  gap: 16px;
  flex-wrap: wrap;
}

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: "Poppins", sans-serif;
  font-weight: 700;
  font-size: 1.25rem;
  color: var(--roost-green-dark);
}

.logo .mark {
  font-size: 1.6rem;
  line-height: 1;
}

.main-nav {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.main-nav a {
  color: var(--roost-ink-soft);
  font-weight: 600;
  font-size: 0.95rem;
  padding: 8px 14px;
  border-radius: 999px;
  text-decoration: none;
  transition: background .15s ease, color .15s ease;
}

.main-nav a:hover,
.main-nav a.active {
  background: var(--roost-cream-2);
  color: var(--roost-green-dark);
}

.nav-status {
  font-size: 0.85rem;
  color: var(--roost-ink-soft);
  display: flex;
  align-items: center;
  gap: 10px;
}

.pill {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: .02em;
}

.pill.unlocked { background: #e4f2e8; color: var(--roost-easy); }
.pill.locked { background: #fbe7e1; color: var(--roost-hard); }

.btn-link {
  background: none;
  border: none;
  color: var(--roost-amber-dark);
  font-weight: 600;
  cursor: pointer;
  font-size: 0.85rem;
  padding: 0;
}

/* ---------------- Buttons ---------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border-radius: 999px;
  padding: 12px 26px;
  font-weight: 700;
  font-size: 0.98rem;
  font-family: inherit;
  border: 2px solid transparent;
  cursor: pointer;
  transition: transform .1s ease, box-shadow .15s ease, background .15s ease;
  text-decoration: none;
}

.btn:active { transform: translateY(1px); }

.btn-primary {
  background: var(--roost-amber);
  color: #fff;
  box-shadow: var(--shadow-sm);
}
.btn-primary:hover { background: var(--roost-amber-dark); text-decoration: none; }

.btn-secondary {
  background: var(--roost-green-dark);
  color: #fff;
}
.btn-secondary:hover { background: #16281f; text-decoration: none; }

.btn-outline {
  background: transparent;
  border-color: var(--roost-line);
  color: var(--roost-green-dark);
}
.btn-outline:hover { border-color: var(--roost-amber); text-decoration: none; }

.btn-sm { padding: 8px 16px; font-size: 0.85rem; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }

/* ---------------- Hero ---------------- */
.hero {
  padding: 64px 0 48px;
  background: radial-gradient(circle at 85% -10%, #fdebd3 0%, transparent 55%), var(--roost-cream);
}

.hero .wrap {
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 48px;
  align-items: center;
}

.hero h1 {
  font-size: clamp(2rem, 4vw, 2.8rem);
  margin-bottom: 0.4em;
}

.hero .lede {
  font-size: 1.1rem;
  color: var(--roost-ink-soft);
  max-width: 46ch;
}

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

.hero-stats {
  display: flex;
  gap: 28px;
  margin-top: 36px;
  flex-wrap: wrap;
}

.hero-stat strong {
  display: block;
  font-family: "Poppins", sans-serif;
  font-size: 1.5rem;
  color: var(--roost-green-dark);
}

.hero-stat span {
  font-size: 0.85rem;
  color: var(--roost-ink-soft);
}

.hero-card {
  background: var(--roost-white);
  border: 1px solid var(--roost-line);
  border-radius: var(--radius);
  padding: 28px;
  box-shadow: var(--shadow);
}

.hero-card h3 { margin-bottom: 6px; }
.hero-card .muted { color: var(--roost-ink-soft); font-size: 0.92rem; margin-bottom: 18px; }

/* ---------------- Access gate ---------------- */
.code-form {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.code-form input[type="text"] {
  flex: 1;
  min-width: 180px;
  padding: 12px 14px;
  border: 2px solid var(--roost-line);
  border-radius: 10px;
  font-size: 1rem;
  font-family: inherit;
  letter-spacing: .04em;
  text-transform: uppercase;
}

.code-form input[type="text"]:focus {
  outline: none;
  border-color: var(--roost-amber);
}

.code-msg {
  margin-top: 12px;
  font-size: 0.9rem;
  font-weight: 600;
}

.code-msg.error { color: var(--roost-hard); }
.code-msg.ok { color: var(--roost-easy); }

.remember-row {
  margin-top: 12px;
  font-size: 0.85rem;
  color: var(--roost-ink-soft);
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Full-page lock overlay used on practice.html / quiz.html */
.lock-overlay {
  position: fixed;
  inset: 0;
  background: rgba(42, 36, 29, 0.55);
  backdrop-filter: blur(2px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 20px;
}

.lock-box {
  background: var(--roost-white);
  border-radius: var(--radius);
  padding: 32px;
  max-width: 420px;
  width: 100%;
  box-shadow: 0 20px 60px rgba(0,0,0,0.25);
  text-align: center;
}

.lock-box .mark { font-size: 2.4rem; }

/* ---------------- Sections ---------------- */
.section {
  padding: 56px 0;
}

.section-head {
  text-align: center;
  max-width: 640px;
  margin: 0 auto 36px;
}

.section-alt { background: var(--roost-white); border-top: 1px solid var(--roost-line); border-bottom: 1px solid var(--roost-line); }

/* Subject grid */
.subject-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 20px;
}

.subject-card {
  background: var(--roost-white);
  border: 1px solid var(--roost-line);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow-sm);
}

.subject-card .icon { font-size: 1.8rem; margin-bottom: 10px; }
.subject-card h3 { margin-bottom: 6px; font-size: 1.1rem; }
.subject-card p { color: var(--roost-ink-soft); font-size: 0.92rem; margin-bottom: 14px; }
.subject-card .count { font-weight: 700; color: var(--roost-amber-dark); font-size: 0.85rem; }

/* How it works steps */
.steps {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 24px;
}

.step {
  text-align: center;
}

.step .num {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--roost-green-dark);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  margin: 0 auto 12px;
}

/* ---------------- Downloads ---------------- */
.download-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 18px;
}

.download-card {
  background: var(--roost-white);
  border: 1px solid var(--roost-line);
  border-radius: var(--radius);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  box-shadow: var(--shadow-sm);
}

.download-card .filesize { font-size: 0.8rem; color: var(--roost-ink-soft); }

/* ---------------- Filters (practice page) ---------------- */
.filter-bar {
  background: var(--roost-white);
  border: 1px solid var(--roost-line);
  border-radius: var(--radius);
  padding: 18px 20px;
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  align-items: flex-end;
  margin-bottom: 24px;
  box-shadow: var(--shadow-sm);
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--roost-ink-soft);
}

.field select, .field input[type="search"] {
  padding: 9px 10px;
  border: 1px solid var(--roost-line);
  border-radius: 8px;
  font-family: inherit;
  font-size: 0.92rem;
  min-width: 150px;
  background: var(--roost-cream);
}

.field input[type="search"] { min-width: 220px; }

.results-count {
  font-size: 0.88rem;
  color: var(--roost-ink-soft);
  margin-bottom: 14px;
}

/* Flip cards for practice */
.qa-list { display: flex; flex-direction: column; gap: 14px; }

.qa-card {
  background: var(--roost-white);
  border: 1px solid var(--roost-line);
  border-radius: var(--radius);
  padding: 18px 20px;
  box-shadow: var(--shadow-sm);
}

.qa-meta {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}

.tag {
  font-size: 0.72rem;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 999px;
  background: var(--roost-cream-2);
  color: var(--roost-ink-soft);
  text-transform: uppercase;
  letter-spacing: .03em;
}

.tag.diff-easy { background: #e4f2e8; color: var(--roost-easy); }
.tag.diff-medium { background: #fbe9d6; color: var(--roost-medium); }
.tag.diff-hard { background: #fbe1db; color: var(--roost-hard); }

.qa-question { font-weight: 600; margin-bottom: 4px; }

.qa-image { margin: 10px 0; max-width: 340px; border-radius: 8px; border: 1px solid var(--roost-line); }

.qa-answer {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px dashed var(--roost-line);
  display: none;
}

.qa-answer.shown { display: block; }

.qa-answer .label { font-size: 0.78rem; font-weight: 700; color: var(--roost-easy); text-transform: uppercase; letter-spacing: .03em; }

.pager {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin: 32px 0;
  flex-wrap: wrap;
}

.pager button {
  min-width: 38px;
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid var(--roost-line);
  background: var(--roost-white);
  cursor: pointer;
  font-weight: 600;
}

.pager button.active { background: var(--roost-green-dark); color: #fff; border-color: var(--roost-green-dark); }
.pager button[disabled] { opacity: .4; cursor: not-allowed; }

/* ---------------- Quiz ---------------- */
.quiz-setup {
  background: var(--roost-white);
  border: 1px solid var(--roost-line);
  border-radius: var(--radius);
  padding: 28px;
  max-width: 560px;
  margin: 0 auto;
  box-shadow: var(--shadow);
}

.quiz-setup .field { width: 100%; margin-bottom: 16px; }
.quiz-setup select { width: 100%; }

.quiz-progress {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 18px;
  font-size: 0.88rem;
  color: var(--roost-ink-soft);
  font-weight: 600;
}

.progress-bar {
  height: 8px;
  background: var(--roost-cream-2);
  border-radius: 999px;
  overflow: hidden;
  margin-bottom: 24px;
}

.progress-bar > div {
  height: 100%;
  background: var(--roost-amber);
  transition: width .25s ease;
}

.quiz-card {
  background: var(--roost-white);
  border: 1px solid var(--roost-line);
  border-radius: var(--radius);
  padding: 28px;
  max-width: 640px;
  margin: 0 auto;
  box-shadow: var(--shadow);
}

.quiz-card .qa-meta { margin-bottom: 14px; }
.quiz-card .question-text { font-size: 1.15rem; font-weight: 600; margin-bottom: 18px; }

.answer-input {
  width: 100%;
  padding: 12px 14px;
  border: 2px solid var(--roost-line);
  border-radius: 10px;
  font-size: 1rem;
  font-family: inherit;
}
.answer-input:focus { outline: none; border-color: var(--roost-amber); }

.mcq-options {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  margin-top: 6px;
}

.mcq-btn {
  padding: 12px;
  border-radius: 10px;
  border: 2px solid var(--roost-line);
  background: var(--roost-cream);
  font-weight: 700;
  cursor: pointer;
  font-size: 1.05rem;
}

.mcq-btn:hover { border-color: var(--roost-amber); }
.mcq-btn.selected { border-color: var(--roost-amber); background: #fdebd3; }
.mcq-btn.correct { border-color: var(--roost-easy); background: #e4f2e8; }
.mcq-btn.incorrect { border-color: var(--roost-hard); background: #fbe1db; }

.feedback-box {
  margin-top: 16px;
  padding: 14px 16px;
  border-radius: 10px;
  font-weight: 600;
  display: none;
}
.feedback-box.show { display: block; }
.feedback-box.correct { background: #e4f2e8; color: var(--roost-easy); }
.feedback-box.incorrect { background: #fbe1db; color: var(--roost-hard); }
.feedback-box .notes { font-weight: 400; margin-top: 6px; font-size: 0.9rem; color: var(--roost-ink-soft); }

.self-mark-row {
  margin-top: 10px;
  display: flex;
  gap: 8px;
  font-size: 0.85rem;
  align-items: center;
}

.quiz-actions {
  display: flex;
  justify-content: space-between;
  margin-top: 24px;
  gap: 10px;
}

/* Results */
.results-card {
  background: var(--roost-white);
  border: 1px solid var(--roost-line);
  border-radius: var(--radius);
  padding: 36px;
  max-width: 640px;
  margin: 0 auto;
  text-align: center;
  box-shadow: var(--shadow);
}

.score-ring {
  font-family: "Poppins", sans-serif;
  font-size: 3rem;
  font-weight: 700;
  color: var(--roost-green-dark);
  margin: 10px 0;
}

.topic-breakdown {
  text-align: left;
  margin-top: 24px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.topic-row {
  display: flex;
  justify-content: space-between;
  font-size: 0.9rem;
  padding: 8px 12px;
  background: var(--roost-cream-2);
  border-radius: 8px;
}

.review-list { text-align: left; margin-top: 20px; }

/* ---------------- Footer ---------------- */
.site-footer {
  background: var(--roost-green-dark);
  color: #d9e6df;
  padding: 40px 0;
  margin-top: 60px;
  font-size: 0.88rem;
}

.site-footer a { color: #fff; }
.site-footer .wrap { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 16px; }

/* ---------------- Utility ---------------- */
.muted { color: var(--roost-ink-soft); }
.center { text-align: center; }
.mt-0 { margin-top: 0; }
.hidden { display: none !important; }
.spinner { display: inline-block; width: 16px; height: 16px; border: 2px solid var(--roost-line); border-top-color: var(--roost-amber); border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.empty-state { text-align: center; padding: 60px 20px; color: var(--roost-ink-soft); }

@media (max-width: 860px) {
  .hero .wrap { grid-template-columns: 1fr; }
  .mcq-options { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 560px) {
  .main-nav { order: 3; width: 100%; justify-content: center; }
  .mcq-options { grid-template-columns: 1fr; }
  .quiz-actions { flex-direction: column-reverse; }
  .quiz-actions .btn { width: 100%; }
}
