:root {
  --bg: #fdf8f1;
  --bg2: #f6ecdd;
  --card: #ffffff;
  --text: #2b2118;
  --muted: #8a7a6a;
  --accent: #f59e0b;
  --accent-dark: #d97706;
  --night: #1e1b4b;
  --night2: #312e81;
  --ok: #16a34a;
  --bad: #e11d48;
  --warn: #f59e0b;
  --line: #eadfce;
  --radius: 18px;
  --shadow: 0 6px 20px rgba(80, 50, 20, .08);
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; -webkit-text-size-adjust: 100%; }
body {
  font-family: "Nunito", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 18px;
  line-height: 1.45;
  min-height: 100vh;
}
a { color: var(--accent-dark); text-decoration: none; }

/* header */
.top {
  position: sticky; top: 0; z-index: 10;
  display: flex; justify-content: space-between; align-items: center;
  padding: max(12px, env(safe-area-inset-top)) 18px 12px;
  background: linear-gradient(135deg, var(--night), var(--night2));
  color: #fff;
  box-shadow: 0 2px 12px rgba(30, 27, 75, .25);
}
.top a { color: #fff; }
.top .brand { font-weight: 800; font-size: 19px; letter-spacing: .2px; }
.top .brand::before { content: "🌙 "; }
.top nav a { margin-left: 14px; opacity: .8; font-weight: 600; font-size: 15px; }

.app { max-width: 720px; margin: 0 auto; padding: 18px 16px calc(28px + env(safe-area-inset-bottom)); }
h1 { font-size: 28px; font-weight: 800; margin: 6px 0 16px; }
h2 { font-size: 15px; font-weight: 800; text-transform: uppercase; letter-spacing: .8px; color: var(--muted); margin: 26px 0 10px; }
.muted { color: var(--muted); }

/* carduri */
.card {
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 18px; margin-bottom: 14px;
  box-shadow: var(--shadow);
}
.card.link { display: block; color: inherit; transition: transform .1s; }
.card.link:active { transform: scale(.98); }
.card.collection { display: flex; align-items: center; gap: 14px; border-left: 6px solid var(--c, var(--accent)); }
.card.collection .icon {
  width: 52px; height: 52px; flex: none; border-radius: 14px;
  display: flex; align-items: center; justify-content: center; font-size: 28px;
  background: color-mix(in srgb, var(--c, var(--accent)) 12%, #fff);
}
.card.collection .body { flex: 1; min-width: 0; }
.card.collection .title { font-weight: 800; font-size: 19px; }
.card.collection .desc { font-size: 14px; color: var(--muted); }
.card.collection .count { font-size: 14px; color: var(--muted); font-weight: 700; white-space: nowrap; }
.card.collection .bar > i { background: var(--c, var(--accent)); }
.card.collection.compact { padding: 12px 14px; margin-bottom: 10px; border-left-width: 4px; }
.card.collection.compact .icon { width: 42px; height: 42px; font-size: 22px; border-radius: 12px; }
.card.collection.compact .title { font-size: 17px; }
.card.collection.compact .bar { height: 6px; margin-top: 6px; }

.hero {
  background: linear-gradient(135deg, #fde68a, #fbbf24);
  border: none; color: #3b2a04;
}
.hero .muted { color: #7a5a10; }

.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.row.between { justify-content: space-between; }
.stack > * + * { margin-top: 10px; }

/* butoane */
.btn {
  -webkit-tap-highlight-color: transparent; touch-action: manipulation; min-height: 50px;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: none; border-radius: 14px;
  padding: 12px 20px; font-size: 18px; font-weight: 800; font-family: inherit;
  background: var(--night2); color: #fff; cursor: pointer; text-align: center;
  box-shadow: 0 4px 0 rgba(0,0,0,.18);
  transition: transform .08s, box-shadow .08s;
}
.btn:active { transform: translateY(3px); box-shadow: 0 1px 0 rgba(0,0,0,.18); }
.btn.big { width: 100%; padding: 20px; font-size: 22px; min-height: 64px; }
.btn.primary { background: linear-gradient(135deg, var(--accent), var(--accent-dark)); color: #fff; }
.btn.ok { background: var(--ok); }
.btn.bad { background: var(--bad); }
.btn.warn { background: var(--warn); color: #3b2a04; }
.btn.ghost { background: #fff; color: var(--text); border: 1.5px solid var(--line); box-shadow: none; }
.btn.ghost:active { transform: none; background: var(--bg2); }
.btn.small { padding: 8px 12px; font-size: 14px; font-weight: 700; min-height: 40px; border-radius: 10px; }
.btn:disabled { opacity: .4; cursor: default; transform: none; }
.btn.half { flex: 1; }

/* formular */
label { display: block; font-weight: 800; font-size: 14px; text-transform: uppercase; letter-spacing: .5px; color: var(--muted); margin-bottom: 6px; }
select, input[type=number] {
  width: 100%; font-size: 18px; font-family: inherit; padding: 12px 14px; border-radius: 12px;
  border: 1.5px solid var(--line); background: #fff; color: var(--text);
}
.field { margin-bottom: 16px; }
.modes { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.mode {
  border: 2px solid var(--line); border-radius: 14px; padding: 12px 8px; text-align: center; cursor: pointer;
  background: #fff; font-family: inherit; color: var(--text);
}
.mode .ic { font-size: 24px; display: block; }
.mode .nm { font-weight: 800; font-size: 15px; display: block; margin-top: 4px; }
.mode .ds { font-size: 12px; color: var(--muted); display: block; }
.mode.active { border-color: var(--accent); background: #fffbeb; }

.tag {
  display: inline-block; font-size: 12px; font-weight: 800; text-transform: uppercase; letter-spacing: .5px;
  padding: 4px 10px; border-radius: 999px; background: var(--bg2); color: var(--muted); margin-right: 6px;
}
.tag.tip { background: #ede9fe; color: #5b21b6; }
.bar { height: 8px; background: var(--bg2); border-radius: 999px; overflow: hidden; margin-top: 8px; }
.bar > i { display: block; height: 100%; background: var(--accent); border-radius: 999px; transition: width .4s; }

/* joc */
.progress-line { height: 6px; background: var(--bg2); border-radius: 999px; overflow: hidden; margin: 4px 0 16px; }
.progress-line > i { display: block; height: 100%; background: linear-gradient(90deg, var(--accent), var(--accent-dark)); }
.question { font-size: 28px; font-weight: 800; line-height: 1.3; margin: 12px 0 20px; }
.options { list-style: none; padding: 0; margin: 0 0 18px; }
.options li {
  padding: 14px 16px; border: 2px solid var(--line); border-radius: 14px;
  margin-bottom: 10px; font-size: 21px; font-weight: 700; background: #fff;
  display: flex; align-items: center; gap: 12px;
}
.options li::before {
  content: attr(data-letter); flex: none; width: 34px; height: 34px; border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  background: var(--bg2); color: var(--muted); font-size: 15px; font-weight: 800;
}
.options li.correct { border-color: var(--ok); background: #f0fdf4; }
.options li.correct::before { content: "✓"; background: var(--ok); color: #fff; }
.answer { border: 2px solid #bbf7d0; padding: 14px 16px; background: #f0fdf4; border-radius: 14px; margin-bottom: 16px; }
.answer .main { font-size: 24px; font-weight: 800; color: #14532d; }
.answer .main::first-letter { text-transform: uppercase; }
.answer .explain { margin-top: 8px; }
.answer .source { font-size: 13px; color: var(--muted); margin-top: 8px; }
.helper { background: #fffbeb; border: 2px solid #fde68a; border-radius: 14px; padding: 12px 16px; margin-bottom: 16px; }
.helper ul { margin: 6px 0 0; padding-left: 20px; }
.counter { font-size: 14px; font-weight: 800; color: var(--muted); }
.tools { display: flex; justify-content: space-between; gap: 8px; flex-wrap: wrap; margin-top: 20px; padding-top: 14px; border-top: 1px dashed var(--line); }

/* liste */
.result-list { list-style: none; padding: 0; margin: 0; }
.result-list li { padding: 12px 0; border-bottom: 1px solid var(--line); }
.result-list li:last-child { border-bottom: none; }
.result-list .q { font-weight: 700; }
.res { font-weight: 800; }
.res.corect { color: var(--ok); }
.res.gresit { color: var(--bad); }
.res.discutat { color: var(--accent-dark); }
.score { display: flex; gap: 10px; margin-top: 10px; }
.score > div { flex: 1; text-align: center; border-radius: 14px; padding: 12px 6px; background: var(--bg2); }
.score .n { font-size: 30px; font-weight: 800; line-height: 1; }
.score .l { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .5px; color: var(--muted); margin-top: 4px; }
.score .ok .n { color: var(--ok); }
.score .bad .n { color: var(--bad); }
.stat { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.stat .ic { font-size: 22px; width: 30px; text-align: center; }
.stat .body { flex: 1; }
.hidden { display: none; }
textarea { width: 100%; min-height: 120px; font-family: monospace; font-size: 13px; border-radius: 10px; border: 1.5px solid var(--line); }

@media (max-width: 480px) {
  body { font-size: 17px; }
  h1 { font-size: 24px; }
  .question { font-size: 24px; }
  .options li { font-size: 18px; padding: 12px 14px; }
  .answer .main { font-size: 21px; }
  .card { padding: 15px; }
  .top { padding-left: 14px; padding-right: 14px; }
  .top nav a { margin-left: 12px; }
  .mode .ds { display: none; }
}

/* calupuri */
.calupuri { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 10px; }
.calup {
  display: flex; align-items: center; gap: 12px; text-align: left; font-family: inherit; color: var(--text);
  background: var(--card); border: 1.5px solid var(--line); border-radius: 14px; padding: 12px;
  cursor: pointer; box-shadow: var(--shadow); -webkit-tap-highlight-color: transparent;
}
.calup:active { transform: scale(.98); }
.calup .nr {
  flex: none; width: 40px; height: 40px; border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 17px;
  background: color-mix(in srgb, var(--c) 14%, #fff); color: var(--c);
}
.calup .info { flex: 1; min-width: 0; }
.calup .t { display: block; font-weight: 800; font-size: 16px; }
.calup .s { display: block; font-size: 13px; color: var(--muted); }
.calup .bar { display: block; height: 6px; margin-top: 6px; }
.calup.done { background: #f6fdf8; border-color: #bbf7d0; }
.calup.done .nr { background: var(--ok); color: #fff; }
.mode:disabled { opacity: .45; cursor: default; }
@media (max-width: 480px) { .calupuri { grid-template-columns: 1fr 1fr; } .calup { flex-direction: column; align-items: stretch; gap: 8px; } .calup .nr { width: 34px; height: 34px; font-size: 15px; } .calup .t { font-size: 15px; } }

/* asociere */
.pairs { display: flex; gap: 10px; margin-bottom: 18px; }
.pairs .col { flex: 1; display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.pairs .item {
  display: flex; align-items: center; gap: 10px;
  padding: 12px; border: 2px solid var(--line); border-radius: 14px;
  background: #fff; font-weight: 700; font-size: 17px; min-height: 58px;
}
.pairs .item.right { background: #fbfaff; border-color: #ddd6fe; }
.pairs .key {
  flex: none; width: 30px; height: 30px; border-radius: 9px;
  display: flex; align-items: center; justify-content: center;
  font-size: 14px; font-weight: 800; background: var(--bg2); color: var(--muted);
}
.pairs .item.right .key { background: #ede9fe; color: #5b21b6; }
.matched { display: flex; flex-direction: column; gap: 8px; margin-bottom: 18px; }
.matched .pair {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 12px 14px; border: 2px solid #bbf7d0; border-radius: 14px; background: #f0fdf4;
}
.matched .a { font-weight: 800; font-size: 18px; }
.matched .link { color: var(--ok); font-weight: 800; }
.matched .b { font-weight: 700; font-size: 18px; color: #14532d; }

/* ordonare */
.steps { display: flex; flex-direction: column; gap: 8px; margin-bottom: 18px; }
.steps .step {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 14px; border: 2px solid var(--line); border-radius: 14px;
  background: #fff; font-weight: 700; font-size: 18px;
}
.steps .num {
  flex: none; width: 32px; height: 32px; border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 15px; font-weight: 800; background: var(--bg2); color: var(--muted);
}
.steps.shuffled .step { border-style: dashed; }
.steps .step.done { border-color: #bbf7d0; background: #f0fdf4; }
.steps .step.done .num { background: var(--ok); color: #fff; }
.steps.ordered .step + .step { position: relative; }
.steps.ordered .step + .step::before {
  content: "↓"; position: absolute; top: -17px; left: 15px;
  color: var(--ok); font-weight: 800; font-size: 14px;
}
@media (max-width: 480px) {
  .pairs .item { font-size: 15px; padding: 10px; gap: 8px; }
  .pairs .key { width: 26px; height: 26px; font-size: 13px; }
  .steps .step, .matched .a, .matched .b { font-size: 16px; }
}

/* estimare */
.estim { margin-bottom: 18px; }
.estim .target {
  display: flex; align-items: baseline; justify-content: center; gap: 8px; flex-wrap: wrap;
  border: 2px solid #bbf7d0; background: #f0fdf4; border-radius: 14px; padding: 16px 14px;
}
.estim .target .pre { font-size: 15px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .5px; }
.estim .target .nr { font-size: 40px; font-weight: 800; color: #14532d; line-height: 1; }
.estim .target .un { font-size: 20px; font-weight: 700; color: #14532d; }
.estim .range { margin-top: 14px; padding: 0 4px; }
.estim .track {
  position: relative; height: 12px; border-radius: 999px;
  background: linear-gradient(90deg, #fde68a, #86efac, #fde68a);
}
.estim .track > i {
  position: absolute; top: 50%; width: 18px; height: 18px; border-radius: 50%;
  background: var(--ok); border: 3px solid #fff; box-shadow: 0 1px 4px rgba(0,0,0,.25);
  transform: translate(-50%, -50%);
}
.estim .ends { display: flex; justify-content: space-between; font-weight: 800; font-size: 15px; margin-top: 6px; color: var(--muted); }
.estim .lbl { text-align: center; font-size: 13px; color: var(--muted); margin-top: 2px; }

/* întrebări fără răspuns corect */
.scop {
  border: 2px dashed #c4b5fd; background: #faf7ff; border-radius: 14px;
  padding: 12px 16px; margin-bottom: 16px;
}
.scop strong { display: block; color: #5b21b6; font-size: 17px; }
.scop div { font-size: 15px; color: var(--muted); margin-top: 2px; }
.helper strong { display: block; margin-bottom: 4px; }
.helper li { margin-bottom: 4px; }
