/*
  Shared styles for the /tutoring/ practice tools (practice hub, vocab, math).

  Why this exists: the vocab and math tools were built by copying one stylesheet
  and appending to it, so ~185 identical lines shipped three times over and had to
  be kept in sync by hand. Everything common now lives here; each tool's own
  css/styles.css holds only what is unique to that tool.

  Load order matters — shared first, then the tool's own sheet, so a tool can
  override a shared rule:

    <link rel="stylesheet" href="/tutoring/shared/practice.css">
    <link rel="stylesheet" href="css/styles.css">

  A page that needs nothing tool-specific (the practice hub) loads only this file.
*/

/* ---- design tokens ---- */
:root {
  --ink: #1f2933;
  --ink-soft: #5b6672;
  --line: #d6dbe0;
  --paper: #ffffff;
  --tint: #e6f1f0;
  --accent: #0b6e6e;
  --accent-ink: #ffffff;
  --good: #1e7f4f;
  --good-tint: #e3f4ea;
  --bad: #b3261e;
  --bad-tint: #fbe7e5;
  --radius: 10px;
  --font: "Atkinson Hyperlegible", system-ui, -apple-system, "Segoe UI", sans-serif;
}

/* ---- reset / base ---- */
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: 17px;
  line-height: 1.45;
  color: var(--ink);
  background: var(--paper);
}
button { font: inherit; color: inherit; cursor: pointer; }
button:disabled { cursor: default; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }

/* ---- page frame ---- */
.top {
  max-width: 640px;
  margin: 0 auto;
  padding: 20px 20px 0;
}
.top h1 { font-size: 1.6rem; margin: 6px 0 0; font-weight: 700; }
.back { color: var(--ink-soft); text-decoration: none; font-size: 0.95rem; }
.back:hover { text-decoration: underline; }

.app { max-width: 640px; margin: 0 auto; padding: 16px 20px 60px; }

/* ---- setup panel ---- */
.setup { border-bottom: 1px solid var(--line); padding-bottom: 20px; margin-bottom: 24px; }
.setup[hidden] { display: none; }
.row { margin-bottom: 18px; }
.row > label, .row-head { display: block; font-weight: 700; margin-bottom: 6px; }
.row-head { display: flex; justify-content: space-between; align-items: baseline; }
.row-actions .link { background: none; border: 0; padding: 0 0 0 12px; color: var(--accent); font-weight: 400; text-decoration: underline; }
.muted { color: var(--ink-soft); font-size: 0.9rem; margin: 6px 0 0; }

/* ---- controls ---- */
.segmented { display: inline-flex; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.segmented button {
  background: var(--paper);
  border: 0;
  padding: 9px 18px;
}
.segmented button + button { border-left: 1px solid var(--line); }
.segmented button[aria-pressed="true"] { background: var(--accent); color: var(--accent-ink); }
.segmented-sub { margin-top: 10px; display: flex; }
.segmented-sub[hidden] { display: none; }
.segmented-sub button { font-size: 0.95rem; padding: 7px 14px; }

.sub-block { margin-top: 12px; }
.sub-block[hidden] { display: none; }
.sub-label { display: block; font-size: 0.9rem; color: var(--ink-soft); margin-bottom: 5px; }
.sub-block .segmented button { font-size: 0.95rem; padding: 7px 14px; }

.btn {
  padding: 10px 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--paper);
}
.btn:disabled { opacity: 0.4; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }

.toggle { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; }
.toggle input { accent-color: var(--accent); width: 16px; height: 16px; margin: 0; }

.counter { color: var(--ink-soft); font-variant-numeric: tabular-nums; }
.empty { padding: 40px 0; color: var(--ink-soft); text-align: center; }

/* ---- feedback ---- */
.feedback { margin-top: 18px; display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.feedback p { margin: 0; font-size: 1.05rem; }
.fb-correct { color: var(--good); font-weight: 700; }
.fb-wrong { color: var(--bad); }

/* ---- results ---- */
.results { text-align: center; padding: 24px 0 8px; }
.results-score { font-size: 2.4rem; font-weight: 700; margin: 0; }
.results-pct { color: var(--ink-soft); margin: 4px 0 0; font-size: 1.2rem; }
.actions { display: flex; justify-content: center; gap: 10px; flex-wrap: wrap; margin: 18px 0 28px; }
.missed h2 { font-size: 1.1rem; margin: 0 0 10px; }
.missed dl { margin: 0; }
.missed dt { font-weight: 700; margin-top: 12px; }
.missed dd { margin: 2px 0 0; color: var(--ink-soft); }
.perfect { text-align: center; color: var(--good); font-weight: 700; }

/* ---- copy link to this setup ---- */
.copy-row { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-top: 14px; }
.copy-link { font-size: 0.95rem; padding: 8px 14px; }
.copy-status { color: var(--good); font-size: 0.9rem; font-weight: 700; }
.copy-status.is-error { color: var(--bad); font-weight: 400; }

/* ---- tool index / hub cards (practice hub, math hub) ---- */
.hub { display: grid; gap: 12px; }
.hub-card {
  display: block;
  padding: 20px 22px;
  border: 2px solid var(--line);
  border-radius: 16px;
  color: inherit;
  text-decoration: none;
  transition: border-color 120ms, background-color 120ms;
}
.hub-card:hover, .hub-card:focus-visible { border-color: var(--accent); background: var(--tint); }
.hub-card strong { display: block; font-size: 1.3rem; margin-bottom: 4px; }
.hub-card span { color: var(--ink-soft); }
.hub-note { margin-top: 16px; }
.hub-foot { margin-top: 36px; padding-top: 18px; border-top: 1px solid var(--line); }
.hub-foot a { color: var(--accent); }

@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
