/* ORCHARD — sunny picnic. Field #fff7d6, ink #2a2118. */
:root {
  --field: #fff7d6;
  --leaf: #3d8f4a;
  --apple: #e23b3b;
  --grape: #7a3ea8;
  --pear: #c6d94e;
  --pear-leaf: #3d8f4a;
  --citrus: #f0a202;
  --cream: #f0d9a8;
  --ink: #2a2118;
  --kraft: #c9a36a;
  --kraft-dark: #a67c3d;
  --paper: #fff4dc;
  --stamp: #c23b32;
  --shadow: #cbb98a;
  --font-display: "Instrument Sans", "Segoe UI", sans-serif;
  --font-body: "Manrope", "Segoe UI", sans-serif;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 18px;
  --radius-xl: 28px;
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 24px;
  --tile: clamp(48px, 15vw, 64px);
  --gap: 6px;
  --cols: 5;
  --rows: 6;
  --motion-quick: 150ms;
  --motion-fast: 250ms;
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  overflow-x: hidden;
  background: var(--field);
  color: var(--ink);
  font-family: var(--font-body);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  min-height: 100dvh;
  background:
    radial-gradient(ellipse 80% 40% at 50% 100%, #e7f0c4 0%, transparent 70%),
    repeating-linear-gradient(
      -12deg,
      transparent 0 18px,
      rgb(61 143 74 / 0.05) 18px 19px
    ),
    var(--field);
}

button {
  font-family: inherit;
  color: inherit;
}

button:not(:disabled),
[role="button"]:not(:disabled) {
  cursor: pointer;
}

.tabular {
  font-variant-numeric: tabular-nums;
}

.game-root {
  min-height: 100dvh;
  min-height: 100svh;
  display: flex;
  flex-direction: column;
}

.shell {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: max(12px, env(safe-area-inset-top)) 16px max(16px, env(safe-area-inset-bottom));
  max-width: 430px;
  margin: 0 auto;
  width: 100%;
}

.troop-mark {
  position: absolute;
  top: max(10px, env(safe-area-inset-top));
  left: 14px;
  font-family: var(--font-display);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.18em;
  color: var(--leaf);
}

.title-shell {
  position: relative;
  align-items: center;
  justify-content: space-between;
  min-height: 100dvh;
}

.title-block {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 12px;
  padding-top: 48px;
}

.wordmark {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(2.6rem, 12vw, 3.6rem);
  letter-spacing: 0.12em;
  line-height: 1.05;
  text-wrap: balance;
  color: var(--ink);
}

.tagline {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 500;
  line-height: 1.45;
  color: var(--ink);
  text-wrap: pretty;
}

.best {
  margin: 4px 0 0;
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--leaf);
}

.btn-play {
  margin-top: 12px;
  min-height: 48px;
  min-width: 168px;
  padding: 12px 28px;
  border: 3px solid var(--ink);
  border-radius: 999px;
  background: var(--leaf);
  color: #fff7d6;
  font-family: var(--font-display);
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  box-shadow: 0 4px 0 var(--ink);
  transition: transform var(--motion-quick) var(--ease-out), box-shadow var(--motion-quick) var(--ease-out);
}

.btn-play:hover {
  filter: brightness(1.05);
}

.btn-play:active {
  transform: scale(0.96) translateY(3px);
  box-shadow: 0 1px 0 var(--ink);
}

.shelf-row {
  display: flex;
  gap: 10px;
  align-items: flex-end;
  justify-content: center;
  min-height: 72px;
  width: 100%;
  padding: 12px 8px 8px;
  border-top: 6px solid #c4a574;
  background: linear-gradient(#e8c48a, #d2a86a);
  border-radius: 8px 8px 0 0;
  box-shadow: inset 0 2px 0 #f3d7a8;
}

.shelf-row.is-quiet {
  opacity: 0.95;
}

.shelf-empty {
  font-size: 0.8rem;
  color: var(--ink);
  opacity: 0.55;
  padding-bottom: 8px;
}

.shelf-item {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  background: var(--paper);
  border: 2px solid var(--ink);
  border-radius: 10px;
}

.mark-ribbon {
  width: 22px;
  height: 28px;
  background: var(--apple);
  border: 2px solid var(--ink);
  clip-path: polygon(0 0, 100% 0, 100% 100%, 50% 78%, 0 100%);
}

.mark-card {
  font-size: 8px;
  font-weight: 800;
  letter-spacing: 0.04em;
  color: var(--stamp);
  border: 2px solid var(--stamp);
  padding: 4px 3px;
  transform: rotate(-8deg);
}

.mark-cloth {
  width: 28px;
  height: 20px;
  background:
    repeating-conic-gradient(#fff 0% 25%, #d95454 0% 50%) 0 0 / 8px 8px;
  border: 2px solid var(--ink);
}

.mark-crate {
  width: 26px;
  height: 20px;
  background: #d9853a;
  border: 2px solid var(--ink);
  box-shadow: inset 0 -6px 0 #c36c24;
}

.play-shell {
  position: relative;
  gap: 8px;
  padding-bottom: 72px;
}

.play-shell.has-gingham .orchard-board {
  background:
    repeating-conic-gradient(#fff7d6 0% 25%, #f3c7c7 0% 50%) 0 0 / 18px 18px;
}

.play-top {
  display: grid;
  grid-template-columns: 1fr auto;
  grid-template-rows: auto auto auto;
  gap: 4px 8px;
  align-items: center;
  padding-top: 4px;
}

.play-top .troop-mark {
  position: static;
  grid-column: 1;
}

.chrome-sentence {
  grid-column: 1 / -1;
  margin: 2px 0 0;
  font-size: 0.98rem;
  font-weight: 600;
  line-height: 1.4;
  text-wrap: pretty;
}

.score-chip {
  grid-column: 1;
  justify-self: start;
  font-weight: 700;
  font-size: 0.92rem;
  padding: 4px 10px;
  background: var(--cream);
  border: 2px solid var(--ink);
  border-radius: 999px;
}

.score-row {
  grid-column: 1;
  justify-self: start;
  display: flex;
  align-items: center;
  gap: 8px;
}

.clock-chip {
  font-weight: 600;
  font-size: 0.85rem;
  padding: 4px 8px;
  color: var(--ink);
  opacity: 0.72;
}

.btn-sheet,
.btn-sheet-link {
  min-height: 44px;
  padding: 8px 16px;
  background: transparent;
  border: 0;
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--leaf);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.btn-sheet-link {
  flex: 1 1 100%;
  background: transparent;
  box-shadow: none;
  border: 0;
  color: var(--ink);
  min-height: 40px;
}

.stamp-time {
  flex: 1 1 100%;
  margin: 0;
  text-align: center;
  font-weight: 700;
  font-size: 0.95rem;
}

.stamp-bar {
  flex-wrap: wrap;
}

.sheet-card {
  position: absolute;
  left: 16px;
  right: 16px;
  top: 20%;
  background: var(--paper);
  border: 3px solid var(--ink);
  border-radius: 18px;
  padding: 14px;
  box-shadow: 0 6px 0 var(--ink);
  z-index: 50;
}

.sheet-card h2 {
  margin: 0 0 8px;
  font-family: var(--font-display);
  font-size: 1.15rem;
}

.sheet-rows {
  list-style: none;
  margin: 0;
  padding: 0;
  max-height: 40vh;
  overflow: auto;
}

.sheet-rows li {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 8px;
  min-height: 44px;
  align-items: center;
  border-bottom: 1px solid var(--shadow);
  font-size: 0.9rem;
  font-weight: 600;
}

.sheet-foot,
.sheet-note {
  margin: 8px 0 0;
  font-size: 0.85rem;
}

.sheet-note {
  opacity: 0.75;
}

.sheet-card button {
  margin-top: 10px;
  width: 100%;
  min-height: 44px;
  border: 2px solid var(--ink);
  border-radius: 14px;
  background: var(--paper);
  font-weight: 700;
  box-shadow: 0 3px 0 var(--ink);
}

.btn-later {
  justify-self: end;
  min-height: 44px;
  padding: 0 10px;
  background: transparent;
  border: 0;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--ink);
  opacity: 0.7;
}

.ticket-strip {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 72px 64px;
  gap: 8px;
  align-items: stretch;
}

.slip {
  position: relative;
  background: var(--kraft);
  border: 2px solid var(--ink);
  border-radius: 4px 12px 10px 4px;
  padding: 8px 10px;
  box-shadow: 2px 3px 0 var(--shadow);
  min-height: 52px;
}

.slip-line {
  display: flex;
  align-items: center;
  gap: 8px;
}

.slip-text {
  margin: 0;
  font-size: 0.92rem;
  font-weight: 700;
  line-height: 1.3;
  text-wrap: pretty;
}

.slip-fruit {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0;
}

.slip-fruit .sil,
.slip-fruit .fruit-svg {
  width: 28px;
  height: 28px;
}

.slip-n {
  font-size: 0.75rem;
  font-weight: 700;
}

.slip.is-stamped {
  filter: saturate(0.85);
}

.done-stamp {
  position: absolute;
  right: 8px;
  top: 10px;
  border: 3px solid var(--stamp);
  color: var(--stamp);
  font-family: var(--font-display);
  font-weight: 800;
  letter-spacing: 0.08em;
  font-size: 0.82rem;
  padding: 3px 8px;
  transform: rotate(-12deg);
  background: rgb(255 247 214 / 0.4);
}

.crate {
  position: relative;
  background: var(--cream);
  border: 2px solid var(--ink);
  border-radius: 8px;
  min-height: 64px;
  overflow: hidden;
}

.crate.is-painted {
  background: #e28b3a;
}

.crate-slats {
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(
    180deg,
    transparent 0 10px,
    rgb(42 33 24 / 0.18) 10px 12px
  );
}

.crate-fruit {
  position: relative;
  z-index: 1;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  padding: 6px 4px;
  gap: 0;
}

.crate-fruit .sil,
.crate-fruit .fruit-svg {
  width: 22px;
  height: 22px;
}

.crate.has-ribbon .ribbon {
  position: absolute;
  left: 50%;
  top: -2px;
  width: 18px;
  height: 70%;
  transform: translateX(-50%);
  background: var(--apple);
  border: 2px solid var(--ink);
  border-radius: 0 0 4px 4px;
  z-index: 2;
}

.crate.has-ribbon .ribbon::after {
  content: "";
  position: absolute;
  left: -8px;
  bottom: -10px;
  width: 0;
  height: 0;
  border-left: 12px solid transparent;
  border-right: 12px solid transparent;
  border-top: 12px solid var(--apple);
  filter: drop-shadow(0 1px 0 var(--ink));
}

.jam-pip {
  position: absolute;
  right: 4px;
  bottom: 4px;
  z-index: 3;
  min-width: 16px;
  height: 16px;
  padding: 0 3px;
  background: #7a3ea8;
  color: #fff7d6;
  border: 2px solid var(--ink);
  border-radius: 999px;
  font-size: 9px;
  font-weight: 800;
  display: grid;
  place-items: center;
}

.bowl-wrap {
  position: relative;
}

.bowl {
  height: 100%;
  min-height: 64px;
  border: 2px solid var(--ink);
  border-radius: 50% 50% 46% 46%;
  background: radial-gradient(circle at 50% 30%, #fff, #efe0c0 55%, #e2c896);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  padding: 6px 4px 10px;
}

.bowl .sil,
.bowl .fruit-svg {
  width: 20px;
  height: 20px;
}

.leaf-shrug {
  position: absolute;
  right: -6px;
  top: -8px;
  opacity: 0;
  transform-origin: 20% 80%;
  pointer-events: none;
}

.leaf-shrug.is-on {
  opacity: 1;
  animation: shrug 500ms var(--ease-out);
}

@keyframes shrug {
  0%,
  100% {
    transform: rotate(0deg);
  }
  35% {
    transform: rotate(-22deg);
  }
  65% {
    transform: rotate(16deg);
  }
}

.orchard-board {
  position: relative;
  width: min(100%, calc(var(--tile) * 5 + var(--gap) * 4 + 28px));
  height: calc(var(--tile) * 4.5 + 40px);
  margin: 4px auto 0;
  border-radius: var(--radius-lg);
  background: rgb(61 143 74 / 0.12);
  padding: 16px 8px 10px;
  overflow: visible;
}

.orchard-board.is-dim {
  opacity: 0.42;
  filter: grayscale(0.15);
  pointer-events: none;
}

.tile {
  position: absolute;
  left: calc(8px + var(--col) * (var(--tile) + var(--gap)));
  top: calc(16px + var(--row) * (var(--tile) * 0.70));
  z-index: calc(var(--z) * 20 + var(--row) * 2 + 1);
  width: var(--tile);
  height: var(--tile);
  min-width: 48px;
  min-height: 48px;
  padding: 4px;
  border: 3px solid var(--ink);
  border-radius: 14px;
  background: var(--cream);
  box-shadow: 3px 4px 0 var(--ink);
  display: grid;
  place-items: center;
  transition:
    transform var(--motion-quick) var(--ease-out),
    box-shadow var(--motion-quick) var(--ease-out),
    filter var(--motion-fast) var(--ease-out);
}

.tile[data-z="1"] {
  transform: translate(8px, -10px);
  box-shadow: 3px 4px 0 var(--ink), 6px 8px 0 var(--ink);
}

.tile[data-z="2"] {
  transform: translate(10px, -16px);
  box-shadow: 3px 4px 0 var(--ink), 6px 8px 0 var(--ink), 9px 12px 0 var(--ink);
}

.tile.is-dim {
  filter: brightness(0.72) saturate(0.8);
}

.tile.is-lidded::after {
  content: "";
  position: absolute;
  right: 5px;
  bottom: 5px;
  width: 10px;
  height: 8px;
  border-right: 2px solid var(--ink);
  border-bottom: 2px solid var(--ink);
  border-radius: 0 0 4px 0;
  opacity: 0.75;
  pointer-events: none;
}

.layer-pip {
  position: absolute;
  top: 3px;
  left: 4px;
  display: flex;
  gap: 2px;
  align-items: center;
  background: var(--kraft);
  border: 1.5px solid var(--ink);
  border-radius: 4px;
  padding: 2px 3px;
  pointer-events: none;
  z-index: 2;
}

.layer-pip i {
  width: 3px;
  height: 3px;
  background: var(--ink);
  border-radius: 50%;
  display: block;
}

.nub {
  position: absolute;
  top: 50%;
  width: 7px;
  height: 14px;
  background: var(--ink);
  pointer-events: none;
  z-index: 2;
}

.nub-left {
  left: -5px;
  transform: translateY(-50%);
  border-radius: 3px 0 0 3px;
}

.nub-right {
  right: -5px;
  transform: translateY(-50%);
  border-radius: 0 3px 3px 0;
}

.tile.is-selected {
  outline: 3px solid var(--leaf);
  outline-offset: 1px;
  z-index: calc(var(--z) * 20 + var(--row) * 2 + 50);
}

.tile[data-z="0"].is-selected {
  transform: translate(0, -6px);
  box-shadow: 3px 8px 0 var(--ink);
}

.tile[data-z="1"].is-selected {
  transform: translate(8px, -16px);
  box-shadow: 3px 8px 0 var(--ink), 6px 12px 0 var(--ink);
}

.tile[data-z="2"].is-selected {
  transform: translate(10px, -22px);
  box-shadow: 3px 8px 0 var(--ink), 6px 12px 0 var(--ink), 9px 16px 0 var(--ink);
}

.tile.is-peek {
  box-shadow: 3px 4px 0 var(--ink), 0 0 0 3px #f0a202;
}

.tile[data-z="1"].is-peek {
  box-shadow: 3px 4px 0 var(--ink), 6px 8px 0 var(--ink), 0 0 0 3px #f0a202;
}

.tile[data-z="2"].is-peek {
  box-shadow: 3px 4px 0 var(--ink), 6px 8px 0 var(--ink), 9px 12px 0 var(--ink), 0 0 0 3px #f0a202;
}

.tile.is-blocked:active {
  animation: refuse-nudge 280ms var(--ease-out);
}

.tile[data-z="0"]:active:not(:disabled):not(.is-blocked):not(.is-selected) {
  transform: scale(0.96);
}

.fruit-svg {
  width: 78%;
  height: 78%;
  display: block;
}

.sil {
  display: inline-grid;
  place-items: center;
}

.refuse {
  position: absolute;
  left: 50%;
  bottom: -6px;
  transform: translateX(-50%);
  white-space: nowrap;
  background: var(--ink);
  color: var(--field);
  font-size: 10px;
  font-weight: 700;
  line-height: 1;
  padding: 4px 6px;
  border-radius: 6px;
  z-index: 5;
}

.hint-line {
  margin: 0;
  text-align: center;
  font-size: 0.9rem;
  font-weight: 600;
  min-height: 1.2em;
}

.hint-line.clap {
  color: var(--leaf);
}

.tools,
.stamp-bar {
  display: flex;
  gap: 8px;
  margin-top: auto;
}

.tools button,
.stamp-bar button,
.leave-card button {
  flex: 1 1 0;
  min-height: 48px;
  min-width: 44px;
  padding: 8px 10px;
  border: 2px solid var(--ink);
  border-radius: 14px;
  background: var(--paper);
  font-weight: 700;
  font-size: 0.95rem;
  box-shadow: 0 3px 0 var(--ink);
}

.stamp-bar button {
  background: var(--leaf);
  color: var(--field);
}

.stamp-bar button[data-act="done"] {
  background: var(--paper);
  color: var(--ink);
}

.tools button:disabled {
  opacity: 0.4;
  box-shadow: none;
  cursor: default;
}

.tools button:active:not(:disabled),
.stamp-bar button:active,
.leave-card button:active {
  transform: scale(0.96) translateY(2px);
  box-shadow: 0 1px 0 var(--ink);
}

.tools.is-away,
.stamp-bar.is-away {
  display: none;
}

.stamp-bar {
  z-index: 30;
  margin-bottom: 8px;
  position: relative;
}

.leave-card {
  position: absolute;
  left: 16px;
  right: 16px;
  bottom: 72px;
  background: var(--paper);
  border: 3px solid var(--ink);
  border-radius: 18px;
  padding: 14px;
  box-shadow: 0 6px 0 var(--ink);
  z-index: 40;
}

.leave-card p {
  margin: 0 0 10px;
  font-weight: 700;
  text-align: center;
}

.flyer {
  border-radius: 14px;
}

@media (prefers-reduced-motion: reduce) {
  .tile,
  .btn-play,
  .tools button,
  .stamp-bar button {
    transition: none;
  }

  .leaf-shrug.is-on {
    animation: none;
    opacity: 1;
  }

  .crate.has-ribbon .ribbon {
    animation: none;
  }

  .tile.is-blocked:active {
    animation: none;
  }
}

@keyframes refuse-nudge {
  0%,
  100% {
    transform: translateX(0);
  }
  25% {
    transform: translateX(-3px);
  }
  75% {
    transform: translateX(3px);
  }
}

@media (min-width: 720px) {
  .shell {
    max-width: 430px;
    padding-top: 28px;
  }
}
