/* CourseReview — playful but legible. Palette validated with the data-viz checker:
   section tags orange / blue / violet, class colors teal / pink, accent violet. */
:root {
  --bg: #faf6ff; --card: #ffffff; --ink: #2a2440; --muted: #6f6a85; --line: #e8e2f3;
  --accent: #5b3fd6; --accent-dark: #4a31b8; --accent-soft: #ece7fb; --accent-ink: #ffffff;
  --grad-a: #5b3fd6; --grad-b: #b23fd6; --grad-c: #ef5da8;
  --algebra: #0f9d8f; --algebra-soft: #e3f6f3; --chem: #ef5da8; --chem-soft: #fde8f1;
  --warm: #eb6834; --cur: #2a78d6; --rev: #4a3aa7; --diag: #5a6b73;
  --ok: #1f9d55; --ok-soft: #e4f7ec; --bad: #d8405d; --bad-soft: #fdeaee; --sun: #f5b700; --sun-soft: #fff4cc;
  --lvl-unseen: #ece9f3; --lvl-struggling: #ffd3dc; --lvl-weak: #ffe7b3; --lvl-strong: #cfefdf; --lvl-mastered: #9fe3bd;
  --series: #2a78d6; --series-soft: #d9e8fb;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink);
  font: 17px/1.5 "Nunito", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif; font-weight: 500; }
a { color: var(--accent); }
h1 { font-size: 1.7rem; margin: .4rem 0 .4rem; font-weight: 800; }
h2 { font-size: 1.15rem; margin: 0 0 .5rem; font-weight: 800; }
h3 { font-size: 1rem; margin: .8rem 0 .3rem; font-weight: 700; }
.wrap { max-width: 780px; margin: 0 auto; padding: 16px 16px 60px; }
.narrow { max-width: 420px; margin: 40px auto; }
.muted { color: var(--muted); }
.tiny { font-size: .85rem; }
.bad { color: var(--bad); font-weight: 700; }
.ok { background: var(--ok-soft); }
code { background: #f1eef8; padding: 0 5px; border-radius: 5px; font-size: .92em; }

/* ---- header ---- */
.top { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 10px 16px; color: #fff;
  background: linear-gradient(100deg, var(--grad-a) 0%, var(--grad-b) 55%, var(--grad-c) 100%); box-shadow: 0 2px 12px rgba(91,63,214,.25); }
.top .brand { display: flex; align-items: center; gap: 12px; color: #fff; text-decoration: none; min-width: 0; }
.top .logo { height: 30px; width: auto; display: block; }
.top .app-name { font-weight: 800; letter-spacing: .3px; padding-left: 12px; border-left: 1px solid rgba(255,255,255,.45); white-space: nowrap; }
.top nav { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; justify-content: flex-end; }
.top nav a { color: #fff; text-decoration: none; font-weight: 700; opacity: .92; }
.top nav a:hover { opacity: 1; text-decoration: underline; }
button.link { background: none; border: 0; color: #fff; cursor: pointer; font: inherit; font-weight: 700; padding: 0; text-decoration: underline; opacity: .92; }
.wrap button.link { color: var(--accent); }
form.inline { display: inline; }
@media (max-width: 560px) { .top .app-name { display: none; } .top .logo { height: 26px; } }

/* ---- cards & basics ---- */
.card { background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 16px; margin: 12px 0; box-shadow: 0 1px 2px rgba(42,36,64,.04); }
.cards { display: grid; gap: 14px; }
.hello { display: flex; align-items: center; gap: 12px; }
.card.course { text-decoration: none; color: inherit; display: grid; grid-template-columns: 120px 1fr; gap: 14px; align-items: center; border: 2px solid transparent; transition: transform .12s, box-shadow .12s; }
.card.course:hover { transform: translateY(-2px); box-shadow: 0 8px 22px rgba(42,36,64,.10); }
.card.course.algebra { border-color: var(--algebra-soft); }
.card.course.chem { border-color: var(--chem-soft); }
.card.course.algebra .fill { background: var(--algebra); }
.card.course.chem .fill { background: var(--chem); }
.card.course.complete { opacity: .92; }
.course-art .art { width: 120px; height: 90px; display: block; }
.course-head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.course-body p { margin: 4px 0 0; }
.course-extra { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-top: 8px; }
@media (max-width: 420px) { .card.course { grid-template-columns: 90px 1fr; } .course-art .art { width: 90px; height: 68px; } }
.pill { display: inline-block; font-size: .78rem; padding: 2px 10px; border-radius: 999px; background: var(--accent-soft); color: var(--accent-dark); font-weight: 700; white-space: nowrap; }
.bar { height: 10px; background: #ece8f5; border-radius: 999px; overflow: hidden; margin: 8px 0; }
.bar .fill { height: 100%; background: var(--accent); border-radius: 999px; transition: width .3s; }
.notice { background: var(--sun-soft); border: 1px solid #f3dd8a; padding: 10px 12px; border-radius: 12px; }

.stack { display: grid; gap: 12px; }
.stack label { display: grid; gap: 4px; font-weight: 700; }
input[type=text], input[type=password], input[type=number], select {
  font: inherit; padding: 10px 12px; border: 1.5px solid #d6d0e6; border-radius: 12px; background: #fff; width: 100%; }
input[type=text]:focus, input[type=password]:focus, input[type=number]:focus, select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
input.short { width: 90px; display: inline-block; }
label.row { display: flex; gap: 8px; align-items: center; font-weight: 600; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
button, .btn { font: inherit; font-weight: 700; border-radius: 12px; padding: 10px 16px; cursor: pointer; border: 1.5px solid #d6d0e6; background: #fff; color: var(--ink); text-decoration: none; display: inline-block; }
button.primary, .btn.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); box-shadow: 0 3px 10px rgba(91,63,214,.25); }
button.primary:hover, .btn.primary:hover { background: var(--accent-dark); }
button.ghost, .btn.ghost { background: transparent; }
button:disabled { opacity: .5; cursor: default; box-shadow: none; }

.login { text-align: center; }
.login .art-sparkles { width: 160px; height: 60px; display: block; margin: 0 auto 4px; }
.login .stack { text-align: left; }

/* ---- the sheet ---- */
.sheet-head .back { text-decoration: none; font-weight: 700; }
.problems { list-style: none; padding: 0; margin: 0; }
.problem { position: relative; border-left: 6px solid var(--diag); }
.problem.sec-warmup { border-left-color: var(--warm); }
.problem.sec-current { border-left-color: var(--cur); }
.problem.sec-review { border-left-color: var(--rev); }
.problem.done.right { background: #f2fbf5; }
.problem.done.wrong { background: #fff4f6; }
.prob-head { display: flex; gap: 10px; align-items: center; margin-bottom: 6px; flex-wrap: wrap; }
.tag { font-size: .74rem; text-transform: uppercase; letter-spacing: .5px; font-weight: 800; padding: 2px 8px; border-radius: 999px; background: #eef0f2; color: var(--diag); }
.sec-warmup .tag { background: #fdeadf; color: #a8451a; }
.sec-current .tag { background: #dfeafb; color: #1d5aa5; }
.sec-review .tag { background: #e6e1f6; color: #3b2d8a; }
.skill-name { font-size: .85rem; color: var(--muted); }
.prompt { font-size: 1.08rem; margin: 6px 0 10px; }
.prompt .katex { font-size: 1.08em; }
.input-row { display: flex; align-items: center; gap: 8px; }
.input-row input.answer { flex: 1; font-size: 1.1rem; }
.unit { color: var(--muted); white-space: nowrap; font-weight: 700; }
.palette { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
.palette button { padding: 4px 10px; font-size: .95rem; border-radius: 9px; background: var(--accent-soft); border-color: transparent; color: var(--accent-dark); }
.choices { display: grid; gap: 8px; }
.choice { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border: 1.5px solid var(--line); border-radius: 12px; cursor: pointer; }
.choice:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.choice input { margin-top: 5px; accent-color: var(--accent); }
.choices-plain { margin: 4px 0 8px 1.2rem; }
.actions { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-top: 12px; }
.actions .help { margin-left: auto; font-size: .92rem; font-weight: 700; }
.feedback { margin-top: 10px; border-top: 1px dashed var(--line); padding-top: 10px; }
.verdict { font-weight: 800; margin: 0 0 4px; }
.note { color: #7a4b00; background: var(--sun-soft); padding: 6px 10px; border-radius: 9px; display: inline-block; }
.answer-line .ans { font-weight: 700; }
details summary { cursor: pointer; color: var(--accent); font-weight: 700; }
.steps { padding-left: 1.3rem; }
.steps li { margin: 6px 0; }
.finish { text-align: center; border: 2px solid var(--lvl-mastered); background: linear-gradient(180deg, #fff 0%, #f3fbf6 100%); }
.finish .art-confetti { width: 100%; max-width: 320px; height: 70px; display: block; margin: 0 auto 4px; }
.finish .row { justify-content: center; margin-top: 8px; }

/* ---- lesson ---- */
.lesson .explain p { margin: .5rem 0; }
.lesson .explain ul, .lesson .explain ol { padding-left: 1.2rem; }
ul.plain { list-style: none; padding: 0; margin: 0; }
ul.plain li { margin: 6px 0; }

/* ---- skill map ---- */
.heat h3 { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.heat-section.frontier { background: #eef3fc; border-radius: 12px; padding: 6px 10px; margin: 6px -10px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { font-size: .85rem; padding: 4px 10px; border-radius: 999px; text-decoration: none; color: var(--ink); border: 1px solid rgba(0,0,0,.05); font-weight: 600; }
.lvl-unseen { background: var(--lvl-unseen); color: var(--muted); }
.lvl-struggling { background: var(--lvl-struggling); }
.lvl-weak { background: var(--lvl-weak); }
.lvl-strong { background: var(--lvl-strong); }
.lvl-mastered { background: var(--lvl-mastered); font-weight: 700; }
.legend { display: flex; gap: 6px; flex-wrap: wrap; }

/* ---- tables & admin ---- */
.tbl { width: 100%; border-collapse: collapse; font-size: .95rem; }
.tbl th, .tbl td { text-align: left; padding: 6px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
.tbl th { color: var(--muted); font-weight: 700; font-size: .82rem; text-transform: uppercase; letter-spacing: .4px; }
.settings-grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }
.settings-form { border: 1px solid var(--line); border-radius: 14px; padding: 12px; }
.problems.compact .problem { padding: 10px 14px; }
table.mini { border-collapse: collapse; margin: 8px 0; font-size: .95rem; }
table.mini th, table.mini td { border: 1px solid var(--line); padding: 4px 10px; text-align: left; }
table.mini th { background: #f3f0fa; font-weight: 700; }

/* ---- review / analytics ---- */
.filters { display: flex; gap: 14px; align-items: end; flex-wrap: wrap; margin: 6px 0 14px; }
.filters label { display: grid; gap: 3px; font-size: .85rem; color: var(--muted); font-weight: 700; }
.filters select { width: auto; min-width: 150px; }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; margin: 0 0 12px; }
.tile { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 12px 14px; }
.tile-label { font-size: .8rem; color: var(--muted); font-weight: 700; }
.tile-value { font-size: 1.7rem; font-weight: 800; line-height: 1.2; margin: 2px 0; }
.tile-sub { font-size: .78rem; color: var(--muted); }
.trend-grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }
.viz { position: relative; }
.viz h3 { margin: 0 0 4px; }
.viz svg { width: 100%; height: auto; display: block; font-family: inherit; }
.viz-hit { cursor: crosshair; outline: none; }
.viz-tip { position: absolute; pointer-events: none; background: var(--ink); color: #fff; font-size: .82rem; padding: 6px 9px; border-radius: 8px; white-space: nowrap; z-index: 5; box-shadow: 0 4px 14px rgba(0,0,0,.18); }
.viz-tip b { font-size: 1rem; }
.meter, .meter-inline { display: inline-block; height: 10px; border-radius: 4px; background: var(--series-soft); overflow: hidden; vertical-align: middle; }
.meter { width: 100%; max-width: 260px; }
.meter-inline { width: 70px; margin-right: 4px; }
.meter > span, .meter-inline > span { display: block; height: 100%; background: var(--series); border-radius: 0 4px 4px 0; }
.meter-cell { width: 40%; }
.nowrap { white-space: nowrap; }
.strip { letter-spacing: 2px; font-size: 1rem; white-space: nowrap; }
.miss .prompt-sm { font-size: .92rem; }
.frontier-row td { background: #eef3fc; }
.patterns { display: grid; gap: 18px; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.patterns h3 { margin-top: 0; }
.hours { display: flex; align-items: flex-end; gap: 3px; height: 70px; border-bottom: 1px solid var(--line); padding-bottom: 2px; margin-bottom: 22px; }
.hour { flex: 1; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; height: 100%; position: relative; }
.hour-bar { display: block; width: 100%; max-width: 18px; background: var(--series); border-radius: 4px 4px 0 0; }
.hour-label { position: absolute; bottom: -18px; font-size: .68rem; color: var(--muted); white-space: nowrap; }
