:root {
  --bg: #0f172a;
  --surface: #1e293b;
  --surface-alt: #263449;
  --border: #334155;
  --text: #f1f5f9;
  --text-muted: #94a3b8;
  --primary: #38bdf8;
  --primary-hover: #0ea5e9;
  --danger: #f87171;
  --danger-bg: rgba(248, 113, 113, 0.12);
  --success: #4ade80;
  --success-bg: rgba(74, 222, 128, 0.12);
  --warning: #fbbf24;
  --radius: 12px;
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Hiragino Sans", "Noto Sans JP", sans-serif;
  background-color: var(--bg);
  color: var(--text);
  line-height: 1.65;
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1.25rem;
}

.site-header {
  background: linear-gradient(135deg, #0f172a 0%, #1e1b4b 100%);
  border-bottom: 1px solid var(--border);
  padding: 2.25rem 0;
}

.header-inner {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 2rem;
  flex-wrap: wrap;
}

.badge-pill {
  display: inline-block;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--primary);
  background: rgba(56, 189, 248, 0.14);
  border: 1px solid rgba(56, 189, 248, 0.35);
  padding: 0.2rem 0.75rem;
  border-radius: 999px;
  margin-bottom: 0.6rem;
}

.site-header h1 {
  font-size: 1.85rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  margin-bottom: 0.5rem;
}

.subtitle {
  color: var(--text-muted);
  max-width: 720px;
  font-size: 0.95rem;
}

.header-stats {
  display: flex;
  gap: 0.85rem;
  flex-wrap: wrap;
}

.stat-card {
  background: rgba(30, 41, 59, 0.85);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.85rem 1.15rem;
  min-width: 140px;
}

.stat-label {
  display: block;
  font-size: 0.75rem;
  color: var(--text-muted);
}

.stat-value {
  font-size: 1.35rem;
  color: var(--primary);
}

/* Tabs */
.tab-nav {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 20;
}

.tab-nav-inner {
  display: flex;
  gap: 0.5rem;
  overflow-x: auto;
  padding-top: 0.5rem;
  padding-bottom: 0.5rem;
}

.tab-btn {
  background: transparent;
  color: var(--text-muted);
  border: 1px solid transparent;
  padding: 0.6rem 1.1rem;
  border-radius: 8px;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s ease;
}

.tab-btn:hover {
  color: var(--text);
  background: var(--surface-alt);
}

.tab-btn.active {
  color: #0f172a;
  background: var(--primary);
}

.main-content {
  padding-top: 2rem;
  padding-bottom: 4rem;
}

.tab-panel {
  display: none;
}

.tab-panel.active {
  display: block;
}

/* Filter Bar */
.filter-bar {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.15rem;
  margin-bottom: 1.5rem;
}

.filter-group {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.filter-group label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
}

.filter-group select,
.filter-group input {
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.6rem 0.8rem;
  font-size: 0.9rem;
}

/* Vulnerability Cards */
.vuln-cards-grid {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.vuln-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
}

.vuln-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 1rem;
  border-bottom: 1px solid var(--border);
  padding-bottom: 0.85rem;
}

.vuln-title-group h3 {
  font-size: 1.25rem;
  margin-bottom: 0.25rem;
}

.vuln-tags {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.tag {
  font-size: 0.75rem;
  padding: 0.15rem 0.6rem;
  border-radius: 6px;
  background: var(--surface-alt);
  border: 1px solid var(--border);
  color: var(--text-muted);
}

.tag.severity-critical {
  color: #fecaca;
  background: rgba(239, 68, 68, 0.2);
  border-color: rgba(239, 68, 68, 0.45);
}

.tag.severity-high {
  color: #fde68a;
  background: rgba(245, 158, 11, 0.2);
  border-color: rgba(245, 158, 11, 0.45);
}

.vuln-columns {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 1.25rem;
  margin-bottom: 1.25rem;
}

.info-box {
  padding: 1rem;
  border-radius: 8px;
  border: 1px solid var(--border);
}

.info-box.cause-box {
  background: var(--danger-bg);
  border-color: rgba(248, 113, 113, 0.35);
}

.info-box.defense-box {
  background: var(--success-bg);
  border-color: rgba(74, 222, 128, 0.35);
}

.info-box h4 {
  font-size: 0.92rem;
  margin-bottom: 0.45rem;
}

.cause-box h4 {
  color: var(--danger);
}

.defense-box h4 {
  color: var(--success);
}

.info-box p,
.info-box ul {
  font-size: 0.9rem;
}

.info-box ul {
  padding-left: 1.2rem;
  margin-top: 0.4rem;
}

.code-compare {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 1rem;
}

.code-block-wrap {
  background: #090d16;
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
}

.code-block-header {
  padding: 0.45rem 0.85rem;
  font-size: 0.8rem;
  font-weight: 700;
  border-bottom: 1px solid var(--border);
}

.code-block-header.bad {
  background: rgba(239, 68, 68, 0.18);
  color: #fca5a5;
}

.code-block-header.good {
  background: rgba(34, 197, 94, 0.18);
  color: #86efac;
}

.code-block-wrap pre {
  padding: 0.9rem;
  overflow-x: auto;
  font-family: "JetBrains Mono", Consolas, Monaco, monospace;
  font-size: 0.82rem;
  line-height: 1.5;
  color: #e2e8f0;
}

/* SDLC Section */
.section-intro {
  margin-bottom: 1.5rem;
}

.section-intro h2 {
  font-size: 1.4rem;
  margin-bottom: 0.4rem;
}

.section-intro p {
  color: var(--text-muted);
}

.sdlc-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 1.25rem;
}

.sdlc-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.35rem;
}

.sdlc-step {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--primary);
  text-transform: uppercase;
}

.sdlc-card h3 {
  font-size: 1.15rem;
  margin: 0.3rem 0 0.75rem;
}

.sdlc-card ul {
  padding-left: 1.15rem;
  font-size: 0.9rem;
  margin-bottom: 1rem;
}

.sdlc-card li {
  margin-bottom: 0.4rem;
}

.tool-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

/* Matrix Table */
.table-responsive {
  overflow-x: auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.matrix-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
}

.matrix-table th,
.matrix-table td {
  padding: 0.85rem 1rem;
  text-align: left;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}

.matrix-table th {
  background: var(--surface-alt);
  color: var(--primary);
  font-weight: 700;
}

/* Checklist */
.checklist-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
  margin-bottom: 1rem;
}

.checklist-actions {
  display: flex;
  gap: 0.6rem;
}

.btn-primary,
.btn-secondary {
  padding: 0.55rem 1rem;
  border-radius: 8px;
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid transparent;
}

.btn-primary {
  background: var(--primary);
  color: #0f172a;
}

.btn-primary:hover {
  background: var(--primary-hover);
}

.btn-secondary {
  background: var(--surface-alt);
  color: var(--text);
  border-color: var(--border);
}

.progress-bar-wrap {
  width: 100%;
  height: 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  overflow: hidden;
  margin-bottom: 0.4rem;
}

.progress-bar-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--primary), var(--success));
  transition: width 0.25s ease;
}

.progress-text {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 1.5rem;
}

.checklist-groups {
  display: grid;
  gap: 1.25rem;
}

.checklist-group-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
}

.checklist-group-card h3 {
  font-size: 1.05rem;
  margin-bottom: 0.85rem;
  color: var(--primary);
}

.check-item {
  display: flex;
  align-items: flex-start;
  gap: 0.7rem;
  padding: 0.5rem 0;
  border-bottom: 1px solid rgba(51, 65, 85, 0.5);
  cursor: pointer;
  font-size: 0.92rem;
}

.check-item:last-child {
  border-bottom: none;
}

.check-item input[type="checkbox"] {
  margin-top: 0.28rem;
  width: 17px;
  height: 17px;
  accent-color: var(--success);
}

.check-item.checked span {
  text-decoration: line-through;
  color: var(--text-muted);
}

.site-footer {
  border-top: 1px solid var(--border);
  padding: 1.5rem 0;
  color: var(--text-muted);
  font-size: 0.85rem;
}

.footer-inner {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
}

/* Overview Map (5 Trust Boundaries) */
.ov-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  margin-bottom: 1.5rem;
}

.ov-header {
  margin-bottom: 1.25rem;
}

.ov-title {
  font-size: 1.3rem;
  font-weight: 800;
  margin-bottom: 0.35rem;
}

.ov-subtitle {
  font-size: 0.9rem;
  color: var(--text-muted);
}

.ov-layers-stack {
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
}

.ov-layer-card {
  background: rgba(15, 23, 42, 0.7);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1rem 1.2rem;
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 1.2rem;
  align-items: center;
}

@media (max-width: 820px) {
  .ov-layer-card {
    grid-template-columns: 1fr;
  }
}

.ov-layer-badge {
  display: inline-block;
  font-size: 0.7rem;
  font-weight: 800;
  padding: 0.15rem 0.55rem;
  border-radius: 999px;
  margin-bottom: 0.35rem;
}

.ov-layer-title {
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: 0.25rem;
}

.ov-layer-desc {
  font-size: 0.8rem;
  color: var(--text-muted);
  line-height: 1.45;
}

.ov-layer-items {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 0.65rem;
}

.ov-node-card {
  text-align: left;
  background: rgba(30, 41, 59, 0.9);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.65rem 0.8rem;
  color: var(--text);
  cursor: pointer;
  transition: transform 0.15s ease, background 0.15s ease;
}

.ov-node-card:hover {
  transform: translateY(-2px);
  background: var(--surface-alt);
}

.ov-node-top {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  margin-bottom: 0.25rem;
}

.ov-node-num {
  font-size: 0.72rem;
  font-weight: 800;
  padding: 0.1rem 0.45rem;
  border-radius: 4px;
}

.ov-node-name {
  font-size: 0.88rem;
  font-weight: 700;
}

.ov-node-tag {
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* Deep-Dive Analogy, Flow Diagrams, Bar Charts & Tables */
.vuln-num-row {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  flex-wrap: wrap;
  margin-bottom: 0.5rem;
}

.vuln-index-badge {
  font-size: 0.74rem;
  font-weight: 800;
  color: #0f172a;
  background: var(--primary);
  padding: 0.15rem 0.55rem;
  border-radius: 6px;
}

.dd-analogy-box {
  background: linear-gradient(135deg, rgba(56, 189, 248, 0.12), rgba(99, 102, 241, 0.1));
  border: 1px solid rgba(56, 189, 248, 0.4);
  border-radius: 10px;
  padding: 1.15rem 1.25rem;
  margin-bottom: 1.35rem;
}

.dd-analogy-label {
  font-size: 0.78rem;
  font-weight: 800;
  color: var(--primary);
  margin-bottom: 0.35rem;
}

.dd-analogy-quote {
  font-size: 1.05rem;
  font-weight: 800;
  color: #f8fafc;
  margin-bottom: 0.5rem;
  line-height: 1.5;
}

.dd-plain-text {
  font-size: 0.9rem;
  color: #cbd5e1;
  line-height: 1.65;
}

.dd-section-block {
  margin-bottom: 1.35rem;
}

.dd-sub-heading {
  font-size: 1rem;
  font-weight: 700;
  color: #f8fafc;
  margin-bottom: 0.35rem;
}

.dd-vis-subtitle {
  font-size: 0.84rem;
  color: var(--text-muted);
  margin-bottom: 0.75rem;
}

.dd-vis-panel {
  background: rgba(15, 23, 42, 0.7);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1.15rem;
  display: flex;
  flex-direction: column;
  gap: 1.2rem;
}

.dd-flow-diagram {
  display: grid;
  grid-template-columns: 1fr auto 1fr auto 1fr auto 1fr;
  gap: 0.5rem;
  align-items: stretch;
}

@media (max-width: 960px) {
  .dd-flow-diagram {
    grid-template-columns: 1fr;
  }
  .dd-flow-arrow {
    transform: rotate(90deg);
  }
}

.dd-flow-node {
  border-radius: 8px;
  padding: 0.85rem;
  border: 1px solid var(--border);
  background: rgba(30, 41, 59, 0.85);
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.dd-flow-node.tone-rose {
  border-color: rgba(248, 113, 113, 0.45);
  background: rgba(248, 113, 113, 0.1);
}

.dd-flow-node.tone-amber {
  border-color: rgba(251, 191, 36, 0.45);
  background: rgba(251, 191, 36, 0.1);
}

.dd-flow-node.tone-sky {
  border-color: rgba(56, 189, 248, 0.45);
  background: rgba(56, 189, 248, 0.1);
}

.dd-flow-node.tone-emerald {
  border-color: rgba(74, 222, 128, 0.5);
  background: rgba(74, 222, 128, 0.12);
}

.dd-flow-icon {
  font-size: 1.35rem;
}

.dd-flow-title {
  font-size: 0.86rem;
  font-weight: 800;
  color: #f8fafc;
}

.dd-flow-sub {
  font-size: 0.78rem;
  color: #cbd5e1;
  line-height: 1.45;
}

.dd-flow-arrow {
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--primary);
  font-weight: 800;
  font-size: 1.1rem;
  padding: 0 0.15rem;
}

.dd-scale-chart {
  background: rgba(9, 13, 22, 0.65);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1rem;
}

.dd-scale-heading {
  font-size: 0.86rem;
  font-weight: 700;
  color: #e2e8f0;
  margin-bottom: 0.8rem;
}

.dd-scale-rows {
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
}

.dd-scale-row-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
  font-size: 0.83rem;
  margin-bottom: 0.28rem;
}

.dd-scale-label {
  font-weight: 700;
  color: #f1f5f9;
}

.dd-scale-val {
  font-weight: 800;
  font-size: 0.8rem;
}

.dd-scale-bar-track {
  width: 100%;
  height: 9px;
  background: rgba(51, 65, 85, 0.55);
  border-radius: 999px;
  overflow: hidden;
  margin-bottom: 0.25rem;
}

.dd-scale-bar-fill {
  height: 100%;
  border-radius: 999px;
}

.dd-scale-note {
  font-size: 0.76rem;
  color: var(--text-muted);
}

.dd-table-wrap {
  margin-top: 0.5rem;
}

.dd-issue-table th {
  font-size: 0.82rem;
}

.dd-issue-table td {
  font-size: 0.84rem;
}

.dd-table-key {
  font-weight: 700;
  color: #f8fafc;
  white-space: nowrap;
  background: rgba(15, 23, 42, 0.55);
}

.dd-examples-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 0.9rem;
  margin-top: 0.5rem;
}

.dd-example-card {
  background: rgba(15, 23, 42, 0.65);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.95rem 1.05rem;
}

.dd-example-num {
  display: inline-block;
  font-size: 0.7rem;
  font-weight: 800;
  color: var(--warning);
  background: rgba(251, 191, 36, 0.14);
  border: 1px solid rgba(251, 191, 36, 0.35);
  padding: 0.1rem 0.5rem;
  border-radius: 4px;
  margin-bottom: 0.35rem;
}

.dd-example-title {
  font-size: 0.92rem;
  font-weight: 700;
  color: #f8fafc;
  margin-bottom: 0.25rem;
}

.dd-example-scene {
  font-size: 0.78rem;
  color: var(--primary);
  margin-bottom: 0.4rem;
}

.dd-example-detail {
  font-size: 0.83rem;
  color: #cbd5e1;
  line-height: 1.55;
}

.matrix-jump-btn {
  background: none;
  border: none;
  color: var(--primary);
  font-size: 0.9rem;
  font-weight: 700;
  text-align: left;
  cursor: pointer;
  padding: 0;
}

.matrix-jump-btn:hover {
  text-decoration: underline;
}

.matrix-analogy-cell {
  color: #e2e8f0;
  font-size: 0.84rem;
}

@keyframes pulseBorder {
  0% {
    box-shadow: 0 0 0 0 rgba(56, 189, 248, 0.7);
    border-color: var(--primary);
  }
  70% {
    box-shadow: 0 0 0 10px rgba(56, 189, 248, 0);
    border-color: var(--primary);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(56, 189, 248, 0);
  }
}

.highlight-pulse {
  animation: pulseBorder 1.5s ease-out;
}

/* Real-World Security Incidents Cards */
.dd-incidents-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 0.9rem;
  margin-top: 0.5rem;
}

.dd-incident-card {
  background: rgba(248, 113, 113, 0.08);
  border: 1px solid rgba(248, 113, 113, 0.35);
  border-radius: 8px;
  padding: 0.95rem 1.05rem;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 0.45rem;
}

.dd-incident-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.dd-incident-badge {
  font-size: 0.7rem;
  font-weight: 800;
  color: #fecaca;
  background: rgba(239, 68, 68, 0.25);
  border: 1px solid rgba(239, 68, 68, 0.5);
  padding: 0.1rem 0.5rem;
  border-radius: 4px;
}

.dd-incident-scale {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--warning);
}

.dd-incident-title {
  font-size: 0.92rem;
  font-weight: 800;
  color: #f8fafc;
}

.dd-incident-summary {
  font-size: 0.83rem;
  color: #cbd5e1;
  line-height: 1.55;
}

.dd-incident-link {
  display: inline-block;
  margin-top: 0.2rem;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--primary);
  text-decoration: none;
}

.dd-incident-link:hover {
  text-decoration: underline;
}

.matrix-incident-item {
  margin-bottom: 0.55rem;
}

.matrix-incident-item:last-child {
  margin-bottom: 0;
}

.matrix-incident-link {
  color: #fca5a5;
  font-weight: 700;
  font-size: 0.82rem;
  text-decoration: none;
}

.matrix-incident-link:hover {
  text-decoration: underline;
  color: var(--primary);
}

.matrix-incident-scale {
  font-size: 0.74rem;
  color: var(--text-muted);
}
