/* Димитровденски щаб – светъл „приключенски“ стил с военни акценти */
:root {
  --bg: #f1f3ea;
  --card: #ffffff;
  --line: #e4e8d8;
  --soft: #e7eddc;
  --soft-2: #f5f7ef;
  --olive: #4f6b2c;
  --olive-d: #34481c;
  --olive-l: #7fa045;
  --khaki: #c9b77c;
  --red: #e5383b;
  --red-d: #b3202a;
  --cta: linear-gradient(135deg, #ff7a59 0%, #e5383b 55%, #c81d4e 100%);
  --cta-2: linear-gradient(135deg, #7fa045 0%, #4f6b2c 100%);
  --gold: #f5b301;
  --navy: #2b3a67;
  --ink: #1d2433;
  --muted: #6b7280;
  --ok: #16a34a;
  --ok-bg: #e3f7e9;
  --bad: #dc2626;
  --bad-bg: #fdeaea;
  --r-lg: 26px;
  --r: 18px;
  --r-sm: 12px;
  --sh: 0 1px 2px rgba(29, 36, 51, 0.04), 0 8px 24px rgba(52, 72, 28, 0.08);
  --sh-lift: 0 2px 4px rgba(29, 36, 51, 0.06), 0 16px 36px rgba(52, 72, 28, 0.14);
  --side: 250px;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { font-family: "Nunito", system-ui, sans-serif; color: var(--ink); background: var(--bg); font-size: 17px; line-height: 1.5; -webkit-font-smoothing: antialiased; }
h1, h2, h3, h4, .btn, .kicker, .score b, .cd-n { font-family: "Rubik", "Nunito", sans-serif; }
h1 { font-size: 2.1rem; line-height: 1.15; margin: 0.15em 0 0.2em; letter-spacing: -0.01em; }
h2 { font-size: 1.35rem; margin: 0; }
h3 { margin: 0.2em 0 0.5em; }
a { color: inherit; }
.small { font-size: 0.85rem; color: var(--muted); }
.kicker { text-transform: uppercase; letter-spacing: 0.1em; font-size: 0.72rem; font-weight: 700; color: var(--olive-l); margin: 0; }
.center { text-align: center; justify-content: center; }
.row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-top: 10px; }
.lead, .sub { font-size: 1.05rem; color: var(--muted); margin: 0; }
.link { font-weight: 800; color: var(--olive); text-decoration: none; white-space: nowrap; }
.link:hover { text-decoration: underline; }

/* ---------- Рамка ---------- */
.shell { display: grid; grid-template-columns: var(--side) 1fr; min-height: 100vh; }
.sidebar { position: sticky; top: 0; height: 100vh; background: var(--card); border-right: 1px solid var(--line); padding: 22px 16px; display: flex; flex-direction: column; gap: 22px; }
.logo { display: flex; align-items: center; gap: 10px; text-decoration: none; padding: 0 6px; }
.logo-mark { width: 44px; height: 44px; border-radius: 14px; background: var(--cta); color: #fff; display: grid; place-items: center; font-size: 1.5rem; box-shadow: 0 6px 14px rgba(229, 56, 59, 0.35); }
.logo b { display: block; font-family: "Rubik"; font-size: 1rem; line-height: 1.1; }
.logo small { color: var(--muted); font-weight: 700; }
.sidenav { display: flex; flex-direction: column; gap: 4px; }
.sidenav a { display: flex; align-items: center; gap: 12px; padding: 11px 14px; border-radius: 14px; text-decoration: none; font-weight: 800; color: #4b5563; transition: background 0.15s, color 0.15s; }
.sidenav a:hover { background: var(--soft-2); color: var(--ink); }
.sidenav a.on { background: var(--soft); color: var(--olive-d); box-shadow: inset 3px 0 0 var(--olive); }
.ni { font-size: 1.2rem; width: 26px; text-align: center; }
.countdown { margin-top: auto; background: var(--soft-2); border-radius: var(--r); padding: 14px; display: grid; gap: 8px; }
.countdown svg { width: 100%; height: auto; display: block; }
.cd-n { font-size: 2.4rem; color: var(--red); line-height: 1; display: block; margin: 4px 0; }
.content { min-width: 0; }
.topbar-app { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 28px; background: rgba(241, 243, 234, 0.85); backdrop-filter: blur(10px); }
.hello { display: flex; align-items: center; gap: 12px; font-size: 1.05rem; }
.avatar svg { width: 44px; height: 44px; border-radius: 50%; display: block; box-shadow: 0 0 0 3px #fff, var(--sh); }
.chips-top { display: flex; gap: 10px; align-items: center; }
.chip-top { display: flex; align-items: center; gap: 8px; background: var(--card); border-radius: 999px; padding: 6px 14px 6px 8px; text-decoration: none; font-weight: 800; box-shadow: var(--sh); }
.streak-chip { padding: 8px 14px; white-space: nowrap; }
.rank-mini svg { width: 22px; height: 30px; display: block; }
.rank-txt { display: flex; flex-direction: column; min-width: 110px; font-size: 0.9rem; }
.rank-txt .bar { margin: 3px 0 0; }
main { max-width: 1120px; padding: 8px 28px 60px; }
.tabbar { display: none; }

/* ---------- Общи елементи ---------- */
.card, .score-card, .task-card, .rank-card { background: var(--card); border-radius: var(--r-lg); box-shadow: var(--sh); padding: 22px; margin-bottom: 18px; border: 1px solid var(--line); }
.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; margin: 10px 0 18px; }
.sec-head { display: flex; justify-content: space-between; align-items: center; margin: 30px 0 14px; }
.bar { display: block; height: 12px; background: #e9ecdf; border-radius: 999px; overflow: hidden; margin: 6px 0; flex: 1; }
.bar.thin { height: 7px; }
.bar-fill { display: block; height: 100%; background: var(--cta-2); border-radius: 999px; transition: width 0.6s; }
.bar-fill.low { background: linear-gradient(90deg, #f87171, var(--red)); }
.bar-fill.mid { background: linear-gradient(90deg, var(--gold), #f59e0b); }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; background: var(--cta-2); color: #fff; border: none; border-radius: 999px; padding: 12px 22px; font-size: 1rem; font-weight: 700; cursor: pointer; text-decoration: none; box-shadow: 0 6px 16px rgba(79, 107, 44, 0.3); transition: transform 0.12s, box-shadow 0.12s, filter 0.12s; }
.btn:hover { transform: translateY(-1px); filter: brightness(1.05); }
.btn:active { transform: translateY(1px) scale(0.98); }
.btn:disabled { opacity: 0.4; cursor: default; transform: none; }
.btn.red, .btn.cta { background: var(--cta); box-shadow: 0 8px 20px rgba(229, 56, 59, 0.35); }
.btn.cta { font-size: 1.08rem; padding: 14px 26px; }
.btn.ghost { background: var(--card); color: var(--olive-d); box-shadow: none; border: 2px solid var(--line); }
.btn.soft { background: var(--soft); color: var(--olive-d); box-shadow: none; }
.btn.big { font-size: 1.12rem; padding: 15px 24px; width: 100%; margin-top: 8px; }
.btn.small { padding: 7px 14px; font-size: 0.88rem; }
.topbar { display: flex; align-items: center; gap: 14px; margin: 10px 0 18px; }
.topbar h2 { font-size: 1.6rem; }
.back { text-decoration: none; font-weight: 800; color: var(--olive-d); background: var(--card); padding: 8px 14px; border-radius: 999px; box-shadow: var(--sh); white-space: nowrap; }

/* ---------- Бойна карта ---------- */
.map-card { background: var(--card); border-radius: var(--r-lg); box-shadow: var(--sh-lift); overflow: hidden; border: 1px solid var(--line); }
.map svg { display: block; width: 100%; height: auto; }
.campaign .cm-node { transition: transform 0.2s; transform-box: fill-box; transform-origin: center; }
.campaign a .cm-node:hover { transform: scale(1.15); }
.campaign .cm-pulse { animation: cmpulse 1.6s ease-in-out infinite; transform-box: fill-box; transform-origin: center; }
@keyframes cmpulse { 50% { transform: scale(1.35); opacity: 0.4; } }
.map-foot { display: flex; align-items: center; gap: 18px; padding: 16px 22px; flex-wrap: wrap; }
.here { display: flex; flex-direction: column; flex: 1; min-width: 200px; }
.here b { font-family: "Rubik"; font-size: 1.15rem; }
.mini-emb { display: flex; text-decoration: none; }
.mini-emb > span { margin-left: -10px; transition: transform 0.2s; }
.mini-emb > span:first-child { margin-left: 0; }
.mini-emb > span:hover { transform: translateY(-4px); }
.mini-emb svg { width: 46px; height: 46px; display: block; filter: drop-shadow(0 2px 3px rgba(0, 0, 0, 0.12)); }

.cards4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }
.tcard { background: var(--card); border-radius: var(--r-lg); overflow: hidden; text-decoration: none; box-shadow: var(--sh); border: 1px solid var(--line); display: flex; flex-direction: column; transition: transform 0.18s, box-shadow 0.18s; }
.tcard:hover { transform: translateY(-4px); box-shadow: var(--sh-lift); }
.tcard-art svg { width: 100%; height: auto; display: block; }
.tcard-body { padding: 12px 16px 16px; display: flex; flex-direction: column; gap: 4px; flex: 1; }
.tcard-body .btn { align-self: flex-start; margin-top: auto; }
.big-links { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-top: 22px; }
.big-link { display: flex; align-items: center; gap: 16px; padding: 14px 22px; border-radius: var(--r-lg); text-decoration: none; color: #fff; font-family: "Rubik"; font-size: 1.25rem; box-shadow: var(--sh-lift); transition: transform 0.18s; }
.big-link:hover { transform: translateY(-3px); }
.big-link.a { background: linear-gradient(120deg, #6b8f36, #34481c); }
.big-link.b { background: linear-gradient(120deg, #ff8a5b, #e5383b 60%, #b3203f); }
.big-link svg { width: 120px; height: auto; display: block; }

/* ---------- Отличия ---------- */
.emb-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 16px; }
.emb-card { background: var(--card); border-radius: var(--r-lg); padding: 18px 14px; text-align: center; text-decoration: none; box-shadow: var(--sh); border: 1px solid var(--line); display: flex; flex-direction: column; align-items: center; gap: 4px; transition: transform 0.18s; }
.emb-card:hover { transform: translateY(-4px) rotate(-1deg); }
.emb-card.on { background: linear-gradient(180deg, #fffaf0, #fff); }
.emb-img svg { width: 96px; height: 96px; display: block; }
.emb-lvl { font-size: 0.78rem; font-weight: 900; padding: 2px 10px; border-radius: 999px; background: #eef0f3; color: #64748b; }
.emb-lvl.l1 { background: #fdebd3; color: #9a4f06; }
.emb-lvl.l2 { background: #e8edf3; color: #475569; }
.emb-lvl.l3 { background: #fff1c2; color: #8a5a00; }

/* ---------- Тест ---------- */
.test-bar { display: flex; align-items: center; gap: 12px; background: var(--card); padding: 10px 14px; border-radius: 999px; box-shadow: var(--sh); margin: 6px 0 16px; flex-wrap: wrap; }
.test-bar b { flex: 1; font-family: "Rubik"; }
.timer { font-family: "Rubik"; font-weight: 800; font-size: 1.1rem; background: var(--soft); color: var(--olive-d); padding: 5px 14px; border-radius: 999px; font-variant-numeric: tabular-nums; }
.timer.warn { background: var(--bad-bg); color: var(--bad); animation: pulse 1s infinite; }
@keyframes pulse { 50% { opacity: 0.6; } }
.test-grid { display: grid; grid-template-columns: 230px 1fr; gap: 20px; align-items: start; }
.test-steps { position: sticky; top: 90px; background: var(--card); border-radius: var(--r-lg); padding: 16px 12px; box-shadow: var(--sh); }
.test-steps .kicker { padding: 0 8px 8px; }
.dots { display: flex; flex-direction: column; gap: 4px; }
.dot { position: relative; display: flex; align-items: center; gap: 10px; border: none; background: transparent; padding: 8px; border-radius: 14px; cursor: pointer; text-align: left; font-family: inherit; }
.dot:hover { background: var(--soft-2); }
.dot.cur { background: var(--soft); }
.dot-n { flex: none; width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; font-family: "Rubik"; font-weight: 800; background: #eef0f3; color: #64748b; }
.dot.ans .dot-n { background: var(--ok); color: #fff; }
.dot.cur .dot-n { box-shadow: 0 0 0 3px var(--red); }
.dot-l { display: flex; flex-direction: column; line-height: 1.2; }
.dot-l small { color: var(--muted); font-weight: 700; }
.dot-star { position: absolute; left: 30px; top: 2px; color: var(--gold); font-size: 1rem; text-shadow: 0 1px 0 #92400e; }
.task-card.real { border: 2px solid var(--gold); background: linear-gradient(180deg, #fff8e1, #fff 140px); }
.task-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.task-no { font-family: "Rubik"; font-weight: 800; font-size: 1.3rem; }
.task-pts { font-size: 0.85rem; background: var(--soft); color: var(--olive-d); padding: 4px 12px; border-radius: 999px; font-weight: 800; }
.real-badge { display: inline-flex; gap: 4px; background: linear-gradient(135deg, #ffd452, var(--gold)); color: #4a3200; font-weight: 800; padding: 5px 14px; border-radius: 999px; font-size: 0.88rem; margin-bottom: 8px; box-shadow: 0 4px 10px rgba(245, 179, 1, 0.35); }
.task-text { white-space: pre-line; font-size: 1.2rem; line-height: 1.6; margin: 6px 0 12px; }
.art-wrap { margin: 10px 0; }
.art-wrap svg { max-width: 100%; height: auto; max-height: 220px; }
.art-wrap svg.small { max-height: 110px; }
.tip { color: var(--muted); font-size: 0.9rem; margin-bottom: 0; }
.nav { display: flex; justify-content: space-between; gap: 10px; }

.parts { display: grid; gap: 12px; margin: 14px 0; }
.part { background: var(--soft-2); border-radius: var(--r); padding: 12px 16px; border: 2px solid transparent; }
.part.ok { border-color: var(--ok); background: var(--ok-bg); }
.part.bad { border-color: var(--bad); background: var(--bad-bg); }
.part-label { display: block; font-weight: 800; margin-bottom: 6px; }
.num-row { display: flex; align-items: center; gap: 8px; }
.num { font-family: "Rubik"; font-size: 1.4rem; font-weight: 700; width: 180px; max-width: 100%; padding: 9px 14px; border-radius: 14px; border: 2px solid var(--line); background: #fff; transition: border-color 0.15s, box-shadow 0.15s; }
.num:focus { outline: none; border-color: var(--olive-l); box-shadow: 0 0 0 4px rgba(127, 160, 69, 0.2); }
.unit { font-weight: 700; color: var(--muted); }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { border: 2px solid var(--line); background: #fff; border-radius: 999px; padding: 8px 16px; font-size: 1rem; font-weight: 700; cursor: pointer; font-family: inherit; transition: all 0.15s; }
.chip:hover { border-color: var(--olive-l); }
.chip.sel { background: var(--olive); color: #fff; border-color: var(--olive); }
.chip.right { outline: 3px solid var(--ok); outline-offset: 1px; }
.chip:disabled { cursor: default; }
.part-verdict { margin-top: 6px; font-weight: 800; }
.part.ok .part-verdict { color: var(--ok); }
.part.bad .part-verdict { color: var(--bad); }

/* ---------- Резултат ---------- */
.score-card { display: flex; gap: 24px; align-items: center; background: radial-gradient(circle at 10% 20%, #fff6dc, #fff 60%); }
.score-card.pop { animation: pop 0.6s cubic-bezier(0.2, 1.4, 0.4, 1); }
@keyframes pop { from { transform: scale(0.85); opacity: 0; } }
.medal svg { width: 96px; height: auto; }
.score { font-size: 1.3rem; }
.score b { font-size: 3.2rem; background: var(--cta); -webkit-background-clip: text; background-clip: text; color: transparent; }
.pill { padding: 6px 14px; border-radius: 999px; font-weight: 800; }
.pill.ok { background: var(--ok-bg); color: var(--ok); }
.pill.bad { background: var(--bad-bg); color: var(--bad); }
.pill.star { background: #fff1c2; color: #8a5a00; }
.review-head { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 10px; margin: 16px 0 12px; }
.seg { display: inline-flex; background: #e6e9dc; border-radius: 999px; padding: 4px; }
.seg-b { border: none; background: transparent; padding: 8px 16px; border-radius: 999px; font-weight: 800; cursor: pointer; font-family: inherit; font-size: 0.95rem; color: #4b5563; }
.seg-b.on { background: #fff; color: var(--ink); box-shadow: var(--sh); }
.review { background: var(--card); border-radius: var(--r-lg); margin-bottom: 12px; box-shadow: var(--sh); border: 1px solid var(--line); overflow: hidden; }
.review.real { border: 2px solid var(--gold); }
.review summary { display: flex; gap: 12px; align-items: center; padding: 14px 18px; cursor: pointer; list-style: none; font-weight: 800; }
.review summary::-webkit-details-marker { display: none; }
.rv-no { width: 34px; height: 34px; border-radius: 50%; background: var(--ok); color: #fff; display: grid; place-items: center; font-family: "Rubik"; }
.review.bad .rv-no { background: var(--bad); }
.rv-title { flex: 1; }
.rv-mark { font-size: 1.3rem; }
.review.ok .rv-mark { color: var(--ok); }
.review.bad .rv-mark { color: var(--bad); }
.rv-body { padding: 0 20px 18px; }
.explain { background: var(--soft-2); border-radius: var(--r); padding: 14px 18px; margin-top: 12px; }
.explain h4 { margin: 8px 0; }
.diag { background: #fff; border-left: 4px solid var(--bad); border-radius: 10px; padding: 10px 14px; margin-bottom: 8px; }
.steps { list-style: none; padding: 0; margin: 0; display: grid; gap: 10px; }
.step { display: flex; gap: 12px; align-items: flex-start; animation: slidein 0.35s ease-out; background: #fff; border-radius: 14px; padding: 10px 12px; }
.step p { margin: 3px 0; font-size: 1.05rem; }
@keyframes slidein { from { opacity: 0; transform: translateY(8px); } }
.step-n { flex: none; width: 30px; height: 30px; border-radius: 50%; background: var(--cta); color: #fff; display: grid; place-items: center; font-weight: 800; font-family: "Rubik"; }
.key { background: #fff6d6; border-radius: 12px; padding: 10px 14px; margin-top: 10px; }
.final { font-weight: 800; margin-top: 10px; color: var(--olive-d); font-size: 1.05rem; }
details.more { margin-top: 8px; }
details.more > summary { cursor: pointer; font-weight: 800; color: var(--olive); }

/* ---------- История ---------- */
.hist { display: grid; gap: 10px; }
.hist-row { display: flex; align-items: center; gap: 14px; background: var(--card); border-radius: var(--r); padding: 12px 18px; text-decoration: none; box-shadow: var(--sh); border: 1px solid var(--line); transition: transform 0.15s; }
.hist-row:hover { transform: translateX(4px); }
.hist-medal { width: 42px; height: 42px; border-radius: 50%; display: grid; place-items: center; color: #fff; font-size: 1.2rem; box-shadow: inset 0 -3px 0 rgba(0, 0, 0, 0.15); }
.hist-main { flex: 1; display: flex; flex-direction: column; }
.hist-score { font-family: "Rubik"; font-weight: 800; font-size: 1.3rem; }

/* ---------- Тренировки ---------- */
.topics { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 16px; }
.topic { background: var(--card); border-radius: var(--r-lg); padding: 18px; text-decoration: none; box-shadow: var(--sh); border: 1px solid var(--line); display: flex; flex-direction: column; gap: 4px; transition: transform 0.18s, box-shadow 0.18s; }
.topic:hover { transform: translateY(-4px); box-shadow: var(--sh-lift); }
.topic.master { border: 2px solid var(--gold); background: linear-gradient(180deg, #fffaf0, #fff); }
.topic.master b::after { content: " 🎖️"; }
.t-emoji { font-size: 2.2rem; }
.lesson-hero { background: var(--card); border-radius: var(--r-lg); overflow: hidden; box-shadow: var(--sh-lift); margin-bottom: 16px; }
.lesson-hero svg { width: 100%; height: auto; display: block; max-height: 240px; }
.mission-text { margin: 0; padding: 14px 22px; font-weight: 800; font-size: 1.15rem; background: var(--cta-2); color: #fff; }
.sec { margin-top: 28px; }
.rules { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 16px; }
.rule { position: relative; background: var(--card); border-radius: var(--r-lg); padding: 22px 18px 16px; box-shadow: var(--sh); border: 1px solid var(--line); }
.rule p { margin: 0 0 6px; font-size: 1.08rem; font-weight: 600; }
.rule-n { position: absolute; top: -12px; left: 16px; background: var(--cta); color: #fff; width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; font-weight: 900; font-family: "Rubik"; box-shadow: 0 4px 10px rgba(229, 56, 59, 0.35); }
.example .steps { margin: 12px 0; }
.feedback { margin-top: 12px; }
.good { background: var(--ok-bg); color: #14532d; border-radius: var(--r); padding: 12px 16px; font-size: 1.1rem; animation: pop 0.5s; }
.hint { background: #fff6d6; border-radius: var(--r); padding: 12px 16px; animation: shake 0.4s; }
@keyframes shake { 25% { transform: translateX(-6px); } 75% { transform: translateX(6px); } }
.real-list { display: grid; gap: 8px; }
.real-item { text-align: left; background: #fffaf0; border: 1px solid #f3dc8f; border-radius: 14px; padding: 10px 14px; cursor: pointer; display: flex; gap: 10px; font-family: inherit; font-size: 0.95rem; transition: background 0.15s; }
.real-item:hover { background: #fff1c2; }

/* ---------- Напредък ---------- */
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 16px; }
.stat { background: var(--card); border-radius: var(--r-lg); padding: 16px; text-align: center; box-shadow: var(--sh); border: 1px solid var(--line); display: flex; flex-direction: column; }
.stat b { font-family: "Rubik"; font-size: 2rem; }
.stat-ic { font-size: 1.5rem; }
.trend { background: var(--soft); border-radius: var(--r); padding: 12px 16px; font-weight: 700; }
.chart-wrap svg { width: 100%; height: auto; }
.chart .grid { stroke: #eceee4; }
.chart .axis { font-size: 12px; fill: var(--muted); font-weight: 700; }
.chart .line { fill: none; stroke: var(--olive); stroke-width: 3.5; stroke-linejoin: round; }
.chart .area { fill: rgba(127, 160, 69, 0.14); }
.cal { display: grid; grid-template-columns: repeat(14, 1fr); gap: 6px; }
.cal-d { aspect-ratio: 1; border-radius: 10px; background: #eceee4; display: grid; place-items: center; color: #fff; font-size: 0.9rem; }
.cal-d.on { background: var(--cta-2); }
.cal-d.today { outline: 3px solid var(--red); outline-offset: 1px; }
.tbars { display: grid; gap: 8px; }
.tbar { display: grid; grid-template-columns: 190px 1fr 48px; gap: 10px; align-items: center; text-decoration: none; }
.tb-name { font-weight: 700; }
.tb-p { font-weight: 800; text-align: right; }

/* ---------- Прозорец за потвърждение ---------- */
.modal-bg { position: fixed; inset: 0; background: rgba(29, 36, 51, 0.45); backdrop-filter: blur(3px); display: grid; place-items: center; z-index: 100; padding: 16px; animation: fadein 0.15s; }
.modal { background: var(--card); border-radius: var(--r-lg); padding: 26px; max-width: 420px; width: 100%; box-shadow: 0 24px 60px rgba(0, 0, 0, 0.25); animation: pop 0.3s cubic-bezier(0.2, 1.4, 0.4, 1); }
.modal-text { font-size: 1.2rem; font-weight: 800; text-align: center; margin: 0 0 8px; }
@keyframes fadein { from { opacity: 0; } }

/* ---------- Таблет ---------- */
@media (max-width: 1100px) {
  .cards4 { grid-template-columns: repeat(2, 1fr); }
}
/* ---------- Телефон / малък таблет ---------- */
@media (max-width: 860px) {
  body { font-size: 16px; }
  .shell { grid-template-columns: 1fr; }
  .sidebar { display: none; }
  .topbar-app { padding: 10px 16px; }
  .rank-txt { min-width: 0; }
  .rank-txt .bar { display: none; }
  main { padding: 6px 16px 100px; }
  .tabbar { display: flex; position: fixed; bottom: 0; left: 0; right: 0; z-index: 30; background: var(--card); border-top: 1px solid var(--line); padding: 6px 6px calc(6px + env(safe-area-inset-bottom)); box-shadow: 0 -6px 20px rgba(0, 0, 0, 0.06); }
  .tabbar a { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px; text-decoration: none; font-size: 0.72rem; font-weight: 800; color: var(--muted); padding: 4px 0; border-radius: 12px; }
  .tabbar a.on { color: var(--olive-d); background: var(--soft); }
  .tabbar .ni { font-size: 1.3rem; }
  h1 { font-size: 1.65rem; }
  .test-grid { grid-template-columns: 1fr; }
  .test-steps { position: static; padding: 8px; background: transparent; box-shadow: none; }
  .hide-m { display: none; }
  .dots { flex-direction: row; flex-wrap: wrap; gap: 8px; }
  .dot { padding: 0; }
  .dot-l { display: none; }
  .dot-n { width: 44px; height: 44px; font-size: 1.1rem; }
  .dot-star { left: auto; right: -4px; top: -6px; }
  .big-links { grid-template-columns: 1fr; }
  .stats { grid-template-columns: repeat(2, 1fr); }
  .score-card { flex-direction: column; text-align: center; }
  .score-card .row { justify-content: center; }
  .tbar { grid-template-columns: 1fr 1fr 40px; }
  .cal { grid-template-columns: repeat(7, 1fr); }
  .map-foot { padding: 14px 16px; }
  .map-foot .btn.cta { width: 100%; }
}
@media (max-width: 520px) {
  .cards4 { grid-template-columns: 1fr; }
  .hello b { font-size: 0.95rem; }
  .avatar svg { width: 36px; height: 36px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* ---------- Реалистични илюстрации (Canva) ---------- */
.hero-img { display: block; width: 100%; aspect-ratio: 8 / 3; object-fit: cover; }
.lesson-hero .hero-img { aspect-ratio: 16 / 5; max-height: 280px; }
.tcard-art .hero-img { aspect-ratio: 16 / 9; }
.emb { position: relative; display: inline-block; width: 80px; height: 80px; border-radius: 50%; }
.emb img, .emb svg { width: 100%; height: 100%; display: block; border-radius: 50%; }
.emb.lvl-0 img { filter: grayscale(1) brightness(1.1); opacity: 0.45; }
.emb.lvl-1 { box-shadow: 0 0 0 4px #cd7f32; }
.emb.lvl-2 { box-shadow: 0 0 0 4px #b8c2cc; }
.emb.lvl-3 { box-shadow: 0 0 0 4px var(--gold), 0 0 18px rgba(245, 179, 1, 0.6); }
.emb-lock { position: absolute; right: -2px; bottom: -2px; width: 28%; height: 28%; min-width: 18px; min-height: 18px; border-radius: 50%; background: #64748b; display: grid; place-items: center; font-size: 0.6em; box-shadow: 0 0 0 2px #fff; }
.emb-star { position: absolute; top: -6px; right: -4px; color: var(--gold); font-size: 1.4rem; text-shadow: 0 1px 2px rgba(0, 0, 0, 0.4); }
.emb-img .emb { width: 110px; height: 110px; }
.mini-emb .emb { width: 46px; height: 46px; box-shadow: 0 0 0 3px #fff, 0 2px 6px rgba(0, 0, 0, 0.15); }
.mini-emb .emb.lvl-1 { box-shadow: 0 0 0 3px #cd7f32; }
.mini-emb .emb.lvl-2 { box-shadow: 0 0 0 3px #b8c2cc; }
.mini-emb .emb.lvl-3 { box-shadow: 0 0 0 3px var(--gold); }
.mini-emb .emb-lock { font-size: 0.55rem; min-width: 16px; min-height: 16px; }
.avatar img { width: 44px; height: 44px; border-radius: 50%; display: block; box-shadow: 0 0 0 3px #fff, var(--sh); object-fit: cover; }
.bl-img img { width: 130px; height: 72px; object-fit: cover; border-radius: 14px; display: block; box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2); }
.cd-img { width: 100%; aspect-ratio: 16 / 7; object-fit: cover; border-radius: 12px; display: block; }
.map-card .map { background: #1e3a8a; }
@media (max-width: 520px) { .avatar img { width: 36px; height: 36px; } .emb-img .emb { width: 90px; height: 90px; } }

/* ---------- Глас ---------- */
.speak { flex: none; display: inline-flex; align-items: center; gap: 6px; border: none; background: var(--soft); color: var(--olive-d); border-radius: 999px; padding: 6px 10px; font-size: 1.05rem; font-weight: 800; cursor: pointer; font-family: inherit; transition: transform 0.15s, background 0.15s; }
.speak span { font-size: 0.85rem; }
.speak:hover { transform: scale(1.08); }
.speak.rec { background: #fff1c2; box-shadow: 0 0 0 2px var(--gold); }
.speak.playing { background: var(--cta); color: #fff; animation: pulse 0.9s infinite; }
.task-text-row, .rule-top, .explain-head { display: flex; gap: 10px; align-items: flex-start; justify-content: space-between; }
.explain-head { align-items: center; }
.mission-text { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.mission-text .speak { background: rgba(255, 255, 255, 0.2); color: #fff; }
button.avatar { border: none; padding: 0; background: none; cursor: pointer; border-radius: 50%; }
.sound-chip { border: none; cursor: pointer; font-size: 1.1rem; padding: 8px 12px; font-family: inherit; }
.parent-link { margin-top: 10px; border-top: 1px dashed var(--line); padding-top: 14px !important; font-size: 0.92rem; }
.toast { position: fixed; left: 50%; bottom: 90px; transform: translateX(-50%); background: var(--ink); color: #fff; padding: 12px 20px; border-radius: 999px; font-weight: 800; z-index: 200; box-shadow: var(--sh-lift); animation: pop 0.4s; transition: opacity 0.5s; }
.toast.out { opacity: 0; }
.studio-tips ul { margin: 0 0 12px; padding-left: 20px; }
.studio-prog { max-width: 420px; }
.warn { color: var(--bad); font-weight: 700; }
.clip { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 14px 18px; margin-bottom: 10px; box-shadow: var(--sh); }
.clip.done { border-left: 6px solid var(--ok); }
.clip.recording { border-color: var(--red); box-shadow: 0 0 0 4px rgba(229, 56, 59, 0.2); }
.clip-head { display: flex; align-items: center; gap: 10px; }
.clip-n { width: 28px; height: 28px; border-radius: 50%; background: var(--soft); display: grid; place-items: center; font-weight: 800; font-size: 0.85rem; }
.clip-id { font-size: 0.8rem; color: var(--muted); }
.clip-status { margin-left: auto; color: var(--ok); font-weight: 800; font-size: 0.9rem; }
.clip-text { font-size: 1.2rem; line-height: 1.55; margin: 8px 0 4px; font-weight: 600; }
.clip-hint { margin: 0; color: var(--muted); font-size: 0.9rem; font-style: italic; }
.clip-btns { margin-top: 8px; }
@media print {
  .sidebar, .tabbar, .topbar-app, .studio-tips .row, .clip-btns, .studio-prog, .clip-status { display: none !important; }
  .shell { display: block; }
  body { background: #fff; }
  .clip { box-shadow: none; break-inside: avoid; border: 1px solid #ccc; }
  main { padding: 0; }
}

/* ---------- Синхронизация и вход ---------- */
.sync-chip { padding: 8px 12px; font-size: 1.05rem; cursor: default; }
.sync-chip.busy { animation: pulse 1s infinite; }
.sync-chip.s-offline { background: #fff6d6; }
.sync-chip.s-locked { background: var(--bad-bg); }
.login { text-align: center; display: grid; gap: 10px; justify-items: center; }
.login-av { width: 90px; height: 90px; border-radius: 50%; box-shadow: 0 0 0 4px #fff, var(--sh-lift); }
.login-code { width: 100%; text-align: center; }

/* ---------- Финално полиране ---------- */
.tcard-art { position: relative; height: 128px; display: grid; place-items: center; overflow: hidden; }
.tcard-art::before { content: ""; position: absolute; inset: 0; background: radial-gradient(circle at 30% 20%, rgba(255, 255, 255, 0.35), transparent 60%); }
.tcard-art.area-A { background: linear-gradient(135deg, #3b82f6, #1e3a8a); }
.tcard-art.area-B { background: linear-gradient(135deg, #84a33a, #3f5a1f); }
.tcard-art.area-C { background: linear-gradient(135deg, #a855f7, #5b21b6); }
.tcard-art.area-D { background: linear-gradient(135deg, #fb923c, #c2410c); }
.tcard-emb .emb { width: 92px; height: 92px; box-shadow: 0 0 0 4px rgba(255, 255, 255, 0.85), 0 10px 24px rgba(0, 0, 0, 0.3); transition: transform 0.3s cubic-bezier(0.2, 1.4, 0.4, 1); }
.tcard:hover .tcard-emb .emb { transform: scale(1.08) rotate(-4deg); }
.tcard-emoji { position: absolute; top: 10px; right: 12px; font-size: 1.4rem; filter: drop-shadow(0 2px 3px rgba(0, 0, 0, 0.3)); }
.campaign .cm-me { animation: bob 2.4s ease-in-out infinite; transform-box: fill-box; transform-origin: center bottom; }
@keyframes bob { 50% { transform: translateY(-5px); } }
.area-title { margin: 26px 0 12px; font-size: 1.1rem; color: var(--olive-d); }
.sec { font-size: 1.15rem; }
@media (max-width: 860px) {
  .topbar-app { gap: 8px; }
  .hello { gap: 8px; min-width: 0; }
  .hello b { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 0.95rem; }
  .chips-top { gap: 6px; flex: none; }
  .chip-top { padding: 6px 9px; }
  .rank-chip { padding: 5px 8px; }
  .rank-txt { display: none; }
  .topbar { flex-wrap: wrap; gap: 10px; }
  .topbar h2 { font-size: 1.35rem; }
}
@media (max-width: 400px) {
  .sync-chip { display: none; }
}
@media (max-width: 520px) {
  .cards4 { grid-template-columns: 1fr 1fr; gap: 12px; }
  .tcard-art { height: 96px; }
  .tcard-emb .emb { width: 68px; height: 68px; }
  .tcard-emoji { font-size: 1.1rem; top: 6px; right: 8px; }
  .tcard-body { padding: 10px 12px 12px; }
  .tcard-body b { font-size: 0.95rem; line-height: 1.25; }
  .tcard-body .small { font-size: 0.78rem; }
  .tcard-body .btn { padding: 6px 12px; font-size: 0.82rem; }
}
