/* Chunky toy-box style from the approved art test: rounded type, thick outlines, solid drop shadows. */
:root {
  --ink: #4a3560;
  --panel: #fffaf2;
  --pink: #ff6fae;
  --pink-soft: #ffd0e5;
  --gold: #ffe27a;
  --meadow: #86d474;
  --font: "Fredoka", ui-rounded, "Arial Rounded MT Bold", "Trebuchet MS", system-ui, sans-serif;
  color-scheme: light;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--meadow); color: var(--ink); font-family: var(--font); overflow: hidden; -webkit-user-select: none; user-select: none; -webkit-tap-highlight-color: transparent; -webkit-touch-callout: none; overscroll-behavior: none; touch-action: none; }
button { touch-action: manipulation; }
#stage { position: fixed; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; }

button { font: 600 20px/1 var(--font); color: var(--ink); background: #fff; border: 3px solid var(--ink); border-radius: 999px; padding: 14px 26px; box-shadow: 0 5px 0 var(--ink); cursor: pointer; touch-action: manipulation; transition: transform .06s, box-shadow .06s; min-height: 64px; }
button:active { transform: translateY(4px); box-shadow: 0 1px 0 var(--ink); }
button:focus-visible { outline: 4px solid var(--pink); outline-offset: 3px; }
button.big { font-size: 30px; padding: 18px 48px; background: var(--gold); }
button.small { font-size: 18px; }
button.round { width: 64px; height: 64px; padding: 0; display: grid; place-items: center; }

.screen { position: fixed; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 22px; padding: max(20px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right)) max(20px, env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left)); background: rgba(255, 250, 242, 0.55); text-align: center; }
.screen[hidden], #hud[hidden] { display: none; }
h1 { font-size: clamp(48px, 9vw, 96px); font-weight: 700; margin: 0; color: #fff; -webkit-text-stroke: 3px var(--ink); paint-order: stroke fill; text-shadow: 0 6px 0 var(--ink); letter-spacing: 1px; }
h2 { font-size: clamp(34px, 6vw, 60px); font-weight: 700; margin: 0; color: #fff; -webkit-text-stroke: 3px var(--ink); paint-order: stroke fill; text-shadow: 0 5px 0 var(--ink); }
.sub { font-size: 22px; font-weight: 600; margin: 0; background: var(--panel); border: 3px solid var(--ink); border-radius: 18px; padding: 6px 16px; }
.row { display: flex; gap: 16px; flex-wrap: wrap; justify-content: center; align-items: center; }

#colours { display: flex; gap: 14px; flex-wrap: wrap; justify-content: center; }
#colours button { width: 132px; height: 132px; padding: 0; border-radius: 28px; background: var(--panel); display: grid; place-items: center; }
#colours button[aria-checked="true"] { background: var(--pink-soft); box-shadow: 0 0 0 6px #fff, 0 0 0 9px var(--ink); transform: scale(1.06); }
#colours canvas { width: 116px; height: 116px; }

.maprow { display: flex; gap: 14px; flex-wrap: wrap; justify-content: center; }
.maprow button { padding: 8px; border-radius: 22px; display: flex; flex-direction: column; gap: 6px; align-items: center; background: var(--panel); }
.maprow canvas { width: 200px; height: 112px; display: block; }
.maprow span { font-size: 18px; }
#maps { gap: 16px; }
/* the poops on/off button: a picture of a poop, with a red "no" sign when off */
button.toggle { display: flex; align-items: center; gap: 8px; padding: 6px 18px 6px 8px; font-size: 18px; background: var(--panel); }
button.toggle .pic canvas { width: 56px; height: 56px; display: block; }
button.toggle[aria-pressed="false"] { background: #ece7f2; color: #8a7d99; }

#hud { position: fixed; inset: 0; pointer-events: none; }
#hud > * { pointer-events: auto; }
/* The herd bar: each team's share of all the unicorns, as widths. No numbers. */
.herdbar { display: flex; height: 44px; border: 3px solid var(--ink); border-radius: 999px; overflow: hidden; background: var(--panel); box-shadow: 0 4px 0 var(--ink); }
#herdbar { position: absolute; top: calc(12px + env(safe-area-inset-top)); left: max(12px, env(safe-area-inset-left)); width: min(52vw, 560px); }
.herdbar.big { width: min(86vw, 640px); height: 64px; }
.seg { position: relative; height: 100%; transition: flex-grow .6s ease; display: grid; place-items: center; min-width: 0; overflow: visible; }
.seg + .seg { border-left: 3px solid var(--ink); }
.seg.white { background: repeating-linear-gradient(180deg, #fffdf7 0 8px, #ffe9f3 8px 10px, #fffdf7 10px 18px, #e8f6ff 18px 20px); }
.seg canvas { width: 40px; height: 40px; pointer-events: none; }
.herdbar.big .seg canvas { width: 58px; height: 58px; }
.seg.you { box-shadow: inset 0 0 0 4px #fff; }
.chip { display: flex; align-items: center; gap: 4px; background: var(--panel); border: 3px solid var(--ink); border-radius: 999px; padding: 2px 12px 2px 4px; font-weight: 700; font-size: 22px; font-variant-numeric: tabular-nums; }
.chip canvas { width: 40px; height: 40px; }
.chip.you { background: var(--gold); box-shadow: 0 4px 0 var(--ink); }
.hud-right { position: absolute; top: calc(10px + env(safe-area-inset-top)); right: max(12px, env(safe-area-inset-right)); display: flex; gap: 10px; }
.bars { display: block; width: 18px; height: 22px; border-left: 6px solid var(--ink); border-right: 6px solid var(--ink); }
#everyone { position: absolute; left: 50%; bottom: calc(14px + env(safe-area-inset-bottom)); transform: translateX(-50%); font-size: 26px; padding: 14px 36px; background: #fff; }
#everyone:active { transform: translateX(-50%) translateY(4px); }
#everyone .herd { display: none; }
#everyone[aria-pressed="true"] { background: var(--pink-soft); }

.celebrate { position: relative; width: min(80vw, 420px); height: min(40vw, 210px); margin-bottom: -40px; }
/* Six stripes, red outside to purple inside. farthest-side keeps them inside the box (until 2026-11-13
   the circle was measured to the far corner, which pushed orange and red out of sight; Valerie noticed). */
.celebrate .rainbow { position: absolute; inset: 0; border-radius: 420px 420px 0 0; background: radial-gradient(circle farthest-side at 50% 100%, transparent 34%, #b48cff 34% 44%, #7cc4ff 44% 54%, #8fe08a 54% 64%, #fff07a 64% 74%, #ffa53d 74% 84%, #ff5f5f 84% 94%, transparent 94%); animation: rise .9s cubic-bezier(.2,1.4,.4,1) both; }
.celebrate .spark { position: absolute; width: 26px; height: 26px; background: #fff6b0; clip-path: polygon(50% 0, 61% 39%, 100% 50%, 61% 61%, 50% 100%, 39% 61%, 0 50%, 39% 39%); animation: twinkle 1.2s ease-in-out infinite; }
@keyframes rise { from { transform: scale(.3) translateY(60px); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes twinkle { 0%, 100% { transform: scale(.4) rotate(0); opacity: .3; } 50% { transform: scale(1.2) rotate(45deg); opacity: 1; } }
#nightCounts { display: flex; gap: 12px; flex-wrap: wrap; justify-content: center; }
#nightCounts .chip { font-size: 30px; padding: 4px 18px 4px 6px; }
#nightCounts .chip canvas { width: 64px; height: 64px; }
#nightCounts .chip.win { background: var(--gold); transform: scale(1.12); }

/* Phones held sideways (short screens): a smaller HUD so the meadow gets more of the screen.
   Tap targets stay at least 52px. iPads are 744px tall or more and never match. */
@media (max-height: 500px) {
  button.round { width: 52px; height: 52px; min-height: 52px; }
  .hud-right { top: calc(6px + env(safe-area-inset-top)); gap: 8px; }
  #herdbar { top: calc(8px + env(safe-area-inset-top)); height: 32px; width: min(44vw, 420px); }
  #herdbar .seg canvas { width: 30px; height: 30px; }
  /* "Everyone!" becomes a round herd button in the bottom-right corner, beside the field, so the field
     can use the full height (main.js checks it really is clear of the field, see chooseReserve) */
  #everyone { left: auto; transform: none; right: max(8px, env(safe-area-inset-right)); bottom: max(8px, env(safe-area-inset-bottom)); width: 56px; height: 56px; min-height: 56px; padding: 0; display: grid; place-items: center; }
  #everyone:active { transform: translateY(4px); }
  #everyone .word { display: none; }
  #everyone .herd { display: block; width: 44px; height: 44px; }
  #everyone .herd canvas { width: 44px; height: 44px; display: block; }
}

#fps { position: fixed; bottom: 8px; right: 8px; background: var(--panel); border: 2px solid var(--ink); border-radius: 999px; padding: 2px 10px; font-weight: 600; font-variant-numeric: tabular-nums; }
@media (prefers-reduced-motion: reduce) { button, .seg { transition: none; } .celebrate .rainbow, .celebrate .spark { animation: none; } }
