* { box-sizing: border-box; }
:root { color-scheme: dark; --accent: #FF8A3D; color: #fff7de; background: #172713; font-family: system-ui, 'PingFang SC', sans-serif; }
body { margin: 0; overflow: hidden; overscroll-behavior: none; }
#stage { position: absolute; inset: 0 auto auto 0; width: 100vw; height: 100dvh; overflow: hidden; isolation: isolate; background: #314a24; }
#stage.turned { transform-origin: top left; transform: translateX(100vw) rotate(90deg); }
#scene { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: fill; pointer-events: none; }
button { color: inherit; font: inherit; cursor: pointer; touch-action: manipulation; }
button:focus-visible { outline: 2px solid #fff7ca; outline-offset: 2px; }
button:disabled { cursor: default; opacity: .65; }
.controls { position: absolute; z-index: 4; top: max(6px, env(safe-area-inset-top)); left: max(2%, env(safe-area-inset-left)); right: max(2%, env(safe-area-inset-right)); display: flex; align-items: stretch; gap: clamp(3px, 1%, 9px); height: clamp(48px, 17%, 80px); }
.sun-bank, .tools button, #ad, .overlay button { border-radius: 8px; border: 1px solid #ffe1a380; background: #262919; box-shadow: 0 2px 3px #12140988; }
.sun-bank { display: grid; place-content: center; justify-items: center; min-width: 44px; width: clamp(44px, 9%, 85px); flex: none; color: #ffdd61; font-size: 15px; font-weight: 900; font-variant-numeric: tabular-nums; }
.sun-bank .mp-icon { font-size: 23px; }
#seeds { display: grid; grid-template-columns: repeat(5,minmax(0,1fr)); gap: clamp(3px, 1%, 9px); width: min(72%, 570px); }
.seed { position: relative; display: flex; align-items: center; justify-content: space-evenly; gap: 2px; padding: 2px; isolation: isolate; overflow: hidden; min-width: 0; border: 1px solid #d8bd79; border-radius: 8px; background: linear-gradient(155deg, #f5dc9e, #c4a06a); color: #252412; box-shadow: 0 2px 3px #1a2113a8; }
.seed::after { content: ''; position: absolute; z-index: 1; bottom: 0; inset-inline: 0; height: var(--cool, 0%); background: #172319ad; pointer-events: none; }
.seed[aria-pressed='true'] { border-color: #fff5bb; box-shadow: 0 0 0 2px var(--accent), inset 0 0 0 2px var(--accent); background: #ffe7aa; }
.seed.poor:not([aria-pressed='true']) { background: #a8a78a; }
.seed-label { position: relative; text-align: center; font-size: 11px; line-height: 1.18; font-weight: 850; min-width: 0; }
.seed-label b { display: block; color: #624017; font-size: 13px; }
.cool-count { position: absolute; z-index: 2; bottom: 2px; right: 3px; color: #fff; font-size: 10px; font-weight: 800; }
.seed-art { position: relative; flex: 0 0 32%; height: 70%; }
.tools { margin-left: auto; display: flex; gap: 4px; }
.tools button { padding: 0; min-width: 44px; width: clamp(44px, 6vw, 65px); color: #ffeda6; }
.tools button[aria-pressed='true'] { color: #201409; background: var(--accent); }
#field { position: absolute; left: 16%; top: 27%; width: 76%; height: 61%; border: 1px solid #e6ee91a8; background: #16290c18; }
#plots, #actors, #drops { position: absolute; inset: 0; }
#plots { display: grid; grid-template: repeat(5, minmax(0,1fr)) / repeat(9, minmax(0,1fr)); }
.plot { min-width: 0; min-height: 0; padding: 0; border: 1px solid #f3f6a43b; background: #527b311c; }
.plot.alt { background: #0937171a; }
.plot:focus-visible { background: #fff4b94a; outline-offset: -3px; }
@media (hover: hover) { .plot:hover { background: #fff4b949; } }
#actors, #drops { pointer-events: none; }
.piece, .mower, .shot, .blast, .sun-drop { position: absolute; }
.piece, .mower { transform: translate(-50%,-100%); }
.piece { width: 8.4%; height: 19%; filter: drop-shadow(1px 2px 1px #1a2a14c4); }
.plant-art { position: absolute; inset: 0; display: block; }
.plant-art::before, .plant-art::after { content: ''; position: absolute; display: block; }
.pea .plant-art, .frost .plant-art, .flower .plant-art { background: radial-gradient(ellipse at 28% 83%,#62b934 0 13%,transparent 14%), radial-gradient(ellipse at 70% 88%,#39882a 0 16%,transparent 17%), linear-gradient(90deg,#205323,#85cc4a 55%,#39872a) center bottom 13% / 14% 45% no-repeat; }
.pea .plant-art::before, .frost .plant-art::before { inset: 8% 22% 33% 5%; border: 1px solid #1d531f; border-radius: 55% 58% 46% 54%; background: radial-gradient(ellipse at 58% 35%, #102c19 0 8%,transparent 9%), radial-gradient(ellipse at 35% 22%, #bcf984, #6ec34a 49%,#297728 96%); }
.pea .plant-art::after, .frost .plant-art::after { inset: 27% 4% 40% 58%; border-radius: 35% 60% 60% 40%; border: 1px solid #277628; background: radial-gradient(ellipse at 74% 47%,#143c22 0 23%,#83d84d 29%,#448c2e 72%); }
.frost .plant-art { filter: hue-rotate(98deg) saturate(.85) brightness(1.23); }
.flower .plant-art::before { inset: 0 11% 24%; border-radius: 46%; background: conic-gradient(#ffd96a, #f59c23, #ffe993, #f6a326, #ffe07e, #ffb334, #ffd96a); border: 2px dotted #ffefa0; }
.flower .plant-art::after { inset: 17% 28% 40%; border: 1px solid #8c3f18; border-radius: 50%; background: radial-gradient(ellipse at 35% 44%, #2f1d13 0 8%,transparent 9%), radial-gradient(ellipse at 66% 44%, #2f1d13 0 8%,transparent 9%), linear-gradient(#d6974f,#965022); }
.wall .plant-art::before { inset: 4% 13% 1%; border: 1px solid #5c361f; border-radius: 43% 46% 39% 40%; background: radial-gradient(ellipse at 39% 48%, #4b2918 0 7%, #fff2bc 8% 12%, transparent 13%),radial-gradient(ellipse at 70% 45%, #4b2918 0 7%, #fff2bc 8% 12%, transparent 13%), radial-gradient(ellipse at 26% 24%, #ffd188,#bd7b3e 75%); box-shadow: inset -3px -2px #80502880; }
.bomb .plant-art::before, .bomb .plant-art::after { bottom: 7%; width: 48%; height: 55%; border: 1px solid #741a1c; border-radius: 48% 45% 56% 50%; background: radial-gradient(ellipse at 33% 34%, #ffd1a1 0 8%, #f36c52 14%, #c32636 56%, #741b30 100%); }
.bomb .plant-art::before { left: 4%; }
.bomb .plant-art::after { right: 3%; bottom: 12%; }
.bomb .plant-art { background: radial-gradient(ellipse at 61% 27%, #8bd452 0 16%,transparent 17%),linear-gradient(80deg,transparent 44%,#4a7629 45% 54%,transparent 55%) center 14% / 50% 62% no-repeat; }
.health { position: absolute; bottom: -7%; left: 17%; right: 17%; height: 4px; display: none; background: #251a16; border: 1px solid #2c2617; border-radius: 4px; }
.health b { display: block; height: 100%; background: #aee95c; border-radius: inherit; }
.hurt .health { display: block; }
.zombie { width: 7.5%; height: 22%; }
.zombie > span:not(.health) { position: absolute; display: block; }
.zombie .legs { inset: 69% 25% 0 36%; border-radius: 15%; background: repeating-linear-gradient(90deg,#25354e 0 35%,transparent 36% 54%); border-bottom: 5px solid #372c2a; }
.zombie .coat { inset: 41% 18% 24% 29%; border-radius: 28% 34% 14% 11%; border: 1px solid #2f211b; background: linear-gradient(76deg,#492f29 0 33%,#e0ce9e 34% 47%,#943e39 48% 58%,#684037 59%); }
.zombie .arm { inset: 52% 46% 34% 0; border: 1px solid #37452b; border-radius: 45%; background: linear-gradient(90deg,#9fae64 35%,#745044 38%); transform: rotate(-12deg); }
.zombie .head { inset: 10% 24% 49% 21%; border: 1px solid #385333; border-radius: 43% 45% 37% 40%; background: radial-gradient(ellipse at 30% 42%,#1c261b 0 8%,#f7efcf 9% 18%,transparent 19%), radial-gradient(ellipse at 63% 43%,#26311e 0 6%,#f7efcf 7% 14%,transparent 15%), radial-gradient(ellipse at 42% 81%,#3a382c 0 14%,transparent 15%),linear-gradient(160deg,#bbc985,#778750); }
.zombie .helmet { display: none !important; }
.zombie.cone .helmet { display: block !important; inset: -14% 16% 72% 24%; background: linear-gradient(110deg,#ffb15b,#ec762c 55%,#b63d1b); clip-path: polygon(47% 0,57% 0,92% 78%,100% 83%,100% 100%,0 100%,0 83%,11% 78%); }
.zombie.bucket .helmet { display: block !important; inset: -8% 17% 76%; background: linear-gradient(105deg,#525562,#d6e5df 35%,#919d9c 64%,#474c52); clip-path: polygon(12% 0,92% 0,100% 95%,0 100%); }
.zombie.runner .coat { background: linear-gradient(90deg,#783734,#d26345 55%,#813632); }
.zombie.runner .head { border-top: 4px solid #b72e35; }
.zombie.chilled { filter: drop-shadow(1px 2px 1px #1a2a14c4) hue-rotate(85deg) brightness(1.2); }
.mower { width: 9%; height: 11%; }
.mower::before { content: ''; position: absolute; inset: 44% 10% 18% 5%; background: linear-gradient(#ff8a3d,#9c3025); border: 1px solid #40291d; border-radius: 6px 10px 4px 4px; }
.mower::after { content: ''; position: absolute; left: 14%; right: 15%; bottom: 0; height: 35%; background: radial-gradient(ellipse at 18% 50%, #40342d 0 20%,transparent 23%),radial-gradient(ellipse at 82% 50%, #40342d 0 20%,transparent 23%); }
.mower span { position: absolute; width: 44%; height: 55%; border: 2px solid #392a20; border-width: 2px 0 0 2px; transform: skewX(30deg); }
.shot { transform: translate(-50%,-50%); width: 1.9%; aspect-ratio: 1; border-radius: 50%; background: radial-gradient(circle at 30% 25%,#f0ffc1,#83de49 41%,#3c972c 80%); border: 1px solid #397733; }
.shot.frost { background: radial-gradient(circle at 30% 25%,#fff,#85e5fb 42%,#397da9 80%); border-color: #4983ac; }
.blast { transform: translate(-50%,-50%); width: 34%; height: 54%; opacity: .8; background: radial-gradient(ellipse,#fff6b5 0%,#ffce66 30%,#ea634bc4 53%,transparent 70%); }
.sun-drop { display: flex; place-content: center; align-items: center; gap: 1px; min-width: 40px; min-height: 38px; border: 0; padding: 3px; transform: translate(-50%,-50%); pointer-events: auto; color: #34260c; background: radial-gradient(ellipse,#fff8b5 10%,#ffd451 56%,#ec8e1ce0 69%,transparent 72%); font-size: 11px; font-weight: 900; filter: drop-shadow(0 1px 2px #52391199); }
.sun-drop .mp-icon { font-size: 15px; }
#notice { position: absolute; z-index: 3; left: 50%; top: 22%; transform: translateX(-50%); pointer-events: none; white-space: nowrap; max-width: 95%; font-size: 12px; font-weight: 750; }
#notice:not(:empty) { background: #222515ed; padding: 2px 9px; border-radius: 6px; }
.round { position: absolute; z-index: 4; bottom: max(3px, env(safe-area-inset-bottom)); left: max(2%, env(safe-area-inset-left)); right: max(2%, env(safe-area-inset-right)); display: flex; align-items: end; justify-content: space-between; gap: 7px; pointer-events: none; }
.wave-info { display: flex; align-items: center; gap: 7px; background: #252b19ed; border: 1px solid #ebcd8370; border-radius: 8px; padding: 5px 8px; white-space: nowrap; font-weight: 800; font-size: 11px; }
progress { accent-color: var(--accent); width: clamp(40px, 12vw, 140px); height: 12px; }
#ad, .overlay button { background: var(--accent); color: #301805; font-weight: 850; min-height: 44px; padding: 3px 9px; font-size: 12px; }
#ad { pointer-events: auto; display: flex; align-items: center; gap: 5px; }
#ad .mp-icon { font-size: 20px; }
.overlay:not([hidden]) { position: absolute; z-index: 8; inset: 0; display: grid; place-items: center; background: #161d12ab; }
.overlay section { text-align: center; background: #2a3520; border: 1px solid #d0ab61; border-radius: 8px; padding: 15px 26px; min-width: 190px; }
.overlay h1 { font-size: 21px; margin: 0 0 8px; }
.overlay p { font-size: 13px; margin: 0 0 12px; }
@media (max-height: 425px) and (orientation: landscape), (max-width: 425px) and (orientation: portrait) {
  .seed { flex-direction: column; gap: 0; }
  .seed-art { flex: 1 1 auto; width: 28px; height: 18px; }
  .seed-label { font-size: 10px; }
  .seed-label b { display: inline; margin-left: 3px; font-size: 10px; }
}
@media (max-height: 310px) and (orientation: landscape), (max-width: 310px) and (orientation: portrait) {
  .round { bottom: 1px; }
  #field { height: 57%; }
  .seed-label b { display: block; margin-left: 0; }
}
