/*
 * Pizarra digital mode - see shared/pizarra.js. Every rule is scoped to
 * html.is-pizarra, which only that script sets, so loading this file costs
 * a normal visitor nothing.
 *
 * The body is laid out at the virtual size (--pz-w x --pz-h) and scaled by
 * --pz-scale to fill the screen. vw/vh units still measure the REAL screen,
 * so any rule sized with them that matters in a game gets a --pz-vw/--pz-vh
 * version here (or in that game's style.css).
 */

html.is-pizarra,
html.is-pizarra body {
  overflow: hidden;
  touch-action: pan-x pan-y; /* no pinch-zoom */
}
html.is-pizarra body {
  width: var(--pz-w);
  height: var(--pz-h);
  transform: scale(var(--pz-scale));
  transform-origin: 0 0;
}
html.is-pizarra #game { height: 100%; }

/* Keep the bottom-right corner free for the toolbox. */
html.is-pizarra .pad-area { padding-bottom: 66px; }

/* shell.css tutorial dialog: 100vh would be the real screen height */
html.is-pizarra .tut-panel { max-height: calc(var(--pz-vh) * 100 - 64px); }

/* ---- ink layer ---- */
.pz-ink {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 9000;
  pointer-events: none;
  touch-action: none;
}
html.pz-drawing .pz-ink { pointer-events: auto; cursor: crosshair; }

/* ---- toolbox, bottom-right ---- */
.pz-tools {
  position: fixed;
  right: 10px;
  bottom: 10px;
  z-index: 9001;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 6px;
  font-family: var(--am-readable-font, system-ui, sans-serif);
  touch-action: none;
}
.pz-bar,
.pz-fly {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 4px;
  background: #fff;
  border: 2px solid #6f4a86;
  border-radius: 14px;
  box-shadow: 0 3px 0 rgba(63, 38, 84, .25);
}
.pz-fly[hidden] { display: none; }
.pz-sep { width: 2px; align-self: stretch; margin: 6px 2px; background: #e4d6ec; border-radius: 2px; }
.pz-btn {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: #4b2d63;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.pz-btn svg { width: 26px; height: 26px; }
.pz-btn:hover { background: #f2e9f7; }
.pz-btn[aria-pressed="true"] { background: #6f4a86; color: #fff; }
.pz-btn:disabled { opacity: .35; cursor: default; background: transparent; }
.pz-btn:focus-visible { outline: 3px solid #ff9ec7; outline-offset: 1px; }
.pz-colour span {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--c);
  box-shadow: 0 0 0 2px #fff, 0 0 0 3px rgba(0, 0, 0, .15);
}
.pz-colour[aria-pressed="true"] { background: #f2e9f7; }
.pz-colour[aria-pressed="true"] span { box-shadow: 0 0 0 3px #fff, 0 0 0 5px #6f4a86; }
.pz-zoom-val {
  min-width: 3.4em;
  text-align: center;
  font-size: 16px;
  font-weight: 700;
  color: #4b2d63;
}

/* The cookie banner sits along the bottom until it's answered. */
html.is-pizarra body:has(.am-cn-banner) .pz-tools { bottom: 110px; }

/* ---- shared exercise UI (tablas, islas...): bigger than shell.css's caps ---- */
html.is-pizarra .equation { font-size: calc(var(--pz-vh) * 15); }
html.is-pizarra .answer-display { min-width: 220px; min-height: 90px; font-size: 60px; border-radius: 20px; }

/* ---- the columnar worksheet (sumas, multiplicar): size digits from the
   board's height instead of shell.css's 42px cap. Per-game tweaks live in
   each game's style.css under html.is-pizarra. ---- */
html.is-pizarra .worksheet {
  --digit: calc(var(--pz-vh) * 8.5);
  width: calc((var(--cols) + 1) * var(--digit) * 1.25); /* shell.css sizes it in rem */
}
