/* ============================================================
   Stage 1 Digital Technologies - Cyber Security
   Design system
   Navy structure. Amber means "caution" and marks locked or
   restricted things. Teal means secure or complete. Red means
   a threat. Unbounded for big numerals and headings,
   Instrument Sans for reading, JetBrains Mono for labels,
   code and data.
   ============================================================ */

:root {
  --bg: #f5f6fa;
  --surface: #ffffff;
  --surface-2: #edf0f6;
  --navy: #0b1330;
  --navy-2: #141e45;
  --navy-line: #26325e;

  --ink: #10162b;
  --muted: #5b6480;
  --muted-2: #8b93ab;
  --on-dark: #eaeef8;
  --on-dark-muted: #9aa6c8;

  --line: #e2e6ef;
  --line-strong: #c9cfdd;

  --accent: #f5b32b;
  --accent-soft: #fff3d6;
  --accent-ink: #6e4a00;
  --teal: #0ea5a0;
  --teal-soft: #d6f3f1;
  --teal-ink: #0a5f5c;
  --red: #e5484d;
  --red-soft: #fce3e4;
  --red-ink: #8f2126;

  --font-display: "Unbounded", "Segoe UI", system-ui, sans-serif;
  --font-body: "Instrument Sans", "Segoe UI", system-ui, -apple-system, sans-serif;
  --font-mono: "JetBrains Mono", "SFMono-Regular", ui-monospace, Consolas, monospace;

  /* the tab-corner card shape: square top-left, rounded elsewhere */
  --r-card: 4px 18px 18px 18px;
  --r-tile: 4px 22px 22px 22px;
  --r-btn: 10px;

  --shadow-hover: 0 14px 34px rgba(11, 19, 48, 0.12);
  --shadow-float: 0 24px 60px rgba(11, 19, 48, 0.22);

  --maxw: 1120px;
  --readw: 46rem;

  --hatch: repeating-linear-gradient(-45deg, var(--accent) 0 10px, var(--navy) 10px 20px);
  --hex: url("data:image/svg+xml;utf8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='360' height='108'%3E%3Cg font-family='Courier New, monospace' font-size='11' fill='rgba(255,255,255,0.065)'%3E%3Ctext x='0' y='14'%3E7f 45 4c 46 02 01 01 00 00 00 00 00 00 00 00 00 03 00 3e 00 01 00%3C/text%3E%3Ctext x='0' y='32'%3E48 89 e5 48 83 ec 10 c7 45 fc 00 00 00 00 8b 45 fc 83 c0 01 89 45%3C/text%3E%3Ctext x='0' y='50'%3E4f 57 41 53 50 20 4a 75 69 63 65 20 53 68 6f 70 20 43 54 46 20 21%3C/text%3E%3Ctext x='0' y='68'%3E2f 65 74 63 2f 70 61 73 73 77 64 00 27 20 4f 52 20 31 3d 31 20 2d%3C/text%3E%3Ctext x='0' y='86'%3E53 45 4c 45 43 54 20 2a 20 46 52 4f 4d 20 75 73 65 72 73 3b 00 00%3C/text%3E%3Ctext x='0' y='104'%3E3c 69 66 72 61 6d 65 20 73 72 63 3d 22 6a 61 76 61 73 63 72 69 70%3C/text%3E%3C/g%3E%3C/svg%3E");
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 17px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

h1, h2 {
  font-family: var(--font-display);
  font-weight: 700;
  line-height: 1.12;
  letter-spacing: -0.02em;
  color: var(--ink);
  margin: 0 0 0.5em;
}
h1 { font-size: clamp(1.8rem, 4.2vw, 2.6rem); }
h2 { font-size: clamp(1.3rem, 2.6vw, 1.7rem); font-weight: 600; }
h3, h4 {
  font-family: var(--font-body);
  font-weight: 700;
  line-height: 1.25;
  color: var(--ink);
  margin: 0 0 0.45em;
}
h3 { font-size: 1.22rem; }
h4 { font-size: 1.02rem; }

p { margin: 0 0 1rem; }
a { color: var(--navy); text-decoration-thickness: 1px; text-underline-offset: 2px; }
a:hover { color: var(--accent-ink); }
img { max-width: 100%; display: block; }
::selection { background: var(--accent); color: #1a1205; }

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

.container { width: 100%; max-width: var(--maxw); margin: 0 auto; padding: 0 24px; }
.muted { color: var(--muted); }
.mono { font-family: var(--font-mono); }
.center { text-align: center; }
main { flex: 1 0 auto; }
.section { padding: 64px 0; }
.section-tight { padding: 40px 0; }
.lead { font-size: 1.14rem; color: var(--muted); line-height: 1.6; }
.hidden { display: none !important; }

/* mono label with a short rule, used as an eyebrow */
.eyebrow {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--accent-ink);
  margin: 0 0 0.7rem;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}
.eyebrow::before { content: ""; width: 20px; height: 2px; background: var(--accent); }
.eyebrow.on-dark { color: var(--accent); }

.skip-link { position: absolute; left: -999px; top: 8px; background: var(--accent); color: #1a1205; padding: 10px 16px; border-radius: 8px; z-index: 200; font-weight: 700; }
.skip-link:focus { left: 12px; }

/* ============================================================
   Dark panels (header, hero, practical console, footer)
   ============================================================ */
.dark {
  background-color: var(--navy);
  background-image:
    radial-gradient(900px 380px at 90% -20%, rgba(245,179,43,0.10), transparent 60%),
    var(--hex);
  color: var(--on-dark);
}
.dark h1, .dark h2, .dark h3 { color: #fff; }
.dark .lead { color: var(--on-dark-muted); }

/* ============================================================
   Header
   ============================================================ */
.site-header {
  background: var(--navy);
  color: var(--on-dark);
  position: sticky;
  top: 0;
  z-index: 100;
  border-bottom: 1px solid var(--navy-line);
}
.site-header .container { display: flex; align-items: center; gap: 16px; min-height: 68px; }

.brand { display: inline-flex; align-items: center; gap: 11px; color: var(--on-dark); text-decoration: none; }
.brand:hover { color: #fff; }
.brand .glyph { width: 34px; height: 34px; flex: none; }
.brand .wm-top { display: block; font-family: var(--font-mono); font-size: 0.6rem; letter-spacing: 0.16em; color: var(--accent); font-weight: 600; }
.brand .wm-main { display: block; font-family: var(--font-display); font-size: 0.98rem; font-weight: 600; letter-spacing: -0.01em; line-height: 1.2; color: #fff; }

.nav { display: flex; gap: 2px; margin-left: 10px; flex-wrap: wrap; }
.nav a { color: var(--on-dark-muted); text-decoration: none; font-size: 0.92rem; font-weight: 500; padding: 7px 12px; border-radius: 8px; transition: color .15s, background .15s; }
.nav a:hover { color: #fff; background: rgba(255,255,255,0.06); }
.nav a.active { color: #fff; box-shadow: inset 0 -2px 0 var(--accent); border-radius: 8px 8px 0 0; }
.header-right { margin-left: auto; display: flex; align-items: center; gap: 10px; }

.level-chip {
  display: inline-flex; align-items: center; gap: 8px;
  font-family: var(--font-mono); font-size: 0.7rem; letter-spacing: 0.06em;
  color: var(--on-dark); background: rgba(255,255,255,0.05);
  border: 1px solid var(--navy-line); padding: 6px 11px; border-radius: 999px; text-decoration: none;
}
.level-chip .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 3px rgba(245,179,43,0.2); }
.level-chip:hover { border-color: var(--accent); color: #fff; }

.menu-toggle { display: none; background: transparent; border: 1px solid var(--navy-line); color: var(--on-dark); border-radius: 8px; padding: 8px 10px; cursor: pointer; }

/* ============================================================
   Buttons
   ============================================================ */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 9px;
  font-family: var(--font-body); font-weight: 600; font-size: 0.96rem; line-height: 1;
  padding: 13px 22px; border-radius: var(--r-btn); border: 1px solid transparent;
  cursor: pointer; text-decoration: none; white-space: nowrap;
  transition: transform .06s ease, background .15s, border-color .15s, box-shadow .15s, color .15s;
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--navy); color: #fff; }
.btn-primary:hover { background: var(--navy-2); color: #fff; }
.btn-accent { background: var(--accent); color: #1a1205; }
.btn-accent:hover { background: #ffc043; color: #1a1205; }
.btn-ghost { background: transparent; border-color: var(--line-strong); color: var(--ink); }
.btn-ghost:hover { border-color: var(--navy); background: var(--surface); }
.btn-on-dark { background: rgba(255,255,255,0.08); color: #fff; border-color: var(--navy-line); }
.btn-on-dark:hover { background: rgba(255,255,255,0.16); color: #fff; }
.btn-danger { background: var(--red); color: #fff; }
.btn-danger:hover { background: #cf3b40; color: #fff; }
.btn-sm { padding: 9px 14px; font-size: 0.88rem; }
.btn-block { width: 100%; }
.btn[disabled], .btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }
.btn-row { display: flex; gap: 12px; flex-wrap: wrap; }

/* ============================================================
   Cards. Square top-left corner, mono tab label sits there.
   ============================================================ */
.card {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-card);
}
.card-pad { padding: 24px; }
.card.has-tab { padding-top: 40px; }
.card-tab {
  position: absolute; top: -1px; left: -1px;
  background: var(--navy); color: var(--accent);
  font-family: var(--font-mono); font-size: 0.64rem; font-weight: 600;
  letter-spacing: 0.14em; text-transform: uppercase;
  padding: 6px 12px; border-radius: 4px 0 12px 0;
}
.card-tab.teal { color: var(--teal); }
.card.soft { background: var(--surface-2); border-color: transparent; }
.card.dark { border-color: var(--navy); }
.card.dark .card-tab { background: var(--accent); color: #1a1205; }

.grid { display: grid; gap: 20px; }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-auto { grid-template-columns: repeat(auto-fill, minmax(270px, 1fr)); }

/* ============================================================
   Module tiles - the signature
   ============================================================ */
.tiles { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.tile {
  position: relative;
  display: flex; flex-direction: column; gap: 10px;
  min-height: 236px;
  padding: 20px 22px 26px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-tile);
  color: inherit; text-decoration: none;
  overflow: hidden;
  transition: transform .15s, border-color .15s, box-shadow .15s;
}
.tile:hover { transform: translateY(-3px); border-color: var(--navy); box-shadow: var(--shadow-hover); }
.tile .tab-row {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  font-family: var(--font-mono); font-size: 0.66rem; letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--muted-2);
}
.tile .num {
  font-family: var(--font-display); font-weight: 700;
  font-size: 3.4rem; line-height: 0.9; letter-spacing: -0.03em;
  color: var(--navy);
  margin: 6px 0 4px;
}
.tile h3 { margin: 0; font-size: 1.12rem; }
.tile p { margin: 0; color: var(--muted); font-size: 0.94rem; }
.tile .foot { margin-top: auto; display: flex; align-items: center; justify-content: space-between; gap: 8px; padding-top: 10px; font-family: var(--font-mono); font-size: 0.72rem; color: var(--muted-2); }
.tile .go { color: var(--accent-ink); font-weight: 600; }

.tile.is-progress .num { color: var(--accent); }
.tile.is-complete { background: var(--navy); border-color: var(--navy); }
.tile.is-complete .num { color: var(--teal); }
.tile.is-complete h3 { color: #fff; }
.tile.is-complete p { color: var(--on-dark-muted); }
.tile.is-complete .tab-row { color: var(--on-dark-muted); }
.tile.is-complete .foot { color: var(--on-dark-muted); }
.tile.is-complete .go { color: var(--teal); }
.tile.is-locked { color: var(--muted); }
.tile.is-locked .num { color: var(--line-strong); }
.tile.is-locked h3 { color: var(--muted); }
.tile.is-locked:hover { transform: none; box-shadow: none; border-color: var(--line); }
.tile.is-locked::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 12px; background: var(--hatch); }

/* practical tile: dark, stands apart from the module tiles */
.tile.tile-practical {
  background-color: var(--navy);
  background-image: var(--hex);
  border-color: var(--navy);
  color: var(--on-dark);
}
.tile.tile-practical .tab-row { color: var(--on-dark-muted); }
.tile.tile-practical .num { color: var(--accent); }
.tile.tile-practical h3 { color: #fff; }
.tile.tile-practical p { color: var(--on-dark-muted); }
.tile.tile-practical .foot { color: var(--on-dark-muted); }
.tile.tile-practical .go { color: var(--accent); }
.tile.tile-practical.is-locked::after { height: 12px; }
.tile.tile-practical.is-locked .num { color: var(--navy-line); }
.tile.tile-practical.is-locked h3 { color: var(--on-dark-muted); }

/* stamps and tags */
.stamp {
  display: inline-flex; align-items: center; gap: 6px;
  font-family: var(--font-mono); font-size: 0.64rem; font-weight: 600;
  letter-spacing: 0.12em; text-transform: uppercase;
  padding: 5px 10px; border-radius: 999px; border: 1px solid;
}
.stamp .s-dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.stamp-locked { color: var(--muted); border-color: var(--line-strong); background: var(--surface-2); }
.stamp-progress { color: var(--accent-ink); border-color: #f0cd88; background: var(--accent-soft); }
.stamp-complete { color: var(--teal-ink); border-color: #93ddd2; background: var(--teal-soft); }
.stamp-start { color: var(--navy); border-color: var(--navy); background: transparent; }
.tile.is-complete .stamp-complete { color: var(--teal); border-color: var(--teal); background: rgba(14,165,160,0.12); }
.tile.tile-practical .stamp-start { color: var(--accent); border-color: var(--accent); }
.tile.tile-practical .stamp-progress { color: var(--accent); border-color: var(--accent); background: rgba(245,179,43,0.12); }
.tile.tile-practical .stamp-locked { color: var(--on-dark-muted); border-color: var(--navy-line); background: transparent; }

.tag {
  display: inline-flex; align-items: center; gap: 6px;
  font-family: var(--font-mono); font-size: 0.7rem; letter-spacing: 0.06em;
  padding: 4px 9px; border-radius: 7px;
  background: var(--surface-2); color: var(--muted); border: 1px solid var(--line);
}
.tag-easy { color: var(--teal-ink); background: var(--teal-soft); border-color: #a8e3da; }
.tag-medium { color: var(--accent-ink); background: var(--accent-soft); border-color: #f0cd88; }
.tag-hard { color: var(--red-ink); background: var(--red-soft); border-color: #f3b6b8; }

/* ============================================================
   Hero (landing)
   ============================================================ */
.hero { padding: 76px 0 68px; }
.hero-grid { display: grid; grid-template-columns: 1.05fr 0.95fr; gap: 48px; align-items: center; }
.hero h1 { font-size: clamp(2rem, 4.8vw, 3.1rem); }
.hero h1 .hl { color: var(--accent); }
.hero-list { list-style: none; margin: 22px 0 0; padding: 0; display: grid; gap: 10px; }
.hero-list li { display: flex; gap: 12px; align-items: flex-start; color: var(--on-dark-muted); font-size: 0.98rem; }
.hero-list li .k { font-family: var(--font-mono); font-size: 0.68rem; letter-spacing: 0.12em; color: var(--accent); padding-top: 5px; min-width: 22px; }

.terminal {
  background: rgba(4, 8, 22, 0.75);
  border: 1px solid var(--navy-line);
  border-radius: var(--r-card);
  box-shadow: var(--shadow-float);
  font-family: var(--font-mono); font-size: 0.88rem;
  overflow: hidden;
}
.terminal-bar { display: flex; align-items: center; gap: 8px; padding: 10px 14px; border-bottom: 1px solid var(--navy-line); color: var(--on-dark-muted); font-size: 0.72rem; letter-spacing: 0.08em; }
.terminal-bar .tdot { width: 10px; height: 10px; border-radius: 50%; }
.terminal-bar .r { background: #ff5f57; } .terminal-bar .y { background: #febc2e; } .terminal-bar .g { background: #28c840; }
.terminal-bar span { margin-left: auto; }
.terminal-body { padding: 18px; min-height: 220px; line-height: 1.9; }
.terminal-body .line { white-space: pre-wrap; word-break: break-word; }
.terminal-body .prompt { color: var(--teal); }
.terminal-body .out { color: var(--on-dark-muted); }
.terminal-body .flag { color: var(--accent); }
.cursor { display: inline-block; width: 9px; height: 1.05em; background: var(--accent); vertical-align: -2px; animation: blink 1.05s steps(1) infinite; }
@keyframes blink { 50% { opacity: 0; } }

/* ============================================================
   Progress ring (dashboard)
   ============================================================ */
.progress-head { display: grid; grid-template-columns: auto 1fr; gap: 28px; align-items: center; }
.ring {
  --p: 0;
  width: 132px; height: 132px; flex: none; border-radius: 50%;
  display: grid; place-items: center;
  background:
    radial-gradient(closest-side, var(--navy) 78%, transparent 79% 100%),
    conic-gradient(var(--accent) calc(var(--p) * 1%), rgba(255,255,255,0.12) 0);
}
.ring .lvl { font-family: var(--font-display); font-size: 2.3rem; color: #fff; font-weight: 700; line-height: 1; text-align: center; }
.ring .lvl small { display: block; font-family: var(--font-mono); font-size: 0.6rem; letter-spacing: 0.14em; color: var(--on-dark-muted); margin-top: 6px; font-weight: 500; }
.progress-meta .rank { font-family: var(--font-display); font-size: 1.5rem; color: #fff; margin: 0; font-weight: 600; }
.progress-meta .sub { color: var(--on-dark-muted); font-family: var(--font-mono); font-size: 0.78rem; letter-spacing: 0.05em; }
.meters { display: flex; gap: 26px; flex-wrap: wrap; margin-top: 16px; }
.meter { min-width: 160px; }
.meter .bar { height: 8px; border-radius: 99px; background: rgba(255,255,255,0.12); overflow: hidden; margin-top: 8px; }
.meter .bar > span { display: block; height: 100%; background: var(--accent); border-radius: 99px; transition: width .6s cubic-bezier(.2,.7,.3,1); }
.meter .bar.teal > span { background: var(--teal); }
.meter .lbl { font-family: var(--font-mono); font-size: 0.68rem; letter-spacing: 0.1em; text-transform: uppercase; color: var(--on-dark-muted); }
.meter .val { color: #fff; font-weight: 700; font-size: 1.1rem; }

/* ============================================================
   Page band + breadcrumb
   ============================================================ */
.page-band { padding: 44px 0 40px; }
.page-band h1 { margin-bottom: 8px; }
.page-band .lead { max-width: 640px; }
.breadcrumb { font-family: var(--font-mono); font-size: 0.72rem; letter-spacing: 0.06em; color: var(--on-dark-muted); margin-bottom: 14px; }
.breadcrumb a { color: var(--on-dark-muted); }
.breadcrumb a:hover { color: var(--accent); }

/* ============================================================
   Lesson layout
   ============================================================ */
.lesson-wrap { display: grid; grid-template-columns: 250px 1fr; gap: 40px; align-items: start; }
.lesson-side { position: sticky; top: 88px; }
.obj-list { list-style: none; margin: 0; padding: 0; }
.obj-list li { display: flex; gap: 10px; padding: 7px 0; font-size: 0.92rem; color: var(--muted); border-bottom: 1px dashed var(--line); }
.obj-list li:last-child { border-bottom: 0; }
.obj-list li::before { content: "\25B8"; color: var(--accent); }
.obj-list.on-dark li { color: var(--on-dark-muted); border-color: var(--navy-line); }

.reading { max-width: var(--readw); }
.reading h2 { margin-top: 2.2rem; }
.reading h3 { margin-top: 1.6rem; }
.reading ul, .reading ol { padding-left: 1.3rem; margin: 0 0 1.1rem; }
.reading li { margin-bottom: 0.4rem; }

.callout { border-left: 4px solid var(--accent); background: var(--accent-soft); border-radius: 0 12px 12px 0; padding: 16px 20px; margin: 1.4rem 0; }
.callout.info { border-color: var(--navy); background: var(--surface-2); }
.callout.danger { border-color: var(--red); background: var(--red-soft); }
.callout.safe { border-color: var(--teal); background: var(--teal-soft); }
.callout .ttl { font-family: var(--font-mono); font-size: 0.7rem; letter-spacing: 0.12em; text-transform: uppercase; font-weight: 700; margin-bottom: 4px; display: block; }
.callout p:last-child { margin-bottom: 0; }

.term-def { display: grid; grid-template-columns: minmax(120px, auto) 1fr; gap: 6px 18px; margin: 1.2rem 0; }
.term-def dt { font-weight: 700; color: var(--ink); }
.term-def dd { margin: 0; color: var(--muted); }

code, .code-inline { font-family: var(--font-mono); font-size: 0.88em; background: var(--surface-2); border: 1px solid var(--line); padding: 1px 6px; border-radius: 6px; color: var(--red-ink); }
pre.code { font-family: var(--font-mono); background: var(--navy); color: var(--on-dark); padding: 16px 18px; border-radius: var(--r-card); overflow-x: auto; font-size: 0.85rem; line-height: 1.7; border: 1px solid var(--navy-line); }
pre.code code { background: none; border: 0; color: inherit; padding: 0; }
pre.code em { color: var(--accent); font-style: normal; }

.read-progress { position: sticky; top: 68px; height: 3px; z-index: 90; }
.read-progress > span { display: block; height: 100%; width: 0; background: var(--accent); transition: width .1s linear; }

/* ============================================================
   Activities
   ============================================================ */
.activity { position: relative; background: var(--surface); border: 1px solid var(--line-strong); border-radius: var(--r-card); overflow: hidden; margin: 1.8rem 0; }
.activity-head { background: var(--navy); color: var(--on-dark); padding: 12px 20px; display: flex; align-items: center; gap: 12px; }
.activity-head .k { font-family: var(--font-mono); font-size: 0.66rem; letter-spacing: 0.14em; color: var(--accent); text-transform: uppercase; font-weight: 600; }
.activity-head h4 { color: #fff; margin: 0; font-size: 1.02rem; }
.activity-body { padding: 20px; }
.activity-body label { font-weight: 600; font-size: 0.9rem; display: block; margin-bottom: 6px; }
.field-help { font-size: 0.86rem; color: var(--muted); margin: 0 0 14px; }

.input-row { display: flex; gap: 10px; flex-wrap: wrap; }
.input-row input { flex: 1; min-width: 200px; }

.slider-row { display: flex; align-items: center; gap: 14px; }
input[type="range"] { flex: 1; accent-color: var(--accent); }
.mono-out { font-family: var(--font-mono); background: var(--surface-2); border: 1px dashed var(--line-strong); border-radius: 10px; padding: 14px 16px; font-size: 0.92rem; word-break: break-word; min-height: 20px; }
.result-line { font-family: var(--font-mono); font-size: 0.88rem; margin-top: 10px; }
.result-line.ok { color: var(--teal-ink); }
.result-line.no { color: var(--red-ink); }

.strength-bar { height: 10px; border-radius: 99px; background: var(--surface-2); overflow: hidden; margin: 10px 0 6px; border: 1px solid var(--line); }
.strength-bar > span { display: block; height: 100%; width: 0; transition: width .3s, background .3s; }

.hashlist { display: flex; flex-direction: column; gap: 8px; }
.hashrow { display: flex; align-items: center; justify-content: space-between; gap: 12px; font-family: var(--font-mono); font-size: 0.82rem; background: var(--surface-2); border: 1px solid var(--line); border-radius: 9px; padding: 9px 12px; }
.hashrow .cracked { color: var(--teal-ink); font-weight: 700; }
.hashrow .uncracked { color: var(--muted-2); }

.sandbox { border: 1px solid var(--navy-line); border-radius: var(--r-card); overflow: hidden; }
.sandbox .sb-bar { background: var(--navy); color: var(--on-dark-muted); font-family: var(--font-mono); font-size: 0.72rem; padding: 8px 12px; letter-spacing: 0.06em; }
.sandbox .sb-body { padding: 18px; background: #fbfbfd; }
.sandbox .query { font-family: var(--font-mono); font-size: 0.8rem; background: var(--navy); color: var(--on-dark); padding: 12px 14px; border-radius: 9px; margin-top: 12px; white-space: pre-wrap; word-break: break-word; }
.sandbox .query .inj { color: var(--accent); }

/* email inspector (module 3) */
.email { border: 1px solid var(--line-strong); border-radius: var(--r-card); overflow: hidden; }
.email-h { background: var(--surface-2); padding: 14px 16px; border-bottom: 1px solid var(--line); font-size: 0.9rem; }
.email-b { padding: 18px 16px; line-height: 1.7; }
.flag { border-bottom: 2px dotted var(--muted-2); cursor: pointer; padding: 1px 2px; border-radius: 3px; transition: background .12s; }
.flag:hover { background: var(--accent-soft); }
.flag.found { background: var(--teal-soft); border-bottom: 2px solid var(--teal); color: var(--teal-ink); cursor: default; }
.flag-note { font-size: 0.82rem; color: var(--teal-ink); display: block; margin-top: 2px; }

/* ============================================================
   Quiz
   ============================================================ */
.quiz { margin: 1.5rem 0; }
.quiz-q { border: 1px solid var(--line); border-radius: var(--r-card); padding: 20px 22px; margin-bottom: 16px; background: var(--surface); }
.quiz-q .qn { font-family: var(--font-mono); font-size: 0.7rem; color: var(--accent-ink); letter-spacing: 0.1em; text-transform: uppercase; }
.quiz-q .qtext { font-weight: 600; font-size: 1.04rem; margin: 6px 0 14px; }
.opt { display: flex; gap: 11px; align-items: flex-start; padding: 11px 14px; border: 1px solid var(--line); border-radius: 10px; margin-bottom: 8px; cursor: pointer; transition: border-color .12s, background .12s; background: var(--surface); }
.opt:hover { border-color: var(--line-strong); background: var(--surface-2); }
.opt input { margin-top: 3px; accent-color: var(--navy); }
.opt.correct { border-color: var(--teal); background: var(--teal-soft); }
.opt.wrong { border-color: var(--red); background: var(--red-soft); }
.opt.locked { cursor: default; }
.explain { font-size: 0.9rem; color: var(--muted); margin-top: 8px; display: none; }
.explain.show { display: block; }
.quiz-result { font-weight: 700; font-size: 1.05rem; padding: 14px 0; }

/* ============================================================
   Practical: flag console + challenge list
   ============================================================ */
.flag-console { position: relative; color: var(--on-dark); border-radius: var(--r-card); padding: 26px; border: 1px solid var(--navy-line); }
.flag-console label { color: var(--on-dark); font-weight: 600; display: block; margin-bottom: 8px; }
.flag-console .input-row input { font-family: var(--font-mono); background: rgba(255,255,255,0.06); border: 1px solid var(--navy-line); color: #fff; }
.flag-console .input-row input::placeholder { color: var(--on-dark-muted); }
.flag-console .input-row input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(245,179,43,0.2); }
.flag-feedback { margin-top: 14px; font-family: var(--font-mono); font-size: 0.88rem; min-height: 1.2em; }
.flag-feedback.ok { color: var(--teal); }
.flag-feedback.no { color: #ff9a9e; }

.challenge { border: 1px solid var(--line); border-radius: var(--r-card); background: var(--surface); overflow: hidden; margin-bottom: 10px; }
.challenge.solved { border-color: #93ddd2; }
.challenge.solved .challenge-head { background: var(--teal-soft); }
.challenge-head { display: flex; align-items: center; gap: 12px; padding: 14px 18px; cursor: pointer; }
.challenge-head .ttl { font-weight: 700; font-size: 1rem; }
.challenge-head .cat { font-family: var(--font-mono); font-size: 0.7rem; color: var(--muted); }
.challenge-head .right { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.challenge-head .chev { transition: transform .18s; color: var(--muted-2); font-size: 1.2rem; }
.challenge.open .chev { transform: rotate(90deg); }
.challenge-body { display: none; padding: 0 18px 18px; }
.challenge.open .challenge-body { display: block; }
.hint-box { background: var(--accent-soft); border: 1px solid #f0cd88; border-radius: 10px; padding: 12px 15px; margin-top: 10px; font-size: 0.94rem; color: #5a3d06; }
.hint-box .hl { font-family: var(--font-mono); font-size: 0.66rem; letter-spacing: 0.12em; text-transform: uppercase; font-weight: 700; color: var(--accent-ink); display: block; margin-bottom: 3px; }
.solved-badge { color: var(--teal-ink); font-family: var(--font-mono); font-size: 0.72rem; font-weight: 700; display: inline-flex; align-items: center; gap: 6px; }

.score-big { display: flex; align-items: baseline; gap: 8px; }
.score-big .n { font-family: var(--font-display); font-size: 2.4rem; font-weight: 700; line-height: 1; }

/* restricted band: caution hatch used as a divider */
.restricted { height: 10px; background: var(--hatch); border-radius: 3px; margin: 18px 0; }

/* ============================================================
   Forms
   ============================================================ */
.form-field { margin-bottom: 16px; }
.form-field label { display: block; font-weight: 600; font-size: 0.92rem; margin-bottom: 6px; }
input[type="text"], input[type="email"], input[type="password"], input[type="number"], textarea, select {
  width: 100%; font-family: var(--font-body); font-size: 1rem; padding: 12px 14px;
  border: 1px solid var(--line-strong); border-radius: 10px; background: var(--surface); color: var(--ink);
  transition: border-color .15s, box-shadow .15s;
}
input:disabled { background: var(--surface-2); color: var(--muted); }
textarea { resize: vertical; min-height: 120px; line-height: 1.6; }
input:focus, textarea:focus, select:focus { outline: none; border-color: var(--navy); box-shadow: 0 0 0 3px rgba(11,19,48,0.12); }
.form-note { font-size: 0.85rem; color: var(--muted); margin-top: 6px; }

.alert { border-radius: 10px; padding: 12px 16px; font-size: 0.94rem; margin-bottom: 16px; border: 1px solid; display: flex; gap: 10px; align-items: flex-start; }
.alert::before { content: ""; flex: none; width: 8px; height: 8px; border-radius: 50%; background: currentColor; margin-top: 8px; }
.alert-error { background: var(--red-soft); border-color: #f3b6b8; color: var(--red-ink); }
.alert-ok { background: var(--teal-soft); border-color: #a8e3da; color: var(--teal-ink); }
.alert-info { background: var(--surface-2); border-color: var(--line-strong); color: var(--ink); }

.check-list .opt { align-items: center; }
.check-list .opt input { margin-top: 0; width: 18px; height: 18px; }

/* auth */
.auth-shell { display: grid; grid-template-columns: 1fr 1fr; min-height: calc(100vh - 68px); }
.auth-aside { padding: 56px 48px; display: flex; flex-direction: column; justify-content: center; }
.auth-form-col { display: flex; align-items: center; justify-content: center; padding: 48px 24px; }
.auth-card { width: 100%; max-width: 440px; }
.tabs { display: flex; gap: 6px; background: var(--surface-2); padding: 5px; border-radius: 12px; margin-bottom: 22px; }
.tabs button { flex: 1; padding: 10px; border: 0; background: transparent; border-radius: 9px; font-weight: 600; font-family: var(--font-body); font-size: 0.95rem; cursor: pointer; color: var(--muted); }
.tabs button.active { background: var(--navy); color: #fff; }

/* ============================================================
   Tables (teacher)
   ============================================================ */
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--r-card); background: var(--surface); }
table.data { width: 100%; border-collapse: collapse; font-size: 0.92rem; min-width: 720px; }
table.data th, table.data td { text-align: left; padding: 12px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
table.data th { font-family: var(--font-mono); font-size: 0.68rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); background: var(--surface-2); }
table.data tr:last-child td { border-bottom: 0; }
table.data tr:hover td { background: #fafbfd; }
table.data .num { font-family: var(--font-mono); font-size: 0.86rem; }
.mini-bar { height: 6px; width: 80px; background: var(--surface-2); border-radius: 99px; overflow: hidden; display: inline-block; vertical-align: middle; margin-left: 8px; }
.mini-bar > span { display: block; height: 100%; background: var(--accent); }
.mini-bar.teal > span { background: var(--teal); }

.stat-tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 16px; margin-bottom: 26px; }
.stat-tile { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-card); padding: 18px 20px; }
.stat-tile .n { font-family: var(--font-display); font-size: 1.9rem; font-weight: 700; line-height: 1.1; }
.stat-tile .l { font-family: var(--font-mono); font-size: 0.68rem; letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); margin-top: 4px; }

.drawer-backdrop { position: fixed; inset: 0; background: rgba(8,12,30,0.55); z-index: 150; display: none; }
.drawer-backdrop.open { display: block; }
.drawer { position: fixed; top: 0; right: 0; bottom: 0; width: min(470px, 92vw); background: var(--surface); z-index: 151; transform: translateX(100%); transition: transform .22s ease; overflow-y: auto; box-shadow: var(--shadow-float); display: flex; flex-direction: column; }
.drawer.open { transform: translateX(0); }
.drawer-head { padding: 22px 24px; border-bottom: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; }
.drawer-body { padding: 24px; }

/* ============================================================
   Toasts and modal (replacing native popups)
   ============================================================ */
.toast {
  position: fixed; right: 22px; bottom: 22px; z-index: 300;
  display: flex; align-items: center; gap: 12px;
  background: var(--navy); color: #fff;
  border-left: 4px solid var(--accent);
  border-radius: 4px 12px 12px 4px;
  padding: 13px 18px; font-size: 0.92rem; font-weight: 500;
  box-shadow: var(--shadow-float);
  max-width: min(420px, calc(100vw - 44px));
  opacity: 0; transform: translateY(10px); pointer-events: none;
  transition: opacity .2s, transform .2s;
}
.toast.show { opacity: 1; transform: translateY(0); }
.toast.ok { border-left-color: var(--teal); }
.toast.error { border-left-color: var(--red); }
.toast .t-icon { font-family: var(--font-mono); font-size: 0.7rem; letter-spacing: 0.12em; color: var(--accent); }
.toast.ok .t-icon { color: var(--teal); }
.toast.error .t-icon { color: #ff9a9e; }

.modal-backdrop { position: fixed; inset: 0; background: rgba(8,12,30,0.55); z-index: 400; display: none; align-items: center; justify-content: center; padding: 20px; }
.modal-backdrop.open { display: flex; }
.modal { position: relative; width: 100%; max-width: 440px; background: var(--surface); border-radius: var(--r-card); padding: 42px 26px 24px; box-shadow: var(--shadow-float); }
.modal h3 { margin-bottom: 8px; }
.modal p { color: var(--muted); margin-bottom: 20px; }
.modal .btn-row { justify-content: flex-end; }

/* ============================================================
   Footer
   ============================================================ */
.site-footer { background: var(--navy); color: var(--on-dark-muted); padding: 36px 0; margin-top: 64px; border-top: 1px solid var(--navy-line); flex-shrink: 0; }
.site-footer .container { display: flex; flex-wrap: wrap; gap: 18px; align-items: center; justify-content: space-between; }
.site-footer a { color: var(--on-dark-muted); text-decoration: none; }
.site-footer a:hover { color: #fff; }
.footer-links { display: flex; gap: 18px; flex-wrap: wrap; font-size: 0.9rem; }
.footer-note { font-family: var(--font-mono); font-size: 0.72rem; letter-spacing: 0.03em; width: 100%; padding-top: 16px; border-top: 1px solid var(--navy-line); margin: 0; }

.loading { display: inline-flex; align-items: center; gap: 10px; color: var(--muted); font-family: var(--font-mono); font-size: 0.85rem; }
.spinner { width: 16px; height: 16px; border: 2px solid var(--line-strong); border-top-color: var(--navy); border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ============================================================
   Responsive
   ============================================================ */
@media (max-width: 980px) {
  .tiles { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 940px) {
  .hero-grid { grid-template-columns: 1fr; gap: 32px; }
  .lesson-wrap { grid-template-columns: 1fr; }
  .lesson-side { position: static; }
  .auth-shell { grid-template-columns: 1fr; }
  .auth-aside { display: none; }
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
}
@media (max-width: 720px) {
  body { font-size: 16px; }
  .section { padding: 48px 0; }
  .nav { display: none; position: absolute; top: 68px; left: 0; right: 0; background: var(--navy); flex-direction: column; padding: 12px; gap: 2px; border-bottom: 1px solid var(--navy-line); }
  .nav.open { display: flex; }
  .nav a { padding: 12px; }
  .nav a.active { box-shadow: inset 3px 0 0 var(--accent); border-radius: 8px; }
  .menu-toggle { display: inline-flex; }
  .header-right .level-chip .txt { display: none; }
  .brand .wm-top { display: none; }
  .progress-head { grid-template-columns: 1fr; text-align: center; justify-items: center; }
  .tiles { grid-template-columns: 1fr; }
  .hero { padding: 52px 0 44px; }
  .toast { left: 16px; right: 16px; max-width: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.001ms !important; animation-iteration-count: 1 !important; transition-duration: 0.001ms !important; scroll-behavior: auto !important; }
  .cursor { animation: none; }
}

@media print {
  .site-header, .site-footer, .btn, .read-progress, .toast { display: none !important; }
  body { background: #fff; }
}
