:root {
  color-scheme: light;
  --ink: #003939;
  --purple: #1a775a;
  --deep-purple: #125c47;
  --lavender: #e9f2dc;
  --paper: #fcfff8;
  --muted: #6c8578;
  --line: #dce7d8;
  --green: #55794a;
  --yellow: #efbb4e;
  font-family: "Avenir Next", "Trebuchet MS", sans-serif;
  color: var(--ink);
  background: #f3f6ed;
  font-synthesis: none;
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
  position: relative;
  isolation: isolate;
}
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  background:
    linear-gradient(#f4f8eb94, #f4f8ebbd),
    url("/assets/map-2-night.jpg") center / cover;
  opacity: 0.72;
  pointer-events: none;
}
button,
input {
  font: inherit;
}
button,
a,
input {
  -webkit-tap-highlight-color: transparent;
}
button {
  cursor: pointer;
  color: inherit;
}
button:disabled {
  cursor: default;
}
button {
  touch-action: manipulation;
}
button:focus-visible,
a:focus-visible,
input:focus-visible,
canvas:focus-visible {
  outline: 3px solid var(--purple);
  outline-offset: 4px;
}
button:disabled {
  opacity: 0.45;
}
button:active:not(:disabled) {
  transform: translateY(1px);
}
[hidden] {
  display: none !important;
}
a {
  color: inherit;
  text-decoration: none;
}
.site-header {
  max-width: 1320px;
  margin: 0 auto;
  padding: 26px 40px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.wordmark {
  display: flex;
  align-items: center;
  gap: 9px;
  font-size: 30px;
  font-weight: 750;
  letter-spacing: -1.6px;
}
.wordmark img {
  width: 30px;
  height: 30px;
}
.anniversary {
  font-size: 12px;
  letter-spacing: 0;
  background: #dcedc1;
  color: #387451;
  border-radius: 8px;
  padding: 6px 9px;
  margin-left: 7px;
  font-weight: 650;
}
nav {
  display: flex;
  gap: 24px;
  align-items: center;
}
.text-button {
  border: 0;
  background: none;
  font-size: 13px;
  font-weight: 650;
  padding: 8px 0;
  display: flex;
  gap: 8px;
  align-items: center;
}
.text-button > span {
  font-size: 18px;
}
.text-button:first-child > span {
  border: 1.7px solid #777084;
  border-radius: 50%;
  width: 18px;
  height: 18px;
  font-size: 12px;
  display: inline-grid;
  place-items: center;
}
.icon-button {
  border: 1px solid #ded5e8;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: #fff9;
  position: relative;
  font-size: 22px;
}
.sound-off {
  position: absolute;
  inset: 3px 0 0 0;
  color: #8c7299;
  font-size: 27px;
}
main {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 20px;
}
.intro {
  text-align: center;
  padding: 15px 0 25px;
}
.birthday-note {
  color: #5f7e68;
  font-size: 12px;
  font-weight: 650;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 7px;
}
.birthday-note > span {
  font-size: 18px;
  color: #ce8c92;
}
h1 {
  font-family: "Arial Rounded MT Bold", "Trebuchet MS", sans-serif;
  font-size: clamp(48px, 5.2vw, 70px);
  font-weight: 900;
  line-height: 1.05;
  letter-spacing: -3.5px;
  margin: 10px 0 8px;
  color: #003939;
  text-shadow: 0 3px 0 #d7e5bd;
  position: relative;
  display: inline-block;
}
.title-flower {
  font-size: 42px;
  color: #c69bd1;
  position: absolute;
  right: -52px;
  top: -5px;
  transform: rotate(14deg);
  text-shadow: none;
}
.intro p {
  font-size: 15px;
  color: #63806c;
  margin: 3px 0 0;
  letter-spacing: 0.1px;
}
.game-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 252px;
  gap: 23px;
  align-items: start;
}
.game-shell {
  border: 1px solid #bdd1b4;
  border-radius: 21px;
  background: #fff;
  box-shadow:
    0 7px 0 #d8e3c9,
    0 18px 36px #6c4b8b0c;
  overflow: hidden;
}
.game-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 15px 24px;
  background: #fcfff8;
  min-height: 81px;
  gap: 10px;
}
.resource {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 111px;
}
.energy-icon {
  background: #fff0bf;
  border: 1px solid #e7cb79;
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border-radius: 13px;
  font-size: 35px;
  color: #b68019;
  line-height: 1;
}
.stat-label {
  display: block;
  font-size: 10px;
  color: #8a8292;
  margin-bottom: 3px;
  font-weight: 600;
}
.game-toolbar strong {
  font-size: 21px;
  line-height: 1;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.5px;
}
.stat-total {
  font-size: 13px;
  color: #aaa0b1;
  font-weight: 500;
}
.health-stat > span:last-child {
  font-size: 21px;
  color: #d28699;
  letter-spacing: 2px;
  white-space: nowrap;
}
.pause-button {
  width: 33px;
  height: 33px;
  border: 1px solid #d8e4ce;
  border-radius: 10px;
  background: #f3f8eb;
  color: #4c7b5d;
  font-size: 19px;
  font-weight: 800;
}
.speed-toggles {
  display: flex;
  gap: 6px;
  margin-left: auto;
  margin-right: 8px;
}
.speed-button {
  min-width: 38px;
  height: 33px;
  border: 1px solid #d8e4ce;
  border-radius: 10px;
  background: #f3f8eb;
  color: #4c7b5d;
  font-size: 14px;
  font-weight: 800;
  cursor: pointer;
}
.speed-button[aria-pressed="true"] {
  background: #1a775a;
  border-color: #1a775a;
  color: #fff;
}
.garden-wrap {
  position: relative;
  background: #a6ca7f;
}
.garden-wrap > canvas {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 1228/620;
  touch-action: pan-y;
  cursor: crosshair;
}
.game-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  justify-content: center;
  align-items: center;
  background: #3c353214;
  padding: 12px;
}
.game-overlay:has(.result-card:not([hidden])) {
  background: #234c3940;
}
.start-card {
  width: min(355px, 75%);
  text-align: center;
  background: #fffdf7;
  border: 2px solid #82725e;
  border-radius: 22px;
  box-shadow: 0 7px 0 #554d3833;
  padding: 24px 25px 20px;
  position: relative;
}
.card-sprout {
  font-size: 40px;
  line-height: 1;
  color: #4c8d63;
  display: block;
  margin-bottom: 8px;
}
.small-note {
  color: #6d8469;
  font-size: 10px;
  font-weight: 650;
}
.start-card h2 {
  font-family: "Arial Rounded MT Bold", "Trebuchet MS", sans-serif;
  font-size: 26px;
  letter-spacing: -0.8px;
  line-height: 1.15;
  margin: 10px 0;
  color: #174e3e;
}
.start-card p {
  font-size: 12px;
  line-height: 1.6;
  color: #857a85;
  margin: 10px 0 17px;
}
.primary-button {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  gap: 30px;
  min-height: 45px;
  padding: 10px 25px;
  border: 1px solid #07533e;
  background: var(--purple);
  box-shadow: 0 3px 0 #0a4a37;
  color: #fff;
  border-radius: 11px;
  font-weight: 750;
  font-size: 13px;
  letter-spacing: 0.1px;
}
.primary-button:hover {
  background: var(--deep-purple);
}
.primary-button span {
  font-size: 20px;
  font-weight: 400;
}
.run-note {
  display: block;
  font-size: 9px;
  color: #a3929e;
  margin-top: 17px;
}
.game-status {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 13px 20px;
  background: #f8fbef;
  font-size: 11px;
  color: #6b846d;
  min-height: 41px;
}
.status-dot {
  width: 6px;
  height: 6px;
  flex-shrink: 0;
  border-radius: 50%;
  background: #a8bb83;
}
#timer {
  margin-left: auto;
  font-variant-numeric: tabular-nums;
  font-size: 12px;
  color: #4f785b;
  font-weight: 650;
}
#game-hint {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.defense-panel {
  padding-top: 3px;
}
.panel-heading {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin: 0 0 15px;
}
.panel-heading h2 {
  font-size: 15px;
  margin: 0;
  letter-spacing: -0.35px;
}
.panel-heading > span {
  font-size: 10px;
  color: #9c8ea6;
}
.defense-shop {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.defense-card {
  position: relative;
  display: flex;
  align-items: center;
  text-align: left;
  border: 1.5px solid #d3dfc9;
  border-radius: 14px;
  min-height: 96px;
  background: #fcfff8;
  padding: 9px 10px 9px 3px;
  transition:
    border-color 0.15s,
    background 0.15s,
    box-shadow 0.15s;
  isolation: isolate;
}
.defense-card.selected {
  border: 2px solid #5c9166;
  background: #e6f0d6;
  box-shadow: 0 3px 0 #cadaac;
  padding: 8.5px 9.5px 8.5px 2.5px;
}
.defense-card:hover {
  border-color: #a88ac5;
}
.defense-card .defense-sprite {
  width: 76px;
  height: 76px;
  flex-shrink: 0;
}
.defense-copy {
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.defense-copy strong {
  font-size: 12px;
  letter-spacing: -0.2px;
  white-space: nowrap;
}
.defense-copy > span {
  font-size: 10px;
  color: #908397;
  white-space: nowrap;
}
.defense-cost {
  position: absolute;
  right: 10px;
  bottom: 10px;
  font-size: 11px;
  font-weight: 750;
  color: #8b6c24;
  display: flex;
  align-items: center;
  gap: 3px;
}
.defense-cost > span {
  font-size: 16px;
}
.defense-card kbd {
  position: absolute;
  right: 9px;
  top: 8px;
  font:
    9px "Avenir Next",
    sans-serif;
  color: #a99bb3;
  border: 1px solid #e6ddec;
  border-radius: 3px;
  padding: 1px 4px;
}
.defense-card.unaffordable {
  background: #f0eef2;
}
.defense-card.unaffordable .defense-cost {
  color: #a36a76;
}
.shovel-button {
  display: flex;
  align-items: center;
  gap: 8px;
  background: #fff9;
  border: 1px dashed #bdd1b4;
  padding: 12px;
  border-radius: 11px;
  width: 100%;
  margin-top: 14px;
  font-size: 11px;
  font-weight: 650;
  min-height: 43px;
}
.shovel-button > span {
  margin-left: auto;
  font-size: 10px;
  color: #a698ac;
  font-weight: 400;
}
.shovel-button[aria-pressed="true"] {
  border: 2px solid #b8758d;
  background: #f8e1e8;
}
.garden-tip {
  display: flex;
  gap: 10px;
  margin: 21px 7px 0;
  color: #a796b2;
}
.garden-tip > span {
  font-size: 22px;
}
.garden-tip p {
  font-size: 11px;
  line-height: 1.7;
  margin: 0;
}
.garden-tip strong {
  display: block;
  color: #537d60;
  font-size: 11px;
  margin-bottom: 3px;
}
.party-strip {
  display: flex;
  gap: 15px;
  align-items: center;
  max-width: 865px;
  margin: 29px auto 0;
  background: #e9f2dc;
  border: 1px solid #d7e4c6;
  border-radius: 14px;
  padding: 17px 22px;
}
.ticket-icon {
  width: 36px;
  height: 42px;
  display: grid;
  place-items: center;
  transform: rotate(-12deg);
  background: #d1e4b0;
  color: #487b51;
  border: 1px dashed #86ab70;
  border-radius: 6px;
  font-size: 27px;
  flex-shrink: 0;
}
.party-strip h2 {
  font-size: 13px;
  margin: 0 0 5px;
  color: #2f684c;
}
.party-strip p {
  font-size: 11px;
  color: #6c8a70;
  line-height: 1.5;
  margin: 0;
}
.practice-badge {
  font-size: 9px;
  background: #fcfff899;
  border: 1px solid #dfcfe9;
  border-radius: 20px;
  padding: 6px 9px;
  margin-left: auto;
  white-space: nowrap;
  color: #64866c;
}
.practice-disclosure {
  font-size: 10px;
  line-height: 1.7;
  color: #a094aa;
  text-align: center;
  max-width: 750px;
  margin: 12px auto 0;
}
footer {
  display: flex;
  justify-content: space-between;
  max-width: 1280px;
  margin: 0 auto;
  padding: 28px 20px;
  font-size: 10px;
  color: #7b947d;
}
footer strong {
  color: #477455;
  letter-spacing: -0.4px;
  font-size: 12px;
}
.toast {
  position: absolute;
  bottom: 18px;
  left: 50%;
  transform: translateX(-50%);
  max-width: 85%;
  width: max-content;
  border-radius: 10px;
  padding: 10px 16px;
  background: #fff9ec;
  color: #74546a;
  box-shadow: 0 3px 12px #29232f28;
  font-size: 12px;
  text-align: center;
  pointer-events: none;
}
.subtle-button {
  display: block;
  border: 0;
  background: none;
  text-decoration: underline;
  font-size: 11px;
  color: #9a839e;
  margin: 15px auto 0;
}
.result-card {
  padding: 17px 23px;
}
.result-card .card-sprout {
  font-size: 29px;
}
.result-card h2 {
  font-size: 24px;
  margin: 8px 0;
}
.result-score {
  font-size: 40px;
  color: #1a775a;
  font-weight: 850;
  letter-spacing: -1.5px;
}
.result-card p {
  margin: 4px 0 9px;
  font-size: 10px;
}
.result-card .result-message {
  max-width: 30ch;
  margin: 6px auto 10px;
  font-size: 12px;
  font-weight: 700;
  line-height: 1.35;
  color: #0b4f45;
}
.result-actions {
  display: flex;
  gap: 8px;
  justify-content: center;
  margin-top: 8px;
}
.result-actions .primary-button,
.secondary-button {
  font-size: 11px;
  padding: 8px 14px;
  min-height: 39px;
}
.secondary-button {
  border: 1px solid #bdd4b6;
  border-radius: 10px;
  background: #e7f1d7;
  color: #3d7657;
  font-weight: 650;
}
.name-entry {
  display: flex;
  gap: 6px;
}
.name-entry input {
  width: 100%;
  min-width: 0;
  background: #fff;
  border: 1px solid #e5d8df;
  padding: 9px 10px;
  font-size: 11px;
  border-radius: 8px;
  color: #77627c;
}
.save-feedback:empty {
  display: none;
}
.save-feedback {
  color: #728c65 !important;
}
dialog {
  width: min(440px, calc(100% - 30px));
  border: 1px solid #c4d4b6;
  border-radius: 22px;
  padding: 32px;
  background: #fffdf9;
  color: var(--ink);
  box-shadow: 0 12px 60px #44345026;
}
dialog::backdrop {
  background: #3f354766;
  backdrop-filter: blur(4px);
}
dialog h2 {
  font-family: "Arial Rounded MT Bold", "Trebuchet MS", sans-serif;
  font-size: 32px;
  letter-spacing: -1px;
  line-height: 1.15;
  margin: 8px 0 22px;
  color: #124f3b;
}
.close-button {
  position: absolute;
  right: 14px;
  top: 12px;
  border: 0;
  background: #e7f1d7;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  font-size: 22px;
  color: #9d83aa;
}
.dialog-flower {
  font-size: 37px;
  color: #568e66;
}
.instructions {
  padding-left: 21px;
  font-size: 13px;
  color: #8c7b93;
  line-height: 1.7;
  display: grid;
  gap: 14px;
}
.instructions strong {
  color: #695272;
}
.help-scoring,
.keyboard-help,
.dialog-description {
  font-size: 11px;
  line-height: 1.7;
  color: #9e8da6;
  margin: 20px 0;
}
.keyboard-help {
  font-size: 10px;
  background: #edf4df;
  padding: 12px;
  border-radius: 9px;
}
dialog > .primary-button {
  width: 100%;
  margin-top: 12px;
}
.leaderboard {
  list-style: none;
  padding: 0;
  max-height: 300px;
  overflow: auto;
}
.leaderboard li {
  display: flex;
  align-items: center;
  padding: 14px 0;
  border-bottom: 1px solid #eee5f3;
  gap: 12px;
  font-size: 13px;
}
.leaderboard .rank {
  display: grid;
  place-items: center;
  border-radius: 50%;
  width: 25px;
  height: 25px;
  background: #e7f1d7;
  color: #6b9669;
  font-size: 11px;
  font-weight: 750;
}
.leaderboard li:first-child .rank {
  background: #f8e5aa;
  color: #a47b24;
}
.leaderboard .leader-score {
  margin-left: auto;
  font-weight: 750;
  color: #2a7557;
}
.empty-board {
  text-align: center;
  padding: 28px 0;
  color: #a18aaa;
  font-size: 13px;
  line-height: 1.8;
}
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}
.defense-shop {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}
.defense-shop .defense-card {
  min-height: 84px;
  padding: 6px 8px 22px 2px;
  align-items: flex-start;
}
.defense-shop .defense-card .defense-cost {
  bottom: 6px;
  right: 8px;
}
.defense-shop .defense-card .defense-sprite {
  width: 52px;
  height: 52px;
  background: none;
}
.defense-shop .defense-copy strong {
  font-size: 11px;
  white-space: normal;
}
.defense-shop .defense-copy > span {
  font-size: 9px;
  white-space: normal;
  line-height: 1.2;
}
.defense-shop .defense-card kbd {
  display: none;
}
@media (min-width: 1450px) {
  .intro {
    padding-top: 25px;
    padding-bottom: 32px;
  }
  .site-header {
    padding-top: 30px;
  }
}
@media (max-width: 1000px) {
  .game-layout {
    grid-template-columns: minmax(0, 1fr) 205px;
    gap: 16px;
  }
  .defense-card {
    min-height: 87px;
  }
  .defense-card .defense-sprite {
    width: 62px;
    height: 62px;
  }
  .defense-copy strong {
    font-size: 11px;
  }
  .defense-copy > span {
    font-size: 9px;
  }
  .defense-cost {
    font-size: 10px;
    bottom: 8px;
  }
  .garden-tip {
    margin-top: 15px;
  }
  .game-toolbar {
    padding: 13px 16px;
  }
  .start-card {
    padding: 17px;
  }
  .start-card h2 {
    font-size: 23px;
  }
  .card-sprout {
    font-size: 32px;
  }
  .party-strip {
    max-width: 760px;
  }
  .run-note {
    font-size: 8px;
  }
  .game-status {
    padding: 11px 14px;
  }
}
@media (max-width: 760px) {
  .site-header {
    padding: 18px 20px;
    gap: 15px;
  }
  .wordmark {
    font-size: 26px;
  }
  .wordmark img {
    width: 26px;
    height: 26px;
  }
  .anniversary {
    padding: 4px 6px;
    font-size: 10px;
    margin-left: 0;
  }
  nav {
    gap: 14px;
  }
  .text-button {
    font-size: 0;
    min-width: 28px;
    min-height: 36px;
    justify-content: center;
  }
  .text-button > span {
    font-size: 23px;
  }
  .text-button:first-child > span {
    width: 22px;
    height: 22px;
    font-size: 14px;
  }
  .icon-button {
    width: 32px;
    height: 32px;
    font-size: 20px;
  }
  .intro {
    padding-top: 7px;
    padding-bottom: 22px;
  }
  .birthday-note {
    font-size: 10px;
  }
  h1 {
    font-size: 54px;
  }
  .intro p {
    font-size: 12px;
  }
  .title-flower {
    right: -37px;
    font-size: 31px;
  }
  main {
    padding: 0 15px;
  }
  .game-layout {
    display: flex;
    flex-direction: column;
    gap: 24px;
  }
  .game-shell {
    width: 100%;
    border-radius: 17px;
  }
  .game-toolbar {
    min-height: 66px;
    padding: 12px 15px;
    gap: 6px;
  }
  .game-toolbar strong {
    font-size: 18px;
  }
  .resource {
    min-width: 80px;
    gap: 6px;
  }
  .energy-icon {
    width: 30px;
    height: 34px;
    font-size: 28px;
    border-radius: 9px;
  }
  .stat-label {
    font-size: 8px;
  }
  .stat-total {
    font-size: 10px;
  }
  .health-stat > span:last-child {
    font-size: 17px;
    letter-spacing: 0;
  }
  .pause-button {
    width: 29px;
    height: 31px;
    font-size: 15px;
  }
  .defense-panel {
    width: 100%;
    padding: 0;
  }
  .panel-heading {
    margin-bottom: 12px;
    padding: 0 3px;
  }
  .panel-heading h2 {
    font-size: 13px;
  }
  .panel-heading > span {
    font-size: 10px;
  }
  .defense-shop {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 8px;
  }
  .defense-card,
  .defense-card.selected {
    display: flex;
    flex-direction: column;
    min-height: 145px;
    padding: 4px 3px 24px;
    align-items: center;
    text-align: center;
    border-radius: 12px;
  }
  .defense-card .defense-sprite {
    width: 75px;
    height: 75px;
    max-width: 100%;
  }
  .defense-copy {
    gap: 5px;
  }
  .defense-copy strong {
    font-size: 10px;
    white-space: normal;
  }
  .defense-copy > span {
    font-size: 8px;
    white-space: normal;
  }
  .defense-cost {
    bottom: 7px;
    right: 50%;
    transform: translateX(50%);
    font-size: 10px;
  }
  .defense-card kbd {
    display: none;
  }
  .shovel-button {
    margin-top: 12px;
    padding: 8px 12px;
    min-height: 38px;
  }
  .garden-tip {
    display: none;
  }
  .game-status {
    font-size: 9px;
    min-height: 37px;
  }
  .start-card {
    padding: 15px 17px;
    width: 310px;
    max-width: 78%;
    border-radius: 15px;
  }
  .card-sprout {
    font-size: 29px;
    margin-bottom: 4px;
  }
  .small-note {
    font-size: 8px;
  }
  .start-card h2 {
    font-size: 23px;
    margin: 6px 0;
  }
  .start-card p {
    font-size: 10px;
    margin: 7px 0 10px;
  }
  .start-card .primary-button {
    font-size: 11px;
    min-height: 39px;
    padding: 8px 21px;
  }
  .run-note {
    margin-top: 11px;
    font-size: 7px;
  }
  .party-strip {
    padding: 15px;
    margin-top: 25px;
    gap: 12px;
    flex-wrap: wrap;
  }
  .party-strip h2 {
    font-size: 12px;
  }
  .party-strip p {
    font-size: 10px;
  }
  .party-strip > div:nth-child(2) {
    flex: 1;
    min-width: 180px;
  }
  .practice-badge {
    margin-left: 48px;
    padding: 4px 7px;
  }
  .practice-disclosure {
    font-size: 9px;
    padding: 0 10px;
  }
  .result-card {
    padding: 12px 16px;
    max-width: 83%;
  }
  .result-card .card-sprout {
    display: none;
  }
  .result-card h2 {
    font-size: 20px;
    margin: 4px 0;
  }
  .result-score {
    font-size: 30px;
  }
  .result-card p {
    font-size: 9px;
    margin: 3px 0 6px;
  }
  .name-entry input {
    padding: 6px 8px;
    font-size: 10px;
  }
  .result-actions {
    margin-top: 6px;
    gap: 7px;
  }
  .result-actions .primary-button,
  .secondary-button {
    padding: 6px 12px;
    min-height: 33px;
    font-size: 10px;
  }
  .toast {
    font-size: 10px;
    bottom: 10px;
    padding: 8px 12px;
  }
  footer {
    padding: 24px 20px;
    justify-content: center;
  }
  footer > span:last-child {
    display: none;
  }
}
@media (max-width: 390px) {
  .site-header {
    padding-left: 15px;
    padding-right: 15px;
  }
  nav {
    gap: 7px;
  }
  main {
    padding: 0 9px;
  }
  .defense-shop {
    gap: 5px;
  }
  .defense-card,
  .defense-card.selected {
    min-height: 139px;
  }
  .defense-card .defense-sprite {
    width: 68px;
    height: 68px;
  }
  .defense-copy strong {
    font-size: 9px;
  }
  .game-toolbar {
    padding: 11px;
  }
  .start-card {
    padding: 11px 13px;
  }
  .start-card h2 {
    font-size: 20px;
  }
  .card-sprout {
    font-size: 23px;
  }
  .start-card p {
    font-size: 9px;
  }
  .run-note {
    font-size: 6.5px;
  }
  .start-card .primary-button {
    min-height: 34px;
  }
  .result-card h2 {
    font-size: 18px;
  }
  .result-score {
    font-size: 27px;
  }
  .name-entry input {
    padding: 5px 7px;
  }
}
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition: none !important;
    animation: none !important;
  }
}

.wordmark .brand-logo {
  width: 158px;
  height: 30px;
}
.defense-sprite {
  display: block;
  background-image: url("/assets/characters-3d.png");
  background-size: 400% 200%;
  background-repeat: no-repeat;
}
.sprite-rose {
  background-position: 0 0;
}
.sprite-orchid {
  background-position: 33.333333% 0;
}
.sprite-lily {
  background-position: 66.666667% 0;
}
.sprite-blossom {
  background-image: url("/assets/astelia-blossom.svg");
  background-size: contain;
  background-position: center;
}
.defense-card.locked {
  opacity: 0.55;
  filter: grayscale(0.85);
}
.defense-card.locked .defense-cost::after {
  content: " 🔒";
}
.shop-card {
  max-width: 460px;
}
.shop-items {
  display: grid;
  gap: 8px;
  margin: 12px 0 16px;
  text-align: left;
}
.shop-item {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 2px 12px;
  padding: 10px 14px;
  border: 1px solid #cfe2c5;
  border-radius: 14px;
  background: #f6fbef;
  color: #203e38;
  font: inherit;
  text-align: left;
  cursor: pointer;
}
.shop-item strong {
  font-size: 14px;
}
.shop-item small {
  grid-column: 1;
  color: #6f7d73;
  font-size: 11px;
}
.shop-item .shop-price {
  grid-row: 1 / span 2;
  grid-column: 2;
  font-weight: 800;
  color: #1a775a;
}
.shop-item:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
.shop-item.bought {
  background: #1a775a;
  border-color: #1a775a;
  color: #fff;
}
.shop-item.bought small,
.shop-item.bought .shop-price {
  color: #e9fff2;
}
.title-flower img {
  display: block;
  width: 43px;
  height: 43px;
}
.analysis-button {
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  margin-top: 12px;
  padding: 11px;
  border: 1px solid #9dbe98;
  border-radius: 12px;
  background: #e5f1d1;
  text-align: left;
  color: #1a775a;
  min-height: 58px;
}
.analysis-orb {
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  background: #1a775a;
  color: #d8efb1;
  border-radius: 50%;
  font-size: 25px;
  flex-shrink: 0;
}
.analysis-button strong {
  display: block;
  font-size: 12px;
}
.analysis-button small {
  display: block;
  font-size: 9px;
  margin-top: 3px;
  color: #5d866a;
}
#analysis-cooldown {
  font-size: 10px;
  margin-left: auto;
  font-weight: 700;
}
.analysis-button.analysis-active {
  opacity: 1;
  border-color: #1a775a;
  box-shadow: 0 0 0 3px #b4d98b66;
}
@media (max-width: 760px) {
  .wordmark .brand-logo {
    width: 120px;
    height: 23px;
  }
  .title-flower img {
    width: 30px;
    height: 30px;
  }
  .analysis-button {
    min-height: 48px;
    padding: 8px 12px;
  }
  .analysis-orb {
    width: 29px;
    height: 29px;
    font-size: 22px;
  }
  .analysis-button small {
    font-size: 9px;
  }
  .garden-wrap:has(.result-card:not([hidden])) {
    min-height: 310px;
  }
}

/* Page-wide flash when reachability analysis fires. */
body.scan-flash::after {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 50;
  background: radial-gradient(circle at 30% 50%, #b8ffd9cc, #1a775a55 45%, transparent 75%);
  animation: scan-flash 0.9s ease-out forwards;
}
@keyframes scan-flash {
  from { opacity: 1; }
  to { opacity: 0; }
}
@media (prefers-reduced-motion: reduce) {
  body.scan-flash::after { animation-duration: 0.01s; }
}

/* Twelve defenses don't fit a sidebar: the picker becomes a bar under the garden. */
@media (min-width: 761px) {
  .game-layout {
    grid-template-columns: minmax(0, 1fr);
  }
  .defense-panel {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px 14px;
    align-items: stretch;
  }
  .defense-panel .panel-heading,
  .defense-panel .defense-shop {
    grid-column: 1 / -1;
  }
  .defense-panel .defense-shop {
    grid-template-columns: repeat(6, minmax(0, 1fr));
  }
  .defense-panel .shovel-button,
  .defense-panel .analysis-button,
  .defense-panel .garden-tip {
    margin: 0;
  }
}
@media (min-width: 761px) and (max-width: 1100px) {
  .defense-panel .defense-shop {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

/* In-round cards stay compact: icon, name and cost. Descriptions live in the shop. */
.defense-shop .defense-copy > span {
  display: none;
}
.defense-shop .defense-card {
  min-height: 64px;
  align-items: center;
}
.defense-shop .defense-card {
  gap: 6px;
  padding: 6px 10px 6px 4px;
}
.defense-shop .defense-card .defense-cost {
  position: static;
  transform: none;
  margin-left: auto;
  align-self: center;
  white-space: nowrap;
}

.resource.energy-bump .energy-icon {
  animation: energy-bump 0.35s ease-out;
}
@keyframes energy-bump {
  40% { transform: scale(1.35); box-shadow: 0 0 18px #ffd24a; }
  100% { transform: scale(1); }
}

/* One screen, no scrolling: compact chrome, a single-row defense bar, and a
   garden sized from the height that is left. */
@media (min-width: 761px) {
  :root {
    /* Everything stacked around the garden canvas: header, title, toolbar,
       status bar, defense bar and gaps. */
    --play-chrome: 318px;
  }
  .site-header {
    padding: 10px 32px;
  }
  .wordmark {
    font-size: 24px;
  }
  .intro {
    padding: 0 0 8px;
  }
  .intro .birthday-note,
  .intro p {
    display: none;
  }
  .intro h1 {
    font-size: 30px;
    letter-spacing: -1.2px;
    margin: 0;
    text-shadow: 0 2px 0 #d7e5bd;
  }
  .intro .title-flower {
    display: none;
  }
  .game-layout {
    gap: 10px;
  }
  .game-shell {
    width: 100%;
    max-width: calc((100dvh - var(--play-chrome)) * 1228 / 620);
    margin: 0 auto;
  }
  .game-toolbar {
    min-height: 54px;
    padding: 7px 18px;
  }
  .game-status {
    min-height: 30px;
    padding: 6px 16px;
  }
  .defense-panel {
    grid-template-columns: minmax(0, 1fr) 270px;
    gap: 8px 10px;
    padding-top: 0;
  }
  .defense-panel .panel-heading,
  .defense-panel .garden-tip {
    display: none;
  }
  .defense-panel .defense-shop {
    grid-column: 1;
    grid-template-columns: repeat(12, minmax(0, 1fr));
    gap: 6px;
  }
  .defense-shop .defense-card {
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    min-height: 0;
    height: 92px;
    padding: 4px 3px;
    gap: 1px;
    text-align: center;
  }
  .defense-shop .defense-card .defense-sprite {
    width: 44px;
    height: 44px;
  }
  .defense-shop .defense-copy {
    width: 100%;
  }
  .defense-shop .defense-copy strong {
    font-size: 9.5px;
    line-height: 1.1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .defense-shop .defense-card .defense-cost {
    margin: 2px 0 0;
    font-size: 10px;
  }
  .defense-panel .shovel-button,
  .defense-panel .analysis-button {
    grid-column: 2;
    min-height: 0;
    height: 43px;
    padding: 4px 10px;
  }
  .defense-panel .shovel-button {
    grid-row: 1;
    align-self: start;
  }
  .defense-panel .analysis-button {
    grid-row: 1;
    align-self: end;
  }
  .defense-panel .analysis-button small {
    display: none;
  }
}
/* Narrower desktops: two rows of six cards. */
@media (min-width: 761px) and (max-width: 1100px) {
  :root {
    --play-chrome: 416px;
  }
  .defense-panel .defense-shop {
    grid-template-columns: repeat(6, minmax(0, 1fr));
  }
  .defense-panel .shovel-button,
  .defense-panel .analysis-button {
    height: 92px;
  }
}

/* Phones: the same one-screen idea, with six compact cards per row. */
@media (max-width: 760px) {
  .site-header {
    padding: 8px 14px;
  }
  .intro {
    padding: 0 0 6px;
  }
  .intro .birthday-note,
  .intro p,
  .intro .title-flower {
    display: none;
  }
  .intro h1 {
    font-size: 24px;
    letter-spacing: -1px;
    margin: 0;
  }
  .game-layout {
    gap: 8px;
  }
  .game-toolbar {
    min-height: 0;
    padding: 6px 10px;
  }
  .game-status {
    min-height: 0;
    padding: 4px 10px;
  }
  .defense-panel {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px;
  }
  .defense-panel .panel-heading,
  .defense-panel .garden-tip {
    display: none;
  }
  .defense-panel .defense-shop {
    grid-column: 1 / -1;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 4px;
  }
  .defense-shop .defense-card,
  .defense-shop .defense-card.selected {
    flex-direction: column;
    align-items: center;
    min-height: 0;
    height: 64px;
    padding: 2px;
    gap: 0;
  }
  .defense-shop .defense-card .defense-sprite {
    width: 34px;
    height: 34px;
  }
  .defense-shop .defense-copy strong {
    font-size: 8px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
    display: block;
  }
  .defense-shop .defense-card .defense-cost {
    position: static;
    transform: none;
    margin: 0;
    font-size: 9px;
  }
  .defense-panel .shovel-button,
  .defense-panel .analysis-button {
    margin: 0;
    min-height: 0;
    height: 40px;
    padding: 4px 8px;
  }
  .defense-panel .analysis-button small {
    display: none;
  }
}
@media (max-width: 760px) {
  .game-toolbar {
    gap: 6px;
  }
  .speed-toggles {
    gap: 3px;
    margin-right: 4px;
  }
  .speed-button {
    min-width: 30px;
    height: 28px;
    font-size: 11px;
    border-radius: 8px;
  }
  .pause-button {
    width: 28px;
    height: 28px;
    font-size: 14px;
  }
  .game-overlay .start-card {
    padding: 10px 14px;
    max-height: 100%;
    overflow: auto;
  }
  .game-overlay .start-card h2 {
    font-size: 17px;
    margin: 2px 0;
  }
  .game-overlay .start-card p:not(:where(.rotate-hint, .save-feedback)),
  .game-overlay .start-card .small-note,
  .game-overlay .start-card .card-sprout {
    display: none;
  }
  .game-overlay .start-card .primary-button {
    min-height: 0;
    padding: 8px 16px;
  }
}

/* ---------- Full-screen layouts ---------- */
.header-title,
.game-overlay .start-card .rotate-hint,
.site-header .fullscreen-button {
  display: none;
}

@media (orientation: portrait) and (max-width: 760px) and (pointer: coarse) {
  .game-overlay .start-card .rotate-hint {
    display: block;
    margin: 8px 0 0;
    color: #3f5f55;
    font-size: 12px;
  }
}

@media (orientation: landscape) and (max-height: 560px) {
  .site-header .fullscreen-button:not([hidden]) {
    display: inline-grid;
    place-items: center;
  }
}

:fullscreen .site-header .fullscreen-button:not([hidden]),
.site-header .fullscreen-button:focus-visible:not([hidden]) {
  display: inline-grid;
  place-items: center;
}

.site-header .fullscreen-button[aria-pressed="true"] {
  background: #0b5d48;
  color: #fff;
}

/* A. Desktop and roomy landscape: edge to edge, one slim top bar, the garden
   as wide as the height allows and the defense bar under it. */
@media (orientation: landscape) and (min-height: 561px) {
  :root {
    --play-chrome: 248px;
  }
  .site-header {
    max-width: none;
    padding: 6px 16px;
    gap: 16px;
    justify-content: flex-start;
  }
  .site-header nav {
    margin-left: auto;
  }
  .wordmark {
    font-size: 20px;
  }
  .wordmark .brand-logo {
    width: 120px;
    height: 23px;
  }
  .header-title {
    display: block;
    font-family: "Arial Rounded MT Bold", "Trebuchet MS", sans-serif;
    font-size: 22px;
    font-weight: 900;
    letter-spacing: -0.8px;
    color: #003939;
  }
  .intro {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    padding: 0;
  }
  main {
    max-width: none;
    padding: 0 12px;
  }
  .game-layout {
    gap: 8px;
  }
  .game-shell {
    max-width: calc((100dvh - var(--play-chrome)) * 1228 / 620);
  }
  .defense-panel {
    width: 100%;
    max-width: max(calc((100dvh - var(--play-chrome)) * 1228 / 620), 1100px);
    margin: 0 auto;
  }
}

/* B. Phones held sideways: no header, defense cards in a column beside the
   garden so the garden gets the full height. */
@media (orientation: landscape) and (max-height: 560px) {
  .site-header {
    position: fixed;
    top: 4px;
    right: 6px;
    z-index: 20;
    padding: 0;
    max-width: none;
  }
  .site-header .wordmark,
  .site-header .header-title {
    display: none;
  }
  .site-header .text-button {
    font-size: 0;
    padding: 4px;
  }
  .site-header .text-button span {
    font-size: 15px;
  }
  .site-header .icon-button {
    width: 28px;
    height: 28px;
    font-size: 16px;
  }
  .intro {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    padding: 0;
  }
  main {
    max-width: none;
    padding: 4px 6px;
  }
  .game-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 236px;
    gap: 6px;
    align-items: start;
  }
  .game-shell {
    max-width: calc((100dvh - 50px) * 1228 / 620);
    margin: 0 auto;
    border-radius: 12px;
  }
  .game-toolbar {
    min-height: 0;
    padding: 3px 120px 3px 10px;
  }
  .game-status {
    display: none;
  }
  .defense-panel {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 4px;
    max-width: none;
    margin: 0;
  }
  .defense-panel .panel-heading,
  .defense-panel .garden-tip {
    display: none;
  }
  .defense-panel .defense-shop {
    grid-column: 1 / -1;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 4px;
  }
  .defense-shop .defense-card,
  .defense-shop .defense-card.selected {
    flex-direction: column;
    align-items: center;
    height: calc((100dvh - 96px) / 4);
    min-height: 0;
    padding: 2px;
    gap: 0;
  }
  .defense-shop .defense-card .defense-sprite {
    width: 32px;
    height: 32px;
  }
  .defense-shop .defense-copy strong {
    font-size: 8px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
    display: block;
  }
  .defense-shop .defense-card .defense-cost {
    position: static;
    transform: none;
    margin: 0;
    font-size: 9px;
  }
  .defense-panel .shovel-button,
  .defense-panel .analysis-button {
    grid-column: auto;
    grid-row: auto;
    height: 38px;
    min-height: 0;
    margin: 0;
    padding: 2px 6px;
    font-size: 11px;
  }
  .defense-panel .analysis-button small,
  .defense-panel .shovel-button span,
  .defense-panel #analysis-cooldown {
    display: none;
  }
  .party-strip,
  footer {
    display: none;
  }
}

/* C. Phones held upright: trim the scenery edges so the lanes fill the
   width, bigger cards, and a nudge to rotate. */
@media (orientation: portrait) {
  .site-header {
    max-width: none;
    padding: 6px 12px;
    gap: 10px;
    justify-content: flex-start;
  }
  .site-header nav {
    margin-left: auto;
  }
  .wordmark .brand-logo {
    width: 104px;
    height: 20px;
  }
  .wordmark .anniversary {
    display: none;
  }
  .header-title {
    display: block;
    font-family: "Arial Rounded MT Bold", "Trebuchet MS", sans-serif;
    font-size: 19px;
    font-weight: 900;
    color: #003939;
  }
  .intro {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    padding: 0;
  }
  main {
    max-width: none;
    padding: 0 6px;
  }
  .game-layout {
    display: flex;
    flex-direction: column;
    gap: 6px;
  }
  .game-shell,
  .defense-panel {
    max-width: none;
    width: 100%;
  }
  .defense-panel {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 5px;
  }
  .defense-panel .panel-heading,
  .defense-panel .garden-tip {
    display: none;
  }
  .defense-panel .defense-shop {
    grid-column: 1 / -1;
  }
  .defense-shop .defense-card,
  .defense-shop .defense-card.selected {
    flex-direction: column;
    align-items: center;
    min-height: 0;
    padding: 2px;
    gap: 0;
  }
  .defense-shop .defense-copy strong {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
    display: block;
  }
  .defense-shop .defense-card .defense-cost {
    position: static;
    transform: none;
    margin: 0;
  }
  .defense-panel .shovel-button,
  .defense-panel .analysis-button {
    grid-column: auto;
    grid-row: auto;
    margin: 0;
    min-height: 0;
  }
  .garden-wrap {
    overflow: hidden;
  }
  .garden-wrap > canvas {
    width: 116%;
    margin-left: -8%;
  }
  .defense-panel .defense-shop {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 5px;
  }
  .defense-shop .defense-card,
  .defense-shop .defense-card.selected {
    height: 78px;
  }
  .defense-shop .defense-card .defense-sprite {
    width: 44px;
    height: 44px;
  }
  .defense-shop .defense-copy strong {
    font-size: 9px;
  }
  .defense-panel .shovel-button,
  .defense-panel .analysis-button {
    height: 46px;
  }
}

@media (orientation: portrait) and (min-width: 500px) {
  .defense-panel .defense-shop {
    grid-template-columns: repeat(6, minmax(0, 1fr));
  }
}
@media (orientation: portrait) {
  .site-header {
    padding: 4px 12px;
  }
  .defense-shop .defense-card,
  .defense-shop .defense-card.selected {
    height: 74px;
  }
  .defense-shop .defense-card .defense-sprite {
    width: 40px;
    height: 40px;
  }
  .defense-panel .shovel-button,
  .defense-panel .analysis-button {
    height: 42px;
  }
}
.game-toolbar strong {
  white-space: nowrap;
}
@media (orientation: portrait) {
  /* Fill the screen: the defense bar stretches into whatever height is left. */
  body {
    display: flex;
    flex-direction: column;
    min-height: 100dvh;
  }
  main {
    flex: 1;
    display: flex;
    flex-direction: column;
    width: 100%;
    box-sizing: border-box;
  }
  .game-layout {
    flex: 1;
    min-height: calc(100dvh - 56px);
  }
  .defense-panel {
    flex: 1;
    grid-template-rows: auto 1fr auto;
  }
  .defense-panel .defense-shop {
    grid-auto-rows: minmax(70px, 1fr);
  }
  .defense-shop .defense-card,
  .defense-shop .defense-card.selected {
    height: auto;
    justify-content: center;
  }
  .defense-shop .defense-card .defense-sprite {
    width: min(72px, 16vw);
    height: min(72px, 16vw);
  }
  /* Trim a little of the fence above and the flower bed below the lawn. */
  .garden-wrap > canvas {
    margin-top: -4%;
    margin-bottom: -4%;
  }
}
@media (orientation: landscape) and (max-height: 560px) {
  .practice-disclosure {
    display: none;
  }
  .game-toolbar {
    padding-right: 10px;
  }
  /* Room above the cards for the floating help / leaderboard / sound icons. */
  .defense-panel {
    padding-top: 34px;
  }
  .defense-shop .defense-card,
  .defense-shop .defense-card.selected {
    height: calc((100dvh - 134px) / 4);
  }
  .game-overlay .start-card {
    padding: 10px 16px;
    max-height: 100%;
    overflow: auto;
  }
  .game-overlay .start-card h2 {
    font-size: 18px;
    margin: 2px 0;
  }
  .game-overlay .start-card p:not(:where(.rotate-hint, .save-feedback)),
  .game-overlay .start-card .small-note,
  .game-overlay .start-card .card-sprout {
    display: none;
  }
  .game-overlay .start-card .primary-button {
    min-height: 0;
    padding: 8px 16px;
  }
}

/* The game owns the whole screen in every layout: no page below it to scroll to. */
.party-strip,
.practice-disclosure,
body > footer {
  display: none;
}

/* Garden shop: a full-screen layer above the game, with a scrolling grid of
   live-drawn cards and a purchase sequence (punch, stamp, points flying off). */
.shop-screen {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: max(12px, env(safe-area-inset-top)) max(12px, env(safe-area-inset-right))
    max(12px, env(safe-area-inset-bottom)) max(12px, env(safe-area-inset-left));
  background: radial-gradient(circle at 50% 30%, #1d5a4699, #062a24e0);
  backdrop-filter: blur(4px);
  animation: shop-fade 0.3s ease-out both;
}
.shop-screen[hidden] {
  display: none;
}
.shop-panel {
  display: flex;
  flex-direction: column;
  width: min(1040px, 100%);
  max-height: 100%;
  overflow: hidden;
  background: linear-gradient(180deg, #fffdf7, #f3f8ea);
  border: 2px solid #82725e;
  border-radius: 24px;
  box-shadow: 0 9px 0 #554d3855, 0 30px 60px #00000055;
  animation: shop-rise 0.5s cubic-bezier(0.2, 1.3, 0.4, 1) both;
}
.shop-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 20px 12px;
  border-bottom: 1px solid #e3ead7;
}
.shop-label {
  display: block;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  color: #1a775a;
}
.shop-head h2 {
  margin: 0;
  font-family: "Arial Rounded MT Bold", "Trebuchet MS", sans-serif;
  font-size: 28px;
  letter-spacing: -0.8px;
  color: #003939;
}
.shop-wallet {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  padding: 6px 16px;
  border-radius: 16px;
  background: linear-gradient(180deg, #ffe9a3, #f5c542);
  border: 2px solid #b7860f;
  box-shadow: 0 3px 0 #8a5a0055;
  color: #5a3b00;
}
.shop-wallet span {
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 1px;
}
.shop-wallet strong {
  font-size: 24px;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}
.shop-wallet.spent {
  animation: wallet-spend 0.45s ease-out;
}
.shop-screen .shop-items {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  align-content: start;
  gap: 12px;
  margin: 0;
  padding: 16px 20px 20px;
}
.shop-screen .shop-item {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 26px 10px 12px;
  border: 2px solid #cfe2c5;
  border-radius: 18px;
  background: linear-gradient(180deg, #ffffff, #f2f8ea);
  box-shadow: 0 4px 0 #cfe2c5;
  color: #203e38;
  font: inherit;
  text-align: center;
  cursor: pointer;
  opacity: 1;
  transition: transform 0.18s ease, box-shadow 0.18s ease, opacity 0.2s;
}
.shop-screen .shop-item:hover,
.shop-screen .shop-item:focus-visible {
  transform: translateY(-4px);
  box-shadow: 0 8px 0 #cfe2c5, 0 12px 22px #1a775a26;
}
.shop-screen .shop-item:active {
  transform: translateY(2px);
  box-shadow: 0 2px 0 #cfe2c5;
}
.shop-screen .shop-item.unlock {
  border-color: #e8c25a;
  box-shadow: 0 4px 0 #e8c25a;
  background: linear-gradient(180deg, #fffaf0, #fbefcf);
}
.shop-screen .shop-item.repair {
  border-color: #f1b3bf;
  box-shadow: 0 4px 0 #f1b3bf;
}
.shop-screen .shop-item.energy {
  border-color: #f3d27a;
  box-shadow: 0 4px 0 #f3d27a;
}
.entering .shop-item {
  animation: shop-card-in 0.5s cubic-bezier(0.2, 1.4, 0.4, 1) both;
  animation-delay: calc(0.12s + var(--i) * 45ms);
}
.shop-tag {
  position: absolute;
  top: 8px;
  left: 50%;
  transform: translateX(-50%);
  white-space: nowrap;
  padding: 2px 9px;
  border-radius: 99px;
  background: #1a775a;
  color: #fff;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.4px;
  text-transform: uppercase;
}
.shop-item.unlock .shop-tag {
  background: #c48a00;
}
.shop-item.repair .shop-tag {
  background: #c8304d;
}
.shop-item.energy .shop-tag {
  background: #b77900;
}
.shop-icon {
  width: 104px;
  height: 104px;
}
.shop-screen .shop-item strong {
  font-size: 15px;
  line-height: 1.15;
}
.shop-screen .shop-item small {
  min-height: 2.5em;
  color: #5f6f64;
  font-size: 11.5px;
  line-height: 1.25;
}
.shop-stars {
  display: flex;
  gap: 3px;
}
.shop-stars i {
  width: 12px;
  height: 12px;
  clip-path: polygon(50% 0, 61% 35%, 98% 35%, 68% 57%, 79% 91%, 50% 70%, 21% 91%, 32% 57%, 2% 35%, 39% 35%);
  background: #d9e2d2;
}
.shop-stars i.filled {
  background: #f0b400;
}
.shop-stars i.next {
  background: #f0b400;
  animation: star-next 1.1s ease-in-out infinite;
}
.shop-screen .shop-item .shop-price {
  margin-top: 6px;
  padding: 5px 14px;
  border-radius: 99px;
  background: #1a775a;
  color: #fff;
  font-weight: 900;
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}
.shop-screen .shop-item.cant-afford {
  opacity: 0.6;
}
.shop-screen .shop-item.cant-afford .shop-price {
  background: #a9b3a5;
}
.shop-screen .shop-item.refused {
  animation: shop-refuse 0.4s ease-in-out;
}
.shop-stamp {
  position: absolute;
  top: 68%;
  left: 50%;
  padding: 4px 12px;
  border: 3px solid #1a775a;
  border-radius: 10px;
  background: #ffffffee;
  color: #1a775a;
  font-size: 19px;
  font-weight: 900;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transform: translate(-50%, -50%) rotate(-9deg) scale(2.6);
}
.shop-item.unlock .shop-stamp {
  border-color: #c48a00;
  color: #a06f00;
}
.shop-screen .shop-item.purchased {
  border-color: #f0b400;
  animation: shop-purchased 1.25s ease-out both;
}
.shop-item.purchased .shop-stamp {
  animation: shop-stamp 1.25s cubic-bezier(0.2, 1.5, 0.4, 1) 0.32s both;
}
.shop-item.purchased .shop-price {
  background: #f0b400;
  color: #5a3b00;
}
.shop-cost-float {
  position: fixed;
  z-index: 101;
  pointer-events: none;
  translate: -50% -50%;
  padding: 3px 10px;
  border-radius: 99px;
  background: #c8304d;
  color: #fff;
  font-weight: 900;
  font-size: 16px;
  animation: cost-travel 0.75s cubic-bezier(0.5, 0, 0.7, 0.4) forwards;
}
.shop-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 20px;
  border-top: 1px solid #e3ead7;
  background: #fffdf7;
}
.shop-tip {
  color: #6f7d73;
  font-size: 12px;
}
.shop-foot .primary-button {
  margin: 0;
  min-height: 0;
  padding: 11px 22px;
}
@keyframes shop-fade {
  from {
    opacity: 0;
  }
}
@keyframes shop-rise {
  from {
    opacity: 0;
    transform: translateY(40px) scale(0.94);
  }
}
@keyframes shop-card-in {
  from {
    opacity: 0;
    transform: translateY(26px) scale(0.85);
  }
}
@keyframes shop-refuse {
  20%,
  60% {
    transform: translateX(-6px);
  }
  40%,
  80% {
    transform: translateX(6px);
  }
}
@keyframes shop-purchased {
  0% {
    box-shadow: 0 4px 0 #f0b400, 0 0 0 0 #f0b40099;
  }
  30% {
    transform: translateY(-6px) scale(1.04);
    box-shadow: 0 8px 0 #f0b400, 0 0 0 14px #f0b40033;
  }
  100% {
    transform: none;
    box-shadow: 0 4px 0 #f0b400, 0 0 0 26px #f0b40000;
  }
}
@keyframes shop-stamp {
  0% {
    opacity: 0;
    transform: translate(-50%, -50%) rotate(-9deg) scale(2.6);
  }
  18% {
    opacity: 1;
    transform: translate(-50%, -50%) rotate(-9deg) scale(1);
  }
  80% {
    opacity: 1;
    transform: translate(-50%, -50%) rotate(-9deg) scale(1);
  }
  100% {
    opacity: 0;
    transform: translate(-50%, -60%) rotate(-9deg) scale(1);
  }
}
@keyframes cost-travel {
  15% {
    transform: scale(1.25);
  }
  100% {
    transform: translate(var(--travel-x), var(--travel-y)) scale(0.6);
    opacity: 0;
  }
}
@keyframes wallet-spend {
  40% {
    transform: scale(0.9);
    filter: brightness(1.15);
  }
}
@keyframes star-next {
  50% {
    transform: scale(1.35);
    opacity: 0.45;
  }
}
@media (max-width: 520px) {
  .shop-screen {
    padding: 8px;
  }
  .shop-head {
    padding: 12px 14px 10px;
  }
  .shop-head h2 {
    font-size: 22px;
  }
  .shop-screen .shop-items {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    padding: 12px;
  }
  .shop-icon {
    width: 88px;
    height: 88px;
  }
  .shop-tip {
    display: none;
  }
  .shop-foot {
    justify-content: center;
    padding: 10px 12px;
  }
  .shop-foot .primary-button {
    width: 100%;
    justify-content: center;
  }
}
@media (orientation: landscape) and (max-height: 560px) {
  .shop-screen {
    padding: 6px;
  }
  .shop-panel {
    border-radius: 16px;
  }
  .shop-head {
    padding: 8px 14px;
  }
  .shop-head h2 {
    font-size: 20px;
  }
  .shop-wallet {
    padding: 3px 12px;
  }
  .shop-wallet strong {
    font-size: 18px;
  }
  .shop-screen .shop-items {
    grid-template-columns: repeat(auto-fill, minmax(132px, 1fr));
    gap: 8px;
    padding: 10px 14px;
  }
  .shop-icon {
    width: 72px;
    height: 72px;
  }
  .shop-screen .shop-item small {
    display: none;
  }
  .shop-foot {
    padding: 6px 14px;
  }
  .shop-foot .primary-button {
    padding: 8px 18px;
  }
}

/* Reachability analysis is the game's big move: a glowing call to action that
   pulses when ready and fills up while it recharges. */
body .defense-panel .analysis-button,
body .analysis-button {
  position: relative;
  overflow: hidden;
  align-self: stretch;
  min-height: 64px;
  padding: 10px 14px;
  gap: 10px;
  border: 2px solid #0b5b45;
  border-radius: 16px;
  background: linear-gradient(135deg, #22b37a, #0f7a5c 55%, #0b5b45);
  color: #fff;
  box-shadow: 0 4px 0 #06372a, 0 8px 18px #0b5b4555;
  cursor: pointer;
  isolation: isolate;
}
body .analysis-button strong {
  font-size: 15px;
  line-height: 1.1;
  color: #fff;
  text-shadow: 0 1px 0 #06372a;
}
body .analysis-button small {
  color: #c9f7df;
  font-size: 11px;
}
body .defense-panel .analysis-button small {
  display: block;
}
body .analysis-orb {
  width: 40px;
  height: 40px;
  font-size: 28px;
  background: #fff;
  color: #0f7a5c;
  box-shadow: 0 0 0 4px #ffffff40;
}
body .defense-panel #analysis-cooldown,
body #analysis-cooldown {
  display: block;
  margin-left: auto;
  padding: 4px 10px;
  border-radius: 99px;
  background: #ffd75e;
  color: #3d2b00;
  font-size: 12px;
  font-weight: 900;
  white-space: nowrap;
}
body .analysis-button.analysis-ready {
  animation: analysis-ready-pulse 1.6s ease-in-out infinite;
}
body .analysis-button.analysis-ready .analysis-orb {
  animation: analysis-orb-spin 6s linear infinite;
}
body .analysis-button:disabled:not(.analysis-active) {
  opacity: 1;
  cursor: default;
  background: linear-gradient(135deg, #3f8f74, #2b6b57);
  border-color: #234f42;
  box-shadow: 0 3px 0 #173a30;
}
body .analysis-button:disabled:not(.analysis-active) #analysis-cooldown {
  background: #ffffff2e;
  color: #e5fff2;
}
body .analysis-button.analysis-active {
  background: linear-gradient(135deg, #7dffb8, #22b37a);
  border-color: #fff;
  box-shadow: 0 0 0 4px #b8ffd9aa, 0 0 26px #7dffb8;
}
body .analysis-button.analysis-active strong,
body .analysis-button.analysis-active small {
  color: #003929;
  text-shadow: none;
}
body .analysis-button kbd {
  position: absolute;
  bottom: 5px;
  right: 9px;
  padding: 0 5px;
  border-radius: 4px;
  background: #ffffff33;
  color: #fff;
  font: 800 9px system-ui, sans-serif;
}
@keyframes analysis-ready-pulse {
  0%,
  100% {
    box-shadow: 0 4px 0 #06372a, 0 0 0 0 #22b37a99;
    transform: translateY(0);
  }
  50% {
    box-shadow: 0 4px 0 #06372a, 0 0 0 10px #22b37a00;
    transform: translateY(-2px);
  }
}
@keyframes analysis-orb-spin {
  to {
    transform: rotate(360deg);
  }
}
@media (orientation: landscape) and (max-height: 560px) {
  body .defense-panel .analysis-button {
    grid-column: 1 / -1;
    min-height: 0;
    padding: 6px 10px;
  }
  body .defense-panel .analysis-button small {
    display: none;
  }
  body .analysis-orb {
    width: 30px;
    height: 30px;
    font-size: 21px;
  }
  body .analysis-button strong {
    font-size: 13px;
  }
}
@media (orientation: portrait) {
  body .defense-panel .analysis-button {
    grid-column: 1 / -1;
    grid-row: 1;
    min-height: 44px;
    padding: 4px 12px;
  }
  body .defense-panel .analysis-button small {
    display: none;
  }
  body .analysis-orb {
    width: 30px;
    height: 30px;
    font-size: 21px;
  }
}
@media (orientation: portrait) {
  body .defense-panel {
    padding-bottom: max(8px, env(safe-area-inset-bottom));
    flex: 1 1 0;
    min-height: 0;
  }
  body main,
  body .game-layout {
    min-height: 0;
  }
  body .defense-panel .garden-tip {
    display: none;
  }
}
/* Short portrait phones: shorter cards so the whole game still fits. */
@media (orientation: portrait) and (max-height: 740px) {
  body .defense-panel .defense-shop {
    grid-auto-rows: minmax(40px, 1fr);
  }
  body .defense-shop .defense-card .defense-sprite {
    width: min(72px, 16vw, 7dvh);
    height: min(72px, 16vw, 7dvh);
  }
  body .defense-shop .defense-card,
  body .defense-shop .defense-card.selected {
    padding-top: 3px;
    padding-bottom: 3px;
  }
  body .defense-panel .analysis-button {
    padding: 4px 10px;
  }
}
@media (orientation: portrait), (max-height: 560px), (pointer: coarse) {
  body .analysis-button kbd {
    display: none;
  }
}

/* The closing line stays on every screen size, even where the overlay hides
   the card's other paragraphs to save room. */
.game-overlay .start-card .result-message:not([hidden]) {
  display: block;
}
@media (max-width: 760px), (orientation: landscape) and (max-height: 560px) {
  .game-overlay .start-card .result-message {
    font-size: 11px;
    margin: 4px auto 8px;
  }
}

/* Plants that haven't arrived yet show the stage they arrive in. */
.defense-card {
  position: relative;
}
.defense-card[data-arrives]::before {
  content: attr(data-arrives);
  position: absolute;
  top: 4px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 1;
  padding: 1px 6px;
  border-radius: 999px;
  background: #003939;
  color: #e7fff4;
  font-size: 9px;
  font-weight: 800;
  white-space: nowrap;
}

/* Field guide */
.guide-dialog {
  width: min(720px, calc(100vw - 32px));
  max-height: calc(100dvh - 32px);
}
.guide-tabs {
  display: flex;
  gap: 6px;
  justify-content: center;
  margin: 8px 0 12px;
}
.guide-tab {
  border: 1px solid #1a775a55;
  background: #f2fbf6;
  color: #0b4f45;
  border-radius: 999px;
  padding: 6px 14px;
  font-weight: 800;
  font-size: 12px;
  cursor: pointer;
}
.guide-tab[aria-selected="true"] {
  background: #1a775a;
  color: #ffffff;
}
.guide-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 8px;
  max-height: min(60dvh, 520px);
  overflow-y: auto;
  text-align: left;
  padding: 2px;
}
.guide-entry {
  display: grid;
  grid-template-columns: 64px 1fr;
  gap: 4px 10px;
  align-items: start;
  border: 1px solid #1a775a33;
  border-radius: 12px;
  padding: 8px;
  background: #fbfffd;
}
.guide-entry canvas {
  width: 64px;
  height: 64px;
  grid-row: span 2;
}
.guide-entry strong {
  font-size: 13px;
  color: #003939;
}
.guide-entry .guide-blurb {
  font-size: 10.5px;
  line-height: 1.3;
  color: #2d5a50;
}
.guide-stats {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 2px 6px;
  align-items: center;
  font-size: 10px;
  color: #0b4f45;
}
.guide-bar {
  height: 6px;
  border-radius: 3px;
  background: #e1efe8;
  overflow: hidden;
}
.guide-bar i {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, #1a775a, #4fd1a5);
}
.guide-stats b {
  text-align: right;
  font-weight: 800;
}
.guide-tag {
  grid-column: 1 / -1;
  font-size: 9.5px;
  font-weight: 800;
  color: #1a775a;
}

/* Story cards: Mythos returns every few stages. */
.story-dialog {
  width: min(680px, calc(100vw - 32px));
  padding: 0;
  overflow: hidden;
  border: 1px solid #8a5cf066;
  background: linear-gradient(135deg, #12082a 0%, #1b0f3d 55%, #0a2a2c 100%);
  color: #efe8ff;
}
.story-dialog[open] {
  display: grid;
  grid-template-columns: 220px 1fr;
  align-items: end;
}
.story-portrait {
  width: 100%;
  height: auto;
  align-self: end;
  filter: drop-shadow(0 0 18px #8a5cf099);
}
.story-body {
  padding: 22px 22px 22px 6px;
  text-align: left;
  align-self: center;
}
.story-chapter {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #c4a8ff;
}
.story-dialog h2 {
  margin: 4px 0 10px;
  font-size: 24px;
  color: #ffffff;
}
.story-dialog p {
  font-size: 14px;
  line-height: 1.45;
  margin: 0 0 16px;
  color: #ddd2ff;
}
@media (max-width: 560px) {
  .story-dialog[open] {
    grid-template-columns: 1fr;
  }
  .story-portrait {
    width: 150px;
    margin: 12px auto -8px;
  }
  .story-body {
    padding: 0 18px 18px;
    text-align: center;
  }
}

.opening-story[open] {
  width: min(840px, calc(100vw - 20px));
  max-height: calc(100dvh - 20px);
  grid-template-columns: minmax(0, 1fr);
  align-items: stretch;
  overflow-y: auto;
}
.opening-story .story-body {
  padding: 16px 22px;
}
.opening-shot {
  container-type: size;
  position: relative;
  height: clamp(160px, 39dvh, 360px);
  overflow: hidden;
  background: #15202b;
}
.opening-video {
  display: block;
  width: 100%;
  height: auto;
  max-height: min(54dvh, 420px);
  object-fit: contain;
  background: #101d22;
}
.opening-field-view {
  --breach-x: 73.6%;
  --breach-foot: 53%;
  position: absolute;
  inset: 0 auto 0 50%;
  width: max(100%, 232cqh);
  translate: -50% 0;
  transform-origin: 66% 50%;
  animation: opening-field-dolly 4.9s ease-in-out both;
}
.opening-field-stage {
  display: block;
  width: 100%;
  height: 100%;
}
.opening-breach-glow {
  position: absolute;
  left: var(--breach-x);
  top: 34%;
  width: 24%;
  aspect-ratio: 1;
  opacity: 0;
  translate: -50% -50%;
  background: radial-gradient(closest-side, #e6acff 0%, #b356ff85 39%, transparent 100%);
  mix-blend-mode: screen;
  animation: opening-breach-pulse 2.5s ease-out both;
}
.opening-mythos {
  position: absolute;
  left: 54%;
  bottom: 20%;
  height: 72%;
  width: auto;
  translate: -50% 0;
  transform-origin: center bottom;
  filter: drop-shadow(0 7px 5px #080d16a8);
  animation: opening-mythos-enter 1.55s ease-in-out 0.1s both;
}
.opening-swarm {
  position: absolute;
  inset: 0;
}
.opening-cve {
  --stride-delay: 1.4s;
  --gather-x: 69%;
  --gather-foot: 40%;
  --charge-x: 38%;
  --charge-foot: 5%;
  position: absolute;
  left: var(--charge-x);
  bottom: var(--charge-foot);
  height: 50%;
  translate: -50% 0;
  transform-origin: center bottom;
  animation: opening-cve-advance 3.2s ease-in var(--stride-delay) both;
}
.opening-cve:nth-child(2) {
  --stride-delay: 1.3s;
  --gather-x: 77%;
  --gather-foot: 49%;
  --charge-x: 60%;
  --charge-foot: 28%;
  height: 33%;
}
.opening-cve:nth-child(3) {
  --stride-delay: 1.15s;
  --gather-x: 67%;
  --gather-foot: 46%;
  --charge-x: 25%;
  --charge-foot: 17%;
  height: 41%;
}
.opening-cve:nth-child(4) {
  --stride-delay: 1.55s;
  --gather-x: 80%;
  --gather-foot: 43%;
  --charge-x: 70%;
  --charge-foot: 14%;
  height: 35%;
}
.opening-cve:nth-child(5) {
  --stride-delay: 1.7s;
  --gather-x: 74%;
  --gather-foot: 39%;
  --charge-x: 57%;
  --charge-foot: 1%;
  height: 43%;
}
.opening-cve-sprite {
  display: block;
  width: auto;
  height: 100%;
  filter: drop-shadow(0 5px 3px #111b16bd);
  animation: opening-cve-gait 440ms ease-in-out 11 alternate;
}
.opening-shot .opening-animated {
  animation-play-state: paused;
}
.opening-shot.opening-art-ready .opening-animated {
  animation-play-state: running;
}
@keyframes opening-field-dolly {
  0%, 8% { transform: scale(1); }
  40% { transform: scale(1.1); }
  100% { transform: scale(1); }
}
@keyframes opening-breach-pulse {
  0%, 100% { opacity: 0; transform: scale(.5); }
  35% { opacity: .8; transform: scale(1); }
}
@keyframes opening-mythos-enter {
  0% {
    left: var(--breach-x);
    bottom: var(--breach-foot);
    transform: scale(.28);
    opacity: 0;
  }
  26% { opacity: 1; }
  48% { transform: translateY(-3%) rotate(-4deg) scale(.63); }
  73% { transform: translateY(1%) rotate(2deg) scale(.84); }
  100% { transform: none; opacity: 1; }
}
@keyframes opening-cve-advance {
  0% {
    left: var(--breach-x);
    bottom: var(--breach-foot);
    opacity: 0;
    transform: scale(.34);
  }
  24%, 39% {
    left: var(--gather-x);
    bottom: var(--gather-foot);
    opacity: 1;
    transform: scale(.57);
  }
  100% { opacity: 1; transform: none; }
}
@keyframes opening-cve-gait {
  from { transform: rotate(-5deg); }
  to { transform: translateY(-9%) rotate(5deg); }
}
@media (orientation: portrait) and (max-width: 620px) {
  .opening-shot {
    height: clamp(160px, 56vw, 280px);
  }
}
@media (orientation: landscape) and (max-height: 560px) {
  .opening-story[open] {
    --opening-media-height: min(clamp(140px, 62dvh, 240px), calc(100dvh - 22px));
    grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr);
  }
  .opening-shot {
    height: var(--opening-media-height);
  }
  .opening-video {
    max-height: var(--opening-media-height);
  }
  .opening-story .story-body {
    display: grid;
    grid-template-rows: auto auto minmax(0, 1fr) auto;
    justify-items: start;
    max-height: calc(100dvh - 22px);
  }
  .opening-story p {
    min-height: 0;
    overflow-y: auto;
  }
}
@media (orientation: landscape) and (max-height: 200px) {
  .opening-story .story-body {
    align-self: start;
    grid-template-rows: auto minmax(24px, 1fr) auto;
    padding: 8px 12px;
  }
  .opening-story .story-chapter {
    display: none;
  }
  .opening-story h2 {
    margin-block: 0 2px;
    font-size: 16px;
    line-height: 1.15;
  }
  .opening-story p {
    margin-bottom: 2px;
  }
}
@media (prefers-reduced-motion: reduce) {
  .opening-animated {
    animation: none;
  }
}

/* Upgrade kits waiting to be placed on a plant. */
.kit-tray {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 8px 0 4px;
}
.kit-tray[hidden] {
  display: none;
}
.kit-chip {
  border: 2px solid var(--kit-color, #1a775a);
  border-radius: 999px;
  padding: 4px 10px;
  background: #ffffff;
  color: #003939;
  font: inherit;
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
}
.kit-chip.selected {
  background: var(--kit-color, #1a775a);
  color: #ffffff;
  box-shadow: 0 0 0 3px #ffffff, 0 0 0 5px var(--kit-color, #1a775a);
}
.shop-guide-button {
  margin-left: auto;
  white-space: nowrap;
}
.shop-screen .shop-info {
  position: absolute;
  top: 6px;
  right: 8px;
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #1a775a;
  color: #ffffff;
  font: italic 800 13px/1 Georgia, serif;
  cursor: help;
}
.shop-screen .shop-info:hover,
.shop-screen .shop-info:focus-visible {
  background: #003939;
  outline: 2px solid #efbb4e;
}
.guide-entry.guide-focus {
  border-color: #efbb4e;
  box-shadow: 0 0 0 3px #efbb4e66;
}

/* Special powers bought in the shop. */
.power-bar {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 6px;
  margin: 8px 0;
}
.power-bar[hidden] {
  display: none;
}
.power-button {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 1px;
  border: 2px solid var(--power-color, #1a775a);
  border-left-width: 8px;
  border-radius: 10px;
  padding: 5px 8px;
  background: #ffffff;
  color: #003939;
  font: inherit;
  font-size: 12px;
  text-align: left;
  cursor: pointer;
}
.power-button small {
  color: #55794a;
  font-weight: 700;
}
.power-button:disabled {
  opacity: 0.55;
  cursor: default;
}
.power-button.aiming {
  background: var(--power-color, #1a775a);
  color: #ffffff;
}
.power-button.aiming small {
  color: #ffffff;
}
.base-card[hidden] {
  display: none;
}
.base-card.selected {
  outline: 3px solid #efbb4e;
}

/* Upgrade kit: the plant's six evolutions, the next one ringed. */
.shop-path {
  display: block;
  width: 100%;
  max-width: 220px;
  height: auto;
  aspect-ratio: 300 / 64;
  margin: 2px auto 0;
}

/* Phones held sideways: the defense panel is exactly one screen tall. The
   cards share the height above the analysis button however many defenses
   there are, and scroll inside the panel only on the shortest screens, so the
   page itself never scrolls. */
@media (orientation: landscape) and (max-height: 560px) {
  body .defense-panel {
    box-sizing: border-box;
    height: calc(100dvh - 12px);
    grid-template-rows: minmax(0, 1fr);
    grid-auto-rows: auto;
    align-content: stretch;
    overflow: hidden;
  }
  body .defense-panel .defense-shop {
    min-height: 0;
    grid-auto-rows: minmax(60px, 1fr);
    overflow-y: auto;
    overscroll-behavior: contain;
  }
  body .defense-shop .defense-card,
  body .defense-shop .defense-card.selected {
    height: auto;
  }
  body .defense-shop .defense-card .defense-sprite {
    width: 26px;
    height: 26px;
  }
  body .defense-shop .defense-card {
    padding: 1px 2px;
    line-height: 1.1;
  }
  body .defense-card[data-arrives]::before {
    top: 2px;
    font-size: 8px;
    padding: 0 5px;
  }
}

#prize-entry-button {
  min-height: 44px;
}

#prize-dialog {
  box-sizing: border-box;
  width: min(460px, calc(100% - 30px));
  padding: 20px;
  margin: auto;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.prize-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.prize-header h2 {
  margin: 0;
  font-size: 24px;
}

.prize-header button {
  min-height: 44px;
}

.prize-note {
  margin: 10px 0 16px;
  color: #3f5f55;
  font-size: 13px;
  line-height: 1.4;
}

#score-form {
  display: grid;
  gap: 12px;
}

#score-form label {
  display: grid;
  gap: 4px;
  font-size: 13px;
  font-weight: 650;
}

#score-form input {
  box-sizing: border-box;
  min-width: 0;
  min-height: 44px;
  padding: 8px 10px;
  border: 1px solid #b9d6cb;
  border-radius: 10px;
  background: #fff;
  color: var(--ink);
  font: inherit;
  font-size: 16px;
}

#score-form .save-feedback {
  margin: 0;
}

#prize-dialog .save-button {
  display: flex;
  width: 100%;
  margin-top: 12px;
}

@media (max-width: 760px), (orientation: landscape) and (max-height: 560px) {
  #prize-dialog {
    position: fixed;
    inset: var(--prize-top, 0px) 0 auto;
    width: 100%;
    height: var(--prize-height, 100dvh);
    max-width: none;
    max-height: none;
    margin: 0;
    border: 0;
    border-radius: 0;
    padding: max(12px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right))
      max(12px, env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left));
  }

  #prize-dialog > * {
    max-width: 460px;
    margin-inline: auto;
  }
}

@media (orientation: landscape) and (max-height: 560px) {
  #prize-dialog[open] {
    display: grid;
    grid-template-columns: minmax(0, 460px) auto;
    grid-template-rows: auto minmax(0, 1fr);
    justify-content: center;
    gap: 8px;
    overflow: hidden;
  }

  #prize-dialog .prize-header {
    align-items: center;
    width: 100%;
  }

  .prize-header h2 {
    font-size: 20px;
  }

  #prize-dialog .save-button {
    grid-area: 1 / 2;
    align-self: center;
    width: auto;
    margin: 0;
    white-space: nowrap;
  }

  #prize-dialog .prize-body {
    grid-column: 1 / -1;
    width: 100%;
    max-width: none;
    overflow-y: auto;
    overscroll-behavior: contain;
    padding-bottom: 12px;
  }
}
