/* =========================================================
   درعك — ملف التنسيق الرئيسي
   ========================================================= */

:root {
  --bg: #f6f4ef;
  --surface: #ffffff;
  --surface-2: #faf9f6;
  --ink: #1b2524;
  --ink-2: #33403e;
  --muted: #5d6967;
  --line: #e2ded4;
  --line-2: #d3cec2;
  --accent: #0e6b5a;
  --accent-hover: #0b5a4b;
  --accent-ink: #ffffff;
  --accent-soft: #e2efea;
  --ok: #17784a;
  --ok-soft: #e5f3ea;
  --warn: #8a5300;
  --warn-soft: #fbf0dc;
  --danger: #b42318;
  --danger-soft: #fcebe9;
  --focus: #1f6feb;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 1px 2px rgba(20, 30, 28, .06), 0 2px 8px rgba(20, 30, 28, .04);
  --font: "IBM Plex Sans Arabic", "Segoe UI", Tahoma, system-ui, sans-serif;
  --fs: 17px;
  --header-h: 64px;
  --tabbar-h: 0px;
}

[data-theme="dark"] {
  --bg: #111615;
  --surface: #182020;
  --surface-2: #1c2524;
  --ink: #e7ecea;
  --ink-2: #ccd5d2;
  --muted: #98a5a2;
  --line: #2a3533;
  --line-2: #364240;
  --accent: #3fae96;
  --accent-hover: #52c0a8;
  --accent-ink: #0b1513;
  --accent-soft: #17302a;
  --ok: #4cc287;
  --ok-soft: #15291f;
  --warn: #e3a74a;
  --warn-soft: #2b2314;
  --danger: #f0786d;
  --danger-soft: #2f1a18;
  --shadow: 0 1px 2px rgba(0, 0, 0, .3);
}

[data-size="lg"] { --fs: 19px; }
[data-size="xl"] { --fs: 21px; }

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: var(--font);
  font-size: var(--fs);
  line-height: 1.75;
  color: var(--ink);
  background: var(--bg);
  min-height: 100vh;
  padding-bottom: var(--tabbar-h);
}

img, svg { display: block; max-width: 100%; }
a { color: var(--accent); text-underline-offset: 3px; }
a:hover { color: var(--accent-hover); }
b, strong { font-weight: 600; color: var(--ink); }
code {
  font-family: ui-monospace, "Cascadia Mono", Consolas, monospace;
  font-size: .86em;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: .05em .4em;
  unicode-bidi: isolate;
  word-break: break-all;
}
h1, h2, h3, h4 { line-height: 1.35; margin: 0 0 .5em; font-weight: 700; color: var(--ink); }
h1 { font-size: clamp(1.6rem, 1.1rem + 2vw, 2.4rem); letter-spacing: -.01em; }
h2 { font-size: clamp(1.3rem, 1.05rem + 1vw, 1.7rem); }
h3 { font-size: 1.15rem; }
p { margin: 0 0 1em; }

:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 4px; }

.skip-link {
  position: absolute; inset-inline-start: 12px; top: -60px; z-index: 100;
  background: var(--ink); color: var(--bg); padding: 8px 14px; border-radius: 8px;
}
.skip-link:focus { top: 12px; color: var(--bg); }

.visually-hidden {
  position: absolute !important; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap;
}

/* ---------- Layout ---------- */
.wrap { width: 100%; max-width: 1100px; margin: 0 auto; padding: 0 20px; }
.narrow { max-width: 760px; }
main { padding: 28px 0 64px; min-height: calc(100vh - var(--header-h) - 120px); }

/* ---------- Header ---------- */
.site-header {
  position: sticky; top: 0; z-index: 30;
  background: color-mix(in srgb, var(--bg) 92%, transparent);
  backdrop-filter: saturate(140%) blur(8px);
  -webkit-backdrop-filter: saturate(140%) blur(8px);
  border-bottom: 1px solid var(--line);
}
.header-inner { display: flex; align-items: center; gap: 16px; height: var(--header-h); }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--ink); font-weight: 700; font-size: 1.2rem; }
.brand:hover { color: var(--ink); }
.brand-mark { width: 34px; height: 34px; color: var(--accent); }
.main-nav { display: flex; gap: 4px; margin-inline-start: 18px; }
.main-nav a {
  text-decoration: none; color: var(--muted); padding: 8px 12px; border-radius: 8px; font-size: .95rem; font-weight: 500;
}
.main-nav a:hover { color: var(--ink); background: var(--surface-2); }
.main-nav a[aria-current="page"] { color: var(--ink); background: var(--surface); box-shadow: inset 0 0 0 1px var(--line); }
.header-tools { margin-inline-start: auto; display: flex; align-items: center; gap: 6px; }
.xp-pill {
  display: inline-flex; align-items: center; gap: 6px; font-size: .88rem; font-weight: 600;
  padding: 5px 12px; border-radius: 999px; background: var(--accent-soft); color: var(--accent);
  text-decoration: none; white-space: nowrap;
}
.xp-pill svg { width: 16px; height: 16px; }
.icon-btn {
  width: 40px; height: 40px; display: inline-grid; place-items: center;
  border: 1px solid var(--line); background: var(--surface); color: var(--ink-2);
  border-radius: 10px; cursor: pointer; font: inherit; font-size: .85rem; font-weight: 600;
}
.icon-btn:hover { border-color: var(--line-2); color: var(--ink); }
.icon-btn svg { width: 20px; height: 20px; }

/* ---------- Mobile tab bar ---------- */
.tabbar { display: none; }

@media (max-width: 820px) {
  :root { --tabbar-h: 66px; --header-h: 58px; }
  .main-nav { display: none; }
  .tabbar {
    display: grid; grid-template-columns: repeat(5, 1fr);
    position: fixed; bottom: 0; left: 0; right: 0; z-index: 30;
    height: calc(var(--tabbar-h) + env(safe-area-inset-bottom));
    padding-bottom: env(safe-area-inset-bottom);
    background: var(--surface); border-top: 1px solid var(--line);
  }
  .tabbar a {
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
    text-decoration: none; color: var(--muted); font-size: .72rem; font-weight: 500;
  }
  .tabbar a svg { width: 23px; height: 23px; }
  .tabbar a[aria-current="page"] { color: var(--accent); }
  .tabbar a[aria-current="page"] svg { stroke-width: 2.2; }
  .xp-pill .xp-label { display: none; }
  .brand { font-size: 1.1rem; }
  .brand-mark { width: 30px; height: 30px; }
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 48px; padding: 10px 22px; border-radius: 10px; border: 1px solid transparent;
  font: inherit; font-weight: 600; font-size: 1rem; cursor: pointer; text-decoration: none;
  transition: background-color .15s, border-color .15s, color .15s, transform .05s;
}
.btn:active { transform: translateY(1px); }
.btn svg { width: 20px; height: 20px; }
.btn-primary { background: var(--accent); color: var(--accent-ink); }
.btn-primary:hover { background: var(--accent-hover); color: var(--accent-ink); }
.btn-secondary { background: var(--surface); color: var(--ink); border-color: var(--line-2); }
.btn-secondary:hover { border-color: var(--ink-2); color: var(--ink); }
.btn-ghost { background: transparent; color: var(--ink-2); }
.btn-ghost:hover { background: var(--surface-2); color: var(--ink); }
.btn-danger { background: var(--surface); color: var(--danger); border-color: color-mix(in srgb, var(--danger) 35%, var(--line)); }
.btn-danger:hover { background: var(--danger-soft); color: var(--danger); }
.btn[disabled], .btn[aria-disabled="true"] { opacity: .5; cursor: not-allowed; pointer-events: none; }
.btn-block { width: 100%; }
.btn-row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }

/* ---------- Cards & generic ---------- */
.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 22px; box-shadow: var(--shadow);
}
.eyebrow { font-size: .85rem; font-weight: 600; color: var(--accent); margin-bottom: 6px; display: block; }
.muted { color: var(--muted); }
.small { font-size: .88rem; }
.section { margin-top: 44px; }
.section-head { display: flex; align-items: end; justify-content: space-between; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.section-head h2 { margin: 0; }
.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (max-width: 960px) { .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 620px) { .grid-2, .grid-3 { grid-template-columns: 1fr; } }

.progress { height: 8px; background: var(--surface-2); border: 1px solid var(--line); border-radius: 99px; overflow: hidden; }
.progress > span { display: block; height: 100%; background: var(--accent); border-radius: 99px; transition: width .5s ease; }

.crumbs { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; font-size: .9rem; color: var(--muted); margin-bottom: 18px; }
.crumbs a { color: var(--muted); text-decoration: none; }
.crumbs a:hover { color: var(--ink); text-decoration: underline; }
.crumbs .sep { opacity: .5; }

/* ---------- Hero ---------- */
.hero { display: grid; grid-template-columns: 1.15fr .85fr; gap: 40px; align-items: center; padding: 18px 0 8px; }
.hero h1 { margin-bottom: 14px; }
.hero .lead { font-size: 1.12rem; color: var(--ink-2); max-width: 36ch; }
.hero-visual { position: relative; }
@media (max-width: 820px) {
  .hero { grid-template-columns: 1fr; gap: 26px; }
  .hero-visual { max-width: 320px; margin: 0 auto; width: 100%; }
  .phone-screen { min-height: 0; }
}
.hero-stats { display: flex; gap: 26px; margin-top: 26px; flex-wrap: wrap; }
.hero-stats div { display: flex; flex-direction: column; }
.hero-stats b { font-size: 1.5rem; line-height: 1.2; }
.hero-stats span { font-size: .88rem; color: var(--muted); }

.resume-card { display: flex; gap: 18px; align-items: center; justify-content: space-between; flex-wrap: wrap; margin-top: 30px; }
.resume-card .meta { flex: 1 1 260px; }
.resume-card h3 { margin: 0 0 4px; }

/* ---------- Phone mock in hero ---------- */
.phone-mock {
  border: 1px solid var(--line-2); border-radius: 34px; padding: 14px; background: var(--surface);
  box-shadow: 0 20px 50px -24px rgba(20, 40, 36, .35);
  max-width: 320px; margin-inline: auto;
}
.phone-screen { background: var(--surface-2); border-radius: 24px; padding: 18px 14px; min-height: 360px; display: flex; flex-direction: column; gap: 12px; }
.phone-top { display: flex; justify-content: space-between; font-size: .72rem; color: var(--muted); padding: 0 6px; }
.bubble { background: var(--surface); border: 1px solid var(--line); border-radius: 16px 16px 16px 4px; padding: 10px 12px; font-size: .86rem; line-height: 1.6; max-width: 92%; }
.bubble small { display: block; color: var(--muted); font-size: .72rem; margin-bottom: 2px; }
.fake-link { white-space: nowrap; }
.bubble .fake-link { color: #2563eb; direction: ltr; unicode-bidi: isolate; text-decoration: underline; }
.mark {
  align-self: flex-end; display: inline-flex; align-items: center; gap: 6px; font-size: .78rem; font-weight: 600;
  color: var(--danger); background: var(--danger-soft); padding: 4px 10px; border-radius: 99px;
}
.mark.ok { color: var(--ok); background: var(--ok-soft); align-self: flex-start; }
.mark svg { width: 14px; height: 14px; }

/* ---------- Feature list ---------- */
.feature { display: flex; gap: 14px; align-items: flex-start; }
.feature .ico { flex: 0 0 auto; width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); }
.feature .ico svg { width: 24px; height: 24px; }
.feature h3 { margin: 0 0 4px; font-size: 1.05rem; }
.feature p { margin: 0; color: var(--muted); font-size: .95rem; }

/* ---------- Levels ---------- */
.level-list { display: grid; gap: 14px; }
.level-card {
  display: grid; grid-template-columns: auto 1fr auto; gap: 18px; align-items: center;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px;
  text-decoration: none; color: inherit; transition: border-color .15s, transform .15s;
}
a.level-card:hover { border-color: var(--accent); color: inherit; }
.level-num {
  width: 54px; height: 54px; border-radius: 14px; display: grid; place-items: center;
  background: var(--accent-soft); color: var(--accent); position: relative;
}
.level-num svg { width: 26px; height: 26px; }
.level-num .n {
  position: absolute; bottom: -6px; inset-inline-end: -6px; background: var(--surface); border: 1px solid var(--line);
  font-size: .72rem; font-weight: 700; width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; color: var(--ink-2);
}
.level-card h3 { margin: 0 0 2px; font-size: 1.1rem; }
.level-card p { margin: 0 0 10px; color: var(--muted); font-size: .93rem; }
.level-meta { display: flex; gap: 14px; align-items: center; font-size: .84rem; color: var(--muted); flex-wrap: wrap; }
.level-meta .progress { flex: 1 1 120px; max-width: 220px; }
.level-state { font-size: .84rem; font-weight: 600; white-space: nowrap; display: inline-flex; align-items: center; gap: 6px; }
.level-state svg { width: 18px; height: 18px; }
.level-state.done { color: var(--ok); }
.level-state.locked { color: var(--muted); }
.level-state.go { color: var(--accent); }
.level-card.is-locked { opacity: .62; background: var(--surface-2); box-shadow: none; }
.level-card.is-locked .level-num { background: var(--surface); color: var(--muted); border: 1px dashed var(--line-2); }
.level-card.is-done .level-num { background: var(--ok-soft); color: var(--ok); }
@media (max-width: 620px) {
  .level-card { grid-template-columns: auto 1fr; padding: 16px; gap: 14px; }
  .level-card .level-state { grid-column: 1 / -1; justify-self: start; }
  .level-num { width: 46px; height: 46px; }
}

/* Level page */
.level-hero { display: flex; gap: 18px; align-items: flex-start; margin-bottom: 26px; }
.level-hero .level-num { width: 64px; height: 64px; flex: 0 0 auto; }
.level-hero .level-num svg { width: 32px; height: 32px; }
.lesson-list { list-style: none; padding: 0; margin: 0; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); overflow: hidden; }
.lesson-list li + li { border-top: 1px solid var(--line); }
.lesson-row { display: flex; align-items: center; gap: 14px; padding: 16px 18px; text-decoration: none; color: var(--ink); min-height: 64px; }
.lesson-row:hover { background: var(--surface-2); color: var(--ink); }
.lesson-row .dot {
  flex: 0 0 auto; width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center;
  border: 2px solid var(--line-2); font-size: .82rem; font-weight: 700; color: var(--muted);
}
.lesson-row.done .dot { background: var(--ok); border-color: var(--ok); color: #fff; }
.lesson-row .dot svg { width: 16px; height: 16px; }
.lesson-row .t { flex: 1; font-weight: 500; }
.lesson-row .m { font-size: .84rem; color: var(--muted); white-space: nowrap; }
.lesson-row.quiz-row .dot { border-style: dashed; }
.lesson-row.quiz-row.locked { color: var(--muted); pointer-events: none; }

/* ---------- Lesson reading ---------- */
.lesson-head { margin-bottom: 26px; padding-bottom: 18px; border-bottom: 1px solid var(--line); }
.lesson-head .meta { display: flex; gap: 14px; color: var(--muted); font-size: .9rem; flex-wrap: wrap; }
.reading { font-size: 1.04em; }
.reading > * + * { margin-top: 0; }
.reading h3 { margin-top: 1.6em; font-size: 1.2rem; }
.reading ul.plain { padding-inline-start: 1.2em; margin: 0 0 1.2em; }
.reading ul.plain li { margin-bottom: .45em; }
.reading ul.plain li::marker { color: var(--accent); }

.note { border-radius: var(--radius-sm); padding: 14px 16px; margin: 1.2em 0; display: flex; gap: 12px; align-items: flex-start; font-size: .97em; }
.note .ni { flex: 0 0 auto; width: 22px; height: 22px; margin-top: 3px; }
.note p { margin: 0; }
.note.tip { background: var(--accent-soft); border-inline-start: 4px solid var(--accent); }
.note.tip .ni { color: var(--accent); }
.note.warn { background: var(--warn-soft); border-inline-start: 4px solid var(--warn); }
.note.warn .ni { color: var(--warn); }

.steps-box { margin: 1.2em 0 1.4em; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); padding: 16px 18px; }
.steps-box h4 { margin: 0 0 12px; font-size: 1rem; display: flex; align-items: center; gap: 8px; }
.steps-box h4 svg { width: 20px; height: 20px; color: var(--accent); }
.steps { list-style: none; counter-reset: s; padding: 0; margin: 0; }
.steps li { counter-increment: s; position: relative; padding-inline-start: 44px; margin-bottom: 12px; min-height: 30px; }
.steps li:last-child { margin-bottom: 0; }
.steps li::before {
  content: counter(s); position: absolute; inset-inline-start: 0; top: 0;
  width: 30px; height: 30px; border-radius: 50%; background: var(--accent-soft); color: var(--accent);
  display: grid; place-items: center; font-weight: 700; font-size: .88rem;
}
.steps-box.no-title { padding-top: 18px; }

.compare { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin: 1.2em 0; }
.compare > div { border-radius: var(--radius-sm); padding: 14px 16px; border: 1px solid; font-size: .95em; }
.compare .bad { background: var(--danger-soft); border-color: color-mix(in srgb, var(--danger) 25%, transparent); }
.compare .good { background: var(--ok-soft); border-color: color-mix(in srgb, var(--ok) 25%, transparent); }
.compare .lbl { display: flex; align-items: center; gap: 6px; font-weight: 700; font-size: .85rem; margin-bottom: 6px; }
.compare .bad .lbl { color: var(--danger); }
.compare .good .lbl { color: var(--ok); }
.compare .lbl svg { width: 18px; height: 18px; }
@media (max-width: 620px) { .compare { grid-template-columns: 1fr; } }

/* Message mockups */
.msg-demo { margin: 1.4em 0; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 16px; align-items: start; }
@media (max-width: 720px) { .msg-demo { grid-template-columns: 1fr; } }
.msg-card { border: 1px solid var(--line); border-radius: 18px; background: var(--surface-2); padding: 14px; }
.msg-head { display: flex; align-items: center; gap: 10px; padding-bottom: 10px; border-bottom: 1px solid var(--line); margin-bottom: 12px; }
.msg-avatar { width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; background: var(--line); color: var(--ink-2); flex: 0 0 auto; }
.msg-avatar svg { width: 18px; height: 18px; }
.msg-from { font-weight: 600; font-size: .92rem; line-height: 1.3; word-break: break-word; }
.msg-from small { display: block; font-weight: 400; color: var(--muted); font-size: .76rem; }
.msg-from .ltr { direction: ltr; unicode-bidi: isolate; }
.msg-bubble { background: var(--surface); border: 1px solid var(--line); border-radius: 14px 14px 14px 4px; padding: 10px 13px; font-size: .93rem; line-height: 1.7; }
.msg-card.whatsapp .msg-bubble { background: #e7f7e3; border-color: #cfe9c8; color: #1b2524; }
.msg-card.messenger .msg-bubble { background: #e9f0ff; border-color: #d4e0fb; color: #1b2524; }
[data-theme="dark"] .msg-card.whatsapp .msg-bubble { background: #1d3424; border-color: #284732; color: var(--ink); }
[data-theme="dark"] .msg-card.messenger .msg-bubble { background: #1c2740; border-color: #2a3858; color: var(--ink); }
.msg-card.email .msg-bubble { border-radius: 10px; }
.msg-card.popup { background: var(--surface); border: 2px solid var(--danger); }
.msg-card.popup .msg-bubble { border: none; background: transparent; padding: 0; font-weight: 500; }
.msg-card.popup .fake-btn { margin-top: 12px; display: flex; gap: 8px; justify-content: flex-end; }
.msg-card.popup .fake-btn span { font-size: .82rem; padding: 6px 14px; border-radius: 6px; background: var(--danger); color: #fff; }
.msg-card.popup .fake-btn span + span { background: var(--surface-2); color: var(--ink); border: 1px solid var(--line); }
.msg-card.call .msg-bubble { font-style: italic; }
.msg-subject { font-weight: 600; margin-bottom: 6px; }
.msg-link { display: block; direction: ltr; text-align: left; color: #2563eb; text-decoration: underline; word-break: break-all; margin-top: 6px; font-size: .9em; }
[data-theme="dark"] .msg-link { color: #7aa7ff; }
.msg-attach { display: inline-flex; align-items: center; gap: 6px; margin-top: 8px; padding: 6px 10px; border: 1px solid var(--line); border-radius: 8px; font-size: .84rem; background: var(--surface-2); direction: ltr; }
.msg-attach svg { width: 16px; height: 16px; }
.msg-time { font-size: .72rem; color: var(--muted); margin-top: 6px; text-align: end; }
.flags { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; }
.flags li { display: flex; gap: 10px; align-items: flex-start; font-size: .93rem; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; }
.flags li .fn { flex: 0 0 auto; width: 24px; height: 24px; border-radius: 50%; background: var(--danger); color: #fff; display: grid; place-items: center; font-size: .78rem; font-weight: 700; margin-top: 2px; }
.flags-title { font-weight: 700; font-size: .92rem; margin-bottom: 8px; color: var(--danger); }

/* Link examples */
.link-ex { list-style: none; padding: 0; margin: 1.2em 0; display: grid; gap: 10px; }
.link-ex li { border: 1px solid var(--line); border-radius: 10px; background: var(--surface); padding: 12px 14px; }
.link-ex .u { direction: ltr; text-align: left; font-family: ui-monospace, Consolas, monospace; font-size: .88rem; word-break: break-all; display: block; margin-bottom: 6px; }
.link-ex .u mark { background: var(--warn-soft); color: var(--ink); padding: 0 2px; border-radius: 3px; font-weight: 700; }
.link-ex .n { display: flex; align-items: flex-start; gap: 8px; font-size: .92rem; }
.link-ex .n svg { width: 18px; height: 18px; flex: 0 0 auto; margin-top: 4px; }
.link-ex li.ok .n svg { color: var(--ok); }
.link-ex li.bad .n svg { color: var(--danger); }

/* Inline check & quiz options */
.check-box { margin: 1.6em 0; border: 1px solid var(--line-2); border-radius: var(--radius); padding: 18px; background: var(--surface); }
.check-box .lbl { font-size: .82rem; font-weight: 700; color: var(--accent); display: flex; align-items: center; gap: 6px; margin-bottom: 6px; }
.check-box .lbl svg { width: 18px; height: 18px; }
.check-box .q { font-weight: 600; margin-bottom: 12px; }
.options { display: grid; gap: 8px; }
.opt {
  display: flex; align-items: center; gap: 12px; text-align: start; width: 100%;
  min-height: 52px; padding: 12px 14px; border-radius: 10px; border: 1.5px solid var(--line-2);
  background: var(--surface); color: var(--ink); font: inherit; font-size: .97rem; cursor: pointer;
  transition: border-color .12s, background-color .12s;
}
.opt:hover:not([disabled]) { border-color: var(--accent); background: var(--surface-2); }
.opt .k {
  flex: 0 0 auto; width: 28px; height: 28px; border-radius: 8px; border: 1.5px solid var(--line-2);
  display: grid; place-items: center; font-size: .82rem; font-weight: 700; color: var(--muted);
}
.opt[disabled] { cursor: default; }
.opt.correct { border-color: var(--ok); background: var(--ok-soft); }
.opt.correct .k { background: var(--ok); border-color: var(--ok); color: #fff; }
.opt.wrong { border-color: var(--danger); background: var(--danger-soft); }
.opt.wrong .k { background: var(--danger); border-color: var(--danger); color: #fff; }
.opt.dim { opacity: .55; }
.feedback { margin-top: 12px; padding: 12px 14px; border-radius: 10px; font-size: .95rem; display: none; }
.feedback.show { display: block; animation: rise .25s ease; }
.feedback.ok { background: var(--ok-soft); }
.feedback.no { background: var(--danger-soft); }
.feedback b.h { display: block; margin-bottom: 2px; }
.feedback.ok b.h { color: var(--ok); }
.feedback.no b.h { color: var(--danger); }

@keyframes rise { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

.lesson-foot { margin-top: 40px; padding-top: 22px; border-top: 1px solid var(--line); display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }

/* ---------- Quiz ---------- */
.quiz-wrap { max-width: 720px; margin: 0 auto; }
.quiz-top { display: flex; align-items: center; gap: 14px; margin-bottom: 22px; }
.quiz-top .progress { flex: 1; }
.quiz-top .count { font-size: .9rem; color: var(--muted); white-space: nowrap; font-variant-numeric: tabular-nums; }
.quiz-q { font-size: 1.2rem; font-weight: 600; margin-bottom: 18px; line-height: 1.6; }
.quiz-actions { margin-top: 20px; display: flex; justify-content: flex-end; }
.result { text-align: center; padding: 34px 22px; }
.result .score-ring { width: 150px; height: 150px; margin: 0 auto 18px; position: relative; }
.result .score-ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.result .score-ring .v { position: absolute; inset: 0; display: grid; place-items: center; font-size: 2rem; font-weight: 700; }
.result .score-ring .v small { display: block; font-size: .8rem; color: var(--muted); font-weight: 500; }
.result h2 { margin-bottom: 8px; }
.result .btn-row { justify-content: center; margin-top: 22px; }
.review { margin-top: 28px; text-align: start; }
.review details { border: 1px solid var(--line); border-radius: 10px; padding: 10px 14px; background: var(--surface); margin-bottom: 8px; }
.review summary { cursor: pointer; font-weight: 500; display: flex; gap: 8px; align-items: flex-start; }
.review summary svg { width: 18px; height: 18px; flex: 0 0 auto; margin-top: 5px; }
.review .ok svg { color: var(--ok); }
.review .no svg { color: var(--danger); }
.review details p { margin: 8px 0 0; color: var(--ink-2); font-size: .94rem; }

/* ---------- Scam game ---------- */
.game-wrap { max-width: 640px; margin: 0 auto; }
.game-hud { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; font-size: .92rem; color: var(--muted); gap: 12px; }
.game-hud b { color: var(--ink); font-variant-numeric: tabular-nums; }
.streak { display: inline-flex; align-items: center; gap: 4px; color: var(--warn); font-weight: 700; }
.streak svg { width: 16px; height: 16px; }
.context-note { font-size: .9rem; background: var(--surface); border: 1px dashed var(--line-2); padding: 10px 12px; border-radius: 10px; margin-bottom: 12px; color: var(--ink-2); }
.verdict-btns { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 16px; }
.verdict-btns .btn { min-height: 58px; font-size: 1.05rem; }
.btn-safe { background: var(--surface); border: 2px solid var(--ok); color: var(--ok); }
.btn-safe:hover { background: var(--ok-soft); color: var(--ok); }
.btn-scam { background: var(--surface); border: 2px solid var(--danger); color: var(--danger); }
.btn-scam:hover { background: var(--danger-soft); color: var(--danger); }
.game-explain { margin-top: 16px; border-radius: var(--radius); padding: 16px 18px; animation: rise .25s ease; }
.game-explain.ok { background: var(--ok-soft); }
.game-explain.no { background: var(--danger-soft); }
.game-explain h3 { margin: 0 0 8px; font-size: 1.05rem; }
.game-explain ul { margin: 0 0 14px; padding-inline-start: 1.2em; }
.game-explain li { margin-bottom: 4px; font-size: .95rem; }

/* ---------- Password lab ---------- */
.pw-input { position: relative; }
.pw-input input {
  width: 100%; min-height: 56px; font: inherit; font-size: 1.1rem; padding: 12px 16px; padding-inline-end: 56px;
  border-radius: 12px; border: 1.5px solid var(--line-2); background: var(--surface); color: var(--ink);
  direction: ltr; text-align: left;
}
.pw-input input:focus { border-color: var(--accent); outline: none; box-shadow: 0 0 0 3px var(--accent-soft); }
.pw-input .eye { position: absolute; top: 50%; transform: translateY(-50%); right: 8px; }
.meter { display: grid; grid-template-columns: repeat(5, 1fr); gap: 5px; margin: 14px 0 6px; }
.meter span { height: 8px; border-radius: 99px; background: var(--line); transition: background-color .2s; }
.meter[data-s="1"] span:nth-child(-n+1) { background: var(--danger); }
.meter[data-s="2"] span:nth-child(-n+2) { background: #d9631e; }
.meter[data-s="3"] span:nth-child(-n+3) { background: #c99a06; }
.meter[data-s="4"] span:nth-child(-n+4) { background: #4f9a3a; }
.meter[data-s="5"] span:nth-child(-n+5) { background: var(--ok); }
.pw-verdict { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.pw-verdict b { font-size: 1.1rem; }
.pw-checks { list-style: none; padding: 0; margin: 16px 0 0; display: grid; gap: 6px; }
.pw-checks li { display: flex; gap: 10px; align-items: center; font-size: .95rem; color: var(--muted); }
.pw-checks li svg { width: 18px; height: 18px; flex: 0 0 auto; }
.pw-checks li.on { color: var(--ink); }
.pw-checks li.on svg { color: var(--ok); }
.pw-checks li.bad { color: var(--danger); }
.pw-pair { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.pw-pair .opt { direction: ltr; justify-content: center; font-family: ui-monospace, Consolas, monospace; font-size: .95rem; word-break: break-all; text-align: center; }
@media (max-width: 560px) { .pw-pair { grid-template-columns: 1fr; } }

/* ---------- Checklist ---------- */
.checklist { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; }
.checklist label {
  display: flex; gap: 14px; align-items: center; padding: 14px 16px; min-height: 58px;
  border: 1px solid var(--line); border-radius: 12px; background: var(--surface); cursor: pointer;
}
.checklist label:hover { border-color: var(--line-2); }
.checklist input { width: 24px; height: 24px; accent-color: var(--accent); flex: 0 0 auto; cursor: pointer; }
.checklist .tx { flex: 1; }
.checklist .lk { font-size: .82rem; white-space: nowrap; }
.checklist input:checked + .tx { color: var(--muted); text-decoration: line-through; text-decoration-color: var(--line-2); }

/* ---------- Glossary ---------- */
.gloss-search { width: 100%; min-height: 50px; font: inherit; padding: 10px 14px; border-radius: 12px; border: 1.5px solid var(--line-2); background: var(--surface); color: var(--ink); margin-bottom: 16px; }
.gloss-search:focus { border-color: var(--accent); outline: none; box-shadow: 0 0 0 3px var(--accent-soft); }
.gloss { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.gloss div { border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; background: var(--surface); }
.gloss dt { font-weight: 700; margin-bottom: 4px; }
.gloss dd { margin: 0; color: var(--ink-2); font-size: .95rem; }
@media (max-width: 620px) { .gloss { grid-template-columns: 1fr; } }

/* ---------- Badges & stats ---------- */
.stat { padding: 18px; }
.stat b { display: block; font-size: 1.7rem; line-height: 1.2; font-variant-numeric: tabular-nums; }
.stat span { color: var(--muted); font-size: .9rem; }
.badges { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.badge { text-align: center; padding: 18px 12px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); }
.badge .bi { width: 56px; height: 56px; margin: 0 auto 10px; border-radius: 50%; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); }
.badge .bi svg { width: 28px; height: 28px; }
.badge b { display: block; font-size: .95rem; line-height: 1.4; }
.badge span { font-size: .8rem; color: var(--muted); line-height: 1.5; display: block; margin-top: 4px; }
.badge.locked { background: var(--surface-2); }
.badge.locked .bi { background: var(--surface); color: var(--line-2); border: 1px dashed var(--line-2); }
.badge.locked b { color: var(--muted); }

/* ---------- Challenges hub ---------- */
.challenge { display: flex; flex-direction: column; gap: 10px; text-decoration: none; color: inherit; height: 100%; transition: border-color .15s; }
a.challenge:hover { border-color: var(--accent); color: inherit; }
.challenge .ico { width: 48px; height: 48px; border-radius: 12px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); }
.challenge .ico svg { width: 26px; height: 26px; }
.challenge h3 { margin: 4px 0 0; }
.challenge p { margin: 0; color: var(--muted); font-size: .95rem; flex: 1; }
.challenge .best { font-size: .85rem; color: var(--ink-2); font-weight: 600; }

/* ---------- Forms ---------- */
.field { display: grid; gap: 6px; margin-bottom: 14px; }
.field label { font-weight: 600; font-size: .95rem; }
.field input, .field textarea {
  width: 100%; min-height: 50px; font: inherit; padding: 10px 14px; border-radius: 10px;
  border: 1.5px solid var(--line-2); background: var(--surface); color: var(--ink);
}
.field textarea { min-height: 110px; font-family: ui-monospace, Consolas, monospace; font-size: .85rem; direction: ltr; }
.field input:focus, .field textarea:focus { border-color: var(--accent); outline: none; box-shadow: 0 0 0 3px var(--accent-soft); }
.seg { display: inline-flex; border: 1px solid var(--line-2); border-radius: 10px; overflow: hidden; }
.seg button { font: inherit; font-size: .92rem; padding: 8px 16px; min-height: 44px; border: none; background: var(--surface); color: var(--ink-2); cursor: pointer; }
.seg button + button { border-inline-start: 1px solid var(--line-2); }
.seg button[aria-pressed="true"] { background: var(--accent); color: var(--accent-ink); }
.setting-row { display: flex; justify-content: space-between; align-items: center; gap: 14px; padding: 16px 0; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.setting-row:last-child { border-bottom: none; }
.setting-row h3 { margin: 0; font-size: 1rem; }
.setting-row p { margin: 2px 0 0; font-size: .88rem; color: var(--muted); }

/* ---------- Certificate ---------- */
.cert {
  background: #fffdf8; color: #1b2524; border: 1px solid #d9d2c2; border-radius: 6px;
  padding: clamp(24px, 5vw, 56px); text-align: center; position: relative;
  box-shadow: 0 20px 40px -24px rgba(0, 0, 0, .25);
}
.cert::before { content: ""; position: absolute; inset: 10px; border: 2px solid #0e6b5a; border-radius: 3px; pointer-events: none; }
.cert::after { content: ""; position: absolute; inset: 16px; border: 1px solid #c8bfa9; border-radius: 2px; pointer-events: none; }
.cert .seal { width: 70px; height: 70px; margin: 0 auto 14px; color: #0e6b5a; }
.cert .ttl { font-size: .95rem; letter-spacing: .02em; color: #5d6967; }
.cert h2 { font-size: clamp(1.4rem, 1rem + 2vw, 2.1rem); margin: 6px 0 18px; color: #1b2524; }
.cert .nm { font-size: clamp(1.6rem, 1.1rem + 2.5vw, 2.6rem); font-weight: 700; color: #0e6b5a; border-bottom: 1px solid #d9d2c2; display: inline-block; padding: 0 20px 6px; margin: 4px 0 16px; }
.cert p { color: #33403e; max-width: 46ch; margin-inline: auto; }
.cert .foot { display: flex; justify-content: space-between; margin-top: 30px; font-size: .85rem; color: #5d6967; gap: 16px; flex-wrap: wrap; }
.cert .foot b { color: #1b2524; display: block; font-size: .95rem; }

/* ---------- Footer ---------- */
.site-footer { border-top: 1px solid var(--line); padding: 26px 0; font-size: .9rem; color: var(--muted); }
.footer-inner { display: flex; justify-content: space-between; gap: 14px; flex-wrap: wrap; align-items: center; }
.footer-inner a { color: var(--ink-2); }
.footer-links { display: flex; gap: 16px; flex-wrap: wrap; }

/* ---------- Toast & modal ---------- */
.toast-host { position: fixed; z-index: 60; left: 50%; transform: translateX(-50%); bottom: calc(var(--tabbar-h) + 18px); display: grid; gap: 8px; width: min(92vw, 420px); pointer-events: none; }
.toast {
  display: flex; gap: 12px; align-items: center; background: var(--ink); color: var(--bg);
  padding: 12px 16px; border-radius: 12px; box-shadow: 0 8px 24px rgba(0, 0, 0, .2); font-size: .95rem;
  animation: toastIn .3s ease; pointer-events: auto;
}
.toast .ti { width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; background: var(--accent); color: #fff; flex: 0 0 auto; }
.toast .ti svg { width: 20px; height: 20px; }
.toast b { color: inherit; display: block; }
.toast.out { animation: toastOut .25s ease forwards; }
@keyframes toastIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@keyframes toastOut { to { opacity: 0; transform: translateY(10px); } }

.modal-back { position: fixed; inset: 0; z-index: 70; background: rgba(10, 16, 15, .45); display: grid; place-items: center; padding: 20px; animation: fade .15s ease; }
.modal { background: var(--surface); border-radius: 16px; padding: 24px; max-width: 440px; width: 100%; border: 1px solid var(--line); }
.modal h3 { margin-bottom: 6px; }
.modal .btn-row { justify-content: flex-end; margin-top: 18px; }
@keyframes fade { from { opacity: 0; } }

.empty { text-align: center; padding: 40px 20px; color: var(--muted); }
.lock-msg { display: flex; gap: 14px; align-items: center; }
.lock-msg svg { width: 40px; height: 40px; color: var(--muted); flex: 0 0 auto; }

/* page transition */
.view { animation: viewIn .25s ease; }
@keyframes viewIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}

/* ---------- Print (certificate only) ---------- */
@media print {
  @page { size: A4 landscape; margin: 12mm; }
  body { background: #fff; padding: 0; }
  .site-header, .site-footer, .tabbar, .no-print, .toast-host { display: none !important; }
  main { padding: 0; }
  .cert { box-shadow: none; border-color: #bbb; }
}
