:root {
  color-scheme: light;
  --ink: #101214;
  --paper: #f4f0e8;
  --muted: #666057;
  --line: rgba(16, 18, 20, 0.16);
  --panel: rgba(255, 252, 244, 0.78);
  --blue: #2f6f9f;
  --green: #27745f;
  --red: #a3423b;
  --gold: #b98118;
  --violet: #5c4b88;
  --shadow: 0 18px 60px rgba(16, 18, 20, 0.14);
}

* {
  box-sizing: border-box;
}

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

body {
  margin: 0;
  overflow-x: hidden;
  color: var(--ink);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
  letter-spacing: 0;
  background:
    linear-gradient(90deg, rgba(16, 18, 20, 0.035) 1px, transparent 1px),
    linear-gradient(rgba(16, 18, 20, 0.035) 1px, transparent 1px),
    var(--paper);
  background-size: 44px 44px;
}

button,
input {
  font: inherit;
}

.lab > *,
.section-head > *,
.protocol > *,
.readout > *,
.principle,
.question-board {
  min-width: 0;
}

.shell {
  min-height: 100vh;
}

.lab {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(320px, 0.74fr) minmax(420px, 1.26fr);
  gap: 0;
  border-bottom: 1px solid var(--line);
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.control-panel {
  align-self: stretch;
  border-radius: 0;
  border-width: 0 1px 0 0;
  box-shadow: none;
  padding: 46px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 28px;
}

.topbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 18px;
}

.kicker {
  margin: 0 0 12px;
  color: var(--red);
  font-size: 12px;
  line-height: 1.2;
  font-weight: 760;
  text-transform: uppercase;
}

.language-switch {
  display: inline-grid;
  grid-template-columns: repeat(2, 42px);
  gap: 4px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 252, 244, 0.72);
  flex: 0 0 auto;
  margin-left: auto;
}

.lang-button {
  min-height: 34px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-size: 12px;
  font-weight: 780;
}

.lang-button:hover,
.lang-button:focus-visible,
.lang-button.is-active {
  background: var(--ink);
  color: #fffaf0;
  outline: none;
}

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

h1 {
  max-width: 760px;
  margin-bottom: 18px;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 56px;
  line-height: 1.02;
  font-weight: 640;
  overflow-wrap: anywhere;
  line-break: anywhere;
}

html[lang="en"] h1 {
  font-size: 52px;
  overflow-wrap: normal;
  line-break: auto;
  word-break: normal;
}

.lede {
  max-width: 680px;
  margin-bottom: 0;
  color: var(--muted);
  font-size: 17px;
  line-height: 1.75;
  overflow-wrap: anywhere;
}

.meters {
  display: grid;
  gap: 18px;
}

.meter {
  display: grid;
  grid-template-columns: 88px 1fr;
  align-items: center;
  gap: 16px;
  color: var(--ink);
  font-size: 14px;
  font-weight: 680;
}

input[type="range"] {
  width: 100%;
  min-width: 0;
  accent-color: var(--blue);
}

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

.readout > div {
  min-height: 104px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 252, 244, 0.62);
}

.readout-label {
  display: block;
  margin-bottom: 12px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 680;
}

.readout strong {
  display: block;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 38px;
  line-height: 1;
  font-weight: 640;
}

.stage {
  position: relative;
  min-height: 100vh;
  overflow: hidden;
  background:
    radial-gradient(circle at 50% 50%, rgba(255, 252, 244, 0.78), rgba(244, 240, 232, 0.42) 46%, rgba(16, 18, 20, 0.05)),
    linear-gradient(135deg, rgba(47, 111, 159, 0.1), rgba(39, 116, 95, 0.1) 38%, rgba(163, 66, 59, 0.08));
}

#boundaryCanvas {
  display: block;
  width: 100%;
  height: 100%;
}

.stage-caption {
  position: absolute;
  left: 28px;
  right: 28px;
  top: 24px;
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px;
  pointer-events: none;
}

.stage-caption span {
  padding: 8px 11px;
  border: 1px solid rgba(16, 18, 20, 0.16);
  border-radius: 999px;
  background: rgba(255, 252, 244, 0.72);
  color: var(--muted);
  font-size: 12px;
  font-weight: 720;
}

.principles,
.protocol {
  padding: 76px 46px;
}

.section-head {
  display: grid;
  grid-template-columns: minmax(180px, 0.3fr) minmax(0, 0.7fr);
  align-items: end;
  gap: 36px;
  margin-bottom: 28px;
}

.section-head h2,
.manifesto h2 {
  margin-bottom: 0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 42px;
  line-height: 1.08;
  font-weight: 640;
}

.principle-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  border-top: 1px solid var(--line);
  border-left: 1px solid var(--line);
}

.principle {
  min-height: 300px;
  padding: 24px;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  background: rgba(255, 252, 244, 0.48);
}

.index {
  display: inline-flex;
  margin-bottom: 60px;
  color: var(--blue);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 34px;
  line-height: 1;
}

.principle h3 {
  margin-bottom: 14px;
  font-size: 20px;
  line-height: 1.2;
}

.principle p {
  margin-bottom: 0;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.72;
}

.protocol {
  display: grid;
  grid-template-columns: minmax(320px, 0.85fr) minmax(360px, 1.15fr);
  gap: 22px;
  padding-top: 0;
}

.manifesto {
  padding: 30px;
  background: rgba(255, 252, 244, 0.7);
}

.manifesto ol {
  margin: 28px 0 0;
  padding-left: 24px;
  color: var(--muted);
  font-size: 16px;
  line-height: 1.9;
}

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

.question {
  min-height: 58px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 252, 244, 0.5);
  color: var(--ink);
  cursor: pointer;
  font-size: 14px;
  font-weight: 760;
}

.question:hover,
.question:focus-visible,
.question.is-active {
  border-color: rgba(47, 111, 159, 0.55);
  background: rgba(47, 111, 159, 0.1);
  outline: none;
}

.answer {
  grid-column: 1 / -1;
  min-height: 230px;
  padding: 28px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #101214;
  color: #f8f2e6;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 28px;
  line-height: 1.42;
}

@media (max-width: 1040px) {
  .lab,
  .protocol {
    grid-template-columns: 1fr;
  }

  .control-panel {
    min-height: auto;
    border-right: 0;
    border-bottom: 1px solid var(--line);
    padding: 36px 28px;
  }

  .stage {
    min-height: 640px;
  }

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

@media (max-width: 820px) {
  .control-panel {
    padding: 32px 18px;
    gap: 24px;
  }

  .topbar {
    align-items: center;
    gap: 12px;
  }

  h1 {
    font-size: 34px;
    word-break: break-word;
  }

  html[lang="en"] h1 {
    font-size: 42px;
  }

  .section-head {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .section-head h2,
  .manifesto h2 {
    font-size: 32px;
  }

  .meter {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .readout,
  .principle-grid,
  .question-board {
    grid-template-columns: 1fr;
  }

  .principles,
  .protocol {
    padding: 54px 18px;
  }

  .protocol {
    padding-top: 0;
  }

  .principle {
    min-height: 240px;
  }

  .index {
    margin-bottom: 36px;
  }

  .answer {
    font-size: 22px;
  }
}
