/* Learning Quizzes: lesson cards, name bar, theory pages, leaderboard. */

.lesson-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 16px; margin-bottom: 20px; }
.lesson-card { display: block; background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 20px; text-decoration: none; color: inherit; transition: transform .2s ease, box-shadow .2s ease, border-color .2s ease; }
.lesson-card:hover { transform: translateY(-3px); box-shadow: 0 10px 24px rgba(49, 49, 49, .1); border-color: var(--brand); }
.lesson-icon { font-size: 28px; margin-bottom: 8px; }
.lesson-card h2 { font-size: 17px; margin: 0 0 6px; color: var(--ink); }
.lesson-card p { font-size: 13.5px; color: var(--muted); margin: 0 0 10px; min-height: 36px; }
.lesson-meta { font-size: 12.5px; color: var(--brand-dark); font-weight: 600; }

table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
th, td { padding: 8px 10px; border-bottom: 1px solid #e4e9ef; text-align: left; }
th { background: #eef3fa; color: var(--brand-dark); }

.learn-name-bar { display: flex; align-items: flex-end; gap: 12px; flex-wrap: wrap; }
.learn-name-bar label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 4px; font-weight: 600; }
.learn-name-bar input { padding: 10px; border: 1px solid #cfcfcf; border-radius: 8px; font-size: 15px; min-width: 240px; }
.learn-name-bar .field-err { flex-basis: 100%; }

.theory-card h2 { font-size: 18px; margin: 4px 0 10px; color: var(--ink); }
.theory-body { font-size: 14.5px; line-height: 1.6; color: var(--ink); }
.theory-body ul { margin: 6px 0; padding-left: 20px; }
.theory-body li { margin: 4px 0; }

/* Theory content rises in one block after another. */
.step.active .theory-body > * { animation: theoryRise .45s cubic-bezier(.2, .7, .3, 1) both; }
.step.active .theory-body > *:nth-child(2) { animation-delay: .08s; }
.step.active .theory-body > *:nth-child(3) { animation-delay: .16s; }
.step.active .theory-body > *:nth-child(4) { animation-delay: .24s; }
.step.active .theory-body > *:nth-child(5) { animation-delay: .32s; }
.step.active .theory-body > *:nth-child(n+6) { animation-delay: .4s; }
@keyframes theoryRise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

/* Lesson cards on the index page appear with a stagger. */
.lesson-grid .lesson-card { animation: lessonIn .45s ease both; }
.lesson-grid .lesson-card:nth-child(2) { animation-delay: .05s; }
.lesson-grid .lesson-card:nth-child(3) { animation-delay: .1s; }
.lesson-grid .lesson-card:nth-child(4) { animation-delay: .15s; }
.lesson-grid .lesson-card:nth-child(5) { animation-delay: .2s; }
.lesson-grid .lesson-card:nth-child(6) { animation-delay: .25s; }
.lesson-grid .lesson-card:nth-child(7) { animation-delay: .3s; }
.lesson-grid .lesson-card:nth-child(8) { animation-delay: .35s; }
.lesson-grid .lesson-card:nth-child(9) { animation-delay: .4s; }
.lesson-grid .lesson-card:nth-child(n+10) { animation-delay: .45s; }
@keyframes lessonIn { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }

/* ---- theory illustrations: pure CSS + emoji, no external images ---- */

/* Fake e-mail mock-up for phishing / email lessons. */
.mail-mock { border: 1px solid var(--line); border-radius: 12px; overflow: hidden; margin: 14px 0; background: #fff; box-shadow: 0 6px 18px rgba(49, 49, 49, 0.07); font-size: 13.5px; }
.mail-mock .mm-head { background: #f6f8fb; padding: 10px 14px; border-bottom: 1px solid var(--line); }
.mail-mock .mm-row { margin: 3px 0; color: var(--muted); }
.mail-mock .mm-row b { color: var(--ink); font-weight: 600; }
.mail-mock .mm-body { padding: 12px 14px; line-height: 1.55; }
.mail-mock .mm-flag { background: var(--redt); border: 1px dashed var(--red); border-radius: 6px; padding: 1px 6px; white-space: nowrap; }
.mail-mock .mm-link { color: #1a6fd4; text-decoration: underline; word-break: break-all; }

/* Messenger chat mock-up for social-engineering lessons. */
.chat-mock { max-width: 440px; margin: 14px 0; }
.chat-mock .bubble { border-radius: 14px; padding: 10px 14px; margin: 6px 0; font-size: 13.5px; line-height: 1.5; }
.chat-mock .bubble.them { background: #eef1f5; border-top-left-radius: 4px; margin-right: 40px; }
.chat-mock .bubble.me { background: var(--tint); border-top-right-radius: 4px; margin-left: 40px; }
.chat-mock .who { font-size: 11.5px; color: var(--muted); margin-top: 10px; }

/* Two-column "do / don't" grid. */
.do-dont { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin: 14px 0; }
.do-dont .do, .do-dont .dont { border-radius: 12px; padding: 12px 14px; font-size: 13.5px; }
.do-dont .do { background: var(--tint); border: 1px solid rgba(109, 172, 58, 0.4); }
.do-dont .dont { background: var(--redt); border: 1px solid rgba(241, 30, 30, 0.3); }
.do-dont h4 { margin: 0 0 8px; font-size: 13.5px; }
.do-dont .do h4 { color: var(--brand-dark); }
.do-dont .dont h4 { color: var(--red); }
.do-dont ul { margin: 0; padding-left: 18px; }
.do-dont li { margin: 4px 0; }

/* Callout tip box. */
.tipbox { display: flex; gap: 12px; align-items: flex-start; background: #eef6ff; border: 1px solid #c4dcf5; border-radius: 12px; padding: 12px 14px; margin: 14px 0; font-size: 13.5px; line-height: 1.55; }
.tipbox .ti { font-size: 22px; line-height: 1; }

/* Password strength meter rows. */
.meter { margin: 14px 0; }
.meter-row { display: flex; align-items: center; gap: 10px; margin: 7px 0; font-size: 13px; }
.meter-row code { flex: 0 0 210px; background: #f4f4f4; border-radius: 6px; padding: 3px 8px; font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.meter-bar { flex: 1; height: 10px; border-radius: 6px; background: #eee; overflow: hidden; }
.meter-bar i { display: block; height: 100%; border-radius: 6px; }
.meter-bar .weak { width: 15%; background: var(--red); }
.meter-bar .fair { width: 45%; background: var(--yellow); }
.meter-bar .strong { width: 100%; background: var(--brand); }
.meter-row .mlabel { flex: 0 0 90px; text-align: right; font-weight: 600; }
.meter-row .mlabel.weak { color: var(--red); }
.meter-row .mlabel.fair { color: var(--yellow); }
.meter-row .mlabel.strong { color: var(--brand-dark); }

/* Numbered mini-flow: what to do, in order. */
.flow { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 14px 0; }
.flow span { background: #fff; border: 1px solid var(--line); border-radius: 20px; padding: 6px 12px; font-size: 13px; white-space: nowrap; }
.flow span b { color: var(--brand-dark); }
.flow .arr { border: none; background: none; color: var(--muted); padding: 0 2px; }

@media (max-width: 560px) {
  .do-dont { grid-template-columns: 1fr; }
  .meter-row code { flex-basis: 140px; }
}

@media (prefers-reduced-motion: reduce) {
  .step.active .theory-body > *, .lesson-grid .lesson-card { animation: none; }
}

/* ---- interactive lesson pages ---- */
.q .hint { font-size: 13px; color: var(--muted); margin: -4px 0 8px; }
.q .letter { color: var(--muted); font-weight: 600; }
.q label.opt { border: 1px solid transparent; transition: background .15s ease, border-color .15s ease; }
.q.checked label.opt { cursor: default; }
.q.checked label.opt:hover { background: none; }
.q label.opt.is-correct { background: var(--tint); border-color: var(--brand); font-weight: 600; }
.q label.opt.is-wrong { background: var(--redt); border-color: var(--red); }
.q label.opt.is-missed { border: 1px dashed var(--brand); }
.q .expl[hidden] { display: none; }
.q .expl { animation: theoryRise .3s ease both; }

/* Check button for multi-select and classify pages. */
.q .btn-check { margin-top: 10px; padding: 9px 18px; font-size: 14px; }
.q.checked .btn-check { display: none; }

/* True / false: two big buttons. */
.tf-statement { font-size: 17px; line-height: 1.5; }
.tf-row { display: flex; gap: 12px; flex-wrap: wrap; }
.q .tf-btn { flex: 1; min-width: 140px; background: #fff; color: var(--ink); border: 2px solid var(--line); font-size: 16px; padding: 14px; transition: transform .15s ease, border-color .15s ease; }
.q .tf-btn:hover:not(:disabled) { border-color: var(--brand); transform: translateY(-2px); background: #fff; }
.q .tf-btn:disabled { background: #fff; color: var(--ink); opacity: .55; cursor: default; }
.q .tf-btn.is-correct:disabled { opacity: 1; border-color: var(--brand); background: var(--tint); }
.q .tf-btn.is-wrong:disabled { opacity: 1; border-color: var(--red); background: var(--redt); }

/* Classify: each item gets a row of category chips. */
.cls-list { display: flex; flex-direction: column; gap: 8px; }
.cls-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; }
.cls-row.is-correct { border-color: var(--brand); background: var(--tint); }
.cls-row.is-wrong { border-color: var(--red); background: var(--redt); }
.cls-text { flex: 1 1 260px; font-size: 14.5px; }
.cls-chips { display: flex; gap: 6px; flex-wrap: wrap; }
.q .cat-chip { padding: 6px 12px; font-size: 13px; border-radius: 20px; background: #fff; color: var(--ink); border: 1px solid var(--line); font-weight: 600; }
.q .cat-chip:hover:not(:disabled) { background: #f6f6f6; }
.q .cat-chip:disabled { cursor: default; background: #fff; color: var(--muted); }
.q .cat-chip.cat-0.on { background: var(--brand); border-color: var(--brand); color: #fff; }
.q .cat-chip.cat-1.on { background: var(--yellow); border-color: var(--yellow); color: #fff; }
.q .cat-chip.cat-2.on { background: var(--red); border-color: var(--red); color: #fff; }
.q .cat-chip.cat-3.on { background: #4a7bd0; border-color: #4a7bd0; color: #fff; }
.cls-fix { flex-basis: 100%; font-size: 13px; color: var(--red); font-weight: 600; }
.cls-fix:empty { display: none; }

/* "Find the signs" hotspots inside theory mock-ups. */
.hotspot { cursor: pointer; border-bottom: 2px dotted #b9b9b9; border-radius: 4px; padding: 0 2px; transition: background .15s ease; }
.hotspot:hover, .hotspot:focus { background: #fff3c4; outline: none; }
.hotspot.found { background: var(--redt); border: 1px dashed var(--red); cursor: default; }
.hs-num { display: inline-block; min-width: 16px; margin-left: 3px; padding: 0 4px; border-radius: 8px; background: var(--red); color: #fff; font-size: 10.5px; font-weight: 700; text-align: center; line-height: 16px; }
.hs-found { margin: 0 0 12px; padding-left: 0; list-style: none; counter-reset: hs; }
.hs-found li { counter-increment: hs; position: relative; margin: 6px 0; padding: 7px 10px 7px 36px; border-radius: 8px; background: #fff8f8; border: 1px solid rgba(241, 30, 30, .2); font-size: 13.5px; animation: theoryRise .3s ease both; }
.hs-found li::before { content: counter(hs); position: absolute; left: 10px; top: 7px; width: 18px; height: 18px; border-radius: 50%; background: var(--red); color: #fff; font-size: 11px; font-weight: 700; text-align: center; line-height: 18px; }
.hs-counter { margin-bottom: 10px; padding: 8px 12px; border-radius: 8px; background: #fff7e6; border: 1px solid #f3d9a4; font-size: 13.5px; }
.hs-counter.done { background: var(--tint); border-color: rgba(109, 172, 58, .4); }

/* Data "traffic light" legend. */
.traffic { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin: 14px 0; }
.traffic > div { border-radius: 12px; padding: 12px 14px; font-size: 13.5px; line-height: 1.5; border: 1px solid var(--line); }
.traffic h4 { margin: 0 0 6px; font-size: 14px; }
.traffic .g { background: var(--tint); border-color: rgba(109, 172, 58, .4); }
.traffic .y { background: var(--yellowt); border-color: #f3d9a4; }
.traffic .r { background: var(--redt); border-color: rgba(241, 30, 30, .3); }

/* Lesson list: per-browser progress badge and duration. */
.lesson-card { position: relative; }
.lesson-done { position: absolute; top: 14px; right: 14px; font-size: 12px; font-weight: 700; padding: 2px 9px; border-radius: 20px; background: var(--tint); color: var(--brand-dark); }
.lesson-done.part { background: var(--yellowt); color: #a8770f; }
.lesson-done[hidden] { display: none; }

@media (max-width: 560px) {
  .traffic { grid-template-columns: 1fr; }
}

/* ---- scenario questions, order, flashcards, password lab ---- */
.scene { margin: 6px 0 12px; }
.scene .chat-mock, .scene .mail-mock { margin: 0; }
.cls-sub { font-size: 12.5px; color: var(--muted); margin-top: 2px; }

/* Order: tap steps in sequence. */
.ord-list { display: flex; flex-direction: column; gap: 8px; }
.q .ord-item { display: flex; align-items: center; gap: 12px; width: 100%; text-align: left; background: #fff; color: var(--ink); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; font-size: 14.5px; font-weight: 500; }
.q .ord-item:hover { background: #f6faf2; border-color: var(--brand); }
.q .ord-item.on { border-color: var(--brand); background: var(--tint); }
.ord-num { flex: 0 0 26px; height: 26px; border-radius: 50%; border: 2px dashed #c9c9c9; display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 13px; color: #fff; }
.ord-item.on .ord-num { border: none; background: var(--brand); }
.ord-actions { display: flex; gap: 8px; align-items: center; }
.q .btn-reset { margin-top: 10px; padding: 9px 18px; font-size: 14px; }
.ord-correct { margin: 0; padding-left: 0; list-style: none; counter-reset: ord; }
.ord-correct li { counter-increment: ord; position: relative; margin: 6px 0; padding: 9px 12px 9px 46px; border-radius: 10px; border: 1px solid var(--brand); background: var(--tint); font-size: 14.5px; }
.ord-correct li.bad { border-color: var(--red); background: var(--redt); }
.ord-correct li::before { content: counter(ord); position: absolute; left: 12px; top: 8px; width: 24px; height: 24px; border-radius: 50%; background: var(--brand); color: #fff; font-weight: 700; font-size: 13px; text-align: center; line-height: 24px; }
.ord-correct li.bad::before { background: var(--red); }

/* Flashcards. */
.flip-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 10px; margin: 14px 0; }
.flip-card { position: relative; min-height: 118px; perspective: 800px; cursor: pointer; outline: none; }
.flip-card .front, .flip-card .back { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 12px; border-radius: 12px; backface-visibility: hidden; -webkit-backface-visibility: hidden; transition: transform .45s cubic-bezier(.2, .7, .3, 1); }
.flip-card .front { background: linear-gradient(135deg, var(--tint), #e3f1f0); border: 1px solid rgba(109, 172, 58, .35); font-weight: 700; font-size: 15px; }
.flip-card .front small { display: block; margin-top: 6px; font-weight: 400; font-size: 11.5px; color: var(--muted); }
.flip-card .back { background: #fff; border: 1px solid var(--line); font-size: 13px; line-height: 1.45; transform: rotateY(180deg); }
.flip-card.flipped .front { transform: rotateY(180deg); }
.flip-card.flipped .back { transform: rotateY(360deg); }
.flip-card:focus-visible .front, .flip-card:focus-visible .back { box-shadow: 0 0 0 3px rgba(109, 172, 58, .35); }

/* Password lab. */
.pw-lab { margin: 14px 0; padding: 14px; border: 1px solid var(--line); border-radius: 12px; background: #fafcf8; }
.pw-label { display: block; font-size: 13px; color: var(--muted); font-weight: 600; margin-bottom: 6px; }
.pw-lab .pw-input { font-family: Consolas, monospace; }
.pw-meter { height: 10px; border-radius: 6px; background: #eee; overflow: hidden; margin: 10px 0 6px; }
.pw-meter i { display: block; height: 100%; width: 0; border-radius: 6px; transition: width .3s ease, background .3s ease; }
.pw-lab[data-level="1"] .pw-meter i { width: 20%; background: var(--red); }
.pw-lab[data-level="2"] .pw-meter i { width: 45%; background: #f08a24; }
.pw-lab[data-level="3"] .pw-meter i { width: 72%; background: var(--yellow); }
.pw-lab[data-level="4"] .pw-meter i { width: 100%; background: var(--brand); }
.pw-verdict { font-size: 14px; min-height: 20px; }
.pw-notes { margin: 6px 0 0; padding-left: 18px; font-size: 13px; color: var(--muted); }
.pw-privacy { margin-top: 8px; font-size: 12px; color: var(--muted); }

@media (prefers-reduced-motion: reduce) {
  .flip-card .front, .flip-card .back { transition: none; }
}
