/* Curs Scratch pentru începători — stil comun */
:root {
  --bg: #f4f7fb;
  --card: #ffffff;
  --ink: #1f2a44;
  --ink-soft: #5a6785;
  --line: #dde3ee;
  --accent: #4c6fff;
  --accent-soft: #e8edff;
  --good: #1fa463;
  --good-soft: #e3f6ec;
  --bad: #e5484d;
  --bad-soft: #fdecec;
  --warn: #f5a524;
  --radius: 16px;
  --shadow: 0 2px 10px rgba(31, 42, 68, .08);

  /* culorile categoriilor de blocuri, ca în Scratch 3 */
  --c-motion: #4c97ff;   --c-motion-d: #3373cc;
  --c-looks: #9966ff;    --c-looks-d: #774dcb;
  --c-sound: #cf63cf;    --c-sound-d: #bd42bd;
  --c-events: #ffbf00;   --c-events-d: #cc9900;
  --c-control: #ffab19;  --c-control-d: #cf8b17;
  --c-sensing: #5cb1d6;  --c-sensing-d: #2e8eb8;
  --c-operators: #59c059;--c-operators-d: #389438;
  --c-variables: #ff8c1a;--c-variables-d: #db6e00;
  --c-robot: #0fbd8c;    --c-robot-d: #0b8e69;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: "Segoe UI", "Trebuchet MS", system-ui, -apple-system, Roboto, Arial, sans-serif;
  background: var(--bg);
  color: var(--ink);
  font-size: 18px;
  line-height: 1.5;
}
a { color: var(--accent); }
h1, h2, h3 { line-height: 1.2; margin: 0 0 .5em; }
h1 { font-size: 1.9rem; }
h2 { font-size: 1.45rem; }
h3 { font-size: 1.15rem; }
p { margin: 0 0 .75em; }
button { font: inherit; cursor: pointer; }
.hidden { display: none !important; }

/* ---------- bara de sus ---------- */
.topbar {
  display: flex; align-items: center; gap: 14px;
  padding: 10px 22px; background: var(--card);
  border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 20;
}
.topbar .brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 1.1rem; color: var(--ink); text-decoration: none; }
.topbar .brand svg { width: 40px; height: 40px; }
.topbar .spacer { flex: 1; }
.topbar .chip { background: var(--accent-soft); color: var(--accent); border-radius: 999px; padding: 4px 12px; font-size: .9rem; font-weight: 600; }
.iconbtn { background: none; border: 1px solid var(--line); border-radius: 10px; padding: 6px 10px; color: var(--ink-soft); }
.iconbtn:hover { background: var(--accent-soft); }

main { max-width: 1240px; margin: 0 auto; padding: 22px; }

/* ---------- butoane ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  border: none; border-radius: 12px; padding: 12px 22px;
  font-weight: 700; font-size: 1.05rem; background: var(--accent); color: #fff;
  box-shadow: 0 3px 0 rgba(0,0,0,.15); text-decoration: none;
  transition: transform .08s;
}
.btn:active { transform: translateY(2px); box-shadow: 0 1px 0 rgba(0,0,0,.15); }
.btn:disabled { background: #b8c1d6; cursor: not-allowed; box-shadow: none; }
.btn.secondary { background: var(--card); color: var(--ink); border: 2px solid var(--line); box-shadow: none; }
.btn.good { background: var(--good); }
.btn.small { padding: 7px 14px; font-size: .95rem; }
.btn.flag { background: #3fb44f; }
.btn.stop { background: var(--bad); }

.card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 22px; }
.row { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; }
.muted { color: var(--ink-soft); }
.center { text-align: center; }

/* ---------- vorbire (TTS) ---------- */
.say-btn { border: none; background: var(--accent-soft); color: var(--accent); border-radius: 50%; width: 32px; height: 32px; font-size: 15px; margin-left: 6px; vertical-align: middle; flex: none; }
.say-btn:hover { background: var(--accent); color: #fff; }
.no-voice .say-btn { display: none; }

/* ---------- mascota și bula ---------- */
.mascot-line { display: flex; gap: 16px; align-items: flex-start; margin: 10px 0 18px; }
.mascot-line .robi { width: 92px; height: 92px; flex: none; }
.bubble {
  position: relative; background: var(--card); border: 2px solid var(--line);
  border-radius: 18px; padding: 14px 18px; flex: 1; box-shadow: var(--shadow);
}
.bubble::before {
  content: ""; position: absolute; left: -12px; top: 28px; width: 20px; height: 20px;
  background: var(--card); border-left: 2px solid var(--line); border-bottom: 2px solid var(--line);
  transform: rotate(45deg);
}
.bubble p:last-child { margin-bottom: 0; }

/* ---------- blocuri în stil Scratch ---------- */
.blk {
  --c: var(--c-motion); --cd: var(--c-motion-d);
  position: relative; display: inline-flex; align-items: center; flex-wrap: nowrap; gap: 6px;
  background: var(--c); color: #fff; border: 1px solid var(--cd);
  border-radius: 6px; padding: 8px 12px 8px 12px; min-height: 40px;
  font-size: 15px; font-weight: 600; white-space: nowrap; user-select: none;
  margin-top: 6px;
}
/* „crestătura” de sus și „dintele” de jos */
.blk::before {
  content: ""; position: absolute; top: -1px; left: 16px; width: 24px; height: 6px;
  background: var(--bg-under, #fff); border: 1px solid var(--cd); border-top: none;
  border-radius: 0 0 6px 6px;
}
.blk::after {
  content: ""; position: absolute; bottom: -7px; left: 16px; width: 24px; height: 7px;
  background: var(--c); border: 1px solid var(--cd); border-top: none;
  border-radius: 0 0 6px 6px; z-index: 1;
}
.blk.hat { border-radius: 22px 22px 6px 6px; padding-top: 14px; margin-top: 0; }
.blk.hat::before { display: none; }
.blk.cap::after { display: none; }
.blk .inp {
  background: #fff; color: #575e75; border-radius: 999px; padding: 1px 10px; min-width: 30px;
  text-align: center; font-weight: 600; border: 1px solid rgba(0,0,0,.12);
}
.blk input.inp { width: 74px; font: inherit; font-weight: 600; outline: none; -moz-appearance: textfield; appearance: textfield; }
.blk input.inp::-webkit-outer-spin-button, .blk input.inp::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.blk input.inp.txt { width: 110px; border-radius: 6px; }
.blk input.inp:focus { box-shadow: 0 0 0 2px #fff, 0 0 0 4px var(--cd); }
.blk .flagicon { width: 22px; height: 22px; vertical-align: middle; }
.blk.cat-motion { --c: var(--c-motion); --cd: var(--c-motion-d); }
.blk.cat-looks { --c: var(--c-looks); --cd: var(--c-looks-d); }
.blk.cat-sound { --c: var(--c-sound); --cd: var(--c-sound-d); }
.blk.cat-events { --c: var(--c-events); --cd: var(--c-events-d); }
.blk.cat-control { --c: var(--c-control); --cd: var(--c-control-d); }
.blk.cat-sensing { --c: var(--c-sensing); --cd: var(--c-sensing-d); }
.blk.cat-operators { --c: var(--c-operators); --cd: var(--c-operators-d); }
.blk.cat-variables { --c: var(--c-variables); --cd: var(--c-variables-d); }
.blk.cat-robot { --c: var(--c-robot); --cd: var(--c-robot-d); }
.blk.running { filter: drop-shadow(0 0 6px #ffe36e) drop-shadow(0 0 3px #ffd000); }
.blk.wrongpick { outline: 3px solid var(--bad); outline-offset: 2px; }
.blk.rightpick { outline: 3px solid var(--good); outline-offset: 2px; }

.script { display: flex; flex-direction: column; align-items: flex-start; }
.script .blk { margin-top: 0; }
.script .blk + .blk { margin-top: 0; }

/* ---------- simulator ---------- */
.sim { display: grid; grid-template-columns: 290px minmax(300px, 1fr) 420px; gap: 16px; align-items: start; }
.sim .panel { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 14px; }
.sim .panel h3 { font-size: 1rem; color: var(--ink-soft); text-transform: uppercase; letter-spacing: .04em; margin-bottom: 10px; }
.sim .palette { display: flex; flex-direction: column; align-items: flex-start; gap: 10px; --bg-under: #fff; min-height: 300px; }
.sim .palette .blk { cursor: grab; touch-action: none; }
.sim .palette.drop-delete { outline: 3px dashed var(--bad); outline-offset: -6px; }
.sim .code { min-height: 380px; position: relative; display: flex; flex-direction: column; --bg-under: #f7f8fc; background: #f7f8fc; border-radius: 12px; padding: 14px; border: 2px dashed var(--line); }
.sim .code.over { border-color: var(--accent); }
.sim .code .script .blk:not(.hat) { cursor: grab; touch-action: none; }
.sim .code .hint { margin-top: auto; padding-top: 16px; font-size: .85rem; color: var(--ink-soft); }
.sim .insert-line { height: 4px; width: 200px; background: var(--accent); border-radius: 2px; margin: 2px 0; }
.sim .stage-wrap { position: relative; }
.sim canvas.stage { width: 100%; aspect-ratio: 4 / 3; border-radius: 12px; border: 2px solid var(--line); background: #fff; display: block; }
.sim .stage-bar { display: flex; gap: 8px; margin-bottom: 8px; align-items: center; }
.sim .coords { margin-left: auto; font-size: .85rem; color: var(--ink-soft); font-variant-numeric: tabular-nums; }
.sim .goal { margin-top: 10px; background: var(--accent-soft); border-radius: 12px; padding: 10px 14px; font-size: .95rem; }
.sim .feedback { margin-top: 10px; border-radius: 12px; padding: 10px 14px; font-weight: 600; }
.sim .feedback.ok { background: var(--good-soft); color: #11734a; }
.sim .feedback.no { background: var(--bad-soft); color: #a32025; }
.drag-ghost { position: fixed; pointer-events: none; z-index: 1000; opacity: .9; transform: rotate(2deg); }

.levels { display: flex; gap: 8px; margin-bottom: 14px; flex-wrap: wrap; align-items: center; }
.levels .lv { width: 38px; height: 38px; border-radius: 50%; border: 2px solid var(--line); background: var(--card); font-weight: 700; color: var(--ink-soft); }
.levels .lv.cur { border-color: var(--accent); color: var(--accent); }
.levels .lv.done { background: var(--good); border-color: var(--good); color: #fff; }

@media (max-width: 1100px) {
  .sim { grid-template-columns: 260px 1fr; }
  .sim .stage-col { grid-column: 1 / -1; max-width: 520px; }
}

/* ---------- lecția ---------- */
.lesson-head { display: flex; align-items: center; gap: 16px; margin-bottom: 14px; }
.steps-dots { display: flex; gap: 6px; flex-wrap: wrap; }
.steps-dots span { width: 34px; height: 8px; border-radius: 4px; background: var(--line); }
.steps-dots span.done { background: var(--good); }
.steps-dots span.cur { background: var(--accent); }
.step-title { display: flex; align-items: center; gap: 10px; }
.step-kicker { font-size: .85rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--accent); }
.nav-row { display: flex; justify-content: space-between; margin-top: 20px; gap: 12px; }

.quick-q { margin: 12px 0; }
.opts { display: grid; gap: 10px; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); margin-top: 10px; }
.opts .blk, .sim .palette .blk, .sim .code .blk { flex-wrap: wrap; white-space: normal; max-width: 100%; }
.opt {
  background: var(--card); border: 2px solid var(--line); border-radius: 14px; padding: 12px 14px;
  text-align: left; display: flex; align-items: center; gap: 10px; min-height: 58px; --bg-under: #fff;
}
.opt:hover:not(:disabled) { border-color: var(--accent); }
.opt.correct { border-color: var(--good); background: var(--good-soft); }
.opt.wrong { border-color: var(--bad); background: var(--bad-soft); }
.opt:disabled { cursor: default; }
.opt .blk { margin-top: 0; }

.checklist { list-style: none; padding: 0; margin: 10px 0; }
.checklist li { display: flex; gap: 12px; align-items: flex-start; padding: 12px 14px; border: 2px solid var(--line); border-radius: 14px; margin-bottom: 10px; background: var(--card); --bg-under: #fff; }
.checklist li.done { border-color: var(--good); background: var(--good-soft); }
.checklist input[type=checkbox] { width: 26px; height: 26px; flex: none; margin-top: 2px; accent-color: var(--good); }
.checklist .blk { margin: 6px 0 0; }

.cards3 { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 14px; }
.cards3 .card { border-top: 6px solid var(--accent); }

.callout { border-radius: 14px; padding: 12px 16px; background: #fff7e6; border: 2px solid #ffe2a8; margin: 12px 0; }
.callout.parent { background: #eef6ff; border-color: #cfe3ff; }
.callout b:first-child { display: block; margin-bottom: 4px; }

.vocab { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 10px; margin: 12px 0; }
.vocab div { background: var(--card); border: 2px solid var(--line); border-radius: 12px; padding: 10px 12px; }
.vocab b { color: var(--accent); }

/* hotspots */
.hotspots { display: grid; grid-template-columns: 1fr 320px; gap: 18px; align-items: start; }
.hotspots svg { width: 100%; height: auto; background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); }
.hotspots .hs { cursor: pointer; }
.hotspots .hs .dot { fill: var(--accent); }
.hotspots .hs.seen .dot { fill: var(--good); }
.hotspots .hs:hover rect.zone { stroke: var(--accent); stroke-width: 3; }
.hotspots .info { position: sticky; top: 80px; }
@media (max-width: 900px) { .hotspots { grid-template-columns: 1fr; } }

/* jocul coordonatelor */
.coordgame { display: grid; grid-template-columns: 480px 1fr; gap: 18px; align-items: start; }
.coordgame canvas { width: 100%; aspect-ratio: 4/3; background: #fff; border-radius: 12px; border: 2px solid var(--line); cursor: crosshair; }
@media (max-width: 900px) { .coordgame { grid-template-columns: 1fr; } }

/* ---------- test ---------- */
.quiz { max-width: 860px; margin: 0 auto; }
.qbar { height: 12px; background: var(--line); border-radius: 6px; overflow: hidden; margin: 8px 0 18px; }
.qbar div { height: 100%; background: var(--accent); width: 0; transition: width .3s; }
.qtext { font-size: 1.3rem; font-weight: 700; display: flex; align-items: flex-start; gap: 8px; }
.qscript { background: #f7f8fc; border-radius: 12px; padding: 14px; margin: 12px 0; display: inline-block; --bg-under: #f7f8fc; }
.qscript .blk.clickable { cursor: pointer; }
.qscript .blk.clickable:hover { filter: brightness(1.08); outline: 2px dashed var(--ink); outline-offset: 2px; }
.order-list { list-style: none; padding: 0; margin: 12px 0; }
.order-list li { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border: 2px solid var(--line); border-radius: 12px; margin-bottom: 8px; background: var(--card); --bg-under: #fff; }
.order-list li .num { font-weight: 800; color: var(--ink-soft); width: 22px; }
.order-list li .item { flex: 1; }
.order-list li.correct { border-color: var(--good); background: var(--good-soft); }
.order-list li.wrong { border-color: var(--bad); background: var(--bad-soft); }
.order-list .mv { width: 40px; height: 40px; border-radius: 10px; border: 2px solid var(--line); background: var(--card); font-size: 18px; }
.order-list .mv:disabled { opacity: .3; }
.match-row { display: flex; align-items: center; gap: 12px; padding: 10px; border: 2px solid var(--line); border-radius: 12px; margin-bottom: 10px; flex-wrap: wrap; background: var(--card); --bg-under: #fff; }
.match-row .left { min-width: 240px; }
.match-row.correct { border-color: var(--good); background: var(--good-soft); }
.match-row.wrong { border-color: var(--bad); background: var(--bad-soft); }
.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chipbtn { border: 2px solid var(--line); background: var(--card); border-radius: 999px; padding: 6px 14px; font-weight: 600; }
.chipbtn.sel { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); }
.chipbtn .sw { display: inline-block; width: 12px; height: 12px; border-radius: 50%; margin-right: 6px; vertical-align: -1px; }
.explain { margin-top: 16px; border-radius: 14px; padding: 14px 16px; }
.explain.ok { background: var(--good-soft); }
.explain.no { background: var(--bad-soft); }
.explain.retry { background: #fff7e6; }
.stars { font-size: 3rem; letter-spacing: 6px; }
.stars .off { opacity: .2; }
.badge { display: inline-flex; flex-direction: column; align-items: center; gap: 6px; }
.badge svg { width: 120px; height: 120px; }

/* ---------- harta ---------- */
.map-wrap { position: relative; }
.map-wrap svg.map { width: 100%; height: auto; display: block; }
.island { cursor: pointer; }
.island.locked { cursor: not-allowed; }
.island:not(.locked):hover .isl-top { filter: brightness(1.06); }
.modal-back { position: fixed; inset: 0; background: rgba(20, 28, 48, .45); display: flex; align-items: center; justify-content: center; z-index: 50; padding: 20px; }
.modal { background: var(--card); border-radius: 20px; padding: 26px; max-width: 560px; width: 100%; box-shadow: 0 20px 60px rgba(0,0,0,.25); }
.modal h2 { display: flex; align-items: center; gap: 10px; }
.status-line { display: flex; gap: 10px; flex-wrap: wrap; margin: 10px 0 18px; }
.pill { border-radius: 999px; padding: 4px 12px; font-size: .9rem; font-weight: 600; background: var(--line); color: var(--ink); }
.pill.good { background: var(--good-soft); color: #11734a; }
.pill.warn { background: #fff4dc; color: #8a5a00; }
.badges-row { display: flex; gap: 14px; flex-wrap: wrap; }
.badges-row .b { text-align: center; width: 92px; font-size: .8rem; color: var(--ink-soft); }
.badges-row .b svg { width: 72px; height: 72px; }
.badges-row .b.off svg { filter: grayscale(1); opacity: .35; }

/* ---------- formulare ---------- */
label.field { display: block; margin: 12px 0; font-weight: 600; }
label.field input, label.field select { display: block; margin-top: 6px; width: 100%; padding: 10px 12px; font: inherit; border: 2px solid var(--line); border-radius: 10px; }
.colors { display: flex; gap: 10px; margin-top: 8px; }
.colors button { width: 44px; height: 44px; border-radius: 50%; border: 3px solid transparent; }
.colors button.sel { border-color: var(--ink); }

/* ---------- pagina de părinte ---------- */
table.res { width: 100%; border-collapse: collapse; font-size: .95rem; }
table.res th, table.res td { text-align: left; padding: 10px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
table.res th { color: var(--ink-soft); font-weight: 600; }
details.guide { border: 2px solid var(--line); border-radius: 14px; padding: 12px 16px; margin-bottom: 12px; background: var(--card); }
details.guide summary { font-weight: 700; cursor: pointer; }
.pinbox { max-width: 360px; margin: 60px auto; text-align: center; }
.pinbox input { font-size: 2rem; letter-spacing: 12px; text-align: center; width: 200px; padding: 8px; border: 2px solid var(--line); border-radius: 12px; }

/* confetti */
.confetti { position: fixed; top: -12px; width: 10px; height: 14px; z-index: 2000; pointer-events: none; animation: fall linear forwards; }
@keyframes fall { to { transform: translateY(105vh) rotate(720deg); } }

@media print {
  .topbar, .no-print { display: none !important; }
  body { background: #fff; }
}

.qrbox svg { width: 100%; height: auto; display: block; border-radius: 8px; }
