:root {
  --bg: #f0f3fa;
  --card: #ffffff;
  --border: #d4dae6;
  --text: #1e293b;
  --muted: #64748b;
  --primary: #2563eb;
  --primary-soft: #dbeafe;
  --safe: #15803d;
  --safe-soft: #dcfce7;
  --harm: #b91c1c;
  --harm-soft: #fee2e2;
  --mod1: #4f46e5;
  --mod2: #0891b2;
  --mod3: #c2410c;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: "Segoe UI", system-ui, Arial, sans-serif;
  color: var(--text);
  background: var(--bg);
  line-height: 1.55;
}

/* ── Hero ── */

.hero {
  text-align: center;
  padding: 24px 20px 14px;
  background: linear-gradient(135deg, #1e3a5f 0%, #2563eb 100%);
  color: white;
}
.hero h1 { font-size: 1.6rem; margin-bottom: 6px; }
.hero-sub { font-size: 0.95rem; opacity: 0.88; }
.hero-sub em { opacity: 0.75; font-size: 0.88rem; }

/* ── Page / sections ── */

.page { max-width: 880px; margin: 0 auto; padding: 0 18px 40px; }

.sec { margin-top: 22px; }
.sec-title { text-align: center; font-size: 1.25rem; margin-bottom: 6px; }
.sec-sub { text-align: center; color: var(--muted); margin-bottom: 14px; font-size: 0.95rem; }

/* ── Chatbot vs Agent comparison ── */

.compare { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.compare-card {
  background: var(--card); border: 1px solid var(--border); border-radius: 12px;
  padding: 16px; text-align: center;
}
.compare-card h3 { margin-bottom: 10px; font-size: 1rem; }
.compare-card p { color: var(--muted); font-size: 0.9rem; margin-top: 10px; }
.compare-card.agent { border-color: var(--primary); }

.compare-flow { display: flex; justify-content: center; align-items: center; gap: 6px; flex-wrap: wrap; }
.flow-box {
  padding: 5px 10px; border: 1px solid var(--border); border-radius: 6px;
  font-size: 0.88rem; font-weight: 600; background: #f8fafc;
}
.flow-box.accent { background: var(--primary-soft); border-color: var(--primary); color: var(--primary); }
.flow-arrow { color: var(--muted); font-weight: bold; }

.tool-ring { margin-top: 10px; display: flex; gap: 6px; flex-wrap: wrap; justify-content: center; }
.tool-chip {
  font-size: 0.78rem; padding: 3px 7px;
  border: 1px solid var(--border); border-radius: 999px; background: #f8fafc;
}

/* ── Canvas sandbox ── */

.canvas-wrap {
  position: relative;
  max-width: 820px;
  margin: 0 auto;
  border: 2px solid #94a3b8;
  border-radius: 12px;
  overflow: hidden;
  background: #1e293b;
}
.canvas-wrap canvas { display: block; width: 100%; height: auto; }
.canvas-wrap { margin-bottom: 14px; }
.scenario-cards { margin-bottom: 12px; }

.canvas-badge {
  position: absolute; top: 8px; right: 10px;
  background: rgba(255,255,255,.92); border: 1px solid var(--border); border-radius: 999px;
  padding: 3px 10px; display: flex; align-items: center; gap: 5px;
  font-size: 0.78rem; font-weight: 600;
}
.cbdot { width: 8px; height: 8px; border-radius: 999px; }
.cbdot.neutral  { background: #94a3b8; }
.cbdot.working  { background: #3b82f6; animation: blink .8s infinite; }
.cbdot.safe     { background: #22c55e; }
.cbdot.harmful  { background: #ef4444; animation: blink .6s infinite; }

@keyframes blink { 0%,100% { opacity: 1; } 50% { opacity: .3; } }

/* ── Module cards ── */

.modules { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.mod-card {
  background: var(--card); border-radius: 12px; padding: 16px;
  border-left: 4px solid var(--border);
}
.mod1 { border-left-color: var(--mod1); }
.mod2 { border-left-color: var(--mod2); }
.mod3 { border-left-color: var(--mod3); }

.mod-num { font-size: 0.78rem; font-weight: 700; color: var(--muted); text-transform: uppercase; margin-bottom: 4px; }
.mod-card h3 { font-size: 1rem; margin-bottom: 6px; }
.mod-card p { font-size: 0.88rem; color: var(--muted); margin-bottom: 8px; }
.mod-scenarios { display: flex; flex-direction: column; gap: 3px; font-size: 0.82rem; }

/* ── Scenario cards ── */

.scenario-cards {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 14px;
}
.sc-card {
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  text-align: center; padding: 12px 8px; border-radius: 10px;
  background: var(--card); border: 1px solid var(--border);
  cursor: pointer; transition: border-color .15s, background .15s;
  font-family: inherit; color: var(--text);
}
.sc-card:hover { border-color: #93a5cc; }
.sc-card.selected { border-color: var(--primary); background: var(--primary-soft); }
.sc-icon { font-size: 1.6rem; }
.sc-card strong { font-size: 0.88rem; }
.sc-card small { color: var(--muted); font-size: 0.78rem; line-height: 1.3; }

/* ── Playground controls ── */

.play-controls {
  background: var(--card); border: 1px solid var(--border); border-radius: 12px; padding: 14px;
}
.play-input { margin-bottom: 10px; }
.play-input label { display: block; font-weight: 600; margin-bottom: 4px; font-size: 0.9rem; }
.play-input textarea {
  width: 100%; border: 1px solid #cbd5e1; border-radius: 6px;
  padding: 8px; font: inherit; resize: vertical;
}
.play-btns { display: flex; gap: 8px; flex-wrap: wrap; }

.btn {
  border: none; border-radius: 8px; padding: 9px 16px;
  font-weight: 600; font-size: 0.92rem; cursor: pointer;
  transition: filter .15s;
}
.btn:hover { filter: brightness(.95); }
.btn.safe   { background: var(--safe-soft); color: var(--safe); }
.btn.attack { background: var(--harm-soft); color: var(--harm); }
.btn.reset  { background: #f1f5f9; color: var(--muted); }

/* ── Results ── */

.result-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.res-card {
  background: var(--card); border: 1px solid var(--border); border-radius: 10px; padding: 12px;
}
.res-card h3 { font-size: 0.88rem; color: var(--muted); margin-bottom: 6px; }
.res-card p  { font-size: 0.92rem; }

.pill {
  display: inline-block; padding: 3px 10px; border-radius: 999px;
  font-weight: 600; font-size: 0.85rem; border: 1px solid transparent;
}
.pill.safe    { color: var(--safe); background: var(--safe-soft); border-color: #86efac; }
.pill.harmful { color: var(--harm); background: var(--harm-soft); border-color: #fca5a5; }
.pill.neutral { color: var(--muted); background: #eef2ff; border-color: #c7d2fe; }

/* ── Risk log ── */

.risk-panel {
  background: var(--card); border: 1px solid var(--border); border-radius: 10px; padding: 14px;
}
.risk-panel ul { padding-left: 18px; }
.risk-panel li { margin-bottom: 5px; font-size: 0.92rem; }
.muted { color: var(--muted); }

/* ── Footer ── */

.footer { text-align: center; padding: 20px; color: var(--muted); font-size: 0.85rem; }

/* ── Responsive ── */

@media (max-width: 700px) {
  .compare, .modules, .scenario-cards, .result-grid {
    grid-template-columns: 1fr;
  }
}
