*, *::before, *::after { box-sizing: border-box; }

:root {
  --bg: #0d0f14;
  --surface: #161b25;
  --surface2: #1e2535;
  --surface3: #101722;
  --border: #2a3347;
  --border-strong: #41506c;
  --accent: #4f8ef7;
  --accent-dim: #2d5bbf;
  --cyan: #52d4ff;
  --green: #3ecf8e;
  --amber: #f7b84f;
  --red: #f75f5f;
  --violet: #8aa2ff;
  --text: #e2e8f0;
  --text-dim: #8b97ab;
  --shadow: 0 24px 80px rgba(3, 8, 18, 0.4);
  --font-mono: "JetBrains Mono", "Fira Code", "Cascadia Code", monospace;
}

body.edu-page {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--bg);
}

body.edu-page a {
  color: var(--accent);
  text-decoration: none;
}

body.edu-page a:hover {
  text-decoration: underline;
}

.page-shell.edu-shell {
  width: 100%;
  max-width: 1240px;
  margin: 0 auto;
  align-items: stretch;
  gap: 1.5rem;
}

.edu-hero {
  position: relative;
  width: 100%;
  overflow: hidden;
  border: 1px solid rgba(65, 80, 108, 0.58);
  border-radius: 24px;
  background:
    radial-gradient(circle at 20% 18%, rgba(79, 142, 247, 0.2), transparent 32%),
    radial-gradient(circle at 82% 24%, rgba(62, 207, 142, 0.16), transparent 26%),
    linear-gradient(180deg, rgba(14, 19, 29, 0.92) 0%, rgba(12, 16, 24, 0.9) 100%);
  box-shadow: var(--shadow);
  isolation: isolate;
}

.edu-hero::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(90deg, rgba(255, 255, 255, 0.02) 1px, transparent 1px),
    linear-gradient(rgba(255, 255, 255, 0.015) 1px, transparent 1px);
  background-size: 44px 44px;
  opacity: 0.34;
}

.edu-hero--frequency::after,
.edu-hero--enigma::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(180deg, rgba(6, 10, 18, 0.08) 0%, rgba(6, 10, 18, 0.62) 100%);
}

.hero-background-bars,
.hero-background-signals {
  position: absolute;
  inset: 0;
  z-index: 0;
  opacity: 0.88;
}

.hero-background-bars svg,
.hero-background-signals canvas {
  width: 100%;
  height: 100%;
  display: block;
}

.hero-body {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(280px, 0.85fr);
  gap: 1.5rem;
  padding: 2.25rem;
  align-items: center;
}

.hero-copy h1 {
  margin: 0;
  font-size: clamp(2rem, 5vw, 3.45rem);
  line-height: 1.02;
  letter-spacing: -0.04em;
}

.hero-copy p {
  margin: 0.95rem 0 0;
  max-width: 60ch;
  color: #c0cad9;
  font-size: 1rem;
  line-height: 1.72;
}

.hero-kicker {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.42rem 0.8rem;
  border: 1px solid rgba(82, 212, 255, 0.24);
  border-radius: 999px;
  background: rgba(16, 23, 34, 0.75);
  color: #a6d5ff;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-weight: 700;
}

.hero-copy h1.hero-title-frequency {
  background: linear-gradient(135deg, #75b1ff 0%, #8dc8ff 38%, #6ef0c7 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hero-copy h1.hero-title-enigma {
  background: linear-gradient(135deg, #efd486 0%, #d6a944 45%, #8ce8ff 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hero-copy h1.hero-title-cryptlab {
  background: linear-gradient(135deg, #75b1ff 0%, #6ef0c7 48%, #8aa2ff 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hero-copy h1.hero-title-challenges {
  background: linear-gradient(135deg, #f7b84f 0%, #f75f8f 42%, #8fd0ff 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.edu-hero--cryptlab::after,
.edu-hero--challenges::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(180deg, rgba(6, 10, 18, 0.08) 0%, rgba(6, 10, 18, 0.62) 100%);
}

.hero-actions {
  display: flex;
  gap: 0.8rem;
  flex-wrap: wrap;
  margin-top: 1.35rem;
}

.btn-primary,
.btn-secondary,
.btn-chip,
.toggle-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  border-radius: 10px;
  border: 1px solid transparent;
  cursor: pointer;
  font-weight: 700;
  transition: transform 0.15s ease, box-shadow 0.2s ease, border-color 0.2s ease, background 0.2s ease, color 0.2s ease;
}

.btn-primary:hover,
.btn-secondary:hover,
.btn-chip:hover,
.toggle-chip:hover {
  text-decoration: none;
  transform: translateY(-1px);
}

.btn-primary {
  padding: 0.88rem 1.25rem;
  color: #eef6ff;
  text-shadow: 0 1px 0 rgba(8, 16, 28, 0.18);
  background: linear-gradient(180deg, #7cc2ff 0%, #4f8ef7 100%);
  box-shadow: 0 12px 34px rgba(79, 142, 247, 0.28);
}

.btn-primary.btn-brass {
  color: #1d1607;
  text-shadow: none;
  background: linear-gradient(180deg, #f4da91 0%, #c99728 100%);
  box-shadow: 0 12px 34px rgba(201, 151, 40, 0.24);
}

body.edu-page a.btn-primary {
  color: #eef6ff;
}

body.edu-page a.btn-primary.btn-brass {
  color: #1d1607;
}

.btn-secondary {
  padding: 0.88rem 1.25rem;
  color: var(--text);
  background: rgba(17, 24, 39, 0.82);
  border-color: rgba(65, 80, 108, 0.58);
}

body.edu-page a.btn-secondary {
  color: var(--text);
}

.btn-chip,
.toggle-chip {
  padding: 0.55rem 0.82rem;
  color: var(--text-dim);
  background: rgba(16, 23, 34, 0.78);
  border-color: rgba(65, 80, 108, 0.42);
  font-size: 0.82rem;
}

.btn-chip.active,
.toggle-chip.active {
  color: #eef6ff;
  background: rgba(79, 142, 247, 0.18);
  border-color: rgba(79, 142, 247, 0.48);
  box-shadow: 0 0 18px rgba(79, 142, 247, 0.18);
}

.hero-side {
  display: grid;
  gap: 0.8rem;
}

.hero-side-card,
.summary-card,
.edu-card,
.tool-card {
  border: 1px solid rgba(65, 80, 108, 0.58);
  border-radius: 18px;
  background: rgba(14, 20, 31, 0.82);
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.26);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.hero-side-card {
  padding: 1rem 1.05rem;
}

.hero-side-card h2,
.summary-card h2,
.edu-card h2,
.tool-card h2,
.section-heading h2 {
  margin: 0;
  font-size: 1.3rem;
  letter-spacing: -0.02em;
}

.hero-side-card p,
.summary-card p,
.edu-card p,
.tool-card p {
  color: var(--text-dim);
  line-height: 1.65;
}

.metric-strip,
.badge-strip,
.insight-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
}

.metric-pill,
.badge-pill,
.insight-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.42rem;
  padding: 0.48rem 0.72rem;
  border-radius: 999px;
  border: 1px solid rgba(65, 80, 108, 0.44);
  background: rgba(15, 20, 30, 0.82);
  font-family: var(--font-mono);
  font-size: 0.76rem;
  color: #c6d1e3;
}

.metric-pill strong,
.badge-pill strong,
.insight-pill strong {
  color: #f8fbff;
}

.page-intro-grid,
.card-grid,
.cta-grid,
.comparison-grid {
  display: grid;
  gap: 1rem;
}

.page-intro-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  width: 100%;
}

.card-grid.two-col {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.card-grid.three-col,
.cta-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.comparison-grid {
  grid-template-columns: 1.1fr 0.9fr;
}

.section-shell {
  width: 100%;
  margin-left: auto;
  margin-right: auto;
}

.enigma-wrap .section-shell {
  max-width: 1180px;
  margin-top: 1.5rem;
}

.section-heading {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 1rem;
  margin-bottom: 0.95rem;
}

.section-heading p {
  max-width: 66ch;
  margin: 0;
  color: var(--text-dim);
  line-height: 1.68;
}

.edu-card,
.tool-card,
.summary-card {
  padding: 1.15rem 1.2rem;
}

.summary-card h3,
.edu-card h3,
.tool-card h3 {
  margin: 0 0 0.55rem;
  color: #eef5ff;
  font-size: 1rem;
  letter-spacing: -0.01em;
}

.hero-side-card .eyebrow,
.summary-card .eyebrow,
.edu-card .eyebrow,
.tool-card .eyebrow,
.counter-card .eyebrow {
  display: inline-block;
  margin-bottom: 0.58rem;
  color: #9bc7ff;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 0.74rem;
  font-weight: 700;
}

.summary-card ul,
.edu-card ul,
.tool-card ul {
  margin: 0.75rem 0 0;
  padding-left: 1.15rem;
  color: var(--text-dim);
}

.summary-card li,
.edu-card li,
.tool-card li {
  margin-bottom: 0.4rem;
}

.tool-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(280px, 0.85fr);
  gap: 1rem;
}

.analysis-input,
.ciphertext-input,
.answer-input,
.guess-input,
.crib-input {
  width: 100%;
  min-height: 164px;
  padding: 0.95rem 1rem;
  border-radius: 14px;
  border: 1px solid rgba(65, 80, 108, 0.65);
  background: rgba(17, 24, 39, 0.92);
  color: var(--text);
  font-family: var(--font-mono);
  line-height: 1.62;
  resize: vertical;
  outline: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.analysis-input:focus,
.ciphertext-input:focus,
.answer-input:focus,
.guess-input:focus,
.crib-input:focus,
.small-input:focus,
.select-input:focus {
  border-color: rgba(79, 142, 247, 0.88);
  box-shadow: 0 0 0 3px rgba(79, 142, 247, 0.12);
}

.small-input,
.select-input {
  width: 100%;
  min-height: 44px;
  padding: 0.72rem 0.9rem;
  border-radius: 12px;
  border: 1px solid rgba(65, 80, 108, 0.65);
  background: rgba(17, 24, 39, 0.92);
  color: var(--text);
  font-family: inherit;
  font-size: 0.95rem;
  outline: none;
}

.field-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.8rem;
}

.field-label {
  display: block;
  margin-bottom: 0.42rem;
  color: #9fb3ca;
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.helper-copy,
.small-copy,
.muted-copy {
  color: var(--text-dim);
  font-size: 0.88rem;
  line-height: 1.62;
}

.small-copy {
  font-size: 0.8rem;
}

.chart-card {
  padding: 1.05rem;
  border-radius: 18px;
  border: 1px solid rgba(65, 80, 108, 0.58);
  background: rgba(12, 18, 29, 0.82);
}

.chart-legend {
  display: flex;
  gap: 0.9rem;
  flex-wrap: wrap;
  margin: 0.7rem 0 0;
}

.legend-item {
  display: inline-flex;
  align-items: center;
  gap: 0.42rem;
  color: var(--text-dim);
  font-size: 0.82rem;
}

.legend-swatch {
  width: 12px;
  height: 12px;
  border-radius: 999px;
}

.legend-swatch.actual { background: linear-gradient(180deg, #8fd0ff 0%, #4f8ef7 100%); }
.legend-swatch.english { background: rgba(62, 207, 142, 0.88); }
.legend-swatch.suspect { background: rgba(247, 184, 79, 0.88); }

.histogram-wrap {
  border-radius: 16px;
  border: 1px solid rgba(65, 80, 108, 0.42);
  background: linear-gradient(180deg, rgba(10, 16, 26, 0.94) 0%, rgba(12, 19, 30, 0.76) 100%);
  overflow: hidden;
}

.histogram-svg {
  width: 100%;
  height: auto;
  display: block;
}

.axis-label {
  fill: #9fb3ca;
  font-family: var(--font-mono);
  font-size: 12px;
}

.axis-grid {
  stroke: rgba(143, 155, 179, 0.12);
  stroke-width: 1;
}

.freq-bar-expected,
.freq-bar-actual {
  transition: opacity 0.2s ease;
}

.freq-bar-expected {
  fill: rgba(62, 207, 142, 0.74);
}

.freq-bar-actual {
  fill: url(#freqActualGradient);
  filter: drop-shadow(0 0 10px rgba(79, 142, 247, 0.28));
}

.freq-bar-actual.highlighted {
  fill: rgba(247, 184, 79, 0.94);
  filter: drop-shadow(0 0 14px rgba(247, 184, 79, 0.35));
}

.freq-value-label {
  fill: #d6e0f3;
  font-family: var(--font-mono);
  font-size: 10px;
  opacity: 0.86;
}

.live-stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.75rem;
}

.stat-box {
  padding: 0.9rem 0.95rem;
  border-radius: 14px;
  border: 1px solid rgba(65, 80, 108, 0.44);
  background: rgba(10, 16, 24, 0.7);
}

.stat-box .label {
  display: block;
  color: var(--text-dim);
  font-size: 0.74rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 0.35rem;
}

.stat-box strong {
  display: block;
  font-size: 1.18rem;
  letter-spacing: -0.02em;
}

.mapping-grid,
.analysis-list,
.attempt-grid,
.mistake-grid,
.counter-grid,
.crib-summary-grid {
  display: grid;
  gap: 0.75rem;
}

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

.mapping-card,
.analysis-item,
.attempt-card,
.mistake-card,
.counter-card,
.crib-summary-card {
  padding: 0.9rem;
  border-radius: 14px;
  border: 1px solid rgba(65, 80, 108, 0.44);
  background: rgba(10, 16, 24, 0.72);
}

.mapping-card strong,
.analysis-item strong,
.attempt-card strong,
.mistake-card strong,
.counter-card strong,
.crib-summary-card strong {
  color: #f7fbff;
}

.candidate-map {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  justify-content: space-between;
  font-family: var(--font-mono);
}

.candidate-map .cipher-letter {
  font-size: 1.15rem;
  color: #8fd0ff;
}

.candidate-map .plain-letter {
  font-size: 1.15rem;
  color: #b8ffd6;
}

.candidate-reason {
  margin-top: 0.45rem;
  color: var(--text-dim);
  font-size: 0.84rem;
  line-height: 1.58;
}

.etaoin-row {
  display: flex;
  gap: 0.45rem;
  flex-wrap: wrap;
}

.etaoin-row span {
  min-width: 38px;
  padding: 0.4rem 0.55rem;
  border-radius: 10px;
  background: rgba(79, 142, 247, 0.1);
  border: 1px solid rgba(79, 142, 247, 0.28);
  color: #d8e7ff;
  text-align: center;
  font-family: var(--font-mono);
  font-size: 0.82rem;
}

.attempt-grid {
  grid-template-columns: repeat(5, minmax(0, 1fr));
  max-height: 420px;
  overflow: auto;
  padding-right: 0.2rem;
}

.attempt-card {
  cursor: pointer;
  transition: transform 0.14s ease, border-color 0.18s ease, box-shadow 0.18s ease;
}

.attempt-card:hover {
  transform: translateY(-1px);
}

.attempt-card.selected {
  border-color: rgba(79, 142, 247, 0.62);
  box-shadow: 0 0 18px rgba(79, 142, 247, 0.18);
}

.attempt-card.best {
  border-color: rgba(62, 207, 142, 0.6);
  box-shadow: 0 0 18px rgba(62, 207, 142, 0.16);
}

.attempt-meta {
  display: flex;
  justify-content: space-between;
  gap: 0.4rem;
  margin-bottom: 0.45rem;
  font-family: var(--font-mono);
  font-size: 0.74rem;
  color: #dbe7f7;
}

.attempt-preview {
  color: var(--text-dim);
  font-size: 0.82rem;
  line-height: 1.56;
  word-break: break-word;
}

.mono-analysis-grid {
  display: grid;
  grid-template-columns: 1.05fr 0.95fr;
  gap: 1rem;
}

.ngram-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 0.4rem;
}

.ngram-table th,
.ngram-table td {
  padding: 0.54rem 0.3rem;
  border-bottom: 1px solid rgba(65, 80, 108, 0.24);
  font-family: var(--font-mono);
  font-size: 0.8rem;
  text-align: left;
}

.ngram-table th {
  color: #9fb3ca;
  text-transform: uppercase;
  font-size: 0.72rem;
  letter-spacing: 0.08em;
}

.pattern-row {
  display: flex;
  justify-content: space-between;
  gap: 0.8rem;
  padding: 0.56rem 0;
  border-bottom: 1px solid rgba(65, 80, 108, 0.24);
  font-family: var(--font-mono);
  font-size: 0.82rem;
}

.pattern-row span:last-child {
  color: var(--text-dim);
}

.formula-card {
  position: relative;
  overflow: hidden;
}

.formula-box {
  padding: 0.95rem 1rem;
  border-radius: 14px;
  border: 1px solid rgba(79, 142, 247, 0.28);
  background: linear-gradient(180deg, rgba(79, 142, 247, 0.08) 0%, rgba(17, 24, 39, 0.88) 100%);
  font-family: var(--font-mono);
  color: #eef6ff;
  font-size: 0.95rem;
  overflow-x: auto;
}

.formula-note {
  margin-top: 0.75rem;
  color: var(--text-dim);
  font-size: 0.84rem;
}

.leakage-diagram {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.8rem;
}

.leakage-node {
  position: relative;
  padding: 0.9rem 0.85rem;
  border-radius: 14px;
  border: 1px solid rgba(65, 80, 108, 0.44);
  background: rgba(10, 16, 24, 0.76);
}

.leakage-node::after {
  content: "";
  position: absolute;
  right: -0.55rem;
  top: 50%;
  width: 0.9rem;
  height: 2px;
  background: linear-gradient(90deg, rgba(79, 142, 247, 0.15), rgba(79, 142, 247, 0.8));
}

.leakage-node:last-child::after {
  display: none;
}

.history-panel {
  display: grid;
  grid-template-columns: 0.95fr 1.05fr;
  gap: 1rem;
}

.history-quote {
  padding: 1rem;
  border-radius: 16px;
  border: 1px solid rgba(65, 80, 108, 0.44);
  background:
    radial-gradient(circle at top right, rgba(79, 142, 247, 0.16), transparent 30%),
    rgba(10, 16, 24, 0.84);
}

.history-quote blockquote {
  margin: 0;
  color: #dbe6f8;
  line-height: 1.72;
}

.history-quote footer {
  margin-top: 0.8rem;
  color: var(--text-dim);
  font-size: 0.84rem;
}

.challenge-output,
.crib-output,
.attack-output,
.status-output,
.timeline-output {
  min-height: 56px;
  padding: 0.82rem 0.9rem;
  border-radius: 14px;
  border: 1px solid rgba(65, 80, 108, 0.42);
  background: rgba(10, 16, 24, 0.74);
  color: #d6e0f3;
  line-height: 1.6;
}

.challenge-cipher {
  padding: 1rem;
  border-radius: 16px;
  border: 1px solid rgba(65, 80, 108, 0.58);
  background: rgba(8, 14, 22, 0.92);
  color: #f0f7ff;
  font-family: var(--font-mono);
  line-height: 1.7;
  word-break: break-word;
}

.challenge-actions,
.toolbar-row,
.crib-toolbar,
.attack-toolbar,
.timeline-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.7rem;
  margin-top: 0.85rem;
}

.link-card {
  position: relative;
  display: block;
  padding: 1rem;
  border-radius: 18px;
  border: 1px solid rgba(65, 80, 108, 0.48);
  background:
    radial-gradient(circle at top right, rgba(79, 142, 247, 0.18), transparent 34%),
    rgba(11, 17, 27, 0.84);
  color: inherit;
  min-height: 150px;
  transition: transform 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
}

.link-card:hover {
  text-decoration: none;
  transform: translateY(-2px);
  border-color: rgba(79, 142, 247, 0.58);
  box-shadow: 0 18px 36px rgba(7, 16, 30, 0.35);
}

.link-card h3 {
  margin: 0 0 0.45rem;
  color: #f3f8ff;
}

.link-card p {
  margin: 0;
  color: var(--text-dim);
  line-height: 1.65;
}

.link-card .link-arrow {
  position: absolute;
  right: 1rem;
  bottom: 0.95rem;
  color: #b5d3ff;
  font-size: 1.1rem;
}

.signal-counter {
  display: block;
  width: 100%;
  min-width: 0;
  font-family: var(--font-mono);
  font-size: clamp(1.25rem, 3vw, 2.1rem);
  color: #fff8e7;
  letter-spacing: -0.05em;
  line-height: 1.02;
  white-space: nowrap;
  font-variant-numeric: tabular-nums lining-nums;
}

.signal-counter.is-long {
  font-size: clamp(1.1rem, 2.25vw, 1.6rem);
  letter-spacing: -0.06em;
}

.signal-counter.is-huge {
  font-size: clamp(1rem, 2vw, 1.42rem);
  letter-spacing: -0.07em;
}

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

.counter-card .counter-label {
  display: block;
  margin-top: 0.35rem;
  color: var(--text-dim);
  font-size: 0.8rem;
  line-height: 1.56;
}

.counter-card .eyebrow {
  color: #e7d398;
}

.confidence-meter {
  margin-top: 0.8rem;
}

.meter-track {
  position: relative;
  width: 100%;
  height: 12px;
  border-radius: 999px;
  background: rgba(65, 80, 108, 0.24);
  overflow: hidden;
}

.meter-fill {
  position: absolute;
  inset: 0 auto 0 0;
  width: 0;
  border-radius: inherit;
  background: linear-gradient(90deg, #c99728 0%, #e4c56d 48%, #5fd6ff 100%);
  transition: width 0.5s ease;
}

.meter-labels {
  margin-top: 0.42rem;
  display: flex;
  justify-content: space-between;
  gap: 0.5rem;
  font-size: 0.78rem;
  color: var(--text-dim);
}

.attack-flow-card {
  overflow: hidden;
}

.attack-flow {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.8rem;
  align-items: stretch;
}

.attack-node {
  position: relative;
  padding: 0.95rem;
  border-radius: 16px;
  border: 1px solid rgba(65, 80, 108, 0.44);
  background: rgba(10, 16, 24, 0.72);
  transition: border-color 0.25s ease, box-shadow 0.25s ease, background 0.25s ease;
}

.attack-node .node-title {
  display: block;
  margin-bottom: 0.35rem;
  color: #eef5ff;
  font-size: 0.94rem;
  font-weight: 700;
}

.attack-node .node-body {
  color: var(--text-dim);
  font-size: 0.84rem;
  line-height: 1.58;
}

.attack-node .node-value {
  display: block;
  margin-top: 0.7rem;
  font-family: var(--font-mono);
  font-size: 1rem;
  color: #cce3ff;
}

.attack-node.active {
  border-color: rgba(79, 142, 247, 0.7);
  background: rgba(79, 142, 247, 0.12);
  box-shadow: 0 0 22px rgba(79, 142, 247, 0.16);
}

.attack-node.complete {
  border-color: rgba(62, 207, 142, 0.55);
}

.attack-node.stop {
  border-color: rgba(201, 151, 40, 0.6);
  box-shadow: 0 0 24px rgba(201, 151, 40, 0.16);
}

.crib-matrix {
  display: grid;
  gap: 0.65rem;
  margin-top: 0.9rem;
}

.crib-row {
  display: grid;
  grid-template-columns: 96px minmax(0, 1fr);
  gap: 0.8rem;
  padding: 0.72rem 0.85rem;
  border-radius: 14px;
  border: 1px solid rgba(65, 80, 108, 0.38);
  background: rgba(10, 16, 24, 0.66);
}

.crib-row.is-possible {
  border-color: rgba(62, 207, 142, 0.48);
}

.crib-row.is-impossible {
  border-color: rgba(247, 95, 95, 0.44);
}

.crib-row-label {
  color: #dce8fb;
  font-family: var(--font-mono);
  font-size: 0.8rem;
}

.crib-row-letters {
  display: flex;
  flex-wrap: wrap;
  gap: 0.28rem;
}

.crib-char {
  min-width: 28px;
  padding: 0.3rem 0.35rem;
  border-radius: 8px;
  border: 1px solid rgba(65, 80, 108, 0.28);
  background: rgba(17, 24, 39, 0.78);
  color: #e5eefc;
  font-family: var(--font-mono);
  font-size: 0.82rem;
  text-align: center;
}

.crib-char.clash {
  border-color: rgba(247, 95, 95, 0.6);
  background: rgba(247, 95, 95, 0.12);
  color: #ffd1d1;
}

.crib-char.linked {
  border-color: rgba(79, 142, 247, 0.52);
  background: rgba(79, 142, 247, 0.12);
}

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

.relay-rack {
  position: relative;
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 0.7rem;
}

.relay-column {
  padding: 0.8rem 0.6rem;
  border-radius: 16px;
  border: 1px solid rgba(65, 80, 108, 0.34);
  background: linear-gradient(180deg, rgba(17, 24, 39, 0.92) 0%, rgba(10, 16, 24, 0.72) 100%);
}

.relay-column .relay-title {
  display: block;
  margin-bottom: 0.55rem;
  color: #a9bdd6;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.relay-stack {
  display: grid;
  gap: 0.42rem;
}

.relay-node {
  height: 18px;
  border-radius: 999px;
  background: rgba(65, 80, 108, 0.28);
  border: 1px solid rgba(65, 80, 108, 0.34);
  transition: background 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}

.relay-node.testing {
  background: rgba(79, 142, 247, 0.26);
  border-color: rgba(79, 142, 247, 0.52);
  box-shadow: 0 0 16px rgba(79, 142, 247, 0.18);
}

.relay-node.fail {
  background: rgba(247, 95, 95, 0.18);
  border-color: rgba(247, 95, 95, 0.4);
}

.relay-node.stop {
  background: rgba(62, 207, 142, 0.22);
  border-color: rgba(62, 207, 142, 0.52);
  box-shadow: 0 0 20px rgba(62, 207, 142, 0.18);
}

.mistake-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin-bottom: 0.85rem;
}

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

.timeline-wrap {
  position: relative;
}

.timeline-track {
  position: absolute;
  top: 0.5rem;
  left: 24px;
  bottom: 0.5rem;
  width: 2px;
  background: rgba(65, 80, 108, 0.28);
}

.timeline-fill {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 0;
  background: linear-gradient(180deg, rgba(201, 151, 40, 0.88) 0%, rgba(94, 234, 212, 0.88) 100%);
  transition: height 0.45s ease;
}

.timeline-list {
  position: relative;
  display: grid;
  gap: 0.9rem;
}

.timeline-item {
  position: relative;
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr);
  gap: 0.9rem;
  align-items: start;
  cursor: pointer;
}

.timeline-dot {
  position: relative;
  z-index: 1;
  width: 18px;
  height: 18px;
  margin: 0.28rem auto 0;
  border-radius: 50%;
  border: 2px solid rgba(65, 80, 108, 0.6);
  background: rgba(17, 24, 39, 0.92);
  transition: background 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}

.timeline-item.active .timeline-dot {
  background: rgba(201, 151, 40, 0.9);
  border-color: rgba(201, 151, 40, 0.95);
  box-shadow: 0 0 18px rgba(201, 151, 40, 0.26);
}

.timeline-item-card {
  padding: 0.92rem 0.95rem;
  border-radius: 14px;
  border: 1px solid rgba(65, 80, 108, 0.4);
  background: rgba(10, 16, 24, 0.7);
  transition: border-color 0.2s ease, background 0.2s ease;
}

.timeline-item.active .timeline-item-card {
  border-color: rgba(201, 151, 40, 0.56);
  background: rgba(201, 151, 40, 0.1);
}

.timeline-year {
  display: inline-block;
  margin-bottom: 0.35rem;
  color: #e7d398;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  letter-spacing: 0.08em;
}

.comparison-table {
  width: 100%;
  border-collapse: collapse;
  overflow: hidden;
}

.comparison-table th,
.comparison-table td {
  padding: 0.78rem 0.65rem;
  border-bottom: 1px solid rgba(65, 80, 108, 0.24);
  text-align: left;
  vertical-align: top;
}

.comparison-table th {
  color: #dfe9fb;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.comparison-table td {
  color: var(--text-dim);
  line-height: 1.6;
}

.comparison-table td strong {
  color: #edf5ff;
}

.site-footer-nav {
  margin-top: 0.4rem;
  max-width: 980px;
  margin-left: auto;
  margin-right: auto;
}

.footer-contact {
  max-width: 980px;
  width: 100%;
  margin-left: auto;
  margin-right: auto;
}

.ad-container {
  width: 100%;
  max-width: 980px;
  margin: 0 auto;
}

.privacy-note {
  width: 100%;
  max-width: 980px;
  margin-left: auto;
  margin-right: auto;
}

.nav-current {
  color: #eef7ff !important;
  background: rgba(79, 142, 247, 0.16);
  border: 1px solid rgba(79, 142, 247, 0.34);
}

.edu-hero--about::after {
  background: linear-gradient(180deg, rgba(6, 10, 18, 0.08) 0%, rgba(6, 10, 18, 0.62) 100%);
}

.philosophy-list {
  margin: 0;
  padding-left: 1.2rem;
  color: var(--text-dim);
  line-height: 1.72;
  font-size: 0.95rem;
}

.philosophy-list li {
  margin-bottom: 0.55rem;
}

.philosophy-list strong {
  color: #eef5ff;
}

.contact-line {
  margin: 0;
  font-size: 1.05rem;
}

.contact-line a {
  font-weight: 600;
}

.status-good { color: var(--green); }
.status-warn { color: var(--amber); }
.status-bad { color: var(--red); }

@media (max-width: 1100px) {
  .hero-body,
  .tool-layout,
  .history-panel,
  .mono-analysis-grid,
  .comparison-grid {
    grid-template-columns: 1fr;
  }

  .page-intro-grid,
  .card-grid.three-col,
  .cta-grid,
  .counter-grid,
  .attack-flow {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

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

@media (max-width: 780px) {
  .page-shell.edu-shell {
    gap: 1rem;
  }

  .edu-hero {
    border-radius: 20px;
  }

  .hero-body {
    padding: 1.4rem;
  }

  .section-heading {
    flex-direction: column;
    align-items: start;
  }

  .page-intro-grid,
  .card-grid.two-col,
  .card-grid.three-col,
  .comparison-grid,
  .mapping-grid,
  .mistake-grid,
  .live-stats,
  .leakage-diagram,
  .counter-grid,
  .crib-summary-grid,
  .attack-flow {
    grid-template-columns: 1fr;
  }

  .attempt-grid {
    grid-template-columns: 1fr 1fr;
  }

  .field-grid {
    grid-template-columns: 1fr;
  }

  .crib-row {
    grid-template-columns: 1fr;
  }

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

.kasiski-viz-wrap {
  padding: 1rem;
  border-radius: 16px;
  border: 1px solid rgba(65, 80, 108, 0.44);
  background: rgba(10, 16, 24, 0.72);
}

.kasiski-groups {
  display: grid;
  gap: 1rem;
}

.kasiski-group {
  padding: 0.85rem;
  border-radius: 14px;
  border: 1px solid rgba(65, 80, 108, 0.34);
  background: rgba(8, 14, 22, 0.82);
}

.kasiski-seq {
  margin-bottom: 0.55rem;
  font-family: var(--font-mono);
  color: #d8e7ff;
}

.kasiski-svg {
  width: 100%;
  height: auto;
  min-height: 72px;
}

.kasiski-dot {
  fill: rgba(79, 142, 247, 0.92);
}

.kasiski-line {
  stroke: rgba(247, 184, 79, 0.72);
  stroke-width: 2;
  stroke-dasharray: 4 4;
}

.kasiski-pos-label,
.kasiski-dist-label {
  fill: #9fb3ca;
  font-family: var(--font-mono);
  font-size: 10px;
}

.kasiski-dist-label {
  fill: #f7b84f;
}

.ident-scores {
  display: grid;
  gap: 0.85rem;
}

.ident-row {
  padding: 0.9rem;
  border-radius: 14px;
  border: 1px solid rgba(65, 80, 108, 0.44);
  background: rgba(10, 16, 24, 0.72);
}

.ident-head {
  display: flex;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.45rem;
}

.ident-head strong {
  color: #eef5ff;
}

.ident-head span {
  font-family: var(--font-mono);
  color: #b5d3ff;
  font-size: 0.88rem;
}

.ngram-table tr.ngram-match td {
  color: var(--green);
}

.challenge-grid {
  display: grid;
  gap: 1rem;
}

.challenge-card {
  padding: 1.15rem 1.2rem;
  border-radius: 18px;
  border: 1px solid rgba(65, 80, 108, 0.58);
  background: rgba(14, 20, 31, 0.82);
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.26);
  transition: border-color 0.25s ease, box-shadow 0.25s ease;
}

.challenge-card.is-solved {
  border-color: rgba(62, 207, 142, 0.52);
  box-shadow: 0 0 22px rgba(62, 207, 142, 0.12);
}

.challenge-card.success-burst {
  animation: challengePulse 0.55s ease;
}

@keyframes challengePulse {
  0% { transform: scale(1); }
  45% { transform: scale(1.01); box-shadow: 0 0 28px rgba(62, 207, 142, 0.28); }
  100% { transform: scale(1); }
}

.challenge-card-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.65rem;
  margin-bottom: 0.75rem;
}

.challenge-card-head h3 {
  margin: 0;
  flex: 1 1 auto;
  color: #f3f8ff;
  font-size: 1.05rem;
}

.challenge-cipher-type {
  font-family: var(--font-mono);
  font-size: 0.76rem;
  color: #9bc7ff;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.difficulty-badge {
  display: inline-flex;
  padding: 0.35rem 0.62rem;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  border: 1px solid transparent;
}

.difficulty-beginner {
  color: #b8ffd6;
  background: rgba(62, 207, 142, 0.12);
  border-color: rgba(62, 207, 142, 0.38);
}

.difficulty-intermediate {
  color: #d8e7ff;
  background: rgba(79, 142, 247, 0.12);
  border-color: rgba(79, 142, 247, 0.38);
}

.difficulty-advanced {
  color: #ffe7b8;
  background: rgba(247, 184, 79, 0.12);
  border-color: rgba(247, 184, 79, 0.38);
}

.difficulty-expert {
  color: #ffd1d1;
  background: rgba(247, 95, 95, 0.12);
  border-color: rgba(247, 95, 95, 0.38);
}

.challenge-setup {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem 1rem;
  margin-bottom: 0.75rem;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--text-dim);
}

.challenge-guess {
  min-height: 48px;
  margin-top: 0.55rem;
}

.challenge-solution {
  margin-top: 0.85rem;
  padding: 0.9rem;
  border-radius: 14px;
  border: 1px solid rgba(65, 80, 108, 0.42);
  background: rgba(8, 14, 22, 0.88);
  color: var(--text-dim);
  line-height: 1.65;
}

.challenge-solution p {
  margin: 0 0 0.5rem;
}

.success-confetti {
  position: absolute;
  top: 1rem;
  right: 1rem;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(62, 207, 142, 0.92);
  color: #0d1a12;
  font-weight: 800;
  font-size: 1.2rem;
  animation: confettiPop 1.2s ease forwards;
  pointer-events: none;
}

.challenge-card {
  position: relative;
}

@keyframes confettiPop {
  0% { opacity: 0; transform: scale(0.4); }
  20% { opacity: 1; transform: scale(1.1); }
  100% { opacity: 0; transform: scale(1.4) translateY(-12px); }
}

.achievement-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.85rem;
}

.achievement-badge {
  padding: 1rem;
  border-radius: 16px;
  border: 1px solid rgba(65, 80, 108, 0.44);
  background: rgba(10, 16, 24, 0.72);
  text-align: center;
  opacity: 0.55;
  filter: grayscale(0.35);
  transition: opacity 0.25s ease, filter 0.25s ease, border-color 0.25s ease;
}

.achievement-badge.earned {
  opacity: 1;
  filter: none;
  border-color: rgba(62, 207, 142, 0.48);
  box-shadow: 0 0 18px rgba(62, 207, 142, 0.12);
}

.achievement-icon {
  display: inline-flex;
  width: 44px;
  height: 44px;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
  margin-bottom: 0.55rem;
  font-family: var(--font-mono);
  font-weight: 800;
  font-size: 1.1rem;
  color: #eef6ff;
  background: rgba(79, 142, 247, 0.18);
  border: 1px solid rgba(79, 142, 247, 0.34);
}

.achievement-badge.earned .achievement-icon {
  background: rgba(62, 207, 142, 0.18);
  border-color: rgba(62, 207, 142, 0.42);
  color: #b8ffd6;
}

.education-promo {
  width: 100%;
  max-width: 1240px;
  margin: 1.5rem auto 0;
  position: relative;
  z-index: 1;
}

.education-promo-inner {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
}

.edu-promo-card {
  display: block;
  padding: 1.35rem 1.4rem;
  border-radius: 20px;
  border: 1px solid rgba(65, 80, 108, 0.58);
  background:
    radial-gradient(circle at top right, rgba(79, 142, 247, 0.16), transparent 34%),
    rgba(11, 17, 27, 0.9);
  color: inherit;
  text-decoration: none;
  min-height: 180px;
  transition: transform 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
}

.edu-promo-card:hover {
  text-decoration: none;
  transform: translateY(-2px);
  border-color: rgba(79, 142, 247, 0.58);
  box-shadow: 0 18px 36px rgba(7, 16, 30, 0.35);
}

.edu-promo-card h2 {
  margin: 0 0 0.5rem;
  font-size: 1.2rem;
  color: #f3f8ff;
}

.edu-promo-card p {
  margin: 0 0 1rem;
  color: var(--text-dim);
  line-height: 1.65;
  max-width: 42ch;
}

.edu-promo-kicker {
  display: inline-block;
  margin-bottom: 0.55rem;
  color: #9bc7ff;
  font-size: 0.74rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-weight: 700;
}

.edu-promo-card--challenges {
  background:
    radial-gradient(circle at top right, rgba(247, 184, 79, 0.14), transparent 34%),
    rgba(11, 17, 27, 0.9);
}

.edu-promo-cta {
  display: inline-flex;
  padding: 0.65rem 0.95rem;
  border-radius: 10px;
  background: rgba(79, 142, 247, 0.16);
  border: 1px solid rgba(79, 142, 247, 0.38);
  color: #d8e7ff;
  font-size: 0.84rem;
  font-weight: 700;
}

.edu-promo-card--challenges .edu-promo-cta {
  background: rgba(247, 184, 79, 0.14);
  border-color: rgba(247, 184, 79, 0.38);
  color: #ffe7b8;
}

@media (max-width: 1100px) {
  .achievement-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .education-promo-inner {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 560px) {
  .hero-copy h1 {
    font-size: 2rem;
  }

  .achievement-grid {
    grid-template-columns: 1fr;
  }

  .hero-copy p {
    font-size: 0.94rem;
  }

  .hero-actions,
  .challenge-actions,
  .toolbar-row,
  .crib-toolbar,
  .attack-toolbar,
  .timeline-toolbar {
    flex-direction: column;
    align-items: stretch;
  }

  .attempt-grid,
  .relay-rack {
    grid-template-columns: 1fr;
  }
}

a.edu-museum-back {
  display: block;
  width: 100%;
  margin-bottom: 0.35rem;
  color: var(--accent);
  font-size: 0.88rem;
  font-weight: 600;
  text-decoration: none;
}

a.edu-museum-back:hover {
  text-decoration: underline;
}
