:root {
  font-family: Inter, 'Segoe UI', 'Microsoft YaHei', sans-serif;
  color: #203d31;
  background: #f1eedf;
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
  background:
    radial-gradient(circle at 10% 8%, #f9f6e9 0, transparent 40%), #f1eedf;
}
button,
a {
  font: inherit;
}
button {
  cursor: pointer;
}
button:focus-visible,
a:focus-visible,
canvas:focus-visible {
  outline: 3px solid #dcaa37;
  outline-offset: 3px;
}
.app-shell {
  max-width: 1240px;
  margin: auto;
  padding: 0 4%;
}
.masthead {
  height: 82px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid #d9ddce;
}
.brand {
  display: flex;
  align-items: center;
  gap: 13px;
}
.brand-symbol {
  width: 45px;
  height: 45px;
  display: grid;
  place-items: center;
  border-radius: 15px;
  background: #d8e6c5;
  color: #4c7649;
  font-size: 31px;
}
.overline,
.eyebrow {
  font-size: 10px;
  letter-spacing: 1.9px;
  font-weight: 700;
  color: #7d9270;
}
.brand h1 {
  font-size: 23px;
  letter-spacing: 2px;
  margin: 4px 0 0;
}
.masthead-right {
  display: flex;
  align-items: center;
  gap: 24px;
  font-size: 12px;
}
.offline {
  display: flex;
  align-items: center;
  gap: 8px;
  color: #6c8a63;
}
.offline i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #77ab56;
  box-shadow: 0 0 0 4px #e4eccc;
}
.back {
  color: #466d54;
  text-decoration: none;
}
.intro {
  height: 150px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 10px;
}
.intro h2 {
  font-size: clamp(30px, 3.7vw, 50px);
  line-height: 1.25;
  margin: 9px 0 9px;
  letter-spacing: 1px;
}
.intro h2 em {
  font-style: normal;
  color: #84a463;
}
.intro p:last-child {
  font-size: 13px;
  color: #7c8c77;
}
.roundel {
  width: 130px;
  height: 130px;
  border: 1px solid #d8dcc7;
  border-radius: 50%;
  display: flex;
  align-items: center;
  flex-direction: column;
  justify-content: center;
  transform: rotate(12deg);
  background: #f8f5e6;
}
.roundel > span {
  font-size: 50px;
  color: #edbd50;
  line-height: 1;
}
.roundel small {
  font-size: 10px;
  color: #829270;
}
.game-frame {
  background: #fffdf4;
  border: 1px solid #dfe3d2;
  border-radius: 22px;
  padding: 14px;
  box-shadow: 0 24px 65px #33472813;
}
.hud {
  display: flex;
  align-items: center;
  gap: 18px;
  margin-bottom: 10px;
}
.sun-meter {
  min-width: 145px;
  display: flex;
  align-items: center;
  gap: 10px;
  background: #fff3ca;
  border: 1px solid #f2dda0;
  border-radius: 13px;
  padding: 9px 15px;
}
.sun-meter > span {
  font-size: 31px;
  color: #e4aa2d;
}
.sun-meter small,
.wave-meter small {
  display: block;
  color: #8b957f;
  font-size: 10px;
}
.sun-meter strong {
  display: block;
  color: #89601e;
  font-size: 21px;
  font-variant-numeric: tabular-nums;
  line-height: 1;
}
.wave-meter {
  min-width: 180px;
}
.wave-meter strong {
  display: block;
  font-size: 14px;
  margin: 3px 0 7px;
}
.wave-track {
  height: 5px;
  background: #e6eadd;
  border-radius: 8px;
  overflow: hidden;
}
.wave-track span {
  display: block;
  background: #84af62;
  height: 100%;
  width: 0;
  transition: width 0.3s;
}
.hud-actions {
  display: flex;
  gap: 7px;
  margin-left: auto;
}
.hud-actions button {
  background: #f7f8ef;
  border: 1px solid #dce2d3;
  border-radius: 9px;
  color: #3e6247;
  padding: 10px 13px;
  font-size: 12px;
}
.hud-actions button:hover,
.shovel-card:hover {
  background: #ecf1e2;
}
.deck {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  scrollbar-color: #c9d3be transparent;
  margin-bottom: 10px;
  padding: 1px 1px 7px;
  scroll-snap-type: x proximity;
}
.plant-card,
.shovel-card {
  position: relative;
  overflow: hidden;
  flex: 0 0 142px;
  min-height: 68px;
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 7px;
  scroll-snap-align: start;
  background: #f8f9ef;
  border: 1px solid #dae3cc;
  border-radius: 12px;
  text-align: left;
  color: #34523b;
  transition:
    transform 0.15s,
    background 0.15s;
}
.plant-card:hover:not(:disabled) {
  transform: translateY(-2px);
  background: #f0f6e4;
}
.plant-card.selected,
.shovel-card.selected {
  border-color: #6b9a55;
  box-shadow: inset 0 0 0 1px #6b9a55;
  background: #eaf4dc;
}
.plant-card.disabled {
  opacity: 0.54;
}
.plant-card strong,
.shovel-card strong {
  display: block;
  font-size: 12px;
  white-space: nowrap;
}
.plant-card small,
.shovel-card small {
  display: block;
  font-size: 9px;
  color: #889783;
  margin: 4px 0;
}
.plant-card b {
  font-size: 10px;
  color: #a67a2a;
}
.plant-icon {
  flex: none;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 29px;
  line-height: 1;
}
.plant-icon.shooter {
  color: #468e4d;
  background: #dcedcc;
}
.plant-icon.sunflower {
  color: #e1ad35;
  background: #fff0c3;
}
.plant-icon.wall {
  color: #a97a4f;
  background: #eedcc8;
}
.plant-icon.bomb {
  color: #d86b68;
  background: #fbe1d8;
}
.plant-icon.ice {
  color: #5a9fc1;
  background: #dff1f6;
}
.plant-icon.spike {
  color: #a57955;
  background: #eee0c7;
}
.plant-icon.twin {
  color: #589963;
  background: #dcefd3;
}
.shovel-card {
  flex-basis: 93px;
  flex-direction: column;
  justify-content: center;
  gap: 0;
  text-align: center;
}
.shovel-card > span {
  font-size: 27px;
  line-height: 1;
  color: #8b6e46;
}
.cooldown {
  position: absolute;
  left: 0;
  bottom: 0;
  height: 4px;
  width: 0;
  background: #bfcead;
  transition: width 0.1s;
}
.board-scroller {
  overflow-x: auto;
  scrollbar-color: #c9d3be transparent;
}
.board-wrap {
  position: relative;
  width: 92%;
  max-width: 1040px;
  min-width: 650px;
  margin-inline: auto;
  border-radius: 15px;
  overflow: hidden;
  background: #86ae66;
}
.board-wrap canvas {
  display: block;
  width: 100%;
  height: auto;
  touch-action: manipulation;
  cursor: crosshair;
}
.settings-panel {
  margin: 0 0 10px;
  border: 1px solid #dce4d2;
  border-radius: 12px;
  background: #f7f9ef;
  color: #365b43;
}
.settings-panel summary {
  min-height: 38px;
  padding: 8px 12px;
  cursor: pointer;
  font-size: 12px;
  font-weight: 700;
}
.settings-panel summary span {
  color: #879982;
  font-size: 10px;
  font-weight: 400;
  margin-left: 8px;
}
.settings-panel[open] summary {
  border-bottom: 1px solid #e3e9d9;
}
.settings-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  padding: 12px;
}
.setting-group {
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
}
.setting-group legend {
  padding: 0 0 7px;
  font-size: 11px;
  font-weight: 700;
}
.setting-options {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}
.setting-options button {
  min-height: 37px;
  min-width: 46px;
  padding: 5px 8px;
  border: 1px solid #d8e3cc;
  border-radius: 8px;
  background: #fffef9;
  color: #3e6247;
  font-size: 11px;
}
.setting-options button[aria-pressed='true'] {
  border-color: #659953;
  background: #dfeeca;
  color: #285535;
  font-weight: 700;
}
.settings-help {
  margin: 0;
  padding: 0 12px 12px;
  color: #788d75;
  font-size: 10px;
}
.result {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: #133225cf;
  color: #fff;
  text-align: center;
  backdrop-filter: blur(4px);
}
.result[hidden] {
  display: none;
}
.result > span {
  font-size: 58px;
  color: #e9c75b;
}
.result h2 {
  font-size: 35px;
  margin: 10px 0;
}
.result p {
  font-size: 14px;
  color: #e2eddc;
}
.result button {
  border: 0;
  border-radius: 11px;
  background: #f2c967;
  color: #264131;
  padding: 13px 26px;
  font-weight: 700;
  margin-top: 16px;
}
.game-bottom {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  padding: 16px 3px 3px;
  font-size: 11px;
  color: #7a8b76;
}
.status {
  display: flex;
  gap: 9px;
  align-items: center;
}
.status-dot {
  width: 7px;
  height: 7px;
  background: #8ab265;
  border-radius: 50%;
}
.controls-hint kbd {
  display: inline-block;
  background: #edf2e6;
  border: 1px solid #d8e1d0;
  border-radius: 4px;
  padding: 3px 5px;
  font-family: inherit;
}
.below {
  display: flex;
  justify-content: space-between;
  padding: 23px 4px;
  font-size: 10px;
  color: #8b9983;
}
@media (max-width: 900px) {
  .app-shell {
    padding: 0 2.5%;
  }
  .intro {
    height: 132px;
  }
  .roundel {
    width: 95px;
    height: 95px;
  }
  .roundel > span {
    font-size: 36px;
  }
  .roundel small {
    font-size: 8px;
  }
  .settings-grid {
    grid-template-columns: 1fr;
    gap: 9px;
  }
  .plant-card {
    padding: 6px;
    gap: 4px;
  }
  .plant-icon {
    width: 32px;
    height: 32px;
    font-size: 22px;
  }
  .plant-card strong {
    font-size: 10px;
  }
  .plant-card small {
    font-size: 8px;
  }
  .game-frame {
    padding: 11px;
  }
}
@media (max-width: 650px) {
  .masthead {
    height: 80px;
  }
  .brand-symbol {
    width: 38px;
    height: 38px;
    font-size: 26px;
  }
  .brand h1 {
    font-size: 19px;
  }
  .overline {
    font-size: 8px;
    letter-spacing: 1px;
  }
  .offline,
  .roundel {
    display: none;
  }
  .intro {
    height: 118px;
    padding: 0 5px;
  }
  .intro h2 {
    font-size: 27px;
  }
  .intro p:last-child {
    font-size: 11px;
  }
  .hud {
    flex-wrap: wrap;
    gap: 8px;
  }
  .sun-meter {
    min-width: 110px;
    padding: 6px 9px;
  }
  .sun-meter > span {
    font-size: 24px;
  }
  .sun-meter strong {
    font-size: 17px;
  }
  .wave-meter {
    min-width: 115px;
    flex: 1;
  }
  .hud-actions {
    width: 100%;
    justify-content: flex-end;
  }
  .hud-actions button {
    padding: 6px 10px;
  }
  .deck {
    padding-bottom: 6px;
  }
  .plant-card {
    flex-basis: 125px;
  }
  .plant-icon {
    width: 35px;
    height: 35px;
  }
  .shovel-card {
    flex-basis: 78px;
  }
  .controls-hint {
    display: none;
  }
  .game-bottom {
    padding: 11px 1px 2px;
  }
  .below {
    line-height: 1.6;
    gap: 14px;
  }
  .below span:last-child {
    max-width: 135px;
    text-align: right;
  }
}
@media (prefers-reduced-motion: reduce) {
  * {
    transition: none !important;
  }
}
