/* Ronnie's Manor: pie & mash shop green, gold-leaf signwriting, big friendly type. */
:root {
  color-scheme: dark;
  --ground: #0F3B2E;
  --ground-deep: #0A2B21;
  --panel: #12473A;
  --cream: #F5EEDC;
  --cream-dim: #C9C3AE;
  --gold: #D9A93A;
  --gold-hi: #F0C861;
  --gold-deep: #6E4F12;
  --red: #D6202B;
  --blue: #2451B7;
  --line: rgba(245, 238, 220, 0.14);
  --display: "Ultra", "Rockwell Extra Bold", Georgia, serif;
  --game: "Fredoka", "Arial Rounded MT Bold", system-ui, sans-serif;
  --body: "Figtree", system-ui, -apple-system, "Segoe UI", sans-serif;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bot: env(safe-area-inset-bottom, 0px);
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; margin: 0; }
body {
  background-color: var(--ground);
  background-image: linear-gradient(rgba(245,238,220,.035) 1px, transparent 1px), linear-gradient(90deg, rgba(245,238,220,.035) 1px, transparent 1px);
  background-size: 48px 24px;
  color: var(--cream);
  font: 18px/1.45 var(--body);
  overscroll-behavior: none;
  user-select: none; -webkit-user-select: none;
}
button { font: inherit; color: inherit; cursor: pointer; }
:focus-visible { outline: 3px solid var(--gold); outline-offset: 3px; }
[hidden] { display: none !important; }
h1, h2, h3 { margin: 0; text-wrap: balance; }
p { margin: 0; }

#app { height: 100%; max-width: 560px; margin: 0 auto; position: relative; }
.screen { position: absolute; inset: 0; display: flex; flex-direction: column; padding-top: var(--safe-top); padding-bottom: var(--safe-bot); }
.scroll { flex: 1; overflow-y: auto; -webkit-overflow-scrolling: touch; }
.pad { padding: 16px; display: grid; gap: 16px; align-content: start; }
.eyebrow { font: 700 12px/1 var(--body); letter-spacing: .14em; text-transform: uppercase; color: var(--gold); }
.note { font-size: 15px; color: var(--cream-dim); }

/* ---------- buttons ---------- */
.btn { border: 0; border-radius: 16px; padding: 16px 22px; font: 700 20px/1 var(--game); min-height: 56px; }
.btn-gold { background: var(--gold); color: var(--ground-deep); box-shadow: 0 5px 0 var(--gold-deep); }
.btn-gold:active { transform: translateY(3px); box-shadow: 0 2px 0 var(--gold-deep); }
.btn-ghost { background: var(--ground-deep); border: 2px solid var(--line); color: var(--cream); }
.btn-ghost small { font: 500 14px var(--body); color: var(--cream-dim); }
.btn-red { background: var(--red); color: var(--cream); box-shadow: 0 5px 0 #7E1016; }
.btn-wide { width: 100%; }
.icon-btn { width: 48px; height: 48px; border-radius: 14px; border: 0; background: rgba(0,0,0,.25); display: grid; place-items: center; }
.icon-btn svg { width: 26px; height: 26px; }

/* ---------- welcome ---------- */
.sign {
  background: var(--ground-deep); border: 3px solid var(--gold); border-radius: 6px;
  box-shadow: inset 0 0 0 6px var(--ground-deep), inset 0 0 0 8px rgba(217,169,58,.55), 0 14px 30px rgba(0,0,0,.35);
  padding: 30px 18px 26px; display: grid; gap: 14px; text-align: center; margin-top: 8px;
}
.sign .est { font: 600 12px/1 var(--body); letter-spacing: .22em; text-transform: uppercase; color: var(--cream-dim); }
.sign h1 { font: 400 clamp(38px, 11vw, 56px)/1 var(--display); color: var(--gold); text-shadow: 0 3px 0 var(--gold-deep); }
.sign .strap { font: 500 20px/1.3 var(--game); }
.sign .rule { height: 2px; width: 60%; margin: 0 auto; background: linear-gradient(90deg, transparent, var(--gold), transparent); }
.big-label { font: 600 22px/1.25 var(--game); }
.big-label.small { font-size: 18px; color: var(--cream-dim); }
.big-input { width: 100%; font: 600 26px/1.2 var(--game); color: var(--ground-deep); background: var(--cream); border: 0; border-radius: 14px; padding: 14px 16px; user-select: text; -webkit-user-select: text; }
.avatar-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.av { border: 0; background: none; padding: 0; display: grid; gap: 4px; justify-items: center; }
.av .avatar { width: 100%; max-width: 76px; height: auto; border-radius: 50%; transition: transform .15s ease, box-shadow .15s ease; }
.av[aria-pressed="true"] .avatar { box-shadow: 0 0 0 4px var(--gold); transform: scale(1.06); }
.av span { font-size: 12px; line-height: 1.2; color: var(--cream-dim); text-align: center; }

/* ---------- map ---------- */
.topbar { display: flex; align-items: center; gap: 10px; padding: 10px 12px; background: rgba(10,43,33,.9); border-bottom: 1px solid var(--line); }
.who { display: flex; align-items: center; gap: 10px; border: 0; background: none; padding: 0; min-width: 0; flex: 1; text-align: left; }
.who .avatar { width: 44px; height: 44px; border-radius: 50%; flex: none; }
.who span:last-child { font: 700 20px/1.1 var(--game); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chips { display: flex; gap: 6px; }
.chip { display: flex; align-items: center; gap: 4px; background: var(--ground-deep); border: 1px solid var(--line); border-radius: 999px; padding: 6px 10px 6px 7px; }
.chip svg { width: 20px; height: 20px; }
.chip b { font: 700 17px/1 var(--game); font-variant-numeric: tabular-nums; }
.bar-title { flex: 1; text-align: center; font: 400 22px/1 var(--display); color: var(--gold); }
.happy { background: linear-gradient(90deg, #B5861F, var(--gold-hi), #B5861F); color: var(--ground-deep); text-align: center; font: 700 16px/1.2 var(--game); padding: 8px 12px; }
.map-top { padding-bottom: 8px; }
.play-card {
  display: grid; justify-items: start; gap: 4px; text-align: left; border: 3px solid var(--gold); border-radius: 18px;
  background: radial-gradient(circle at 85% 20%, #1E6B50, var(--ground-deep) 70%); padding: 18px 20px; position: relative;
}
.play-title { font: 400 30px/1.1 var(--display); color: var(--gold); text-shadow: 0 2px 0 var(--gold-deep); }
.play-sub { font: 600 18px/1.2 var(--game); color: var(--cream); }
.play-go { justify-self: stretch; text-align: center; margin-top: 8px; background: var(--gold); color: var(--ground-deep); font: 700 22px/1 var(--game); padding: 14px 22px; border-radius: 14px; box-shadow: 0 4px 0 var(--gold-deep); }
.badge { font: 700 13px/1 var(--game); padding: 5px 10px; border-radius: 999px; background: var(--cream); color: var(--ground-deep); }
.badge.tricky { background: var(--blue); color: var(--cream); }
.badge.hard { background: var(--red); color: var(--cream); }
.badge.guvnor { background: var(--gold); color: var(--ground-deep); }
.badge.breather { background: #4CB85A; color: var(--ground-deep); }
.badge.club { background: #2F7A3A; color: var(--cream); }
.modes { display: grid; gap: 10px; }
.mode { display: grid; gap: 2px; text-align: left; background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 14px 16px; min-height: 64px; }
.mode b { font: 600 20px/1.2 var(--game); }
.mode span { font-size: 15px; color: var(--cream-dim); }

.tube { padding: 8px 16px 40px; }
.zone-head { margin: 26px 0 8px; display: grid; gap: 2px; }
.zone-done summary { list-style: none; cursor: pointer; }
.zone-done summary::-webkit-details-marker { display: none; }
.zone-done[open] summary span { color: var(--gold); }
.zone-head h3 { font: 400 22px/1.1 var(--display); color: var(--gold); }
.zone-head span { font-size: 14px; color: var(--cream-dim); }
.station { display: grid; grid-template-columns: 34px 1fr; gap: 10px; align-items: center; position: relative; min-height: 76px; }
.station::before { content: ""; position: absolute; left: 13px; top: 0; bottom: 0; width: 8px; background: var(--red); }
.station:first-of-type::before { top: 50%; }
.station .dot { position: relative; width: 26px; height: 26px; border-radius: 50%; background: var(--ground-deep); border: 5px solid var(--cream); z-index: 1; }
.station.done .dot { background: var(--cream); }
.station.here .dot { border-color: var(--gold); box-shadow: 0 0 0 4px rgba(217,169,58,.35); }
.station.locked { opacity: .5; }
.st-body { display: grid; gap: 6px; padding: 8px 0; }
.st-name { font: 600 18px/1.2 var(--game); }
.st-levels { display: flex; gap: 8px; flex-wrap: wrap; }
.lvl { min-width: 64px; height: 48px; border-radius: 12px; border: 2px solid var(--line); background: var(--ground-deep); display: grid; place-items: center; font: 700 17px/1 var(--game); padding: 0 8px; position: relative; }
.lvl small { display: block; font-size: 11px; letter-spacing: 1px; color: var(--gold); }
.lvl.here { border-color: var(--gold); background: #1E6B50; }
.lvl.hard { border-color: var(--red); }
.lvl.guvnor { border-color: var(--gold); }
.lvl[disabled] { opacity: .55; }

/* ---------- game ---------- */
.hud { display: flex; align-items: center; gap: 10px; padding: 8px 10px 4px; }
.hud-title { flex: 1; min-width: 0; display: grid; }
.hud-title b { font: 700 19px/1.15 var(--game); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hud-title span { font-size: 14px; color: var(--cream-dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hud-moves { background: var(--ground-deep); border: 2px solid var(--gold); border-radius: 14px; padding: 4px 12px; text-align: center; min-width: 76px; }
.hud-moves b { display: block; font: 700 30px/1 var(--game); font-variant-numeric: tabular-nums; }
.hud-moves span { font: 700 11px/1 var(--body); letter-spacing: .1em; text-transform: uppercase; color: var(--cream-dim); }
.hud-moves.low { border-color: var(--red); animation: pulse 1s ease-in-out infinite; }
@keyframes pulse { 50% { transform: scale(1.06); } }
.hud2 { display: flex; gap: 10px; align-items: stretch; padding: 4px 10px 8px; }
.scorebox { background: var(--ground-deep); border: 1px solid var(--line); border-radius: 12px; padding: 6px 10px; min-width: 110px; display: grid; gap: 4px; }
.scorebox b { font: 700 22px/1 var(--game); font-variant-numeric: tabular-nums; }
.starbar { position: relative; height: 10px; border-radius: 99px; background: rgba(0,0,0,.35); overflow: visible; }
.starbar i { position: absolute; left: 0; top: 0; bottom: 0; width: 0; border-radius: 99px; background: linear-gradient(90deg, var(--gold), var(--gold-hi)); transition: width .3s ease; }
.starbar em { position: absolute; top: -3px; width: 4px; height: 16px; background: var(--cream); border-radius: 2px; }
.goals { flex: 1; display: flex; gap: 6px; flex-wrap: wrap; align-content: center; justify-content: flex-end; }
.goal { display: flex; align-items: center; gap: 4px; background: var(--ground-deep); border: 1px solid var(--line); border-radius: 12px; padding: 4px 10px 4px 6px; min-height: 44px; }
.goal .tile-ico { width: 32px; height: 32px; }
.goal b { font: 700 20px/1 var(--game); font-variant-numeric: tabular-nums; }
.goal.done { border-color: #4CB85A; }
.goal.done b { color: #7BD88A; }
.goal .txt { font: 600 14px/1.1 var(--game); color: var(--cream-dim); }
.board-wrap { flex: 1; display: grid; place-items: center; position: relative; min-height: 0; padding: 0 6px; }
#board { touch-action: none; display: block; max-width: 100%; }
.board-wrap.shake { animation: shake .35s ease; }
@keyframes shake { 20% { transform: translate(-6px, 3px); } 40% { transform: translate(5px, -4px); } 60% { transform: translate(-4px, 2px); } 80% { transform: translate(3px, -1px); } }
.shout { position: absolute; left: 0; right: 0; top: 38%; text-align: center; pointer-events: none; font: 400 clamp(34px, 11vw, 60px)/1 var(--display); color: var(--gold); text-shadow: 0 4px 0 var(--gold-deep), 0 0 24px rgba(0,0,0,.6); opacity: 0; }
.shout.go { animation: shout 1.1s cubic-bezier(.2,1.4,.4,1) both; }
@keyframes shout { 0% { opacity: 0; transform: scale(2.4) rotate(-8deg); } 18% { opacity: 1; transform: scale(1) rotate(-5deg); } 75% { opacity: 1; transform: scale(1.02) rotate(-5deg); } 100% { opacity: 0; transform: scale(.9) translateY(-30px) rotate(-5deg); } }
.gamebar { padding: 8px 12px 12px; display: flex; justify-content: center; }
.gamebar .btn { width: 100%; }
.popper { position: absolute; border: 0; background: none; padding: 0; display: grid; justify-items: center; gap: 2px; z-index: 5; }
.popper span { font: 700 14px/1 var(--game); background: var(--gold); color: var(--ground-deep); padding: 5px 8px; border-radius: 8px; }
.van { top: 4px; left: 0; width: 140px; animation: van 7s linear forwards; }
.van svg { width: 130px; height: 70px; }
@keyframes van { from { transform: translateX(-160px); } to { transform: translateX(calc(100vw + 20px)); } }
.pigeon { top: 30%; left: 0; width: 90px; animation: pigeon 4.5s ease-in-out forwards; }
.pigeon svg { width: 80px; height: 60px; }
@keyframes pigeon { 0% { transform: translate(-100px, 60px); } 50% { transform: translate(45vw, -40px); } 100% { transform: translate(calc(100vw + 20px), 40px); } }

/* ---------- sheet ---------- */
.sheet { position: fixed; inset: 0; background: rgba(5,20,15,.72); display: grid; place-items: end center; z-index: 20; padding: 0 0 var(--safe-bot); }
.sheet-card { width: min(560px, 100%); max-height: 92%; overflow-y: auto; background: var(--ground); border-top: 3px solid var(--gold); border-radius: 22px 22px 0 0; padding: 22px 18px 20px; display: grid; gap: 14px; animation: up .28s cubic-bezier(.2,1.2,.4,1); }
@keyframes up { from { transform: translateY(100%); } }
.sheet-card h2 { font: 400 28px/1.1 var(--display); color: var(--gold); text-shadow: 0 2px 0 var(--gold-deep); }
.sheet-card .row { display: flex; gap: 10px; }
.sheet-card .row .btn { flex: 1; }
.sheet-goals { display: grid; gap: 8px; }
.sheet-goal { display: flex; align-items: center; gap: 12px; background: var(--ground-deep); border-radius: 12px; padding: 8px 12px; font: 600 18px/1.2 var(--game); }
.sheet-goal .tile-ico { width: 40px; height: 40px; flex: none; }
.boosters { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.booster { border: 2px solid var(--line); background: var(--ground-deep); border-radius: 14px; padding: 8px 4px; display: grid; justify-items: center; gap: 2px; }
.booster .tile-ico { width: 44px; height: 44px; }
.booster b { font: 600 14px/1.1 var(--game); }
.booster small { font-size: 12px; color: var(--cream-dim); }
.booster[aria-pressed="true"] { border-color: var(--gold); background: #1E6B50; }
.booster[disabled] { opacity: .45; }
.big-stars { display: flex; justify-content: center; gap: 8px; }
.big-stars svg { width: 58px; height: 58px; }
.big-stars svg.off path { fill: rgba(0,0,0,.35); stroke: var(--line); }
.stat-row { display: flex; justify-content: space-between; font: 600 18px/1.3 var(--game); padding: 6px 2px; border-bottom: 1px solid var(--line); }
.stat-row:last-child { border-bottom: 0; }
.opts { display: grid; gap: 8px; }
.opt { text-align: left; font: 600 20px/1.2 var(--game); padding: 14px 16px; border-radius: 14px; border: 2px solid var(--line); background: var(--ground-deep); }
.opt.right { border-color: #4CB85A; background: #1C5A3A; }
.opt.wrong { border-color: var(--red); }
.slang { font: 400 30px/1.1 var(--display); color: var(--cream); }

/* ---------- celebration ---------- */
.celebrate { position: fixed; inset: 0; z-index: 30; display: grid; place-items: center; background: radial-gradient(circle at 50% 38%, rgba(30,107,80,.92), rgba(5,20,15,.94) 70%); overflow: hidden; }
.celebrate canvas { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.cel-inner { position: relative; display: grid; gap: 14px; justify-items: center; text-align: center; padding: 0 16px; }
.stamp { font: 400 clamp(44px, 14vw, 78px)/1 var(--display); color: var(--gold); text-shadow: 0 5px 0 var(--gold-deep), 0 0 34px rgba(217,169,58,.5); transform: rotate(-6deg); }
.celebrate.play .stamp { animation: slam .55s cubic-bezier(.2,1.6,.4,1) .1s both; }
@keyframes slam { 0% { transform: rotate(-6deg) scale(3.2); opacity: 0; } 100% { transform: rotate(-6deg) scale(1); opacity: 1; } }
.cel-stars { display: flex; gap: 10px; min-height: 80px; align-items: center; }
.cel-stars svg { width: 66px; height: 66px; opacity: 0; }
.cel-stars svg:nth-child(2) { width: 84px; height: 84px; margin-top: -14px; }
.cel-stars svg.in { animation: pop .45s cubic-bezier(.2,1.8,.4,1) both; }
.cel-stars svg.off path { fill: rgba(0,0,0,.35); stroke: var(--line); }
@keyframes pop { 0% { transform: scale(0) rotate(-40deg); opacity: 0; } 100% { transform: scale(1) rotate(0); opacity: 1; } }
.cel-score { font: 700 44px/1 var(--game); font-variant-numeric: tabular-nums; }
.cel-sub { font: 600 18px/1.3 var(--game); color: var(--cream-dim); max-width: 22ch; }
.bus-run { position: absolute; bottom: calc(24px + var(--safe-bot)); left: -60%; display: flex; align-items: center; }
.bus-run svg { width: 84px; height: 84px; }
.bus-run span { font: 700 14px/1 var(--game); letter-spacing: .06em; background: var(--red); color: var(--cream); padding: 8px 12px; border-radius: 6px; margin-left: -10px; white-space: nowrap; }
.celebrate.play .bus-run { animation: drive 3s ease-in-out .9s both; }
@keyframes drive { 0% { left: -70%; } 40%, 62% { left: 50%; transform: translateX(-50%); } 100% { left: 130%; transform: translateX(-50%); } }

.toast { position: fixed; left: 50%; bottom: calc(96px + var(--safe-bot)); transform: translateX(-50%); z-index: 40; background: var(--cream); color: var(--ground-deep); font: 600 18px/1.3 var(--game); padding: 12px 18px; border-radius: 14px; box-shadow: 0 8px 24px rgba(0,0,0,.35); max-width: calc(100% - 32px); text-align: center; animation: toast 3.2s ease both; }
@keyframes toast { 0% { opacity: 0; transform: translate(-50%, 20px); } 10%, 85% { opacity: 1; transform: translate(-50%, 0); } 100% { opacity: 0; transform: translate(-50%, 10px); } }

/* ---------- leaderboard / settings ---------- */
.tabs { display: flex; gap: 6px; }
.tab { flex: 1; border: 1px solid var(--line); background: var(--ground-deep); border-radius: 999px; padding: 10px 6px; font: 600 15px/1 var(--game); color: var(--cream-dim); }
.tab.on { background: var(--gold); color: var(--ground-deep); border-color: var(--gold); }
.lb { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.lb li { display: grid; grid-template-columns: 30px 44px 1fr auto; gap: 10px; align-items: center; padding: 10px 12px; border-radius: 12px; background: var(--ground-deep); }
.lb li:first-child { box-shadow: inset 0 0 0 2px var(--gold); }
.lb .pos { font: 700 20px/1 var(--game); color: var(--gold); text-align: center; }
.lb .avatar { width: 44px; height: 44px; border-radius: 50%; }
.lb .nm { font: 600 19px/1.2 var(--game); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lb .pts { font: 700 19px/1 var(--game); font-variant-numeric: tabular-nums; }
.settings .toggle { display: flex; align-items: center; gap: 14px; font: 600 19px/1.2 var(--game); background: var(--panel); border-radius: 14px; padding: 14px 16px; }
.settings .toggle input { width: 28px; height: 28px; accent-color: var(--gold); }
.about { display: grid; gap: 10px; margin-top: 10px; }
.about h3 { font: 400 22px/1.1 var(--display); color: var(--gold); }
.about ul { margin: 0; padding-left: 20px; display: grid; gap: 6px; }

@media (prefers-reduced-motion: reduce) {
  .shout.go, .celebrate.play .stamp, .cel-stars svg.in, .celebrate.play .bus-run, .toast, .sheet-card, .hud-moves.low { animation-duration: .01s !important; }
  .van, .pigeon { animation-duration: 9s; }
}

/* ---------- v2: pub, wheel, barrow ---------- */
.mode-pub { background: linear-gradient(135deg, #6E4B32, #3A2A1E); border-color: rgba(217,169,58,.5); }
.mode-pub.ready { box-shadow: 0 0 0 3px var(--gold); }
.mode-wheel { background: linear-gradient(135deg, #FBF8F0, #E4DCC6); color: var(--ground-deep); }
.mode-wheel span { color: #6E4F12; }
.scene-wrap { border: 3px solid var(--gold); border-radius: 14px; background: #0A2B21; position: relative; }
.scene-wrap .scene { display: block; width: 100%; height: auto; aspect-ratio: 6 / 5; border-radius: 11px; }
.scene-wrap.glow { animation: glow 1.2s ease; }
@keyframes glow { 0% { box-shadow: 0 0 0 0 rgba(240,200,97,.9); transform: scale(1); } 30% { transform: scale(1.03); } 100% { box-shadow: 0 0 0 24px rgba(240,200,97,0); transform: scale(1); } }
.pub-next { display: grid; gap: 10px; background: var(--panel); border: 2px solid var(--gold); border-radius: 16px; padding: 16px; }
.pub-next b { font: 600 22px/1.2 var(--game); }
.pub-next .cost { font: 700 18px/1 var(--game); color: var(--gold); }
.pub-jobs { display: grid; gap: 6px; }
.pub-job { display: flex; justify-content: space-between; gap: 10px; padding: 10px 14px; border-radius: 12px; background: var(--ground-deep); font: 600 16px/1.25 var(--game); color: var(--cream-dim); }
.pub-job.done { color: var(--gold); }
.pub-job small { font: 700 14px/1.25 var(--game); white-space: nowrap; }
.wheel-box { position: relative; width: min(300px, 80vw); aspect-ratio: 1; margin: 0 auto; }
.wheel-box svg.wheel { width: 100%; height: 100%; transition: transform 3.6s cubic-bezier(.12,.8,.18,1); }
.wheel-box .pointer { position: absolute; left: 50%; top: -6px; transform: translateX(-50%); width: 0; height: 0; border-left: 16px solid transparent; border-right: 16px solid transparent; border-top: 28px solid var(--red); filter: drop-shadow(0 2px 2px rgba(0,0,0,.5)); }
.offers { display: grid; gap: 8px; }
.offer { display: flex; align-items: center; gap: 12px; border: 2px solid var(--line); background: var(--ground-deep); border-radius: 14px; padding: 10px 14px; text-align: left; }
.offer .tile-ico { width: 48px; height: 48px; flex: none; }
.offer b { font: 600 18px/1.2 var(--game); flex: 1; }
.offer span { font: 700 17px/1 var(--game); color: var(--gold); white-space: nowrap; }
.offer[disabled] { opacity: .45; }
