:root {
  --bg: #fbfaf6;
  --text: #1f2430;
  --muted: #5d6475;
  --line: #e4e0d6;
  --code-bg: #1f2430;
  --code-text: #e9edf5;
  --note-bg: #fff7db;
  --mono: ui-monospace, "Cascadia Code", "JetBrains Mono", Consolas, monospace;
}
.theme-orange { --accent: #f06a2a; --accent-soft: #fff0e6; }
.theme-blue { --accent: #2f7de1; --accent-soft: #e8f1fd; }
.theme-green { --accent: #0f9d72; --accent-soft: #e3f6ef; }
.theme-purple { --accent: #5b4bdb; --accent-soft: #efedfd; }

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--text);
  font: clamp(1.15rem, min(2.5vw, 4.2vh), 2.7rem)/1.4 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  overflow: hidden;
}

/* ===== Deck ===== */
.deck-progress { height: 6px; background: var(--accent-soft); flex-shrink: 0; }
.deck-progress span { display: block; height: 100%; width: 0; background: var(--accent); transition: width .25s; }
.deck { flex: 1; min-height: 0; position: relative; }
.slide { position: absolute; inset: 0; display: flex; overflow-y: auto; padding: 2.5vh clamp(16px, 4vw, 72px); }
.slide[hidden] { display: none; }
.slide-inner { width: 100%; max-width: 1500px; margin: auto; display: flex; flex-direction: column; gap: 2.2vh; animation: slide-in .3s ease-out; }
@keyframes slide-in { from { opacity: 0; transform: translateX(24px); } to { opacity: 1; transform: none; } }

/* ===== Title slides ===== */
.slide-title { background: radial-gradient(circle at 85% 15%, var(--accent-soft), transparent 55%), var(--bg); }
.slide-title .slide-inner { align-items: flex-start; }
.title-emoji { font-size: clamp(3rem, 9vw, 8rem); line-height: 1; }
.eyebrow { margin: 0; color: var(--accent); font-weight: 800; letter-spacing: .06em; text-transform: uppercase; font-size: .8em; }
.slide-title h1 { margin: 0; font-size: clamp(2rem, 5vw, 4.6rem); line-height: 1.1; color: var(--muted); }
.slide-title h1 span { color: var(--text); }
.big { margin: 0; font-size: clamp(2rem, 5vw, 4.2rem); }
.lead { margin: 0; max-width: 42ch; font-size: 1.15em; color: var(--muted); }

/* ===== Content slides ===== */
.slide-head { display: flex; align-items: center; gap: .6em; padding-bottom: 1.2vh; border-bottom: 4px solid var(--accent); }
.slide-head h2 { margin: 0; font-size: clamp(1.7rem, min(4vw, 6.5vh), 4.2rem); line-height: 1.15; }
.slide-emoji { font-size: 1.9em; line-height: 1; }
.slide-body { display: flex; flex-direction: column; gap: 2vh; }
.has-demo .slide-body { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr); gap: clamp(16px, 3vw, 48px); align-items: start; }
.slide-text > :first-child { margin-top: 0; }
.slide-text > :last-child { margin-bottom: 0; }
.slide-text p { margin: 0 0 .7em; }
.slide-text ul, .slide-text ol, .task-list, .reflection { margin: 0; padding-left: 1.3em; }
.slide-text li, .task-list li, .reflection li { margin-bottom: .45em; }
.slide-text li::marker, .task-list li::marker { color: var(--accent); font-weight: 800; }
.slide-text strong { color: var(--accent); }
.slide-text code, .cheat-grid code, .bonus code {
  padding: .05em .3em;
  border-radius: 8px;
  background: var(--accent-soft);
  color: var(--text);
  font-family: var(--mono);
  font-size: .9em;
}
.slide-text .big-idea {
  padding: .6em .9em;
  border-left: 8px solid var(--accent);
  border-radius: 12px;
  background: var(--accent-soft);
  font-weight: 700;
}
.slide-text .compare { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: .6em; }
.slide-text .compare > div { padding: .6em .8em; border-radius: 14px; background: #fff; border: 2px solid var(--line); }

.slide-demo { display: flex; flex-direction: column; gap: 1.5vh; min-width: 0; }
.slide-code {
  margin: 0;
  overflow-x: auto;
  padding: .8em 1em;
  border-radius: 16px;
  background: var(--code-bg);
  color: var(--code-text);
  font: clamp(.9rem, min(1.7vw, 2.9vh), 1.8rem)/1.45 var(--mono);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.slide-code-css { border-left: 8px solid #7dd3fc; }
.slide-preview { width: 100%; height: clamp(180px, 34vh, 520px); border: 3px solid var(--line); border-radius: 16px; background: #fff; }
.slide-preview-wide { height: clamp(260px, 62vh, 780px); }

.cheat-grid { margin: 0; padding: 0; list-style: none; display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 340px), 1fr)); gap: 1.5vh 2vw; }
.cheat-grid li { display: flex; flex-direction: column; gap: .2em; padding: .6em .8em; border-radius: 16px; background: #fff; border: 2px solid var(--line); }
.cheat-grid code { align-self: flex-start; color: var(--accent); word-break: break-word; }
.cheat-grid span { color: var(--muted); font-size: .85em; }
.bonus { margin: 0; padding: .6em .9em; border-radius: 14px; background: #f2efff; }
.reflection { font-size: 1.2em; }

/* ===== Teacher notes ===== */
.slide-note { display: none; padding: .6em .9em; border-radius: 14px; background: var(--note-bg); color: #5c4700; font-size: .72em; }
.slide-note::before { content: "💡 Подсказка: "; font-weight: 800; }
.guest-slide { margin: 0; padding: .5em .8em; border-radius: 12px; background: var(--note-bg); color: #5c4700; font-size: .7em; }
.credit { color: var(--muted); font-size: 14px; text-decoration: none; margin-right: 6px; }
.credit:hover { color: var(--accent); text-decoration: underline; }
.show-notes .slide-note { display: block; }

/* ===== Controls ===== */
.deck-controls {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px clamp(12px, 2vw, 24px);
  border-top: 1px solid var(--line);
  background: #fff;
  font-size: 16px;
}
.control {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 42px;
  min-height: 40px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  color: var(--text);
  font: inherit;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
}
.control:hover { background: var(--accent-soft); }
.control[aria-pressed="true"] { background: var(--note-bg); border-color: #e9c96b; }
.control:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.counter { min-width: 4.5em; text-align: center; font-weight: 700; color: var(--muted); }
.spacer { flex: 1; }

@media (max-width: 800px) {
  body { overflow: auto; }
  .has-demo .slide-body { grid-template-columns: 1fr; }
  .deck-controls { flex-wrap: wrap; }
}

/* ===== Print / PDF: one slide per page ===== */
@media print {
  @page { size: A4 landscape; margin: 10mm; }
  html, body { height: auto; overflow: visible; display: block; font-size: 15pt; }
  .deck-progress, .deck-controls { display: none; }
  .deck { position: static; }
  .slide, .slide[hidden] { position: relative; display: flex; min-height: 180mm; padding: 0; break-after: page; overflow: visible; }
  .slide-inner { animation: none; }
  .slide-preview { height: 70mm; }
  .slide-preview-wide { height: 140mm; }
  .slide-code { white-space: pre-wrap; font-size: 11pt; }
}
