:root {
  color-scheme: light;
  --ink: #12201f;
  --muted: #62716f;
  --paper: #f5f4ef;
  --card: #fffefa;
  --line: #d9ddd7;
  --teal: #087f72;
  --teal-soft: #d8efe9;
  --coral: #d35e42;
  --coral-soft: #fae4dd;
  --violet: #7156a6;
  --violet-soft: #eae3f6;
  --blue: #2f65a7;
  --blue-soft: #e1ebf7;
  --shadow: 0 18px 55px rgb(26 42 40 / 8%);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-synthesis: none;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background:
    radial-gradient(circle at 0 0, rgb(8 127 114 / 8%), transparent 30rem),
    var(--paper);
  color: var(--ink);
}

button, input { font: inherit; }

button { color: inherit; }

.skip-link {
  position: fixed;
  left: 1rem;
  top: -5rem;
  z-index: 10;
  padding: 0.7rem 1rem;
  background: var(--ink);
  color: white;
  border-radius: 0.5rem;
}

.skip-link:focus { top: 1rem; }

.site-header, main, footer {
  width: min(1180px, calc(100% - 2rem));
  margin-inline: auto;
}

.site-header {
  padding: 4.5rem 0 2.7rem;
}

.header-copy { max-width: 760px; }

.section-kicker, .card-label {
  margin: 0 0 0.55rem;
  color: var(--teal);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.13em;
  text-transform: uppercase;
}

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

h1 {
  max-width: 700px;
  margin-bottom: 0.8rem;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(3rem, 7vw, 6.2rem);
  font-weight: 500;
  letter-spacing: -0.055em;
  line-height: 0.92;
}

.lede {
  max-width: 690px;
  margin-bottom: 0;
  color: var(--muted);
  font-size: clamp(1rem, 2vw, 1.25rem);
  line-height: 1.6;
}

.tabs {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  margin-bottom: 2rem;
  border: 1px solid var(--line);
  border-radius: 1rem;
  background: rgb(255 254 250 / 60%);
  overflow: hidden;
}

.tabs button {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  min-height: 4rem;
  border: 0;
  border-right: 1px solid var(--line);
  background: transparent;
  cursor: pointer;
  font-weight: 750;
}

.tabs button:last-child { border-right: 0; }
.tabs button span { color: var(--muted); font-size: 0.74rem; }
.tabs button[aria-selected="true"] { background: var(--ink); color: white; }
.tabs button[aria-selected="true"] span { color: #a8c7c2; }
.tabs button:focus-visible, .button:focus-visible { outline: 3px solid #eebf53; outline-offset: 2px; }

.tab-panel { position: relative; min-height: calc(100vh - 1rem); padding-bottom: 5rem; scroll-margin-top: 1rem; }

.panel-loader {
  position: absolute;
  inset: 0;
  z-index: 5;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  gap: 0.7rem;
  padding-top: clamp(8rem, 28vh, 15rem);
  background: rgb(245 244 239 / 82%);
  color: var(--ink);
  font-size: 0.88rem;
  font-weight: 750;
  backdrop-filter: blur(2px);
}

.panel-loader[hidden] { display: none; }

.loading-spinner {
  width: 1.15rem;
  height: 1.15rem;
  border: 2px solid rgb(8 127 114 / 22%);
  border-top-color: var(--teal);
  border-radius: 50%;
  animation: loading-spin 700ms linear infinite;
}

@keyframes loading-spin { to { transform: rotate(360deg); } }

.section-intro {
  display: grid;
  grid-template-columns: minmax(260px, 0.8fr) minmax(320px, 1.2fr);
  align-items: end;
  gap: clamp(2rem, 8vw, 7rem);
  padding: 2.5rem 0 2rem;
}

.section-intro h2 {
  margin-bottom: 0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(2.2rem, 5vw, 4rem);
  font-weight: 500;
  letter-spacing: -0.045em;
  line-height: 1;
}

.section-intro > p { margin-bottom: 0; color: var(--muted); font-size: 1.02rem; line-height: 1.65; }
.section-kicker.coral { color: var(--coral); }
.section-kicker.violet { color: var(--violet); }
.section-kicker.blue { color: var(--blue); }

.workspace, .visual-grid { display: grid; gap: 1rem; margin-top: 1rem; }
.two-column { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.visual-grid { grid-template-columns: 1fr; }

.command-guide {
  display: grid;
  grid-template-columns: minmax(170px, 0.35fr) minmax(0, 1.65fr);
  align-items: center;
  gap: 0.75rem 1.5rem;
  margin: 1rem 0;
  padding: 1rem 1.15rem;
  border: 1px solid #bcded7;
  border-radius: 1rem;
  background: #edf7f4;
}

.command-guide h3 { margin: 0; font-size: 1rem; }
.command-guide .card-label { margin-bottom: 0.2rem; }
.command-guide > p { grid-column: 2; margin: 0; color: var(--muted); font-size: 0.78rem; }

.command-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.command-list li {
  padding: 0.42rem 0.7rem;
  border: 1px solid #b8d8d2;
  border-radius: 999px;
  background: var(--card);
  color: #176c63;
  font-size: 0.82rem;
  font-weight: 800;
}

.card {
  min-width: 0;
  padding: clamp(1.15rem, 2.5vw, 1.75rem);
  border: 1px solid var(--line);
  border-radius: 1.15rem;
  background: var(--card);
  box-shadow: var(--shadow);
}

.card-heading { display: flex; align-items: center; gap: 0.85rem; margin-bottom: 1.35rem; }
.card-heading h3, .plot-heading h3, .range-heading h3 { margin: 0; font-size: 1.05rem; }
.card-heading .card-label, .range-heading .card-label { margin-bottom: 0.2rem; }

.step-number {
  display: grid;
  width: 2.2rem;
  height: 2.2rem;
  place-items: center;
  border-radius: 50%;
  background: var(--teal-soft);
  color: var(--teal);
  font-size: 0.8rem;
  font-weight: 850;
}

.input-type-selector {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.45rem;
  margin: 0 0 0.75rem;
  padding: 0;
  border: 0;
}

.input-type-selector legend {
  margin-bottom: 0.4rem;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 700;
}

.input-type-selector label { position: relative; }
.input-type-selector input { position: absolute; opacity: 0; }

.input-type-selector span {
  display: block;
  padding: 0.58rem 0.4rem;
  border: 1px solid var(--line);
  border-radius: 0.6rem;
  background: #f8faf7;
  font-size: 0.76rem;
  font-weight: 700;
  text-align: center;
  cursor: pointer;
}

.input-type-selector input:checked + span {
  border-color: var(--teal);
  background: var(--teal-soft);
  color: #176c63;
}

.input-type-selector input:focus-visible + span { outline: 3px solid #eebf53; outline-offset: 2px; }
.input-type-selector input:disabled + span { cursor: wait; opacity: 0.55; }
.input-methods { min-height: 10.5rem; }

.input-method-panel {
  position: relative;
  min-height: 10.5rem;
  padding: 1rem;
  border: 1px solid var(--line);
  border-radius: 0.85rem;
  background: #f8faf7;
}

.input-method-panel[hidden], .record-countdown[hidden] { display: none; }
.microphone-input-panel, .sample-input-panel { display: grid; align-content: center; gap: 0.9rem; }
.input-method-copy { display: grid; gap: 0.25rem; }
.input-method-copy span { color: var(--muted); font-size: 0.8rem; line-height: 1.45; }
.input-method-panel > .button { justify-self: start; }

.drop-zone {
  display: grid;
  min-height: 8.4rem;
  place-content: center;
  border: 1.5px dashed #aab8b4;
  border-radius: 0.85rem;
  background: #f8faf7;
  text-align: center;
  cursor: pointer;
  transition: border-color 150ms, background 150ms, transform 150ms;
}

.drop-zone:hover, .drop-zone.dragging { border-color: var(--teal); background: var(--teal-soft); transform: translateY(-1px); }
.drop-zone input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.drop-zone strong { margin-bottom: 0.3rem; }
.drop-zone span { color: var(--muted); font-size: 0.85rem; }

.record-countdown {
  position: absolute;
  inset: 0;
  display: grid;
  place-content: center;
  pointer-events: none;
  border-radius: inherit;
  background: #edf7f4;
  text-align: center;
}

.record-countdown strong {
  color: var(--teal);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 3.4rem;
  font-weight: 500;
  line-height: 0.95;
}

.record-countdown span { margin-top: 0.35rem; color: #315d58; font-size: 0.75rem; font-weight: 800; letter-spacing: 0.08em; text-transform: uppercase; }
.record-countdown[data-phase="listening"] strong { animation: listening-pulse 900ms ease-in-out infinite alternate; }
.record-countdown[data-phase="speech"] { background: var(--coral-soft); }
.record-countdown[data-phase="speech"] strong { color: var(--coral); font-size: 2.4rem; }
.record-countdown[data-phase="speech"] > span { color: #8f3c28; }
.record-countdown[data-phase="processing"] strong { font-size: 2.7rem; }
.record-countdown[data-phase="cooldown"] strong { font-size: 2.4rem; }
#record-button.recording + .record-countdown { place-content: start center; padding-top: 1rem; }

.live-input-level {
  display: none;
  width: 8rem;
  height: 0.4rem;
  margin: 0.75rem auto 0 !important;
  border-radius: 99px;
  background: rgb(18 32 31 / 12%);
  overflow: hidden;
}

.live-input-level span {
  display: block;
  width: var(--level, 0%);
  height: 100%;
  margin: 0;
  border-radius: inherit;
  background: var(--teal);
  transition: width 80ms linear;
}

.record-countdown[data-phase="listening"] .live-input-level,
.record-countdown[data-phase="speech"] .live-input-level { display: block; }
.record-countdown[data-phase="speech"] .live-input-level span { background: var(--coral); }

@keyframes listening-pulse { to { opacity: 0.35; transform: scale(0.78); } }

.button-row { display: flex; flex-wrap: wrap; gap: 0.65rem; margin-top: 1rem; }
.button { padding: 0.72rem 0.95rem; border-radius: 0.65rem; cursor: pointer; font-weight: 750; }
.button.primary { border: 1px solid var(--ink); background: var(--ink); color: white; }
.button.secondary { border: 1px solid var(--line); background: white; }
.button:disabled { cursor: wait; opacity: 0.55; }

.record-dot { display: inline-block; width: 0.55rem; height: 0.55rem; margin-right: 0.35rem; border-radius: 50%; background: #ff7962; }
#record-button.recording { position: relative; z-index: 1; }
.recording .record-dot { animation: pulse 850ms infinite alternate; }
@keyframes pulse { to { opacity: 0.35; transform: scale(0.7); } }

.inline-status { min-height: 1.3rem; margin: 0.85rem 0 0.5rem; color: var(--muted); font-size: 0.82rem; }
audio { width: 100%; height: 2.6rem; }

.prediction-hero {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.25rem;
  padding: 1rem 1.1rem;
  border-radius: 0.85rem;
  background: var(--teal-soft);
}

.prediction-hero span { font-family: Georgia, serif; font-size: clamp(2rem, 5vw, 3.2rem); }
.prediction-hero strong { color: var(--teal); }
.prediction-hero.empty { background: #f0f1ed; color: var(--muted); }
.prediction-hero.empty strong { color: var(--muted); font-weight: 500; }

.probability-list { display: grid; gap: 0.55rem; }
.probability-row { display: grid; grid-template-columns: 6.5rem 1fr 3.5rem; align-items: center; gap: 0.65rem; font-size: 0.82rem; }
.probability-row strong { font-weight: 650; }
.probability-track { height: 0.55rem; border-radius: 99px; background: #e9ece8; overflow: hidden; }
.probability-fill { height: 100%; border-radius: inherit; background: var(--teal); transition: width 300ms ease; }
.probability-row span:last-child { color: var(--muted); text-align: right; font-variant-numeric: tabular-nums; }

.plot-card { padding: clamp(0.75rem, 1.5vw, 1rem); }
.signal-card { display: grid; gap: 0.65rem; }
.signal-plot { min-width: 0; }
.signal-plot .plot-heading { margin-bottom: 0.35rem; padding-inline: 0.1rem; }
.plot-heading, .range-heading, .compare-title { display: flex; justify-content: space-between; align-items: center; gap: 1rem; margin-bottom: 1rem; }
.plot-heading span { color: var(--muted); font-size: 0.75rem; }
canvas { display: block; width: 100%; height: auto; border-radius: 0.65rem; background: #eef1ec; }

.attack-intro {
  grid-template-columns: minmax(250px, 0.75fr) minmax(360px, 1.25fr);
  gap: clamp(2rem, 6vw, 5rem);
  padding: 1.4rem 0 1.25rem;
}

.attack-intro h2 { font-size: clamp(2.1rem, 4.2vw, 3.4rem); }
.attack-intro > p { font-size: 0.93rem; line-height: 1.55; }

.attack-lab {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(19rem, 20.5rem);
  align-items: start;
  gap: 1rem;
}

.attack-comparisons { display: grid; min-width: 0; gap: 0.75rem; }

.audio-compare-card {
  display: grid;
  grid-template-columns: minmax(8rem, auto) minmax(0, 1fr);
  grid-template-areas:
    "title player"
    "plot plot";
  align-items: center;
  gap: 0.55rem 0.8rem;
  padding: 0.7rem;
  box-shadow: none;
}

.audio-compare-card.attacked { border-color: #eab7a9; background: #fff9f6; }
.audio-compare-card.poisoned { border-color: #c9b7e7; background: #fcf9ff; }
.audio-compare-card .compare-title { grid-area: title; margin: 0; }
.audio-compare-card audio { grid-area: player; width: 100%; min-width: 0; height: 2.25rem; margin: 0; }
.audio-compare-card canvas { grid-area: plot; border-radius: 0.22rem; }
.fgsm-comparison-card { display: grid; gap: 0.45rem; padding: 0.55rem; box-shadow: none; }
.fgsm-compare-item {
  display: grid;
  grid-template-columns: minmax(8rem, auto) minmax(0, 1fr);
  grid-template-areas:
    "title player"
    "plot plot";
  align-items: center;
  gap: 0.38rem 0.7rem;
  min-width: 0;
}
.fgsm-compare-item + .fgsm-compare-item { padding-top: 0.5rem; border-top: 1px solid #eab7a9; }
.fgsm-compare-item .compare-title { grid-area: title; margin: 0; }
.fgsm-compare-item audio { grid-area: player; width: 100%; min-width: 0; height: 2rem; margin: 0; }
.fgsm-compare-item canvas { grid-area: plot; border-radius: 0.22rem; }
.comparison-tag { padding: 0.32rem 0.5rem; border-radius: 0.4rem; font-size: 0.62rem; font-weight: 850; letter-spacing: 0.08em; text-transform: uppercase; }
.comparison-tag.clean { background: var(--teal-soft); color: var(--teal); }
.comparison-tag.attack { background: var(--coral-soft); color: #9e402c; }
.comparison-tag.poison { background: var(--violet-soft); color: var(--violet); }
.compare-title strong { font-size: 0.82rem; }

.attack-sidebar {
  position: sticky;
  top: 1rem;
  max-height: calc(100vh - 2rem);
  padding: 0;
  overflow-x: hidden;
  overflow-y: auto;
  scrollbar-color: #b7c6c3 transparent;
  scrollbar-width: thin;
}

.sidebar-section { padding: 1rem 1.1rem; }
.sidebar-section + .sidebar-section { border-top: 1px solid var(--line); }
.sidebar-heading { margin-bottom: 0.85rem; }
.sidebar-heading h3 { margin: 0; font-size: 1rem; }
.sidebar-heading .card-label { margin-bottom: 0.18rem; }
.sidebar-subtitle { display: block; margin-top: 0.2rem; color: var(--muted); font-size: 0.64rem; }
.sidebar-controls .range-heading { margin-bottom: 0.7rem; }
.sidebar-controls .range-heading h3 { font-size: 1rem; }
.attack-sample-picker {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 0.65rem;
  margin-bottom: 0.8rem;
  padding: 0.55rem;
  border: 1px solid var(--line);
  border-radius: 0.6rem;
  background: #f7f8f5;
}
.attack-sample-picker div { display: grid; gap: 0.12rem; min-width: 0; }
.attack-sample-picker span { color: var(--muted); font-size: 0.58rem; font-weight: 800; letter-spacing: 0.07em; text-transform: uppercase; }
.attack-sample-picker strong { font-size: 0.78rem; line-height: 1.2; overflow-wrap: anywhere; }
.attack-sample-picker .button { padding: 0.48rem 0.58rem; font-size: 0.68rem; white-space: nowrap; }
.range-heading output { padding: 0.45rem 0.58rem; border-radius: 0.5rem; background: var(--coral-soft); color: #8f3c28; font-size: 0.78rem; font-weight: 800; }
input[type="range"] { width: 100%; accent-color: var(--coral); }
.range-scale { display: flex; justify-content: space-between; color: var(--muted); font-size: 0.65rem; }

.fgsm-response {
  margin-top: 0.85rem;
  padding: 0.75rem;
  border: 1px solid #e7b4a6;
  border-radius: 0.8rem;
  background: #fff9f6;
}

.fgsm-response-heading { display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; margin-bottom: 0.55rem; }
.fgsm-response-heading .card-label { margin: 0; color: #9e402c; }
.prediction-change { padding: 0.25rem 0.4rem; border-radius: 99px; background: #ecefeb; color: var(--muted); font-size: 0.56rem; font-weight: 850; letter-spacing: 0.05em; text-transform: uppercase; }
.prediction-change.changed { background: #f9d8cf; color: #8f3c28; }
.fgsm-prediction-shift { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); align-items: stretch; gap: 0.35rem; }

.fgsm-prediction {
  display: grid;
  align-content: center;
  min-width: 0;
  padding: 0.65rem 0.55rem;
  border: 1px solid var(--line);
  border-radius: 0.65rem;
  background: white;
}

.fgsm-prediction > span { color: var(--muted); font-size: 0.56rem; font-weight: 850; letter-spacing: 0.07em; text-transform: uppercase; }
.fgsm-prediction strong { margin-top: 0.15rem; font-family: Georgia, "Times New Roman", serif; font-size: 1.35rem; font-weight: 500; line-height: 1; overflow-wrap: anywhere; }
.fgsm-prediction small { margin-top: 0.28rem; color: var(--muted); font-size: 0.62rem; font-weight: 750; }
.fgsm-prediction.after { border-color: #e7a692; background: var(--coral-soft); }
.fgsm-prediction.after strong, .fgsm-prediction.after small { color: #8f3c28; }
.prediction-arrow { align-self: center; color: var(--coral); font-size: 1.1rem; font-weight: 900; }
.fgsm-response.updated .fgsm-prediction.after { animation: result-pop 280ms ease-out; }
@keyframes result-pop { 50% { transform: scale(1.035); box-shadow: 0 0 0 3px rgb(225 101 72 / 14%); } }
.volume-warning { margin: 0.7rem 0 0; color: #795047; font-size: 0.64rem; line-height: 1.45; }

.sidebar-metrics article {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 0.75rem;
  padding: 0.7rem 0;
}

.sidebar-metrics article + article { border-top: 1px solid var(--line); }
.sidebar-metrics span { color: var(--muted); font-size: 0.68rem; font-weight: 750; letter-spacing: 0.05em; text-transform: uppercase; }
.sidebar-metrics strong { max-width: 9rem; font-size: 0.88rem; text-align: right; overflow-wrap: anywhere; }

.poison-controls { margin-top: 0; }
.segmented-control { display: grid; grid-template-columns: 1fr 1fr; gap: 0.5rem; margin: 0 0 0.9rem; padding: 0; border: 0; }
.segmented-control legend { margin-bottom: 0.45rem; color: var(--muted); font-size: 0.77rem; font-weight: 700; }
.segmented-control label { position: relative; }
.segmented-control input { position: absolute; opacity: 0; }
.segmented-control span { display: block; padding: 0.52rem; border: 1px solid var(--line); border-radius: 0.55rem; text-align: center; cursor: pointer; }
.segmented-control input:checked + span { border-color: var(--violet); background: var(--violet-soft); color: var(--violet); font-weight: 800; }
.range-label { display: flex; justify-content: space-between; margin-bottom: 0.45rem; font-size: 0.8rem; font-weight: 700; }
.range-label output { color: var(--violet); }
.poison-controls input[type="range"] { accent-color: var(--violet); }
.poison-controls .button-row { gap: 0.45rem; margin-top: 0.75rem; }
.poison-controls .button { flex: 1 1 0; padding: 0.62rem 0.45rem; font-size: 0.76rem; }
#poison-use-current { width: 100%; line-height: 1.35; }
.poison-controls .inline-status { min-height: 0; margin: 0.65rem 0 0; font-size: 0.72rem; line-height: 1.45; }

.model-comparison { border: 1px solid var(--line); border-radius: 0.8rem; overflow: hidden; }
.model-comparison > div { display: grid; grid-template-columns: 1fr 1fr 1fr; }
.model-comparison span, .model-comparison strong { min-width: 0; padding: 0.9rem; border-right: 1px solid var(--line); overflow-wrap: anywhere; }
.model-comparison span:last-child { border-right: 0; }
.model-comparison > div + div { border-top: 1px solid var(--line); }
.comparison-header { background: #f0f1ed; color: var(--muted); font-size: 0.7rem; font-weight: 800; letter-spacing: 0.06em; text-transform: uppercase; }
.model-comparison [role="row"]:not(.comparison-header) { font-size: 0.82rem; }
.highlight-result { background: var(--violet-soft); color: #553b87; font-weight: 800; }

.attack-sidebar .model-comparison span,
.attack-sidebar .model-comparison strong { padding: 0.58rem 0.42rem; }
.attack-sidebar .comparison-header { font-size: 0.58rem; }
.attack-sidebar .model-comparison [role="row"]:not(.comparison-header) { font-size: 0.68rem; }

.sidebar-insight { border-top: 0 !important; }
.sidebar-insight .card-label { margin-bottom: 0.35rem; }
.sidebar-insight p:last-child { margin: 0; font-size: 0.76rem; line-height: 1.55; }
.coral-insight { background: var(--coral-soft); color: #653b32; }
.coral-insight .card-label { color: #9e402c; }
.violet-insight { background: var(--violet-soft); color: #4e4560; }
.violet-insight .card-label { color: var(--violet); }

.model-pipeline-card {
  margin: 1rem 0 2rem;
  padding: clamp(1.2rem, 3vw, 2rem);
  border: 1px solid #b9cce3;
  border-radius: 1.15rem;
  background: var(--card);
  box-shadow: var(--shadow);
}

.pipeline-heading {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  margin-bottom: 1.25rem;
}

.pipeline-heading h3 { margin: 0; font-size: 1.25rem; }
.pipeline-heading .card-label { margin-bottom: 0.2rem; color: var(--blue); }
.pipeline-heading > span { color: var(--muted); font-size: 0.75rem; font-weight: 750; }

.model-pipeline {
  display: flex;
  align-items: stretch;
  gap: 0.6rem;
}

.pipeline-stage {
  position: relative;
  flex: 1 1 0;
  min-width: 0;
  padding: 1rem;
  border: 1px solid var(--line);
  border-radius: 0.9rem;
  background: #f7f9f6;
}

.pipeline-stage-wide { flex-grow: 1.35; }
.pipeline-number { position: absolute; top: 0.65rem; right: 0.7rem; color: #8aa09d; font-size: 0.63rem; font-weight: 850; letter-spacing: 0.08em; }
.pipeline-visual { display: block; width: 100%; height: 4rem; margin-bottom: 0.8rem; }
.waveform-visual path { fill: none; stroke: var(--teal); stroke-width: 2.5; stroke-linejoin: round; }
.pipeline-label { margin: 0 0 0.2rem; color: var(--blue); font-size: 0.65rem; font-weight: 850; letter-spacing: 0.09em; text-transform: uppercase; }
.pipeline-stage h4 { margin: 0 0 0.4rem; font-size: 0.98rem; }
.pipeline-stage > p:last-child { margin: 0; color: var(--muted); font-size: 0.73rem; line-height: 1.5; }
.pipeline-stage code { color: #3e5e5a; font-size: 0.72rem; }

.pipeline-arrow { display: grid; flex: 0 0 1rem; place-items: center; color: #8aa09d; font-size: 1.3rem; }

.feature-stack {
  display: flex;
  height: 4rem;
  align-items: flex-end;
  justify-content: center;
  gap: 0.25rem;
  margin-bottom: 0.8rem;
}

.feature-stack span {
  display: grid;
  width: 2rem;
  place-items: center;
  border: 1px solid #9dbbd8;
  border-radius: 0.3rem 0.3rem 0 0;
  background: var(--blue-soft);
  color: #315d8f;
  font-size: 0.6rem;
  font-weight: 800;
}

.feature-stack span:nth-child(1) { height: 2.2rem; }
.feature-stack span:nth-child(2) { height: 2.55rem; }
.feature-stack span:nth-child(3) { height: 2.9rem; }
.feature-stack span:nth-child(4) { height: 3.25rem; }
.feature-stack span:nth-child(5) { height: 3.6rem; }
.feature-stack span:nth-child(6) { height: 4rem; }

.output-count {
  display: grid;
  width: 4rem;
  height: 4rem;
  margin: 0 auto 0.8rem;
  place-content: center;
  border: 1px solid #b9cce3;
  border-radius: 50%;
  background: var(--blue-soft);
  color: #214f87;
  text-align: center;
}

.output-count strong { font-family: Georgia, "Times New Roman", serif; font-size: 1.6rem; font-weight: 500; line-height: 1; }
.output-count span { font-size: 0.55rem; font-weight: 800; letter-spacing: 0.05em; text-transform: uppercase; }

.model-pipeline-card figcaption {
  margin-top: 1rem;
  padding-top: 0.85rem;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.55;
}

.run-section-intro {
  display: grid;
  grid-template-columns: minmax(260px, 0.8fr) minmax(320px, 1.2fr);
  align-items: end;
  gap: clamp(2rem, 8vw, 7rem);
  padding: 2.25rem 0 1.5rem;
}

.run-section-intro h2 { margin: 0; font-family: Georgia, "Times New Roman", serif; font-size: clamp(2rem, 4vw, 3.2rem); font-weight: 500; letter-spacing: -0.04em; line-height: 1; }
.run-section-intro > p { margin: 0; color: var(--muted); line-height: 1.65; }

.run-gallery { display: grid; gap: 1.25rem; }
.gallery-status { color: var(--muted); }

.run-card {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(260px, 0.9fr);
  gap: 1rem 1.5rem;
  padding: clamp(1.25rem, 3vw, 2rem);
  border: 1px solid var(--line);
  border-radius: 1.15rem;
  background: var(--card);
  box-shadow: var(--shadow);
}

.run-card header {
  display: flex;
  grid-column: 1;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
}

.run-card h3 {
  margin: 0.45rem 0 0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(1.55rem, 3vw, 2.15rem);
  font-weight: 500;
  letter-spacing: -0.035em;
}

.run-kind {
  display: inline-block;
  padding: 0.35rem 0.55rem;
  border-radius: 0.4rem;
  font-size: 0.65rem;
  font-weight: 850;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.run-kind.training { background: var(--teal-soft); color: var(--teal); }
.run-kind.evaluation { background: var(--blue-soft); color: var(--blue); }

.run-summary {
  grid-column: 1;
  margin: 0;
  color: var(--muted);
  line-height: 1.6;
}

.run-metrics {
  display: grid;
  grid-column: 1;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.65rem;
}

.run-metrics div {
  padding: 0.85rem;
  border: 1px solid var(--line);
  border-radius: 0.7rem;
  background: #f8f9f6;
}

.run-metrics span {
  display: block;
  margin-bottom: 0.25rem;
  color: var(--muted);
  font-size: 0.66rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.run-metrics strong { font-size: 1.15rem; font-variant-numeric: tabular-nums; }

.run-card figure {
  grid-column: 2;
  grid-row: 1 / span 3;
  margin: 0;
  align-self: center;
}

.run-card figure img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 0.75rem;
}

.run-note {
  grid-column: 1 / -1;
  margin: 0;
  padding-top: 0.9rem;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.79rem;
  line-height: 1.55;
}

footer { display: flex; justify-content: space-between; gap: 2rem; padding: 1.6rem 0 3rem; border-top: 1px solid var(--line); color: var(--muted); font-size: 0.82rem; }
footer p { margin: 0; }
footer a { color: var(--ink); font-weight: 700; }

@media (max-width: 920px) {
  .attack-lab { grid-template-columns: 1fr; }
  .attack-sidebar {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    position: static;
    order: -1;
    max-height: none;
    overflow: visible;
  }
  .attack-sidebar .sidebar-section + .sidebar-section {
    border-top: 0;
    border-left: 1px solid var(--line);
  }
}

@media (max-width: 720px) {
  .attack-sidebar { display: block; }
  .attack-sidebar .sidebar-section + .sidebar-section {
    border-top: 1px solid var(--line);
    border-left: 0;
  }
  .attack-sidebar .sidebar-insight { border-top: 0; }
  .audio-compare-card {
    grid-template-columns: 1fr;
    grid-template-areas: "title" "player" "plot";
  }
  .fgsm-compare-item {
    grid-template-columns: 1fr;
    grid-template-areas: "title" "player" "plot";
  }
}

@media (max-width: 800px) {
  .site-header { padding-top: 2.7rem; }
  .section-intro, .two-column, .visual-grid, .run-section-intro { grid-template-columns: 1fr; }
  .section-intro { gap: 1.5rem; }
  .command-guide { grid-template-columns: 1fr; }
  .command-guide > p { grid-column: 1; }
  .tabs button { flex-direction: column; gap: 0.25rem; padding: 0.7rem 0.3rem; font-size: 0.78rem; }
  .run-card { grid-template-columns: 1fr; }
  .run-card header, .run-card .run-summary, .run-card .run-metrics, .run-card figure, .run-card .run-note {
    grid-column: 1;
  }
  .run-card figure { grid-row: auto; }
  .model-pipeline { flex-direction: column; }
  .pipeline-arrow { min-height: 1rem; transform: rotate(90deg); }
  footer { flex-direction: column; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}
