/* v4.3: новые задания, «✨ Ещё», истории, тренажёры, контрольная, группы, бонусы, карта, Рафик, конфетти */

/* ---------- задания ---------- */
.picture-card .pic { font-size: 84px; line-height: 1.2; text-align: center; padding: 8px 0; }
.gap { display: inline-block; min-width: 64px; border-bottom: 3px solid var(--coral); color: transparent; }
.fix-row { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; margin: 6px 0; }
.fix-word { padding: 8px 12px; border-radius: 10px; border: 1px solid var(--line); background: var(--card); color: var(--ink); font-size: 18px; cursor: pointer; }
.fix-word.bad { border-color: var(--coral); background: color-mix(in srgb, var(--coral) 14%, var(--card)); }
.fix-word.picked { outline: 2px solid var(--ink-soft); }
.hint-btn { display: block; margin: 8px auto 0; padding: 6px 14px; border-radius: 999px; border: 1px dashed var(--line); background: none; color: var(--ink-soft); font-size: 13px; cursor: pointer; }
.quiz-option.removed { opacity: .25; text-decoration: line-through; pointer-events: none; }
.why-wrong { margin-top: 8px; padding: 8px 10px; border-radius: 10px; background: color-mix(in srgb, var(--line) 45%, transparent); font-size: 14px; }
.repeat-box { display: flex; align-items: center; justify-content: center; gap: 8px; flex-wrap: wrap; margin: 10px 0; }
.repeat-status { font-size: 13px; color: var(--ink-soft); }
.repeat-play { display: inline-flex; gap: 6px; }
.extern-btn { font-size: 16px; }
.extern-tag { font-size: 11px; padding: 2px 8px; border-radius: 999px; background: color-mix(in srgb, var(--coral) 18%, transparent); color: var(--coral); }
.offline-banner { position: fixed; left: 50%; bottom: 14px; transform: translateX(-50%); z-index: 60; max-width: 92vw;
  padding: 8px 14px; border-radius: 12px; background: #333; color: #fff; font-size: 13px; text-align: center; }

/* ---------- главная: событие, темы, «Ещё» ---------- */
.event-banner { margin: 0 0 8px; padding: 8px 12px; border-radius: 12px; font-size: 14px;
  background: color-mix(in srgb, #F2B134 22%, var(--card)); border: 1px solid color-mix(in srgb, #F2B134 45%, transparent); }
.event-banner.boost { background: color-mix(in srgb, var(--coral) 14%, var(--card)); border-color: color-mix(in srgb, var(--coral) 35%, transparent); }
.topic-chips { display: flex; gap: 6px; overflow-x: auto; margin: 8px 0 4px; padding-bottom: 2px; }
.topic-chip { flex: 0 0 auto; padding: 6px 12px; border-radius: 999px; border: 1px solid var(--line); background: var(--card); color: var(--ink); font-size: 13px; cursor: pointer; }
.topic-chip.active { background: var(--ink); color: var(--card); border-color: var(--ink); }
.topic-chip.map-chip { margin-left: auto; }
.more-h { margin: 16px 0 8px; font-size: 15px; }
.more-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
.more-tile { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; padding: 12px; text-align: left;
  border-radius: var(--radius, 16px); border: 1px solid var(--line); background: var(--card); color: var(--ink); cursor: pointer; }
.more-tile .mt-icon { font-size: 24px; margin-bottom: 4px; font-family: "Noto Naskh Arabic", serif; }
.more-tile b { font-size: 14px; }
.more-tile small { font-size: 12px; color: var(--ink-soft); }
.more-note { font-size: 13px; color: var(--ink-soft); line-height: 1.5; margin: 6px 0 10px; }
.search-input { width: 100%; padding: 10px 12px; border-radius: 12px; border: 1px solid var(--line); background: var(--card); color: var(--ink); font: inherit; margin: 6px 0 10px; box-sizing: border-box; }
.more-tile:focus-visible, .topic-chip:focus-visible, .lmap-node:focus-visible, .frame-tile:focus-visible, .sw:focus-visible { outline: 2px solid var(--coral); outline-offset: 2px; }

/* ---------- карта уроков ---------- */
.lmap { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 10px 0 40px; }
.lmap-level { margin: 14px 0 4px; font-weight: 700; font-size: 14px; }
.lmap-step { display: flex; flex-direction: column; align-items: center; gap: 2px; width: 200px; }
.lmap-step.r1 { transform: translateX(56px); }
.lmap-step.l1 { transform: translateX(-56px); }
.lmap-node { width: 62px; height: 62px; border-radius: 50%; border: none; font-size: 22px; font-weight: 700; cursor: pointer;
  background: var(--card); color: var(--ink); box-shadow: 0 4px 0 color-mix(in srgb, var(--ink) 18%, transparent); border: 2px solid var(--line); }
.lmap-node.done { background: var(--sage); color: #fff; border-color: var(--sage); }
.lmap-node.current { background: var(--coral); color: var(--on-accent, #fff); border-color: var(--coral); animation: node-pulse 1.6s ease-in-out infinite; }
.lmap-node.locked { opacity: .55; }
.lmap-title { font-size: 12px; color: var(--ink-soft); text-align: center; max-width: 180px; }
.lmap-flag { font-size: 30px; margin-top: 10px; }
@keyframes node-pulse { 50% { box-shadow: 0 0 0 8px color-mix(in srgb, var(--coral) 22%, transparent); } }

/* ---------- истории ---------- */
.story-ch { display: flex; text-align: left; }
.story-ch.locked { opacity: .55; }
.story-text { display: flex; flex-direction: column; gap: 10px; margin: 8px 0 14px; }
.story-line { padding: 10px 12px; border-radius: 12px; background: var(--card); border: 1px solid var(--line); position: relative; }
.story-line.dialog { border-left: 3px solid var(--coral); }
.story-who { font-size: 12px; color: var(--coral); font-weight: 700; margin-bottom: 2px; }
.story-src { font-size: 19px; line-height: 1.9; }
.story-src.ar-inline { font-size: 24px; }
.sw { cursor: pointer; border-bottom: 1px dotted color-mix(in srgb, var(--ink) 30%, transparent); position: relative; }
.gloss-pop { position: absolute; z-index: 5; margin-top: 30px; margin-inline-start: -40px; padding: 4px 8px; border-radius: 8px; background: var(--ink); color: var(--card);
  font-size: 13px; font-family: system-ui, sans-serif; white-space: nowrap; direction: ltr; }
.story-tools { display: flex; gap: 6px; margin-top: 4px; }
.story-tools .mini-btn { padding: 4px 10px; font-size: 13px; }
.story-tr { margin-top: 6px; font-size: 14px; color: var(--ink-soft); }

/* ---------- разговорник, тренажёры ---------- */
.pb-row { display: flex; align-items: center; gap: 8px; padding: 8px 0; border-bottom: 1px dashed var(--line); }
.pb-row:last-child { border-bottom: none; }
.pb-text { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.pb-text b { font-size: 16px; line-height: 1.7; }
.pb-text small { font-size: 13px; color: var(--ink-soft); }
.trainer-row { display: flex; align-items: center; gap: 12px; text-align: left; }
.trainer-row small { display: block; font-size: 12px; color: var(--ink-soft); font-weight: 400; }
.verb-table { width: 100%; border-collapse: collapse; font-size: 14px; margin: 10px 0; }
.verb-table th { text-align: left; font-size: 12px; color: var(--ink-soft); padding: 6px; border-bottom: 1px solid var(--line); }
.verb-table td { padding: 7px 6px; border-bottom: 1px dashed var(--line); cursor: pointer; }
.verb-table.ar td.ar-inline { font-size: 22px; text-align: right; }

/* ---------- контрольная и сертификат ---------- */
.exam-row small { display: block; margin: 4px 0 8px; color: var(--ink-soft); font-size: 12px; }
.certificate { margin: 10px 0; padding: 28px 20px; text-align: center; border-radius: 6px; background: #FFFDF6; color: #2A2A2A;
  border: 6px double #C9A24B; font-family: Georgia, "PT Serif", serif; }
.certificate h2 { margin: 6px 0 4px; font-size: 26px; letter-spacing: .02em; }
.cert-top { font-size: 13px; color: #8A6D2B; }
.cert-name { font-size: 26px; font-weight: 700; margin: 6px 0 10px; border-bottom: 1px solid #C9A24B; display: inline-block; padding: 0 16px 4px; }
.cert-level { font-size: 22px; color: #8A6D2B; margin: 8px 0; }
.cert-code { font-size: 12px; margin-top: 16px; word-break: break-all; }
.cert-note { font-size: 11px; color: #777; margin-top: 10px; }
@media print {
  body * { visibility: hidden !important; }
  #certificate, #certificate * { visibility: visible !important; }
  #certificate { position: absolute; left: 0; top: 0; width: 100%; margin: 0; }
  .no-print { display: none !important; }
}

/* ---------- в дороге ---------- */
.road-card { text-align: center; padding: 24px 12px; border-radius: var(--radius, 16px); background: var(--card); border: 1px solid var(--line); }
.road-card .word { font-size: 34px; }
.road-tr { font-size: 20px; color: var(--ink-soft); margin: 8px 0; }
.road-count { font-size: 12px; color: var(--ink-soft); }
.road-controls { display: flex; justify-content: center; align-items: center; gap: 10px; margin: 16px 0; }
html.calm-mode { --coral: #6C7FA8; }
html.calm-mode .lesson-top .combo-badge { display: none; }

/* ---------- группы ---------- */
.group-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; text-align: left; }
.group-row small { display: block; color: var(--ink-soft); font-size: 12px; font-weight: 400; }
.group-goal { flex: 0 0 80px; height: 8px; border-radius: 4px; background: color-mix(in srgb, var(--line) 80%, transparent); overflow: hidden; }
.group-goal i { display: block; height: 100%; background: var(--sage); }
.group-code-big { font-size: 30px; font-weight: 800; letter-spacing: .18em; margin: 4px 0 8px; font-family: ui-monospace, monospace; }
.group-member.me, .history-row.me { background: color-mix(in srgb, var(--coral) 9%, transparent); border-radius: 10px; }
.gm-place { min-width: 26px; text-align: center; font-weight: 700; }
.gm-avatar { display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; font-size: 20px; margin-right: 6px; }

/* ---------- рамки аватарки ---------- */
.frame-leaf { box-shadow: 0 0 0 3px #4FAE4E; }
.frame-wave { box-shadow: 0 0 0 3px #3390EC, 0 0 0 5px color-mix(in srgb, #3390EC 35%, transparent); }
.frame-gold { box-shadow: 0 0 0 3px #D4A72C, 0 0 8px 2px color-mix(in srgb, #F2B134 55%, transparent); }
.frame-star { box-shadow: 0 0 0 3px #8E5CD9, 0 0 0 6px color-mix(in srgb, #E0478B 35%, transparent); }
.frame-crown { box-shadow: 0 0 0 3px #E4572E, 0 0 0 6px #F2B134; }
.hdr-frame { border-radius: 50%; display: inline-grid; place-items: center; width: 24px; height: 24px; }
.frame-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.frame-tile { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 10px 4px; border-radius: 12px; border: 1px solid var(--line);
  background: var(--card); color: var(--ink); cursor: pointer; font-size: 12px; }
.frame-tile.active { border-color: var(--coral); box-shadow: inset 0 0 0 1px var(--coral); }
.coins-line { font-size: 15px; margin: 6px 0 10px; }

/* ---------- Рафик и конфетти ---------- */
.mascot { display: flex; align-items: flex-end; gap: 8px; margin-top: 12px; text-align: left; }
.mascot-face { font-size: 40px; line-height: 1; }
.mascot-bubble { position: relative; padding: 8px 12px; border-radius: 14px 14px 14px 4px; background: color-mix(in srgb, var(--line) 50%, var(--card)); font-size: 14px; }
.confetti { position: fixed; inset: 0; pointer-events: none; z-index: 80; overflow: hidden; }
.confetti i { position: absolute; top: -12px; width: 8px; height: 14px; border-radius: 2px; animation: confetti-fall linear forwards; }
@keyframes confetti-fall { to { transform: translateY(105vh) rotate(720deg); opacity: .9; } }

/* ---------- крупный режим ---------- */
html.big-mode { --ink-soft: color-mix(in srgb, var(--ink) 82%, transparent); }
html.big-mode .quiz-option, html.big-mode .next-btn, html.big-mode .mini-btn { min-height: 52px; }
html.big-mode .quiz-option { border-width: 2px; }
html.big-mode :focus-visible { outline: 3px solid var(--ink) !important; outline-offset: 3px; }

@media (prefers-reduced-motion: reduce) {
  .lmap-node.current { animation: none; }
}
.trace-wrap { display: flex; justify-content: center; }
#trace-canvas { width: min(300px, 86vw); height: min(300px, 86vw); border-radius: 16px; border: 1px dashed var(--line); background: var(--card); }
.rare-ach { border: 2px solid #C9A24B !important; background: color-mix(in srgb, #F2B134 10%, var(--card)) !important; }
.home-actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.home-action { min-width: 0; }
.next-btn:disabled { opacity: .5; cursor: default; }
.fix-word.found { border-color: var(--sage); background: color-mix(in srgb, var(--sage) 18%, var(--card)); }
.summary-actions .next-btn, .road-controls .next-btn { margin: 0; min-height: 46px; width: auto; padding: 0 24px; display: inline-flex; align-items: center; justify-content: center; }
.road-controls .mini-btn { min-height: 46px; min-width: 52px; font-size: 18px; }
