:root {
  --ink: #0b1828;
  --muted: #526071;
  --paper: #f4f1ea;
  --paper-2: #e9e4da;
  --blue: #0c5f74;
  --blue-2: #0a3848;
  --cyan: #45c0cf;
  --gold: #d6a94d;
  --red: #ba4a42;
  --green: #377d5a;
  --white: #fffdf8;
  --shadow: 0 18px 60px rgba(7, 24, 37, .18);
  font-family: "Segoe UI", "Noto Sans", Arial, sans-serif;
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; overflow: hidden; background: #071724; color: var(--ink); }
button, a { font: inherit; }
button { color: inherit; }

.deck { height: 100%; position: relative; }
.slide {
  position: absolute;
  inset: 0;
  display: none;
  overflow: auto;
  padding: clamp(28px, 4vw, 72px) clamp(28px, 5.5vw, 104px) 96px;
  background:
    radial-gradient(circle at 85% 8%, rgba(69, 192, 207, .16), transparent 30%),
    linear-gradient(135deg, var(--white), var(--paper));
}
.slide.active { display: block; animation: enter .22s ease-out; }
.slide.dark {
  color: var(--white);
  background:
    radial-gradient(circle at 82% 16%, rgba(69, 192, 207, .2), transparent 33%),
    linear-gradient(135deg, #06131f 0%, #0b3040 62%, #0c5f74 130%);
}
.slide::after {
  content: attr(data-section);
  position: fixed;
  right: 5.5vw;
  top: 28px;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--blue);
}
.slide.dark::after { color: var(--cyan); }

@keyframes enter { from { transform: translateX(12px); } to { transform: none; } }

h1, h2, h3, p { margin-top: 0; }
h1 { font-size: clamp(32px, 4.1vw, 66px); line-height: 1.05; letter-spacing: -.035em; max-width: 1200px; }
h2 { font-size: clamp(30px, 3.25vw, 54px); line-height: 1.07; letter-spacing: -.03em; margin-bottom: clamp(20px, 3vh, 38px); max-width: 1220px; }
h3 { font-size: clamp(19px, 1.55vw, 28px); line-height: 1.18; }
p, li, td, th { font-size: clamp(16px, 1.25vw, 23px); line-height: 1.42; }
.lead { font-size: clamp(21px, 1.8vw, 31px); line-height: 1.34; max-width: 1080px; }
.eyebrow { color: var(--cyan); font-size: 13px; font-weight: 900; letter-spacing: .18em; text-transform: uppercase; margin-bottom: 24px; }
.kicker { color: var(--blue); font-size: clamp(18px, 1.3vw, 24px); font-weight: 750; }
.dark .kicker { color: var(--cyan); }
.muted { color: var(--muted); }
.dark .muted { color: #b8c7d0; }
.small { font-size: clamp(13px, .92vw, 17px); line-height: 1.35; }
.mono, code { font-family: "Cascadia Code", Consolas, monospace; }

.title-layout { min-height: calc(100vh - 190px); display: grid; grid-template-columns: 1.45fr .72fr; align-items: center; gap: 6vw; }
.title-rule { width: 110px; height: 6px; background: var(--gold); margin: 32px 0; }
.identity { border-left: 1px solid rgba(255,255,255,.25); padding-left: 34px; }
.identity p { margin-bottom: 18px; }
.identity strong { display: block; font-size: clamp(18px, 1.4vw, 25px); }
.advisor-card { border-top: 3px solid var(--gold); padding-top: 20px; margin-top: 34px; }

.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: clamp(18px, 2vw, 34px); }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: clamp(16px, 1.6vw, 28px); }
.grid-4 { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: clamp(12px, 1.25vw, 22px); }
.split-40 { display: grid; grid-template-columns: .78fr 1.22fr; gap: 4vw; align-items: center; }
.split-60 { display: grid; grid-template-columns: 1.3fr .7fr; gap: 4vw; align-items: center; }

.card {
  background: rgba(255,255,255,.66);
  border: 1px solid rgba(12,95,116,.2);
  border-radius: 18px;
  padding: clamp(18px, 2vw, 30px);
  box-shadow: 0 8px 28px rgba(8, 42, 56, .07);
}
.dark .card { background: rgba(255,255,255,.07); border-color: rgba(255,255,255,.19); box-shadow: none; }
.card.accent { border-top: 5px solid var(--gold); }
.card h3 { margin-bottom: 12px; color: var(--blue-2); }
.dark .card h3 { color: var(--cyan); }
.card p:last-child { margin-bottom: 0; }
.number { font-size: clamp(32px, 3vw, 54px); font-weight: 850; color: var(--blue); letter-spacing: -.04em; }
.dark .number { color: var(--cyan); }

.formula {
  background: #fff;
  border-left: 5px solid var(--gold);
  padding: clamp(18px, 2vw, 30px);
  margin: 18px 0;
  font: clamp(22px, 2.15vw, 38px)/1.42 Cambria, "Times New Roman", serif;
  overflow-x: auto;
  white-space: nowrap;
  box-shadow: 0 7px 24px rgba(11, 24, 40, .07);
}
.dark .formula { background: rgba(255,255,255,.09); box-shadow: none; }
.term {
  border: 0;
  border-bottom: 2px dotted var(--cyan);
  background: transparent;
  padding: 0 2px;
  cursor: help;
  font: inherit;
}
.term:hover, .term:focus { background: rgba(69,192,207,.18); outline: 3px solid rgba(69,192,207,.22); border-radius: 4px; }
.formula-note { color: var(--muted); font-size: clamp(13px, .95vw, 17px); }
.dark .formula-note { color: #b8c7d0; }

.chain { display: flex; align-items: stretch; gap: 10px; overflow-x: auto; padding: 18px 0 28px; }
.chain .node { min-width: 150px; flex: 1; }
.node, .arch-node {
  border: 1px solid rgba(12,95,116,.28);
  background: rgba(255,255,255,.83);
  padding: 18px 16px;
  border-radius: 14px;
  text-align: center;
  font-size: clamp(15px, 1.05vw, 20px);
}
button.node, button.arch-node { cursor: pointer; }
button.node:hover, button.arch-node:hover { transform: translateY(-2px); border-color: var(--cyan); box-shadow: 0 10px 24px rgba(12,95,116,.14); }
.arrow { align-self: center; color: var(--blue); font-weight: 900; font-size: 24px; }
.dark .arrow { color: var(--cyan); }
.dark .node, .dark .arch-node { color: var(--ink); }
.dark .tag { color: var(--white); }

.can-diagram { position: relative; width: min(320px, 72vw); height: 430px; margin: 0 auto; border: 7px solid #81909b; border-radius: 24px 24px 35px 35px; overflow: hidden; background: rgba(255,255,255,.45); }
.can-liquid { position: absolute; inset: 39% 0 0; background: linear-gradient(#4fc2cf, #0c5f74); }
.can-marker { position: absolute; left: -26px; right: -26px; top: 38%; border-top: 4px dashed var(--gold); z-index: 2; }
.can-marker span { position: absolute; right: -85px; top: -17px; color: var(--ink); font-weight: 800; }
.can-top, .can-bottom { position: absolute; left: 8%; right: 8%; height: 18px; border: 3px solid #81909b; border-radius: 50%; z-index: 4; }
.can-top { top: 8px; } .can-bottom { bottom: 7px; }

.timing { position: relative; height: 280px; margin-top: 28px; background: linear-gradient(180deg, rgba(12,95,116,.06), transparent); border-bottom: 2px solid var(--ink); }
.timing-window { position: absolute; bottom: 0; height: 72%; border-radius: 12px 12px 0 0; display: flex; align-items: flex-start; justify-content: center; padding-top: 22px; font-weight: 850; }
.timing-window.reference { left: 18%; width: 11%; background: rgba(214,169,77,.42); border: 2px solid var(--gold); }
.timing-window.liquid { left: 42%; width: 26%; background: rgba(69,192,207,.28); border: 2px solid var(--cyan); }
.timing-tick { position: absolute; bottom: -32px; transform: translateX(-50%); font-weight: 700; }
.timing-axis { margin-top: 40px; text-align: center; }

.decision-bar { display: grid; grid-template-columns: 1fr .58fr 1fr; border-radius: 18px; overflow: hidden; box-shadow: var(--shadow); margin-top: 34px; }
.decision-bar > div { min-height: 150px; padding: 26px; display: grid; place-items: center; text-align: center; }
.decision-under { background: #f4c9c5; }
.decision-unknown { background: #f2dfae; }
.decision-good { background: #bfe2cf; }

.architecture { display: grid; grid-template-columns: repeat(9, minmax(90px, 1fr)); gap: 10px; align-items: center; margin: 20px 0; }
.arch-node { min-height: 105px; display: grid; place-items: center; font-weight: 750; }
.arch-node.local { border-top: 5px solid var(--green); }
.arch-node.transport { border-top: 5px solid var(--gold); }
.arch-node.state { border-top: 5px solid var(--cyan); }
.arch-node.store { border-top: 5px solid var(--blue); }
.arch-node.view { border-top: 5px solid #765c9b; }
.arch-arrow { text-align: center; color: var(--blue); font-size: 24px; font-weight: 900; }
.arch-secondary { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 20px; margin: 24px auto 0; max-width: 920px; }

.code-stack { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 28px; }
.code-row { display: grid; grid-template-columns: 190px 1fr; gap: 18px; align-items: start; padding: 15px 0; border-bottom: 1px solid rgba(12,95,116,.18); }
.code-row code { font-size: clamp(12px, .85vw, 15px); color: var(--blue); overflow-wrap: anywhere; }
.dark .code-row code { color: var(--cyan); }
.code-row p { font-size: clamp(14px, 1.05vw, 19px); margin: 0; }

.metrics { display: grid; grid-template-columns: repeat(4, 1fr); gap: 18px; }
.metric { padding: 22px; border-top: 5px solid var(--green); background: rgba(255,255,255,.78); border-radius: 14px; }
.metric span { display: block; color: var(--muted); font-size: 15px; min-height: 42px; }
.metric strong { display: block; font-size: clamp(23px, 2.1vw, 38px); color: var(--blue-2); margin-top: 10px; }
.metric.pending { border-color: var(--gold); }
.metric.pending strong { font-size: clamp(17px, 1.3vw, 23px); }

table { width: 100%; border-collapse: collapse; background: rgba(255,255,255,.55); }
th { text-align: left; color: var(--blue-2); font-weight: 800; }
th, td { padding: 12px 14px; border-bottom: 1px solid rgba(12,95,116,.18); vertical-align: top; }
.table-scroll { overflow: auto; max-height: 62vh; }

.source { border: 0; background: transparent; color: var(--blue); font-size: .72em; font-weight: 850; cursor: pointer; vertical-align: super; padding: 0 2px; }
.dark .source { color: var(--cyan); }
.source:hover { text-decoration: underline; }

.toolbar {
  position: fixed;
  z-index: 30;
  left: 50%;
  transform: translateX(-50%);
  bottom: 18px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px;
  border-radius: 999px;
  background: rgba(6, 19, 31, .92);
  color: white;
  box-shadow: 0 10px 40px rgba(0,0,0,.3);
  backdrop-filter: blur(12px);
}
.toolbar button { border: 0; background: transparent; color: white; border-radius: 999px; min-width: 38px; height: 38px; cursor: pointer; }
.toolbar button:hover { background: rgba(255,255,255,.13); }
#counter { min-width: 70px; text-align: center; font-size: 13px; font-weight: 800; }
.progress-track { position: fixed; z-index: 35; left: 0; right: 0; bottom: 0; height: 5px; background: rgba(255,255,255,.15); }
#progress { display: block; height: 100%; width: 0; background: var(--cyan); transition: width .2s ease; }

.drawer {
  position: fixed;
  z-index: 60;
  top: 0;
  right: 0;
  bottom: 0;
  width: min(460px, 92vw);
  padding: 70px 38px 38px;
  color: var(--ink);
  background: var(--white);
  box-shadow: -20px 0 60px rgba(0,0,0,.24);
  transform: translateX(105%);
  transition: transform .22s ease;
  overflow: auto;
}
.drawer.open { transform: translateX(0); }
.drawer-close { position: absolute; top: 18px; right: 18px; border: 0; background: #e8eef0; border-radius: 50%; width: 42px; height: 42px; cursor: pointer; font-size: 24px; }
.drawer h2 { font-size: 31px; margin-bottom: 24px; }
.drawer p { font-size: 19px; }
.drawer code { display: block; white-space: pre-wrap; overflow-wrap: anywhere; background: #eaf0f2; padding: 14px; border-radius: 10px; }
.drawer-link { display: inline-block; margin-top: 22px; padding: 11px 16px; background: var(--blue); color: white; border-radius: 8px; text-decoration: none; }
.drawer-hint { color: var(--muted); font-size: 14px !important; }

.notes-panel {
  position: fixed;
  z-index: 55;
  left: 24px;
  bottom: 78px;
  width: min(600px, calc(100vw - 48px));
  max-height: 46vh;
  overflow: auto;
  padding: 24px;
  border-radius: 16px;
  background: rgba(6, 19, 31, .96);
  color: white;
  box-shadow: var(--shadow);
  display: none;
}
.notes-panel.open { display: block; }
.notes-panel h3 { color: var(--cyan); }
.notes-panel p { font-size: 17px; }
.speaker-notes { display: none; }
.slide-help { display: none; }

.overview { position: fixed; z-index: 70; inset: 0; padding: 42px; background: rgba(5,16,26,.97); color: white; display: none; overflow: auto; }
.overview.open { display: block; }
.overview h2 { color: white; }
.overview-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 13px; }
.overview-grid button { min-height: 112px; text-align: left; color: white; border: 1px solid rgba(255,255,255,.2); border-radius: 12px; background: rgba(255,255,255,.06); padding: 17px; cursor: pointer; }
.overview-grid button:hover { border-color: var(--cyan); background: rgba(69,192,207,.1); }
.overview-grid span { color: var(--cyan); display: block; font-size: 13px; margin-bottom: 8px; }
.overview-grid strong { font-size: 16px; }

.tag { display: inline-block; font-size: 13px; font-weight: 850; padding: 6px 10px; border-radius: 999px; color: var(--blue-2); background: rgba(69,192,207,.2); }
.tag.gold { background: rgba(214,169,77,.3); }
.tag.green { background: rgba(55,125,90,.18); color: var(--green); }
.callout { border-left: 5px solid var(--cyan); padding: 8px 0 8px 22px; margin: 24px 0; max-width: 1100px; }
.dark .callout { border-color: var(--gold); }
.patent-list { display: grid; grid-template-columns: 1fr 1fr; gap: 13px 24px; }
.patent { border-bottom: 1px solid rgba(12,95,116,.2); padding: 10px 0 15px; }
.patent strong { color: var(--blue); }

.decision-chain .node { min-width: 175px; }
.method-table { max-height: 70vh; }
.method-table p, .method-table td, .method-table th,
.novelty-table td, .novelty-table th,
.trace-table td, .trace-table th { font-size: clamp(13px, .95vw, 17px); line-height: 1.28; }
.method-table th, .novelty-table th, .trace-table th { position: sticky; top: 0; z-index: 2; background: #f7f4ed; }
.closest-grid .card { min-height: 270px; display: flex; flex-direction: column; }
.source-card { align-self: flex-start; margin-top: auto; vertical-align: baseline; font-size: 13px; padding: 7px 10px; border: 1px solid currentColor; border-radius: 999px; }
.provision-grid .card { min-height: 305px; }
.proof-grid .card { min-height: 300px; }
.compact-decision { margin-top: 20px; }
.compact-decision > div { min-height: 105px; padding: 16px; }
.compact-timing { height: 175px; margin-top: 0; }
.compact-timing .timing-window { padding-top: 14px; }
.formula-pair { margin-top: 34px; }
.formula-pair .formula { font-size: clamp(18px, 1.6vw, 28px); margin: 0; }
.architecture-second { grid-template-columns: repeat(7, minmax(90px, 1fr)); max-width: 1120px; margin-inline: auto; }
.compact-code .code-row { grid-template-columns: 250px 1fr; padding: 10px 0; }
.status-row { margin-top: 22px; }
.status-row .card { padding-block: 17px; }
.status-row .card p { font-size: clamp(14px, 1vw, 18px); }
.openegiz-heading { display: flex; align-items: center; gap: 24px; margin-bottom: 10px; }
.openegiz-heading img { width: 140px; max-height: 64px; }
.openegiz-arch { margin-block: 10px 20px; }
.compact-metrics { gap: 14px; }
.compact-metrics .metric { padding: 16px; }
.compact-metrics .metric span { min-height: 22px; }
.compact-metrics .metric strong { margin-top: 5px; }
.evidence-columns h3 { color: var(--blue-2); border-bottom: 3px solid var(--gold); padding-bottom: 10px; }
.evidence-row { display: grid; grid-template-columns: 150px 1fr; gap: 18px; border-bottom: 1px solid rgba(12,95,116,.2); padding: 12px 0; }
.evidence-row strong { color: var(--blue); font-size: clamp(15px, 1.05vw, 19px); }
.evidence-row p { margin: 0; font-size: clamp(14px, 1vw, 18px); }
.conclusion-line { margin: 34px auto 0; text-align: center; color: var(--cyan); }
.appendix-formula { text-align: center; }
.small-formula { font-size: clamp(18px, 1.55vw, 27px); margin: 11px 0; }
.source-buttons { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.source-buttons .node { min-width: 0; padding: 13px 10px; }
.glossary-mini .node { min-width: 0; padding: 14px 8px; }
.drawer h3 { color: var(--blue); margin-top: 26px; margin-bottom: 8px; }

@media (max-width: 980px) {
  .slide { padding-left: 30px; padding-right: 30px; }
  .slide::after { display: none; }
  .title-layout, .grid-3, .grid-4, .split-40, .split-60, .code-stack { grid-template-columns: 1fr; }
  .identity { border-left: 0; border-top: 1px solid rgba(255,255,255,.25); padding: 24px 0 0; }
  .metrics { grid-template-columns: repeat(2, 1fr); }
  .architecture { grid-template-columns: 1fr; }
  .arch-arrow { transform: rotate(90deg); }
  .grid-2 { grid-template-columns: 1fr; }
  .patent-list { grid-template-columns: 1fr; }
  .can-diagram { height: 300px; }
  .evidence-row { grid-template-columns: 1fr; gap: 4px; }
  .source-buttons { grid-template-columns: 1fr; }
}

@media print {
  html, body { overflow: visible; background: white; }
  .deck { height: auto; }
  .slide { position: relative; display: block !important; min-height: 100vh; page-break-after: always; padding-bottom: 40px; }
  .toolbar, .progress-track, .drawer, .notes-panel, .overview { display: none !important; }
}
