:root {
  --ink: #1d2447;
  --ink-soft: #5d6690;
  --card: #ffffff;
  --brand: #2e7dff;
  --brand-dark: #1957c9;
  --good: #1fb26b;
  --good-bg: #dbf7e8;
  --bad: #ee5a5a;
  --bad-bg: #ffe3e3;
  --warn: #ff9f1c;
  --gold: #ffb400;
  --line: #dde4fb;
  --radius: 18px;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  font-family: "Vazirmatn", Tahoma, "Segoe UI", system-ui, sans-serif;
  color: var(--ink);
  background: radial-gradient(1200px 600px at 70% -10%, #3a4fb8 0%, #1a2150 55%, #10152f 100%) fixed;
  line-height: 1.7;
  -webkit-tap-highlight-color: transparent;
}
#app { max-width: 880px; margin: 0 auto; padding: 12px 12px 36px; min-height: 100vh; }
button { font: inherit; color: inherit; cursor: pointer; }
h1, h2, h3, p { margin: 0; }

/* ---------- دکمه‌ها ---------- */
.btn {
  border: 0; border-radius: 14px; padding: 12px 22px; font-weight: 800; font-size: 1.05rem;
  background: var(--brand); color: #fff; box-shadow: 0 5px 0 var(--brand-dark);
  transition: transform .08s, box-shadow .08s;
}
.btn:active { transform: translateY(4px); box-shadow: 0 1px 0 var(--brand-dark); }
.btn.big { width: 100%; padding: 15px; font-size: 1.2rem; }
.btn.good { background: var(--good); box-shadow: 0 5px 0 #14804d; }
.btn.good:active { box-shadow: 0 1px 0 #14804d; }
.btn.fire { background: linear-gradient(180deg, #ff7a3d, #ee3d3d); box-shadow: 0 5px 0 #a82a2a; }
.btn.fire:active { box-shadow: 0 1px 0 #a82a2a; }
.btn.ghost { background: #fff; color: var(--brand-dark); box-shadow: 0 5px 0 var(--line); border: 2px solid var(--line); }
.btn.ghost:active { box-shadow: 0 1px 0 var(--line); }
.btn.small { padding: 8px 14px; font-size: .9rem; border-radius: 12px; box-shadow: 0 3px 0 var(--line); }
.btn:disabled { opacity: .45; cursor: not-allowed; }

.card { background: var(--card); border-radius: var(--radius); padding: 16px; box-shadow: 0 10px 30px rgba(0, 0, 20, .35); }
.muted { color: var(--ink-soft); }

/* ---------- شروع ---------- */
.welcome { text-align: center; padding-top: 20px; color: #fff; max-width: 520px; margin: 0 auto; }
.welcome h1 { font-size: 2.1rem; font-weight: 800; }
.welcome .sub { color: #c5cdf5; margin: 4px 0 18px; }
.welcome .card { color: var(--ink); text-align: right; display: grid; gap: 16px; }
.lbl { font-weight: 800; display: block; margin-bottom: 8px; }
.text-input { width: 100%; font: inherit; font-size: 1.15rem; padding: 12px 14px; border-radius: 14px; border: 2px solid var(--line); background: #f7f9ff; color: var(--ink); }
.text-input:focus { outline: 3px solid #b5ceff; border-color: var(--brand); }
.choices { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.choice { border: 3px solid var(--line); background: #fff; border-radius: 14px; padding: 12px 6px; text-align: center; font-weight: 600; }
.choice[aria-pressed="true"] { border-color: var(--brand); background: #eaf2ff; box-shadow: 0 0 0 3px #bcd5ff; }
.code-input { text-align: center; letter-spacing: .2em; font-weight: 800; }
.code-input::placeholder { letter-spacing: .1em; font-weight: 400; }
.msg { border-radius: 12px; padding: 8px 12px; font-weight: 600; }
.msg.bad { background: var(--bad-bg); color: #9b2b2b; }
.msg.good { background: var(--good-bg); color: #0f6b44; }
.welcome a { color: #fff; font-weight: 800; }

/* ---------- پروفایل‌ها ---------- */
.profile-row { display: grid; grid-template-columns: 1fr auto; gap: 8px; align-items: center; }
.profile-pick { display: grid; grid-template-columns: 52px 1fr; gap: 12px; align-items: center; text-align: right; background: #fff; border: 3px solid var(--line); border-radius: 20px; padding: 10px 14px; box-shadow: 0 6px 0 var(--line); }
.profile-row.active .profile-pick { border-color: var(--brand); box-shadow: 0 6px 0 var(--brand-dark); }
.profile-pick .av { width: 48px; height: 48px; border-radius: 50%; background: #eaf2ff; color: var(--brand-dark); display: grid; place-items: center; font-weight: 800; font-size: 1.4rem; }
.profile-pick .t { font-weight: 800; font-size: 1.1rem; }
.profile-pick .s { color: var(--ink-soft); font-size: .9rem; }

/* ---------- همگام‌سازی و فصل‌ها ---------- */
.sync-line { text-align: center; color: #c5cdf5; font-size: .85rem; margin-top: 8px; }
.picker { display: grid; gap: 8px; margin-bottom: 12px; }
.picker .chips { padding: 0; }
.picker .chip { background: #fff; }
.picker .chip[aria-pressed="true"] { border-color: var(--brand); background: #eaf2ff; color: var(--brand); }
.small-note { font-size: .85rem; text-align: center; margin-top: 10px; }
.chk { display: flex; gap: 10px; align-items: center; padding: 8px 4px; font-weight: 600; cursor: pointer; }
.chk input { width: 22px; height: 22px; accent-color: var(--good); }

/* ---------- انتخاب مأموریت ---------- */
.missions h1 { color: #fff; font-size: 1.6rem; margin: 6px 0 2px; }
.missions .sub { color: #c5cdf5; margin-bottom: 14px; }
.mission-list { display: grid; gap: 12px; }
.mission {
  display: grid; grid-template-columns: 64px 1fr auto; gap: 14px; align-items: center; text-align: right; width: 100%;
  background: #fff; border: 3px solid var(--line); border-radius: 20px; padding: 12px 16px; box-shadow: 0 6px 0 var(--line);
}
.mission .ic { width: 56px; height: 56px; border-radius: 16px; background: #eaf2ff; display: grid; place-items: center; font-size: 1.9rem; }
.mission .t { font-weight: 800; font-size: 1.1rem; }
.mission .s { color: var(--ink-soft); font-size: .9rem; }
.mission.open { border-color: var(--brand); box-shadow: 0 6px 0 var(--brand-dark); }
.mission.done { border-color: var(--good); box-shadow: 0 6px 0 #14804d; }
.mission.locked { opacity: .55; filter: grayscale(.6); cursor: not-allowed; }
.stars { letter-spacing: 2px; color: var(--gold); font-size: 1.3rem; white-space: nowrap; }
.stars .off { color: #d3d9ef; }
.footer-actions { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; margin-top: 18px; }

/* ---------- نبرد ---------- */
.hud { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 8px; color: #fff; }
.hud .pill { background: rgba(255, 255, 255, .14); border-radius: 99px; padding: 2px 12px; font-weight: 600; font-size: .92rem; white-space: nowrap; }
.hud .title { font-weight: 800; margin-inline-end: auto; }
.shield { display: flex; align-items: center; gap: 6px; }
.shield .bar { width: 120px; height: 12px; background: rgba(255, 255, 255, .2); border-radius: 99px; overflow: hidden; }
.shield .bar i { display: block; height: 100%; background: linear-gradient(90deg, #4be3a0, #1fb26b); transition: width .4s; }
.shield .bar i.low { background: linear-gradient(90deg, #ffb347, #ee5a5a); }
.pip { display: inline-block; width: 10px; height: 10px; border-radius: 50%; background: rgba(255, 255, 255, .25); margin-inline-start: 3px; }
.pip.on { background: var(--warn); box-shadow: 0 0 8px var(--warn); }
.pill.armed { background: var(--warn); color: #3a2300; animation: glow 1s ease-in-out infinite; }
.stage { position: relative; border-radius: 18px; overflow: hidden; box-shadow: 0 10px 30px rgba(0, 0, 20, .45); border: 3px solid rgba(255, 255, 255, .25); }
#cv { display: block; width: 100%; height: auto; background: #8ad0ff; touch-action: none; }
#banner {
  position: absolute; top: 14px; left: 50%; transform: translateX(-50%); background: rgba(20, 25, 60, .85); color: #fff;
  padding: 6px 20px; border-radius: 99px; font-weight: 800; pointer-events: none; opacity: 0; transition: opacity .25s; white-space: nowrap;
}
#banner.show { opacity: 1; }

#panel { margin-top: 10px; }
.qmeta { color: var(--ink-soft); font-size: .88rem; margin-bottom: 4px; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.qtag { background: #eaf2ff; color: var(--brand-dark); border-radius: 99px; padding: 0 10px; font-weight: 600; }
.qtag.again { background: var(--bad-bg); color: #b73636; }
.qtext { font-size: 1.35rem; font-weight: 800; margin: 4px 0 12px; }
.options { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.opt {
  display: grid; grid-template-columns: 32px 1fr; gap: 8px; align-items: center; text-align: right;
  background: #fff; border: 3px solid var(--line); border-radius: 14px; padding: 10px 12px; font-size: 1.1rem; font-weight: 600;
  box-shadow: 0 4px 0 var(--line); transition: transform .08s;
}
.opt .k { width: 28px; height: 28px; border-radius: 8px; background: #eaf2ff; display: grid; place-items: center; font-size: .8rem; color: var(--brand-dark); }
.opt:hover:not(:disabled) { border-color: #8db4ff; }
.opt:active:not(:disabled) { transform: translateY(3px); box-shadow: 0 1px 0 var(--line); }
.opt.right { background: var(--good-bg); border-color: var(--good); box-shadow: 0 4px 0 #14804d; }
.opt.wrong { background: var(--bad-bg); border-color: var(--bad); box-shadow: 0 4px 0 #c24141; animation: shake .4s; }
.opt:disabled { cursor: default; }
.feedback { margin-top: 12px; border-radius: 14px; padding: 12px 14px; animation: rise .3s; display: grid; gap: 8px; }
.feedback.good { background: var(--good-bg); color: #0f6b44; }
.feedback.bad { background: var(--bad-bg); color: #9b2b2b; }
.feedback .head { font-weight: 800; font-size: 1.1rem; }
.feedback .why { color: var(--ink); }
.feedback .effect { font-weight: 600; }

.aim { display: grid; gap: 12px; }
.aim .status { border-radius: 12px; padding: 8px 12px; font-weight: 600; }
.aim .status.good { background: var(--good-bg); color: #0f6b44; }
.aim .status.bad { background: var(--bad-bg); color: #9b2b2b; }
.aim .status.plain { background: #eaf2ff; color: var(--brand-dark); }
.sliders { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.slider label { display: flex; justify-content: space-between; font-weight: 800; margin-bottom: 4px; }
.slider input[type=range] { width: 100%; height: 34px; accent-color: var(--brand); }
.hint { text-align: center; font-weight: 600; color: var(--ink-soft); padding: 10px 0; }

/* ---------- عبارت‌های ریاضی ---------- */
.code { display: inline-block; direction: ltr; unicode-bidi: isolate; white-space: pre; font-family: ui-monospace, Menlo, Consolas, monospace; font-size: .92em; }
.math { display: inline-block; direction: ltr; unicode-bidi: isolate; white-space: nowrap; font-weight: 600; }
.frac { display: inline-flex; flex-direction: column; vertical-align: middle; text-align: center; margin: 0 .12em; line-height: 1.15; font-size: .92em; }
.frac > span:first-child { border-bottom: 2px solid currentColor; padding: 0 .25em; }
.frac > span:last-child { padding: 0 .25em; }
.math sup { font-size: .65em; }
.qtext .math { font-size: 1.15em; }

/* ---------- نتیجه ---------- */
.result { text-align: center; padding: 8px 0; }
.result .big-em { font-size: 4rem; line-height: 1.2; }
.result h2 { font-size: 1.7rem; margin: 4px 0; }
.result .stars { font-size: 2.4rem; margin: 4px 0 8px; }
.result .note { color: var(--ink-soft); margin-bottom: 14px; }
.actions { display: grid; gap: 10px; max-width: 420px; margin: 0 auto; }

/* ---------- گزارش ---------- */
.report { max-width: 640px; margin: 0 auto; }
.report h2 { margin-bottom: 12px; }
.report section { margin-bottom: 16px; }
.report h3 { margin-bottom: 6px; }
.kpis { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.kpi { background: #eef3ff; border-radius: 14px; padding: 10px; text-align: center; }
.kpi b { display: block; font-size: 1.5rem; }
.stat-row { display: grid; grid-template-columns: 150px 1fr 56px; gap: 10px; align-items: center; margin: 8px 0; }
.stat-row .bar { height: 12px; background: #e3eaff; border-radius: 99px; overflow: hidden; }
.stat-row .bar i { display: block; height: 100%; background: linear-gradient(90deg, #4be3a0, #1fb26b); }
.stat-row .p { text-align: left; font-weight: 800; }
.weak { padding: 10px 12px; border: 2px solid var(--line); border-radius: 14px; margin: 8px 0; }
.weak .n { color: var(--bad); font-weight: 600; font-size: .9rem; }

#confetti { position: fixed; inset: 0; pointer-events: none; overflow: hidden; z-index: 50; }
#confetti span { position: absolute; top: -40px; font-size: 1.6rem; animation: fall linear forwards; }

@keyframes shake { 20%, 60% { transform: translateX(-7px); } 40%, 80% { transform: translateX(7px); } }
@keyframes rise { from { opacity: 0; transform: translateY(10px); } }
@keyframes fall { to { transform: translateY(110vh) rotate(540deg); } }
@keyframes glow { 50% { box-shadow: 0 0 14px var(--warn); } }

@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }
@media (max-width: 640px) {
  .options, .sliders { grid-template-columns: 1fr; }
  .qtext { font-size: 1.15rem; }
  .mission { grid-template-columns: 52px 1fr; }
  .mission .stars { grid-column: 1 / -1; }
}

.qtag.review { background: #fff1d6; color: #9a5b00; }
.pills { display: flex; flex-wrap: wrap; gap: 8px; margin: 4px 0 12px; }
.pills .pill { background: rgba(255,255,255,.14); color: #fff; border-radius: 99px; padding: 2px 12px; font-weight: 600; font-size: .92rem; }

/* ---------- صفحهٔ عریض (لپ‌تاپ/دسکتاپ): نبرد بدون اسکرول؛ پنل سؤال کنار صحنه ---------- */
@media (min-width: 820px) and (min-aspect-ratio: 5/4) {
  .in-battle #app { max-width: 1400px; padding-bottom: 12px; }
  .battle { display: grid; grid-template-columns: 420px minmax(0, 1fr); grid-template-areas: "hud hud" "panel stage"; gap: 12px; align-items: start; }
  .battle .hud { grid-area: hud; margin-bottom: 0; }
  .battle .stage { grid-area: stage; }
  .battle #panel { grid-area: panel; margin-top: 0; max-height: calc(100vh - 100px); overflow-y: auto; }
  .battle #cv { max-height: calc(100vh - 100px); object-fit: contain; }
  .battle .sliders { grid-template-columns: 1fr; }
  .battle .options { gap: 8px; }
  .battle .opt { grid-template-columns: 26px 1fr; gap: 6px; }
  .battle .feedback { margin-top: 10px; padding: 10px 12px; gap: 6px; }
  .battle .feedback .btn { position: sticky; bottom: 0; }
  .battle .qtext { font-size: 1.2rem; margin-bottom: 10px; }
  .battle .opt { padding: 8px 12px; font-size: 1.05rem; }
}

.hud .quit { box-shadow: 0 3px 0 var(--line); }

/* ---------- داستان یک‌ساله: کارت فصل، چالش‌ها، گشت مرور ---------- */
.campaign {
  position: relative; overflow: hidden; color: #fff; border-radius: 22px; padding: 14px 16px; margin-bottom: 12px;
  background: linear-gradient(135deg, var(--c1), var(--c2)); box-shadow: 0 10px 30px rgba(0, 0, 20, .35);
  text-shadow: 0 1px 3px rgba(0, 0, 30, .55);
}
.campaign h2 { font-size: 1.45rem; margin: 6px 0 8px; }
.campaign .s { font-size: .9rem; margin-top: 4px; }
.camp-top { display: flex; flex-wrap: wrap; gap: 6px; justify-content: space-between; }
.act-tag { background: rgba(0, 0, 30, .35); border-radius: 99px; padding: 2px 12px; font-size: .85rem; font-weight: 600; white-space: nowrap; }
.camp-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; text-shadow: none; }
.xpbar { height: 14px; background: rgba(0, 0, 30, .3); border-radius: 99px; overflow: hidden; }
.xpbar i { display: block; height: 100%; background: linear-gradient(90deg, #ffe066, #ffb400); border-radius: 99px; transition: width .5s; }
.campaign .btn.fire { text-shadow: none; }
.quests { margin-bottom: 12px; padding: 12px 16px; }
.quests h3 { margin-bottom: 6px; }
.quest { display: grid; grid-template-columns: 1fr 90px auto; gap: 10px; align-items: center; padding: 4px 0; font-size: .95rem; }
.quest .qbar { height: 10px; background: #e3eaff; border-radius: 99px; overflow: hidden; }
.quest .qbar i { display: block; height: 100%; background: linear-gradient(90deg, #4be3a0, #1fb26b); }
.quest .rw { font-weight: 800; color: #9a6b00; font-size: .85rem; white-space: nowrap; }
.quest.done { color: var(--ink-soft); }
.quest.done .rw { color: var(--good); }
.event { display: flex; gap: 12px; align-items: center; margin-bottom: 12px; padding: 10px 14px; background: #fff8e6; }
.event .ev-ic { font-size: 2rem; }
.event > div { flex: 1; }
.event .s { color: var(--ink-soft); font-size: .9rem; }
.mission.patrol { margin-bottom: 12px; border-color: #7c5cff; box-shadow: 0 6px 0 #5236c9; background: linear-gradient(90deg, #f3efff, #fff); }
.mission.patrol .ic { background: #e7e0ff; }

/* ---------- صحنهٔ داستان ---------- */
.story {
  max-width: 640px; margin: 10px auto 0; border-radius: 24px; padding: 18px 16px 20px; color: #fff; min-height: 70vh;
  display: flex; flex-direction: column; gap: 16px;
  background: linear-gradient(180deg, var(--c1), var(--c2) 70%, var(--c3)); box-shadow: 0 10px 30px rgba(0, 0, 20, .45);
}
.story-head { text-align: center; text-shadow: 0 1px 3px rgba(0, 0, 30, .6); }
.story-head h1 { font-size: 1.7rem; margin-top: 6px; }
.story-stage { flex: 1; display: flex; flex-direction: column; justify-content: center; gap: 12px; }
.speaker { display: flex; align-items: center; gap: 10px; text-shadow: 0 1px 3px rgba(0, 0, 30, .6); }
.speaker .face {
  font-size: 3.2rem; width: 84px; height: 84px; display: grid; place-items: center; border-radius: 50%;
  background: rgba(255, 255, 255, .85); box-shadow: 0 6px 0 rgba(0, 0, 30, .25); animation: bob 2.4s ease-in-out infinite;
}
.speaker.villain .face { background: #e7d6ff; box-shadow: 0 6px 0 #5a2594; }
.speaker b { font-size: 1.2rem; }
.bubble {
  background: #fff; color: var(--ink); border-radius: 20px; padding: 16px 18px; font-size: 1.2rem; line-height: 1.9;
  box-shadow: 0 8px 0 rgba(0, 0, 30, .18); animation: pop .25s ease-out;
}
.bubble.narrator { background: rgba(10, 10, 30, .75); color: #fff; font-style: italic; text-align: center; }
.dots { display: flex; justify-content: center; gap: 6px; }
.dots i { width: 9px; height: 9px; border-radius: 50%; background: rgba(255, 255, 255, .35); }
.dots i.on { background: #fff; }
.story-actions { display: grid; gap: 10px; justify-items: center; }
@keyframes bob { 50% { transform: translateY(-6px); } }
@keyframes pop { from { transform: scale(.94); opacity: 0; } to { transform: none; opacity: 1; } }

/* ---------- نقشهٔ سفر ---------- */
.rank-card { margin-bottom: 14px; }
.rank-card .xpbar { background: #e3eaff; margin: 6px 0 2px; }
.rank-card .s { color: var(--ink-soft); font-size: .88rem; }
.act-node {
  display: grid; grid-template-columns: 60px 1fr auto; gap: 12px; align-items: center; border-radius: 20px; padding: 12px 14px;
  color: #fff; background: linear-gradient(135deg, var(--c1), var(--c2)); text-shadow: 0 1px 3px rgba(0, 0, 30, .6);
  border: 3px solid rgba(255, 255, 255, .25);
}
.act-node .ic { font-size: 2.2rem; width: 56px; height: 56px; display: grid; place-items: center; border-radius: 50%; background: rgba(0, 0, 30, .25); }
.act-node .t { font-weight: 800; font-size: 1.1rem; }
.act-node .s { font-size: .88rem; }
.act-node.cur { border-color: #ffe066; box-shadow: 0 0 0 4px rgba(255, 224, 102, .45); }
.act-node.locked { background: #262c58; border-color: rgba(255, 255, 255, .12); opacity: .85; }
.node-actions { display: grid; gap: 6px; text-shadow: none; }
.journey .path { width: 6px; height: 22px; margin: 2px auto; border-radius: 3px; background: repeating-linear-gradient(180deg, rgba(255, 255, 255, .6) 0 6px, transparent 6px 11px); }

/* ---------- آشیانه ---------- */
.hangar { max-width: 640px; margin: 0 auto; display: grid; gap: 10px; }
.hangar .topbar { display: flex; justify-content: space-between; align-items: center; }
.pill.gold { background: #fff1c2; color: #7a5200; border-radius: 99px; padding: 2px 12px; font-weight: 800; }
#tankPreview { width: 100%; max-width: 360px; height: auto; margin: 0 auto; display: block; border-radius: 16px; border: 3px solid var(--line); }
.hangar .s { font-size: .88rem; }
.up-row { display: grid; grid-template-columns: 40px 1fr auto; gap: 10px; align-items: center; padding: 6px 0; border-bottom: 1px solid var(--line); }
.up-row .ic { font-size: 1.7rem; }
.up-row .s { color: var(--ink-soft); }
.lv i { display: inline-block; width: 12px; height: 12px; border-radius: 3px; background: #dde4fb; margin-inline-start: 3px; }
.lv i.on { background: var(--gold); }
.shop-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 8px; }
.shop-item { display: grid; justify-items: center; gap: 4px; padding: 8px 4px; border: 2px solid var(--line); border-radius: 14px; text-align: center; }
.shop-item.on { border-color: var(--good); background: var(--good-bg); }
.shop-item.locked { opacity: .55; }
.shop-item .sw { width: 44px; height: 30px; border-radius: 10px; border: 2px solid rgba(0, 0, 0, .1); }
.shop-item .sw.em { border: 0; font-size: 1.6rem; line-height: 30px; }
.shop-item .nm { font-weight: 600; font-size: .9rem; }
.shop-item .s.on { color: var(--good); font-weight: 800; }
.shop-item .btn.small { padding: 4px 10px; font-size: .85rem; }

/* ---------- نبرد: معرفی دشمن تازه، جایزه ---------- */
.enemy-intro { display: grid; gap: 12px; }
.enemy-intro h2 { color: #b33; }
.enemy-intro .ei { display: grid; grid-template-columns: 54px 1fr; gap: 10px; align-items: center; background: #f6f0ff; border-radius: 14px; padding: 10px; }
.enemy-intro .ic { font-size: 2.4rem; text-align: center; }
.result .gain { font-weight: 800; color: #9a6b00; margin-top: 6px; }

/* ---------- نشان‌ها ---------- */
.badges { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 8px; }
.badge { display: grid; justify-items: center; text-align: center; gap: 2px; padding: 8px 6px; border-radius: 14px; background: #f3f5fb; opacity: .6; }
.badge.got { background: #fff6d8; opacity: 1; box-shadow: inset 0 0 0 2px #ffd36a; }
.badge .ic { font-size: 1.8rem; }
.badge b { font-size: .9rem; }
.badge .s { font-size: .78rem; color: var(--ink-soft); }

/* ---------- پیام کوتاه ---------- */
#toasts { position: fixed; bottom: 16px; left: 50%; transform: translateX(-50%); display: grid; gap: 8px; z-index: 50; width: min(92vw, 460px); pointer-events: none; }
.toast { background: rgba(20, 25, 60, .94); color: #fff; padding: 10px 16px; border-radius: 14px; font-weight: 600; box-shadow: 0 8px 20px rgba(0, 0, 0, .35); animation: pop .25s ease-out; transition: opacity .5s; text-align: center; }
.toast.out { opacity: 0; }

@media (max-width: 640px) {
  .quest { grid-template-columns: 1fr auto; }
  .quest .qbar { grid-column: 1 / -1; grid-row: 2; }
  .act-node { grid-template-columns: 48px 1fr; }
  .act-node .ic { width: 46px; height: 46px; font-size: 1.8rem; }
  .node-actions { grid-column: 1 / -1; grid-auto-flow: column; justify-content: start; }
  .bubble { font-size: 1.08rem; }
}

/* ---------- انتخاب فصل‌ها (خلاصه در صفحهٔ اصلی + پنجره) ---------- */
.chapters-sum {
  display: grid; grid-template-columns: 48px 1fr auto; gap: 12px; align-items: center; width: 100%; text-align: right; margin-bottom: 12px;
  background: #fff; border: 2px solid var(--line); border-radius: 18px; padding: 10px 14px;
}
.chapters-sum .ic { font-size: 1.8rem; }
.chapters-sum .t { font-weight: 800; }
.chapters-sum .s { color: var(--ink-soft); font-size: .88rem; }
.chapters-sum .go { font-size: 1.2rem; }
.chapters-sum.empty { border: 3px solid var(--good); box-shadow: 0 6px 0 #14804d; animation: glow 1.6s ease-in-out infinite; }
body.modal-open { overflow: hidden; }
.modal-back { position: fixed; inset: 0; background: rgba(8, 10, 30, .6); z-index: 40; }
.chapters-modal {
  position: fixed; z-index: 41; top: 4vh; left: 50%; transform: translateX(-50%); width: min(560px, calc(100vw - 24px)); max-height: 92vh;
  display: grid; grid-template-rows: auto auto minmax(0, 1fr) auto; gap: 10px; background: #fff; border-radius: 20px; padding: 16px;
  box-shadow: 0 20px 50px rgba(0, 0, 20, .5);
}
.chapters-modal .topbar { display: flex; justify-content: space-between; align-items: center; }
.chapters-modal .s { font-size: .9rem; }
.subj-list { overflow-y: auto; display: grid; gap: 8px; align-content: start; padding: 2px; }
.subj { border: 2px solid var(--line); border-radius: 14px; }
.subj.some { border-color: #9be3bf; }
.subj-head { display: grid; grid-template-columns: 1fr auto auto; gap: 10px; align-items: center; width: 100%; background: none; border: 0; padding: 10px 12px; text-align: right; }
.subj-head .cnt { color: var(--ink-soft); font-size: .88rem; }
.subj.some .subj-head .cnt { color: #0f6b44; font-weight: 800; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; padding: 0 12px 8px; }
.chip { border: 2px solid var(--line); background: #f7f9ff; border-radius: 99px; padding: 5px 12px; font-size: .9rem; font-weight: 600; text-align: right; }
.chip.on { background: var(--good-bg); border-color: var(--good); color: #0f6b44; }
.subj-tools { display: flex; gap: 8px; padding: 0 12px 10px; }

/* ---------- گزارش به تفکیک درس ---------- */
.report .s { font-size: .86rem; }
.subj-report { border: 2px solid var(--line); border-radius: 14px; margin: 8px 0; padding: 8px 12px; }
.subj-report summary { cursor: pointer; display: grid; grid-template-columns: 1fr auto; gap: 4px 10px; align-items: center; }
.subj-report summary .nm { font-weight: 800; font-size: 1.05rem; }
.subj-report summary .s { color: var(--ink-soft); }
.subj-report summary .meter { grid-column: 1 / -1; }
.meter { display: grid; grid-template-columns: 44px 1fr 46px; gap: 8px; align-items: center; font-size: .85rem; }
.meter .bar { height: 10px; background: #e3eaff; border-radius: 99px; overflow: hidden; }
.meter .bar i { display: block; height: 100%; background: linear-gradient(90deg, #4be3a0, #1fb26b); }
.meter.m .bar i { background: linear-gradient(90deg, #8fb8ff, #2e7dff); }
.meter b { text-align: left; }
.ch-row { display: grid; gap: 2px; padding: 8px 0 4px; border-top: 1px dashed var(--line); margin-top: 6px; }
.ch-row .nm { font-weight: 600; display: flex; justify-content: space-between; gap: 8px; }
.ch-row .nm .s { color: var(--ink-soft); font-weight: 400; }
.weak .w-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.weak .n { color: #9a5b00; }
.weak.hard .n { color: var(--bad); }
