/* =====================================================================
   Cybersecurity Demo Lab — Clean Modern Light Theme
   Palette: Crisp white & slate backgrounds, blue/cyan highlights,
   green=secure, red=vulnerable, amber=warning, dark syntax terminals.
   ===================================================================== */
:root {
  --navy-900: #f8fafc;
  --navy-850: #ffffff;
  --navy-800: #f1f5f9;
  --panel: #ffffff;
  --panel-2: #f8fafc;
  --charcoal: #e2e8f0;
  --border: #e2e8f0;
  --border-soft: #edf2f7;

  --text: #0f172a;
  --text-dim: #334155;
  --text-faint: #64748b;

  --blue: #2563eb;
  --blue-hover: #1d4ed8;
  --blue-bg: #eff6ff;
  --cyan: #0284c7;
  --cyan-dim: #0369a1;
  --green: #16a34a;
  --green-bg: #f0fdf4;
  --red: #dc2626;
  --red-bg: #fef2f2;
  --amber: #d97706;
  --amber-bg: #fffbeb;

  --mono: "SFMono-Regular", "JetBrains Mono", "Fira Code", Consolas, monospace;
  --sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;

  --radius: 10px;
  --radius-sm: 6px;
  --radius-lg: 14px;
  --shadow: 0 4px 16px -2px rgba(15, 23, 42, 0.06), 0 2px 6px -1px rgba(15, 23, 42, 0.04);
  --shadow-lg: 0 16px 36px -6px rgba(15, 23, 42, 0.1), 0 6px 14px -3px rgba(15, 23, 42, 0.05);
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  font-family: var(--sans);
  background:
    radial-gradient(1200px 600px at 80% -10%, rgba(2, 132, 199, 0.04), transparent),
    radial-gradient(900px 500px at -10% 110%, rgba(37, 99, 235, 0.04), transparent),
    var(--navy-900);
  color: var(--text);
  font-size: 14.5px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

code, pre, .mono { font-family: var(--mono); }

a { color: var(--cyan); text-decoration: none; }
a:hover { text-decoration: underline; }

h1, h2, h3, h4 { margin: 0 0 0.4em; font-weight: 650; letter-spacing: -0.01em; color: var(--text); }
h2 { font-size: 1.25rem; }
h3 { font-size: 1.05rem; }
p { margin: 0 0 0.8em; color: var(--text-dim); }

/* ---------- Layout shell ---------- */
.app-shell { display: grid; grid-template-columns: 248px 1fr; min-height: 100vh; }

.sidebar {
  background: var(--navy-850);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: 18px 14px;
  position: sticky;
  top: 0;
  height: 100vh;
  box-shadow: 2px 0 10px rgba(15, 23, 42, 0.02);
}
.brand { display: flex; align-items: center; gap: 11px; padding: 6px 8px 18px; border-bottom: 1px solid var(--border-soft); }
.brand-mark {
  font-size: 1.6rem; color: var(--blue);
  text-shadow: 0 2px 8px rgba(37, 99, 235, 0.2);
}
.brand-text strong { display: block; font-size: 0.98rem; color: var(--text); }
.brand-text small { color: var(--text-faint); font-size: 0.72rem; letter-spacing: 0.04em; text-transform: uppercase; font-weight: 600; }

.nav { display: flex; flex-direction: column; gap: 4px; margin-top: 14px; }
.nav a {
  color: var(--text-dim);
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  font-weight: 500;
  display: flex; align-items: center; gap: 9px;
  transition: background 0.14s, color 0.14s, transform 0.08s;
}
.nav a:hover { background: var(--navy-800); color: var(--text); text-decoration: none; }
.nav a.active {
  background: var(--blue-bg);
  color: var(--blue);
  font-weight: 600;
  box-shadow: inset 3px 0 0 var(--blue);
}

.sidebar-footer {
  margin-top: auto;
  padding: 14px 8px 4px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  border-top: 1px solid var(--border-soft);
}
.sidebar-footer small { color: var(--text-faint); font-size: 0.72rem; }

/* ---------- Main / topbar ---------- */
.main { display: flex; flex-direction: column; min-width: 0; background: var(--navy-900); }
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px;
  padding: 14px 26px;
  border-bottom: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.88);
  backdrop-filter: blur(8px);
  position: sticky; top: 0; z-index: 20;
}
.page-title { font-size: 1.2rem; margin: 0; }
.topbar-right { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.meta-item { color: var(--text-dim); font-size: 0.82rem; }
.meta-item code { color: var(--blue); background: var(--navy-800); padding: 2px 7px; border-radius: 4px; font-weight: 600; }
.status-running { color: var(--green); display: inline-flex; align-items: center; gap: 6px; font-weight: 600; }
.status-running .dot { background: var(--green); box-shadow: 0 0 6px rgba(22, 163, 74, 0.5); }

.content { padding: 24px 26px 40px; max-width: 1240px; width: 100%; margin: 0 auto; }
.appfoot {
  margin-top: auto;
  display: flex; justify-content: space-between; gap: 12px;
  padding: 12px 26px; border-top: 1px solid var(--border);
  background: #ffffff;
  color: var(--text-faint); font-size: 0.76rem;
}

/* ---------- Presentation Mode Switcher Bar ---------- */
.view-switch-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 8px 12px;
  margin-bottom: 20px;
  box-shadow: var(--shadow);
  gap: 12px;
  flex-wrap: wrap;
}
.view-tabs-group {
  display: inline-flex;
  background: var(--navy-800);
  border-radius: 999px;
  padding: 4px;
  gap: 4px;
}
.view-tab {
  border: none;
  background: transparent;
  color: var(--text-dim);
  padding: 7px 18px;
  border-radius: 999px;
  cursor: pointer;
  font-weight: 600;
  font-size: 0.86rem;
  transition: all 0.16s ease;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.view-tab:hover {
  color: var(--text);
}
.view-tab.active {
  background: #ffffff;
  color: var(--blue);
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.08);
}
.view-helper-links {
  display: flex;
  align-items: center;
  gap: 10px;
}

/* Callout transition banner */
.demo-reveal-banner {
  background: linear-gradient(135deg, #eff6ff, #f0fdf4);
  border: 1.5px solid #bfdbfe;
  border-radius: var(--radius);
  padding: 14px 18px;
  margin-top: 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  animation: fadeIn 0.3s ease;
}
.demo-reveal-banner strong {
  color: #1e3a8a;
  display: block;
  font-size: 0.95rem;
}
.demo-reveal-banner p {
  margin: 2px 0 0;
  font-size: 0.84rem;
  color: #334155;
}

/* ---------- Dots / pills / badges ---------- */
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.pill {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 4px 10px; border-radius: 999px; font-size: 0.76rem; font-weight: 600;
  border: 1px solid var(--border);
}
.pill-ok { color: var(--green); background: var(--green-bg); border-color: rgba(22, 163, 74, 0.25); }
.pill-ok .dot { background: var(--green); box-shadow: 0 0 6px var(--green); }

.badge {
  display: inline-block; padding: 4px 10px; border-radius: 999px;
  font-size: 0.72rem; font-weight: 700; letter-spacing: 0.03em; text-transform: uppercase;
}
.badge-vuln { color: var(--red); background: var(--red-bg); border: 1px solid rgba(220, 38, 38, 0.25); }
.badge-secure { color: var(--green); background: var(--green-bg); border: 1px solid rgba(22, 163, 74, 0.25); }
.badge-warn { color: var(--amber); background: var(--amber-bg); border: 1px solid rgba(217, 119, 6, 0.25); }
.badge-info { color: var(--blue); background: var(--blue-bg); border: 1px solid rgba(37, 99, 235, 0.25); }

.diff-easy { color: var(--green); font-weight: 600; }
.diff-medium { color: var(--amber); font-weight: 600; }
.diff-hard { color: var(--red); font-weight: 600; }

/* ---------- Cards / panels ---------- */
.panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 22px;
  box-shadow: var(--shadow);
}
.panel + .panel { margin-top: 18px; }
.panel-title { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 14px; }
.panel-title h2, .panel-title h3 { margin: 0; }

.grid { display: grid; gap: 18px; }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-2 { grid-template-columns: repeat(2, 1fr); }

.lab-card {
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px;
  display: flex; flex-direction: column; gap: 12px;
  box-shadow: var(--shadow);
  transition: transform 0.15s, border-color 0.15s, box-shadow 0.15s;
}
.lab-card:hover {
  transform: translateY(-3px);
  border-color: #93c5fd;
  box-shadow: var(--shadow-lg);
}
.lab-card .card-icon { font-size: 1.8rem; color: var(--blue); }
.lab-card h3 { margin: 0; font-size: 1.15rem; }
.lab-card .card-desc { color: var(--text-dim); font-size: 0.88rem; flex: 1; }
.lab-card .card-meta { display: flex; align-items: center; justify-content: space-between; font-size: 0.78rem; color: var(--text-faint); }

/* ---------- Buttons ---------- */
.btn {
  font-family: var(--sans);
  font-size: 0.88rem; font-weight: 600;
  border: 1px solid var(--border);
  background: #ffffff;
  color: var(--text);
  padding: 9px 15px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.14s ease;
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}
.btn:hover { background: var(--navy-800); text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-sm { padding: 6px 12px; font-size: 0.8rem; }
.btn-primary {
  background: linear-gradient(135deg, var(--blue), var(--blue-hover));
  border-color: transparent;
  color: #ffffff;
  box-shadow: 0 2px 6px rgba(37, 99, 235, 0.25);
}
.btn-primary:hover { filter: brightness(1.08); background: var(--blue-hover); color: #ffffff; }
.btn-cyan {
  background: linear-gradient(135deg, #0284c7, #0369a1);
  border-color: transparent;
  color: #ffffff;
}
.btn-cyan:hover { background: linear-gradient(135deg, #0369a1, #075985); color: #ffffff; }
.btn-danger {
  background: linear-gradient(135deg, #dc2626, #b91c1c);
  border-color: transparent;
  color: #ffffff;
}
.btn-danger:hover { background: linear-gradient(135deg, #b91c1c, #991b1b); color: #ffffff; }
.btn-secure {
  background: linear-gradient(135deg, #16a34a, #15803d);
  border-color: transparent;
  color: #ffffff;
}
.btn-secure:hover { background: linear-gradient(135deg, #15803d, #166534); color: #ffffff; }
.btn-warning {
  background: #ffffff;
  border-color: rgba(217, 119, 6, 0.35);
  color: var(--amber);
}
.btn-warning:hover { background: var(--amber-bg); }
.btn-ghost { background: transparent; border-color: transparent; box-shadow: none; color: var(--text-dim); }
.btn-ghost:hover { background: var(--navy-800); color: var(--text); }

.btn-row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }

/* ---------- Forms ---------- */
label.field { display: block; margin-bottom: 12px; }
label.field > span { display: block; font-size: 0.82rem; color: var(--text-dim); margin-bottom: 5px; font-weight: 600; }
input[type="text"], input[type="password"], input[type="number"], textarea, select {
  width: 100%;
  background: #ffffff;
  border: 1px solid #cbd5e1;
  color: var(--text);
  border-radius: var(--radius-sm);
  padding: 9px 12px;
  font-size: 0.9rem;
  font-family: var(--sans);
  transition: border-color 0.15s, box-shadow 0.15s;
}
textarea { resize: vertical; min-height: 84px; font-family: var(--mono); font-size: 0.85rem; }
input:focus, textarea:focus, select:focus {
  outline: none;
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}
.input-mono { font-family: var(--mono); }

/* Password input with view/hide toggle */
.password-input-wrap {
  position: relative;
  display: flex;
  align-items: center;
  width: 100%;
}
.password-input-wrap input {
  padding-right: 44px;
}
.toggle-password-btn {
  position: absolute;
  right: 6px;
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 6px 8px;
  font-size: 1.05rem;
  color: var(--text-faint);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  transition: all 0.15s ease;
  line-height: 1;
}
.toggle-password-btn:hover {
  color: var(--blue);
  background: var(--navy-800);
}

/* ---------- Mode toggle ---------- */
.mode-toggle {
  display: inline-flex;
  background: var(--navy-800);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 3px;
  gap: 3px;
}
.mode-toggle button {
  border: none; background: transparent; color: var(--text-dim);
  padding: 6px 16px; border-radius: 999px; cursor: pointer; font-weight: 600; font-size: 0.82rem;
  transition: background 0.14s, color 0.14s;
}
.mode-toggle button.on-vuln { background: var(--red); color: #ffffff; box-shadow: 0 2px 6px rgba(220, 38, 38, 0.3); }
.mode-toggle button.on-secure { background: var(--green); color: #ffffff; box-shadow: 0 2px 6px rgba(22, 163, 74, 0.3); }

/* ---------- Terminal / code blocks (Sleek High-Contrast Console) ---------- */
.terminal {
  background: #090d16;
  border: 1px solid #1e293b;
  border-radius: var(--radius-sm);
  padding: 0;
  overflow: hidden;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}
.terminal-head {
  display: flex; align-items: center; gap: 7px;
  padding: 8px 12px; border-bottom: 1px solid #1e293b;
  background: #0d1526;
}
.terminal-head .tdot { width: 10px; height: 10px; border-radius: 50%; }
.terminal-head .tdot.r { background: #ef4444; }
.terminal-head .tdot.y { background: #f59e0b; }
.terminal-head .tdot.g { background: #10b981; }
.terminal-head .tlabel { margin-left: 8px; color: #94a3b8; font-size: 0.74rem; font-family: var(--mono); }
.terminal pre {
  margin: 0; padding: 13px 15px;
  font-family: var(--mono); font-size: 0.84rem; line-height: 1.6;
  color: #e2e8f0; white-space: pre-wrap; word-break: break-word;
  max-height: 340px; overflow: auto;
}

/* syntax highlight tokens */
.tok-kw { color: #38bdf8; font-weight: 600; }
.tok-str { color: #4ade80; }
.tok-inj { color: #f87171; background: rgba(239, 68, 68, 0.25); border-radius: 3px; padding: 1px 4px; font-weight: 700; }
.tok-num { color: #fbbf24; }
.tok-punc { color: #94a3b8; }
.tok-key { color: #c084fc; }

/* ---------- Result / status panels ---------- */
.result-box {
  border-radius: var(--radius-sm);
  padding: 13px 15px;
  border: 1px solid var(--border);
  background: #ffffff;
}
.result-vuln { background: var(--red-bg); border-color: rgba(220, 38, 38, 0.25); color: #991b1b; }
.result-secure { background: var(--green-bg); border-color: rgba(22, 163, 74, 0.25); color: #166534; }
.result-warn { background: var(--amber-bg); border-color: rgba(217, 119, 6, 0.25); color: #92400e; }
.result-head { display: flex; align-items: center; gap: 8px; font-weight: 700; margin-bottom: 7px; }
.result-vuln .result-head { color: var(--red); }
.result-secure .result-head { color: var(--green); }
.result-warn .result-head { color: var(--amber); }

/* ---------- Tables ---------- */
.data-table { width: 100%; border-collapse: collapse; font-size: 0.84rem; }
.data-table th, .data-table td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--border-soft); }
.data-table th { color: var(--text-faint); font-weight: 600; font-size: 0.74rem; text-transform: uppercase; letter-spacing: 0.04em; background: var(--navy-800); }
.data-table td { color: var(--text); font-family: var(--mono); font-size: 0.82rem; }
.data-table tr:hover td { background: var(--navy-800); }

/* ---------- Edu accordion ---------- */
.edu { display: grid; gap: 10px; }
.edu details {
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 2px 14px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.02);
}
.edu summary {
  cursor: pointer; padding: 11px 0; font-weight: 600; color: var(--text);
  list-style: none; display: flex; align-items: center; gap: 9px;
}
.edu summary::-webkit-details-marker { display: none; }
.edu summary::before { content: "▸"; color: var(--blue); transition: transform 0.15s; font-size: 1rem; }
.edu details[open] summary::before { transform: rotate(90deg); }
.edu details > div { padding: 0 0 14px 22px; color: var(--text-dim); font-size: 0.88rem; line-height: 1.6; }
.edu .takeaway {
  border-left: 3px solid var(--blue);
  background: var(--blue-bg);
  padding: 10px 14px;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  color: #1e3a8a;
}

/* ---------- Section headers ---------- */
.section-head { display: flex; align-items: center; gap: 12px; margin: 4px 0 18px; }
.section-head .lead { color: var(--text-dim); font-size: 0.9rem; }
.hero { margin-bottom: 22px; }
.hero p { max-width: 760px; }

/* ---------- XSS Lab Split Layout (Preview on the LEFT and VISIBLE) ---------- */
.xss-lab-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  align-items: start;
}
.xss-preview-card {
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.browser-chrome {
  background: #f1f5f9;
  border-bottom: 1px solid #cbd5e1;
  padding: 9px 14px;
  display: flex;
  align-items: center;
  gap: 12px;
}
.browser-chrome .dots {
  display: flex;
  gap: 6px;
}
.browser-chrome .dots span {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  display: inline-block;
}
.browser-chrome .dots .r { background: #ef4444; }
.browser-chrome .dots .y { background: #f59e0b; }
.browser-chrome .dots .g { background: #10b981; }
.browser-chrome .url-bar {
  flex: 1;
  background: #ffffff;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  padding: 3px 10px;
  font-size: 0.78rem;
  color: #475569;
  font-family: var(--mono);
  display: flex;
  align-items: center;
  gap: 6px;
}
.browser-chrome .badge-sandboxed {
  font-size: 0.7rem;
  background: #e2e8f0;
  color: #475569;
  padding: 2px 7px;
  border-radius: 4px;
  font-weight: 600;
}

.preview-frame {
  width: 100%;
  min-height: 480px;
  height: 520px;
  background: #ffffff;
  border: none;
  display: block;
}
.preview-label { font-size: 0.76rem; color: var(--text-faint); margin-bottom: 6px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.03em; }

/* Stored comment manager */
.xss-comment-list {
  list-style: none;
  margin: 0;
  padding: 0;
  max-height: 240px;
  overflow-y: auto;
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-sm);
}
.xss-comment-list > li { padding: 8px 10px; }
.xss-comment-list > li + li { border-top: 1px solid var(--border-soft); }
.xss-comment-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.xss-comment-text { min-width: 0; font-size: 0.82rem; }
.xss-comment-text strong { display: block; }
.xss-comment-text code { display: block; color: var(--text-dim); overflow-wrap: anywhere; font-size: 0.78rem; }
.xss-comment-row .btn { flex-shrink: 0; color: var(--red); }
.xss-prevention { margin: 4px 0 0; padding-left: 18px; }

/* ---------- Standalone / Clean Presentation Portal Styles ---------- */
.demo-portal-wrapper {
  max-width: 460px;
  margin: 30px auto;
  animation: fadeIn 0.3s ease;
}
.demo-portal-card {
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 34px 30px;
  box-shadow: var(--shadow-lg);
}
.demo-portal-brand {
  text-align: center;
  margin-bottom: 24px;
}
.demo-portal-brand .portal-logo {
  font-size: 2.2rem;
  color: var(--blue);
  display: inline-block;
  margin-bottom: 8px;
}
.demo-portal-brand h2 {
  font-size: 1.35rem;
  margin-bottom: 4px;
}
.demo-portal-brand p {
  font-size: 0.85rem;
  color: var(--text-faint);
  margin: 0;
}
.demo-helper-box {
  background: #f8fafc;
  border: 1px dashed #cbd5e1;
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  margin: 16px 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.demo-helper-box span {
  font-size: 0.78rem;
  color: var(--text-dim);
}
.demo-helper-box code {
  color: var(--red);
  font-weight: 700;
}
.auth-dashboard-view {
  animation: fadeIn 0.3s ease;
}
.auth-user-header {
  display: flex;
  align-items: center;
  gap: 14px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 18px;
}
.auth-avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: linear-gradient(135deg, #2563eb, #0284c7);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 1.2rem;
}
.auth-details h3 {
  margin: 0;
  font-size: 1.1rem;
}
.auth-details p {
  margin: 2px 0 0;
  font-size: 0.82rem;
  color: var(--text-faint);
}

/* ---------- API console ---------- */
.console-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.kv { display: grid; grid-template-columns: 120px 1fr; gap: 8px 12px; align-items: center; font-size: 0.85rem; }
.kv .k { color: var(--text-faint); font-weight: 600; }
.history-item {
  display: flex; align-items: center; gap: 10px; padding: 7px 10px;
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  font-family: var(--mono); font-size: 0.78rem; cursor: pointer;
  margin-bottom: 6px; background: #ffffff;
  transition: all 0.12s;
}
.history-item:hover { border-color: var(--blue); background: var(--blue-bg); }
.method-chip { font-weight: 700; padding: 2px 7px; border-radius: 4px; font-size: 0.72rem; }
.m-GET { background: rgba(22, 163, 74, 0.12); color: var(--green); }
.m-POST { background: rgba(37, 99, 235, 0.12); color: var(--blue); }
.status-chip { font-weight: 700; padding: 2px 7px; border-radius: 4px; margin-left: auto; }
.s-2 { background: var(--green-bg); color: var(--green); border: 1px solid rgba(22,163,74,0.25); }
.s-4 { background: var(--red-bg); color: var(--red); border: 1px solid rgba(220,38,38,0.25); }

/* ---------- Attack flow diagram ---------- */
.flow { display: flex; align-items: stretch; gap: 0; flex-wrap: wrap; margin: 6px 0 2px; }
.flow-step {
  flex: 1 1 120px; min-width: 120px;
  background: #ffffff; border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 10px 12px; text-align: center;
  font-size: 0.78rem; color: var(--text-dim);
  box-shadow: 0 1px 3px rgba(0,0,0,0.02);
  position: relative;
}
.flow-step strong { display: block; color: var(--text); font-size: 0.82rem; margin-bottom: 2px; }
.flow-arrow { align-self: center; color: var(--blue); padding: 0 8px; font-size: 1.1rem; }
.flow-step.danger { border-color: rgba(220, 38, 38, 0.35); background: #fef2f2; }
.flow-step.safe { border-color: rgba(22, 163, 74, 0.35); background: #f0fdf4; }

/* ---------- Loading spinner ---------- */
.spinner {
  width: 15px; height: 15px; border: 2px solid rgba(0, 0, 0, 0.15);
  border-top-color: var(--blue); border-radius: 50%;
  display: inline-block; animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes fadeIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: translateY(0); } }

/* ---------- Toast ---------- */
.toast-root { position: fixed; bottom: 22px; right: 22px; display: flex; flex-direction: column; gap: 10px; z-index: 1000; pointer-events: none; }
.toast {
  min-width: 240px; max-width: 360px;
  background: #ffffff; border: 1px solid var(--border);
  border-left: 4px solid var(--blue);
  border-radius: var(--radius-sm); padding: 11px 14px;
  box-shadow: var(--shadow-lg); font-size: 0.86rem;
  animation: slidein 0.22s ease;
  color: var(--text);
}
.toast.ok { border-left-color: var(--green); }
.toast.err { border-left-color: var(--red); }
.toast.warn { border-left-color: var(--amber); }
.toast strong { display: block; margin-bottom: 2px; }
@keyframes slidein { from { transform: translateX(20px); opacity: 0; } to { transform: translateX(0); opacity: 1; } }

/* ---------- Utility ---------- */
.muted { color: var(--text-faint); }
.small { font-size: 0.8rem; }
.mt-0 { margin-top: 0; }
.mt-1 { margin-top: 10px; }
.mt-2 { margin-top: 18px; }
.mb-1 { margin-bottom: 10px; }
.row { display: flex; gap: 14px; flex-wrap: wrap; }
.col { flex: 1 1 0; min-width: 0; }
.nowrap { white-space: nowrap; }
.hidden { display: none !important; }
.tag-note { font-size: 0.78rem; color: var(--text-faint); font-style: italic; }
hr.sep { border: none; border-top: 1px solid var(--border); margin: 18px 0; }

/* ---------- Responsive ---------- */
@media (max-width: 960px) {
  .app-shell { grid-template-columns: 1fr; }
  .sidebar { position: static; height: auto; flex-direction: row; flex-wrap: wrap; align-items: center; }
  .sidebar-footer { margin: 0 0 0 auto; flex-direction: row; align-items: center; }
  .nav { flex-direction: row; flex-wrap: wrap; }
  .grid-3, .grid-2, .console-grid, .xss-lab-grid, .mitm-mode-selector { grid-template-columns: 1fr; }
  .preview-frame { min-height: 380px; height: 400px; }
  .network-canvas { min-height: 480px; }
}
@media (max-width: 620px) {
  .topbar { flex-direction: column; align-items: flex-start; }
  .content { padding: 18px 16px 32px; }
}

/* =====================================================================
   MITM Simulation Module Styles
   Design: Dark navy arena (#080d1a), cyan & blue highlights, green for secure,
   red for security warnings, animated packet movement, event terminals.
   ===================================================================== */

/* Notice Banner */
.mitm-notice-banner {
  background: linear-gradient(135deg, #eff6ff, #f8fafc);
  border: 1px solid #bfdbfe;
  border-left: 4px solid var(--blue);
  border-radius: var(--radius);
  padding: 12px 18px;
  margin-bottom: 20px;
  display: flex;
  align-items: flex-start;
  gap: 14px;
}
.mitm-notice-icon {
  font-size: 1.4rem;
  line-height: 1;
}
.mitm-notice-banner strong {
  display: block;
  font-size: 0.92rem;
  color: #1e3a8a;
  margin-bottom: 2px;
}
.mitm-notice-banner p {
  margin: 0;
  font-size: 0.82rem;
  color: var(--text-dim);
}

/* Mode Selector */
.mitm-mode-selector {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.mitm-mode-btn {
  background: #f8fafc;
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  display: flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
  transition: all 0.16s ease;
  text-align: left;
}
.mitm-mode-btn:hover {
  background: #ffffff;
  border-color: #94a3b8;
}
.mitm-mode-btn .mode-icon {
  font-size: 1.5rem;
  line-height: 1;
}
.mitm-mode-btn .mode-label strong {
  display: block;
  font-size: 0.88rem;
  color: var(--text);
}
.mitm-mode-btn .mode-label small {
  display: block;
  font-size: 0.74rem;
  color: var(--text-faint);
  margin-top: 1px;
}
.mitm-mode-btn.active-http {
  background: #fef2f2;
  border-color: var(--red);
  box-shadow: 0 2px 10px rgba(220, 38, 38, 0.15);
}
.mitm-mode-btn.active-http .mode-label strong {
  color: #991b1b;
}
.mitm-mode-btn.active-https {
  background: #f0fdf4;
  border-color: var(--green);
  box-shadow: 0 2px 10px rgba(22, 163, 74, 0.15);
}
.mitm-mode-btn.active-https .mode-label strong {
  color: #166534;
}

/* Avatar input */
.input-with-avatar {
  position: relative;
  display: flex;
  align-items: center;
}
.input-with-avatar .input-avatar {
  position: absolute;
  left: 10px;
  font-size: 1rem;
  pointer-events: none;
}
.input-with-avatar input {
  padding-left: 36px;
  font-weight: 600;
}

/* Speed toggle wrap */
.speed-toggle-wrap {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

/* Arena Panel */
.mitm-arena-panel {
  background: #090e1a;
  border: 1px solid #1e293b;
  color: #e2e8f0;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.3);
  padding: 18px 22px 24px;
}
.arena-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  padding-bottom: 14px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  margin-bottom: 16px;
}
.arena-badge {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: #38bdf8;
  background: rgba(56, 189, 248, 0.12);
  border: 1px solid rgba(56, 189, 248, 0.25);
  padding: 2px 8px;
  border-radius: 4px;
  display: inline-block;
  margin-bottom: 4px;
}
.arena-title h3 {
  color: #f8fafc;
  margin: 0;
  font-size: 1.05rem;
}
.arena-status-indicators {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}
.cert-indicator {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 0.76rem;
  font-family: var(--mono);
  padding: 5px 12px;
  border-radius: 999px;
  background: #0f172a;
  border: 1px solid #334155;
  color: #94a3b8;
}
.cert-indicator .cert-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  display: inline-block;
}
.cert-none .cert-dot { background: #64748b; }
.cert-ok {
  background: rgba(34, 197, 94, 0.12);
  border-color: rgba(34, 197, 94, 0.35);
  color: #4ade80;
}
.cert-ok .cert-dot {
  background: #22c55e;
  box-shadow: 0 0 6px #22c55e;
}

.security-banner {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.8rem;
  padding: 6px 14px;
  border-radius: 6px;
  font-weight: 700;
  letter-spacing: 0.03em;
}
.banner-vuln {
  background: rgba(220, 38, 38, 0.18);
  border: 1px solid rgba(220, 38, 38, 0.4);
  color: #f87171;
  box-shadow: 0 0 14px rgba(220, 38, 38, 0.2);
}
.banner-secure {
  background: rgba(34, 197, 94, 0.18);
  border: 1px solid rgba(34, 197, 94, 0.4);
  color: #4ade80;
  box-shadow: 0 0 14px rgba(34, 197, 94, 0.2);
}

/* Canvas Topology Arena */
.network-canvas {
  position: relative;
  min-height: 290px;
  background: radial-gradient(circle at 50% 30%, #0f1c3f 0%, #080d1a 75%);
  border: 1px solid #1e293b;
  border-radius: var(--radius);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 30px 40px;
  margin-bottom: 14px;
}
.network-svg-layer {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 1;
}
.pipeline-track-bg {
  stroke: rgba(255, 255, 255, 0.08);
  stroke-width: 6;
  stroke-linecap: round;
}
.pipeline-track-active {
  stroke-width: 4;
  stroke-linecap: round;
  stroke-dasharray: 8 6;
  animation: trackFlow 1.2s linear infinite;
}
.line-http {
  stroke: #ef4444;
  filter: drop-shadow(0 0 6px rgba(239, 68, 68, 0.6));
}
.line-https {
  stroke: #22c55e;
  filter: drop-shadow(0 0 6px rgba(34, 197, 94, 0.6));
}
@keyframes trackFlow {
  from { stroke-dashoffset: 28; }
  to { stroke-dashoffset: 0; }
}

.tap-sensor-line {
  stroke: rgba(255, 255, 255, 0.2);
  stroke-width: 2;
  stroke-dasharray: 4 4;
  transition: all 0.3s ease;
}
.tap-sensor-point {
  fill: #64748b;
  transition: all 0.3s ease;
}
.tap-active.tap-sensor-line {
  stroke: #ef4444;
  stroke-width: 3;
  filter: drop-shadow(0 0 6px #ef4444);
}
.tap-active.tap-sensor-point {
  fill: #ef4444;
  filter: drop-shadow(0 0 8px #ef4444);
}
.tap-blocked.tap-sensor-line {
  stroke: #06b6d4;
  stroke-width: 2;
}
.tap-blocked.tap-sensor-point {
  fill: #06b6d4;
  filter: drop-shadow(0 0 6px #06b6d4);
}

/* Nodes */
.network-node {
  position: relative;
  z-index: 10;
  background: #0d1527;
  border: 1px solid #1e293b;
  border-radius: var(--radius);
  padding: 16px 14px;
  width: 175px;
  text-align: center;
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.4);
  transition: all 0.22s ease;
}
.network-node:hover {
  transform: translateY(-2px);
  border-color: #38bdf8;
}
.node-icon-wrap {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: #1e293b;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 10px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  transition: all 0.2s ease;
}
.node-icon { font-size: 1.5rem; line-height: 1; }
.node-title {
  font-weight: 700;
  font-size: 0.88rem;
  color: #f8fafc;
  letter-spacing: 0.04em;
}
.node-role {
  font-size: 0.72rem;
  color: #94a3b8;
  margin-top: 1px;
}
.node-ip {
  font-family: var(--mono);
  font-size: 0.7rem;
  color: #38bdf8;
  background: rgba(56, 189, 248, 0.08);
  padding: 2px 6px;
  border-radius: 4px;
  display: inline-block;
  margin: 6px 0 8px;
}
.node-state-badge {
  font-size: 0.72rem;
  padding: 3px 8px;
  border-radius: 999px;
  background: #1e293b;
  color: #94a3b8;
  border: 1px solid #334155;
  display: inline-block;
  font-weight: 600;
}
.state-transmitting {
  background: rgba(56, 189, 248, 0.16);
  border-color: #38bdf8;
  color: #38bdf8;
}
.state-routing {
  background: rgba(245, 158, 11, 0.16);
  border-color: #f59e0b;
  color: #fbbf24;
}
.state-received {
  background: rgba(34, 197, 94, 0.16);
  border-color: #22c55e;
  color: #4ade80;
  box-shadow: 0 0 10px rgba(34, 197, 94, 0.3);
}

.node-alice.node-active {
  border-color: #38bdf8;
  box-shadow: 0 0 20px rgba(56, 189, 248, 0.35);
}
.node-bob.node-received {
  border-color: #22c55e;
  box-shadow: 0 0 20px rgba(34, 197, 94, 0.35);
}

/* Attacker Node Specifics */
.node-attacker {
  position: absolute;
  top: 14px;
  left: 50%;
  transform: translateX(-50%);
  width: 220px;
  background: #14101e;
  border-color: #451a24;
}
.attacker-icon-wrap {
  background: #2a1219;
  border-color: rgba(239, 68, 68, 0.3);
}
.attacker-alert-tag {
  font-size: 0.72rem;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 999px;
  background: #1e1b2e;
  color: #94a3b8;
  border: 1px solid #3b283d;
  display: inline-block;
}
.alert-vuln {
  background: rgba(220, 38, 38, 0.2);
  border-color: #ef4444;
  color: #fca5a5;
  box-shadow: 0 0 12px rgba(239, 68, 68, 0.4);
  animation: pulseVuln 0.8s alternate infinite;
}
.alert-secure {
  background: rgba(6, 182, 212, 0.15);
  border-color: #06b6d4;
  color: #67e8f9;
  box-shadow: 0 0 10px rgba(6, 182, 212, 0.3);
}
@keyframes pulseVuln {
  from { transform: scale(1); }
  to { transform: scale(1.04); }
}

.node-attacker.sniffing-active {
  border-color: #ef4444;
  box-shadow: 0 0 24px rgba(239, 68, 68, 0.45);
}
.node-attacker.sniffing-blocked {
  border-color: #06b6d4;
  box-shadow: 0 0 20px rgba(6, 182, 212, 0.35);
}

/* Radar pulse ring on attacker */
.attacker-pulse-ring {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 120%;
  height: 120%;
  transform: translate(-50%, -50%);
  border-radius: var(--radius);
  border: 1px dashed rgba(239, 68, 68, 0.25);
  pointer-events: none;
  animation: pulseRing 2.4s linear infinite;
}
@keyframes pulseRing {
  0% { transform: translate(-50%, -50%) scale(0.95); opacity: 0.8; }
  100% { transform: translate(-50%, -50%) scale(1.15); opacity: 0; }
}

/* Traveling packet */
.traveling-packet {
  position: absolute;
  top: 154px;
  left: 14%;
  transform: translate(-50%, -50%);
  z-index: 25;
  pointer-events: none;
  transition: left 0.08s linear;
}
.packet-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  border-radius: 999px;
  background: #0f172a;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.6);
  font-size: 0.76rem;
  border: 2px solid #38bdf8;
  white-space: nowrap;
}
.chip-http {
  border-color: #ef4444;
  color: #fca5a5;
  box-shadow: 0 0 16px rgba(239, 68, 68, 0.6);
}
.chip-https {
  border-color: #22c55e;
  color: #86efac;
  box-shadow: 0 0 16px rgba(34, 197, 94, 0.6);
}
.packet-info strong {
  display: block;
  font-size: 0.78rem;
  color: #f8fafc;
}
.packet-info span {
  font-size: 0.68rem;
  color: #94a3b8;
}

/* TLS Handshake banner */
.tls-handshake-stage {
  position: absolute;
  bottom: 16px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 30;
}
.handshake-pill {
  background: rgba(15, 23, 42, 0.94);
  backdrop-filter: blur(8px);
  border: 1px solid #38bdf8;
  color: #38bdf8;
  padding: 8px 18px;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 10px;
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.4);
}

/* Progress bar */
.sim-progress-track {
  height: 4px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 2px;
  overflow: hidden;
}
.sim-progress-bar {
  height: 100%;
  background: linear-gradient(90deg, #38bdf8, #22c55e);
  transition: width 0.08s linear;
}

/* Terminals */
.mitm-terminal-panel {
  display: flex;
  flex-direction: column;
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
}
.terminal-panel-head {
  padding: 12px 16px;
  background: #f8fafc;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.terminal-tag {
  font-size: 0.76rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  display: flex;
  align-items: center;
  gap: 7px;
}
.tag-attacker { color: #dc2626; }
.tag-bob { color: #16a34a; }
.terminal-body {
  padding: 16px;
  min-height: 220px;
  background: #fafbfc;
  flex: 1;
}
.terminal-hint {
  color: var(--text-faint);
  font-size: 0.84rem;
  font-style: italic;
  padding: 28px 16px;
  text-align: center;
}
.code-view-wrap {
  border: 1px solid #1e293b;
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: #090e1a;
}
.code-view-title {
  background: #0f172a;
  padding: 6px 12px;
  font-family: var(--mono);
  font-size: 0.7rem;
  color: #94a3b8;
  border-bottom: 1px solid #1e293b;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.terminal-code {
  margin: 0;
  padding: 12px 14px;
  font-family: var(--mono);
  font-size: 0.8rem;
  line-height: 1.55;
  color: #e2e8f0;
  max-height: 190px;
  overflow: auto;
  white-space: pre-wrap;
  word-break: break-word;
}
.panel-explainer {
  padding: 12px 16px;
  background: #f1f5f9;
  border-top: 1px solid var(--border-soft);
}

/* Bob's inbox card */
.bob-inbox-card {
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}
.bob-inbox-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border-soft);
  margin-bottom: 12px;
}
.bob-message-bubble {
  background: #f8fafc;
  border-left: 3px solid var(--blue);
  padding: 10px 14px;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  font-size: 0.9rem;
  color: var(--text);
  font-weight: 500;
}

/* Event Log Terminal */
.mitm-event-log-terminal pre {
  max-height: 200px;
  background: #080d1a;
}

/* Comparison Matrix Cards */
.mitm-comparison-panel {
  background: #ffffff;
}
.comparison-card {
  border-radius: var(--radius);
  padding: 20px 22px;
  border: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.comp-insecure {
  background: #fffafa;
  border-color: rgba(220, 38, 38, 0.25);
}
.comp-secure {
  background: #f7fdf9;
  border-color: rgba(22, 163, 74, 0.25);
}
.comp-head {
  display: flex;
  align-items: center;
  gap: 12px;
}
.comp-icon {
  font-size: 1.8rem;
  line-height: 1;
}
.comp-head h4 {
  margin: 0;
  font-size: 0.98rem;
}
.comp-insecure .comp-head h4 { color: #991b1b; }
.comp-secure .comp-head h4 { color: #166534; }
.comp-sub {
  font-size: 0.74rem;
  color: var(--text-faint);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-weight: 600;
}
.comp-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
  flex: 1;
}
.comp-list li {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  font-size: 0.84rem;
}
.comp-list p {
  margin: 2px 0 0;
  font-size: 0.78rem;
  color: var(--text-dim);
}
.comp-status-icon {
  font-weight: 700;
  font-size: 0.95rem;
  line-height: 1.2;
}
.comp-status-icon.bad { color: #dc2626; }
.comp-status-icon.good { color: #16a34a; }
.comp-foot {
  padding-top: 10px;
  border-top: 1px solid rgba(0, 0, 0, 0.06);
}

/* =====================================================================
   DDoS Simulation Module Styles
   Shares the MITM dark arena; blue = legitimate, red = excessive traffic,
   green = healthy, cyan = defense.
   ===================================================================== */

/* Simulation controls: equal-sized buttons that keep their colour on hover */
.ddos-controls {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 12px;
}
.ddos-controls .btn {
  min-height: 46px;
  font-size: 0.92rem;
  border-radius: var(--radius);
  box-shadow: 0 2px 6px rgba(15, 23, 42, 0.18);
  transition: transform 0.14s ease, box-shadow 0.14s ease, background 0.14s ease;
}
.ddos-controls .btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 18px rgba(15, 23, 42, 0.26);
}
.ddos-controls .btn:active { transform: translateY(0); box-shadow: 0 1px 3px rgba(15, 23, 42, 0.2); }
.ddos-controls .btn:focus-visible { outline: 3px solid var(--cyan); outline-offset: 2px; }
.ddos-btn-neutral, .ddos-btn-neutral:hover { color: #ffffff; border-color: transparent; }
.ddos-btn-neutral { background: linear-gradient(135deg, #475569, #334155); }
.ddos-btn-neutral:hover { background: linear-gradient(135deg, #334155, #1e293b); }
.ddos-btn-reset, .ddos-btn-reset:hover { color: #ffffff; border-color: transparent; }
.ddos-btn-reset { background: linear-gradient(135deg, #d97706, #b45309); }
.ddos-btn-reset:hover { background: linear-gradient(135deg, #b45309, #92400e); }
/* The running mode gets a coloured ring that matches its button */
.ddos-controls .ddos-btn-current { outline: 3px solid rgba(15, 23, 42, 0.55); outline-offset: 2px; }
.ddos-controls #ddos-normal-btn.ddos-btn-current { outline-color: rgba(37, 99, 235, 0.55); }
.ddos-controls #ddos-attack-btn.ddos-btn-current { outline-color: rgba(220, 38, 38, 0.55); }
.ddos-controls #ddos-defense-btn.ddos-btn-current { outline-color: rgba(22, 163, 74, 0.55); }

.ddos-banner-warn {
  background: rgba(245, 158, 11, 0.18);
  border: 1px solid rgba(245, 158, 11, 0.4);
  color: #fbbf24;
}
.ddos-banner-defense {
  background: rgba(34, 211, 238, 0.16);
  border: 1px solid rgba(34, 211, 238, 0.45);
  color: #67e8f9;
  box-shadow: 0 0 14px rgba(34, 211, 238, 0.2);
}
.ddos-status-detail {
  color: #cbd5e1;
  font-size: 0.86rem;
  min-height: 2.6em;
  margin: 0 0 8px;
}

/* Topology stage */
.ddos-stage {
  position: relative;
  height: 400px;
  background: radial-gradient(circle at 50% 30%, #0f1c3f 0%, #080d1a 75%);
  border: 1px solid #1e293b;
  border-radius: var(--radius);
  overflow: hidden;
  margin-bottom: 12px;
}
.ddos-flow-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
}
.ddos-node {
  position: absolute;
  width: 200px;
  padding: 11px 12px;
}
.ddos-node:hover { transform: none; border-color: #1e293b; }
.ddos-node .node-title { font-size: 0.74rem; line-height: 1.3; }
.ddos-node-legit { left: 18px; top: 18px; border-color: rgba(56, 189, 248, 0.4); }
.ddos-node-sources { left: 18px; bottom: 18px; border-color: rgba(239, 68, 68, 0.4); }
.ddos-node-server {
  right: 18px;
  top: 0;
  bottom: 0;
  height: fit-content;
  margin: auto 0;
  width: 214px;
  border-width: 2px;
  transition: border-color 0.3s ease, box-shadow 0.3s ease;
}
.ddos-node-count { font-size: 1.5rem; font-weight: 700; color: #f8fafc; line-height: 1.25; }
.ddos-node .node-role { margin-top: 4px; }

.ddos-swarm {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: 3px;
  margin: 5px auto 0;
  max-width: 132px;
}
.ddos-swarm i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #1e293b;
  transition: background 0.25s ease;
}
.ddos-swarm i.on { background: #38bdf8; }
.ddos-swarm-red i.on { background: #ef4444; }

/* Server health */
.ddos-led-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin: 6px 0 8px;
  color: #f8fafc;
  font-size: 0.86rem;
}
.ddos-led {
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: #64748b;
}
.ddos-node-server.is-healthy, .ddos-node-server:not([class*="is-"]) { border-color: #22c55e; }
.ddos-node-server.is-healthy .ddos-led, .ddos-node-server:not([class*="is-"]) .ddos-led { background: #22c55e; box-shadow: 0 0 8px #22c55e; }
.ddos-node-server.is-warn { border-color: #f59e0b; }
.ddos-node-server.is-warn .ddos-led { background: #f59e0b; box-shadow: 0 0 8px #f59e0b; }
.ddos-node-server.is-overloaded { border-color: #ef4444; box-shadow: 0 0 24px rgba(239, 68, 68, 0.45); }
.ddos-node-server.is-overloaded .ddos-led { background: #ef4444; box-shadow: 0 0 8px #ef4444; }
.ddos-node-server.is-defended { border-color: #22d3ee; box-shadow: 0 0 20px rgba(34, 211, 238, 0.3); }
.ddos-node-server.is-defended .ddos-led { background: #22d3ee; box-shadow: 0 0 8px #22d3ee; }

.ddos-node-server.is-crashed {
  border-color: #ef4444;
  background: #2a0d12;
  box-shadow: 0 0 34px rgba(239, 68, 68, 0.6);
  animation: ddosCrashShake 0.5s ease;
}
.ddos-node-server.is-crashed .ddos-led { background: #ef4444; animation: ddosLedBlink 0.8s steps(2) infinite; }
.ddos-node-server.is-crashed .ddos-led-row strong { color: #fca5a5; }
.is-crashed .ddos-meter-fill { background: #ef4444; }
.is-crashed .ddos-rack-unit, .is-crashed .ddos-rack-unit.on { background: #450a0a; border-color: #7f1d1d; }
.ddos-banner-crashed { animation: ddosLedBlink 1.2s steps(2) infinite; }
@keyframes ddosCrashShake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-7px); }
  40% { transform: translateX(6px); }
  60% { transform: translateX(-4px); }
  80% { transform: translateX(3px); }
}
@keyframes ddosLedBlink {
  from { opacity: 1; }
  to { opacity: 0.7; }
}
@media (prefers-reduced-motion: reduce) {
  .ddos-node-server.is-crashed, .ddos-node-server.is-crashed .ddos-led, .ddos-banner-crashed { animation: none; }
}

.ddos-meter { margin-top: 6px; text-align: left; }
.ddos-meter-label {
  display: flex;
  justify-content: space-between;
  font-size: 0.7rem;
  color: #94a3b8;
  margin-bottom: 3px;
}
.ddos-meter-track { height: 6px; background: #1e293b; border-radius: 3px; overflow: hidden; }
.ddos-meter-fill {
  height: 100%;
  width: 0;
  background: #22c55e;
  border-radius: 3px;
  transition: width 0.3s linear, background 0.3s ease;
}
.is-warn .ddos-meter-fill { background: #f59e0b; }
.is-overloaded .ddos-meter-fill { background: #ef4444; }
.is-defended .ddos-meter-fill { background: #22d3ee; }

.ddos-rack { display: flex; gap: 4px; margin-top: 9px; }
.ddos-rack-unit {
  flex: 1;
  height: 8px;
  border-radius: 2px;
  background: #1e293b;
  border: 1px solid #334155;
  transition: background 0.3s ease;
}
.ddos-rack-unit.on { background: #38bdf8; border-color: #38bdf8; }

/* Legend */
.ddos-legend {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 16px;
  font-size: 0.76rem;
  color: #cbd5e1;
  margin-bottom: 14px;
}
.ddos-legend span { display: inline-flex; align-items: center; gap: 6px; }
.ddos-key { width: 9px; height: 9px; border-radius: 50%; display: inline-block; }
.ddos-key-square { border-radius: 2px; }
.ddos-key-bar { width: 4px; height: 13px; border-radius: 2px; }
.ddos-legend-note { color: #94a3b8; margin-left: auto; font-style: italic; }

/* Live readouts */
.ddos-readouts {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
}
.ddos-readout {
  background: #0d1527;
  border: 1px solid #1e293b;
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  min-width: 0;
}
.ddos-readout span { display: block; font-size: 0.73rem; color: #94a3b8; font-weight: 600; }
.ddos-readout strong {
  display: block;
  font-size: 1.35rem;
  color: #f8fafc;
  line-height: 1.3;
  font-variant-numeric: tabular-nums;
}
.ddos-readout small { display: block; font-size: 0.7rem; color: #64748b; }
.ddos-readout strong[data-tone="good"] { color: #4ade80; }
.ddos-readout strong[data-tone="warn"] { color: #fbbf24; }
.ddos-readout strong[data-tone="bad"] { color: #f87171; }

/* Defense layers */
.ddos-layers {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
}
.ddos-layer {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  background: var(--panel-2);
  transition: border-color 0.3s ease, background 0.3s ease;
}
.ddos-layer p { margin: 6px 0 0; font-size: 0.8rem; }
.ddos-layer-head strong { display: block; font-size: 0.9rem; }
.ddos-layer-value {
  display: block;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-faint);
  margin-top: 2px;
}
.ddos-layer[data-state="deploying"] { border-color: rgba(217, 119, 6, 0.5); background: var(--amber-bg); }
.ddos-layer[data-state="deploying"] .ddos-layer-value { color: var(--amber); }
.ddos-layer[data-state="on"] { border-color: rgba(22, 163, 74, 0.5); background: var(--green-bg); }
.ddos-layer[data-state="on"] .ddos-layer-value { color: var(--green); }

/* Statistics dashboard */
.ddos-stats {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 10px;
}
.ddos-stat {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  background: var(--panel-2);
  min-width: 0;
}
.ddos-stat span { display: block; font-size: 0.74rem; color: var(--text-faint); font-weight: 600; line-height: 1.3; min-height: 2.6em; }
.ddos-stat strong { display: block; font-size: 1.25rem; color: var(--text); overflow-wrap: anywhere; }
.ddos-stat strong[data-tone="warn"] { color: var(--amber); }
.ddos-stat strong[data-tone="bad"] { color: var(--red); }
.ddos-stat strong[data-tone="good"] { color: var(--green); }

/* Traffic chart */
.ddos-chart-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 6px 16px;
  margin: 18px 0 8px;
}
.ddos-chart-head h4 { margin: 0; font-size: 0.92rem; }
.ddos-chart-legend { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 0.78rem; color: var(--text-dim); }
.ddos-chart-legend span { display: inline-flex; align-items: center; gap: 6px; }
.ddos-chart-legend i { width: 14px; height: 3px; border-radius: 2px; display: inline-block; }
.ddos-chart-wrap { position: relative; height: 280px; }
.ddos-chart { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.ddos-tooltip {
  position: absolute;
  top: 16px;
  pointer-events: none;
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-lg);
  padding: 8px 10px;
  font-size: 0.76rem;
  color: var(--text-dim);
  white-space: nowrap;
  z-index: 5;
}
.ddos-tooltip strong { display: block; color: var(--text); margin-bottom: 3px; }
.ddos-tooltip i { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 6px; }
.ddos-table-details { margin-top: 10px; font-size: 0.84rem; }
.ddos-table-details summary { cursor: pointer; color: var(--text-dim); font-weight: 600; margin-bottom: 8px; }

@media (max-width: 1100px) {
  .ddos-stats { grid-template-columns: repeat(3, 1fr); }
  .ddos-layers { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 760px) {
  .ddos-readouts { grid-template-columns: repeat(2, 1fr); }
  .ddos-stats { grid-template-columns: repeat(2, 1fr); }
  .ddos-layers { grid-template-columns: 1fr; }
  .ddos-stage { height: 530px; }
  .ddos-node { width: calc(50% - 12px); max-width: 200px; padding: 8px; }
  .ddos-node-legit { left: 8px; top: 8px; }
  .ddos-node-sources { left: auto; right: 8px; top: 8px; bottom: auto; }
  .ddos-node-server { left: 0; right: 0; top: auto; bottom: 8px; margin: 0 auto; width: 176px; max-width: none; }
  .ddos-node .node-title { font-size: 0.66rem; }
  .ddos-swarm { gap: 2px; grid-template-columns: repeat(12, 5px); justify-content: center; }
  .ddos-swarm i { width: 5px; height: 5px; }
  .ddos-legend-note { margin-left: 0; }
}
