:root{--sat:env(safe-area-inset-top);--sar:env(safe-area-inset-right);--sab:env(safe-area-inset-bottom);--sal:env(safe-area-inset-left)}
/* Nunito Sans (SIL Open Font License, fonts/OFL.txt), self-hosted and precached for offline play.
   The fallback face is metric-matched so text doesn't jump when the web font arrives. */
@font-face{font-family:"Nunito Sans";src:url("fonts/nunito-sans-var.woff2") format("woff2");font-weight:200 1000;font-style:normal;font-display:swap}
@font-face{font-family:"Nunito Sans Fallback";src:local("Helvetica Neue"),local("HelveticaNeue"),local("Arial"),local("Helvetica"),local("Roboto");size-adjust:101%;ascent-override:100%;descent-override:35%;line-gap-override:0%}
:root{
  --ink:#2a2418; --paper:#fbf6ea; --card:#fffdf7; --line:#e4d9c2;
  --green:#2f5d3a; --green2:#3f7a4c; --gold:#e3a826; --red:#c8463c; --blue:#2f7fb5;
  --shadow:0 6px 18px rgba(40,30,10,.18);
  --font: "Nunito Sans", "Nunito Sans Fallback", -apple-system, "Segoe UI", system-ui, Roboto, sans-serif;
}
*{box-sizing:border-box;-webkit-tap-highlight-color:transparent}
html,body{margin:0;height:100%;overflow:hidden;background:#7dba5a;font-family:var(--font);color:var(--ink);
  user-select:none;-webkit-user-select:none;overscroll-behavior:none;touch-action:none}
canvas#game{position:fixed;left:0;top:0;width:100vw;width:var(--app-w,100vw);height:100vh;height:100dvh;height:var(--app-h,100dvh);display:block;touch-action:none}
button{font-family:inherit;color:inherit;cursor:pointer}
.hidden{display:none!important}

/* HUD */
#hud{position:fixed;left:0;right:0;top:0;display:flex;flex-wrap:wrap;gap:6px;padding:calc(var(--sat) + 8px) calc(var(--sar) + 8px) 0 calc(var(--sal) + 8px);pointer-events:none;align-items:center}
.pill{pointer-events:auto;display:flex;align-items:center;gap:6px;background:rgba(255,253,247,.94);border:1px solid rgba(0,0,0,.06);
  border-radius:999px;padding:5px 10px;font-size:13px;box-shadow:0 2px 8px rgba(40,30,10,.15);white-space:nowrap}
#moneyPill b{font-size:15px;color:#3b5b1d;font-variant-numeric:tabular-nums}
.bar{display:inline-block;width:46px;height:7px;border-radius:5px;background:#e9e0cc;overflow:hidden}
.bar i{display:block;height:100%;width:0;background:linear-gradient(90deg,#e3a826,#f0c75a);border-radius:5px;transition:width .3s}
#hopfill{background:linear-gradient(90deg,#5c9a3e,#8cc56a)}
#hopperPill.full #hopfill{background:linear-gradient(90deg,#c8463c,#e57a52)}
#hopperPill.full{animation:pulse 1s infinite}
@keyframes pulse{50%{transform:scale(1.06)}}
#hoptxt{font-variant-numeric:tabular-nums;font-size:12px}
#envPill{gap:8px;font-size:12px}
#envPill #weatherTxt{color:#5a6b7a}
.btn-icon{margin-left:auto;width:38px;height:34px;justify-content:center;padding:0}
.burger,.burger:before,.burger:after{display:block;width:16px;height:2px;background:var(--ink);border-radius:2px;position:relative}
.burger:before,.burger:after{content:"";position:absolute;left:0}
.burger:before{top:-5px}.burger:after{top:5px}
.ico{width:16px;height:16px;display:inline-block;background-size:contain;background-repeat:no-repeat}
.ico-coin{background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Ccircle cx='8' cy='8' r='7' fill='%23e3a826'/%3E%3Ccircle cx='8' cy='8' r='5' fill='none' stroke='%23b37d0e' stroke-width='1.2'/%3E%3Ctext x='8' y='11.2' font-size='8' text-anchor='middle' font-family='Arial' font-weight='bold' fill='%23845a06'%3E$%3C/text%3E%3C/svg%3E")}
.ico-hopper{background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M2 4h12l-2 9H4z' fill='%23a77b3e'/%3E%3Cpath d='M3 4c1-3 9-3 10 0' fill='%23e3c04a'/%3E%3C/svg%3E")}
.lvl{font-size:12px}.lvl b{font-size:14px}

/* toasts */
#toasts{position:fixed;left:50%;top:calc(var(--sat) + 92px);transform:translateX(-50%);display:flex;flex-direction:column;gap:6px;align-items:center;pointer-events:none;z-index:5;width:min(92vw,420px)}
.toast{background:rgba(42,36,24,.9);color:#fff;padding:8px 14px;border-radius:12px;font-size:14px;box-shadow:var(--shadow);animation:tin .25s ease-out;text-align:center}
.toast.good{background:rgba(47,93,58,.95)}.toast.warn{background:rgba(168,62,40,.95)}.toast.gold{background:rgba(160,110,10,.95)}
@keyframes tin{from{opacity:0;transform:translateY(-8px)}}

/* bottom tools */
#bottom{position:fixed;left:0;right:0;bottom:0;padding:0 calc(var(--sar) + 8px) calc(var(--sab) + 8px) calc(var(--sal) + 8px);display:flex;flex-direction:column;align-items:center;gap:6px;pointer-events:none}
#tools{pointer-events:auto;display:flex;gap:4px;background:rgba(255,253,247,.95);border-radius:18px;padding:5px;box-shadow:var(--shadow);max-width:460px;width:100%}
.tool{flex:1;border:0;background:transparent;border-radius:13px;padding:6px 2px 5px;display:flex;flex-direction:column;align-items:center;gap:2px;font-size:11.5px;font-weight:600;color:#5b5240;min-height:54px}
.tool.on{background:var(--green);color:#fff}
.tico{width:26px;height:26px;background-size:contain;background-repeat:no-repeat;background-position:center}
.t-drive{background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 26 26'%3E%3Crect x='6' y='8' width='9' height='7' rx='1.5' fill='%23c8463c'/%3E%3Crect x='14' y='11' width='7' height='4' rx='1' fill='%23c8463c'/%3E%3Cpath d='M7.5 9h6v4h-6z' fill='%23bfe3f2'/%3E%3Ccircle cx='9' cy='18' r='4.2' fill='%23333'/%3E%3Ccircle cx='9' cy='18' r='1.6' fill='%23ddd'/%3E%3Ccircle cx='19.5' cy='18.5' r='2.6' fill='%23333'/%3E%3C/svg%3E")}
.t-plow{background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 26 26'%3E%3Cpath d='M3 20h20' stroke='%236b4a2f' stroke-width='3' stroke-linecap='round'/%3E%3Cpath d='M5 8h16' stroke='%23555' stroke-width='2.5'/%3E%3Cpath d='M8 8l-2 9M13 8l-2 9M18 8l-2 9' stroke='%23888' stroke-width='2.5' stroke-linecap='round'/%3E%3C/svg%3E")}
.t-plant{background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 26 26'%3E%3Cpath d='M3 21h20' stroke='%236b4a2f' stroke-width='3' stroke-linecap='round'/%3E%3Cpath d='M13 20v-8' stroke='%233f7a4c' stroke-width='2'/%3E%3Cpath d='M13 13c-5 0-7-3-7-6 4 0 7 2 7 6zM13 12c4 0 6-3 6-5-3 0-6 1-6 5z' fill='%235c9a3e'/%3E%3C/svg%3E")}
.t-water{background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 26 26'%3E%3Cpath d='M13 3c4 6 7 9 7 13a7 7 0 0 1-14 0c0-4 3-7 7-13z' fill='%234a9bd1'/%3E%3Cpath d='M10 16a3 3 0 0 0 3 3' stroke='%23d8efff' stroke-width='1.6' fill='none' stroke-linecap='round'/%3E%3C/svg%3E")}
.t-harvest{background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 26 26'%3E%3Cpath d='M13 23V9' stroke='%23b8902a' stroke-width='2'/%3E%3Cellipse cx='13' cy='7' rx='2.6' ry='5' fill='%23e3b23c'/%3E%3Cellipse cx='9' cy='12' rx='2' ry='4' transform='rotate(-25 9 12)' fill='%23e3b23c'/%3E%3Cellipse cx='17' cy='12' rx='2' ry='4' transform='rotate(25 17 12)' fill='%23e3b23c'/%3E%3C/svg%3E")}
.tool.on .tico{filter:drop-shadow(0 0 1px #fff)}

#seedRow{pointer-events:auto;display:flex;gap:6px;overflow-x:auto;max-width:460px;width:100%;padding:2px 2px 4px;scrollbar-width:none}
#seedRow::-webkit-scrollbar{display:none}
.seed{flex:0 0 auto;display:flex;align-items:center;gap:6px;border:2px solid transparent;background:rgba(255,253,247,.96);border-radius:14px;padding:4px 10px 4px 4px;box-shadow:0 2px 8px rgba(40,30,10,.15);font-size:12px;text-align:left;line-height:1.15}
.seed img{width:34px;height:34px;border-radius:10px;background:#7a5536}
.seed.on{border-color:var(--green)}
.seed.locked{opacity:.55}
.seed small{color:#7a6e55}

.cta{border:0;background:var(--green);color:#fff;font-weight:700;border-radius:14px;padding:12px 18px;font-size:16px;box-shadow:var(--shadow)}
.cta:active{transform:translateY(1px)}
.cta.big{font-size:20px;padding:14px 40px}
.cta.gold{background:var(--gold);color:#3a2a05}
.cta.red{background:var(--red)}
.cta[disabled]{background:#bdb4a0;box-shadow:none;cursor:not-allowed}
.ghost{border:2px solid var(--line);background:transparent;border-radius:14px;padding:10px 16px;font-size:15px;font-weight:600}
#shedPrompt{position:fixed;left:50%;transform:translateX(-50%);bottom:calc(var(--sab) + 84px);z-index:4}

/* modal sheet */
#modal{position:fixed;inset:0;padding:0 var(--sar) 0 var(--sal);background:rgba(30,25,15,.45);display:flex;align-items:flex-end;justify-content:center;z-index:20}
@media (min-width:700px){#modal{align-items:center}}
.sheet{background:var(--paper);width:100%;max-width:720px;max-height:calc(var(--app-h,100dvh) * .88);border-radius:22px 22px 0 0;display:flex;flex-direction:column;box-shadow:var(--shadow);animation:sup .22s ease-out}
@media (min-width:700px){.sheet{border-radius:22px}}
@keyframes sup{from{transform:translateY(30px);opacity:.4}}
.sheet-head{display:flex;align-items:center;padding:14px 16px 8px}
.sheet-head h2{margin:0;font-size:20px;flex:1}
.x{border:0;background:#ece3cf;width:34px;height:34px;border-radius:50%;font-size:22px;line-height:1}
#modalBody{overflow:auto;padding:0 16px calc(18px + var(--sab));-webkit-overflow-scrolling:touch}
.menu-list{display:grid;gap:8px}
.menu-list button{display:flex;align-items:center;gap:12px;text-align:left;border:1px solid var(--line);background:var(--card);border-radius:14px;padding:12px 14px;font-size:16px;font-weight:600}
.menu-list button small{display:block;font-weight:400;color:#7a6e55;font-size:12.5px}
.row{display:flex;align-items:center;gap:10px}
.spacer{flex:1}
.card{background:var(--card);border:1px solid var(--line);border-radius:16px;padding:12px}
.grid{display:grid;gap:10px;grid-template-columns:repeat(auto-fill,minmax(210px,1fr))}
.muted{color:#7a6e55;font-size:13px}
.price{font-weight:800;color:#3b5b1d}
.how ol{padding-left:20px;margin:6px 0 12px}.how li{margin:6px 0;line-height:1.4}
.how .keys{display:inline-block;border:1px solid #cbbf a4;border:1px solid #cbbfa4;border-radius:6px;padding:0 6px;background:#fff;font-size:12px}
table.crops{width:100%;border-collapse:collapse;font-size:13px}
table.crops td,table.crops th{padding:6px 4px;border-bottom:1px solid var(--line);text-align:left}
table.crops img{width:26px;height:26px;border-radius:7px;vertical-align:middle;background:#7a5536}
.switch{display:flex;align-items:center;gap:10px;border:1px solid var(--line);background:var(--card);border-radius:14px;padding:12px 14px;font-size:16px;font-weight:600;width:100%}
.switch .knob{margin-left:auto;width:46px;height:26px;border-radius:13px;background:#d6ccb6;position:relative;transition:.2s}
.switch .knob:after{content:"";position:absolute;top:3px;left:3px;width:20px;height:20px;border-radius:50%;background:#fff;transition:.2s}
.switch.on .knob{background:var(--green)}.switch.on .knob:after{left:23px}

/* Tractor shed (dealership lot) */
.lot{background:#3d4046 repeating-linear-gradient(90deg,transparent 0 calc(50% - 2px),rgba(255,255,255,.0) 0 50%);border-radius:18px;padding:12px;
  background-image:linear-gradient(#45484f,#383b41);position:relative}
.lot-banner{display:flex;align-items:center;gap:8px;color:#fff;margin:0 2px 10px}
.lot-banner .flag{height:10px;flex:1;background:repeating-linear-gradient(90deg,#e3a826 0 14px,#c8463c 14px 28px,#2f7fb5 28px 42px);clip-path:polygon(0 0,100% 0,100% 40%,0 100%);opacity:.9}
.lot-banner b{font-size:15px;letter-spacing:.06em}
.lot-grid{display:grid;gap:12px;grid-template-columns:repeat(auto-fill,minmax(200px,1fr))}
.spot{position:relative;background:rgba(255,255,255,.04);border-left:3px solid #f2f2f2;border-right:3px solid #f2f2f2;border-radius:4px;padding:8px 10px 10px;color:#f3f1ea}
.spot canvas{display:block;margin:0 auto;width:150px;height:96px}
.spot h3{margin:4px 0 0;font-size:15px}
.spot .blurb{font-size:12px;color:#c9c6bb;margin:2px 0 8px;min-height:30px}
.tag{position:absolute;top:8px;right:8px;background:#fffbe8;color:#3a2a05;font-weight:800;font-size:12px;padding:3px 8px 3px 12px;border-radius:4px;transform:rotate(4deg);box-shadow:0 2px 4px rgba(0,0,0,.3)}
.tag:before{content:"";position:absolute;left:4px;top:50%;width:4px;height:4px;margin-top:-2px;border-radius:50%;background:#45484f}
.spot.locked canvas{filter:grayscale(.85) brightness(.75)}
.spot.locked .tag{background:#c9c6bb}
.spot.current{outline:2px solid #8cc56a;outline-offset:2px}
.stat{display:grid;grid-template-columns:62px 1fr 44px;align-items:center;gap:6px;font-size:11.5px;margin:3px 0}
.stat .sb{height:7px;border-radius:4px;background:rgba(255,255,255,.14);overflow:hidden}
.stat .sb i{display:block;height:100%;background:#8cc56a;border-radius:4px}
.stat .v{text-align:right;color:#c9c6bb;font-variant-numeric:tabular-nums}
.spot .cta{width:100%;margin-top:8px;padding:9px;font-size:14px}
.cmp{width:100%;border-collapse:collapse;font-size:12.5px;color:#f3f1ea;margin-top:12px}
.cmp th,.cmp td{padding:5px 4px;border-bottom:1px solid rgba(255,255,255,.12);text-align:center}
.cmp th:first-child,.cmp td:first-child{text-align:left}
.cmp-wrap{overflow-x:auto}

/* title */
.screen{position:fixed;inset:0;z-index:30;display:flex;align-items:center;justify-content:center;
  background:radial-gradient(ellipse at 50% 120%,#e8b84a 0,#f4d58a 30%,#cfe6f0 70%,#a9d3e8 100%);padding:calc(var(--sat) + 16px) calc(var(--sar) + 16px) calc(var(--sab) + 16px) calc(var(--sal) + 16px)}
.title-card{text-align:center;max-width:380px;width:100%}
.title-card h1{font-size:40px;margin:6px 0 0;letter-spacing:-.01em;color:#2f3b1c}
.title-card .tag2,.title-card p.tag{position:static;transform:none;background:none;box-shadow:none;font-weight:500;font-size:16px;color:#4b4433;padding:0;margin:10px 0 22px}
.title-card p.tag:before{display:none}
.title-card .ghost{display:block;margin:12px auto 0}
.title-art canvas{width:100%;max-width:320px;height:auto}
.fine{font-size:12px;color:#6d6550;margin-top:18px}

/* silo sale payout */
#salePop{position:fixed;left:50%;top:calc(var(--sat) + 120px);transform:translateX(-50%) scale(.6);opacity:0;z-index:6;pointer-events:none;
  background:linear-gradient(#fffaf0,#fff3d6);border:2px solid #e3b23c;border-radius:18px;padding:12px 18px 12px;min-width:220px;max-width:calc(var(--app-w,100vw) * .88);
  box-shadow:0 12px 30px rgba(60,40,0,.28);text-align:center;transition:transform .35s cubic-bezier(.2,1.6,.4,1),opacity .25s}
#salePop.show{transform:translateX(-50%) scale(1);opacity:1}
#salePop.out{transform:translateX(-50%) translateY(-30px) scale(.9);opacity:0}
#salePop.hidden{display:none}
.sp-head{font-size:12px;letter-spacing:.14em;text-transform:uppercase;color:#8a6d22;font-weight:700}
.sp-total{font-size:40px;font-weight:800;color:#3b6b1d;line-height:1.1;margin:2px 0 6px;font-variant-numeric:tabular-nums;text-shadow:0 2px 0 #f6dd96}
#salePop .sl{display:flex;align-items:center;gap:8px;font-size:14px;color:#4a4232;padding:2px 0;text-align:left}
#salePop .sl img{width:20px;height:20px}#salePop .sl span{flex:1}#salePop .sl b{color:#3b5b1d;font-variant-numeric:tabular-nums}
.sp-best{margin-top:6px;font-size:13px;font-weight:800;color:#b5651d}
.coin{position:fixed;width:18px;height:18px;border-radius:50%;z-index:7;pointer-events:none;
  background:radial-gradient(circle at 35% 35%,#fff3b0 0 18%,#f3c53c 40%,#c98f14 100%);box-shadow:0 0 0 1.5px #a8740c inset,0 2px 4px rgba(0,0,0,.25)}
#moneyPill{transition:background .2s}
#moneyPill.ticking{background:#fff2c4}
#moneyPill.pulse{animation:mpulse .35s ease-out}
@keyframes mpulse{0%{transform:scale(1)}40%{transform:scale(1.18)}100%{transform:scale(1)}}
.statsbox{display:grid;grid-template-columns:repeat(3,1fr);gap:8px;margin:6px 0 10px}
.statsbox div{background:#fff;border:1px solid rgba(0,0,0,.07);border-radius:12px;padding:8px 10px}
.statsbox small{display:block;font-size:11px;color:#7a6e55}.statsbox b{font-size:16px;color:#3b5b1d}
.stats-line{margin:10px 0 0;font-size:13px;color:#5b5240}.stats-line:empty{display:none}.stats-line b{color:#3b5b1d}
@media (prefers-reduced-motion:reduce){#salePop{transition:none}#moneyPill.pulse{animation:none}}

/* level up */
#levelPop{position:fixed;left:50%;top:30%;transform:translate(-50%,-50%) scale(.5);opacity:0;z-index:8;pointer-events:none;width:min(calc(var(--app-w,100vw) * .86),330px);
  background:linear-gradient(160deg,#2f5d3a,#3f7a4b);color:#fff;border-radius:22px;padding:16px 18px 14px;text-align:center;overflow:hidden;
  box-shadow:0 16px 40px rgba(20,40,20,.4),0 0 0 3px #f0c75a inset;transition:transform .45s cubic-bezier(.2,1.7,.4,1),opacity .25s}
#levelPop.show{transform:translate(-50%,-50%) scale(1);opacity:1}
#levelPop.out{transform:translate(-50%,-62%) scale(.92);opacity:0}
#levelPop.hidden{display:none}
.lp-burst{position:absolute;inset:-40%;background:repeating-conic-gradient(rgba(255,230,140,.13) 0 10deg,transparent 10deg 20deg);animation:spin 8s linear infinite;pointer-events:none}
@keyframes spin{to{transform:rotate(360deg)}}
.lp-head,.lp-lvl,.lp-bonus,.lp-new{position:relative}
.lp-head{font-size:12px;letter-spacing:.2em;text-transform:uppercase;color:#f6dc8a;font-weight:800}
.lp-lvl{font-size:34px;font-weight:800;line-height:1.1}
.lp-bonus{margin:6px auto 2px;display:inline-block;background:#f3c53c;color:#3b2e05;font-weight:800;font-size:22px;border-radius:999px;padding:3px 14px}
.lp-bonus span{font-size:12px;font-weight:700}
.lp-new{margin-top:10px;background:rgba(255,255,255,.12);border-radius:14px;padding:8px 10px;text-align:left}
.lp-nh{font-size:11px;letter-spacing:.14em;text-transform:uppercase;color:#f6dc8a;font-weight:800;margin-bottom:4px}
.lp-item{display:flex;align-items:center;gap:8px;padding:3px 0}
.lp-item img{width:30px;height:30px;border-radius:8px}.lp-item small{display:block;font-size:11px;opacity:.85}
.lp-dot{width:30px;height:30px;border-radius:8px;background:rgba(255,255,255,.2) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M4 16h3l2-5h6l2 3h3v3H4z' fill='%23f6dc8a'/%3E%3Ccircle cx='8' cy='18' r='2.5' fill='%23fff'/%3E%3Ccircle cx='17' cy='18' r='2' fill='%23fff'/%3E%3C/svg%3E") center/20px no-repeat}
/* locks */
.lock{display:inline-block;width:12px;height:13px;margin-right:4px;vertical-align:-1px;background:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 13'%3E%3Cpath d='M3 6V4a3 3 0 0 1 6 0v2' fill='none' stroke='%235b5240' stroke-width='1.6'/%3E%3Crect x='1.5' y='5.5' width='9' height='7' rx='1.6' fill='%235b5240'/%3E%3C/svg%3E") center/contain no-repeat}
.seed{position:relative}
.seed.locked{opacity:1;background:#e7e2d6;box-shadow:none;cursor:not-allowed}
.seed.locked img{filter:grayscale(1) brightness(.9);opacity:.55}
.seed.locked b,.seed.locked small{color:#8b836f}
.seed .lock{position:absolute;left:15px;top:14px;width:14px;height:15px;margin:0}
.seed.new:after{content:'NEW';position:absolute;top:-6px;right:-4px;background:#e0a92a;color:#fff;font-size:9px;font-weight:800;border-radius:6px;padding:1px 5px}
.seed-sep{flex:0 0 auto;align-self:center;font-size:10px;font-weight:800;letter-spacing:.12em;text-transform:uppercase;color:#fff;background:rgba(47,93,58,.85);border-radius:8px;padding:4px 7px;writing-mode:vertical-rl;transform:rotate(180deg)}
table.crops tr.locked td{color:#8b836f}table.crops tr.locked img{filter:grayscale(1);opacity:.5}
.guide-h{margin:14px 0 4px;font-size:16px}
#treePrompt{position:fixed;left:50%;transform:translateX(-50%);bottom:calc(var(--sab) + 84px);z-index:4}
#seedRow{padding-top:8px}
.lp-more{font-size:12px;opacity:.9;padding-top:4px}
/* iOS app: nothing web-only (install tips, external links) is shown inside the app */
html.native .web-only{display:none !important}

/* ---------- touch: the game owns pinch; lists still scroll ---------- */
#modalBody,#seedRow,.cmp-wrap,.screen{touch-action:pan-x pan-y}
button{touch-action:manipulation}

/* ---------- zoom control ---------- */
#zoomCtl{position:fixed;z-index:3;right:calc(var(--sar) + 10px);bottom:calc(var(--bot-h,84px) + 10px);display:flex;flex-direction:column;
  background:rgba(255,253,247,.94);border:1px solid rgba(0,0,0,.06);border-radius:14px;box-shadow:0 2px 8px rgba(40,30,10,.15);overflow:hidden;transition:bottom .18s ease-out}
.zb{width:38px;height:36px;border:0;background:transparent;display:flex;align-items:center;justify-content:center;padding:0}
.zb+.zb{border-top:1px solid rgba(42,36,24,.09)}
.zb:active{background:rgba(42,36,24,.07)}
.zb:disabled{cursor:default}.zb:disabled .zi{opacity:.3}
.zb.on{background:var(--green)}.zb.on .zi{filter:brightness(0) invert(1)}
.zi{width:18px;height:18px;background-size:contain;background-repeat:no-repeat;background-position:center}
.zi-in{background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 18 18'%3E%3Cpath d='M9 3.5v11M3.5 9h11' stroke='%232a2418' stroke-width='2' stroke-linecap='round'/%3E%3C/svg%3E")}
.zi-out{background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 18 18'%3E%3Cpath d='M3.5 9h11' stroke='%232a2418' stroke-width='2' stroke-linecap='round'/%3E%3C/svg%3E")}
.zi-fit{background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 18 18'%3E%3Cpath d='M2.5 6.5v-4h4M11.5 2.5h4v4M15.5 11.5v4h-4M6.5 15.5h-4v-4' fill='none' stroke='%232a2418' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3Crect x='6' y='6' width='6' height='6' rx='1.2' fill='%232a2418' opacity='.55'/%3E%3C/svg%3E")}

/* ---------- phone held sideways ---------- */
@media (orientation:landscape) and (max-height:540px){
  #hud{padding-top:calc(var(--sat) + 6px)}
  /* tool bar becomes a rail on the right; seeds run along the bottom */
  #bottom{top:0;padding:0;display:block}
  #tools{position:fixed;right:calc(var(--sar) + 8px);top:calc(50% + var(--sat) / 2 + 22px);transform:translateY(-50%);
    flex-direction:column;width:76px;max-width:none;gap:3px;padding:4px}
  .tool{flex:0 0 auto;min-height:48px;padding:4px 2px 4px;font-size:11px}
  .tool .tico{width:24px;height:24px}
  #seedRow{position:fixed;left:calc(var(--sal) + 8px);right:calc(var(--sar) + 96px);bottom:calc(var(--sab) + 8px);
    width:auto;max-width:none;padding:6px 2px 2px}
  #zoomCtl{right:auto;left:calc(var(--sal) + 10px);bottom:auto;top:calc(50% + var(--sat) / 2 + 22px);transform:translateY(-50%)}
  #toasts{top:calc(var(--sat) + 54px);left:calc(50% - 40px)}
  #salePop{top:calc(var(--sat) + 50px);left:calc(50% - 40px);max-height:calc(var(--app-h,100dvh) - 60px);overflow:hidden}
  #levelPop{top:52%;left:calc(50% - 40px);max-height:calc(var(--app-h,100dvh) - 20px)}
  #shedPrompt,#treePrompt{left:calc(50% - 40px);bottom:calc(var(--sab) + 14px)}
  body:has(#seedRow:not(.hidden)) #shedPrompt,body:has(#seedRow:not(.hidden)) #treePrompt{bottom:calc(var(--sab) + 84px)}
  .sheet{max-height:calc(var(--app-h,100dvh) - var(--sat) - 10px)}
  /* title: art beside the words */
  .screen{overflow:auto;padding:12px calc(var(--sar) + 16px) 12px calc(var(--sal) + 16px)}
  .title-card{max-width:700px;display:grid;grid-template-columns:minmax(0,1fr) minmax(0,1fr);column-gap:28px;align-items:center;margin:auto}
  .title-card>*{grid-column:2}
  .title-card>.title-art{grid-column:1;grid-row:1 / span 7}
  .title-card h1{font-size:34px;margin:0}
  .title-card p.tag{margin:6px 0 14px;font-size:15px}
  .title-card .cta.big{padding:12px 40px}
  .title-card .ghost{margin-top:10px}
  .fine{margin-top:12px}
}
@media (orientation:landscape) and (max-height:540px){.title-card>button{justify-self:center}}

/* =====================================================================
   Visual polish pass (v8): warmer palette, calmer panels, 44pt targets,
   the Drive Tractor button, and a landscape layout that fits Safari.
   ===================================================================== */
:root{--ink:#2b2419;--paper:#f8f1e2;--card:#fffcf4;--line:#e2d5bb;--green:#2f5b38;--green2:#3d7246;--gold:#d99b22;--red:#b8432f;
  --glass:rgba(255,251,242,.95);--edge:rgba(70,50,20,.10);--soft:0 1px 0 rgba(255,255,255,.7) inset,0 3px 10px rgba(45,30,10,.16);
  --shadow:0 10px 28px rgba(45,30,10,.20),0 2px 6px rgba(45,30,10,.12);--gap:8px;--tap:44px}
html,body{height:100%;height:var(--app-h,100%);background:#6f9a45;-webkit-font-smoothing:antialiased;font-feature-settings:"tnum" 0}
b,strong{font-weight:800}

/* HUD: soft paper pills */
#hud{gap:var(--gap);row-gap:6px}
.pill{background:var(--glass);border:1px solid var(--edge);box-shadow:var(--soft);padding:6px 12px;font-size:13px;font-weight:700;color:#3c3324;min-height:34px}
#moneyPill b{font-size:16px;color:#2f5b1f;letter-spacing:-.01em}
.bar{height:8px;background:#e8dcc3;box-shadow:0 1px 1px rgba(60,40,10,.15) inset}
.bar i{background:linear-gradient(180deg,#f2c95a,#d89a20)}
#hopfill{background:linear-gradient(180deg,#86bd5e,#4c8a34)}
#hopperPill.full #hopfill{background:linear-gradient(180deg,#e2775a,#b8432f)}
#hopperPill.full{animation:none;box-shadow:var(--soft),0 0 0 2px rgba(184,67,47,.55)}
#envPill #weatherTxt{color:#55677a;font-weight:600}
.btn-icon{width:var(--tap);height:var(--tap);min-height:var(--tap);border-radius:14px}
.burger,.burger:before,.burger:after{width:18px}

/* toasts */
#toasts{top:calc(var(--hud-b,52px) + 10px)}
.toast{background:rgba(38,31,20,.92);font-weight:700;font-size:14px;padding:10px 16px;border-radius:14px;box-shadow:0 8px 22px rgba(30,20,5,.25);letter-spacing:.005em}
.toast.good{background:rgba(42,86,52,.96)}.toast.warn{background:rgba(160,58,38,.96)}.toast.gold{background:rgba(150,100,14,.96)}

/* tool bar */
#bottom{gap:var(--gap)}
#tools{gap:6px;padding:6px;background:var(--glass);border:1px solid var(--edge);border-radius:20px;box-shadow:var(--shadow)}
.tool{min-height:56px;min-width:var(--tap);border-radius:14px;font-weight:800;font-size:11.5px;color:#5a4f3b;letter-spacing:.01em;transition:background-color .15s,color .15s}
.tool:active{background:rgba(60,45,20,.07)}
.tool.on{background:linear-gradient(180deg,#3b6d44,#2c5634);color:#fff;box-shadow:0 1px 0 rgba(255,255,255,.18) inset,0 2px 6px rgba(30,60,30,.3)}
.tool.on .tico{filter:drop-shadow(0 1px 1px rgba(0,0,0,.35)) brightness(1.08)}

/* seed picker */
#seedRow{gap:var(--gap);padding:8px 2px 4px}
.seed{min-height:48px;background:var(--glass);border:2px solid transparent;border-radius:15px;box-shadow:var(--soft);font-size:12px;padding:4px 12px 4px 5px;transition:border-color .15s,transform .15s}
.seed b{font-weight:800;color:#3a3122}
.seed img{width:36px;height:36px;border-radius:11px;box-shadow:0 1px 2px rgba(0,0,0,.25) inset}
.seed.on{border-color:#2f5b38;box-shadow:var(--soft),0 0 0 3px rgba(47,91,56,.18)}
.seed.new:after{background:#c98a1a;letter-spacing:.06em;top:-7px}
.seed-sep{background:rgba(47,91,56,.9)}

/* buttons */
.cta{min-height:var(--tap);font-weight:800;border-radius:15px;background:linear-gradient(180deg,#3b6d44,#2c5634);box-shadow:0 1px 0 rgba(255,255,255,.18) inset,0 4px 12px rgba(30,50,20,.25);letter-spacing:.01em}
.cta.gold{background:linear-gradient(180deg,#f0c04a,#d39a1f);color:#3a2805}
.cta.red{background:linear-gradient(180deg,#c9523c,#a63a28)}
.cta[disabled]{background:#c4bba7;color:#f6f1e6}
.ghost{min-height:var(--tap);font-weight:700;border-color:#d9cbb0;color:#4a3f2c;background:rgba(255,252,244,.5)}
.x{width:var(--tap);height:var(--tap);background:#ebe0c8;color:#4a3f2c;flex:0 0 auto}

/* zoom control */
#zoomCtl{background:var(--glass);border:1px solid var(--edge);box-shadow:var(--shadow);border-radius:16px}
.zb{width:var(--tap);height:var(--tap)}
.zb.on{background:#2f5b38}

/* the Drive button: hold to drive. Same size, shape, type and states as a tool button (size comes from
   --tool-w/--tool-h, measured from the tool bar), on its own glass card in thumb reach */
.drive-btn{position:fixed;z-index:3;left:calc(var(--sal) + 10px);bottom:calc(var(--bot-h,84px) + 10px);
  width:var(--tool-w,64px);height:var(--tool-h,56px);min-width:var(--tap);min-height:var(--tap);padding:4px 2px;
  display:flex;flex-direction:column;align-items:center;justify-content:center;gap:2px;
  border:1px solid var(--edge);border-radius:14px;font-size:11.5px;font-weight:800;letter-spacing:.01em;color:#2f5b38;
  background:var(--glass);box-shadow:var(--shadow);
  touch-action:none;-webkit-user-select:none;user-select:none;-webkit-touch-callout:none;-webkit-tap-highlight-color:transparent;
  transition:background-color .12s,color .12s,bottom .18s ease-out}
.dv-ico{width:26px;height:26px;flex:0 0 auto;background:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Ccircle cx='12' cy='12' r='10.5' fill='%232f5b38'/%3E%3Cpath d='M9.6 7.4v9.2l7.2-4.6z' fill='%23fff'/%3E%3C/svg%3E") center/contain no-repeat}
.drive-btn.on{background:linear-gradient(180deg,#3b6d44,#2c5634);color:#fff;border-color:transparent;box-shadow:0 1px 0 rgba(255,255,255,.18) inset,0 2px 6px rgba(30,60,30,.3),var(--shadow)}
.drive-btn.on .dv-ico{background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Ccircle cx='12' cy='12' r='10.5' fill='%23fff'/%3E%3Cpath d='M9.6 7.4v9.2l7.2-4.6z' fill='%232c5634'/%3E%3C/svg%3E")}
.sr-only{position:absolute!important;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap;border:0}
.drive-btn.nudge{animation:dvnudge .9s ease-in-out 2}
@keyframes dvnudge{50%{box-shadow:0 0 0 5px rgba(240,200,90,.6),var(--shadow)}}
@media (prefers-reduced-motion:reduce){.drive-btn{transition:none}.drive-btn.nudge{animation:none;outline:3px solid rgba(240,200,90,.8)}}
#shedPrompt,#treePrompt{bottom:calc(var(--bot-h,84px) + 84px);min-height:48px;box-shadow:0 1px 0 rgba(255,255,255,.18) inset,0 8px 20px rgba(25,45,20,.3)}

/* modal sheet */
#modal{background:rgba(28,22,12,.42);-webkit-backdrop-filter:blur(2px);backdrop-filter:blur(2px)}
.sheet{background:linear-gradient(180deg,#fbf5e8,#f5ecd9);max-height:calc(var(--app-h,100dvh) * .9);box-shadow:0 -6px 30px rgba(30,20,5,.25)}
.sheet-head{padding:12px 12px 8px 18px}
.sheet-head h2{font-size:21px;font-weight:800;letter-spacing:-.01em;color:#2f2718}
.menu-list button{min-height:52px;font-weight:700;border-color:#e3d6bb;box-shadow:0 1px 2px rgba(60,40,10,.06)}
.menu-list button:active{background:#f4ead6}
.card{border-color:#e3d6bb;box-shadow:0 1px 2px rgba(60,40,10,.06)}
.switch{min-height:52px}
table.crops th{font-size:11px;letter-spacing:.08em;text-transform:uppercase;color:#7a6c50}

/* Tractor Shed: a calm machine-shed floor, straight price cards, no bunting */
.lot{background:linear-gradient(180deg,#4a4a47,#3a3a38);box-shadow:0 1px 0 rgba(255,255,255,.06) inset}
.lot-banner .flag{background:linear-gradient(90deg,rgba(255,255,255,.22),rgba(255,255,255,.04));clip-path:none;height:2px;opacity:1}
.lot-banner b{font-weight:800;letter-spacing:.14em;font-size:13px;text-transform:uppercase;color:#efe8d8}
.spot{background:linear-gradient(180deg,rgba(255,255,255,.06),rgba(255,255,255,.02));border:1px solid rgba(255,255,255,.08);border-left:3px solid rgba(245,240,225,.75);border-right:3px solid rgba(245,240,225,.75);border-radius:8px}
.spot h3{font-weight:800}
.tag{transform:none;border-radius:6px;background:#f6efdc;font-variant-numeric:tabular-nums;box-shadow:0 1px 3px rgba(0,0,0,.35)}
.spot .cta{min-height:var(--tap);padding:10px}
.stat .sb i{background:linear-gradient(90deg,#78b257,#9ccc72)}
#modal.doors .sheet{animation:none}
#modal.doors .sheet:before,#modal.doors .sheet:after{content:"";position:absolute;top:0;bottom:0;width:50.5%;z-index:5;pointer-events:none;
  background:repeating-linear-gradient(90deg,#8e3a2b 0 7px,#7a3124 7px 9px),#8e3a2b;box-shadow:0 0 0 1px rgba(0,0,0,.2) inset;animation:doorL .62s cubic-bezier(.55,.05,.3,1) .08s both}
#modal.doors .sheet{position:relative;overflow:hidden}
#modal.doors .sheet:before{left:0;border-radius:22px 0 0 0;transform-origin:left}
#modal.doors .sheet:after{right:0;border-radius:0 22px 0 0;animation-name:doorR}
@keyframes doorL{from{transform:translateX(0)}to{transform:translateX(-101%)}}
@keyframes doorR{from{transform:translateX(0)}to{transform:translateX(101%)}}

/* silo panel (real numbers only; selling still happens on the pad) */
.silo-load{background:var(--card);border:1px solid var(--line);border-radius:16px;padding:12px 14px}
.sl-top{display:flex;justify-content:space-between;align-items:baseline;font-weight:700;color:#5a4f3b;font-size:14px}.sl-top b{font-size:18px;color:#2f5b1f;font-variant-numeric:tabular-nums}
.sl-bar{display:block;height:10px;border-radius:6px;background:#e8dcc3;margin-top:8px;overflow:hidden;box-shadow:0 1px 1px rgba(60,40,10,.15) inset}
.sl-bar i{display:block;height:100%;background:linear-gradient(180deg,#86bd5e,#4c8a34);border-radius:6px}
.silo-items{margin-top:10px;background:var(--card);border:1px solid var(--line);border-radius:16px;padding:4px 12px}
.si{display:grid;grid-template-columns:30px 1fr auto auto;align-items:center;gap:10px;padding:8px 0;border-bottom:1px solid #eee3cc;font-size:14px}
.si:last-child{border-bottom:0}.si img{width:30px;height:30px;border-radius:8px}
.si small{color:#7a6c50;font-variant-numeric:tabular-nums}.si b{color:#2f5b1f;font-variant-numeric:tabular-nums}
.si.total{grid-template-columns:1fr auto;font-weight:800}.si.total b{font-size:17px}
.silo-empty{margin:10px 0 0;padding:14px;border:1px dashed #d6c7a6;border-radius:14px;color:#6d624b;text-align:center;font-size:14px}
.silo-how{display:flex;gap:12px;align-items:center;margin-top:12px;padding:12px 14px;border-radius:16px;background:#fbf0d2;border:1px solid #ecd59a}
.silo-how b{display:block;font-size:15px;color:#5b4410}.silo-how small{display:block;color:#7a6331;font-size:12.5px;margin-top:2px;line-height:1.35}
.silo-how .pin{flex:0 0 auto;width:34px;height:34px;border-radius:10px;background:#d99b22 url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'%3E%3Cpath d='M10 2.5c3.3 0 5.5 2.4 5.5 5.4 0 3.8-5.5 9.6-5.5 9.6S4.5 11.7 4.5 7.9C4.5 4.9 6.7 2.5 10 2.5z' fill='%23fff'/%3E%3Ccircle cx='10' cy='7.9' r='2' fill='%23d99b22'/%3E%3C/svg%3E") center/20px no-repeat}
.silo-harv{display:flex;flex-wrap:wrap;gap:8px}
.silo-harv span{display:inline-flex;align-items:center;gap:6px;background:var(--card);border:1px solid var(--line);border-radius:999px;padding:4px 10px 4px 4px;font-size:13px;font-weight:700}
.silo-harv img{width:24px;height:24px;border-radius:50%}.silo-harv b{color:#2f5b1f;font-variant-numeric:tabular-nums}

/* title */
.screen{background:radial-gradient(ellipse at 50% 118%,#e9b14a 0,#f2cf86 28%,#e8e2c8 55%,#bcd9e4 78%,#9ccbe0 100%)}
.title-card h1{font-weight:900;letter-spacing:-.02em;color:#2c3a1b;text-shadow:0 1px 0 rgba(255,255,255,.45)}
.title-card .tag2,.title-card p.tag{font-weight:600;color:#4a4231}

/* silo payout */
#salePop{background:linear-gradient(180deg,#fffaf0,#fbeecd);border:1px solid #e2c27a;box-shadow:0 0 0 4px rgba(255,248,230,.7),0 16px 36px rgba(60,40,0,.28)}
.sp-head{font-weight:800;color:#8a6a1c}
.sp-total{font-weight:900;color:#2f5b1f;text-shadow:none;letter-spacing:-.02em}

/* level up: calm green card with a soft light, no spinning rays */
#levelPop{background:linear-gradient(165deg,#336541,#244c2e);box-shadow:0 18px 44px rgba(20,40,20,.42),0 0 0 1px rgba(255,255,255,.08) inset,0 0 0 4px rgba(240,199,90,.85)}
.lp-burst{inset:-30%;background:radial-gradient(circle at 50% 30%,rgba(255,226,140,.28),rgba(255,226,140,0) 55%);animation:glow 2.4s ease-in-out infinite alternate}
@keyframes glow{from{opacity:.55}to{opacity:1}}
.lp-lvl{font-weight:900;letter-spacing:-.01em}
.lp-bonus{background:linear-gradient(180deg,#f3cc58,#dca325);font-weight:900}
.lp-new{background:rgba(255,255,255,.1);border:1px solid rgba(255,255,255,.1)}

/* ---------- landscape (all heights phones show in Safari: 320–430) ---------- */
@media (orientation:landscape) and (max-height:540px){
  #tools{width:80px;gap:6px;padding:5px;top:max(calc(var(--hud-b,52px) + 8px),calc((var(--hud-b,52px) + var(--app-h,100dvh) - 8px - var(--sab) - var(--rail-h,300px)) / 2));transform:none}
  .tool{min-height:50px;padding:3px 2px}
  #zoomCtl{top:calc(var(--hud-b,52px) + 8px);transform:none}
  .drive-btn{bottom:calc(var(--sab) + 10px)}
  #seedRow{left:calc(var(--drive-r,190px) + 8px);right:calc(var(--sar) + 100px);bottom:calc(var(--sab) + 8px);padding-top:8px}
  #shedPrompt,#treePrompt{left:calc(50% + 30px - 50px);bottom:calc(var(--sab) + 14px)}
  body:has(#seedRow:not(.hidden)) #shedPrompt,body:has(#seedRow:not(.hidden)) #treePrompt{bottom:calc(var(--sab) + 76px)}
  #toasts{top:calc(var(--hud-b,52px) + 8px)}
  .sheet{max-height:calc(var(--app-h,100dvh) - var(--sat) - 8px)}
  #salePop{max-height:calc(var(--app-h,100dvh) - 60px)}
  #levelPop{max-height:calc(var(--app-h,100dvh) - 20px)}
}
@media (orientation:landscape) and (max-height:380px){
  #hud{padding-top:calc(var(--sat) + 4px)}
  .pill{min-height:32px;padding:4px 10px}
  #tools{gap:4px;padding:4px}
  .tool{min-height:44px;font-size:10.5px}.tool .tico{width:22px;height:22px}
  .seed{min-height:44px}.seed img{width:32px;height:32px}
}
/* very short landscape (e.g. 667x320): the zoom buttons sit side by side so they clear the Drive button */
@media (orientation:landscape) and (max-height:350px){
  #zoomCtl{flex-direction:row}
  .zb+.zb{border-top:0;border-left:1px solid rgba(42,36,24,.09)}
}

@media (prefers-reduced-motion:reduce){
  *,*:before,*:after{animation-duration:.001ms!important;animation-iteration-count:1!important;transition-duration:.001ms!important}
  #modal.doors .sheet:before,#modal.doors .sheet:after{display:none}
  .lp-burst{animation:none}
}
#seedRow{align-items:center}
.seed-sep{font-size:9px;letter-spacing:.05em;padding:4px 5px;max-height:48px;overflow:hidden}
#tools{gap:var(--gap)}
@media (orientation:landscape) and (max-height:540px){#tools{gap:var(--gap)}}
@media (orientation:landscape) and (max-height:380px){#tools{gap:6px}}
/* warm light + vignette overlay (painted once per size/season/weather by drawLighting) */
#light{position:fixed;left:0;top:0;width:100vw;width:var(--app-w,100vw);height:100vh;height:100dvh;height:var(--app-h,100dvh);pointer-events:none;display:block}

/* settings group in the Farm menu */
.settings{display:flex;flex-direction:column;gap:8px;margin:6px 0 2px}
.set-h{margin:4px 2px 0;font-size:13px;font-weight:800;letter-spacing:.04em;text-transform:uppercase;color:#7a6c52}
.switch.unavail{color:#8b7f68}.switch.unavail .knob{opacity:.5}
.set-note{margin:-2px 4px 0;font-size:13px;color:#6f634c}

/* ---- buy land (v12) ---- */
.landbuy .lm{display:block;width:100%;max-width:260px;height:auto;margin:2px auto 12px}
.landbuy .lm-all{fill:#dfe6c4;stroke:#b9b08f;stroke-width:1;stroke-dasharray:3 3}
.landbuy .lm-own{fill:#7a5534;stroke:#5d3f24;stroke-width:1}
.landbuy .lm-new{fill:#c9b47a;stroke:#d9653a;stroke-width:1.4;stroke-dasharray:4 2}
.lb-rows{background:var(--card);border:1px solid var(--line);border-radius:14px;padding:4px 14px}
.lb-rows>div{display:flex;justify-content:space-between;align-items:baseline;gap:10px;padding:9px 0;border-bottom:1px solid var(--line);font-size:15px}
.lb-rows>div:last-child{border-bottom:0}
.lb-rows span{color:#6b5f48}
.lb-rows b{text-align:right}
.lb-rows small{font-weight:600;color:#7d705a;font-size:13px}
.lb-msg{margin:12px 2px 0;font-size:14px;line-height:1.4;color:#4a3f2c}
.lb-msg.lock,.lb-msg.short{background:#f6ead0;border:1px solid #e6d2a6;border-radius:12px;padding:10px 12px}
.lb-msg .lock{margin-right:6px}
.lb-btns{display:flex;gap:10px;margin-top:14px}
.lb-btns>*{flex:1}
.lb-btns .cta{flex:1.6}
@media (orientation:landscape) and (max-height:540px){
  .landbuy[data-plot]{display:grid;grid-template-columns:minmax(150px,34%) 1fr;column-gap:16px;align-items:start}
  .landbuy[data-plot] .lm{grid-column:1;grid-row:1 / span 3;margin:4px 0 0;max-width:none}
  .landbuy[data-plot] .lb-rows,.landbuy[data-plot] .lb-msg,.landbuy[data-plot] .lb-btns{grid-column:2}
  .landbuy[data-plot] .lb-rows>div{padding:6px 0;font-size:14px}
  .landbuy[data-plot] .lb-msg{margin-top:8px}
  .landbuy[data-plot] .lb-btns{margin-top:10px}
}

/* ---------- landscape mode, turned page (v13) ----------
   When the setting is on but the phone can't be locked sideways (iPhone Safari) and it's held upright,
   the whole page is turned a quarter clockwise and sized to the swapped screen. Hold the phone turned
   to the left (top of the phone to your left) and the game reads the right way up. */
html.rot{--sat:env(safe-area-inset-right);--sar:env(safe-area-inset-bottom);--sab:env(safe-area-inset-left);--sal:env(safe-area-inset-top);overflow:hidden;height:100%}
html.rot body{position:fixed;left:0;top:0;width:var(--app-w);height:var(--app-h);transform-origin:0 0;transform:translateX(var(--rot-x)) rotate(90deg);overflow:hidden}
html.rot,html.rot *{touch-action:none!important}
.switch .sw-l{display:flex;flex-direction:column;align-items:flex-start;gap:2px;text-align:left}
.switch .sw-l small{display:block;font-size:12px;font-weight:600;opacity:.7;margin:0}
/* landscape menu: places on the left, settings + stats on the right, so Settings shows without scrolling */
@media (orientation:landscape) and (max-height:560px){
  #modal[data-kind="menu"] .menu-list{grid-template-columns:1fr 1fr;align-items:start;column-gap:12px}
  #modal[data-kind="menu"] .menu-list > button{grid-column:1}
  #modal[data-kind="menu"] .menu-list > .settings{grid-column:2;grid-row:1 / span 4;margin-top:0}
  #modal[data-kind="menu"] .menu-list > .statsbox{grid-column:2;grid-row:5;margin-top:0}
  #modal[data-kind="menu"] .menu-list > button.wide{grid-column:1 / -1}
}

/* v14: Add to Home Screen tip (iPhone/iPad Safari only) */
#a2hsTip{position:fixed;z-index:35;left:50%;transform:translateX(-50%);top:calc(var(--sat) + 10px);width:min(calc(var(--app-w,100vw) - var(--sal) - var(--sar) - 24px),360px);
  display:flex;align-items:center;gap:6px;padding:4px 4px 4px 14px;background:#fffaf0;color:#2f2718;border:2px solid #e3b23c;border-radius:16px;
  box-shadow:0 6px 18px rgba(40,25,5,.22);font-size:14px;line-height:1.3;font-weight:600}
#a2hsTip p{margin:0;flex:1}
#a2hsTip .a2hs-x{flex:none;width:44px;height:44px;min-width:44px;border:0;border-radius:12px;background:transparent;color:#5b4a2a;font-size:24px;line-height:1;cursor:pointer}
#a2hsTip .a2hs-x:active{background:#f4e3b5}
#a2hsTip.hidden{display:none}
body:not(:has(#title.hidden)) #a2hsTip{top:calc(var(--sat) + 10px)}
body:has(#title.hidden) #a2hsTip{top:calc(var(--hud-b,52px) + 8px)}
/* v15: optional Save & sync */
.cloud{display:flex;flex-direction:column;gap:8px;margin:6px 0 2px;grid-column:1 / -1}
.cloud-note{margin:0 4px;font-size:14px;line-height:1.4;color:#5d5240}
.cloud-note b{color:#3b5b1d;word-break:break-all}
.cloud-btns{display:grid;grid-template-columns:1fr 1fr;gap:8px}
.cloud-btns button{justify-content:center;text-align:center}
.menu-list .cloud-del{color:#a83e28}
.cloud-form{display:flex;flex-direction:column;gap:10px}
.cloud-form p{margin:0;line-height:1.45}
.cloud-form label{font-weight:800;font-size:14px;color:#4a3f2c;margin-bottom:-4px}
.cloud-form input{min-height:48px;font-size:18px;border:2px solid #d9cbb0;border-radius:12px;padding:8px 12px;background:#fffdf7;color:#2f2716;width:100%;box-sizing:border-box}
.cloud-form input:focus{outline:none;border-color:#3b6d44;box-shadow:0 0 0 3px rgba(59,109,68,.2)}
.cloud-form .cf-code{font-size:26px;letter-spacing:.3em;text-align:center;font-variant-numeric:tabular-nums}
.cf-err{color:#a83e28;font-weight:700;font-size:14px;min-height:0}
.cf-err:empty{display:none}
.cf-row{display:grid;grid-template-columns:1fr 1fr;gap:8px}
.cf-row .ghost{padding:8px;font-size:14px}
.cloud-conflict{display:flex;flex-direction:column;gap:10px}
.cloud-conflict p{margin:0;line-height:1.45}
.cf-cards{display:grid;grid-template-columns:1fr 1fr;gap:8px}
.cf-card{background:#fffaf0;border:1px solid #e3d6bb;border-radius:14px;padding:10px 12px}
.cf-card h3{margin:0 0 6px;font-size:15px;color:#3b5b1d}
.cf-card dl{margin:0;display:grid;gap:4px}
.cf-card dl div{display:flex;justify-content:space-between;gap:6px;font-size:13px}
.cf-card dt{color:#7a6e55}.cf-card dd{margin:0;font-weight:800;color:#2f2716;text-align:right}
.cloud-conflict .ghost,.cloud-form .ghost{min-height:44px}
/* v15: "ready in" timer tooltip (one element, never takes touches) */
.grow-tip{position:fixed;left:0;top:0;z-index:4;pointer-events:none;display:flex;flex-direction:column;gap:1px;max-width:min(78vw,260px);
  padding:7px 12px 8px;border-radius:14px;background:#fffaf0;color:#2f2718;border:2px solid #e3c98a;box-shadow:0 6px 16px rgba(40,25,5,.22);
  font-size:15px;line-height:1.25;will-change:transform}
.grow-tip .gt-l{font-weight:800;font-variant-numeric:tabular-nums;white-space:nowrap}
.grow-tip .gt-n{font-size:13px;font-weight:700;color:#2f6d8f}
.grow-tip .gt-e{font-size:11.5px;font-weight:600;color:#7a6e55}
.grow-tip.ripe{border-color:#e3b23c;background:#fff4cf}
.grow-tip.hidden{display:none}
/* v15: Move land mode */
html.moving #bottom,html.moving .drive-btn,html.moving #treePrompt,html.moving #shedPrompt{visibility:hidden;pointer-events:none}
.move-bar{position:fixed;z-index:6;left:50%;transform:translateX(-50%);bottom:calc(var(--sab) + 12px);width:min(calc(var(--app-w,100vw) - var(--sal) - var(--sar) - 20px),460px);
  display:flex;align-items:center;gap:10px;padding:10px 12px;background:#fffaf0;border:2px solid #e3c98a;border-radius:18px;box-shadow:0 10px 26px rgba(40,26,6,.28);color:#3a2a14;animation:mbIn .22s ease-out}
.move-bar.hidden{display:none}
.move-bar .mb-t{flex:1;min-width:0;display:flex;flex-direction:column;line-height:1.2}
.move-bar .mb-t b{font-size:16px}
.move-bar .mb-t span{font-size:13px;color:#7a6440}
.move-bar .mb-b{display:flex;gap:8px;flex-shrink:0}
.move-bar button{min-height:44px;min-width:44px;padding:0 14px;border-radius:12px;font-weight:800;font-size:15px}
.move-bar #moveDone{min-width:84px}
@keyframes mbIn{from{opacity:0;transform:translate(-50%,12px)}to{opacity:1;transform:translate(-50%,0)}}
@media (prefers-reduced-motion:reduce){.move-bar{animation:none}}
