:root {
  --ink:#fff4dc;
  --muted:#e4cba4;
  --gold:#f0c17a;
  --cream:#fff3d6;
  --wood:#68452b;
  --green:#d1eca0;
  font-family:'Trebuchet MS',system-ui,sans-serif;
  color-scheme:light;
}

* {
  box-sizing:border-box;
}

html,body {
  width:100%;
  height:100%;
  margin:0;
  overflow:hidden;
  overscroll-behavior:none;
  touch-action:none;
}

body {
  color:var(--ink);
  background:radial-gradient(ellipse at 10% 95%,#294738 0,transparent 45%),radial-gradient(ellipse at 94% 0,#e7ca6680 0,transparent 40%),radial-gradient(ellipse at 50% 40%,#a4aa68,#647c4e 65%,#264b3b);
  font-family:inherit;
}

button,input {
  font:inherit;
}

button {
  cursor:pointer;
}

button:focus-visible,input:focus-visible {
  outline:3px solid #fff1ac;
  outline-offset:4px;
}

.game-shell {
  position:relative;
  width:100vw;
  height:100dvh;
  isolation:isolate;
}

.game-shell:before,.game-shell:after {
  content:'';
  position:absolute;
  z-index:-1;
  pointer-events:none;
  width:270px;
  height:270px;
  background:radial-gradient(ellipse at 35% 70%,#375f3d 0 14%,transparent 15%),radial-gradient(ellipse at 65% 55%,#80a355 0 15%,transparent 16%),radial-gradient(ellipse at 38% 34%,#a1b65f 0 13%,transparent 14%);
  opacity:.65;
}

.game-shell:before {
  left:-100px;
  bottom:-120px;
  transform:rotate(-20deg);
}

.game-shell:after {
  right:-140px;
  top:-90px;
  transform:rotate(35deg);
}

#game {
  display:block;
  width:100%;
  height:100%;
  touch-action:none;
  user-select:none;
}

.playfield {
  position:absolute;
  inset:92px 20px 20px 310px;
  overflow:hidden;
  border:8px solid #b88042;
  border-radius:28px;
  background:#536542;
  box-shadow:inset 0 0 0 3px #efd09a,0 5px 0 #664121,0 14px 28px #263b2955;
  outline:2px solid #efc281;
}

.playfield:after {
  content:'';
  position:absolute;
  inset:0;
  border:2px solid #f8d59750;
  border-radius:19px;
  pointer-events:none;
}

.hud {
  position:absolute;
  top:16px;
  left:20px;
  right:20px;
  z-index:2;
  display:flex;
  gap:0;
  min-height:62px;
  padding:9px 12px;
  border:3px solid #d5a66f;
  border-radius:22px;
  background:repeating-linear-gradient(2deg,#fff1 0 1px,transparent 1px 21px),linear-gradient(#77502f,#51341f);
  box-shadow:inset 0 2px 0 #fbe0ac88,0 5px 0 #4f331c80,0 8px 18px #24382b40;
  color:var(--ink);
}

.hud>div {
  position:relative;
  display:grid;
  flex:1;
  min-width:0;
  padding-left:46px;
  padding-right:14px;
  border-right:1px solid #e5c88a33;
  align-content:center;
  gap:2px;
}

.hud>div:last-of-type {
  border:0;
}

.hud-icon {
  position:absolute;
  left:4px;
  top:50%;
  width:32px;
  height:32px;
  transform:translateY(-50%);
  filter:drop-shadow(0 2px 1px #2f201a66);
}

.hud span {
  font-size:10px;
  font-weight:800;
  text-transform:uppercase;
  color:#e9cfa2;
  letter-spacing:.6px;
}

.hud strong {
  font-size:25px;
  line-height:1.05;
  font-weight:900;
  color:var(--green);
  font-variant-numeric:tabular-nums;
  text-shadow:0 2px #3c2b1e;
}

.motion-toggle {
  align-self:center;
  flex:none;
  width:32px;
  height:36px;
  padding:7px;
  border:1px solid #ebc28260;
  border-radius:11px;
  margin-left:7px;
  color:#ffe3a6;
  background:#3e2a1f55;
  box-shadow:inset 0 1px #fff2;
}

.motion-toggle svg {
  display:block;
  width:100%;
  height:100%;
}

.motion-slash {
  display:none;
}

.motion-toggle[aria-pressed=true] .motion-slash {
  display:block;
}

.motion-toggle:hover {
  background:#9b703d;
}

.garden-guide {
  position:absolute;
  left:20px;
  top:96px;
  bottom:20px;
  width:265px;
  display:flex;
  flex-direction:column;
  align-items:center;
  justify-content:space-evenly;
  gap:12px;
  padding:22px 17px 17px;
  text-align:center;
  background:linear-gradient(135deg,#234e3ded,#13372fec);
  border:2px solid #d4c18b88;
  border-radius:29px;
  box-shadow:inset 0 1px #ffffd630,0 6px 0 #14332760,0 12px 25px #20392c40;
  color:#fff6dc;
}

.guide-sprout {
  font-size:36px;
  line-height:1;
  color:#e2eeaa;
  text-shadow:0 3px 0 #142c22;
}

.guide-eyebrow {
  font-size:8px;
  letter-spacing:2px;
  color:#bfd2ae;
  margin:0;
}

.garden-guide h2 {
  font-size:38px;
  font-weight:1000;
  line-height:1;
  letter-spacing:-1.8px;
  margin:0;
  text-shadow:0 3px 0 #122a22;
}

.garden-guide h2 span {
  color:#c5e56e;
}

.guide-intro {
  font-size:15px;
  line-height:1.5;
  margin:0;
  color:#f1ebcd;
}

.guide-instructions {
  width:100%;
  padding:9px 12px;
  background:#092a253f;
  border:1px solid #bdc29840;
  border-radius:20px;
  font-size:13px;
  line-height:1.6;
}

.guide-instructions p {
  margin:10px 0;
}

.guide-instructions small {
  font-size:11px;
  color:#c6d4bc;
}

.garden-guide img {
  width:100%;
  height:auto;
  max-height:190px;
  flex:none;
  aspect-ratio:1.6;
  object-fit:cover;
  border-radius:18px;
  border:2px solid #d9cb9e80;
  box-shadow:0 4px 0 #152f2555;
}

kbd {
  display:inline-grid;
  place-items:center;
  min-width:24px;
  height:25px;
  padding:0 4px;
  background:#835b37;
  border:1px solid #c49b64;
  border-radius:6px;
  color:#fff0d3;
  font:800 11px system-ui;
  box-shadow:0 3px 0 #34291e;
}

.help {
  display:none;
}

.overlay {
  position:absolute;
  inset:0;
  z-index:4;
  display:grid;
  place-items:center;
  padding:18px;
  background:#112e2566;
  backdrop-filter:blur(3px);
}

.overlay.hidden {
  display:none;
}

.overlay>div {
  width:min(460px,100%);
  padding:28px;
  text-align:center;
  background:radial-gradient(ellipse at 15% 0,#fff8e9,transparent 70%),linear-gradient(120deg,#fff0d2,#ead1a4);
  border:3px solid #f7d89a;
  border-radius:28px;
  box-shadow:inset 0 0 0 2px #fff7db,0 7px 0 #8a613a88,0 24px 70px #0f291b88;
  color:#3b2a1a;
  animation:garden-arrive .24s ease-out;
}

.overlay h1 {
  font-size:32px;
  line-height:1.12;
  font-weight:900;
  letter-spacing:-1px;
  margin:12px 0 22px;
}

.overlay p {
  color:#5f783f;
  font-size:11px;
  text-transform:uppercase;
  letter-spacing:2px;
  font-weight:900;
  margin:0 0 8px;
}

.overlay strong {
  display:block;
  font-size:18px;
  color:#647d3e;
  margin:0 0 18px;
}

.name-field {
  display:grid;
  text-align:left;
  gap:7px;
  margin:14px 0;
}

.name-field span {
  color:#7a6448;
  font-size:11px;
  font-weight:900;
}

.name-field input {
  width:100%;
  padding:12px;
  border:1px solid #cbb17c;
  border-radius:12px;
  background:#fff8e8;
  color:#3d3325;
  font-size:16px;
  min-height:44px;
}

.ladder {
  text-align:left;
  padding:12px 14px;
  margin:18px 0;
  background:#d4be8e26;
  border:1px solid #c9b38755;
  border-radius:16px;
}

.ladder h2 {
  font-size:11px;
  text-transform:uppercase;
  letter-spacing:.6px;
  color:#6d7950;
  margin:0 0 9px;
}

.ladder ol {
  margin:0;
  padding-left:18px;
}

.ladder li {
  color:#6a563d;
  font-size:12px;
  line-height:1.7;
}

.ladder .empty {
  font-size:12px;
  letter-spacing:0;
  text-transform:none;
  font-weight:400;
  color:#8e7b5e;
  margin:0;
}

.overlay button {
  width:100%;
  min-height:48px;
  padding:12px 18px;
  border:1px solid #e0efb799;
  border-radius:16px;
  background:linear-gradient(#83ad54,#507f34);
  color:#fff9e6;
  font-size:16px;
  font-weight:900;
  box-shadow:inset 0 2px #d9efb966,0 5px 0 #355825,0 10px 20px #4e642730;
}

.overlay button:active {
  transform:translateY(2px);
  box-shadow:0 2px 0 #355825;
}

.overlay[data-outcome=win]>div:before {
  content:'✦';
  display:block;
  color:#b78a29;
  text-shadow:0 2px #fff9cd;
  font-size:40px;
  line-height:1;
}

.overlay[data-outcome=error] button {
  background:linear-gradient(#b17c48,#835a36);
  box-shadow:inset 0 2px #f5d5a555,0 5px 0 #5d4029;
}

.game-shell[data-feedback=error] .playfield {
  animation:garden-error .5s ease-out;
}

.game-shell[data-feedback=win] .playfield {
  animation:garden-win .6s ease-out;
}

@keyframes garden-arrive {
  from {
    opacity:0;
    transform:translateY(10px) scale(.98);
  }
  to {
    opacity:1;
    transform:none;
  }
}

@keyframes garden-error {
  0%,45% {
    outline-color:#ed8b6d;
  }
  100% {
    outline-color:#efc281;
  }
}

@keyframes garden-win {
  40% {
    outline-color:#fff1b3;
    box-shadow:0 0 25px #e9da8c77;
  }
  100% {
    outline-color:#efc281;
  }
}

@media(max-width:1050px),(max-height:620px) {
  .garden-guide {
    display:none;
  }
  .playfield {
    left:16px;
    right:16px;
    bottom:16px;
    top:90px;
  }
  .hud {
    left:16px;
    right:16px;
  }
}

@media(pointer:coarse) {
  .garden-guide {
    display:none;
  }
  .playfield {
    inset:68px 8px 8px;
    border-width:5px;
    border-radius:22px;
  }
  .hud {
    top:7px;
    left:8px;
    right:8px;
    min-height:50px;
    padding:7px 8px;
    border-width:2px;
    border-radius:18px;
  }
  .hud>div {
    padding-left:28px;
    padding-right:5px;
  }
  .hud-icon {
    width:23px;
    height:23px;
    left:0;
  }
  .hud span {
    font-size:9px;
    letter-spacing:0;
  }
  .hud strong {
    font-size:21px;
  }
  .motion-toggle {
    width:29px;
    height:32px;
    padding:6px;
    margin-left:3px;
  }
  .overlay {
    padding:8px;
    backdrop-filter:none;
  }
  .overlay>div {
    padding:14px;
    max-height:calc(100dvh - 16px);
    overflow:auto;
  }
  .overlay h1 {
    font-size:25px;
  }
  .overlay .ladder {
    font-size:12px;
  }
}

@media(pointer:coarse) and (orientation:landscape) {
  .overlay {
    overflow:auto;
    align-items:start;
  }
  .overlay>div {
    width:min(680px,100%);
    display:grid;
    grid-template-columns:1fr 1fr;
    gap:10px 18px;
    align-items:start;
    touch-action:pan-y;
  }
  .overlay p,.overlay h1 {
    grid-column:1/-1;
    margin:0;
  }
  .overlay .name-field,.overlay .ladder {
    margin:0;
  }
  .overlay .ladder {
    grid-column:2;
    grid-row:3/5;
  }
  .overlay button {
    grid-column:1;
    font-size:14px;
    padding:10px;
    min-height:44px;
  }
  .overlay strong {
    margin:0;
    font-size:16px;
  }
  .overlay[data-outcome=win]>div:before {
    display:none;
  }
}

@media(pointer:coarse) and (max-height:340px) {
  .playfield {
    top:61px;
    bottom:7px;
  }
  .hud {
    min-height:45px;
    padding:5px 7px;
  }
  .hud span {
    font-size:8px;
  }
  .hud strong {
    font-size:19px;
  }
  .hud-icon {
    width:21px;
    height:21px;
  }
  .motion-toggle {
    height:30px;
  }
}

@media(max-width:430px) {
  .hud>div {
    padding-left:0;
    text-align:center;
  }
  .hud-icon {
    display:none;
  }
  .hud span {
    font-size:8px;
  }
  .hud strong {
    font-size:18px;
  }
}

:root[data-reduced-motion=true] .game-shell *,:root[data-reduced-motion=true] .game-shell :before,:root[data-reduced-motion=true] .game-shell :after {
  animation:none!important;
  transition:none!important;
}

@media(prefers-reduced-motion:reduce) {
  .game-shell *,.game-shell :before,.game-shell :after {
    animation:none!important;
    transition:none!important;
  }
}
