/* ==========================================================================
   Hayloft — base styles (farm palette from the design sketch)
   ========================================================================== */
:root {
  --hay: #F7C873;
  --hay-light: #FADF9F;
  --cream: #FFF4DE;
  --cream-dark: #F1DDB2;
  --brown: #3B2416;
  --brown-soft: #6B4A2E;
  --red: #A8322A;
  --red-dark: #6E1F19;
  --red-bright: #C8402E;
  --blue: #2F6DB5;
  --yellow: #E8B23A;
  --gold: #E8B84A;
  --green: #3F7D3A;
  --grass: #5E8C3A;
  --grass-light: #8FAE54;
  --pink: #F4A7A0;
  --white: #FFFFFF;
  --font-display: 'Roboto Slab', 'Rockwell', 'Georgia', serif;
  --font-logo: 'Alfa Slab One', 'Rockwell', 'Georgia', serif;
  --font-body: 'Nunito', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --radius: 16px;
  --shadow: 5px 5px 0 var(--brown);
  --shadow-sm: 3px 3px 0 var(--brown);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; min-height: 100vh; background: var(--hay); color: var(--brown);
  font-family: var(--font-body); font-weight: 600; font-size: 18px; line-height: 1.45;
}
h1, h2, h3 { font-family: var(--font-display); font-weight: 800; line-height: 1.1; margin: 0 0 0.5em; }
h1 { font-size: 2.4rem; } h2 { font-size: 1.7rem; } h3 { font-size: 1.25rem; }
p { margin: 0 0 1em; }
a { color: var(--red); } a:hover { color: var(--red-dark); }
img { max-width: 100%; display: block; }
button, input, select, textarea { font: inherit; color: inherit; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.muted { color: var(--brown-soft); }
.small { font-size: 0.9rem; }
.center { text-align: center; }
.row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.grow { flex: 1; }
.hidden { display: none !important; }

/* Layout --------------------------------------------------------------- */
.app { min-height: 100vh; display: flex; flex-direction: column; }
.site-header {
  display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap;
  padding: 14px 20px; background: var(--cream); border-bottom: 4px solid var(--brown);
}
.logo { font-family: var(--font-logo); font-size: 1.7rem; color: var(--red); text-decoration: none; text-shadow: 2px 2px 0 var(--brown); letter-spacing: 0.02em; }
.nav { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.nav a:not(.btn) { text-decoration: none; color: var(--brown); padding: 8px 12px; border-radius: 999px; min-height: 44px; display: inline-flex; align-items: center; }
.nav a:not(.btn):hover, .nav a.active { background: var(--hay); }
.site-main { flex: 1; width: 100%; max-width: 1100px; margin: 0 auto; padding: 24px 16px 48px; }
.site-footer { padding: 20px 16px; text-align: center; font-size: 0.9rem; color: var(--brown-soft); }
.site-footer a { margin: 0 8px; }
.demo-banner { background: var(--brown); color: var(--cream); text-align: center; padding: 8px 16px; font-size: 0.95rem; }
.demo-banner a { color: var(--gold); }

/* Buttons --------------------------------------------------------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 48px; padding: 10px 22px; border-radius: var(--radius); border: 3px solid var(--brown);
  background: var(--cream); color: var(--brown); font-weight: 800; font-size: 1rem; cursor: pointer;
  text-decoration: none; box-shadow: var(--shadow-sm); transition: transform 0.08s, box-shadow 0.08s;
}
.btn:hover { transform: translate(-1px, -1px); box-shadow: 4px 4px 0 var(--brown); }
.btn:active { transform: translate(2px, 2px); box-shadow: 1px 1px 0 var(--brown); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; box-shadow: var(--shadow-sm); }
.btn-primary { background: var(--red); color: var(--cream); font-family: var(--font-display); font-weight: 800; font-size: 1.15rem; }
.btn-green { background: var(--green); color: var(--cream); }
.btn-blue { background: var(--blue); color: var(--cream); }
.btn-ghost { background: transparent; box-shadow: none; border-color: transparent; }
.btn-ghost:hover { background: rgba(59, 36, 22, 0.08); box-shadow: none; transform: none; }
.btn-sm { min-height: 40px; padding: 6px 14px; font-size: 0.95rem; }
.btn-lg { min-height: 60px; padding: 14px 32px; font-size: 1.4rem; box-shadow: var(--shadow); }
.btn-icon { width: 44px; min-height: 44px; padding: 0; border-radius: 999px; }
.btn-danger { color: var(--red); }

/* Cards & forms --------------------------------------------------------- */
.card { background: var(--cream); border: 4px solid var(--brown); border-radius: 22px; box-shadow: var(--shadow); padding: 22px; }
.card-sm { padding: 16px; border-width: 3px; border-radius: 16px; box-shadow: var(--shadow-sm); }
.label { display: block; font-size: 0.85rem; font-weight: 900; letter-spacing: 0.1em; text-transform: uppercase; color: var(--red-dark); margin-bottom: 6px; }
.input, .select, .textarea {
  width: 100%; min-height: 48px; padding: 10px 14px; border: 3px solid var(--brown); border-radius: 14px;
  background: var(--white); font-weight: 700; font-size: 1.05rem;
}
.input:focus, .select:focus, .textarea:focus, .btn:focus-visible, .tile:focus-visible { outline: 4px solid var(--blue); outline-offset: 2px; }
.textarea { min-height: 90px; resize: vertical; }
.input-lg { font-size: 1.6rem; text-align: center; letter-spacing: 0.15em; font-family: var(--font-display); font-weight: 800; min-height: 64px; }
.field { margin-bottom: 16px; }
.help { font-size: 0.9rem; color: var(--brown-soft); margin-top: 4px; }
.error { background: #FBE2DE; border: 3px solid var(--red); color: var(--red-dark); border-radius: 12px; padding: 10px 14px; margin: 12px 0; }
.notice { background: var(--hay-light); border: 3px solid var(--brown); border-radius: 12px; padding: 10px 14px; margin: 12px 0; }
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 4px 12px; border-radius: 999px; background: var(--brown); color: var(--cream); font-size: 0.85rem; font-weight: 900; letter-spacing: 0.05em; }
.pill-gold { background: var(--gold); color: var(--brown); border: 2px solid var(--brown); }
.pill-light { background: var(--cream); color: var(--brown); border: 2px solid var(--brown); }
.checkbox { display: flex; gap: 10px; align-items: flex-start; cursor: pointer; }
.checkbox input { width: 22px; height: 22px; margin-top: 2px; accent-color: var(--green); flex-shrink: 0; }

/* Toasts ---------------------------------------------------------------- */
.toasts { position: fixed; left: 0; right: 0; bottom: 20px; display: flex; flex-direction: column; align-items: center; gap: 8px; pointer-events: none; z-index: 100; }
.toast { background: var(--brown); color: var(--cream); padding: 12px 20px; border-radius: 999px; font-weight: 800; opacity: 0; transform: translateY(10px); transition: all 0.25s; max-width: 90vw; }
.toast.show { opacity: 1; transform: none; }
.toast-error { background: var(--red); }
.toast-success { background: var(--green); }

/* Home ------------------------------------------------------------------ */
.hero { display: grid; grid-template-columns: 1fr; gap: 24px; align-items: start; }
@media (min-width: 820px) { .hero { grid-template-columns: 1.1fr 1fr; } }
.hero-title { font-family: var(--font-logo); font-weight: 400; font-size: clamp(2.6rem, 7vw, 4.5rem); color: var(--red); text-shadow: 4px 4px 0 var(--brown); margin-bottom: 8px; }
.hero-sub { font-size: 1.3rem; font-weight: 800; }
.pin-form .input-lg { margin-bottom: 12px; }

/* Quiz grid -------------------------------------------------------------- */
.quiz-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 18px; }
.quiz-card { background: var(--cream); border: 3px solid var(--brown); border-radius: 18px; box-shadow: var(--shadow-sm); overflow: hidden; display: flex; flex-direction: column; text-decoration: none; color: inherit; transition: transform 0.08s; }
.quiz-card:hover { transform: translate(-2px, -2px); box-shadow: var(--shadow); }
.quiz-cover { aspect-ratio: 16 / 9; background: var(--cream-dark); display: flex; align-items: center; justify-content: center; color: var(--brown-soft); border-bottom: 3px solid var(--brown); }
.quiz-cover img { width: 100%; height: 100%; object-fit: cover; }
.quiz-body { padding: 12px 14px 14px; display: flex; flex-direction: column; gap: 6px; flex: 1; }
.quiz-title { font-family: var(--font-display); font-size: 1.15rem; line-height: 1.2; }
.quiz-meta { font-size: 0.85rem; color: var(--brown-soft); display: flex; gap: 10px; flex-wrap: wrap; margin-top: auto; }

/* Editor ---------------------------------------------------------------- */
.editor { display: grid; grid-template-columns: 1fr; gap: 20px; }
@media (min-width: 900px) { .editor { grid-template-columns: 280px 1fr; align-items: start; } }
.qlist { display: flex; flex-direction: column; gap: 8px; }
.qlist-item { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border: 3px solid var(--brown); border-radius: 12px; background: var(--white); cursor: pointer; text-align: left; width: 100%; }
.qlist-item.active { background: var(--hay-light); box-shadow: var(--shadow-sm); }
.qlist-item.invalid { border-color: var(--red); }
.qlist-num { font-family: var(--font-display); color: var(--red); min-width: 26px; }
.qlist-text { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 0.95rem; }
.answer-row { display: flex; gap: 10px; align-items: center; margin-bottom: 10px; }
.answer-row .shape-box { width: 48px; height: 48px; flex-shrink: 0; border: 3px solid var(--brown); border-radius: 12px; background: var(--white); display: flex; align-items: center; justify-content: center; }
.correct-toggle { width: 48px; height: 48px; flex-shrink: 0; border-radius: 999px; border: 3px solid var(--brown); background: var(--white); cursor: pointer; display: flex; align-items: center; justify-content: center; font-size: 1.3rem; }
.correct-toggle.on { background: var(--green); color: var(--cream); }
.image-drop { border: 3px dashed var(--brown); border-radius: 14px; padding: 14px; text-align: center; background: var(--white); cursor: pointer; position: relative; }
.image-drop img { max-height: 200px; margin: 0 auto; border-radius: 8px; }
.image-drop input[type=file] { position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; }
.editor-toolbar { position: sticky; top: 0; z-index: 5; background: var(--hay); padding: 10px 0; display: flex; gap: 10px; align-items: center; flex-wrap: wrap; justify-content: space-between; }

/* ==========================================================================
   Big screen (host)
   ========================================================================== */
.host { min-height: 100vh; display: flex; flex-direction: column; background: var(--hay); position: relative; overflow: hidden; }
.host-top { display: flex; justify-content: space-between; align-items: center; gap: 16px; padding: 16px 28px; flex-wrap: wrap; }
.host-logo { font-family: var(--font-logo); font-size: 2rem; color: var(--red); text-shadow: 3px 3px 0 var(--brown); }
.host-main { flex: 1; display: flex; flex-direction: column; padding: 0 28px 24px; gap: 18px; position: relative; z-index: 1; }
.host-scene { position: absolute; left: 0; right: 0; bottom: 0; z-index: 0; pointer-events: none; }
.host-scene svg { width: 100%; height: auto; display: block; }

.lobby { display: flex; flex-direction: column; align-items: center; gap: 18px; width: 100%; }
.lobby-head { width: 100%; }
.join-card { display: flex; flex-direction: column; align-items: center; gap: 4px; text-align: center; padding: 12px 28px 14px; }
.lobby .pin-big { font-size: clamp(2.2rem, 4.5vw, 3.2rem); }
.join-card .qr { background: var(--white); padding: 10px; border: 3px solid var(--brown); border-radius: 12px; }
.join-card .qr svg { display: block; width: 180px; height: 180px; }
.lobby .players-yard { width: 100%; justify-content: center; position: relative; z-index: 1; }
/* Lobby: the farm sits along the bottom at a fixed height with the barn at the
   right edge; the critters gather in the yard but stay clear of the barn. */
.lobby-scene > svg { height: 34vh; }
.lobby .players-yard { max-width: max(55vw, calc(100vw - 64vh)); margin: 0 auto; }
.lobby .yard-player { width: 124px; }
.lobby .yard-player .name { font-size: 1rem; max-width: 140px; }
/* More critters → smaller critters, so everyone fits on one screen */
.lobby .yard-m { gap: 12px; } .lobby .yard-m .yard-player { width: 100px; } .lobby .yard-m .name { font-size: 0.85rem; max-width: 100px; }
.lobby .yard-s { gap: 8px 10px; } .lobby .yard-s .yard-player { width: 84px; } .lobby .yard-s .name { font-size: 0.75rem; max-width: 84px; padding: 2px 8px; border-width: 2px; }
.lobby .yard-xs { gap: 6px 8px; } .lobby .yard-xs .yard-player { width: 70px; } .lobby .yard-xs .name { font-size: 0.7rem; max-width: 70px; padding: 1px 6px; border-width: 2px; }
.lobby .yard-s .kick, .lobby .yard-xs .kick { transform: scale(0.8); }
/* A big crowd: the join card moves to the left and the critters fill the space beside it */
.lobby.lobby-crowd { display: grid; grid-template-columns: auto 1fr; align-items: start; column-gap: 28px; }
.lobby.lobby-crowd .lobby-head { grid-column: 1 / -1; }
.lobby.lobby-crowd .players-yard { max-width: none; margin: 0; justify-content: flex-start; align-content: flex-start; }
@media (max-height: 820px) { .lobby { gap: 12px; } .join-card .qr svg { width: 150px; height: 150px; } .lobby .pin-big { font-size: 2.4rem; } }
.pin-big { font-family: var(--font-display); font-size: clamp(2.2rem, 5vw, 3.6rem); line-height: 1; letter-spacing: 0.04em; white-space: nowrap; }
.players-yard { display: flex; flex-wrap: wrap; gap: 18px; align-items: flex-end; min-height: 140px; }
.yard-player { display: flex; flex-direction: column; align-items: center; gap: 4px; width: 104px; animation: pop-in 0.4s cubic-bezier(.2,1.4,.4,1); position: relative; }
.yard-player .name { background: var(--cream); border: 3px solid var(--brown); border-radius: 999px; padding: 3px 10px; font-size: 0.85rem; font-weight: 800; max-width: 110px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.yard-player .kick { position: absolute; top: -6px; right: 6px; width: 28px; height: 28px; border-radius: 999px; border: 2px solid var(--brown); background: var(--cream); font-size: 0.8rem; cursor: pointer; opacity: 0; transition: opacity 0.15s; padding: 0; line-height: 1; }
.yard-player:hover .kick, .yard-player:focus-within .kick { opacity: 1; }
@keyframes pop-in { from { transform: translateY(20px) scale(0.6); opacity: 0; } to { transform: none; opacity: 1; } }

.question-screen { display: flex; flex-direction: column; gap: 16px; flex: 1; }
.question-text { font-family: var(--font-display); font-size: clamp(1.5rem, 3.5vw, 2.8rem); text-align: center; line-height: 1.15; background: var(--cream); border: 4px solid var(--brown); border-radius: 22px; padding: 18px 28px; box-shadow: var(--shadow); }
.question-middle { display: grid; grid-template-columns: 1fr; gap: 16px; align-items: center; flex: 1; }
@media (min-width: 760px) { .question-middle { grid-template-columns: 160px 1fr 160px; } }
.timer-circle { width: 140px; height: 140px; border-radius: 999px; background: var(--gold); border: 5px solid var(--brown); box-shadow: var(--shadow); display: flex; align-items: center; justify-content: center; font-family: var(--font-display); font-size: 3.6rem; margin: 0 auto; position: relative; }
.timer-circle.urgent { background: var(--red-bright); color: var(--cream); animation: pulse 0.6s infinite alternate; }
@keyframes pulse { from { transform: scale(1); } to { transform: scale(1.06); } }
.counter-circle { width: 140px; height: 140px; border-radius: 999px; background: var(--white); border: 5px solid var(--brown); box-shadow: var(--shadow); display: flex; flex-direction: column; align-items: center; justify-content: center; margin: 0 auto; }
.counter-circle b { font-family: var(--font-display); font-size: 3rem; font-weight: 800; line-height: 1; }
.counter-circle span { font-size: 0.85rem; }
.question-image { max-height: 38vh; min-height: 120px; display: flex; align-items: center; justify-content: center; }
.question-image img { max-height: 38vh; border: 4px solid var(--brown); border-radius: 16px; box-shadow: var(--shadow); object-fit: contain; }
.answers-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.tile { display: flex; align-items: center; gap: 16px; min-height: 84px; padding: 10px 16px; border: 4px solid var(--brown); border-radius: 16px; box-shadow: var(--shadow); font-size: clamp(1.1rem, 2.4vw, 1.8rem); font-weight: 900; text-align: left; position: relative; }
.tile .shape-box { width: 58px; height: 58px; flex-shrink: 0; border-radius: 12px; background: var(--white); border: 3px solid var(--brown); display: flex; align-items: center; justify-content: center; }
.tile img.answer-img { height: 60px; width: 90px; object-fit: cover; border-radius: 8px; border: 2px solid var(--brown); }
.tile.dim { opacity: 0.35; }
.tile.correct::after { content: '✓'; position: absolute; right: 14px; top: 50%; transform: translateY(-50%); width: 40px; height: 40px; border-radius: 999px; background: var(--cream); color: var(--green); border: 3px solid var(--brown); display: flex; align-items: center; justify-content: center; font-size: 1.4rem; }
.tile .count { margin-left: auto; font-family: var(--font-display); font-size: 1.6rem; background: rgba(255,255,255,0.85); color: var(--brown); border-radius: 999px; padding: 2px 14px; margin-right: 52px; }
.bars { display: flex; gap: 14px; align-items: flex-end; height: 140px; padding: 0 20px; }
.bar { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; gap: 6px; height: 100%; }
.bar .fill { width: 100%; border: 3px solid var(--brown); border-radius: 10px 10px 0 0; transition: height 0.6s cubic-bezier(.2,1.2,.4,1); min-height: 6px; }
.bar b { font-family: var(--font-display); font-weight: 800; font-size: 1.4rem; }
.host-controls { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }

.board { background: var(--cream); border: 4px solid var(--brown); border-radius: 22px; box-shadow: var(--shadow); padding: 18px 24px; display: flex; flex-direction: column; gap: 10px; max-width: 920px; width: 100%; margin: 0 auto; }
.board-row { display: flex; align-items: center; gap: 14px; min-height: 64px; animation: slide-in 0.5s cubic-bezier(.2,1.2,.4,1) both; }
.board-row:nth-child(2) { animation-delay: 0.08s; } .board-row:nth-child(3) { animation-delay: 0.16s; } .board-row:nth-child(4) { animation-delay: 0.24s; } .board-row:nth-child(5) { animation-delay: 0.32s; }
@keyframes slide-in { from { transform: translateX(-30px); opacity: 0; } to { transform: none; opacity: 1; } }
.board-rank { width: 42px; height: 42px; border-radius: 999px; background: var(--brown); color: var(--cream); display: flex; align-items: center; justify-content: center; font-family: var(--font-display); font-size: 1.2rem; flex-shrink: 0; }
.board-name { width: 160px; font-size: 1.3rem; font-weight: 900; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.board-track { flex: 1; height: 26px; border: 3px solid var(--brown); border-radius: 999px; background: var(--cream-dark); overflow: hidden; }
.board-track .fill { height: 100%; background: var(--grass); border-right: 3px solid var(--brown); transition: width 0.8s cubic-bezier(.2,1,.4,1); }
.board-score { width: 110px; text-align: right; font-family: var(--font-display); font-size: 1.5rem; line-height: 1; }
.board-score small { display: block; font-family: var(--font-body); font-size: 0.85rem; font-weight: 800; color: var(--green); }

.podium { display: flex; justify-content: center; align-items: flex-end; gap: 18px; padding: 20px 0; flex-wrap: wrap; }
.podium-spot { display: flex; flex-direction: column; align-items: center; gap: 8px; animation: pop-in 0.6s cubic-bezier(.2,1.4,.4,1) both; }
.podium-spot .stand { width: 180px; border: 4px solid var(--brown); border-radius: 16px 16px 0 0; background: var(--cream); display: flex; flex-direction: column; align-items: center; justify-content: flex-start; padding-top: 10px; box-shadow: var(--shadow); }
.podium-spot.first .stand { height: 180px; background: var(--gold); } .podium-spot.second .stand { height: 130px; } .podium-spot.third .stand { height: 100px; }
.podium-spot .place { font-family: var(--font-display); font-size: 2.2rem; }
.podium-spot .pname { font-size: 1.3rem; font-weight: 900; max-width: 180px; text-align: center; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.podium-spot .pscore { font-family: var(--font-display); font-size: 1.1rem; }
.ribbon { position: absolute; }

/* ==========================================================================
   Player (phone)
   ========================================================================== */
.play { min-height: 100vh; display: flex; flex-direction: column; background: var(--hay); }
.play-top { display: flex; justify-content: space-between; align-items: center; padding: 14px 16px; gap: 10px; }
.play-main { flex: 1; display: flex; flex-direction: column; padding: 0 14px 20px; gap: 12px; }
.play-main .card { border-radius: 24px 24px 0 0; flex: 1; }
.avatar-picker { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.avatar-picker button { height: 64px; padding: 0; border-radius: 14px; border: 3px solid var(--brown); background: var(--white); cursor: pointer; display: flex; align-items: center; justify-content: center; }
.avatar-picker button.on { border: 4px solid var(--red); background: var(--hay-light); }
.hat-picker { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.hat-picker button { min-height: 44px; border-radius: 999px; border: 3px solid var(--brown); background: var(--white); font-weight: 800; cursor: pointer; }
.hat-picker button.on { background: var(--brown); color: var(--cream); }
.avatar-stage { display: flex; flex-direction: column; align-items: center; margin-top: -4px; }
.avatar-stage .ground { width: 200px; height: 20px; margin-top: -12px; border-radius: 50%; background: var(--grass); border: 3px solid var(--brown); }
.player-bar { display: flex; align-items: center; gap: 10px; background: var(--brown); color: var(--cream); border-radius: 16px; padding: 6px 14px 6px 6px; min-height: 60px; }
.player-bar .avatar-chip { background: var(--cream); border-radius: 12px; }
.player-bar .pname { flex: 1; font-weight: 900; font-size: 1.1rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.player-bar .pscore { font-family: var(--font-display); font-size: 1.2rem; }
.answer-buttons { flex: 1; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); grid-auto-rows: minmax(120px, 1fr); gap: 12px; }
.answer-buttons.single { grid-template-columns: 1fr; }
.answer-btn { border-radius: 20px; border: 4px solid var(--brown); box-shadow: var(--shadow); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; cursor: pointer; font-weight: 900; font-size: 1.1rem; padding: 10px; text-align: center; min-height: 110px; }
.answer-btn .shape-box { width: 70px; height: 70px; border-radius: 16px; background: var(--white); border: 3px solid var(--brown); display: flex; align-items: center; justify-content: center; }
.answer-btn:active { transform: translate(3px, 3px); box-shadow: 1px 1px 0 var(--brown); }
.answer-btn span { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.result-big { font-family: var(--font-display); font-size: 2.4rem; text-align: center; line-height: 1.1; }
.result-points { font-family: var(--font-display); font-size: 3rem; text-align: center; }
.play-center { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; text-align: center; padding: 10px; }
.timer-bar { height: 10px; background: var(--cream-dark); border: 2px solid var(--brown); border-radius: 999px; overflow: hidden; }
.timer-bar .fill { height: 100%; background: var(--green); transition: width 0.25s linear; }
.streak-flame { display: inline-flex; align-items: center; gap: 4px; background: var(--red-bright); color: var(--cream); border-radius: 999px; padding: 4px 12px; font-weight: 900; }

/* Legal pages ----------------------------------------------------------- */
.prose { max-width: 760px; }
.prose h2 { margin-top: 1.4em; }
.prose ul { padding-left: 1.3em; }

@media (max-width: 600px) {
  .site-main { padding: 16px 12px 40px; }
  .card { padding: 16px; }
  h1 { font-size: 2rem; }
  .board-name { width: 100px; font-size: 1.05rem; }
  .board-score { width: 80px; font-size: 1.2rem; }
  .question-middle { gap: 10px; }
  .timer-circle, .counter-circle { width: 100px; height: 100px; font-size: 2.4rem; }
  .counter-circle b { font-size: 2rem; }
}

/* ==========================================================================
   Stage 2 — life on the farm
   ========================================================================== */
@media (prefers-reduced-motion: no-preference) {
  .yard-player > svg { animation: bob 2.4s ease-in-out infinite; transform-origin: 50% 100%; }
  .yard-player:nth-child(3n) > svg { animation-delay: -0.8s; }
  .yard-player:nth-child(3n+1) > svg { animation-delay: -1.6s; }
  .avatar-stage > svg, .play-center > svg.avatar:first-child { animation: bob 2.4s ease-in-out infinite; transform-origin: 50% 100%; }
  .podium-spot.first > svg { animation: hop 1s ease-in-out infinite; }
  .result-big { animation: pop-in 0.45s cubic-bezier(.2,1.4,.4,1) both; }
  .result-points { animation: pop-in 0.6s 0.15s cubic-bezier(.2,1.4,.4,1) both; }
  .tile { animation: tile-in 0.4s cubic-bezier(.2,1.2,.4,1) both; }
  .tile:nth-child(2) { animation-delay: 0.06s; } .tile:nth-child(3) { animation-delay: 0.12s; } .tile:nth-child(4) { animation-delay: 0.18s; }
  .question-text { animation: drop-in 0.5s cubic-bezier(.2,1.3,.4,1) both; }
  .answer-btn { transition: transform 0.08s, box-shadow 0.08s; }
}
@keyframes bob { 0%, 100% { transform: translateY(0) rotate(0); } 25% { transform: translateY(-4px) rotate(-2deg); } 75% { transform: translateY(-2px) rotate(2deg); } }
@keyframes hop { 0%, 100% { transform: translateY(0); } 40% { transform: translateY(-14px); } 60% { transform: translateY(-10px); } }
@keyframes tile-in { from { transform: translateY(16px) scale(0.96); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes drop-in { from { transform: translateY(-20px); opacity: 0; } to { transform: none; opacity: 1; } }

/* A strip of grass along the bottom of every big-screen view */
.host::after { content: ''; position: absolute; left: 0; right: 0; bottom: 0; height: 14px; background: var(--grass); border-top: 3px solid var(--brown); z-index: 0; }
.host-scene ~ .host::after, .host:has(.host-scene)::after { display: none; }

/* Blue ribbon for the winner */
.podium-spot { position: relative; }
.podium-spot .ribbon { position: absolute; top: -8px; right: -18px; width: 54px; height: 70px; z-index: 2; }

/* Falling hay confetti on the podium */
.hay-confetti { position: absolute; inset: 0; pointer-events: none; overflow: hidden; z-index: 0; }
.hay-confetti i { position: absolute; top: -20px; width: 6px; height: 18px; border-radius: 3px; background: var(--gold); border: 1.5px solid var(--brown); opacity: 0.85; }
@media (prefers-reduced-motion: no-preference) {
  .hay-confetti i { animation: fall linear infinite; }
}
@keyframes fall { to { transform: translateY(110vh) rotate(540deg); } }

/* Phone: answer countdown number */
.phone-timer { font-family: var(--font-display); font-size: 1.1rem; min-width: 2.2em; text-align: right; }

/* Wager step */
.wager-title { font-family: var(--font-logo); font-size: clamp(2.6rem, 6vw, 4.6rem); color: var(--red); text-shadow: 4px 4px 0 var(--brown); line-height: 1.05; }
.wager-category { background: var(--cream); border: 4px solid var(--brown); border-radius: 18px; padding: 10px 28px; font-family: var(--font-display); font-size: clamp(1.6rem, 3.5vw, 2.6rem); box-shadow: 5px 5px 0 var(--brown); display: flex; flex-direction: column; align-items: center; }
.wager-category .label { font-family: var(--font-body); font-size: 0.9rem; }
.yard-player.bet-in .name { background: var(--grass-light); }
.wager-screen .yard-player:not(.bet-in) > svg { opacity: 0.55; }
.bet-amount { font-family: var(--font-display); font-size: 3rem; line-height: 1; }
.bet-quick { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; width: 100%; }
.bet-quick .btn { padding-left: 4px; padding-right: 4px; white-space: nowrap; font-size: 0.85rem; }
.bet-range { width: 100%; accent-color: var(--red); height: 34px; }
.wager-screen .yard-player { animation: none; }

/* Admin: reports */
.admin-report { background: var(--cream); border: 2px solid var(--brown); border-radius: 12px; padding: 8px 12px; }
.admin-report.handled { opacity: 0.6; }
.admin-item details summary { cursor: pointer; font-weight: 800; }

/* Headline typeface: Roboto Slab, heavy. The logo keeps Alfa Slab One. */
.quiz-title, .qlist-num, .pin-big, .question-text, .timer-circle, .tile .count, .board-rank, .board-score,
.podium-spot .place, .podium-spot .pscore, .player-bar .pscore, .result-big, .result-points, .phone-timer,
.wager-category, .bet-amount { font-weight: 800; }
.site-footer a { color: inherit; }

/* Lobby avatars sized by fitYard() in host.js */
.lobby .fit-yard { gap: 10px 14px; }
.lobby.lobby-crowd .fit-yard { max-width: calc(100% - 30vh); }
.lobby .fit-yard .yard-player { width: var(--cell, 124px); }
.lobby .fit-yard .yard-player > svg { width: var(--av, 100px); height: var(--av, 100px); will-change: transform; }
.lobby .fit-yard .yard-player .name { font-size: var(--name, 1rem); max-width: var(--cell, 140px); }

/* Lobby: the farmer drives his tractor back and forth along the bottom. */
.tractor-lane { position: absolute; left: 0; right: 0; bottom: 0.5vh; height: 16vh; pointer-events: none; }
.tractor { position: absolute; left: 1vw; bottom: 0; height: 100%; aspect-ratio: 230 / 160; animation: tractor-drive 36s ease-in-out infinite; animation-delay: var(--t, 0s); }
.tractor-flip { width: 100%; height: 100%; animation: tractor-flip 36s steps(1) infinite; animation-delay: var(--t, 0s); }
.host-scene .tractor-svg { width: 100%; height: 100%; display: block; overflow: visible; }
.tractor-body { animation: tractor-bump 0.45s ease-in-out infinite alternate; }
.tractor .wheel { transform-box: view-box; animation: tractor-wheel 1.4s linear infinite; }
.tractor .puff { opacity: 0; transform-box: fill-box; transform-origin: center; animation: tractor-puff 2.4s ease-out infinite; }
.tractor .p2 { animation-delay: 0.8s; } .tractor .p3 { animation-delay: 1.6s; }
@keyframes tractor-drive {
  0%, 4% { transform: translateX(0); }
  46%, 54% { transform: translateX(calc(100vw - 2vw - 32vh - 23vh)); }
  96%, 100% { transform: translateX(0); }
}
@keyframes tractor-flip { 0% { transform: scaleX(1); } 50% { transform: scaleX(-1); } }
@keyframes tractor-bump { from { transform: translateY(0); } to { transform: translateY(-1.5px); } }
@keyframes tractor-wheel { to { transform: rotate(360deg); } }
@keyframes tractor-puff { 0% { opacity: 0.9; transform: translate(0, 0) scale(0.6); } 100% { opacity: 0; transform: translate(-22px, -34px) scale(1.8); } }
@media (prefers-reduced-motion: reduce) { .tractor, .tractor-flip, .tractor-body, .tractor .wheel, .tractor .puff { animation: none; } }

/* Reveal: nothing slides in again (the screen stays put), the right answer
   gets a green ring and a big tick, the wrong ones fade back. */
.question-screen.is-reveal .tile, .question-screen.is-reveal .question-text { animation: none; }
.question-screen.is-reveal .tile { transition: opacity 0.3s, filter 0.3s; }
.question-screen.is-reveal .tile.dim { opacity: 0.28; filter: grayscale(0.8); }
.question-screen.is-reveal .tile.correct { z-index: 1; box-shadow: 0 0 0 4px var(--cream), 0 0 0 9px var(--green), var(--shadow); animation: correct-pop 0.6s cubic-bezier(.2,1.4,.4,1) both; }
.question-screen.is-reveal .tile.correct::after { width: 54px; height: 54px; font-size: 2rem; background: var(--green); color: var(--cream); border-width: 4px; }
.question-screen.is-reveal .tile.correct .count { margin-right: 66px; }
@keyframes correct-pop { 0% { transform: scale(1); } 45% { transform: scale(1.04); } 100% { transform: scale(1.015); } }
@media (prefers-reduced-motion: reduce) { .question-screen.is-reveal .tile.correct { animation: none; transform: scale(1.015); } }
.question-screen .answers-grid { padding: 0 10px; }
.question-screen.is-reveal .bar-dim { opacity: 0.35; filter: grayscale(0.8); }
.question-screen.is-reveal .bar-correct b { color: var(--green); font-size: 1.8rem; }
