/* ============================================================
   modules.css — view + simulation specific styles
   (hero, mission map, module shell, fake UIs, diagrams,
    drag-drop, quiz, code panels, boss, cheat sheet, about)
   ============================================================ */

/* ---------- Hero (landing) ---------- */
.hero { text-align: center; padding-block: 40px 20px; }
.hero__title { font-size: var(--fs-hero); font-weight: 700; }
.hero__title .fx { color: var(--text-3); }
.hero__by { margin-top: 6px; color: var(--text-3); font-family: var(--font-mono); font-size: var(--fs-xs); letter-spacing: 0.28em; text-transform: uppercase; }
.hero__tag { color: var(--text-2); font-size: 1.1rem; max-width: 52ch; margin: 20px auto 0; }
.hero__cta { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; margin-top: 32px; }
.hero__stats { display: flex; gap: 28px; justify-content: center; flex-wrap: wrap; margin-top: 44px; color: var(--text-3); }
.hero__stat b { display: block; font-family: var(--font-head); font-size: 1.6rem; color: var(--text); }
.hero__stat span { font-size: var(--fs-xs); font-family: var(--font-mono); letter-spacing: 0.12em; text-transform: uppercase; }
.hero--compact { padding-block: 40px 8px; }
.hero--compact .hero__stats { margin-top: 32px; }

/* Start row (Step 2 — begins the game once a level is chosen) */
.start-row { text-align: center; padding-top: 28px; padding-bottom: 48px; }
.start-row__cta { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; margin-top: 12px; }
.start-row__hint { margin-top: 14px; color: var(--text-3); font-size: var(--fs-sm); font-family: var(--font-mono); letter-spacing: 0.02em; }
.start-row .btn[disabled] { opacity: 0.45; cursor: not-allowed; pointer-events: none; }
.start-row .btn.is-ready { animation: startPulse 1.8s ease-in-out infinite; }
@keyframes startPulse { 0%, 100% { box-shadow: 0 0 0 0 rgba(255,255,255,0.0); } 50% { box-shadow: 0 0 0 4px rgba(255,255,255,0.12); } }
@media (prefers-reduced-motion: reduce) { .start-row .btn.is-ready { animation: none; } }

/* Level select cards on landing */
.levelcards { margin-top: 48px; }
.levelcard { cursor: pointer; text-align: left; display: flex; flex-direction: column; gap: 10px; }
.levelcard.is-selected { border-color: var(--text); background: var(--surface-2); }
.levelcard__head { display: flex; align-items: center; justify-content: space-between; }
.levelcard__dots { display: flex; gap: 4px; }
.levelcard__dots i { width: 8px; height: 8px; border-radius: 50%; border: 1px solid var(--border-2); }
.levelcard__dots i.on { background: var(--text); border-color: var(--text); }
.levelcard ul { list-style: none; padding: 0; margin: 4px 0 0; color: var(--text-2); font-size: var(--fs-sm); display: grid; gap: 6px; }
.levelcard ul li::before { content: "→ "; color: var(--text-3); }

/* ---------- Mission map ---------- */
.map__head { display: flex; flex-wrap: wrap; gap: 20px; align-items: flex-end; justify-content: space-between; margin-bottom: 8px; }
.map__progress { min-width: 240px; flex: 1; }
.map__progress .meta { display: flex; justify-content: space-between; font-size: var(--fs-sm); color: var(--text-2); margin-bottom: 8px; }
.nodes { margin-top: 36px; }
.node {
  display: flex; flex-direction: column; gap: 14px; min-height: 200px;
}
.node__top { display: flex; align-items: center; justify-content: space-between; }
.node__status {
  font-family: var(--font-mono); font-size: 10px; letter-spacing: 0.14em; text-transform: uppercase;
  padding: 3px 9px; border-radius: var(--radius-pill); border: 1px solid var(--border);
}
.node__status.locked { color: var(--text-3); }
.node__status.todo { color: var(--text); border-color: var(--border-2); }
.node__status.done { color: var(--safe); border-color: rgba(58,208,122,0.4); }
.node__icon { width: 40px; height: 40px; color: var(--text); }
.node.is-locked { opacity: 0.5; }
.node.is-locked:hover { transform: none; border-color: var(--border); background: var(--surface); }
.node__foot { margin-top: auto; display: flex; align-items: center; justify-content: space-between; }
.node__go { font-size: var(--fs-sm); color: var(--text); }
.badges-row { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 36px; }

/* ---------- Module shell ---------- */
.mod__header { display: flex; flex-wrap: wrap; gap: 14px; align-items: center; justify-content: space-between; }
.mod__kicker { display: flex; align-items: center; gap: 12px; }
.mod__num { font-family: var(--font-mono); color: var(--text-3); font-size: var(--fs-sm); }
.mod__panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: clamp(18px, 3vw, 32px); margin-top: 8px; }
.mod__steptitle { display: flex; align-items: center; gap: 12px; margin-bottom: 4px; }
.mod__steptitle .tag { font-family: var(--font-mono); font-size: 11px; letter-spacing: 0.16em; color: var(--text-3); text-transform: uppercase; }
.mod__instruction { color: var(--text-2); margin-bottom: 22px; max-width: 64ch; }
.mod__nav { display: flex; justify-content: space-between; gap: 12px; margin-top: 28px; }
.hint {
  display: flex; gap: 10px; align-items: flex-start; font-size: var(--fs-sm); color: var(--text-2);
  border: 1px dashed var(--border-2); border-radius: var(--radius); padding: 12px 14px; margin-top: 18px; background: var(--surface-2);
}
.hint b { color: var(--text); }
.hint svg { flex: 0 0 auto; margin-top: 2px; color: var(--text-3); }

/* ---------- Fake UIs (login, inbox, comments, bank) ---------- */
.fakeui { border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface-2); overflow: hidden; }
.fakeui__bar { display: flex; align-items: center; gap: 8px; padding: 10px 14px; border-bottom: 1px solid var(--border); background: var(--surface); }
.fakeui__dots { display: flex; gap: 6px; }
.fakeui__dots i { width: 10px; height: 10px; border-radius: 50%; background: var(--surface-3); border: 1px solid var(--border); }
.fakeui__url { flex: 1; font-family: var(--font-mono); font-size: var(--fs-xs); color: var(--text-3); background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius-pill); padding: 5px 12px; }
.fakeui__body { padding: 20px; }

.field { display: grid; gap: 6px; margin-bottom: 14px; }
.field label { font-size: var(--fs-xs); color: var(--text-3); font-family: var(--font-mono); letter-spacing: 0.08em; text-transform: uppercase; }
.input, .textarea {
  width: 100%; background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius-sm); color: var(--text);
  font-family: var(--font-mono); font-size: var(--fs-sm); padding: 11px 13px; transition: border-color var(--t-fast);
}
.input:focus, .textarea:focus { outline: none; border-color: var(--border-3); }
.textarea { resize: vertical; min-height: 72px; }

/* ---------- Code / query panels ---------- */
.code {
  font-family: var(--font-mono); font-size: var(--fs-sm); line-height: 1.75; background: var(--bg);
  border: 1px solid var(--border); border-radius: var(--radius); padding: 16px 18px; overflow-x: auto; white-space: pre-wrap; word-break: break-word;
}
.code__label { display: flex; align-items: center; justify-content: space-between; font-family: var(--font-mono); font-size: var(--fs-xs); letter-spacing: 0.1em; text-transform: uppercase; color: var(--text-3); margin-bottom: 8px; }
.tok-key { color: var(--text-2); }
.tok-str { color: var(--text); }
.tok-inject { color: var(--danger); background: var(--danger-dim); border-radius: 3px; padding: 0 3px; }
.tok-safe { color: var(--safe); background: var(--safe-dim); border-radius: 3px; padding: 0 3px; }
.tok-comment { color: var(--text-3); }

.codepair { display: grid; gap: 16px; }
@media (min-width: 760px) { .codepair { grid-template-columns: 1fr 1fr; } }
.codecol h4 { font-family: var(--font-mono); font-size: var(--fs-xs); letter-spacing: 0.1em; text-transform: uppercase; margin-bottom: 8px; display: flex; align-items: center; gap: 8px; }
.codecol--bad h4 { color: var(--danger); }
.codecol--good h4 { color: var(--safe); }
.codecol--bad .code { border-color: rgba(255,82,87,0.35); }
.codecol--good .code { border-color: rgba(58,208,122,0.35); }

/* ---------- Status banner (attack result) ---------- */
.result {
  display: flex; align-items: center; gap: 12px; border-radius: var(--radius); padding: 14px 16px; margin-top: 18px;
  font-weight: 500; border: 1px solid var(--border); opacity: 0; transform: translateY(6px); transition: opacity var(--t), transform var(--t);
}
.result.show { opacity: 1; transform: none; }
.result--danger { border-color: rgba(255,82,87,0.5); background: var(--danger-dim); color: #ffb4b6; }
.result--safe { border-color: rgba(58,208,122,0.5); background: var(--safe-dim); color: #b7f0cf; }
.result__icon { width: 22px; height: 22px; flex: 0 0 auto; }
@keyframes flashRed { 0%,100%{background:var(--danger-dim)} 50%{background:rgba(255,82,87,0.34)} }
.flash-danger { animation: flashRed .5s 2; }

/* ---------- Toggle switch ---------- */
.toggle { display: flex; align-items: center; gap: 12px; cursor: pointer; }
.toggle__track { width: 48px; height: 27px; border-radius: var(--radius-pill); background: var(--surface-3); border: 1px solid var(--border-2); position: relative; transition: background var(--t); flex: 0 0 auto; }
.toggle__thumb { position: absolute; top: 2px; left: 2px; width: 21px; height: 21px; border-radius: 50%; background: var(--text-2); transition: transform var(--t), background var(--t); }
.toggle input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.toggle input:checked + .toggle__track { background: var(--safe); border-color: var(--safe); }
.toggle input:checked + .toggle__track .toggle__thumb { transform: translateX(21px); background: #000; }
.toggle input:focus-visible + .toggle__track { outline: 2px solid var(--text); outline-offset: 2px; }
.toggle__text b { display: block; }
.toggle__text span { color: var(--text-3); font-size: var(--fs-xs); }

/* ---------- Diagram (SEE IT) ---------- */
.diagram { background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius); padding: 10px; }
.diagram svg { width: 100%; height: auto; }
.dg-label { font-family: var(--font-mono); font-size: 10px; fill: var(--text-2); letter-spacing: 0.08em; text-transform: uppercase; }
.dg-node { fill: var(--surface-2); stroke: var(--border-2); }
.dg-line { stroke: var(--border-2); stroke-width: 1.5; fill: none; }
.dg-packet { fill: var(--danger); }
.dg-packet--safe { fill: var(--safe); }
@keyframes flow { to { stroke-dashoffset: -400; } }
.dg-flow { stroke-dasharray: 6 10; animation: flow 6s linear infinite; }

/* ---------- Drag & drop ---------- */
.dnd { display: grid; gap: 18px; }
@media (min-width: 720px) { .dnd { grid-template-columns: 1fr 1fr; } }
.dnd__col { border: 1px solid var(--border); border-radius: var(--radius); padding: 14px; min-height: 120px; background: var(--surface-2); }
.dnd__col h4 { font-family: var(--font-mono); font-size: var(--fs-xs); letter-spacing: 0.1em; text-transform: uppercase; color: var(--text-3); margin-bottom: 12px; }
.dnd__col.drop-ok { border-color: var(--safe); }
.dnd__col.drop-over { border-color: var(--border-3); background: var(--surface-3); }
.token {
  display: flex; align-items: center; gap: 10px; background: var(--surface-3); border: 1px solid var(--border-2); border-radius: var(--radius-sm);
  padding: 10px 12px; margin-bottom: 8px; cursor: grab; font-size: var(--fs-sm); transition: border-color var(--t-fast), transform var(--t-fast);
}
.token:hover { border-color: var(--border-3); }
.token:active { cursor: grabbing; }
.token.dragging { opacity: 0.5; }
.token__grip { color: var(--text-3); font-family: var(--font-mono); }
.token--placed { border-color: var(--safe); }

/* ---------- Quiz ---------- */
.quiz { display: grid; gap: 22px; }
.qcard { border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; background: var(--surface-2); }
.qcard__q { font-weight: 600; margin-bottom: 14px; }
.qopts { display: grid; gap: 10px; }
.qopt {
  text-align: left; border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 12px 14px; color: var(--text-2);
  transition: border-color var(--t-fast), color var(--t-fast), background var(--t-fast); display: flex; align-items: center; gap: 10px;
}
.qopt:hover { border-color: var(--border-2); color: var(--text); }
.qopt.correct { border-color: var(--safe); color: #b7f0cf; background: var(--safe-dim); }
.qopt.wrong { border-color: var(--danger); color: #ffb4b6; background: var(--danger-dim); }
.qopt__key { font-family: var(--font-mono); font-size: var(--fs-xs); color: var(--text-3); border: 1px solid var(--border); border-radius: 5px; width: 22px; height: 22px; display: grid; place-items: center; flex: 0 0 auto; }

/* ---------- Completion / badge award ---------- */
.award { text-align: center; padding: 20px 0; }
.award__badge { width: 96px; height: 96px; margin: 0 auto 18px; border-radius: 50%; border: 1px solid var(--border-2); display: grid; place-items: center; background: var(--surface-2); }
.award__badge svg { width: 44px; height: 44px; color: var(--text); }
@keyframes pop { 0%{transform:scale(.6);opacity:0} 60%{transform:scale(1.08)} 100%{transform:scale(1);opacity:1} }
.pop { animation: pop var(--t-slow) both; }

/* ---------- Inbox / email (phishing) ---------- */
.inbox { display: grid; gap: 2px; }
.mailrow { display: grid; grid-template-columns: auto 1fr auto; gap: 12px; align-items: center; padding: 12px 14px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface-2); cursor: pointer; transition: border-color var(--t-fast); }
.mailrow:hover { border-color: var(--border-2); }
.mailrow.is-open { border-color: var(--border-3); }
.mailrow__from { font-weight: 600; font-size: var(--fs-sm); }
.mailrow__sub { color: var(--text-2); font-size: var(--fs-sm); }
.mailrow__time { color: var(--text-3); font-size: var(--fs-xs); font-family: var(--font-mono); }
.mail { border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; margin-top: 12px; background: var(--surface-2); }
.flag {
  position: relative; border-bottom: 1px dashed var(--border-3); cursor: pointer; transition: background var(--t-fast);
}
.flag:hover { background: var(--surface-3); }
.flag.found { background: var(--danger-dim); border-bottom-color: var(--danger); color: #ffb4b6; }
.flag.decoy.found { background: var(--surface-3); border-bottom-color: var(--border-2); color: var(--text-3); }
.flags-score { font-family: var(--font-mono); font-size: var(--fs-sm); color: var(--text-2); }

/* ---------- Meters (ddos load, password crack) ---------- */
.meter { height: 14px; border-radius: var(--radius-pill); background: var(--surface-2); border: 1px solid var(--border); overflow: hidden; }
.meter__fill { height: 100%; width: 0; background: var(--safe); transition: width .3s linear, background .3s; }
.meter__fill.mid { background: var(--warn); }
.meter__fill.high { background: var(--danger); }
.meter__cap { display: flex; justify-content: space-between; font-family: var(--font-mono); font-size: var(--fs-xs); color: var(--text-3); margin-bottom: 6px; }

/* ---------- Boss challenge ---------- */
.boss__site { border: 1px solid var(--border); border-radius: var(--radius-lg); overflow: hidden; }
.boss__threats { display: grid; gap: 12px; margin-top: 22px; }
.threat { display: flex; align-items: center; gap: 14px; justify-content: space-between; border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; background: var(--surface-2); }
.threat.caught { border-color: var(--safe); }
.threat__status { font-family: var(--font-mono); font-size: var(--fs-xs); color: var(--text-3); }
.threat.caught .threat__status { color: var(--safe); }

/* ---------- Cheat sheet ---------- */
.cheat-grid { display: grid; gap: 16px; }
@media (min-width: 620px) { .cheat-grid { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 940px) { .cheat-grid { grid-template-columns: repeat(3, 1fr); } }
.cheat { display: flex; flex-direction: column; gap: 10px; }
.cheat__icon { width: 34px; height: 34px; color: var(--text); }
.cheat__name { font-family: var(--font-head); font-weight: 600; }
.cheat__def { color: var(--text-2); font-size: var(--fs-sm); }
.cheat__def b { color: var(--text); }

/* ---------- About ---------- */
.about__grid { display: grid; gap: 20px; margin-top: 28px; }
@media (min-width: 760px) { .about__grid { grid-template-columns: 1.4fr 1fr; } }
.stacklist { list-style: none; padding: 0; display: grid; gap: 10px; }
.stacklist li { display: flex; gap: 10px; align-items: baseline; color: var(--text-2); font-size: var(--fs-sm); }
.stacklist b { color: var(--text); font-family: var(--font-mono); font-size: var(--fs-xs); min-width: 92px; }

/* ---------- Empty / coming soon ---------- */
.soon { text-align: center; padding: 60px 20px; }
.soon svg { width: 48px; height: 48px; color: var(--text-3); margin: 0 auto 16px; }
