@font-face {
  font-family: 'Kenney Future';
  src: url('../assets/fonts/KenneyFuture.ttf') format('truetype');
  font-display: swap;
}

:root {
  --ink: #1d2230;
  --muted: #5d6475;
  --line: #dfe2ea;
  --card: #ffffff;
  --bg: #f4f5f8;
  --without: #c4473a;
  --with: #2f8f5b;
  --accent: #3a63d8;
  --hud: 'Kenney Future', system-ui, sans-serif;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 15px/1.5 system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
}

#page { max-width: 720px; margin: 0 auto; padding: 16px 12px 28px; }

.intro h1 { font: 700 23px/1.25 system-ui, sans-serif; margin: 4px 0 8px; letter-spacing: .01em; }
.intro p { margin: 0 0 14px; color: var(--muted); }

.trick {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 14px 14px 12px;
  margin: 0 0 16px;
  scroll-margin-top: 12px;
}
.trick.highlight { box-shadow: 0 0 0 3px rgba(58, 99, 216, .35); }

.trick-head { display: flex; gap: 10px; align-items: flex-start; }
.num {
  flex: none; width: 28px; height: 28px; border-radius: 50%;
  background: var(--ink); color: #fff; display: grid; place-items: center;
  font: 700 14px system-ui, sans-serif; margin-top: 1px;
}
.trick h2 { font: 700 18px/1.3 system-ui, sans-serif; margin: 2px 0 2px; }
.lede { margin: 0; color: var(--muted); font-size: 14px; }
.watch { margin: 8px 0 10px; font-size: 13.5px; }
.watch span { font-weight: 600; }
.watch em { font-style: normal; color: var(--muted); }

.panes { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); grid-template-rows: auto auto auto; column-gap: 10px; }
.pane { margin: 0; min-width: 0; display: grid; grid-row: span 3; grid-template-rows: subgrid; grid-template-columns: minmax(0, 1fr); align-content: start; }
.pane-label {
  font-size: 12.5px; line-height: 1.3; margin-bottom: 5px;
  display: flex; gap: 4px 6px; align-items: center; flex-wrap: wrap; align-self: end;
}
.pane-label b { font: 12px var(--hud); text-transform: uppercase; letter-spacing: .04em; padding: 2px 6px 1px; border-radius: 4px; color: #fff; }
.left .pane-label b { background: var(--without); }
.right .pane-label b { background: var(--with); }
.pane-label .sub { color: var(--muted); }
.pane-label .chip { display: inline-block; font-size: 11px; padding: 0 5px; border-radius: 3px; background: #eef0f5; color: var(--muted); margin-right: 2px; }
.pane-label .chip.new { background: #dcf1e4; color: #1d6b41; font-weight: 600; }

.stage {
  position: relative; width: 100%; aspect-ratio: 320 / 220;
  border-radius: 8px; overflow: hidden; background: #2b2f3a;
}
.stage canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; touch-action: pan-y; }
.playing .stage canvas { touch-action: none; cursor: crosshair; }
.left .stage { box-shadow: inset 0 0 0 2px rgba(196, 71, 58, .0); }

figcaption { min-height: 5.6em; padding: 6px 2px 0; font-size: 13px; line-height: 1.35; }
.cap-now { display: block; font-weight: 600; }
.cap-prev { display: block; color: var(--muted); font-size: 12px; margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cap-now .t, .cap-prev .t { font-variant-numeric: tabular-nums; color: var(--muted); font-weight: 400; margin-right: 4px; font-size: 11.5px; }
.cap-now.fresh { animation: fresh .6s ease-out; }
@keyframes fresh { from { background: #fff4c2; } to { background: transparent; } }

.progress { height: 3px; background: #eceef3; border-radius: 2px; overflow: hidden; margin: 4px 0 10px; }
.progress i { display: block; height: 100%; width: 0; background: var(--accent); }

.controls { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.controls button {
  font: 600 13px system-ui, sans-serif; color: var(--ink);
  border: 1px solid var(--line); background: #fff; border-radius: 8px;
  padding: 7px 12px; cursor: pointer; min-height: 36px;
}
.controls button:hover { border-color: #b9bfcc; }
.controls button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.controls .play.on { background: var(--ink); color: #fff; border-color: var(--ink); }
.compare { display: inline-flex; align-items: center; gap: 0; font-size: 12.5px; color: var(--muted); }
.compare span { margin-right: 6px; }
.compare button { border-radius: 0; padding: 7px 9px; font-weight: 500; font-size: 12.5px; }
.compare button:first-of-type { border-radius: 8px 0 0 8px; }
.compare button:last-of-type { border-radius: 0 8px 8px 0; border-left: none; }
.compare button.on { background: #eef0f5; font-weight: 600; }
.solo-link { margin-left: auto; font-size: 12.5px; color: var(--accent); text-decoration: none; }
.play-help { margin: 8px 0 0; font-size: 12.5px; color: var(--muted); }

.credits { color: var(--muted); font-size: 12.5px; text-align: center; }
.credits a { color: inherit; }

/* Phones: stack Without above With so each room stays big enough to read. */
@media (max-width: 540px) {
  #page { padding: 10px 8px 20px; }
  .intro h1 { font-size: 19px; }
  .trick { padding: 12px 10px 10px; }
  .panes { grid-template-columns: minmax(0, 1fr); grid-template-rows: none; row-gap: 6px; }
  .pane { display: block; }
  .pane-label { margin-bottom: 4px; }
  figcaption { min-height: 4.4em; }
  .solo-link { margin-left: 0; }
}

/* ?trick=<id>&solo : just the one demo, for embedding. */
body.solo { background: transparent; }
body.solo #page { padding: 6px; }
body.solo .intro, body.solo .credits { display: none; }
body.solo .trick { margin: 0; }
body.solo .solo-link { display: none; }
