/* Practice page additions — assumes styles.css already defines the
   :root tokens (--paper, --ink, --rule, --card-w, --radius, …) and the base
   .wrap / .site / .wordmark / .question-card / .options / .option /
   .feedback / .qc-head / .qc-body / .stem-math / .eyebrow / mono classes. */

:root {
  --palette-w: 252px; /* 5 cols of 44px + 4 gaps of 8px */
  --layout-gap: 24px;
}

/* Combined width of the palette column + gap + question box (+ side padding).
   Constraining .practice-main to this makes the title, pills, status/progress
   and the palette+box row all share the same left/right edges. */
.practice-main {
  padding: 34px 26px 94px;
  max-width: calc(var(--palette-w) + var(--layout-gap) + var(--card-w) + 52px);
}

.practice-title {
  font-family: "Spectral", serif;
  font-size: clamp(1.8rem, 3.6vw, 2.4rem);
  margin: 18px 0 36px;
}

/* ---------- Topic pills ---------- */
.topic-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 36px;
}
.topic-pill {
  font-size: 0.8rem;
  background: var(--paper-raised);
  border: 1px solid var(--rule);
  border-radius: 999px;
  padding: 8px 18px;
  cursor: pointer;
  color: var(--ink-soft);
}
.topic-pill:hover {
  border-color: var(--ink-soft);
}
.topic-pill[aria-pressed="true"] {
  background: var(--ink);
  border-color: var(--ink);
  color: var(--paper);
}

/* ---------- Status + progress ---------- */
.practice-status {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px 20px;
  margin-bottom: 24px;
}
.practice-status #statusLine {
  font-size: 0.85rem;
  color: var(--ink-soft);
  white-space: nowrap;
}
.storage-note {
  flex-basis: 100%;
  margin: 0;
  font-size: 0.72rem;
  color: var(--ink-faint);
}
.progress-track {
  flex: 1;
  height: 8px;
  background: var(--grid-line);
  border-radius: 999px;
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  background: var(--red);
  width: 0%;
  transition: width 0.15s ease;
}

/* ---------- Question layout: palette (LHS) + question box ---------- */
.question-layout {
  display: flex;
  align-items: stretch; /* palette column matches the question box height */
  gap: var(--layout-gap);
}
.question-layout .question-card {
  flex: 1 1 auto;
  max-width: none; /* override the --card-w cap from styles.css */
  min-width: 0;
}

/* ---------- Question palette ---------- */
.palette {
  flex: 0 0 var(--palette-w);
  display: grid;
  grid-template-columns: repeat(5, 44px);
  grid-auto-rows: 44px;
  align-content: start; /* numbers sit at the top when the box is taller */
  gap: 8px;
}
.palette-item {
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
  background: var(--paper-raised);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  color: var(--ink-soft);
  cursor: pointer;
}
.palette-item:hover {
  border-color: var(--ink-soft);
}
.palette-item[aria-current="true"] {
  border-color: var(--navy);
  border-width: 2px;
  color: var(--ink);
  font-weight: 500;
}
.palette-item[data-state="correct"] {
  background: var(--green-bg);
  border-color: var(--green);
  color: var(--green);
}
.palette-item[data-state="incorrect"] {
  background: var(--red-bg);
  border-color: var(--red);
  color: var(--red);
}

/* ---------- Question nav (prev/next/reset) ---------- */
.qc-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 26px;
  border-top: 1px solid var(--grid-line);
}
.nav-btn {
  background: none;
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  padding: 10px 20px;
  font-size: 0.8rem;
  color: var(--ink-soft);
  cursor: pointer;
}
.nav-btn:hover {
  border-color: var(--ink-soft);
  color: var(--ink);
}
.nav-btn:disabled {
  opacity: 0.4;
  cursor: default;
}
.nav-btn:disabled:hover {
  border-color: var(--rule);
  color: var(--ink-soft);
}

/* Stack the palette above the box once there isn't room for a side column. */
@media (max-width: 830px) {
  .question-layout {
    flex-direction: column;
  }
  .palette {
    flex: 0 0 auto;
    grid-template-columns: repeat(auto-fill, 44px);
    margin-bottom: 5px;
  }
  /* Hide the reset button to keep the nav to Prev/Next on narrow screens.
     !important is needed because practice.js toggles resetBtn.style.display
     inline, which would otherwise win over this rule. */
  #resetBtn {
    display: none !important;
  }
}

@media (max-width: 625px) {
  .qc-nav {
    flex-wrap: wrap;
    gap: 10px;
  }
}
