:root {
  color-scheme: light;
  --sky: #8ecfff;
  --sky-deep: #5eb4f0;
  --grass: #7ecf6a;
  --grass-deep: #4ea24a;
  --lemon: #ffe36a;
  --coral: #ff7a6e;
  --paper: #fff8ee;
  --ink: #2a3a28;
  --muted: #5e7460;
  --line: #d7e8c8;
  --white: #ffffff;
  --shadow: rgba(42, 58, 40, 0.16);
  --font: "Hiragino Maru Gothic ProN", "Hiragino Sans", "Yu Gothic", "Helvetica Neue", sans-serif;
}

* { box-sizing: border-box; }

html {
  overflow-x: clip;
  overflow-y: scroll;
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  font-family: var(--font);
  background:
    radial-gradient(circle at 12% -4%, rgba(255, 227, 106, 0.55), transparent 22rem),
    radial-gradient(circle at 92% 8%, rgba(255, 122, 110, 0.22), transparent 20rem),
    linear-gradient(180deg, #c9ebff 0%, #e7f8d8 42%, var(--paper) 100%);
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: 0.12;
  background-image: radial-gradient(#2a3a28 0.7px, transparent 0.8px);
  background-size: 5px 5px;
}

a { color: inherit; }
button { font: inherit; color: inherit; }

a:focus-visible,
button:focus-visible,
canvas:focus-visible {
  outline: 3px solid var(--lemon);
  outline-offset: 3px;
  box-shadow: 0 0 0 6px var(--coral);
}

.site-header,
main {
  width: min(94vw, 1080px);
  margin-inline: auto;
}

.site-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  min-height: 44px;
}

.site-header a {
  color: #2f6d3a;
  font-weight: 800;
  text-decoration: none;
}

.site-header p {
  margin: 0;
  color: var(--muted);
  font: 700 0.72rem/1 "Trebuchet MS", sans-serif;
  letter-spacing: 0.08em;
}

main {
  display: grid;
  gap: 14px;
  padding-bottom: 72px;
}

.intro {
  display: grid;
  gap: 4px;
}

.eyebrow {
  margin: 0;
  color: #d4554a;
  font: 800 0.7rem/1 "Trebuchet MS", sans-serif;
  letter-spacing: 0.14em;
}

.intro h1 {
  margin: 0;
  font-size: clamp(1.7rem, 4vw, 2.6rem);
  line-height: 0.95;
  letter-spacing: 0.02em;
}

.intro h1 span {
  color: #2f8d3e;
}

.intro p {
  margin: 0;
  max-width: 36rem;
  color: var(--muted);
}

.game-panel {
  display: grid;
  gap: 12px;
}

.stage {
  position: relative;
  min-height: 240px;
  border-radius: 28px;
  overflow: hidden;
  box-shadow: 0 16px 0 rgba(42, 58, 40, 0.08), 0 18px 40px var(--shadow);
}

#garden {
  display: block;
  width: 100%;
  height: min(52vh, 420px);
  touch-action: none;
  background: transparent;
  cursor: pointer;
}

.hint {
  position: absolute;
  left: 50%;
  top: 46%;
  z-index: 2;
  margin: 0;
  padding: 6px 10px;
  transform: translate(-50%, -120%);
  border-radius: 999px;
  background: var(--white);
  color: #c44;
  font-weight: 800;
  font-size: 0.82rem;
  box-shadow: 0 6px 0 rgba(42, 58, 40, 0.08);
  pointer-events: none;
}

.stamps {
  position: absolute;
  inset: 12px 12px auto;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  pointer-events: none;
}

.stamp {
  padding: 4px 10px;
  border-radius: 999px;
  background: #fff7d2;
  color: #7a4a10;
  font-weight: 800;
  font-size: 0.78rem;
  box-shadow: 0 3px 0 rgba(122, 74, 16, 0.16);
  animation: pop 0.45s ease;
}

.toast {
  position: absolute;
  left: 50%;
  bottom: 12px;
  z-index: 3;
  margin: 0;
  padding: 6px 12px;
  transform: translateX(-50%);
  border-radius: 999px;
  background: rgba(42, 58, 40, 0.86);
  color: #fff;
  font-size: 0.8rem;
  font-weight: 700;
}

.dock {
  display: grid;
  gap: 8px;
  padding: 10px;
  border-radius: 24px;
  background: rgba(255, 248, 238, 0.86);
  box-shadow: 0 10px 0 rgba(42, 58, 40, 0.06);
}

.stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
}

.stats p,
.live {
  margin: 0;
}

.stats span,
.book-lead,
.save-note,
.key-hint {
  color: var(--muted);
}

.stats p {
  display: grid;
  gap: 2px;
  padding: 6px 8px;
  border-radius: 14px;
  background: var(--white);
}

.stats span {
  font-size: 0.68rem;
  font-weight: 700;
}

.stats strong {
  font-size: 1.05rem;
}

.tools {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
}

.tool,
.ghost,
.sky-btn,
.postcard-btn,
.share-x,
.reset {
  border: 0;
  border-radius: 16px;
  cursor: pointer;
}

.tool {
  display: grid;
  justify-items: center;
  gap: 2px;
  padding: 8px 4px 7px;
  background: var(--white);
  font-weight: 800;
  font-size: 0.78rem;
  box-shadow: 0 4px 0 var(--line);
}

.tool[aria-pressed="true"] {
  background: var(--lemon);
  box-shadow: 0 4px 0 #e2c24a;
}

.tool-icon {
  width: 34px;
  height: 28px;
  position: relative;
}

.i-flower,
.i-tree,
.i-pond,
.i-bench,
.i-lamp,
.i-stall {
  position: absolute;
  inset: 0;
  margin: auto;
}

.i-flower {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--coral);
  box-shadow: 10px 4px 0 #ffb4ae, -8px 6px 0 var(--lemon);
}

.i-tree {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--grass-deep);
  box-shadow: 0 10px 0 -6px #8a5a32;
}

.i-pond {
  width: 22px;
  height: 12px;
  border-radius: 50%;
  background: #6ec8e8;
}

.i-bench {
  width: 22px;
  height: 8px;
  border-radius: 3px;
  background: #c9844a;
  box-shadow: -8px 8px 0 -3px #c9844a, 8px 8px 0 -3px #c9844a;
}

.i-lamp {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--lemon);
  box-shadow: 0 12px 0 -4px #8a5a32;
}

.i-stall {
  width: 22px;
  height: 10px;
  background: repeating-linear-gradient(90deg, var(--coral) 0 6px, var(--white) 6px 12px);
  box-shadow: 0 10px 0 -4px #f3d2a4;
}

.edit-row,
.sky-row,
.modal-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.ghost,
.sky-btn,
.reset {
  flex: 1;
  min-height: 40px;
  background: var(--white);
  font-weight: 800;
}

.ghost:disabled {
  opacity: 0.45;
}

.ghost.danger {
  color: #c44;
}

.sky-btn[aria-pressed="true"] {
  background: #bfe8ff;
}

.postcard-btn,
.share-x {
  min-height: 44px;
  background: var(--coral);
  color: #fff;
  font-weight: 800;
  box-shadow: 0 4px 0 #d4554a;
}

.share-x {
  background: #111;
  box-shadow: 0 4px 0 #000;
}

.live {
  min-height: 1.4em;
  font-size: 0.82rem;
  color: #2f6d3a;
  font-weight: 700;
}

.book,
.help {
  display: grid;
  gap: 8px;
  padding: 16px;
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.72);
}

.book h2,
.help h2,
.modal-card h2 {
  margin: 0;
  font-size: 1.15rem;
}

.book-lead,
.save-note,
.key-hint {
  margin: 0;
  font-size: 0.86rem;
}

.finds {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.finds li {
  display: grid;
  grid-template-columns: 36px 1fr;
  gap: 8px;
  align-items: center;
  padding: 8px;
  border-radius: 16px;
  background: var(--white);
}

.find-mark {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-weight: 800;
  background: #d9e7d4;
  color: #7a8f76;
}

.finds li.is-open .find-mark {
  background: var(--lemon);
  color: #7a4a10;
}

.finds li.is-open strong {
  color: var(--ink);
}

.finds li:not(.is-open) strong,
.finds li:not(.is-open) span {
  color: #9aa898;
}

.finds strong,
.finds span {
  display: block;
}

.finds span {
  font-size: 0.75rem;
}

.help ol {
  margin: 0;
  padding: 0;
  display: grid;
  gap: 8px;
}

.help li {
  display: grid;
  grid-template-columns: 28px 1fr;
  gap: 8px;
  align-items: start;
  list-style: none;
}

.help li span {
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--lemon);
  font-weight: 800;
}

kbd {
  display: inline-block;
  padding: 0 5px;
  border-radius: 6px;
  background: #fff;
  box-shadow: 0 2px 0 var(--line);
  font-size: 0.78em;
}

.reset {
  justify-self: start;
  padding: 8px 14px;
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 16px;
  background: rgba(42, 58, 40, 0.42);
}

.modal[hidden] { display: none; }

.modal-card {
  width: min(92vw, 640px);
  display: grid;
  gap: 10px;
  padding: 16px;
  border-radius: 24px;
  background: var(--paper);
}

#card-canvas {
  width: 100%;
  height: auto;
  border-radius: 16px;
  background: #fff;
}

.modal-meta {
  margin: 0;
  font-weight: 700;
}

html[data-capture] [data-account] { display: none; }

@media (min-width: 880px) {
  .intro {
    grid-template-columns: auto 1fr;
    align-items: end;
    column-gap: 18px;
  }

  .intro h1 { grid-row: 1 / span 2; }

  .game-panel {
    grid-template-columns: minmax(0, 1fr) 250px;
    align-items: start;
  }

  .stage { min-height: 420px; }

  #garden { height: min(62vh, 460px); }

  .finds { grid-template-columns: repeat(4, 1fr); }
}

@media (max-width: 430px) {
  .intro h1 { font-size: 1.55rem; }
  #garden { height: 250px; }
  .tool { font-size: 0.72rem; padding: 6px 2px; }
  .live { font-size: 0.75rem; }
}

@media (max-height: 760px) and (min-width: 880px) {
  .site-header { min-height: 36px; }
  .intro { gap: 0; }
  .intro h1 { font-size: 1.7rem; }
  #garden { height: min(58vh, 390px); }
  .dock { gap: 6px; padding: 8px; }
}

@media (prefers-reduced-motion: reduce) {
  .stamp,
  .hint {
    animation: none;
  }
}

@keyframes pop {
  from { transform: scale(0.6); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}
