/* CodeYogi deck engine — shared look for every slide.
   The stage is always 1920×1080 and is scaled to fit the window. */
:root {
  --plum: #4a1030;
  --plum-deep: #27081a;
  --ivory: #f6e9cc;
  --cream: #fff4dc;
  --muted: rgba(255, 244, 220, 0.72);
  --walnut: #8a4a22;
  --walnut-dark: #5a2c10;
  --wheat: #f3b63b;
  --wheat-light: #ffd97a;
  --display: "Baloo 2", "Mukta", system-ui, sans-serif;
  --body: "Mukta", "Baloo 2", system-ui, sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  width: 100%; height: 100%;
  overflow: hidden;
  background: var(--plum-deep);
  color: var(--cream);
  font-family: var(--body);
}
body.idle { cursor: none; }

#stage {
  position: absolute; top: 0; left: 0;
  width: 1920px; height: 1080px;
  transform-origin: top left;
  overflow: hidden;
  background:
    radial-gradient(120% 90% at 30% 20%, #5e1a40 0%, var(--plum) 45%, var(--plum-deep) 100%);
}

.slide {
  position: absolute; inset: 0;
  padding: 120px 140px;
  visibility: hidden;
}
.slide.is-active { visibility: visible; }

/* Everything revealed by a "next" press starts hidden. */
.later { opacity: 0; visibility: hidden; }

/* Type scale (1920 wide). Devanagari needs taller lines. */
.display { font: 800 168px/1.15 var(--display); letter-spacing: -0.01em; }
.h1 { font: 800 112px/1.2 var(--display); }
.h2 { font: 700 80px/1.25 var(--display); }
.lead { font: 600 58px/1.4 var(--display); }
.body { font: 400 46px/1.5 var(--body); }
.small { font: 500 32px/1.4 var(--body); color: var(--muted); }
.wheat { color: var(--wheat); }

/* Brand line (title slide). */
.brand { display: flex; align-items: center; gap: 24px; color: var(--cream); }
.brand svg { width: 64px; height: 84px; color: var(--wheat); }
.brand span { font: 700 36px/1 var(--display); letter-spacing: 0.01em; }

/* Speech bubble. */
.bubble {
  position: relative;
  display: inline-block;
  max-width: 1100px;
  padding: 36px 48px;
  border-radius: 40px;
  background: var(--ivory);
  color: var(--plum-deep);
  font: 600 52px/1.4 var(--display);
}
.bubble::after {
  content: ""; position: absolute; width: 0; height: 0;
  border: 28px solid transparent;
}
.bubble.from-right::after { right: -40px; top: 60px; border-left-color: var(--ivory); border-right: 0; }
.bubble.from-left::after { left: -40px; top: 60px; border-right-color: var(--ivory); border-left: 0; }

/* Chessboard. 8×8, a1 bottom-left. A bevelled frame and a faint grain on every square. */
.board {
  position: relative;
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  grid-template-rows: repeat(8, 1fr);
  aspect-ratio: 1;
  padding: 14px;
  border-radius: 12px;
  background:
    linear-gradient(135deg, rgba(255,255,255,.14), rgba(0,0,0,.18)),
    var(--walnut-dark);
  box-shadow:
    0 40px 90px rgba(0, 0, 0, 0.5),
    0 4px 10px rgba(0, 0, 0, 0.3),
    inset 0 2px 0 rgba(255, 255, 255, 0.18),
    inset 0 -3px 0 rgba(0, 0, 0, 0.35);
}
.board::before {
  /* inner lip around the playing surface */
  content: ""; position: absolute; inset: 10px; border-radius: 6px; pointer-events: none;
  box-shadow: inset 0 0 0 2px rgba(0,0,0,.35), inset 0 0 18px rgba(0,0,0,.35);
  z-index: 2;
}
.sq { position: relative; display: grid; place-items: center; overflow: hidden; }
.sq::after {
  /* wood/stone grain: alternating hairlines, works on light and dark squares alike */
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background:
    repeating-linear-gradient(100deg, rgba(255,255,255,.07) 0 2px, transparent 2px 7px, rgba(0,0,0,.06) 7px 9px, transparent 9px 16px);
  mix-blend-mode: overlay;
}
.sq.light { background: linear-gradient(160deg, color-mix(in srgb, var(--ivory) 92%, white), color-mix(in srgb, var(--ivory) 88%, black)); }
.sq.dark { background: linear-gradient(160deg, color-mix(in srgb, var(--walnut) 90%, white), color-mix(in srgb, var(--walnut) 80%, black)); }
.sq .n {
  position: relative; z-index: 1;
  font: 700 26px/1 var(--display);
  color: var(--plum-deep);
  text-align: center;
  padding: 4px;
}
.sq.dark .n { color: var(--cream); }

/* Grains of wheat inside a square: two-tone, creased, each one slightly turned. */
.grains {
  position: absolute; inset: 6px; z-index: 1;
  display: flex; flex-wrap: wrap; align-content: center; justify-content: center;
  gap: 3px;
}
.grain {
  --g: var(--wheat);
  width: 12px; height: 18px;
  border-radius: 50% 50% 50% 50% / 60% 60% 40% 40%;
  background:
    linear-gradient(90deg, transparent 46%, rgba(0,0,0,.28) 47%, rgba(0,0,0,.28) 53%, transparent 54%),
    linear-gradient(160deg, color-mix(in srgb, var(--g) 70%, white), var(--g) 55%, color-mix(in srgb, var(--g) 65%, black));
  box-shadow: 0 2px 2px rgba(0, 0, 0, 0.45), inset 0 1px 0 rgba(255,255,255,.35);
  transform: rotate(var(--r, 0deg));
}
.grains.tiny .grain { width: 6px; height: 8px; }
.grains.tiny { gap: 1px; inset: 4px; }

/* Characters (linocut: body in --cream, details in --plum-deep, accent in --wheat). */
.figure-svg { width: 400px; height: 500px; filter: drop-shadow(0 24px 40px rgba(0,0,0,.35)); }

/* Crown + pawn icons. */
.icon-crown { width: 320px; height: 240px; color: var(--wheat); }
.icon-pawn { width: 220px; height: 320px; color: var(--ivory); }

/* Help overlay + counter (engine chrome). */
#counter {
  position: absolute; right: 40px; bottom: 28px;
  font: 500 24px/1 var(--body); color: var(--muted); opacity: 0.6;
}
#help {
  position: absolute; inset: 0; display: none;
  background: rgba(20, 4, 12, 0.92);
  padding: 140px 180px;
  font: 400 40px/1.6 var(--body);
}
#help.open { display: block; }
#help h2 { font: 800 72px/1.2 var(--display); margin-bottom: 30px; }
#help kbd {
  display: inline-block; min-width: 1.6em; padding: 0 0.5em; margin-right: 0.3em;
  border-radius: 10px; background: var(--ivory); color: var(--plum-deep);
  font: 700 32px/1.6 var(--display); text-align: center;
}
#error {
  position: absolute; inset: 0; display: none; place-items: center;
  padding: 120px; text-align: center;
  font: 500 44px/1.5 var(--body);
}
#error.open { display: grid; }
