:root {
  color-scheme: light;
  font-family: "Trebuchet MS", "Verdana", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: linear-gradient(180deg, #daf1ff 0%, #cbe8ff 100%);
  color: #1b3654;
}

.app {
  max-width: 980px;
  margin: 0 auto;
  padding: 14px 16px 20px;
}

.hud {
  display: grid;
  grid-template-columns: auto minmax(260px, 420px) auto;
  align-items: center;
  gap: 12px;
  margin-bottom: 10px;
}

.hud-item {
  background: #ffffffd9;
  border: 2px solid #88bee5;
  border-radius: 12px;
  padding: 8px 12px;
  font-size: 1.1rem;
  font-weight: 700;
}

.timer-meter {
  height: 20px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.82);
  border: 2px solid #88bee5;
  box-shadow: inset 0 1px 5px rgba(24, 61, 93, 0.18);
  overflow: hidden;
}

.timer-fill {
  width: 100%;
  height: 100%;
  transform-origin: left center;
  background: linear-gradient(90deg, #7ad65f 0%, #f2cf57 62%, #f18a53 100%);
}

.game-shell {
  background: #ffffffcc;
  border: 2px solid #88bee5;
  border-radius: 16px;
  padding: 10px;
  position: relative;
  isolation: isolate;
}

.canvas-wrap {
  position: relative;
  line-height: 0; /* remove inline gap below canvas */
}

.typing-capture {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 1px;
  height: 1px;
  opacity: 0.01;
  border: 0;
  padding: 0;
  pointer-events: none;
}

#game-canvas {
  width: 100%;
  height: auto;
  border-radius: 10px;
  border: 2px solid #6aa6d4;
  display: block;
}

/* Garden strip overlaid on the bottom of the canvas */
.garden-overlay {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 105px;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  flex-wrap: nowrap;
  padding: 10px 16px 6px;
  gap: 8px;
  overflow: visible;
  pointer-events: all;
  border-radius: 0 0 10px 10px;
  z-index: 1;
  background:
    radial-gradient(120% 90% at 50% 115%, rgba(39, 116, 34, 0.35) 0%, rgba(39, 116, 34, 0) 72%),
    linear-gradient(180deg, rgba(129, 214, 103, 0.18) 0%, rgba(54, 141, 49, 0.22) 100%);
}

.garden-overlay::before,
.garden-overlay::after {
  content: "";
  position: absolute;
  bottom: 92px;
  width: 140px;
  height: 34px;
  border-radius: 80% 80% 0 0;
  background: linear-gradient(180deg, rgba(135, 224, 111, 0.9) 0%, rgba(67, 155, 61, 0.45) 100%);
  filter: blur(0.4px);
  pointer-events: none;
}

.garden-overlay::before {
  left: 7%;
  transform: rotate(-4deg);
}

.garden-overlay::after {
  right: 7%;
  transform: rotate(5deg);
}

.flower-btn {
  border: none;
  background: transparent;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 0;
  flex-shrink: 0;
  z-index: 1;
  align-self: flex-end;
  margin-bottom: 0;
}

.flower-btn img {
  width: 162px;
  height: 162px;
  object-fit: contain;
  transition: transform 0.12s ease;
  filter: drop-shadow(0 2px 4px rgba(0,0,0,0.35));
  background: transparent;
}

.bottom-actions {
  display: flex;
  justify-content: center;
  margin-top: 10px;
}

.flower-btn:focus-visible {
  outline: 3px solid #1f5f92;
  outline-offset: 2px;
  border-radius: 8px;
}

.flower-btn:hover img,
.flower-btn:focus-visible img {
  transform: translateY(-2px) scale(1.05);
}

.overlay {
  position: fixed;
  inset: 0;
  background: rgba(19, 43, 65, 0.55);
  display: grid;
  place-items: center;
  padding: 14px;
  z-index: 50;
}

.hidden {
  display: none;
}

.overlay-card {
  background: #ffffff;
  border: 3px solid #75b1dd;
  border-radius: 14px;
  width: min(760px, 100%);
  max-height: 90vh;
  overflow: auto;
  padding: 18px;
}

.overlay-card h2 {
  margin-top: 0;
}

.overlay-points {
  font-size: 1.1rem;
  font-weight: 700;
  margin-bottom: 10px;
}

.shop-items {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 10px;
  margin-bottom: 12px;
}

.shop-card {
  border: 2px solid #8bc2e7;
  border-radius: 10px;
  padding: 8px;
  text-align: center;
  background: #f4fbff;
}

.shop-card img {
  width: 80px;
  height: 80px;
  object-fit: contain;
}

.primary-btn,
.buy-btn,
.close-btn {
  font-size: 1rem;
  font-weight: 700;
  border-radius: 8px;
  border: 2px solid #2f79b1;
  cursor: pointer;
}

.primary-btn,
.buy-btn {
  background: #e3f4ff;
  color: #13456c;
  padding: 8px 12px;
}

.primary-btn:focus-visible,
.buy-btn:focus-visible,
.close-btn:focus-visible {
  outline: 3px solid #13456c;
  outline-offset: 2px;
}

.buy-btn[disabled] {
  opacity: 0.55;
  cursor: default;
}

.flower-info-card {
  position: relative;
}

.close-btn {
  position: absolute;
  right: 10px;
  top: 10px;
  width: 34px;
  height: 34px;
  background: #ffffff;
  color: #164468;
}

.flower-info-image {
  width: 130px;
  height: 130px;
  object-fit: contain;
  display: block;
  margin-bottom: 10px;
}

.flower-info-map {
  width: 100%;
  max-width: 560px;
  border: 2px solid #7fb8de;
  border-radius: 10px;
}

.flower-map-wrap {
  position: relative;
  width: 100%;
  max-width: 560px;
}

.flower-map-wrap .flower-info-map {
  max-width: 100%;
  display: block;
}

.map-circle-layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.map-circle {
  position: absolute;
  transform: translate(-50%, -50%);
  border: 3px solid #ff5f45;
  border-radius: 999px;
  background: rgba(255, 130, 84, 0.14);
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.75);
}

@media (max-width: 760px) {
  .hud {
    grid-template-columns: 1fr;
  }
}
