/* NetSec Academy – application styles (dark technical theme) */
:root {
  --bg: #0b1220;
  --bg2: #0f182b;
  --panel: #141f36;
  --panel2: #1a2742;
  --panel3: #21304f;
  --border: #253653;
  --border2: #324769;
  --text: #e6edf7;
  --muted: #8b9bb8;
  --dim: #5f6f8d;
  --accent: #3b82f6;
  --accent2: #60a5fa;
  --accent-soft: rgba(59, 130, 246, 0.16);
  --green: #22c55e;
  --green-soft: rgba(34, 197, 94, 0.16);
  --red: #ef4444;
  --red-soft: rgba(239, 68, 68, 0.16);
  --amber: #f59e0b;
  --amber-soft: rgba(245, 158, 11, 0.16);
  --purple: #a78bfa;
  --purple-soft: rgba(167, 139, 250, 0.16);
  --cyan: #22d3ee;
  --cyan-soft: rgba(34, 211, 238, 0.14);
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
  --font: system-ui, -apple-system, "Segoe UI", Roboto, Inter, Helvetica, Arial, sans-serif;
  --mono: ui-monospace, "Cascadia Code", "Cascadia Mono", Consolas, "SF Mono", Menlo, "Courier New", monospace;
  --sidebar-w: 248px;
  --topbar-h: 58px;
  color-scheme: dark; /* dark native scrollbars, selects and form controls */
}
:root[data-theme="darker"] {
  --bg: #05080f;
  --bg2: #080d17;
  --panel: #0d1424;
  --panel2: #121b2f;
  --panel3: #182440;
  --border: #1b2740;
}
* { box-sizing: border-box; }
html { scrollbar-gutter: stable; }
html, body { margin: 0; padding: 0; background: var(--bg); color: var(--text); font-family: var(--font); font-size: 15px; line-height: 1.55; -webkit-text-size-adjust: 100%; }
a { color: var(--accent2); }
h1, h2, h3, h4 { margin: 0 0 0.5em; line-height: 1.25; font-weight: 650; letter-spacing: -0.01em; }
h2 { font-size: 1.35rem; }
h3 { font-size: 1.1rem; }
h4 { font-size: 1rem; }
p { margin: 0 0 0.9em; }
code, pre, kbd { font-family: var(--mono); }
code { background: var(--panel3); padding: 0.1em 0.4em; border-radius: 5px; font-size: 0.9em; color: #c9d8f5; }
pre { background: #0a1020; border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 12px 14px; overflow: auto; font-size: 0.86rem; line-height: 1.5; margin: 0 0 1em; }
pre code { background: none; padding: 0; color: #dbe6ff; }
button { font-family: inherit; }
input, select, textarea { font-family: inherit; font-size: 0.95rem; }
hr { border: 0; border-top: 1px solid var(--border); margin: 1.2em 0; }
table { border-collapse: collapse; width: 100%; margin: 0 0 1em; font-size: 0.92rem; }
th, td { border: 1px solid var(--border); padding: 7px 10px; text-align: left; vertical-align: top; }
th { background: var(--panel2); font-weight: 600; }
blockquote { margin: 0 0 1em; padding: 10px 14px; border-left: 3px solid var(--accent); background: var(--accent-soft); border-radius: 0 var(--radius-sm) var(--radius-sm) 0; }
ul, ol { margin: 0 0 1em; padding-left: 1.3em; }
li { margin-bottom: 0.3em; }
::selection { background: rgba(59,130,246,0.4); }

/* Layout */
.app { display: grid; grid-template-columns: var(--sidebar-w) 1fr; min-height: 100vh; }
.sidebar { background: var(--bg2); border-right: 1px solid var(--border); position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; z-index: 40; }
.brand { display: flex; align-items: center; gap: 10px; padding: 16px 16px 12px; border-bottom: 1px solid var(--border); position: relative; }
.brand-logo { width: 34px; height: 34px; border-radius: 9px; background: linear-gradient(135deg, #2563eb, #22d3ee); box-shadow: 0 0 0 3px rgba(59,130,246,0.2); position: relative; flex: none; }
.brand-logo::after { content: ""; position: absolute; inset: 9px; border: 2px solid rgba(255,255,255,0.85); border-radius: 4px; }
.brand-name { font-weight: 700; font-size: 1rem; }
.brand-sub { font-size: 0.72rem; color: var(--muted); }
.sidebar-close { display: none; position: absolute; right: 8px; top: 12px; }
.nav { padding: 10px; overflow-y: auto; flex: 1; }
.nav a { display: flex; align-items: center; gap: 10px; padding: 9px 11px; border-radius: 9px; color: var(--muted); text-decoration: none; font-weight: 500; font-size: 0.93rem; margin-bottom: 2px; transition: background 0.15s, color 0.15s; }
.nav a:hover { background: var(--panel); color: var(--text); }
.nav a.active { background: var(--accent-soft); color: var(--accent2); }
.nav a svg { width: 18px; height: 18px; flex: none; }
.nav .nav-num { margin-left: auto; font-size: 0.7rem; color: var(--dim); }
.sidebar-foot { padding: 12px 16px; border-top: 1px solid var(--border); font-size: 0.8rem; color: var(--muted); }
.main { min-width: 0; display: flex; flex-direction: column; }
.topbar { height: var(--topbar-h); display: flex; align-items: center; gap: 12px; padding: 0 22px; border-bottom: 1px solid var(--border); background: rgba(11,18,32,0.85); backdrop-filter: blur(8px); position: sticky; top: 0; z-index: 30; }
.page-title { font-size: 1.15rem; margin: 0; flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar-right { display: flex; align-items: center; gap: 8px; }
.menu-btn { display: none; }
.view { padding: 22px; max-width: 1280px; width: 100%; margin: 0 auto; animation: fadeIn 0.2s ease; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
.backdrop { display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.55); z-index: 35; }
.bottom-nav { display: none; }

/* Chips / badges */
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 999px; background: var(--panel2); border: 1px solid var(--border); font-size: 0.8rem; color: var(--muted); white-space: nowrap; }
.chip svg { width: 14px; height: 14px; }
.chip.accent { background: var(--accent-soft); color: var(--accent2); border-color: transparent; }
.chip.green { background: var(--green-soft); color: var(--green); border-color: transparent; }
.chip.red { background: var(--red-soft); color: var(--red); border-color: transparent; }
.chip.amber { background: var(--amber-soft); color: var(--amber); border-color: transparent; }
.chip.purple { background: var(--purple-soft); color: var(--purple); border-color: transparent; }
.chip.cyan { background: var(--cyan-soft); color: var(--cyan); border-color: transparent; }
.badge { display: inline-block; padding: 2px 8px; border-radius: 6px; font-size: 0.72rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; background: var(--panel3); color: var(--muted); }
.badge.l1 { background: var(--green-soft); color: var(--green); }
.badge.l2 { background: var(--amber-soft); color: var(--amber); }
.badge.l3 { background: var(--red-soft); color: var(--red); }
.badge.net { background: var(--accent-soft); color: var(--accent2); }
.badge.sec { background: var(--purple-soft); color: var(--purple); }

/* Buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; padding: 8px 14px; border-radius: 9px; border: 1px solid var(--border2); background: var(--panel2); color: var(--text); cursor: pointer; font-weight: 550; font-size: 0.9rem; transition: background 0.15s, transform 0.08s, border-color 0.15s; text-decoration: none; line-height: 1.2; }
.btn:hover { background: var(--panel3); border-color: var(--accent); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { background: #2f6fe0; }
.btn.success { background: var(--green); border-color: var(--green); color: #052e13; }
.btn.danger { background: var(--red-soft); border-color: var(--red); color: #fca5a5; }
.btn.ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn.ghost:hover { color: var(--text); background: var(--panel2); }
.btn.sm { padding: 5px 10px; font-size: 0.82rem; border-radius: 7px; }
.btn.xs { padding: 3px 8px; font-size: 0.76rem; border-radius: 6px; }
.btn.block { width: 100%; }
.btn svg { width: 16px; height: 16px; }
.icon-btn { background: transparent; border: 1px solid transparent; color: var(--muted); width: 36px; height: 36px; border-radius: 8px; cursor: pointer; font-size: 1.2rem; display: inline-flex; align-items: center; justify-content: center; }
.icon-btn:hover { background: var(--panel2); color: var(--text); }
.btn-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }

/* Cards & grids */
.card { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; }
.card.pad-sm { padding: 12px 14px; }
.card.clickable { cursor: pointer; transition: border-color 0.15s, transform 0.1s; }
.card.clickable:hover { border-color: var(--accent); transform: translateY(-1px); }
.card-title { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 10px; }
.card-title h3 { margin: 0; }
.grid { display: grid; gap: 16px; }
.grid.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid.cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid.auto { grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.grid.auto-sm { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }
.stack { display: flex; flex-direction: column; gap: 12px; }
.row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.spacer { flex: 1; }
.muted { color: var(--muted); }
.dim { color: var(--dim); }
.small { font-size: 0.84rem; }
.tiny { font-size: 0.74rem; }
.mono { font-family: var(--mono); }
.mt { margin-top: 14px; }
.mb { margin-bottom: 14px; }
.center { text-align: center; }
.section-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; margin: 6px 0 14px; flex-wrap: wrap; }
.section-head h2 { margin: 0; }
.section-head p { margin: 2px 0 0; color: var(--muted); font-size: 0.9rem; }

/* Stats */
.stat { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; display: flex; flex-direction: column; gap: 4px; position: relative; overflow: hidden; }
.stat .label { font-size: 0.76rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); }
.stat .value { font-size: 1.5rem; font-weight: 700; line-height: 1.1; }
.stat .sub { font-size: 0.8rem; color: var(--muted); }
.stat .stat-icon { position: absolute; right: 12px; top: 12px; width: 32px; height: 32px; border-radius: 8px; display: flex; align-items: center; justify-content: center; background: var(--accent-soft); color: var(--accent2); }
.stat .stat-icon svg { width: 18px; height: 18px; }

/* Progress */
.progress { height: 8px; background: var(--panel3); border-radius: 999px; overflow: hidden; }
.progress > span { display: block; height: 100%; background: linear-gradient(90deg, var(--accent), var(--cyan)); border-radius: 999px; transition: width 0.4s ease; }
.progress.green > span { background: var(--green); }
.progress.amber > span { background: var(--amber); }
.progress.thin { height: 5px; }
.progress-label { display: flex; justify-content: space-between; font-size: 0.78rem; color: var(--muted); margin-bottom: 4px; }

/* Tabs */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 16px; overflow-x: auto; overflow-y: hidden; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tabs button { background: none; border: 0; border-bottom: 2px solid transparent; color: var(--muted); padding: 9px 14px; cursor: pointer; font-weight: 550; font-size: 0.9rem; white-space: nowrap; margin-bottom: -1px; }
.tabs button:hover { color: var(--text); }
.tabs button.active { color: var(--accent2); border-bottom-color: var(--accent); }
.pills { display: flex; gap: 6px; flex-wrap: wrap; }
.pills button { background: var(--panel2); border: 1px solid var(--border); color: var(--muted); padding: 5px 11px; border-radius: 999px; cursor: pointer; font-size: 0.82rem; }
.pills button.active { background: var(--accent-soft); color: var(--accent2); border-color: var(--accent); }

/* Forms */
.field { display: flex; flex-direction: column; gap: 4px; margin-bottom: 10px; }
.field label { font-size: 0.8rem; color: var(--muted); font-weight: 500; }
.input, input:not([type]), input[type=text], input[type=number], input[type=password], input[type=search], select, textarea { background: var(--bg2); border: 1px solid var(--border2); color: var(--text); border-radius: 8px; padding: 8px 10px; width: 100%; outline: none; transition: border-color 0.15s; }
input:focus, select:focus, textarea:focus { border-color: var(--accent); }
input.invalid { border-color: var(--red); }
input.valid { border-color: var(--green); }
textarea { min-height: 90px; resize: vertical; }
.checkbox { display: flex; align-items: center; gap: 8px; cursor: pointer; }
.checkbox input { width: auto; }
.inline-form { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.inline-form input, .inline-form select { width: auto; flex: 1; min-width: 120px; }

/* Lists */
.list { display: flex; flex-direction: column; gap: 8px; }
.list-item { display: flex; align-items: center; gap: 12px; padding: 11px 14px; background: var(--panel); border: 1px solid var(--border); border-radius: 10px; text-decoration: none; color: inherit; transition: border-color 0.15s; }
.list-item:hover { border-color: var(--accent); }
.list-item.locked, .card.locked { opacity: 0.6; }
.list-item .li-icon { width: 36px; height: 36px; border-radius: 9px; display: flex; align-items: center; justify-content: center; background: var(--panel3); color: var(--accent2); flex: none; }
.list-item .li-icon svg { width: 18px; height: 18px; }
.list-item .li-icon.done { background: var(--green-soft); color: var(--green); }
.list-item .li-body { flex: 1; min-width: 0; }
.list-item .li-title { font-weight: 600; }
.list-item .li-sub { font-size: 0.8rem; color: var(--muted); display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.list-item .li-right { flex: none; display: flex; gap: 6px; align-items: center; }

/* Toasts */
.toasts { position: fixed; right: 16px; bottom: 16px; display: flex; flex-direction: column; gap: 8px; z-index: 100; max-width: min(360px, calc(100vw - 32px)); }
.toast { background: var(--panel2); border: 1px solid var(--border2); border-left: 4px solid var(--accent); padding: 10px 14px; border-radius: 9px; box-shadow: var(--shadow); animation: slideIn 0.25s ease; font-size: 0.9rem; }
.toast.success { border-left-color: var(--green); }
.toast.error { border-left-color: var(--red); }
.toast.xp { border-left-color: var(--amber); }
@keyframes slideIn { from { opacity: 0; transform: translateX(20px); } to { opacity: 1; transform: none; } }

/* Modal */
.modal-bg { position: fixed; inset: 0; background: rgba(2,6,16,0.7); display: flex; align-items: center; justify-content: center; z-index: 90; padding: 16px; animation: fadeIn 0.15s ease; }
.modal { background: var(--panel); border: 1px solid var(--border2); border-radius: 14px; width: 100%; max-width: 620px; max-height: 92vh; overflow: auto; box-shadow: var(--shadow); }
.modal.wide { max-width: 900px; }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 18px; border-bottom: 1px solid var(--border); }
.modal-head h3 { margin: 0; }
.modal-body { padding: 18px; }
.modal-foot { padding: 12px 18px; border-top: 1px solid var(--border); display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; }

/* Lesson */
.lesson-layout { display: grid; grid-template-columns: 1fr 260px; gap: 20px; align-items: start; }
.lesson-side { position: sticky; top: calc(var(--topbar-h) + 16px); }
.lesson-toc a { display: block; padding: 6px 10px; border-radius: 7px; color: var(--muted); text-decoration: none; font-size: 0.85rem; }
.lesson-toc a.read { color: var(--green); }
.lesson-toc a.current { background: var(--accent-soft); color: var(--accent2); }
.lesson-section { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); padding: 22px 24px; margin-bottom: 16px; }
.lesson-section.read { border-color: rgba(34,197,94,0.35); }
.lesson-section .sec-head { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.lesson-section .sec-head h3 { margin: 0; }
.lesson-section .sec-kind { font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); }
.callout { border-radius: var(--radius-sm); padding: 12px 14px; margin: 0 0 1em; border: 1px solid var(--border); background: var(--panel2); }
.callout.tip { border-color: rgba(34,197,94,0.4); background: var(--green-soft); }
.callout.warn { border-color: rgba(245,158,11,0.4); background: var(--amber-soft); }
.callout.danger { border-color: rgba(239,68,68,0.4); background: var(--red-soft); }
.callout.real { border-color: rgba(167,139,250,0.4); background: var(--purple-soft); }
.callout .callout-title { font-weight: 650; font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.06em; margin-bottom: 4px; }
.lesson-content h3 { margin-top: 1.1em; }
.lesson-content img, .lesson-content svg.diagram { max-width: 100%; }
.objectives li { margin-bottom: 4px; }
.lesson-nav { display: flex; justify-content: space-between; gap: 10px; margin-top: 10px; flex-wrap: wrap; }

/* Quiz */
.quiz-q { background: var(--panel2); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px 18px; margin-bottom: 12px; }
.quiz-q .q-num { font-size: 0.74rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.06em; margin-bottom: 4px; }
.quiz-q .q-text { font-weight: 600; margin-bottom: 10px; }
.options { display: flex; flex-direction: column; gap: 6px; }
.option { display: flex; align-items: flex-start; gap: 10px; padding: 9px 12px; border: 1px solid var(--border2); border-radius: 9px; cursor: pointer; background: var(--panel); transition: border-color 0.12s, background 0.12s; }
.option:hover { border-color: var(--accent); }
.option.selected { border-color: var(--accent); background: var(--accent-soft); }
.option.correct { border-color: var(--green); background: var(--green-soft); }
.option.wrong { border-color: var(--red); background: var(--red-soft); }
.option .opt-key { width: 22px; height: 22px; border-radius: 6px; background: var(--panel3); display: flex; align-items: center; justify-content: center; font-size: 0.75rem; font-weight: 700; flex: none; }
.feedback { margin-top: 10px; padding: 10px 12px; border-radius: 8px; font-size: 0.9rem; }
.feedback.ok { background: var(--green-soft); border: 1px solid rgba(34,197,94,0.35); }
.feedback.bad { background: var(--red-soft); border: 1px solid rgba(239,68,68,0.35); }
.score-ring { width: 120px; height: 120px; }
.result-head { display: flex; gap: 20px; align-items: center; flex-wrap: wrap; }

/* Terminal */
.terminal { background: #050a14; border: 1px solid var(--border2); border-radius: 10px; font-family: var(--mono); font-size: 0.84rem; color: #d7e3ff; display: flex; flex-direction: column; min-height: 320px; max-height: 70vh; }
.terminal.windows { background: #0c0c0c; color: #cccccc; }
.terminal-bar { display: flex; align-items: center; gap: 8px; padding: 6px 10px; border-bottom: 1px solid var(--border); font-family: var(--font); font-size: 0.78rem; color: var(--muted); }
.terminal-bar .dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }
.terminal-out { flex: 1; overflow: auto; padding: 10px 12px; white-space: pre-wrap; word-break: break-word; line-height: 1.45; }
.terminal-out .cmdline { color: #9ad0ff; }
.terminal.windows .terminal-out .cmdline { color: #e5e5e5; }
.terminal-out .err { color: #ff8e8e; }
.terminal-out .ok { color: #7ee787; }
.terminal-in { display: flex; align-items: center; gap: 6px; padding: 6px 12px; border-top: 1px solid var(--border); }
.terminal-in .prompt { color: #7ee787; white-space: nowrap; }
.terminal.windows .terminal-in .prompt { color: #e5e5e5; }
.terminal-in input { background: transparent; border: 0; outline: none; color: inherit; font-family: inherit; font-size: inherit; flex: 1; padding: 4px 0; }
.task-list { display: flex; flex-direction: column; gap: 6px; }
.task { display: flex; gap: 10px; align-items: flex-start; padding: 8px 10px; border-radius: 8px; background: var(--panel2); border: 1px solid var(--border); font-size: 0.88rem; }
.task.done { border-color: rgba(34,197,94,0.4); }
.task .task-check { width: 20px; height: 20px; border-radius: 50%; border: 2px solid var(--border2); flex: none; display: flex; align-items: center; justify-content: center; font-size: 0.7rem; }
.task.done .task-check { background: var(--green); border-color: var(--green); color: #052e13; }

/* Network simulator */
.sim-layout { display: grid; grid-template-columns: 1fr 320px; gap: 14px; align-items: start; }
.sim-canvas-wrap { background: #0a1020; border: 1px solid var(--border2); border-radius: 12px; position: relative; overflow: hidden; touch-action: none; }
/* Only the topology canvas itself – never the icon SVGs inside toolbar buttons or devices. */
.sim-canvas-wrap > svg.sim-canvas { display: block; width: 100%; height: auto; aspect-ratio: 1000 / 560; background-image: radial-gradient(rgba(255,255,255,0.06) 1px, transparent 1px); background-size: 24px 24px; user-select: none; -webkit-user-select: none; }
.sim-canvas.tool-cable .sim-device { cursor: crosshair; }
.sim-canvas.tool-delete .sim-device { cursor: not-allowed; }
.sim-toolbar { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; padding: 8px; border-bottom: 1px solid var(--border); background: var(--panel); }
.sim-toolbar .btn { padding: 5px 10px; font-size: 0.8rem; }
.sim-toolbar select { width: auto; padding: 5px 8px; font-size: 0.8rem; }
.sim-hint { position: absolute; left: 10px; bottom: 10px; max-width: calc(100% - 20px); padding: 5px 10px; border-radius: 7px; background: rgba(10,16,32,0.85); border: 1px solid var(--border); color: var(--muted); font-size: 0.78rem; pointer-events: none; }
.sim-hint.active { border-color: var(--cyan); color: var(--cyan); }
.sim-device { cursor: grab; }
.sim-device .dev-box { fill: #16223b; stroke: #324769; stroke-width: 1.5; transition: stroke 0.15s; }
.sim-device:hover .dev-box { stroke: #4b6390; }
.sim-device.selected .dev-box { stroke: var(--accent2); stroke-width: 2.5; }
.sim-device.connecting .dev-box { stroke: var(--cyan); stroke-width: 2.5; stroke-dasharray: 5 3; }
.sim-device .dev-icon { color: var(--accent2); pointer-events: none; }
.sim-device.t-switch .dev-icon, .sim-device.t-hub .dev-icon, .sim-device.t-ap .dev-icon { color: var(--cyan); }
.sim-device.t-router .dev-icon { color: var(--amber); }
.sim-device.t-firewall .dev-icon { color: var(--red); }
.sim-device.t-internet .dev-icon { color: var(--purple); }
.sim-device.t-server .dev-icon { color: var(--green); }
.sim-device text { fill: #e6edf7; font-family: var(--font); pointer-events: none; paint-order: stroke; stroke: #0a1020; stroke-width: 3px; stroke-linejoin: round; }
.sim-device .dev-name { font-size: 13px; font-weight: 650; }
.sim-device .dev-ip { fill: #9fb0cc; font-size: 11px; font-family: var(--mono); }
.sim-link { stroke: #4b5f85; stroke-width: 2.5; }
.sim-link.wireless { stroke-dasharray: 5 4; stroke: #22d3ee; }
.sim-link.down { stroke: #ef4444; stroke-dasharray: 3 3; }
.sim-link.hover { stroke: var(--accent2); }
.sim-packet { fill: #f59e0b; stroke: #fff; stroke-width: 1; filter: drop-shadow(0 0 4px #f59e0b); }
.sim-packet.arp { fill: #a78bfa; filter: drop-shadow(0 0 4px #a78bfa); }
.sim-packet.reply { fill: #22c55e; filter: drop-shadow(0 0 4px #22c55e); }
.sim-packet.drop { fill: #ef4444; }
.sim-side { display: flex; flex-direction: column; gap: 12px; max-height: calc(100vh - var(--topbar-h) - 40px); overflow: auto; scrollbar-width: thin; position: sticky; top: calc(var(--topbar-h) + 12px); }
.sim-log { font-family: var(--mono); font-size: 0.76rem; background: #0a1020; border: 1px solid var(--border); border-radius: 8px; padding: 8px 10px; max-height: 220px; overflow: auto; white-space: pre-wrap; }
.sim-log .ok { color: #7ee787; } .sim-log .err { color: #ff8e8e; } .sim-log .info { color: #9ad0ff; } .sim-log .warn { color: #ffd37a; }
.port-pill { display: inline-flex; align-items: center; gap: 4px; padding: 2px 7px; border-radius: 6px; background: var(--panel3); font-family: var(--mono); font-size: 0.74rem; cursor: pointer; border: 1px solid transparent; }
.port-pill.used { border-color: var(--green); }
.port-pill.picked { border-color: var(--accent); background: var(--accent-soft); }
.objective { display: flex; gap: 8px; align-items: flex-start; font-size: 0.88rem; padding: 6px 0; border-bottom: 1px dashed var(--border); }
.objective:last-child { border-bottom: 0; }
.objective .obj-mark { width: 18px; height: 18px; border-radius: 50%; border: 2px solid var(--border2); flex: none; font-size: 0.65rem; display: flex; align-items: center; justify-content: center; margin-top: 2px; }
.objective.done .obj-mark { background: var(--green); border-color: var(--green); color: #052e13; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 4px 12px; font-size: 0.86rem; }
.kv dt { color: var(--muted); } .kv dd { margin: 0; font-family: var(--mono); }

/* Flashcards */
.flashcard { background: var(--panel2); border: 1px solid var(--border2); border-radius: 14px; min-height: 200px; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 24px; text-align: center; cursor: pointer; font-size: 1.1rem; position: relative; }
.flashcard .fc-label { position: absolute; top: 10px; left: 14px; font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); }
.flashcard .fc-back { color: var(--accent2); }

/* Skill bars / charts */
.skill-row { display: grid; grid-template-columns: 150px 1fr 44px; gap: 10px; align-items: center; font-size: 0.86rem; margin-bottom: 8px; }
.skill-row .pct { text-align: right; font-family: var(--mono); color: var(--muted); }
.streak-days { display: flex; gap: 4px; }
.streak-days span { width: 14px; height: 14px; border-radius: 4px; background: var(--panel3); }
.streak-days span.on { background: var(--amber); }
.streak-days span.today { outline: 2px solid var(--accent2); outline-offset: 1px; }
.radar text { fill: var(--muted); font-size: 10px; }

/* Achievements */
.ach { display: flex; gap: 12px; align-items: center; padding: 12px; border-radius: 12px; background: var(--panel); border: 1px solid var(--border); }
.ach.locked { opacity: 0.55; filter: grayscale(0.6); }
.ach .ach-icon { width: 46px; height: 46px; border-radius: 12px; background: linear-gradient(135deg, var(--panel3), var(--panel2)); display: flex; align-items: center; justify-content: center; font-size: 1.4rem; flex: none; }
.ach.earned .ach-icon { background: linear-gradient(135deg, #f59e0b, #ef4444); box-shadow: 0 0 16px rgba(245,158,11,0.35); }

/* Diagrams */
.diagram { width: 100%; height: auto; margin: 8px 0 14px; }
.diagram text { font-family: var(--font); fill: #e6edf7; font-size: 12px; }
.diagram .box { fill: #1a2742; stroke: #324769; }
.diagram .hl { fill: var(--accent-soft); stroke: var(--accent); }
.osi-layer { display: grid; grid-template-columns: 50px 1fr; gap: 8px; padding: 10px 12px; margin-bottom: 6px; border-radius: 9px; background: var(--panel2); border: 1px solid var(--border); cursor: pointer; transition: border-color 0.12s; }
.osi-layer:hover, .osi-layer.active { border-color: var(--accent); }
.osi-layer .osi-num { font-size: 1.2rem; font-weight: 700; color: var(--accent2); }
.osi-layer .osi-detail { grid-column: 1 / -1; font-size: 0.88rem; color: var(--muted); display: none; padding-top: 6px; border-top: 1px dashed var(--border); margin-top: 4px; }
.osi-layer.active .osi-detail { display: block; }
.bits { display: flex; gap: 2px; flex-wrap: wrap; font-family: var(--mono); font-size: 0.8rem; }
.bits span { width: 22px; height: 26px; display: flex; align-items: center; justify-content: center; border-radius: 4px; background: var(--panel3); }
.bits span.net { background: var(--accent-soft); color: var(--accent2); }
.bits span.host { background: var(--green-soft); color: var(--green); }
.bits span.sep { width: 8px; background: none; }
.handshake-step { padding: 8px 12px; border-radius: 8px; background: var(--panel2); border: 1px solid var(--border); margin-bottom: 6px; opacity: 0.4; transition: opacity 0.3s; }
.handshake-step.on { opacity: 1; border-color: var(--accent); }
.email-view { background: #f4f6fb; color: #1b2433; border-radius: 10px; padding: 14px 16px; font-family: var(--font); }
.email-view .eh { font-size: 0.82rem; color: #52627a; }
.email-view a { color: #1d4ed8; }
.pw-meter { height: 10px; background: var(--panel3); border-radius: 999px; overflow: hidden; }
.pw-meter > span { display: block; height: 100%; transition: width 0.3s, background 0.3s; }
.log-table { font-family: var(--mono); font-size: 0.76rem; }
.log-table td { padding: 4px 8px; white-space: nowrap; }
.log-table tr.flag td { background: var(--red-soft); }
.log-table tr.picked td { outline: 1px solid var(--accent); }
.scroll-x { overflow-x: auto; }
.kbd { font-family: var(--mono); font-size: 0.78rem; background: var(--panel3); border: 1px solid var(--border2); border-bottom-width: 2px; padding: 1px 6px; border-radius: 5px; }

/* Empty state */
.empty { text-align: center; padding: 36px 16px; color: var(--muted); border: 1px dashed var(--border2); border-radius: var(--radius); }

/* Mission steps */
.step-list { counter-reset: step; display: flex; flex-direction: column; gap: 8px; }
.step { display: flex; gap: 12px; padding: 12px 14px; border-radius: 10px; background: var(--panel); border: 1px solid var(--border); }
.step .step-num { width: 26px; height: 26px; border-radius: 50%; background: var(--panel3); display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 0.8rem; flex: none; }
.step.done .step-num { background: var(--green); color: #052e13; }
.step.active { border-color: var(--accent); }
.step.locked { opacity: 0.55; }

/* Responsive */
@media (max-width: 1100px) {
  .grid.cols-4 { grid-template-columns: repeat(2, 1fr); }
  .grid.cols-3 { grid-template-columns: repeat(2, 1fr); }
  .sim-layout { grid-template-columns: 1fr; }
  .sim-side { max-height: none; position: static; }
  .lesson-layout { grid-template-columns: 1fr; }
  .lesson-side { position: static; }
}
@media (max-width: 900px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { position: fixed; left: 0; top: 0; bottom: 0; width: min(300px, 85vw); transform: translateX(-100%); transition: transform 0.2s ease; box-shadow: var(--shadow); }
  .sidebar.open { transform: none; }
  .sidebar-close { display: inline-flex; }
  .backdrop.show { display: block; }
  .menu-btn { display: inline-flex; }
  .topbar { padding: 0 14px; }
  .view { padding: 14px 14px 80px; }
  .bottom-nav { display: flex; position: fixed; left: 0; right: 0; bottom: 0; background: var(--bg2); border-top: 1px solid var(--border); z-index: 30; padding-bottom: env(safe-area-inset-bottom); }
  .bottom-nav a { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 8px 4px; color: var(--muted); text-decoration: none; font-size: 0.68rem; }
  .bottom-nav a.active { color: var(--accent2); }
  .bottom-nav a svg { width: 20px; height: 20px; }
  .skill-row { grid-template-columns: 110px 1fr 40px; }
}
@media (max-width: 600px) {
  .grid.cols-2, .grid.cols-3, .grid.cols-4 { grid-template-columns: 1fr; }
  .grid.auto { grid-template-columns: 1fr; }
  .grid.auto-sm { grid-template-columns: repeat(2, 1fr); }
  .page-title { font-size: 1rem; }
  .lesson-section { padding: 16px; }
  .result-head { flex-direction: column; align-items: flex-start; }
  .sim-canvas-wrap > svg.sim-canvas { aspect-ratio: 4 / 3; }
  .sim-hint { position: static; margin: 6px; max-width: none; }
  .terminal { font-size: 0.78rem; }
  .modal-body { padding: 14px; }
}
@media print { .sidebar, .topbar, .bottom-nav, .toasts { display: none !important; } .app { display: block; } }
