:root {
  color-scheme: dark;
  --bg: #101114;
  --panel: #171b1f;
  --panel-strong: #20252a;
  --ink: #f6f0e4;
  --muted: #b9b1a4;
  --line: rgba(246, 240, 228, 0.15);
  --mint: #60dec0;
  --blue: #74a9ff;
  --amber: #f3be5d;
  --red: #ff6f61;
  --violet: #c9a7ff;
  --green: #9de078;
  --shadow: 0 24px 70px rgba(0, 0, 0, 0.34);
}

* {
  box-sizing: border-box;
}

html {
  background: var(--bg);
}

body {
  margin: 0;
  min-width: 320px;
  color: var(--ink);
  background:
    linear-gradient(135deg, rgba(96, 222, 192, 0.08), transparent 24rem),
    radial-gradient(circle at 84% 18%, rgba(243, 190, 93, 0.10), transparent 24rem),
    linear-gradient(180deg, #101114 0%, #141719 42%, #0f1216 100%);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  letter-spacing: 0;
}

button,
a {
  font: inherit;
}

.defense-shell {
  width: min(1180px, 100%);
  margin: 0 auto;
  padding: 14px 14px 36px;
}

.defense-topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 2px;
  color: var(--muted);
  background: rgba(16, 17, 20, 0.82);
  backdrop-filter: blur(18px);
  border-bottom: 1px solid var(--line);
}

.defense-topbar a {
  display: inline-flex;
  align-items: center;
  min-height: 36px;
  color: var(--ink);
  text-decoration: none;
  font-weight: 800;
}

.defense-topbar span,
.eyebrow {
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.defense-hero {
  display: grid;
  gap: 16px;
  min-height: 44vh;
  align-content: end;
  padding: 38px 0 12px;
}

.hero-copy {
  max-width: 720px;
}

.eyebrow {
  margin: 0 0 10px;
  color: var(--mint);
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  max-width: 11ch;
  margin-bottom: 14px;
  font-size: clamp(3.35rem, 15vw, 8.1rem);
  line-height: 0.88;
}

h2 {
  margin-bottom: 10px;
  font-size: clamp(1.7rem, 5.8vw, 3.6rem);
  line-height: 0.98;
}

p {
  color: var(--muted);
  font-size: 1rem;
  line-height: 1.55;
}

.posture-strip {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
}

.posture-strip strong,
.posture-strip span,
.metric-card,
.recommendation-card,
.hardcase-card,
.topology-panel,
.safe-grain {
  border: 1px solid var(--line);
  background: rgba(23, 27, 31, 0.84);
  box-shadow: var(--shadow);
}

.posture-strip strong,
.posture-strip span {
  display: flex;
  min-height: 42px;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  color: var(--ink);
  font-size: 0.8rem;
  font-weight: 900;
  text-transform: uppercase;
}

.posture-strip strong {
  border-color: rgba(255, 111, 97, 0.58);
  color: #ffd2cb;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin: 12px 0;
}

.metric-card {
  min-height: 132px;
  padding: 14px;
  border-radius: 8px;
}

.metric-card strong {
  display: block;
  margin-bottom: 8px;
  font-size: 2.6rem;
  line-height: 0.9;
}

.metric-card span {
  display: block;
  color: var(--ink);
  font-weight: 800;
}

.metric-card small {
  display: block;
  margin-top: 8px;
  color: var(--muted);
  line-height: 1.35;
}

.metric-card:nth-child(1) strong {
  color: var(--blue);
}

.metric-card:nth-child(2) strong {
  color: var(--red);
}

.metric-card:nth-child(3) strong {
  color: var(--amber);
}

.metric-card:nth-child(4) strong {
  color: var(--violet);
}

.metric-card:nth-child(5) strong {
  color: var(--green);
}

.metric-card:nth-child(6) strong {
  color: var(--mint);
}

.topology-panel,
.safe-grain {
  display: grid;
  gap: 16px;
  margin-top: 12px;
  padding: 16px;
  border-radius: 8px;
}

.topology-proof-list {
  display: grid;
  gap: 8px;
  margin: 18px 0 0;
  padding: 0;
  list-style: none;
}

.topology-proof-list li {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  min-height: 42px;
  border: 1px solid rgba(246, 240, 228, 0.12);
  border-radius: 8px;
  background: rgba(246, 240, 228, 0.04);
}

.topology-proof-list strong {
  display: grid;
  place-items: center;
  height: 100%;
  border-right: 1px solid rgba(246, 240, 228, 0.12);
  color: var(--amber);
  font-size: 1.45rem;
}

.topology-proof-list span {
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.25;
}

.topology-figure {
  display: grid;
  gap: 10px;
  margin: 0;
  min-width: 0;
}

#defenseCanvas {
  width: 100%;
  height: auto;
  aspect-ratio: 1.64;
  border: 1px solid rgba(116, 169, 255, 0.22);
  border-radius: 8px;
  background:
    linear-gradient(rgba(246, 240, 228, 0.055) 1px, transparent 1px),
    linear-gradient(90deg, rgba(246, 240, 228, 0.055) 1px, transparent 1px),
    #0b0e13;
  background-size: 44px 44px;
}

.topology-figure figcaption {
  color: var(--muted);
  font: 0.82rem/1.35 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

.safe-grain {
  grid-template-columns: 1fr;
  overflow: hidden;
  border-color: rgba(255, 111, 97, 0.3);
}

.grain-bars {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  min-height: 150px;
  align-items: end;
}

.grain-bars span {
  display: block;
  min-height: 8px;
  height: var(--h);
  border-radius: 6px 6px 0 0;
  background: linear-gradient(180deg, rgba(116, 169, 255, 0.95), rgba(96, 222, 192, 0.78));
}

.grain-bars .blocked {
  background: linear-gradient(180deg, rgba(255, 111, 97, 1), rgba(243, 190, 93, 0.72));
}

.recommendation-section,
.hardcase-section {
  margin-top: 28px;
}

.section-heading {
  margin-bottom: 12px;
}

.recommendation-list,
.hardcase-list {
  display: grid;
  gap: 12px;
}

.recommendation-card,
.hardcase-card {
  position: relative;
  overflow: hidden;
  padding: 16px;
  border-radius: 8px;
}

.recommendation-card::before {
  position: absolute;
  inset: 0 auto 0 0;
  width: 5px;
  content: "";
  background: var(--lane-color, var(--blue));
}

.recommendation-card header,
.hardcase-card header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.recommendation-card h3,
.hardcase-card h3 {
  margin: 0;
  font-size: 1.2rem;
}

.count-pill,
.posture-pill {
  flex: 0 0 auto;
  padding: 7px 9px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--ink);
  font-size: 0.76rem;
  font-weight: 900;
}

.evidence-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 0 0 14px;
  padding: 0;
  list-style: none;
}

.evidence-tags li {
  padding: 6px 8px;
  border-radius: 999px;
  background: rgba(246, 240, 228, 0.08);
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 800;
}

.recommendation-card dl {
  display: grid;
  gap: 10px;
  margin: 0;
}

.recommendation-card dt {
  color: var(--ink);
  font-size: 0.72rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.recommendation-card dd {
  margin: 3px 0 0;
  color: var(--muted);
  line-height: 1.45;
}

.hardcase-card {
  box-shadow: none;
}

.hardcase-card p {
  margin-bottom: 0;
}

@media (min-width: 720px) {
  .defense-shell {
    padding: 18px 24px 56px;
  }

  .defense-hero {
    grid-template-columns: minmax(0, 1fr) 280px;
    min-height: 42vh;
    align-items: end;
  }

  h1 {
    max-width: 12ch;
  }

  .posture-strip {
    grid-template-columns: 1fr;
  }

  .metric-grid {
    grid-template-columns: repeat(6, minmax(0, 1fr));
  }

  .metric-card {
    min-height: 156px;
  }

  .topology-panel,
  .safe-grain {
    grid-template-columns: minmax(260px, 0.82fr) minmax(360px, 1.18fr);
    align-items: center;
    padding: 20px;
  }

  .recommendation-list {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .hardcase-list {
    grid-template-columns: repeat(5, minmax(0, 1fr));
  }
}
