:root {
  --sky: #0a0f2c;
  --cream: #f6e7c8;
  --dim: #c9b28a;
  --wood: #7a4e2b;
  --wood-lt: #946238;
  --wood-dk: #4d2f18;
  --wood-edge: #24140a;
  --pumpkin: #f2862a;
  --candle: #ffd86a;
  --vine: #5c8a2e;
  --soil: #2d1d13;
  --ink: #2b1a0c;
  --sol: #14f195;
  --red: #ff6a52;
  --px: 'Pixelify Sans', 'VT323', monospace;
  --vt: 'VT323', monospace;
  --knife: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='32' height='32' shape-rendering='crispEdges'%3E%3Cpath d='M1 31 L1 28 L14 15 L17 18 L4 31 Z' fill='%23e6ecf2'/%3E%3Cpath d='M1 31 L4 31 L17 18 L16 17 Z' fill='%238f99a5'/%3E%3Cpath d='M15 14 L18 17 L27 8 L24 5 Z' fill='%237a4a2a'/%3E%3Cpath d='M24 5 L27 8 L29 6 L26 3 Z' fill='%23523019'/%3E%3C/svg%3E") 1 31, crosshair;
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
html, body { margin: 0; }
body {
  background: var(--sky);
  color: var(--cream);
  font-family: var(--vt);
  font-size: 22px;
  line-height: 1.25;
  min-height: 100vh;
  overflow-x: hidden;
}
body.over-pumpkin { cursor: pointer; }
#scene {
  position: fixed; inset: 0; width: 100vw; height: 100vh; z-index: -2;
  image-rendering: pixelated; image-rendering: crisp-edges;
}
#fx { position: fixed; inset: 0; width: 100vw; height: 100vh; pointer-events: none; z-index: 60; }
body::before {
  content: ''; position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background: radial-gradient(ellipse at 50% 40%, transparent 55%, rgba(4, 4, 18, 0.55) 100%);
}
a { color: var(--candle); }
button { font: inherit; cursor: pointer; color: inherit; }
:focus-visible { outline: 3px dashed var(--candle); outline-offset: 3px; }
h1, h2 { font-family: var(--px); margin: 0; font-weight: 700; }
.vh { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* ---------- wood ---------- */
.sign, .panel, .tag, .btn, .cta, .tool, .hall-sign, .pot-tag, .toast, .stake {
  --plank: 38px;
  background:
    repeating-linear-gradient(180deg, transparent 0 calc(var(--plank) - 3px), rgba(20, 8, 2, 0.55) calc(var(--plank) - 3px) var(--plank)),
    repeating-linear-gradient(92deg, rgba(255, 220, 170, 0.035) 0 2px, transparent 2px 9px, rgba(0, 0, 0, 0.06) 9px 11px, transparent 11px 23px),
    linear-gradient(180deg, var(--wood-lt), var(--wood) 30%, var(--wood-dk));
  border: 3px solid var(--wood-edge);
  box-shadow: inset 0 2px 0 rgba(255, 210, 160, 0.25), inset 0 -3px 0 rgba(0, 0, 0, 0.3), 0 6px 0 var(--wood-edge), 0 14px 26px rgba(0, 0, 0, 0.55);
}

/* ---------- hero ---------- */
.hero {
  position: relative; min-height: 78vh; max-width: 1180px; margin: 0 auto;
  padding: 92px 24px 40px; display: flex; flex-direction: column; align-items: center; text-align: center;
}
.tags { position: absolute; top: 0; right: 24px; display: flex; gap: 14px; align-items: flex-start; }
.tag {
  --plank: 100px;
  position: relative; display: inline-block; margin-top: 34px; padding: 8px 14px 9px;
  font-family: var(--px); font-size: 17px; font-weight: 600; text-decoration: none; color: var(--cream);
  transform-origin: 50% -34px; transition: transform 0.25s;
}
.tag::before {
  content: ''; position: absolute; left: 50%; top: -37px; width: 2px; height: 34px; background: #c9b28a; transform: translateX(-50%);
}
.tag:hover { transform: rotate(-4deg); }
.tag:active { transform: rotate(3deg) translateY(2px); }
.tag-lit { color: #2a1405; background: linear-gradient(180deg, #ffb35a, var(--pumpkin) 40%, #c9611a); border-color: #5a2508; }

.hero-row { display: flex; align-items: flex-start; justify-content: center; gap: 48px; flex-wrap: wrap; width: 100%; }
.sign-wrap { position: relative; padding-top: 0; }
.rope { position: absolute; top: -92px; width: 4px; height: 96px; background: repeating-linear-gradient(180deg, #c9a46a 0 5px, #8f6a3a 5px 9px); }
.rope-l { left: 18%; } .rope-r { right: 18%; }
.sign {
  --plank: 52px;
  position: relative; padding: 22px 46px 20px; transform-origin: 50% -92px;
  animation: sway 6s ease-in-out infinite;
}
.sign:hover { animation-duration: 2.2s; }
.sign.knock { animation: knock 0.9s ease-out; }
@keyframes sway { 0%, 100% { transform: rotate(-1.4deg); } 50% { transform: rotate(1.4deg); } }
@keyframes knock { 0% { transform: rotate(0); } 20% { transform: rotate(-6deg); } 45% { transform: rotate(4deg); } 70% { transform: rotate(-2deg); } 100% { transform: rotate(0); } }
.sign h1 {
  font-size: clamp(48px, 9vw, 104px); line-height: 0.95; color: #ff9a2e; letter-spacing: 1px;
  text-shadow: 0 4px 0 #6e2a06, 4px 4px 0 #3a1503, -2px 2px 0 #3a1503, 0 0 28px rgba(255, 140, 40, 0.45);
}
.sign .ticker { display: block; margin-top: 8px; font-family: var(--px); font-size: 18px; color: var(--candle); opacity: 0.85; }
.sign::before, .sign::after {
  content: ''; position: absolute; top: 10px; width: 8px; height: 8px; background: #2a2b33; box-shadow: inset -2px -2px 0 #111, inset 2px 2px 0 #6a6c78;
}
.sign::before { left: calc(18% - 2px); } .sign::after { right: calc(18% - 2px); }

.pot { display: flex; flex-direction: column; align-items: center; margin-top: 6px; }
.cauldron { width: 150px; height: auto; image-rendering: pixelated; filter: drop-shadow(0 0 18px rgba(20, 241, 149, 0.35)); overflow: visible; }
.cauldron .b { fill: #5affc0; animation: bubble 2.4s ease-in infinite; }
.cauldron .b2 { animation-delay: 0.8s; } .cauldron .b3 { animation-delay: 1.6s; }
@keyframes bubble { 0% { transform: translateY(4px); opacity: 0; } 20% { opacity: 1; } 100% { transform: translateY(-9px); opacity: 0; } }
.cauldron .fire { animation: fire 0.35s steps(2) infinite; }
@keyframes fire { 50% { transform: translateY(-1px); opacity: 0.85; } }
.pot-tag { --plank: 100px; margin-top: 10px; padding: 8px 16px; display: flex; flex-direction: column; align-items: center; transform: rotate(1.5deg); }
.pot-label { font-size: 18px; color: var(--dim); }
.pot-val { font-family: var(--px); font-weight: 700; font-size: 26px; color: var(--sol); text-shadow: 0 2px 0 #06301f; }
.pot.bump .pot-tag { animation: knock 0.7s; }

.tagline { max-width: 34ch; margin: 34px auto 18px; font-size: 27px; color: var(--cream); text-shadow: 0 2px 0 #000, 0 0 12px #000; }
.cta {
  --plank: 100px;
  display: inline-block; padding: 14px 30px 16px; font-family: var(--px); font-weight: 700; font-size: 24px;
  color: #2a1405; text-decoration: none;
  background: linear-gradient(180deg, #ffbd6a, var(--pumpkin) 45%, #c45c16);
  border-color: #4a1d05; box-shadow: inset 0 2px 0 #ffe0b0, inset 0 -4px 0 #9a4410, 0 6px 0 #4a1d05, 0 0 40px rgba(255, 138, 31, 0.5);
  position: relative; top: 0; transition: top 0.08s, box-shadow 0.08s;
}
.cta:hover { top: -2px; box-shadow: inset 0 2px 0 #ffe0b0, inset 0 -4px 0 #9a4410, 0 8px 0 #4a1d05, 0 0 60px rgba(255, 138, 31, 0.7); }
.cta:active { top: 4px; box-shadow: inset 0 2px 0 #ffe0b0, inset 0 -4px 0 #9a4410, 0 2px 0 #4a1d05, 0 0 30px rgba(255, 138, 31, 0.5); }
.hint { margin: 14px 0 0; font-size: 19px; color: var(--dim); text-shadow: 0 2px 0 #000; }
.demo-bar {
  margin-top: 22px; padding: 6px 14px; background: rgba(40, 26, 6, 0.85); border: 2px dashed var(--candle); color: var(--candle);
}
.link-btn { background: none; border: 0; color: #fff3c4; text-decoration: underline; padding: 0; }

/* ---------- panels ---------- */
.grid {
  display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.05fr); gap: 34px;
  max-width: 1220px; margin: 0 auto; padding: 0 24px; align-items: start;
}
.panel { --plank: 46px; position: relative; padding: 20px; }
.panel::before, .panel::after {
  content: ''; position: absolute; top: 10px; width: 7px; height: 7px; background: #2a2b33; box-shadow: inset -2px -2px 0 #111, inset 2px 2px 0 #6a6c78;
}
.panel::before { left: 10px; } .panel::after { right: 10px; }
.panel-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; margin-bottom: 14px; padding: 0 8px; }
.panel h2 { font-size: 27px; line-height: 1.1; color: var(--candle); text-shadow: 0 3px 0 #2a1405; }
.panel-head > div:first-child { min-width: 0; }
.sub { margin: 2px 0 0; color: var(--dim); font-size: 20px; }
.sub b { color: var(--cream); font-weight: 400; }

.timer { display: flex; align-items: center; gap: 8px; text-align: right; flex-shrink: 0; white-space: nowrap; }
.timer > div { display: flex; flex-direction: column; }
.lantern { width: 34px; height: 51px; image-rendering: pixelated; overflow: visible; }
.lantern .glass { opacity: 0.35; transition: opacity 1s; }
.lantern .flame { transform-box: fill-box; transform-origin: 50% 100%; transition: transform 1s linear; animation: flick 0.4s steps(2) infinite; }
@keyframes flick { 50% { opacity: 0.8; } }
.timer-lbl { font-size: 17px; color: var(--dim); }
.clock-val { font-family: var(--px); font-weight: 700; font-size: 26px; color: var(--candle); }
.clock-val.hurry { color: var(--red); animation: blink 0.6s steps(2) infinite; }
@keyframes blink { 50% { opacity: 0.4; } }

/* carving table */
.tabletop {
  position: relative; padding: 18px; border-radius: 4px;
  background:
    repeating-linear-gradient(180deg, transparent 0 62px, rgba(20, 8, 2, 0.6) 62px 65px),
    repeating-linear-gradient(90deg, rgba(0, 0, 0, 0.06) 0 2px, transparent 2px 13px),
    linear-gradient(180deg, #5d3a1f, #4a2d17);
  box-shadow: inset 0 0 0 3px #2a180b, inset 0 10px 30px rgba(0, 0, 0, 0.5);
}
.board-wrap { position: relative; max-width: 500px; margin: 0 auto; aspect-ratio: 1; }
.candle-glow {
  position: absolute; inset: -10%; pointer-events: none; border-radius: 50%;
  background: radial-gradient(circle at 50% 58%, rgba(255, 190, 80, var(--glow, 0.12)), transparent 62%);
  transition: --glow 0.4s;
}
#board {
  position: relative; width: 100%; height: 100%; display: block; image-rendering: pixelated;
  touch-action: none; cursor: var(--knife);
}
.board-wrap.thunk { animation: thunk 0.18s ease-out; }
@keyframes thunk { 40% { transform: scale(0.985) translateY(2px); } }
.board-note {
  position: absolute; left: 18px; right: 18px; bottom: 18px; padding: 10px; text-align: center;
  background: rgba(18, 10, 4, 0.9); border: 2px solid var(--candle); color: var(--candle);
}

.tools { display: flex; flex-wrap: wrap; gap: 8px; margin: 16px 0; justify-content: center; }
.tool {
  --plank: 100px;
  display: inline-flex; align-items: center; gap: 6px; padding: 7px 11px 8px;
  font-family: var(--px); font-size: 16px; font-weight: 500;
  box-shadow: inset 0 2px 0 rgba(255, 210, 160, 0.25), 0 4px 0 var(--wood-edge);
  position: relative; top: 0;
}
.tool svg { width: 18px; height: 18px; image-rendering: pixelated; }
.tool:hover { top: -2px; box-shadow: inset 0 2px 0 rgba(255, 210, 160, 0.25), 0 6px 0 var(--wood-edge); }
.tool:active { top: 3px; box-shadow: inset 0 2px 0 rgba(255, 210, 160, 0.25), 0 1px 0 var(--wood-edge); }
.tool.active { background: linear-gradient(180deg, #ffbd6a, var(--pumpkin) 50%, #c45c16); color: #2a1405; border-color: #4a1d05; }
.sep { width: 10px; }

.submit-row { display: flex; gap: 10px; align-items: stretch; }
.name-tag { flex: 1; min-width: 0; display: flex; }
.name-tag input {
  width: 100%; font-family: var(--vt); font-size: 25px; padding: 6px 12px; color: var(--ink);
  background: linear-gradient(180deg, #f3e2b8, #e2cc96); border: 3px solid #5a3a1c; box-shadow: inset 0 2px 0 #fff3d4, 0 4px 0 #2a180b;
}
.name-tag input::placeholder { color: #8a714a; }
.name-tag input:focus { outline: none; border-color: var(--pumpkin); }
.btn {
  --plank: 100px;
  font-family: var(--px); font-weight: 700; font-size: 19px; padding: 10px 18px; color: #2a1405;
  background: linear-gradient(180deg, #ffbd6a, var(--pumpkin) 45%, #c45c16); border-color: #4a1d05;
  box-shadow: inset 0 2px 0 #ffe0b0, 0 5px 0 #4a1d05; position: relative; top: 0;
}
.btn:hover { top: -2px; box-shadow: inset 0 2px 0 #ffe0b0, 0 7px 0 #4a1d05, 0 0 24px rgba(255, 138, 31, 0.5); }
.btn:active { top: 4px; box-shadow: inset 0 2px 0 #ffe0b0, 0 1px 0 #4a1d05; }
.status { color: var(--dim); margin: 12px 4px 0; min-height: 1.3em; font-size: 20px; }
.status.ok { color: #b8e07a; }
.status.err { color: var(--red); }

/* ---------- the patch (raised bed) ---------- */
.bed {
  margin-top: 12px; padding: 18px 12px 8px; min-height: 260px; border: 6px solid #3a2311;
  box-shadow: inset 0 0 0 2px #6a4424, inset 0 14px 30px rgba(0, 0, 0, 0.6);
  background:
    radial-gradient(circle at 20% 30%, #3e2819 0 2px, transparent 3px) 0 0 / 23px 19px,
    radial-gradient(circle at 70% 60%, #1b110a 0 2px, transparent 3px) 0 0 / 31px 27px,
    repeating-linear-gradient(180deg, #2f1f13 0 34px, #261810 34px 70px);
}
.plots { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 6px 10px; max-height: 760px; overflow-y: auto; padding: 4px; }
.plot { position: relative; display: flex; flex-direction: column; align-items: center; padding: 6px 4px 12px; perspective: 500px; }
.plot-pk {
  position: relative; width: 100%; max-width: 168px; aspect-ratio: 1; cursor: pointer;
  transform: rotateX(var(--rx, 0deg)) rotateY(var(--ry, 0deg)) translateY(var(--lift, 0px));
  transition: transform 0.15s ease-out; transform-style: preserve-3d;
}
.plot-pk::before {
  content: ''; position: absolute; left: 6%; right: 6%; bottom: 3%; height: 18%; border-radius: 50%;
  background: radial-gradient(ellipse, #4a3020 0 45%, #2a1a0f 70%, transparent 72%);
  transform: translateZ(-20px);
}
.plot-pk canvas { position: relative; width: 100%; height: 100%; image-rendering: pixelated; display: block; }
.plot:hover .plot-pk, .plot:focus-within .plot-pk { --lift: -6px; }
.plot.hop .plot-pk { animation: hop 0.6s cubic-bezier(.3, 1.6, .5, 1); }
@keyframes hop { 30% { transform: translateY(-28px) scale(1.06, 0.95); } 60% { transform: translateY(0) scale(0.96, 1.05); } }
.vine-curl { position: absolute; left: 4%; bottom: 22%; width: 26px; height: 18px; pointer-events: none; }
.stake {
  --plank: 100px;
  position: relative; margin-top: -4px; padding: 4px 10px 5px; max-width: 100%; text-align: center; transform: rotate(var(--tilt, -2deg));
}
.stake::after { content: ''; position: absolute; left: 50%; top: 100%; width: 5px; height: 10px; margin-left: -2px; background: var(--wood-dk); border: 2px solid var(--wood-edge); border-top: 0; }
.stake .nm { display: block; font-family: var(--px); font-size: 16px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 140px; }
.stake .by { display: block; font-size: 16px; color: var(--dim); }
.pick {
  margin-top: 14px; font-family: var(--px); font-weight: 700; font-size: 15px; padding: 6px 14px; color: #2a1405;
  background: linear-gradient(180deg, #ffbd6a, var(--pumpkin) 50%, #c45c16); border: 2px solid #4a1d05; box-shadow: 0 3px 0 #4a1d05;
}
.pick:hover:not(:disabled) { box-shadow: 0 3px 0 #4a1d05, 0 0 16px rgba(255, 138, 31, 0.6); }
.pick:disabled { background: #3a2a1c; color: #9b8462; border-color: #24150a; box-shadow: none; cursor: default; }
.rosette {
  position: absolute; top: 4px; right: 8px; width: 44px; height: 44px; border-radius: 50%; z-index: 2;
  display: grid; place-items: center; font-family: var(--px); font-size: 12px; font-weight: 700; line-height: 1; text-align: center;
  background: radial-gradient(circle, var(--rc, #2f6bd6) 0 52%, #fff 53% 58%, var(--rc, #2f6bd6) 59%);
  color: #fff; box-shadow: 0 3px 0 rgba(0, 0, 0, 0.4);
}
.rosette::after { content: ''; position: absolute; top: 34px; left: 12px; width: 20px; height: 22px; z-index: -1;
  background: linear-gradient(90deg, var(--rc, #2f6bd6) 0 45%, transparent 45% 55%, var(--rc, #2f6bd6) 55%);
  clip-path: polygon(0 0, 100% 0, 100% 100%, 75% 80%, 50% 100%, 25% 80%, 0 100%); }
.rosette.mine { --rc: #4f8a2a; }
.empty { color: var(--dim); text-align: center; margin: 30px 10px; }

/* ---------- hall of gourds ---------- */
.hall { max-width: 1220px; margin: 70px auto 0; padding: 0 24px; }
.hall-sign { --plank: 100px; display: inline-block; padding: 10px 26px; margin-left: 30px; position: relative; z-index: 2; transform: rotate(-1.5deg); }
.hall-sign h2 { font-size: 30px; color: var(--candle); text-shadow: 0 3px 0 #2a1405; }
.fence {
  position: relative; margin-top: -10px; padding: 26px 18px 0; min-height: 240px;
  background:
    linear-gradient(180deg, transparent 0 calc(100% - 92px), #6b4526 calc(100% - 92px) calc(100% - 78px), transparent calc(100% - 78px) calc(100% - 44px), #6b4526 calc(100% - 44px) calc(100% - 30px), transparent calc(100% - 30px)),
    repeating-linear-gradient(90deg, transparent 0 120px, #5a3a1f 120px 136px, transparent 136px 220px);
}
.winners { display: flex; gap: 22px; overflow-x: auto; padding: 4px 4px 20px; align-items: flex-end; scroll-snap-type: x proximity; }
.winner { position: relative; flex: 0 0 180px; display: flex; flex-direction: column; align-items: center; scroll-snap-align: start; }
.winner canvas { width: 160px; height: 160px; image-rendering: pixelated; }
.winner .rosette { --rc: #c8961e; top: 0; right: 4px; }
.winner .card-note {
  margin-top: -6px; padding: 6px 10px; width: 100%; text-align: center; color: var(--ink);
  background: linear-gradient(180deg, #f3e2b8, #e2cc96); border: 2px solid #5a3a1c; box-shadow: 0 4px 0 #2a180b; transform: rotate(var(--tilt, 1deg));
}
.card-note .nm { font-family: var(--px); font-weight: 700; font-size: 17px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: block; }
.card-note .by { font-size: 17px; color: #6a5434; }
.card-note .paid { color: #1d6e3c; font-family: var(--px); font-weight: 700; font-size: 16px; }
.card-note .roll { color: #7a5c34; font-size: 16px; }
.card-note a { color: #1d4e8e; }

/* ---------- notice ---------- */
.notice {
  position: relative; max-width: 720px; margin: 70px auto 0; padding: 34px 36px 26px; color: var(--ink);
  background:
    radial-gradient(circle at 90% 90%, rgba(120, 80, 30, 0.18), transparent 40%),
    linear-gradient(180deg, #f1e0b4, #e4cd94);
  border: 2px solid #8a6a3a; box-shadow: 0 10px 0 rgba(0, 0, 0, 0.35), 0 20px 40px rgba(0, 0, 0, 0.5); transform: rotate(-0.8deg);
}
.notice .nail { position: absolute; top: 10px; left: 50%; width: 12px; height: 12px; margin-left: -6px; background: #55565f; box-shadow: inset -3px -3px 0 #2a2b33, inset 2px 2px 0 #9a9ca8; }
.notice h2 { font-size: 30px; color: #8a3a08; margin-bottom: 12px; }
.notice ol { margin: 0; padding-left: 26px; }
.notice li { margin-bottom: 10px; }
.notice b { font-family: var(--px); color: #8a3a08; }
.notice .fine { color: #6a5434; font-size: 18px; word-break: break-all; margin-bottom: 0; }
.notice code { font-family: var(--vt); color: var(--ink); }
.foot { text-align: center; color: var(--dim); padding: 50px 16px 60px; font-size: 18px; text-shadow: 0 2px 0 #000; }

.toast {
  --plank: 100px;
  position: fixed; left: 50%; bottom: 22px; transform: translateX(-50%) translateY(160%); max-width: 90vw;
  padding: 10px 18px; font-family: var(--px); font-size: 18px; z-index: 70; transition: transform 0.25s cubic-bezier(.3, 1.4, .5, 1);
}
.toast.show { transform: translateX(-50%) translateY(0); }
.toast.err { color: #ffd2c6; border-color: #5a1208; }

/* ---------- responsive ---------- */
@media (max-width: 960px) {
  .grid { grid-template-columns: minmax(0, 1fr); padding: 0 16px; gap: 28px; }
  .hall, .notice { margin-left: 16px; margin-right: 16px; }
  .hall { padding: 0; }
  .plots { max-height: none; }
}
@media (max-width: 600px) {
  body { font-size: 20px; }
  .hero { padding: 100px 16px 30px; min-height: 0; }
  .tags { right: 12px; gap: 8px; }
  .tag { font-size: 15px; padding: 6px 10px; }
  .hero-row { gap: 26px; }
  .sign { padding: 16px 26px 14px; }
  .rope { top: -100px; height: 104px; }
  .cauldron { width: 110px; }
  .tagline { font-size: 23px; margin-top: 24px; }
  .panel { padding: 14px 10px; }
  .panel-head { flex-direction: column; padding: 0 6px; }
  .timer { text-align: left; }
  .tabletop { padding: 10px; }
  .plots { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .submit-row { flex-direction: column; }
  .winner { flex-basis: 150px; }
  .winner canvas { width: 140px; height: 140px; }
  .notice { padding: 30px 20px 20px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  html { scroll-behavior: auto; }
}
