:root {
  --green: #007a2f;
  --green-dark: #005820;
  --green-soft: #e9f5ee;
  --red: #e30613;
  --ink: #111513;
  --muted: #5d6861;
  --line: #c9ddd0;
  --paper: #fbfdfb;
  --shadow: 0 24px 70px rgba(0, 60, 25, 0.14);
}

* {
  box-sizing: border-box;
}

html {
  overflow-x: hidden;
  overscroll-behavior: none;
  background: #eef5f0;
}

body {
  margin: 0;
  min-height: 100vh;
  overflow: hidden;
  background:
    linear-gradient(90deg, rgba(0, 122, 47, 0.08) 0 1px, transparent 1px 100%),
    linear-gradient(180deg, rgba(0, 122, 47, 0.06) 0 1px, transparent 1px 100%),
    #eef5f0;
  background-size: 48px 48px;
  color: var(--ink);
  font-family:
    Inter, "Segoe UI", Arial, Helvetica, sans-serif;
}

.deck {
  width: 100vw;
  height: 100vh;
  position: relative;
}

.slide {
  position: absolute;
  inset: 0;
  display: none;
  width: 100%;
  height: 100%;
  padding: clamp(40px, 5vw, 76px);
  background:
    radial-gradient(circle at 8% 88%, rgba(0, 122, 47, 0.12), transparent 28%),
    linear-gradient(180deg, #ffffff 0%, var(--paper) 100%);
  overflow: hidden;
  isolation: isolate;
}

.slide.cover {
  padding-bottom: 104px;
}

.slide.dense {
  padding-top: clamp(34px, 4vw, 58px);
  padding-bottom: 40px;
}

.slide.active {
  display: block;
}

.slide.active > * {
  animation: slide-in 420ms cubic-bezier(0.2, 0.8, 0.2, 1) both;
}

.slide.active > :nth-child(2) { animation-delay: 60ms; }
.slide.active > :nth-child(3) { animation-delay: 120ms; }
.slide.active > :nth-child(n + 4) { animation-delay: 180ms; }

.slide.active > .slide-number {
  animation: none;
}

.deck.back .slide.active > * {
  animation-name: slide-in-back;
}

@keyframes slide-in {
  from { opacity: 0; transform: translateX(28px); }
}

@keyframes slide-in-back {
  from { opacity: 0; transform: translateX(-28px); }
}

@media (prefers-reduced-motion: reduce) {
  .slide.active > * { animation: none; }
}

.slide::before {
  content: "";
  position: absolute;
  z-index: 0;
  left: -28px;
  top: 22%;
  width: 160px;
  height: 520px;
  background:
    linear-gradient(90deg, rgba(0, 122, 47, 0.08), transparent),
    repeating-linear-gradient(0deg, transparent 0 22px, rgba(0, 122, 47, 0.2) 22px 24px),
    repeating-linear-gradient(90deg, transparent 0 22px, rgba(0, 122, 47, 0.2) 22px 24px);
  border-radius: 18px;
  opacity: 0.7;
  pointer-events: none;
}

.slide > * {
  position: relative;
  z-index: 1;
}

.slide-number {
  position: absolute;
  z-index: 2;
  top: 0;
  left: 0;
  min-width: 112px;
  padding: 24px 26px 28px;
  border-radius: 0 0 28px 0;
  background: linear-gradient(145deg, var(--green), var(--green-dark));
  color: #fff;
  font-size: 42px;
  font-weight: 900;
  letter-spacing: 0;
  box-shadow: var(--shadow);
}

.kicker {
  margin: 20px 0 26px 132px;
  color: var(--ink);
  font-size: clamp(18px, 2vw, 28px);
  font-weight: 900;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

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

h1 {
  margin-bottom: 16px;
  color: var(--green);
  font-size: clamp(68px, 8vw, 132px);
  line-height: 0.9;
  font-weight: 950;
  letter-spacing: 0;
}

h2 {
  max-width: 1050px;
  margin-bottom: 34px;
  color: var(--green-dark);
  font-size: clamp(46px, 5.4vw, 86px);
  line-height: 1.02;
  font-weight: 950;
  letter-spacing: 0;
}

.dense h2 {
  margin-bottom: 22px;
  font-size: clamp(38px, 4.4vw, 64px);
}

h3 {
  margin-bottom: 10px;
  color: var(--green-dark);
  font-size: clamp(23px, 2.1vw, 34px);
}

.subtitle {
  margin-bottom: 34px;
  font-size: clamp(28px, 3.1vw, 48px);
}

.big,
.closing p,
.quote-panel p {
  font-size: clamp(30px, 3vw, 52px);
  line-height: 1.15;
}

.cover-grid {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 300px;
  gap: 48px;
  align-items: start;
  height: 100%;
}

.cover-main {
  padding-left: 120px;
}

.cover .kicker {
  margin-left: 0;
  margin-bottom: 22px;
  border-bottom: 3px solid var(--green);
  padding-bottom: 14px;
}

.cover h1 {
  margin-bottom: 12px;
  font-size: clamp(56px, 6vw, 96px);
}

.cover .subtitle {
  max-width: 980px;
  margin-bottom: 24px;
  font-size: clamp(25px, 2.6vw, 42px);
  line-height: 1.18;
}

.group-box {
  display: block;
  max-width: 930px;
  padding: 18px 28px;
  border: 3px solid var(--green);
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.8);
}

.group-box h2 {
  margin: 0 0 10px;
  color: var(--green-dark);
  font-size: clamp(24px, 2vw, 34px);
  line-height: 1;
  font-weight: 950;
}

.group-box ul,
.check-list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.group-box ul {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  column-gap: 26px;
}

.group-box li,
.check-list li {
  position: relative;
  margin: 7px 0;
  padding-left: 28px;
  font-size: clamp(18px, 1.32vw, 24px);
  line-height: 1.2;
}

.group-box li::before,
.check-list li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.5em;
  width: 10px;
  height: 10px;
  background: var(--green);
}

.teacher {
  display: inline-block;
  margin-top: 16px;
  padding: 10px 16px 12px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.86);
  font-size: clamp(21px, 1.8vw, 31px);
  line-height: 1.15;
}

.cover footer {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 18px 22px;
  background: linear-gradient(145deg, var(--green), var(--green-dark));
  color: #fff;
  text-align: center;
  font-size: 24px;
  font-weight: 800;
}

.ifc-mark {
  padding-top: 42px;
  text-align: center;
  font-style: normal;
}

.ifc-symbol {
  display: grid;
  grid-template-columns: repeat(3, 34px);
  grid-auto-rows: 34px;
  gap: 8px;
  justify-content: center;
  margin-bottom: 24px;
}

.ifc-symbol span {
  border-radius: 5px;
  background: #2f9e44;
}

.ifc-symbol .red {
  border-radius: 50%;
  background: var(--red);
}

.ifc-mark strong {
  display: block;
  font-size: 38px;
  line-height: 1;
  text-transform: uppercase;
}

.ifc-mark > span {
  display: block;
  margin: 8px 0 18px;
  font-size: 28px;
}

.ifc-mark em {
  display: block;
  padding-top: 16px;
  border-top: 3px solid var(--green);
  font-size: 25px;
  font-style: normal;
}

.split,
.analysis-layout {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(320px, 0.8fr);
  gap: 42px;
  align-items: center;
}

.callout,
.formula-card,
.concept-grid article,
.function-row article,
.result-grid article,
.two-cards article,
.relation-examples article,
.property-grid article,
.quote-panel,
.abstract-note,
.stats-panel {
  border: 2px solid var(--line);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.86);
  box-shadow: var(--shadow);
}

.callout {
  padding: 34px;
}

.callout strong {
  color: var(--green);
  font-size: 32px;
}

.callout p,
.concept-grid p,
.function-row p,
.relation-examples p,
.property-grid p,
.abstract-note p,
.two-cards p,
.stats-panel p {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: clamp(20px, 1.8vw, 31px);
  line-height: 1.3;
}

.concept-grid,
.result-grid,
.two-cards,
.function-row,
.relation-examples,
.property-grid {
  position: relative;
  z-index: 1;
  display: grid;
  gap: 24px;
}

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

.concept-grid article,
.function-row article,
.result-grid article,
.two-cards article,
.relation-examples article,
.property-grid article {
  padding: 28px;
}

.concept-grid span {
  display: grid;
  place-items: center;
  width: 72px;
  height: 72px;
  margin-bottom: 24px;
  border-radius: 16px;
  background: var(--green);
  color: #fff;
  font-size: 38px;
  font-weight: 950;
}

.model-layout {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 22px;
  align-items: stretch;
}

.model-layout img {
  width: 100%;
  max-height: 56vh;
  object-fit: contain;
  border-radius: 16px;
  background: #f6efe3;
  box-shadow: var(--shadow);
}

.stats-panel {
  display: grid;
  align-content: center;
  gap: 10px;
  padding: 20px;
}

.stats-panel div {
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line);
}

.stats-panel strong {
  display: block;
  color: var(--green);
  font-size: clamp(36px, 3.2vw, 52px);
  line-height: 1;
}

.stats-panel span {
  color: var(--muted);
  font-size: clamp(17px, 1.35vw, 23px);
}

.stats-panel p {
  font-size: clamp(17px, 1.25vw, 24px);
  line-height: 1.22;
}

.formula-card {
  position: relative;
  z-index: 1;
  max-width: 1050px;
  margin: 0 auto 22px;
  padding: 24px 32px;
  text-align: center;
}

.formula-card span {
  display: block;
  color: var(--green);
  font-size: clamp(54px, 6.5vw, 96px);
  font-weight: 950;
}

.formula-card p {
  margin-bottom: 0;
  color: var(--muted);
  font-size: clamp(22px, 2vw, 32px);
}

.two-cards,
.function-row,
.relation-examples,
.result-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.relation-slide .two-cards article {
  padding: 24px 28px;
}

.relation-slide .two-cards p {
  font-size: clamp(19px, 1.55vw, 28px);
}

@media (max-height: 820px) and (min-width: 981px) {
  .slide {
    padding-top: 36px;
    padding-bottom: 34px;
  }

  .slide.cover {
    padding-bottom: 84px;
  }

  .kicker {
    margin-bottom: 16px;
    font-size: 22px;
  }

  h2,
  .dense h2 {
    margin-bottom: 16px;
    font-size: 46px;
    line-height: 1;
  }

  .cover h1 {
    font-size: 84px;
  }

  .cover .subtitle {
    margin-bottom: 18px;
    font-size: 35px;
    line-height: 1.08;
  }

  .group-box {
    padding: 16px 28px;
  }

  .group-box h2 {
    margin-bottom: 8px;
    font-size: 30px;
  }

  .group-box li {
    margin: 6px 0;
    font-size: 21px;
  }

  .teacher {
    margin-top: 12px;
    padding: 8px 14px;
    font-size: 25px;
  }

  .cover footer {
    padding: 14px 22px;
    font-size: 21px;
  }

  .model-layout {
    grid-template-columns: minmax(0, 1fr) 280px;
    gap: 18px;
  }

  .model-layout img {
    max-height: 450px;
  }

  .stats-panel {
    align-content: start;
    gap: 8px;
    padding: 16px;
  }

  .stats-panel div {
    padding-bottom: 7px;
  }

  .stats-panel strong {
    font-size: 36px;
  }

  .stats-panel span {
    font-size: 17px;
  }

  .stats-panel p {
    margin-top: 4px;
    font-size: 17px;
    line-height: 1.18;
  }

  .formula-card {
    margin-bottom: 16px;
    padding: 20px 28px;
  }

  .formula-card span {
    font-size: 78px;
  }

  .formula-card p {
    font-size: 25px;
  }

  .two-cards,
  .function-row,
  .steps {
    gap: 16px;
  }

  .relation-slide .two-cards article,
  .function-row article,
  .two-cards article {
    padding: 20px 24px;
  }

  .relation-slide .two-cards p,
  .function-row p,
  .two-cards p,
  .relation-examples p,
  .property-grid p,
  .abstract-note p {
    font-size: 22px;
    line-height: 1.22;
  }

  .function-row code {
    margin-bottom: 12px;
    font-size: 30px;
  }

  .bottom-note {
    margin-top: 16px;
    padding: 13px 20px;
    font-size: 27px;
  }

  .steps li {
    min-height: 106px;
    padding: 18px 20px 18px 76px;
    font-size: 24px;
  }

  .steps li::before {
    left: 20px;
    top: 18px;
    width: 38px;
    height: 38px;
  }

  .callout.horizontal {
    padding: 18px 24px;
  }

  .callout strong {
    font-size: 26px;
  }

  .callout p {
    font-size: 22px;
  }
}

.function-row code {
  display: inline-block;
  margin-bottom: 18px;
  padding: 10px 14px;
  border-radius: 12px;
  background: var(--green-soft);
  color: var(--green-dark);
  font-size: clamp(25px, 2.5vw, 38px);
  font-weight: 900;
}

.bottom-note,
.final-tag {
  position: relative;
  z-index: 1;
  margin-top: 22px;
  padding: 16px 24px;
  border-left: 8px solid var(--green);
  background: var(--green-soft);
  color: var(--green-dark);
  font-size: clamp(22px, 2.1vw, 34px);
  font-weight: 800;
}

.steps {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  margin: 0 0 18px;
  padding: 0;
  list-style: none;
  counter-reset: step;
}

.steps li {
  min-height: 126px;
  padding: 22px 24px 22px 84px;
  border: 2px solid var(--line);
  border-radius: 18px;
  background: #fff;
  box-shadow: var(--shadow);
  counter-increment: step;
  font-size: clamp(20px, 1.75vw, 29px);
  line-height: 1.25;
  position: relative;
}

.steps li::before {
  content: counter(step);
  position: absolute;
  left: 22px;
  top: 22px;
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--green);
  color: #fff;
  font-weight: 950;
}

.callout.horizontal {
  display: grid;
  grid-template-columns: 250px 1fr;
  align-items: center;
  padding: 24px 28px;
}

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

.result-grid span {
  display: inline-block;
  margin-bottom: 18px;
  color: var(--green);
  font-size: 30px;
  font-weight: 950;
}

.result-grid strong {
  display: block;
  font-size: clamp(34px, 4vw, 62px);
}

.result-grid p {
  margin: 18px 0 10px;
  font-size: clamp(24px, 2.4vw, 39px);
  font-weight: 800;
}

.result-grid small {
  color: var(--muted);
  font-size: 22px;
}

.quote-panel {
  padding: 36px;
  border-left: 10px solid var(--green);
}

.focus-layout {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(360px, 0.85fr);
  gap: 36px;
  align-items: center;
}

.emphasis-list li {
  margin: 16px 0;
  font-size: clamp(24px, 2.3vw, 40px);
}

.abstraction-layout {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(360px, 0.9fr);
  gap: 26px;
  align-items: stretch;
}

.abstraction-slide .formula-card {
  display: grid;
  align-content: center;
  margin: 0;
}

.abstraction-slide .formula-card span {
  font-size: clamp(42px, 5vw, 72px);
}

.abstract-note {
  padding: 30px;
}

.relation-examples code {
  display: inline-block;
  margin: 6px 0 10px;
  padding: 10px 14px;
  border-radius: 12px;
  background: var(--green-soft);
  color: var(--green-dark);
  font-size: clamp(30px, 3.6vw, 56px);
  font-weight: 950;
}

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

.property-grid span {
  display: inline-grid;
  place-items: center;
  min-width: 58px;
  height: 42px;
  margin-bottom: 18px;
  border-radius: 999px;
  background: var(--green);
  color: #fff;
  font-weight: 950;
}

.inline-example {
  display: inline-block;
  margin-top: 16px;
  padding: 10px 14px;
  border-radius: 12px;
  background: var(--green-soft);
  color: var(--green-dark);
  font-size: clamp(20px, 1.8vw, 30px);
}

.step-table {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.step-table div {
  min-height: 82px;
  padding: 16px 20px;
  border: 2px solid var(--line);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.9);
  box-shadow: var(--shadow);
}

.step-table strong,
.step-table span {
  display: block;
}

.step-table strong {
  color: var(--green-dark);
  font-size: clamp(20px, 1.75vw, 30px);
}

.step-table span {
  margin-top: 5px;
  color: var(--muted);
  font-size: clamp(17px, 1.35vw, 24px);
  line-height: 1.22;
}

.route-line {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 22px;
  margin-top: 18px;
  padding: 16px 24px;
  border-radius: 18px;
  background: linear-gradient(145deg, var(--green), var(--green-dark));
  color: #fff;
  box-shadow: var(--shadow);
}

.route-line strong {
  font-size: clamp(26px, 3vw, 48px);
}

.route-line span {
  font-size: clamp(22px, 2.4vw, 38px);
  font-weight: 900;
}

@media (max-height: 820px) and (min-width: 981px) {
  .focus-layout,
  .abstraction-layout {
    gap: 18px;
  }

  .emphasis-list li {
    margin: 10px 0;
    font-size: 26px;
  }

  .abstract-note,
  .relation-examples article,
  .property-grid article {
    padding: 20px 24px;
  }

  .abstraction-slide .formula-card span {
    font-size: 54px;
  }

  .relation-examples code {
    font-size: 38px;
  }

  .step-table {
    gap: 10px;
  }

  .step-table div {
    min-height: 70px;
    padding: 12px 16px;
  }

  .step-table strong {
    font-size: 22px;
  }

  .step-table span {
    font-size: 18px;
  }

  .route-line {
    margin-top: 14px;
    padding: 12px 20px;
  }

  .route-line strong {
    font-size: 32px;
  }

  .route-line span {
    font-size: 28px;
  }
}

.closing {
  position: relative;
  z-index: 1;
  max-width: 1150px;
}

.controls {
  position: fixed;
  z-index: 20;
  left: 50%;
  bottom: 20px;
  display: flex;
  align-items: center;
  gap: 12px;
  transform: translateX(-50%);
  padding: 10px;
  border: 1px solid rgba(0, 88, 32, 0.18);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.88);
  box-shadow: 0 18px 50px rgba(0, 60, 25, 0.18);
  backdrop-filter: blur(12px);
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 18px);
  transition:
    opacity 160ms ease,
    transform 160ms ease;
}

body.controls-visible .controls,
.controls:focus-within,
.controls:hover {
  opacity: 1;
  pointer-events: auto;
  transform: translate(-50%, 0);
}

button {
  min-width: 48px;
  height: 42px;
  border: 0;
  border-radius: 999px;
  background: var(--green);
  color: #fff;
  cursor: pointer;
  font: inherit;
  font-weight: 850;
}

button:hover {
  background: var(--green-dark);
}

#overview {
  padding: 0 18px;
}

.controls .home {
  display: inline-flex;
  align-items: center;
  height: 42px;
  padding: 0 16px;
  border-radius: 999px;
  border: 1px solid rgba(0, 88, 32, 0.25);
  color: var(--green-dark);
  font-weight: 850;
  text-decoration: none;
  white-space: nowrap;
}

.controls .home:hover {
  background: var(--green-soft);
}

@media (hover: none) {
  .controls {
    opacity: 1;
    pointer-events: auto;
    transform: translate(-50%, 0);
  }

  .progress {
    opacity: 1;
  }
}

#counter {
  min-width: 82px;
  color: var(--green-dark);
  font-weight: 900;
  text-align: center;
}

.progress {
  position: fixed;
  z-index: 21;
  left: 0;
  right: 0;
  bottom: 0;
  height: 6px;
  background: rgba(0, 122, 47, 0.12);
  opacity: 0;
  transition: opacity 160ms ease;
}

body.controls-visible .progress {
  opacity: 1;
}

.progress span {
  display: block;
  width: 10%;
  height: 100%;
  background: var(--green);
  transition: width 180ms ease;
}

.thumbs {
  position: fixed;
  z-index: 30;
  inset: 24px;
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 16px;
  padding: 24px;
  border-radius: 22px;
  background: rgba(244, 249, 246, 0.96);
  box-shadow: 0 24px 90px rgba(0, 60, 25, 0.25);
}

.thumbs[hidden] {
  display: none;
}

.thumbs button {
  height: auto;
  min-height: 132px;
  padding: 18px;
  border-radius: 16px;
  background: #fff;
  color: var(--ink);
  text-align: left;
  box-shadow: var(--shadow);
}

.thumbs button strong {
  display: block;
  color: var(--green);
  font-size: 28px;
}

.thumbs button span {
  display: block;
  margin-top: 10px;
  color: var(--muted);
  font-size: 18px;
}

@media (max-width: 980px) {
  body {
    overflow-x: hidden;
    overflow-y: auto;
  }

  .deck {
    height: auto;
  }

  .slide {
    position: relative;
    display: block;
    min-height: 100vh;
    padding: 86px 22px 100px;
  }

  .slide:not(.active) {
    display: none;
  }

  .slide-number {
    min-width: 78px;
    padding: 16px 18px 18px;
    font-size: 28px;
  }

  .kicker,
  .cover-main {
    margin-left: 0;
    padding-left: 0;
  }

  .cover-grid,
  .split,
  .analysis-layout,
  .model-layout,
  .focus-layout,
  .abstraction-layout,
  .callout.horizontal {
    grid-template-columns: 1fr;
  }

  .concept-grid,
  .steps,
  .two-cards,
  .function-row,
  .relation-examples,
  .property-grid,
  .step-table,
  .result-grid {
    grid-template-columns: 1fr;
  }

  .route-line {
    flex-direction: column;
    align-items: flex-start;
  }

  .ifc-mark {
    display: none;
  }

  .group-box {
    grid-template-columns: 1fr;
  }

  .thumbs {
    grid-template-columns: 1fr 1fr;
    overflow: auto;
  }
}

@media print {
  body {
    overflow: visible;
    background: #fff;
  }

  .deck {
    height: auto;
  }

  .slide,
  .slide:not(.active) {
    position: relative;
    display: block;
    width: 100vw;
    height: 100vh;
    page-break-after: always;
  }

  .controls,
  .progress,
  .thumbs {
    display: none !important;
  }
}
