@font-face { font-family: Archivo; src: url(/fonts/archivo-latin.woff2) format("woff2"); font-weight: 100 900; font-display: swap; }
@font-face { font-family: "Permanent Marker"; src: url(/fonts/permanent-marker-latin.woff2) format("woff2"); font-weight: 400; font-display: swap; }

:root {
  --paper: #f5f1e8;
  --paper-2: #fbfaf6;
  --rule: #d9e2f2;
  --ink: #1d2433;
  --ink-soft: #4a5263;
  --pen: #2b4bd1;
  --tape: #ecdcb0;
  --marker: #ffd23f;
  --brick: #b8553a;
  --line: #1d2433;
  --radius: 14px;
  --gutter: clamp(16px, 4vw, 40px);
  --maxw: 1100px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 72px; }
body {
  margin: 0;
  background-color: var(--paper);
  background-image: repeating-linear-gradient(to bottom, transparent 0 31px, var(--rule) 31px 32px);
  color: var(--ink);
  font: 400 17px/1.55 Archivo, system-ui, sans-serif;
}
img, svg, canvas { max-width: 100%; display: block; }
a { color: var(--pen); }
h1, h2, h3 { margin: 0; line-height: 1.05; }
h1 { font-weight: 900; font-size: clamp(40px, 5.4vw, 74px); letter-spacing: -0.03em; }
h2 { font-weight: 800; font-size: clamp(26px, 4vw, 38px); margin-bottom: 18px; }
h3 { font-weight: 800; font-size: 19px; }
.hidden { display: none !important; }

.tape {
  display: inline-block;
  background: var(--tape);
  font-family: "Permanent Marker", cursive;
  font-weight: 400;
  padding: 4px 14px 2px;
  box-shadow: 0 1px 0 rgba(0,0,0,.08);
  clip-path: polygon(2% 0, 98% 4%, 100% 96%, 0 100%);
}
.tape-tilt { transform: rotate(-3deg); margin-bottom: 14px; font-size: 18px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  background: var(--ink); color: var(--paper-2);
  border: 2px solid var(--ink); border-radius: 999px;
  padding: 12px 22px; font: 800 16px Archivo, sans-serif;
  text-decoration: none; cursor: pointer;
  box-shadow: 3px 3px 0 var(--marker);
  transition: transform .12s ease, box-shadow .12s ease;
}
.btn:hover { transform: translate(-1px, -1px); box-shadow: 4px 4px 0 var(--marker); }
.btn:active { transform: translate(2px, 2px); box-shadow: 1px 1px 0 var(--marker); }
.btn-ghost { background: transparent; color: var(--ink); }
.btn-sm { padding: 8px 16px; font-size: 14px; }
.btn:disabled { opacity: .5; cursor: default; }

.top {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 12px var(--gutter);
  background: rgba(245, 241, 232, .92);
  backdrop-filter: blur(6px);
  border-bottom: 2px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 8px; color: var(--ink); text-decoration: none; font-weight: 800; }
.brand-ball { width: 26px; height: 26px; }
.brand b { font-family: "Permanent Marker", cursive; font-weight: 400; }
.nav { display: flex; gap: 18px; }
.nav a { color: var(--ink); text-decoration: none; font-weight: 600; font-size: 15px; }
.nav a:hover { text-decoration: underline; text-decoration-color: var(--marker); text-decoration-thickness: 4px; }
@media (max-width: 820px) { .nav { display: none; } }

main > section { max-width: var(--maxw); margin: 0 auto; padding: 0 var(--gutter); }
.section { padding-top: 72px !important; padding-bottom: 8px; }
.section-lede { margin: -6px 0 22px; color: var(--ink-soft); max-width: 640px; }

.hero {
  display: grid; grid-template-columns: 1.05fr 1fr; gap: 32px; align-items: center;
  padding-top: 48px !important;
}
@media (max-width: 860px) { .hero { grid-template-columns: 1fr; } .hero-art { order: -1; max-width: 420px; margin: 0 auto; } }
.year { font-family: "Permanent Marker", cursive; font-size: 26px; margin: 6px 0 18px; color: var(--brick); }
.lede { font-size: 19px; margin: 0 0 12px; max-width: 520px; }
.lede-big { font-size: 23px; line-height: 1.35; color: var(--ink); }
.rule-chip { display: inline-grid; gap: 2px; margin: 4px 0 16px; padding: 10px 16px; background: var(--marker); border: 2px solid var(--line); border-radius: 10px; box-shadow: 3px 3px 0 var(--line); transform: rotate(-1deg); }
.rule-chip b { font-size: 19px; }
.rule-chip span { font-size: 15px; color: var(--ink-soft); }
@media (max-width: 560px) { .lede-big { font-size: 20px; } .rule-chip b { font-size: 17px; } }
.counter {
  background: var(--paper-2); border: 2px solid var(--line); border-radius: var(--radius);
  padding: 18px 20px; margin: 22px 0; max-width: 480px;
  box-shadow: 5px 5px 0 var(--ink);
}
.counter-num { display: flex; align-items: baseline; gap: 10px; font-weight: 900; font-size: clamp(40px, 7vw, 58px); line-height: 1; font-variant-numeric: tabular-nums; }
.counter-num small { font-size: 16px; font-weight: 600; color: var(--ink-soft); }
.bar { height: 14px; border: 2px solid var(--line); border-radius: 999px; margin: 14px 0 8px; overflow: hidden; background: #fff; }
.bar span { display: block; height: 100%; width: 0; background: var(--marker); transition: width 1.2s cubic-bezier(.2,.8,.2,1); }
.counter-sub { margin: 0; font-size: 14px; color: var(--ink-soft); }
.cta-row { display: flex; flex-wrap: wrap; gap: 12px; }

.house-svg { width: 100%; height: auto; overflow: visible; }
.art-note { text-align: center; font-size: 13px; color: var(--ink-soft); margin: 6px 0 0; }
.drop-ball { animation: drop 1.6s cubic-bezier(.5,0,.75,0) .4s both; transform-box: fill-box; transform-origin: center; }
@keyframes drop {
  0% { transform: translate(0, 0) rotate(0); opacity: 0; }
  10% { opacity: 1; }
  80% { transform: translate(-8px, 150px) rotate(220deg); }
  90% { transform: translate(-12px, 140px) rotate(250deg); }
  100% { transform: translate(-14px, 150px) rotate(270deg); }
}
@media (prefers-reduced-motion: reduce) { .drop-ball { animation: none; opacity: 0; } html { scroll-behavior: auto; } }

.how ol { list-style: none; padding: 0; margin: 56px 0 0; display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }
@media (max-width: 720px) { .how ol { grid-template-columns: 1fr; } }
.how li { background: var(--paper-2); border: 2px solid var(--line); border-radius: var(--radius); padding: 18px; }
.how p { margin: 6px 0 0; color: var(--ink-soft); }
.step { display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; background: var(--marker); border: 2px solid var(--line); font-weight: 900; margin-bottom: 10px; }

.roof-photo { margin: 0; border: 2px solid var(--line); border-radius: var(--radius); overflow: hidden; background: var(--paper-2); aspect-ratio: 4 / 3; max-width: 820px; }
.roof-photo img { width: 100%; height: 100%; object-fit: cover; }
.photo-empty { height: 100%; display: grid; place-items: center; color: var(--ink-soft); font-family: "Permanent Marker", cursive; font-size: 22px; padding: 20px; text-align: center; }
.photo-meta { color: var(--ink-soft); font-size: 15px; }

.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
@media (max-width: 720px) { .stats { grid-template-columns: repeat(2, 1fr); } }
.stat { background: var(--paper-2); border: 2px solid var(--line); border-radius: var(--radius); padding: 14px 16px; display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.stat .k { font-size: 13px; color: var(--ink-soft); font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }
.stat .v { font-size: clamp(22px, 3.4vw, 30px); font-weight: 900; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.stat .v.small { font-size: 16px; font-weight: 600; }
.fine { font-size: 14px; color: var(--ink-soft); }
/* the 50 big painted balls: one per full roof */
.score { margin-top: 34px; max-width: 820px; }
.score > p { margin: 8px 0 0; }
.score > p:first-of-type { color: var(--ink-soft); max-width: 640px; }
.big-balls { list-style: none; padding: 0; margin: 18px 0 6px; display: grid; grid-template-columns: repeat(10, 1fr); gap: 10px; max-width: 620px; }
@media (max-width: 560px) { .big-balls { grid-template-columns: repeat(5, 1fr); max-width: 320px; } }
.bb { --c: #ccc; --e: var(--c); aspect-ratio: 1; border-radius: 50%; display: grid; place-items: center; font-size: 11px; font-weight: 800; font-variant-numeric: tabular-nums; color: var(--ink-soft); background: var(--paper-2); border: 2px dashed var(--e); }
.bb.done { color: var(--ink); border: 2px solid var(--line); background: radial-gradient(circle at 34% 30%, rgba(255,255,255,.55), transparent 42%), var(--c); }
.bb.next { color: var(--ink); border: 2px solid var(--line); background: conic-gradient(var(--c) var(--p, 0%), var(--paper-2) 0); }
.bb-last { scale: 1.18; }
.bb-red { --c: #e2533f; }
.bb-orange { --c: #f08c2e; }
.bb-yellow { --c: #ffd23f; --e: #d9ab12; }
.bb-green { --c: #49a85a; }
.bb-blue { --c: #3f78de; }
.bb-purple { --c: #8f57cc; }
.bb-pink { --c: #ee77ad; }
.bb-bronze { --c: #b8793f; }
.bb-silver { --c: #c5cad2; --e: #9aa1ab; }
.bb-gold { --c: #dcaa26; }
.bb-bronze.done, .bb-silver.done, .bb-gold.done { background: radial-gradient(circle at 34% 30%, rgba(255,255,255,.8), transparent 45%), linear-gradient(135deg, var(--c), color-mix(in srgb, var(--c), #000 22%)); }

.game { display: grid; grid-template-columns: minmax(0, 1fr) 260px; gap: 22px; align-items: start; }
@media (max-width: 760px) { .game { grid-template-columns: 1fr; } .game-side { order: -1; display: grid; grid-template-columns: 130px 1fr; gap: 4px 14px; align-items: center; } .game-side .side-label, .game-side .fine { grid-column: 1 / -1; } }
.game-stage { position: relative; }
.scene { width: 100%; height: auto; aspect-ratio: 4 / 3; border: 3px solid var(--line); border-radius: 12px; background: #fff; touch-action: none; cursor: grab; }
.game-overlay { position: absolute; inset: 0 0 76px; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; gap: 10px; padding: 20px; background: rgba(251, 250, 246, .94); border-radius: 12px; }
.game-overlay p { margin: 0; font-size: 15px; color: var(--ink-soft); max-width: 420px; }
.mute-btn { position: absolute; top: 8px; right: 8px; z-index: 2; width: 36px; height: 36px; border: 2px solid var(--line); border-radius: 50%; background: rgba(255,255,255,.9); font-size: 16px; line-height: 1; cursor: pointer; }
.levels { display: inline-flex; gap: 4px; padding: 4px; margin: 2px auto 12px; background: var(--paper); border: 2px solid var(--line); border-radius: 999px; }
.levels button { font: 700 14px/1 Archivo, sans-serif; color: var(--ink); background: none; border: 0; border-radius: 999px; padding: 9px 16px; min-height: 36px; cursor: pointer; }
.levels button[aria-checked="true"] { background: var(--ink); color: var(--paper-2); }
.levels button:focus-visible { outline: 3px solid var(--marker); outline-offset: 2px; }
.overlay-actions { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; margin-top: 4px; }
.overlay-cta { margin-top: 12px; padding: 14px 22px 18px; display: grid; justify-items: center; gap: 8px; background: var(--marker); border: 2px solid var(--line); border-radius: var(--radius); box-shadow: 5px 5px 0 var(--line); transform: rotate(-1deg); max-width: 460px; }
.overlay-cta p { color: var(--ink) !important; }
.cta-title { font: 400 26px "Permanent Marker", cursive !important; color: var(--ink) !important; }
.btn-help { background: var(--brick); border-color: var(--line); color: #fff; font-size: 19px; padding: 14px 30px; box-shadow: 4px 4px 0 var(--line); animation: help-pulse 2.4s ease-in-out infinite; }
.btn-help:hover { box-shadow: 5px 5px 0 var(--line); }
.btn-help:active { box-shadow: 1px 1px 0 var(--line); }
.btn-help .heart { display: inline-block; margin-right: 8px; }
@keyframes help-pulse { 0%, 70%, 100% { scale: 1; } 80% { scale: 1.06; } 90% { scale: .99; } }
.confetti { position: absolute; inset: 0; z-index: 3; width: 100%; height: 100%; pointer-events: none; }
@media (prefers-reduced-motion: reduce) { .btn-help { animation: none; } }
/* phones (and phones held sideways): the overlay also covers the (disabled) Throw button so the end screen fits without cutting anything */
@media (max-width: 560px), (max-height: 500px) {
  .game-overlay { inset: 0; gap: 6px; padding: 12px; overflow-y: auto; justify-content: safe center; }
  .game-overlay:not(.hidden) + .throw-btn { visibility: hidden; }
  .game-overlay:not(.hidden) ~ .mute-btn { display: none; }
  .game-overlay p { font-size: 14px; }
  .levels { margin: 0 auto 4px; }
  .overlay-cta { margin-top: 2px; padding: 8px 12px 12px; gap: 4px; box-shadow: 3px 3px 0 var(--line); }
  .btn-help { font-size: 17px; padding: 10px 22px; }
  .cta-title { font-size: 20px !important; }
}
@media (max-width: 420px) {
  .game-overlay { gap: 4px; padding: 8px 10px; }
  .game-overlay h3 { font-size: 19px; }
  .game-overlay p { font-size: 13px; line-height: 1.35; }
  .game-overlay .btn { padding: 8px 16px; font-size: 15px; }
  .game-overlay .btn-help { padding: 10px 22px; font-size: 16px; }
  .levels button { padding: 6px 12px; min-height: 32px; }
  .cta-title { font-size: 18px !important; }
}
.throw-btn { width: 100%; margin-top: 12px; padding: 18px; font-size: 22px; letter-spacing: .04em; text-transform: uppercase; }
.side-label { margin: 0 0 6px; font-family: "Permanent Marker", cursive; font-size: 18px; }
.blueprint { width: 100%; height: auto; aspect-ratio: 12 / 11; }
.game-readout { display: grid; gap: 8px; margin-top: 12px; }
.game-readout > div { display: flex; justify-content: space-between; gap: 10px; border-bottom: 1px dashed var(--ink-soft); padding-bottom: 6px; }
.game-readout .k { color: var(--ink-soft); }
.game-readout .v { font-weight: 800; font-variant-numeric: tabular-nums; }

.poll { display: grid; gap: 10px; max-width: 720px; margin-bottom: 28px; }
.poll-opt { position: relative; display: flex; justify-content: space-between; gap: 12px; text-align: left; width: 100%; padding: 14px 16px; border: 2px solid var(--line); border-radius: var(--radius); background: var(--paper-2); font: 600 16px Archivo, sans-serif; color: var(--ink); cursor: pointer; overflow: hidden; }
.poll-opt .fill { position: absolute; inset: 0 auto 0 0; width: 0; background: var(--tape); transition: width .8s ease; z-index: 0; }
.poll-opt span { position: relative; z-index: 1; }
.poll-opt.mine { box-shadow: 4px 4px 0 var(--marker); }
.poll-opt .pct { font-variant-numeric: tabular-nums; font-weight: 800; }
.suggest { max-width: 720px; display: grid; gap: 10px; }
.suggest label { display: grid; gap: 8px; font-weight: 600; }
textarea, input { width: 100%; font: 400 16px Archivo, sans-serif; color: var(--ink); background: #fff; border: 2px solid var(--line); border-radius: 10px; padding: 10px 12px; }
textarea:focus, input:focus { outline: 3px solid var(--marker); outline-offset: 1px; }
.suggest-row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.suggest-row input[name="name"] { flex: 1 1 200px; }
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; }
.form-msg { margin: 0; min-height: 1.4em; font-size: 15px; }

.feed { display: grid; gap: 14px; margin-top: 26px; max-width: 760px; }
.post { background: var(--paper-2); border: 2px solid var(--line); border-radius: var(--radius); padding: 14px 16px; }
.post-head { display: flex; justify-content: space-between; gap: 10px; font-size: 14px; color: var(--ink-soft); margin-bottom: 6px; }
.post-head b { color: var(--ink); }
.post p { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.reply { margin-top: 10px; padding: 10px 12px; border-left: 4px solid var(--marker); background: var(--paper); font-size: 15px; }
.reply b { font-family: "Permanent Marker", cursive; font-weight: 400; }
.wall .post { transform: rotate(var(--tilt, 0deg)); }
.empty { color: var(--ink-soft); font-style: italic; }
.amount { background: var(--marker); color: var(--ink); border-radius: 999px; padding: 0 8px; font-weight: 800; }

.donate-cards { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; max-width: 760px; }
@media (max-width: 640px) { .donate-cards { grid-template-columns: 1fr; } }
.card { background: var(--paper-2); border: 2px solid var(--line); border-radius: var(--radius); padding: 18px; box-shadow: 5px 5px 0 var(--ink); }
.card p { color: var(--ink-soft); margin: 8px 0 14px; }
.soon { display: inline-block; font-family: "Permanent Marker", cursive; background: var(--tape); padding: 2px 12px; transform: rotate(-2deg); }

.rules details { max-width: 760px; border-bottom: 2px solid var(--line); padding: 14px 0; }
.rules summary { cursor: pointer; font-weight: 800; font-size: 18px; list-style: none; display: flex; justify-content: space-between; gap: 12px; }
.rules summary::-webkit-details-marker { display: none; }
.rules summary::after { content: "+"; font-family: "Permanent Marker", cursive; font-size: 22px; line-height: 1; }
.rules details[open] summary::after { content: "–"; }
.rules details p { margin: 10px 0 0; color: var(--ink-soft); }

.foot { margin-top: 96px; padding: 30px var(--gutter) 40px; border-top: 2px solid var(--line); text-align: center; overflow: hidden; }
.foot-big { margin: 0; font-weight: 900; font-size: clamp(56px, 16vw, 200px); line-height: .9; letter-spacing: -0.04em; color: transparent; -webkit-text-stroke: 2px var(--ink); }
/* the million, filled with paper balls */
@supports ((-webkit-background-clip: text) or (background-clip: text)) {
  .foot-big { background: url(/balls.svg) 0 0 / max(36px, .6em) auto; -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; }
}
.foot p:last-child { color: var(--ink-soft); font-size: 15px; }
.foot-line { margin: 14px 0 6px; font: 400 22px "Permanent Marker", cursive; color: var(--ink); }
/* tiny or sideways phones: the end screen drops the level picker (Play again keeps the last level) so "I want to help!" is never cut */
@media (max-width: 340px), (max-height: 500px) { .game-overlay.is-end .levels { display: none; } }
/* sideways phones: the whole game (roof, meter and Throw) fits on one screen under the sticky header */
@media (max-height: 500px) and (orientation: landscape) {
  .game { grid-template-columns: 1fr; }
  .game-stage { max-width: max(300px, calc((100svh - 150px) * 4 / 3)); margin-inline: auto; }
  .throw-btn { margin-top: 8px; padding: 12px; font-size: 18px; }
  /* there is width to spare and no height: the end screen spreads past the stage, result left, call to action right */
  .game-overlay.is-end { left: 50%; right: auto; width: min(calc(100vw - 32px), 720px); transform: translateX(-50%); display: grid; grid-template-columns: 1fr 1fr; align-content: center; gap: 6px 18px; border: 2px solid var(--line); }
  .game-overlay.is-end > :not(.overlay-cta) { grid-column: 1; }
  .game-overlay.is-end > .overlay-cta { grid-column: 2; grid-row: 1 / span 4; align-self: center; }
}
