/* Flinkdink — deliberately small, no framework.
   Sizing is generous: the review screen is used by children, often on tablets. */

:root {
  --ink: #1c2431;
  --muted: #667085;
  --line: #e3e8ef;
  --bg: #f7f8fa;
  --panel: #ffffff;
  --brand: #3b6ef5;
  --brand-dark: #2b55c8;
  --good: #17915c;
  --good-bg: #e8f7f0;
  --bad: #c0392b;
  --bad-bg: #fdeceb;
  --radius: 12px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.55 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }

/* --- layout ------------------------------------------------------------ */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  gap: 1rem; padding: .85rem 1.5rem;
  background: var(--panel); border-bottom: 1px solid var(--line);
}
.brand { font-weight: 700; font-size: 1.15rem; color: var(--ink); letter-spacing: -.02em; }
.topbar nav { display: flex; gap: 1.25rem; align-items: center; }

.wrap { max-width: 1000px; margin: 2rem auto; padding: 0 1.25rem; }
.wrap.narrow { max-width: 620px; }

.page-head {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 1rem; flex-wrap: wrap; margin-bottom: 1.5rem;
}
.page-head h1 { margin: 0; }
.actions { display: flex; gap: .6rem; align-items: center; flex-wrap: wrap; }

h1 { font-size: 1.75rem; letter-spacing: -.02em; }
h2 { font-size: 1.15rem; margin-top: 0; }
h3 { font-size: .95rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }

.grid { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }
.grid.two { grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); }

.card {
  background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 1.25rem; margin-bottom: 1rem;
}
.card.empty { text-align: center; color: var(--muted); }

.muted { color: var(--muted); }
.small { font-size: .85rem; }
.tag {
  display: inline-block; padding: .1rem .5rem; border-radius: 99px;
  background: var(--bg); border: 1px solid var(--line);
  font-size: .75rem; color: var(--muted);
}

/* --- controls ---------------------------------------------------------- */
.button {
  display: inline-block; padding: .6rem 1.1rem; border: 1px solid transparent;
  border-radius: 9px; background: var(--brand); color: #fff;
  font: inherit; font-weight: 600; cursor: pointer; text-align: center;
}
.button:hover { background: var(--brand-dark); text-decoration: none; }
.button.ghost { background: var(--panel); color: var(--ink); border-color: var(--line); }
.button.ghost:hover { background: var(--bg); }
.button.small { padding: .35rem .75rem; font-size: .9rem; }

.link { background: none; border: 0; padding: 0; font: inherit; color: var(--brand); cursor: pointer; }
.link.danger, .danger { color: var(--bad); }

.field { margin-bottom: 1rem; }
.field label { display: block; font-weight: 600; margin-bottom: .3rem; font-size: .9rem; }
.field input[type=text], .field input[type=password], .field input[type=email],
.field input[type=date], .field input[type=number], .field textarea, .field select {
  width: 100%; padding: .55rem .7rem; font: inherit;
  border: 1px solid var(--line); border-radius: 9px; background: var(--panel); color: var(--ink);
}
.field textarea { min-height: 5rem; resize: vertical; }
.field .hint { margin: .3rem 0 0; font-size: .85rem; color: var(--muted); }
.field .error { margin: .3rem 0 0; font-size: .85rem; color: var(--bad); }
.check { display: flex; gap: .5rem; align-items: center; margin-bottom: 1rem; }
.card-image-preview { display: block; max-width: 240px; border-radius: 9px; margin-bottom: .5rem; }
.inline-form { border-top: 1px solid var(--line); margin-top: 1rem; padding-top: 1rem; }

/* --- flashes ----------------------------------------------------------- */
.flashes { margin-bottom: 1.25rem; }
.flash { padding: .7rem 1rem; border-radius: 9px; margin-bottom: .5rem; border: 1px solid var(--line); background: var(--panel); }
.flash-success { background: var(--good-bg); border-color: #b7e4cd; color: var(--good); }
.flash-danger  { background: var(--bad-bg);  border-color: #f5c4bf; color: var(--bad); }
.flash-warning { background: #fff7e6; border-color: #f6dfae; color: #8a6100; }

/* --- students ---------------------------------------------------------- */
.avatar { font-size: 1.6rem; line-height: 1; }
.student-head { display: flex; gap: .75rem; align-items: center; margin-bottom: .75rem; }
.student-head h2 { margin: 0; font-size: 1.1rem; }
.student-head p { margin: 0; font-size: .85rem; }

.counters { display: flex; gap: 1.5rem; list-style: none; padding: 0; margin: 0 0 1rem; }
.counters.wide { flex-wrap: wrap; gap: 1.75rem; }
.counters li { display: flex; flex-direction: column; }
.counters strong { font-size: 1.5rem; line-height: 1.1; }
.counters span { font-size: .78rem; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.done { color: var(--good); font-weight: 600; }

.list { list-style: none; padding: 0; margin: 0; }
.list li {
  display: flex; justify-content: space-between; align-items: center; gap: 1rem;
  padding: .6rem 0; border-bottom: 1px solid var(--line);
}
.list li p { margin: .1rem 0 0; font-size: .85rem; }

.deck-list li { padding: .75rem 0; }
.deck-row { display: flex; justify-content: space-between; align-items: center; gap: 1rem; width: 100%; flex-wrap: wrap; }
.deck-meta { min-width: 0; }
.deck-actions { display: flex; align-items: center; gap: .75rem; }
.link.small { font-size: .85rem; }

/* --- xp & levels --------------------------------------------------------- */
.level-badge { display: flex; align-items: center; gap: .5rem; }
.level-num {
  font-size: .78rem; font-weight: 700; color: var(--brand);
  background: #eaf0fe; border-radius: 99px; padding: .1rem .55rem; white-space: nowrap;
}
.level-bar { width: 90px; height: 6px; border-radius: 99px; background: var(--line); overflow: hidden; }
.level-bar-fill { height: 100%; background: var(--brand); transition: width .25s ease; }
.level-summary { display: flex; justify-content: center; margin: 1rem 0; }
.level-summary .level-bar { width: 160px; }
.xp-pill {
  display: inline-block; font-size: .78rem; font-weight: 700; color: var(--good);
  background: var(--good-bg); border-radius: 99px; padding: .1rem .55rem; margin-left: .4rem;
}
.level-up { text-align: center; font-weight: 700; color: var(--brand); margin: 0 0 1rem; }

/* --- strength bar ------------------------------------------------------ */
.bar { display: flex; height: 12px; border-radius: 99px; overflow: hidden; background: var(--line); margin-bottom: .6rem; }
.seg-new { background: #cbd5e1; }
.seg-learning { background: #f6a623; }
.seg-familiar { background: #4a9df5; }
.seg-mastered { background: var(--good); }
.legend { display: flex; flex-wrap: wrap; gap: 1rem; list-style: none; padding: 0; margin: 0; font-size: .82rem; color: var(--muted); }
.legend li { display: flex; align-items: center; gap: .35rem; text-transform: capitalize; }
.dot { width: 9px; height: 9px; border-radius: 99px; display: inline-block; }
.dot-new { background: #cbd5e1; }
.dot-learning { background: #f6a623; }
.dot-familiar { background: #4a9df5; }
.dot-mastered { background: var(--good); }

/* --- tables ------------------------------------------------------------ */
.table { width: 100%; border-collapse: collapse; font-size: .92rem; }
.table th { text-align: left; font-size: .78rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); padding-bottom: .5rem; }
.table td { padding: .55rem 0; border-top: 1px solid var(--line); vertical-align: top; }
.row-actions { display: flex; gap: .75rem; justify-content: flex-end; }
.type-buttons { display: flex; flex-wrap: wrap; gap: .5rem; }

/* --- review ------------------------------------------------------------ */
.review-head { display: flex; align-items: center; gap: .6rem; margin-bottom: 1rem; }
.review-head form { margin-left: auto; }

.progress { height: 6px; border-radius: 99px; background: var(--line); overflow: hidden; }
.progress-bar { height: 100%; background: var(--brand); transition: width .25s ease; }
.progress-text { margin: .4rem 0 1rem; font-size: .82rem; }

.question, .answer { padding: 1.75rem; }
.prompt { font-size: 1.6rem; font-weight: 600; line-height: 1.35; margin: 0 0 1.25rem; }
.card-image { max-width: 100%; border-radius: 9px; margin-bottom: 1rem; }

.answer-input {
  width: 100%; padding: .8rem 1rem; font-size: 1.25rem; margin-bottom: 1rem;
  border: 2px solid var(--line); border-radius: 10px; font-family: inherit;
}
.answer-input:focus { outline: none; border-color: var(--brand); }

.choices { display: grid; gap: .6rem; }
.choices.two-up { grid-template-columns: 1fr 1fr; }
.choice { font-size: 1.05rem; padding: .85rem 1rem; text-align: left; }
.choice.static {
  border: 1px solid var(--line); border-radius: 9px; background: var(--panel);
  display: flex; justify-content: space-between; align-items: center;
}
.choice.is-answer { background: var(--good-bg); border-color: #b7e4cd; color: var(--good); font-weight: 600; }
.choice.is-picked { background: var(--bad-bg); border-color: #f5c4bf; color: var(--bad); }
.mark { font-weight: 700; }

.reveal { margin-bottom: 1.25rem; }
.reveal summary { cursor: pointer; color: var(--brand); font-weight: 600; }
.reveal-text { font-size: 1.35rem; font-weight: 600; margin: .75rem 0 0; }
.hint-box { margin-top: 1rem; font-size: .9rem; color: var(--muted); }
.hint-box summary { cursor: pointer; }

.answer.is-correct { border-color: #b7e4cd; }
.answer.is-wrong { border-color: #f5c4bf; }
.verdict { font-weight: 700; margin: 0 0 1rem; }
.is-correct .verdict { color: var(--good); }
.is-wrong .verdict { color: var(--bad); }
.answer-text { font-size: 1.35rem; font-weight: 600; margin: .5rem 0 1rem; }
.given { margin: 0 0 .5rem; }
.finished { text-align: center; }
.finished .button { margin: .35rem .25rem 0; }

@media (max-width: 560px) {
  .wrap { margin: 1.25rem auto; }
  .prompt { font-size: 1.35rem; }
  .choices.two-up { grid-template-columns: 1fr; }
  .counters { gap: 1.1rem; }
  .review-head .level-bar { width: 50px; }
}
