:root {
  color-scheme: dark;
  --bg: #101214;
  --panel: #181d21;
  --line: #34414a;
  --text: #edf2f5;
  --muted: #aab6bf;
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
}

.app {
  min-height: 100vh;
  padding: 28px;
  display: grid;
  grid-template-rows: auto auto auto 1fr auto;
  gap: 18px;
}

.lang {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}

.lang button {
  width: 38px;
  height: 32px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font: inherit;
}

.lang button.active {
  color: #071311;
  border-color: #41c7b9;
  background: #41c7b9;
  font-weight: 700;
}

.hero {
  max-width: 1080px;
}

.kicker {
  margin: 0 0 8px;
  color: #f0b44d;
  font-size: clamp(0.95rem, 1.4vw, 1.15rem);
  font-weight: 700;
  letter-spacing: 0;
}

.hero h1 {
  margin: 0;
  font-size: clamp(2.05rem, 5vw, 4.8rem);
  line-height: 1.04;
  letter-spacing: 0;
}

.hero p {
  margin: 12px 0 0;
  color: #41c7b9;
  font-size: clamp(1.05rem, 2vw, 1.42rem);
  line-height: 1.35;
}

.intro {
  max-width: 920px;
  display: grid;
  gap: 6px;
}

.intro p {
  margin: 0;
  font-size: clamp(1rem, 1.5vw, 1.22rem);
  line-height: 1.42;
  letter-spacing: 0;
  color: var(--muted);
}

.intro p:first-child {
  color: var(--text);
}

.theory {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  max-width: 1120px;
}

.theory-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  padding: 15px;
}

.theory-card strong {
  color: var(--text);
  font-size: 1rem;
}

.theory-card p {
  margin: 7px 0 0;
  color: var(--muted);
  line-height: 1.45;
}

.bridge {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1.35fr) auto minmax(0, 1fr);
  gap: 12px;
  align-items: center;
  max-width: 1120px;
}

.bridge div {
  min-height: 86px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  padding: 14px;
  display: grid;
  align-content: center;
  gap: 5px;
}

.bridge .bridge-core {
  border-color: #41c7b9;
}

.bridge strong {
  font-size: 1rem;
  color: var(--text);
}

.bridge span {
  color: var(--muted);
  line-height: 1.35;
}

.bridge b {
  color: #41c7b9;
  font-size: 1.5rem;
  font-weight: 700;
}

.stage {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  align-content: start;
}

.panel {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  overflow: hidden;
}

.panel svg {
  display: block;
  width: 100%;
  height: auto;
  background: #0b0d0f;
}

.panel p {
  margin: 0;
  padding: 13px 14px 15px;
  color: var(--text);
  font-size: 1.02rem;
  line-height: 1.35;
}

.closing {
  max-width: 960px;
  border-top: 1px solid var(--line);
  padding-top: 16px;
}

.closing p {
  margin: 0;
  color: var(--muted);
  font-size: clamp(1rem, 1.4vw, 1.18rem);
  line-height: 1.5;
}

.details {
  max-width: 1120px;
  border-top: 1px solid var(--line);
  padding-top: 20px;
}

.details h2 {
  margin: 0 0 14px;
  font-size: clamp(1.35rem, 2.2vw, 2rem);
  line-height: 1.15;
}

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

.detail-block {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  padding: 15px;
}

.detail-block h3 {
  margin: 0;
  font-size: 1rem;
  line-height: 1.3;
}

.detail-block p {
  margin: 8px 0 0;
  color: var(--muted);
  line-height: 1.48;
}

.alignment-note {
  margin: 14px 0 0;
  color: var(--muted);
  line-height: 1.45;
}

.alignment-note strong {
  color: #f0b44d;
}

.boundary-notes {
  max-width: 1120px;
  border-top: 1px solid var(--line);
  padding-top: 20px;
}

.boundary-notes h2 {
  margin: 0 0 14px;
  font-size: clamp(1.25rem, 2vw, 1.8rem);
}

.boundary-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.boundary-block {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  padding: 15px;
}

.boundary-block.known {
  border-color: #41c7b9;
}

.boundary-block.proposal {
  border-color: #f0b44d;
}

.boundary-block.failure {
  border-color: #ee6a6a;
}

.boundary-block strong {
  display: block;
  color: var(--text);
}

.boundary-block p {
  margin: 8px 0 0;
  color: var(--muted);
  line-height: 1.48;
}

@media (max-width: 980px) {
  .app {
    padding: 18px;
  }

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

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

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

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

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

  .bridge b {
    display: none;
  }
}
