:root {
  --blue: #4285F4; --green: #34A853; --yellow: #FBBC04; --red: #EA4335;
  --blue-h: #57CAFF; --green-h: #5CDB6D; --yellow-h: #FFD427; --red-h: #FF7DAF;
  --blue-p: #C3ECF6; --green-p: #CCF6C5; --yellow-p: #FFE7A5; --red-p: #F8D8D8;
  --ink: #1E1E1E; --ink-2: #4A4A4A; --ink-3: #7A7A7A; --paper: #FFFFFF; --off: #F1F0EE;
  --line: 2.5px;
  --sans: 'Google Sans Flex', 'Google Sans', system-ui, sans-serif;
  --mono: 'Roboto Mono', 'Google Sans Code', ui-monospace, monospace;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: var(--off); }
body { font-family: var(--sans); color: var(--ink); -webkit-font-smoothing: antialiased; }
html[data-idle]:not([data-hud]) body { cursor: none; }
html:not(.ready) #stage { opacity: 0; }
svg.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }

/* ---------- stage ---------- */
#stage {
  position: fixed; left: 50%; top: 50%; width: 1920px; height: 1080px; overflow: hidden;
  transform: translate(-50%, -50%) scale(var(--s, 1)); transform-origin: center;
  background: var(--bg, var(--off)); contain: strict;
}
#frame { position: absolute; inset: 0; width: 1920px; height: 1080px; overflow: visible; }
#frame-path { fill: var(--paper); stroke: var(--ink); stroke-width: var(--line); stroke-linejoin: round; }
.slide { position: absolute; inset: 0; visibility: hidden; font-family: var(--sans); }
.slide.active { visibility: visible; will-change: opacity; }
/* nothing inside a hidden slide may show, even if an inline style says visible */
.slide:not(.active) * { visibility: hidden !important; }
/* GSAP animates through inline styles, so give the active slide's pieces their own GPU layers;
   otherwise every animated frame repaints whatever they sit on */
#frame { will-change: transform; }
.slide.active > * { will-change: transform, opacity; }
.slide > * { position: absolute; }
.notes { display: none !important; }

/* ---------- persistent chrome (positioned by the engine) ---------- */
.chrome { position: absolute; left: 0; top: 0; pointer-events: none; will-change: transform, opacity; }
.c-gdg { display: flex; align-items: center; gap: 22px; width: 380px; margin: -50px 0 0 -190px; }
.c-gdg svg { width: 150px; height: 86px; flex: none; }
.c-gdg span { font: 400 25px/1.12 var(--sans); letter-spacing: -.005em; }
.c-label { display: flex; align-items: center; gap: 18px; height: 56px; margin-top: -28px; white-space: nowrap; }
.c-label b { display: grid; place-items: center; height: 52px; min-width: 76px; padding: 0 16px; border: var(--line) solid var(--ink); border-radius: 999px; background: var(--sec, var(--paper)); font: 400 26px/1 var(--mono); }
.c-label span { font: 300 27px/1 var(--mono); letter-spacing: -.01em; }
.c-devfest { left: 110px; top: 100px; }
.c-year { font: 300 150px/1 var(--mono); letter-spacing: -.03em; margin: -75px 0 0 -190px; width: 380px; text-align: center; }
.c-arrow { left: 690px; top: 138px; width: 270px; height: 100px; }
.c-globe { left: 1010px; top: 112px; width: 152px; height: 152px; }
.c-arrow path, .c-globe * { fill: none; stroke: var(--ink); stroke-width: 2.6; }

.devfest { display: grid; grid-template-columns: 58px auto 58px; align-items: center; column-gap: 20px; }
.devfest svg.brace { width: 58px; height: 150px; }
.devfest svg.brace.r { transform: scaleX(-1); }
.devfest .df-word { font: 700 98px/.9 var(--sans); letter-spacing: -.01em; margin: 0 0 14px; }
.devfest .df-loc { display: grid; place-items: center; height: 48px; border: var(--line) solid var(--ink); border-radius: 999px; background: var(--paper); font: 400 24px/1 var(--sans); }

/* ---------- type ---------- */
.h-xl { font: 700 210px/.92 var(--sans); letter-spacing: -.012em; margin: 0; }
.h-l { font: 700 104px/1 var(--sans); letter-spacing: -.012em; margin: 0; }
.h-m { font: 700 76px/1.06 var(--sans); letter-spacing: -.008em; margin: 0; }
.h-s { font: 700 50px/1.12 var(--sans); letter-spacing: -.004em; margin: 0; }
.t-sub { font: 300 31px/1.4 var(--mono); letter-spacing: -.015em; margin: 0; color: var(--ink); }
.t-body { font: 400 34px/1.3 var(--sans); margin: 0; }
.t-small { font: 400 26px/1.35 var(--sans); margin: 0; }
.t-cite { font: 300 21px/1.4 var(--mono); color: var(--ink-2); margin: 0; letter-spacing: -.01em; }
.mono { font-family: var(--mono); }

/* ---------- template components ---------- */
.box { background: var(--paper); border: var(--line) solid var(--ink); border-radius: 30px; }
.pill { display: inline-flex; align-items: center; justify-content: center; gap: 12px; padding: 0 30px; height: 64px; border: var(--line) solid var(--ink); border-radius: 999px; background: var(--paper); font: 400 28px/1 var(--sans); white-space: nowrap; }
.tag { display: inline-flex; align-items: center; gap: 10px; padding: 12px 22px; border: var(--line) solid var(--ink); border-radius: 16px; font: 500 26px/1.15 var(--sans); background: var(--paper); }
.fill-blue { background: var(--blue-p); } .fill-green { background: var(--green-p); } .fill-yellow { background: var(--yellow-p); } .fill-red { background: var(--red-p); }
.fill-blue-h { background: var(--blue-h); } .fill-green-h { background: var(--green-h); } .fill-yellow-h { background: var(--yellow-h); } .fill-red-h { background: var(--red-h); }
.dots { display: flex; gap: 30px; }
.dots i { width: 112px; height: 112px; border-radius: 50%; border: var(--line) solid var(--ink); background: var(--c, var(--blue)); }
.ill { fill: none; stroke: var(--ink); stroke-width: 2.6; stroke-linejoin: round; stroke-linecap: round; }
.caret { display: inline-block; width: 3px; height: 1.05em; margin-left: 2px; vertical-align: -.14em; background: currentColor; animation: blink 1s steps(1) infinite; }
@keyframes blink { 50% { opacity: 0; } }

html[data-black]::after { content: ''; position: fixed; inset: 0; background: #000; z-index: 90; }

/* ---------- HUD (Cmd/Ctrl+S) ---------- */
#hud {
  position: fixed; left: 50%; bottom: 26px; z-index: 80; translate: -50% 20px; opacity: 0; pointer-events: none;
  display: flex; align-items: center; gap: 4px; padding: 8px; border-radius: 999px;
  background: var(--paper); color: var(--ink); border: 2px solid var(--ink);
  font: 500 15px/1 var(--sans); transition: opacity .25s ease, translate .35s cubic-bezier(.2,.8,.2,1);
}
html[data-hud] #hud { opacity: 1; translate: -50% 0; pointer-events: auto; }
#hud button { all: unset; cursor: pointer; height: 40px; min-width: 40px; padding: 0 14px; border-radius: 999px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; white-space: nowrap; }
#hud button:hover { background: var(--off); }
#hud button:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }
#hud svg { width: 18px; height: 18px; display: block; flex: none; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
#hud .meta { display: flex; align-items: center; gap: 12px; padding: 0 12px; min-width: 300px; }
#hud [data-count] { font: 400 14px/1 var(--mono); color: var(--ink-2); white-space: nowrap; }
#hud [data-title] { max-width: 340px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#hud .sep { width: 1px; height: 22px; background: #D5D3CF; }

#overview {
  position: fixed; inset: 36px 36px 104px; z-index: 79; columns: 3 300px; column-gap: 28px;
  padding: 24px 32px 10px; border-radius: 28px; opacity: 0; pointer-events: none; overflow: auto;
  background: var(--paper); border: 2px solid var(--ink); transition: opacity .25s ease;
}
html[data-mode=presenter] #overview { inset: 92px 18px 18px; z-index: 95; }
html[data-overview] #overview { opacity: 1; pointer-events: auto; }
.ov-hint { column-span: all; margin: 0 0 18px 14px; font: 400 15px/1.4 var(--mono); color: var(--ink-2); }
.ov-group { break-inside: avoid; padding-bottom: 16px; }
.ov-group h4 { display: flex; align-items: center; gap: 10px; margin: 0 0 2px; padding: 6px 14px; font: 600 15px/1.3 var(--sans); color: var(--ink-2); }
.ov-group h4 i { flex: none; width: 14px; height: 14px; border-radius: 4px; border: 1.5px solid var(--ink); }
.ov-group h4 span { font: 400 14px/1 var(--mono); }
#overview button { all: unset; cursor: pointer; display: flex; gap: 14px; width: 100%; box-sizing: border-box; padding: 10px 14px; border-radius: 14px; font: 450 17px/1.3 var(--sans); }
#overview button span { font: 400 14px/1.6 var(--mono); color: var(--ink-3); min-width: 26px; }
#overview button:hover { background: var(--off); }
#overview button[data-on] { background: var(--blue-p); }
#overview button:focus-visible { outline: 2px solid var(--blue); }

#goto {
  position: fixed; left: 50%; top: 26px; z-index: 96; translate: -50% -8px; opacity: 0; pointer-events: none;
  display: flex; align-items: center; gap: 10px; padding: 12px 14px 12px 22px; border-radius: 999px;
  background: var(--ink); color: #fff; font: 500 19px/1 var(--sans); transition: opacity .2s ease, translate .25s ease;
}
html[data-goto] #goto { opacity: 1; translate: -50% 0; }
html[data-mode=presenter] #goto { left: 30%; top: 116px; }
#goto b { font: 500 22px/1 var(--mono); }
#goto kbd { margin-left: 4px; padding: 5px 9px; border-radius: 8px; border: 1.5px solid rgba(255,255,255,.45); font: 400 13px/1 var(--mono); }

/* ---------- presenter view (?presenter) ---------- */
#pv { display: none; }
html[data-mode=presenter], html[data-mode=presenter] body { background: #E9E7E3; overflow: hidden; }
html[data-mode=presenter] #pv {
  display: grid; position: fixed; inset: 0; padding: 18px; gap: 16px;
  grid-template-columns: minmax(0, 1.42fr) minmax(360px, 1fr); grid-template-rows: auto minmax(0, 1fr) auto;
  grid-template-areas: "bar bar" "live notes" "next notes";
  font-family: var(--sans); color: var(--ink);
}
.pv-bar { grid-area: bar; display: flex; align-items: center; gap: 14px; padding: 6px 6px 6px 18px; background: var(--paper); border: 2px solid var(--ink); border-radius: 999px; }
.pv-bar .pv-n { font: 400 15px/1 var(--mono); color: var(--ink-2); cursor: pointer; }
.pv-bar .pv-title { cursor: pointer; font: 600 19px/1.2 var(--sans); flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pv-bar .pv-steps { display: flex; gap: 5px; }
.pv-bar .pv-steps i { width: 10px; height: 10px; border-radius: 50%; border: 1.5px solid var(--ink); }
.pv-bar .pv-steps i[data-done] { background: var(--ink); }
.pv-bar .pv-steps i[data-now] { background: var(--green); }
.pv-time { display: flex; align-items: baseline; gap: 8px; font: 400 26px/1 var(--mono); padding: 0 6px; cursor: pointer; border-radius: 10px; }
.pv-time small { font-size: 15px; color: var(--ink-2); }
.pv-time[data-warn] { color: #B06000; } .pv-time[data-over] { color: var(--red); }
.pv-clock { font: 300 18px/1 var(--mono); color: var(--ink-2); }
.pv-link { display: inline-flex; align-items: center; gap: 8px; font: 500 15px/1 var(--sans); white-space: nowrap; }
.pv-link[hidden], .pv-key[hidden] { display: none; }
.pv-key { display: inline-flex; gap: 8px; }
.pv-key input { all: unset; box-sizing: border-box; height: 44px; width: 170px; padding: 0 18px; border: 2px solid var(--ink); border-radius: 999px; background: var(--paper); font: 500 16px/1 var(--sans); }
.pv-key input::placeholder { color: var(--ink-3); }
html[data-link=nokey] .pv-link i { background: var(--paper); }
.pv-link i { width: 10px; height: 10px; border-radius: 50%; border: 1.5px solid var(--ink); background: var(--yellow); }
html[data-link=on] .pv-link i { background: var(--green); }
html[data-link=off] .pv-link i, html[data-link=key] .pv-link i { background: var(--red); }
.pv-bar button { all: unset; cursor: pointer; height: 44px; padding: 0 18px; border-radius: 999px; display: inline-flex; align-items: center; gap: 8px; font: 500 16px/1 var(--sans); border: 2px solid var(--ink); background: var(--paper); }
.pv-bar button:hover { background: var(--off); }
.pv-bar button.pv-go { background: var(--ink); color: #fff; }
.pv-live { grid-area: live; position: relative; min-height: 0; border-radius: 18px; overflow: hidden; background: var(--off); border: 2px solid var(--ink); }
html[data-mode=presenter] #stage { position: absolute; }
.pv-next { grid-area: next; display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 16px; align-items: start; }
.pv-next .pv-thumb { position: relative; width: 300px; aspect-ratio: 16 / 9; border-radius: 12px; overflow: hidden; border: 2px solid var(--ink); background: var(--off); }
.pv-next iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; pointer-events: none; }
.pv-next .pv-end { position: absolute; inset: 0; display: none; place-items: center; font: 400 16px/1 var(--mono); color: var(--ink-2); }
.pv-next[data-end] .pv-end { display: grid; } .pv-next[data-end] iframe { visibility: hidden; }
.pv-next p { margin: 4px 0 0; font: 400 15px/1.4 var(--mono); color: var(--ink-2); }
.pv-next h3 { margin: 4px 0 0; font: 600 20px/1.25 var(--sans); }
.pv-notes { grid-area: notes; position: relative; overflow: auto; padding: 26px 30px 40vh; background: var(--paper); border: 2px solid var(--ink); border-radius: 18px; scroll-behavior: smooth; }
.pv-notes .n { padding: 14px 18px 16px; margin: 0 -18px 6px; border-radius: 14px; transition: background .3s, opacity .3s; }
.pv-notes .n[data-past] { opacity: .45; }
.pv-notes .n[data-now] { background: var(--yellow-p); }
.pv-notes .cue { display: block; margin: 0 0 8px; font: 500 14px/1.3 var(--mono); color: var(--ink-2); }
.pv-notes .cue::before { content: '▸ click: '; color: var(--ink); }
.pv-notes .n:first-child .cue::before { content: '▸ on screen: '; }
.pv-notes p { margin: 0 0 12px; font: 400 21px/1.5 var(--sans); }
.pv-notes p:last-child { margin-bottom: 0; }
.pv-notes b { font-weight: 650; }
.pv-notes .src { font: 400 15px/1.45 var(--mono); color: var(--ink-2); }
