/* Maple Junction - sunny cream panels, green and gold buttons, chunky rounded type. */
:root {
  --sky: #7cc5e8; --cream: #fff8e8; --cream2: #f6e7c4; --wood: #b77a42; --wood2: #8a5527;
  --green: #5bbf3a; --green2: #3f962a; --gold: #ffc531; --gold2: #e79a12; --red: #e8553b;
  --ink: #3b2a1a; --muted: #8c7558; --miss: #e04a3a;
  --safe-t: env(safe-area-inset-top, 0px); --safe-b: env(safe-area-inset-bottom, 0px);
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; overflow: hidden; background: var(--sky); color: var(--ink); font-family: 'Fredoka', 'Nunito', system-ui, sans-serif; user-select: none; -webkit-user-select: none; touch-action: none; }
button { font: inherit; color: inherit; border: 0; background: none; cursor: pointer; padding: 0; }
.ic { width: 28px; height: 28px; object-fit: contain; vertical-align: middle; }
.ic.sm { width: 18px; height: 18px; }
.ic.face { width: 52px; height: 52px; border-radius: 50%; background: #fff3d6; }
.ic.face.big { width: 72px; height: 72px; }
.ic.hero { width: 140px; height: 140px; }
.muted { color: var(--muted); }
.miss { color: var(--miss); }
#map { position: fixed; inset: 0; width: 100%; height: 100%; display: block; }

/* ---- buttons ---- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 10px 18px; border-radius: 16px; font-weight: 700; font-size: 16px; color: #fff;
  background: linear-gradient(#72d24f, var(--green2)); box-shadow: 0 4px 0 #2c6e1d, 0 6px 10px rgba(0,0,0,.18); text-shadow: 0 1px 0 rgba(0,0,0,.25); }
.btn:active { transform: translateY(3px); box-shadow: 0 1px 0 #2c6e1d; }
.btn.gold { background: linear-gradient(#ffd75a, var(--gold2)); box-shadow: 0 4px 0 #b06e06, 0 6px 10px rgba(0,0,0,.18); color: #5a3300; text-shadow: 0 1px 0 rgba(255,255,255,.5); }
.btn.ghost { background: #fff; color: var(--wood2); box-shadow: 0 4px 0 #d9c39a, 0 4px 8px rgba(0,0,0,.08); text-shadow: none; }
.btn.red { background: linear-gradient(#ff7b62, #d13d24); box-shadow: 0 4px 0 #8f2412; }
.btn.sm { padding: 6px 12px; font-size: 14px; border-radius: 12px; }
.btn.xl { padding: 16px 64px; font-size: 26px; border-radius: 22px; }
.btn:disabled { filter: grayscale(.7); opacity: .6; }
.round { width: 44px; height: 44px; border-radius: 50%; background: var(--cream); box-shadow: 0 3px 0 #d9c39a, 0 4px 10px rgba(0,0,0,.2); display: grid; place-items: center; }
.round.x { font-size: 28px; line-height: 1; color: var(--wood2); font-weight: 700; }

/* ---- HUD ---- */
#top { position: fixed; top: calc(8px + var(--safe-t)); left: 8px; right: 8px; display: flex; align-items: center; gap: 8px; pointer-events: none; z-index: 5; }
#top > * { pointer-events: auto; }
#lvlBox { display: flex; align-items: center; }
#lvl { width: 46px; height: 46px; border-radius: 50%; background: radial-gradient(circle at 35% 30%, #8fe36b, #3f962a); color: #fff; font-weight: 700; font-size: 20px; display: grid; place-items: center; border: 3px solid #fff; box-shadow: 0 3px 8px rgba(0,0,0,.25); z-index: 1; text-shadow: 0 1px 0 rgba(0,0,0,.3); }
#xpbar { position: relative; width: 74px; height: 20px; margin-left: -10px; background: rgba(60,40,20,.55); border-radius: 0 10px 10px 0; overflow: hidden; }
#xpfill { position: absolute; inset: 0 auto 0 0; background: linear-gradient(#ffe27a, #f2b50a); }
#xptext { position: absolute; inset: 0; display: grid; place-items: center; font-size: 11px; font-weight: 600; color: #fff; text-shadow: 0 1px 1px rgba(0,0,0,.6); padding-left: 8px; }
.pills { display: flex; gap: 4px; margin-left: auto; min-width: 0; }
.pill { white-space: nowrap; display: flex; align-items: center; gap: 3px; height: 30px; padding: 0 5px 0 3px; border-radius: 15px; background: rgba(60,40,20,.55); color: #fff; font-weight: 600; font-size: 14px; }
@media (max-width: 400px) { .pill .plus { display: none; } #top { gap: 4px; } }
.pill .ic { width: 24px; height: 24px; }
.pill .plus { width: 18px; height: 18px; border-radius: 50%; background: var(--green); display: grid; place-items: center; font-size: 15px; line-height: 1; }
.pi { color: #9ad7ff; font-size: 14px; padding: 0 2px 0 4px; }
#menuBtn { position: fixed; top: calc(62px + var(--safe-t)); right: 8px; z-index: 5; flex-direction: column; gap: 3px; display: flex; align-items: center; justify-content: center; }
#menuBtn span { width: 18px; height: 3px; border-radius: 2px; background: var(--wood2); }
#dailyDot { position: absolute; top: 2px; right: 2px; width: 12px; height: 12px; border-radius: 50%; background: var(--red); border: 2px solid #fff; }
#bottom { position: fixed; left: 8px; right: 8px; bottom: calc(10px + var(--safe-b)); display: flex; gap: 8px; align-items: flex-end; z-index: 5; pointer-events: none; }
#bottom > * { pointer-events: auto; }
.spacer { flex: 1; pointer-events: none !important; }
.hbtn { position: relative; width: 72px; height: 72px; border-radius: 22px; background: var(--cream); box-shadow: 0 4px 0 #d2b98c, 0 6px 14px rgba(0,0,0,.22); display: flex; flex-direction: column; align-items: center; justify-content: center; font-weight: 700; font-size: 13px; color: var(--wood2); }
.hbtn .ic { width: 44px; height: 40px; }
.hbtn small { position: absolute; top: -8px; right: -6px; background: var(--wood2); color: #fff; border-radius: 10px; padding: 1px 6px; font-size: 11px; }
.hbtn.shop { background: linear-gradient(#ffd75a, var(--gold2)); color: #5a3300; box-shadow: 0 4px 0 #b06e06, 0 6px 14px rgba(0,0,0,.22); }
#ordersBtn.hot::after { content: '!'; position: absolute; top: -6px; right: -6px; width: 22px; height: 22px; border-radius: 50%; background: var(--red); color: #fff; display: grid; place-items: center; font-size: 15px; border: 2px solid #fff; animation: bob 1s ease-in-out infinite; }
@keyframes bob { 50% { transform: translateY(-4px); } }

/* ---- toast, guide ---- */
#toast { position: fixed; left: 50%; top: calc(110px + var(--safe-t)); transform: translate(-50%, -20px); opacity: 0; transition: .25s; z-index: 30; background: rgba(50,34,18,.88); color: #fff; padding: 10px 16px; border-radius: 14px; font-weight: 500; font-size: 15px; max-width: 88vw; text-align: center; pointer-events: none; }
#toast.on { opacity: 1; transform: translate(-50%, 0); }
#guide { position: fixed; left: 10px; right: 10px; bottom: calc(96px + var(--safe-b)); display: flex; gap: 10px; align-items: center; background: var(--cream); border-radius: 18px; padding: 10px 14px; box-shadow: 0 6px 18px rgba(0,0,0,.2); z-index: 6; transform: translateY(20px); opacity: 0; transition: .3s; pointer-events: none; }
#guide.on { transform: none; opacity: 1; }
#guide p { margin: 0; font-weight: 500; font-size: 15px; }

/* ---- seed picker ---- */
#seeds { position: fixed; z-index: 8; left: 50%; transform: translateX(-50%); bottom: calc(92px + var(--safe-b)); display: none; gap: 6px; padding: 8px; background: var(--cream); border-radius: 18px; box-shadow: 0 6px 18px rgba(0,0,0,.25); max-width: calc(100vw - 16px); overflow-x: auto; }
#seeds.on { display: flex; }
.seed { flex: 0 0 56px; width: 56px; display: flex; flex-direction: column; align-items: center; padding: 4px 2px; border-radius: 12px; background: #fff; box-shadow: 0 2px 0 #e2cfa6; position: relative; }
.seed .ic { width: 40px; height: 40px; }
.seed small { font-size: 11px; font-weight: 600; color: var(--wood2); }
.seed em { position: absolute; top: 2px; right: 3px; font-style: normal; font-size: 10px; color: var(--muted); }
.seed.on { background: #e2f7d4; box-shadow: 0 0 0 3px var(--green); }
.seed.dim { opacity: .45; }

/* ---- placement bar ---- */
#placebar { position: fixed; left: 10px; right: 10px; bottom: calc(10px + var(--safe-b)); z-index: 9; display: none; align-items: center; gap: 8px; background: var(--cream); padding: 10px; border-radius: 18px; box-shadow: 0 6px 18px rgba(0,0,0,.25); }
#placebar.on { display: flex; }
#placebar span { flex: 1; font-weight: 600; font-size: 15px; }
body:has(#placebar.on) #bottom { display: none; }

/* ---- sheet ---- */
#scrim { position: fixed; inset: 0; background: rgba(30,20,10,.35); opacity: 0; pointer-events: none; transition: .2s; z-index: 10; }
#scrim.on { opacity: 1; pointer-events: auto; }
#sheet { position: fixed; left: 0; right: 0; bottom: 0; max-height: 78vh; z-index: 11; background: var(--cream); border-radius: 26px 26px 0 0; box-shadow: 0 -8px 24px rgba(0,0,0,.2); transform: translateY(105%); transition: transform .25s ease; display: flex; flex-direction: column; padding-bottom: var(--safe-b); }
#sheet.open { transform: none; }
.sheethead { display: flex; align-items: center; padding: 12px 14px 6px 18px; background: linear-gradient(var(--wood), var(--wood2)); border-radius: 26px 26px 0 0; color: #fff; }
.sheethead h3 { flex: 1; margin: 0; font-size: 22px; font-weight: 700; text-shadow: 0 2px 0 rgba(0,0,0,.25); }
.sheethead .cap { font-size: 14px; opacity: .9; margin-left: 6px; }
#sheetBody { overflow-y: auto; padding: 12px 14px 18px; -webkit-overflow-scrolling: touch; touch-action: pan-y; }
#sheetBody h4 { margin: 14px 0 6px; color: var(--wood2); }
.row { display: flex; gap: 8px; margin: 10px 0; flex-wrap: wrap; }
.row.end { justify-content: flex-end; }
.col { display: flex; flex-direction: column; gap: 8px; }
.center { text-align: center; display: flex; flex-direction: column; align-items: center; gap: 8px; }

.tabs { display: flex; gap: 6px; margin-bottom: 10px; overflow-x: auto; }
.tab { padding: 8px 14px; border-radius: 14px; background: var(--cream2); font-weight: 600; color: var(--wood2); white-space: nowrap; }
.tab.on { background: var(--wood2); color: #fff; }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 8px; }
.card { background: #fff; border-radius: 18px; padding: 8px 6px; display: flex; flex-direction: column; align-items: center; gap: 2px; box-shadow: 0 3px 0 #e2cfa6; position: relative; }
.card.dim { opacity: .55; }
.cardimg { position: relative; width: 86px; height: 76px; display: grid; place-items: center; }
.cardimg .ic { width: 86px; height: 76px; }
.card b { font-size: 14px; text-align: center; }
.card small { font-size: 11px; color: var(--muted); text-align: center; }
.card .have { position: absolute; top: 6px; left: 8px; }
.price { display: flex; align-items: center; gap: 3px; font-weight: 700; color: var(--wood2); }
.lock { position: absolute; bottom: 0; right: 0; background: var(--wood2); color: #fff; font-size: 11px; font-weight: 700; padding: 2px 6px; border-radius: 8px; }

.capbar { height: 14px; border-radius: 7px; background: var(--cream2); overflow: hidden; margin-bottom: 10px; }
.capbar i { display: block; height: 100%; background: linear-gradient(#8fe36b, var(--green2)); }
.slots { display: grid; grid-template-columns: repeat(auto-fill, minmax(62px, 1fr)); gap: 6px; }
.slot { background: #fff; border-radius: 14px; padding: 6px 2px 4px; display: flex; flex-direction: column; align-items: center; box-shadow: 0 2px 0 #e2cfa6; }
.slot .ic { width: 40px; height: 40px; }
.slot span { font-weight: 700; font-size: 14px; }
.slot.on { box-shadow: 0 0 0 3px var(--gold2); }
.sellbar { display: flex; align-items: center; gap: 8px; background: #fff; border-radius: 16px; padding: 8px; margin-bottom: 10px; flex-wrap: wrap; }
.sellbar > div { flex: 1; display: flex; flex-direction: column; min-width: 80px; }
.sellbar small { color: var(--muted); font-size: 12px; }
.qty { min-width: 24px; text-align: center; }
.upg { margin-top: 12px; background: #fff; border-radius: 16px; padding: 10px; display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.upg small { color: var(--muted); }
.needs { display: flex; gap: 8px; flex-wrap: wrap; font-weight: 700; font-size: 13px; }
.needs span { display: inline-flex; align-items: center; gap: 2px; }
.upg .needs { flex: 1; }

.queue { display: flex; gap: 6px; flex-wrap: wrap; }
.qslot { position: relative; width: 64px; height: 64px; border-radius: 16px; background: #fff; display: grid; place-items: center; box-shadow: inset 0 0 0 2px #ecdcb8; }
.qslot.empty { background: rgba(255,255,255,.5); }
.qslot .ic { width: 44px; height: 44px; }
.qslot span { position: absolute; right: 4px; top: 2px; font-size: 11px; font-weight: 700; color: var(--wood2); }
.qslot em { position: absolute; bottom: -6px; left: 50%; transform: translateX(-50%); font-style: normal; font-size: 11px; font-weight: 700; background: var(--wood2); color: #fff; border-radius: 8px; padding: 0 6px; white-space: nowrap; }
.qslot.run { box-shadow: inset 0 0 0 3px var(--gold); }
.qslot.ready { box-shadow: inset 0 0 0 3px var(--green); }
.qslot.ready em { background: var(--green2); }
.qslot.add { font-size: 26px; font-weight: 700; color: var(--green2); display: flex; flex-direction: column; }
.qslot.add small { font-size: 11px; display: flex; align-items: center; }
.recipes { display: flex; flex-direction: column; gap: 6px; margin-top: 8px; }
.recipe { display: flex; gap: 10px; align-items: center; text-align: left; background: #fff; border-radius: 16px; padding: 8px 10px; box-shadow: 0 3px 0 #e2cfa6; }
.recipe > .ic { width: 52px; height: 52px; }
.recipe > div { display: flex; flex-direction: column; gap: 2px; flex: 1; }
.recipe small { color: var(--muted); font-size: 12px; }
.recipe.dim { opacity: .5; }

.animals { display: flex; gap: 8px; justify-content: center; }
.animal { width: 84px; background: #fff; border-radius: 16px; padding: 8px; display: flex; flex-direction: column; align-items: center; box-shadow: 0 3px 0 #e2cfa6; }
.animal .ic { width: 48px; height: 48px; }
.animal small { font-weight: 600; color: var(--wood2); }
.animal.ready { box-shadow: 0 0 0 3px var(--green); }

.odet { display: flex; gap: 10px; align-items: center; background: #fff; border-radius: 18px; padding: 10px; margin-bottom: 10px; }
.odet > div:nth-child(2) { flex: 1; }
.ocards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.ocard { background: #fff; border-radius: 16px; padding: 8px 4px; display: flex; flex-direction: column; align-items: center; gap: 4px; box-shadow: 0 3px 0 #e2cfa6; min-height: 120px; }
.ocard.on { box-shadow: 0 0 0 3px var(--gold2); }
.ocard.ok .face { box-shadow: 0 0 0 3px var(--green); }
.ocard.wait { justify-content: center; color: var(--muted); background: rgba(255,255,255,.55); }
.oitems { display: flex; gap: 6px; flex-wrap: wrap; justify-content: center; font-weight: 700; font-size: 13px; }
.oitems span { display: inline-flex; align-items: center; gap: 1px; }
.oitems.big { font-size: 15px; justify-content: flex-start; margin: 4px 0; }
.oitems.big .ic { width: 36px; height: 36px; }
.orew { display: flex; align-items: center; gap: 3px; font-weight: 700; font-size: 13px; color: var(--wood2); }
.xp { color: #3a8fd0; }

.wagons { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; }
.wagon { width: 100px; background: #fff; border-radius: 16px; padding: 8px; display: flex; flex-direction: column; align-items: center; gap: 4px; box-shadow: 0 3px 0 #e2cfa6; }
.wagon .wag { width: 80px; height: 50px; }
.wagon.full { box-shadow: 0 0 0 3px var(--green); }
.packs { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 8px; }
.pack { position: relative; background: #fff; border-radius: 18px; padding: 10px; display: flex; flex-direction: column; align-items: center; gap: 4px; box-shadow: 0 3px 0 #e2cfa6; }
.pack .ic { width: 52px; height: 52px; }
.pack .btn .ic { width: 18px; height: 18px; }
.pack em { position: absolute; top: -6px; left: 50%; transform: translateX(-50%); background: var(--red); color: #fff; font-style: normal; font-size: 11px; font-weight: 700; padding: 1px 8px; border-radius: 8px; white-space: nowrap; }
.pack small { color: var(--muted); font-size: 12px; }
.stat { display: flex; gap: 10px; align-items: center; background: #fff; border-radius: 16px; padding: 10px; }
.stat > div { flex: 1; display: flex; flex-direction: column; }
.stat small { color: var(--muted); }
.menu { display: flex; flex-direction: column; gap: 8px; }
.mrow { text-align: left; background: #fff; border-radius: 14px; padding: 14px; font-weight: 600; font-size: 16px; box-shadow: 0 2px 0 #e2cfa6; }
.help p { line-height: 1.45; }
.about h2 { margin: 6px 0 0; color: var(--wood2); }
.madeby { display: flex; align-items: center; gap: 8px; font-weight: 600; }
.madeby img { height: 30px; width: auto; }

/* ---- level up ---- */
#lvlUp { position: fixed; inset: 0; z-index: 40; background: rgba(30,20,10,.5); display: none; place-items: center; }
#lvlUp.on { display: grid; }
.lvlcard { width: min(320px, 86vw); background: var(--cream); border-radius: 28px; padding: 18px; text-align: center; box-shadow: 0 10px 30px rgba(0,0,0,.3); animation: popin .35s ease; }
.lvlcard small { font-size: 18px; font-weight: 700; color: var(--wood2); text-transform: uppercase; letter-spacing: 1px; }
.burst { width: 110px; height: 110px; margin: 10px auto; border-radius: 50%; background: radial-gradient(circle at 35% 30%, #8fe36b, #3f962a); display: grid; place-items: center; border: 5px solid #fff; box-shadow: 0 0 0 6px var(--gold), 0 6px 18px rgba(0,0,0,.25); }
.burst b { font-size: 48px; color: #fff; text-shadow: 0 3px 0 rgba(0,0,0,.25); }
@keyframes popin { from { transform: scale(.7); opacity: 0; } }

/* ---- puzzle pier ---- */
#match { position: fixed; inset: 0; z-index: 20; display: none; flex-direction: column; background: linear-gradient(#8fd3f4, #4fa6d8 60%, #2f7fb5); padding: calc(10px + var(--safe-t)) 10px calc(10px + var(--safe-b)); }
#match.on { display: flex; }
.mtop { display: flex; align-items: center; gap: 10px; color: #fff; }
.mtop b { flex: 1; font-size: 22px; text-shadow: 0 2px 0 rgba(0,0,0,.2); }
.moves { background: var(--cream); color: var(--wood2); border-radius: 16px; padding: 4px 14px; text-align: center; }
.moves small { display: block; font-size: 11px; font-weight: 600; }
.moves b { font-size: 24px; color: var(--wood2); text-shadow: none; }
#mGoals { display: flex; gap: 10px; justify-content: center; margin: 10px 0; }
#mGoals span { display: flex; align-items: center; gap: 4px; background: rgba(255,255,255,.85); border-radius: 14px; padding: 4px 10px; font-weight: 700; font-size: 18px; }
#mGoals span.ok { background: #d9f7c8; }
#mGoals .ic { width: 34px; height: 34px; }
#mBoard { flex: 1; width: 100%; min-height: 0; touch-action: none; }
#mResult { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); width: min(320px, 86vw); background: var(--cream); border-radius: 26px; padding: 18px; text-align: center; display: none; flex-direction: column; gap: 10px; box-shadow: 0 10px 30px rgba(0,0,0,.3); }
#mResult.on { display: flex; }
#mResult h3 { margin: 0; font-size: 24px; color: var(--wood2); }
#mResult p { margin: 0; }

/* ---- title ---- */
#title { position: fixed; inset: 0; z-index: 50; background: var(--sky); display: flex; flex-direction: column; align-items: center; transition: opacity .4s; }
#title.gone { opacity: 0; pointer-events: none; }
#title .splash { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.tbox { position: relative; margin-top: calc(9vh + var(--safe-t)); text-align: center; }
.tbox h1 { margin: 0; font-size: clamp(48px, 15vw, 84px); line-height: .92; font-weight: 700; color: #fff; letter-spacing: 1px;
  text-shadow: 0 4px 0 #b9651c, 0 7px 0 #8a4410, 0 12px 18px rgba(0,0,0,.35); -webkit-text-stroke: 2px #c86e1f; paint-order: stroke fill; }
.tag { margin: 12px 0 0; display: inline-block; background: rgba(255,255,255,.88); color: var(--wood2); font-weight: 600; padding: 6px 16px; border-radius: 16px; }
.tfoot { position: absolute; bottom: calc(28px + var(--safe-b)); display: flex; flex-direction: column; align-items: center; gap: 10px; }
#tstatus { margin: 0; color: #fff; font-size: 13px; text-shadow: 0 1px 2px rgba(0,0,0,.5); min-height: 16px; }
#title .madeby { color: #fff; text-shadow: 0 1px 3px rgba(0,0,0,.6); background: rgba(30,20,10,.35); padding: 6px 12px; border-radius: 14px; }

/* ---- landscape phones and tablets: side panel, compact HUD, puzzle beside its goals ---- */
:root { --safe-l: env(safe-area-inset-left, 0px); --safe-r: env(safe-area-inset-right, 0px); }
@media (orientation: landscape) {
  #top { left: calc(8px + var(--safe-l)); right: calc(8px + var(--safe-r)); }
  #menuBtn { right: calc(8px + var(--safe-r)); }
  #bottom { left: calc(8px + var(--safe-l)); right: calc(8px + var(--safe-r)); }
  #sheet { left: auto; top: 0; right: 0; bottom: 0; width: min(440px, 58vw); max-height: none; border-radius: 24px 0 0 24px; transform: translateX(105%); padding-bottom: 0; padding-right: var(--safe-r); }
  #sheet.open { transform: none; }
  .sheethead { border-radius: 24px 0 0 0; padding-top: calc(10px + var(--safe-t)); }
  #sheetBody { padding-bottom: calc(14px + var(--safe-b)); }
  #guide, #placebar { left: 50%; right: auto; width: min(520px, 70vw); transform: translateX(-50%); }
  #guide { transform: translate(-50%, 20px); }
  #guide.on { transform: translate(-50%, 0); }
  .ocards { grid-template-columns: repeat(3, 1fr); }
  .tbox { margin-top: calc(5vh + var(--safe-t)); }
  .tbox h1 { font-size: clamp(40px, 13vh, 84px); }
  .tbox h1 br { display: none; }
  .tfoot { bottom: calc(14px + var(--safe-b)); gap: 6px; }
  .btn.xl { padding: 12px 56px; font-size: 22px; }
  /* puzzle: header and goals on the left, the board fills the right */
  #match { display: none; grid-template-columns: minmax(170px, 26vw) 1fr; grid-template-rows: auto 1fr; padding: calc(10px + var(--safe-t)) calc(10px + var(--safe-r)) calc(10px + var(--safe-b)) calc(10px + var(--safe-l)); column-gap: 14px; }
  #match.on { display: grid; }
  .mtop { grid-column: 1; grid-row: 1; flex-wrap: wrap; }
  #mGoals { grid-column: 1; grid-row: 2; flex-direction: column; align-items: flex-start; justify-content: flex-start; margin: 14px 0 0; }
  #mBoard { grid-column: 2; grid-row: 1 / 3; height: 100%; }
}
@media (orientation: landscape) and (max-height: 520px) {
  .hbtn { width: 60px; height: 60px; border-radius: 18px; font-size: 12px; }
  .hbtn .ic { width: 36px; height: 32px; }
  #lvl { width: 40px; height: 40px; font-size: 18px; }
  #menuBtn { top: calc(54px + var(--safe-t)); width: 40px; height: 40px; }
  #seeds { bottom: calc(76px + var(--safe-b)); }
  #guide { bottom: calc(76px + var(--safe-b)); }
  .lvlcard { padding: 12px; }
  .burst { width: 84px; height: 84px; margin: 6px auto; }
  .burst b { font-size: 38px; }
  .card { padding: 6px 4px; }
  .cardimg, .cardimg .ic { width: 72px; height: 62px; }
}
/* ---- tablets: the phone-sized interface scaled up (the map canvas itself is never zoomed) ---- */
@media (min-width: 1000px) and (min-height: 700px) {
  #seeds, #placebar, #guide, #toast, .lvlcard, .mtop, #mGoals, #mResult { zoom: 1.4; }
  /* the fixed HUD bars scale with a transform, which keeps their screen edges exact */
  #top { transform: scale(1.4); transform-origin: top left; width: calc((100vw - 16px - var(--safe-l) - var(--safe-r)) / 1.4); right: auto; }
  #bottom { transform: scale(1.4); transform-origin: bottom left; width: calc((100vw - 16px - var(--safe-l) - var(--safe-r)) / 1.4); right: auto; }
  #menuBtn { transform: scale(1.4); transform-origin: top right; }
  #sheet { zoom: 1.35; }
}
