:root {
  --bg: #fbf7f0;
  --paper: #ffffff;
  --ink: #2b2420;
  --muted: #7a6e64;
  --line: #eadfd2;
  --accent: #c2572b;
  --accent-soft: #fbe6da;
  --u1: #c2572b;
  --u1-soft: #fbe6da;
  --u2: #2f6f8f;
  --u2-soft: #dcecf4;
  --u3: #4f8a3a;
  --u3-soft: #e2f0dc;
  --gold: #d9a521;
  --gold-soft: #fbf0d1;
  --good: #2f8a4c;
  --good-soft: #dff3e5;
  --bad: #c23b3b;
  --bad-soft: #fbe1e1;
  --radius: 16px;
  --shadow: 0 2px 10px rgba(80, 50, 20, 0.07);
  --font: "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
  --serif: Georgia, "Palatino Linotype", Palatino, serif;
}

* { box-sizing: border-box; }
html { font-size: 17px; }
html.mare { font-size: 19px; }
html.foarte-mare { font-size: 21px; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  line-height: 1.6;
}
a { color: inherit; }
button { font: inherit; cursor: pointer; }
mark { background: var(--gold-soft); color: inherit; padding: 0 .2em; border-radius: 4px; }
b, strong { font-weight: 650; }

/* ---------- header ---------- */
.top {
  position: sticky; top: 0; z-index: 20;
  background: rgba(251, 247, 240, .92);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}
.top-in {
  max-width: 1080px; margin: 0 auto; padding: .6rem 1.2rem;
  display: flex; align-items: center; gap: 1rem; flex-wrap: wrap;
}
.logo { font-weight: 800; text-decoration: none; font-size: 1.1rem; display: flex; align-items: center; gap: .45rem; }
.logo span { font-size: 1.4rem; }
.nav { display: flex; gap: .3rem; flex-wrap: wrap; margin-left: auto; }
.nav a {
  text-decoration: none; padding: .35rem .7rem; border-radius: 999px; font-size: .9rem; color: var(--muted);
}
.nav a:hover, .nav a.on { background: var(--accent-soft); color: var(--accent); }
.fontbtn { border: 1px solid var(--line); background: var(--paper); border-radius: 999px; padding: .25rem .6rem; font-size: .85rem; color: var(--muted); }

main { max-width: 1080px; margin: 0 auto; padding: 1.5rem 1.2rem 4rem; }

/* ---------- home ---------- */
.hero {
  background: linear-gradient(135deg, #fff4e8, #fdeede 60%, #f9e3cf);
  border: 1px solid var(--line); border-radius: 22px; padding: 1.6rem 1.8rem;
  display: grid; grid-template-columns: 1fr auto; gap: 1.5rem; align-items: center;
}
.hero h1 { margin: 0 0 .3rem; font-size: 1.8rem; line-height: 1.2; }
.hero p { margin: 0; color: var(--muted); }
.ring { --p: 0; width: 120px; height: 120px; border-radius: 50%;
  background: conic-gradient(var(--accent) calc(var(--p) * 1%), #f1e2d3 0);
  display: grid; place-items: center; }
.ring div { width: 92px; height: 92px; border-radius: 50%; background: #fff8f1; display: grid; place-items: center; text-align: center; line-height: 1.1; }
.ring b { font-size: 1.5rem; display: block; }
.ring small { color: var(--muted); font-size: .72rem; }

.actions { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: .8rem; margin: 1.2rem 0 2rem; }
.action {
  background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem 1.1rem;
  text-decoration: none; box-shadow: var(--shadow); transition: transform .15s, box-shadow .15s; display: block;
}
.action:hover { transform: translateY(-2px); box-shadow: 0 6px 18px rgba(80,50,20,.12); }
.action .e { font-size: 1.6rem; }
.action b { display: block; margin-top: .2rem; }
.action small { color: var(--muted); }

.unit { margin-bottom: 2.2rem; }
.unit-h { display: flex; align-items: center; gap: .7rem; margin-bottom: .9rem; }
.unit-h .e { font-size: 1.8rem; width: 52px; height: 52px; display: grid; place-items: center; border-radius: 14px; }
.unit-h h2 { margin: 0; font-size: 1.3rem; line-height: 1.2; }
.unit-h small { color: var(--muted); }
.u1 .unit-h .e { background: var(--u1-soft); }
.u2 .unit-h .e { background: var(--u2-soft); }
.u3 .unit-h .e { background: var(--u3-soft); }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: .9rem; }
.tcard {
  position: relative; background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 1rem 1.1rem 1.1rem; text-decoration: none; box-shadow: var(--shadow);
  transition: transform .15s, box-shadow .15s; display: flex; flex-direction: column; gap: .3rem; border-top: 5px solid var(--uc);
}
.tcard:hover { transform: translateY(-3px); box-shadow: 0 8px 20px rgba(80,50,20,.13); }
.u1 { --uc: var(--u1); --ucs: var(--u1-soft); }
.u2 { --uc: var(--u2); --ucs: var(--u2-soft); }
.u3 { --uc: var(--u3); --ucs: var(--u3-soft); }
.tcard .e { font-size: 2rem; line-height: 1; }
.tcard .nr { font-size: .78rem; text-transform: uppercase; letter-spacing: .05em; color: var(--uc); font-weight: 700; }
.tcard h3 { margin: 0; font-size: 1.02rem; line-height: 1.3; }
.tcard .pg { font-size: .8rem; color: var(--muted); }
.tcard .badges { display: flex; gap: .35rem; flex-wrap: wrap; margin-top: auto; padding-top: .4rem; }
.badge { font-size: .74rem; padding: .12rem .5rem; border-radius: 999px; background: #f3ece4; color: var(--muted); }
.badge.ok { background: var(--good-soft); color: var(--good); }
.badge.sp { background: var(--gold-soft); color: #8a6510; }
.badge.score { background: var(--ucs); color: var(--uc); }

/* ---------- theme page ---------- */
.crumb { font-size: .88rem; color: var(--muted); margin-bottom: .6rem; }
.crumb a { text-decoration: none; }
.crumb a:hover { text-decoration: underline; }
.thead {
  border-radius: 20px; padding: 1.3rem 1.5rem; background: var(--ucs); border: 1px solid var(--line);
  display: flex; gap: 1rem; align-items: center;
}
.thead .e { font-size: 2.8rem; }
.thead .nr { color: var(--uc); font-weight: 700; font-size: .82rem; text-transform: uppercase; letter-spacing: .05em; }
.thead h1 { margin: .1rem 0; font-size: 1.55rem; line-height: 1.25; }
.thead .pg { color: var(--muted); font-size: .88rem; }

.tabs { display: flex; gap: .4rem; flex-wrap: wrap; margin: 1.1rem 0 1.3rem; position: sticky; top: 56px; z-index: 10; background: var(--bg); padding: .4rem 0; }
.tabs a {
  text-decoration: none; padding: .5rem .9rem; border-radius: 999px; background: var(--paper);
  border: 1px solid var(--line); font-size: .92rem; white-space: nowrap;
}
.tabs a.on { background: var(--uc); color: #fff; border-color: var(--uc); }

.card {
  background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.2rem 1.4rem;
  box-shadow: var(--shadow); margin-bottom: 1rem;
}
.card h2 { margin: 0 0 .6rem; font-size: 1.2rem; display: flex; align-items: center; gap: .5rem; }
.card p { margin: .5rem 0; }
.card ul { margin: .4rem 0; padding-left: 1.3rem; }
.card li { margin: .25rem 0; }
.intro { color: var(--muted); margin: 0 0 1rem; }

/* definitions */
.def { display: grid; grid-template-columns: 1fr 1fr; gap: 0; padding: 0; overflow: hidden; }
.def .term { grid-column: 1 / -1; padding: .8rem 1.2rem; background: var(--ucs); font-weight: 750; font-size: 1.08rem; display: flex; justify-content: space-between; align-items: center; gap: .5rem; }
.def .term small { font-weight: 500; color: var(--muted); font-size: .78rem; }
.def .book, .def .simple { padding: .9rem 1.2rem 1rem; }
.def .book { border-right: 1px solid var(--line); font-family: var(--serif); color: #4a3f37; }
.def .lbl { font-family: var(--font); font-size: .74rem; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; margin-bottom: .3rem; display: block; }
.def .book .lbl { color: var(--muted); }
.def .simple .lbl { color: var(--good); }
.def .simple { background: #fbfffa; }

/* lesson */
.sec h2 .e { font-size: 1.4rem; }
.facts { display: flex; flex-wrap: wrap; gap: .45rem; margin-top: .7rem; }
.fact { background: var(--ucs); color: var(--ink); border-radius: 10px; padding: .3rem .65rem; font-size: .88rem; }
.fact b { color: var(--uc); }
.tip { background: var(--gold-soft); border-radius: 12px; padding: .7rem 1rem; margin-top: .7rem; font-size: .95rem; }
.tip::before { content: "💡 "; }
.mini-tl { border-left: 3px solid var(--uc); margin: .5rem 0 0 .4rem; padding-left: 1rem; }
.mini-tl div { margin: .45rem 0; position: relative; }
.mini-tl div::before { content: ""; position: absolute; left: -1.43rem; top: .5rem; width: 11px; height: 11px; border-radius: 50%; background: var(--uc); border: 2px solid #fff; }
.mini-tl b { color: var(--uc); }

.remember { list-style: none; padding: 0 !important; counter-reset: r; }
.remember li { counter-increment: r; padding: .75rem 1rem .75rem 3.2rem; position: relative; background: var(--ucs); border-radius: 12px; margin: .55rem 0 !important; }
.remember li::before { content: counter(r); position: absolute; left: .9rem; top: .7rem; width: 1.6rem; height: 1.6rem; border-radius: 50%; background: var(--uc); color: #fff; font-weight: 700; display: grid; place-items: center; font-size: .85rem; }

.pager { display: flex; justify-content: space-between; gap: 1rem; margin-top: 2rem; flex-wrap: wrap; }
.btn {
  display: inline-flex; align-items: center; gap: .4rem; border: 0; background: var(--accent); color: #fff;
  padding: .65rem 1.15rem; border-radius: 12px; text-decoration: none; font-weight: 600; font-size: .95rem;
}
.btn:hover { filter: brightness(1.06); }
.btn.ghost { background: var(--paper); color: var(--ink); border: 1px solid var(--line); }
.btn.uc { background: var(--uc); }
.btn.good { background: var(--good); }
.btn:disabled { opacity: .45; cursor: default; }
.row { display: flex; gap: .6rem; flex-wrap: wrap; align-items: center; }

/* compare table */
.cmp { width: 100%; border-collapse: separate; border-spacing: 0; font-size: .95rem; }
.cmp th, .cmp td { padding: .65rem .8rem; vertical-align: top; border-bottom: 1px solid var(--line); text-align: left; }
.cmp thead th { background: var(--ucs); font-size: 1.05rem; }
.cmp thead th:first-child { border-top-left-radius: 12px; }
.cmp thead th:last-child { border-top-right-radius: 12px; }
.cmp tbody th { width: 22%; color: var(--uc); font-size: .9rem; }
.fisa { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.fisa .card h2 { font-size: 1.25rem; }
.fisa dl { margin: 0; }
.fisa dt { font-weight: 700; color: var(--uc); font-size: .85rem; margin-top: .7rem; }
.fisa dd { margin: .15rem 0 0; }

/* ---------- quiz ---------- */
.quiz { max-width: 760px; margin: 0 auto; }
.qprog { height: 10px; background: #efe5da; border-radius: 99px; overflow: hidden; }
.qprog div { height: 100%; background: linear-gradient(90deg, var(--gold), var(--accent)); transition: width .3s; }
.qmeta { display: flex; justify-content: space-between; color: var(--muted); font-size: .88rem; margin: .5rem 0 1rem; }
.qcard { background: var(--paper); border: 1px solid var(--line); border-radius: 20px; padding: 1.5rem; box-shadow: var(--shadow); }
.qtheme { font-size: .78rem; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
.qcard h3 { margin: .3rem 0 1.1rem; font-size: 1.2rem; line-height: 1.4; }
.opts { display: grid; gap: .6rem; }
.opt {
  text-align: left; padding: .8rem 1rem; border-radius: 12px; border: 2px solid var(--line); background: #fffdfb;
  font-size: 1rem; transition: border-color .15s, background .15s; display: flex; gap: .7rem; align-items: center;
}
.opt:hover:not(:disabled) { border-color: var(--accent); background: var(--accent-soft); }
.opt .k { flex: none; width: 1.8rem; height: 1.8rem; border-radius: 8px; background: #f3ece4; display: grid; place-items: center; font-weight: 700; font-size: .85rem; color: var(--muted); }
.opt.right { border-color: var(--good); background: var(--good-soft); }
.opt.wrong { border-color: var(--bad); background: var(--bad-soft); }
.opt:disabled { cursor: default; color: var(--ink); }
.opt:disabled:not(.right):not(.wrong) { opacity: .6; }
.tf { grid-template-columns: 1fr 1fr; }
.tf .opt { justify-content: center; font-size: 1.1rem; padding: 1rem; }
.match-row { display: grid; grid-template-columns: 1fr 1.3fr; gap: .6rem; align-items: center; padding: .45rem 0; border-bottom: 1px dashed var(--line); }
.match-row select { font: inherit; padding: .5rem; border-radius: 10px; border: 2px solid var(--line); background: #fff; width: 100%; }
.match-row.right select { border-color: var(--good); background: var(--good-soft); }
.match-row.wrong select { border-color: var(--bad); background: var(--bad-soft); }
.match-row .fix { grid-column: 2; font-size: .85rem; color: var(--good); }
.feed { margin-top: 1rem; padding: 1rem 1.1rem; border-radius: 14px; animation: pop .25s ease; }
.feed.ok { background: var(--good-soft); }
.feed.no { background: var(--bad-soft); }
.feed b.t { font-size: 1.1rem; display: block; margin-bottom: .2rem; }
.feed .next { margin-top: .8rem; }
@keyframes pop { from { transform: scale(.97); opacity: 0; } to { transform: none; opacity: 1; } }

.result { text-align: center; }
.result .big { font-size: 3.4rem; font-weight: 800; color: var(--accent); line-height: 1; margin: .5rem 0; }
.result .msg { font-size: 1.15rem; margin-bottom: 1rem; }
.review { text-align: left; margin-top: 1.4rem; }
.review .item { border-left: 4px solid var(--bad); background: #fff9f8; padding: .7rem 1rem; border-radius: 0 12px 12px 0; margin: .6rem 0; }
.review .item small { color: var(--muted); }

.setup label.chk { display: flex; align-items: center; gap: .6rem; padding: .55rem .8rem; border: 1px solid var(--line); border-radius: 12px; margin: .4rem 0; background: #fffdfb; cursor: pointer; }
.setup .counts { display: flex; gap: .5rem; flex-wrap: wrap; margin: .5rem 0 1.2rem; }
.setup .counts button { border: 2px solid var(--line); background: #fff; border-radius: 12px; padding: .5rem 1rem; }
.setup .counts button.on { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); font-weight: 700; }

/* ---------- flashcards ---------- */
.deck { max-width: 620px; margin: 0 auto; }
.flip { perspective: 1200px; cursor: pointer; height: 330px; margin: .8rem 0 1rem; }
.flip-in { position: relative; width: 100%; height: 100%; transition: transform .55s; transform-style: preserve-3d; }
.flip.on .flip-in { transform: rotateY(180deg); }
.face {
  position: absolute; inset: 0; backface-visibility: hidden; border-radius: 22px; padding: 1.6rem;
  display: flex; flex-direction: column; justify-content: center; align-items: center; text-align: center;
  border: 1px solid var(--line); box-shadow: 0 6px 22px rgba(80,50,20,.1); overflow: auto;
}
.face.front { background: linear-gradient(140deg, #fff, var(--ucs)); }
.face.front .t { font-size: 1.9rem; font-weight: 800; line-height: 1.2; }
.face.front small { color: var(--muted); margin-top: .8rem; }
.face.back { background: #fff; transform: rotateY(180deg); }
.face.back .s { font-size: 1.12rem; }
.face.back .b { font-family: var(--serif); font-size: .88rem; color: var(--muted); margin-top: .9rem; border-top: 1px solid var(--line); padding-top: .7rem; }
.deck-ctrl { display: flex; justify-content: space-between; align-items: center; gap: .5rem; flex-wrap: wrap; }

/* ---------- timeline ---------- */
.tl { position: relative; margin-left: 1rem; border-left: 3px solid var(--line); padding-left: 1.4rem; }
.tl-item { position: relative; margin: 0 0 1rem; background: var(--paper); border: 1px solid var(--line); border-radius: 14px; padding: .7rem 1rem; box-shadow: var(--shadow); }
.tl-item::before { content: ""; position: absolute; left: -2.02rem; top: 1rem; width: 15px; height: 15px; border-radius: 50%; background: var(--uc); border: 3px solid var(--bg); }
.tl-item .y { font-weight: 800; color: var(--uc); }
.tl-item a { font-size: .82rem; color: var(--muted); }
.filters { display: flex; gap: .4rem; flex-wrap: wrap; margin-bottom: 1.2rem; }
.filters button { border: 1px solid var(--line); background: #fff; border-radius: 999px; padding: .35rem .85rem; font-size: .9rem; }
.filters button.on { background: var(--ink); color: #fff; border-color: var(--ink); }

/* ---------- map ---------- */
.map-wrap { display: grid; grid-template-columns: 1fr 300px; gap: 1rem; align-items: start; }
.map { position: relative; border-radius: 16px; overflow: hidden; border: 1px solid var(--line); box-shadow: var(--shadow); background: #fff; }
.map img { display: block; width: 100%; height: auto; }
.pin {
  position: absolute; transform: translate(-50%, -50%); width: 26px; height: 26px; border-radius: 50%;
  border: 3px solid #fff; box-shadow: 0 1px 6px rgba(0,0,0,.35); padding: 0; transition: transform .15s;
}
.pin:hover, .pin.on { transform: translate(-50%, -50%) scale(1.35); z-index: 3; }
.pin.oras { background: var(--accent); }
.pin.provincie { background: #7d5bb5; width: 32px; height: 32px; }
.pin.popor { background: var(--u3); width: 32px; height: 32px; }
.pin.on { outline: 4px solid var(--gold); }
.map.game .pin { background: #888 !important; }
.map.game .pin.found { background: var(--good) !important; }
.map-info { position: sticky; top: 120px; }
.map-info .card { margin: 0 0 1rem; }
.legend { display: flex; gap: 1rem; flex-wrap: wrap; font-size: .88rem; margin: .7rem 0; }
.legend span::before { content: ""; display: inline-block; width: 12px; height: 12px; border-radius: 50%; margin-right: .35rem; vertical-align: -1px; }
.legend .l-oras::before { background: var(--accent); }
.legend .l-prov::before { background: #7d5bb5; }
.legend .l-pop::before { background: var(--u3); }

/* confetti */
.conf { position: fixed; top: -40px; font-size: 1.6rem; z-index: 100; pointer-events: none; animation: fall linear forwards; }
@keyframes fall { to { transform: translateY(110vh) rotate(540deg); } }

.empty { text-align: center; color: var(--muted); padding: 2rem; }

@media (max-width: 760px) {
  html { font-size: 16px; }
  .hero { grid-template-columns: 1fr; }
  .def { grid-template-columns: 1fr; }
  .def .book { border-right: 0; border-bottom: 1px solid var(--line); }
  .fisa, .map-wrap { grid-template-columns: 1fr; }
  .map-info { position: static; }
  .tabs { top: 0; position: static; }
  .match-row { grid-template-columns: 1fr; }
  .cmp tbody th { width: auto; }
  .pin { width: 20px; height: 20px; }
  .pin.provincie, .pin.popor { width: 24px; height: 24px; }
}
