:root {
  color-scheme: light;
  --cream: #fff8e8;
  --paper: #fffcf3;
  --forest: #143b2b;
  --muted: #4e6355;
  --line: #d2d7bc;
  --leaf: #dce9b9;
  --gold: #f4c95b;
  --display: "Palatino Linotype", "Book Antiqua", Palatino, Georgia, serif;
  --body: "Trebuchet MS", Verdana, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }

body {
  margin: 0;
  background: var(--cream);
  color: var(--forest);
  font: 1rem/1.55 var(--body);
}

button, input { font: inherit; }
button { color: inherit; }
a { color: inherit; text-underline-offset: .25em; }
img { display: block; max-width: 100%; }
button:focus-visible, a:focus-visible, summary:focus-visible, input:focus-visible {
  outline: 3px solid #825110;
  outline-offset: 3px;
}

.play-wrap { width: min(1020px, calc(100% - 64px)); margin-inline: auto; }
.skip-link {
  position: fixed;
  top: 8px;
  left: 8px;
  z-index: 5;
  padding: 10px 16px;
  border-radius: 7px;
  color: white;
  background: var(--forest);
  transform: translateY(-150%);
}
.skip-link:focus { transform: translateY(0); }

.play-header, .play-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.play-header { min-height: 78px; border-bottom: 1px solid var(--line); }
.play-brand {
  display: inline-flex;
  gap: 10px;
  align-items: center;
  font: bold 1.5rem/1.15 var(--display);
  text-decoration: none;
}
.play-brand img { border-radius: 10px; flex: none; }
.quiet-link, .play-footer a { font-size: .875rem; color: var(--muted); }
.quiet-link span, .store-button span { margin-inline-start: .25em; }

.play-intro {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 36px;
  padding-block: 37px 27px;
}
.play-intro h1 {
  margin: 0 0 10px;
  font: normal clamp(2.65rem, 6.1vw, 4.55rem)/1.02 var(--display);
  letter-spacing: -.06em;
  text-wrap: balance;
}
.play-intro p { max-width: 49ch; margin: 0; color: var(--muted); }
.intro-flower { margin: 0 35px 12px 0; transform: rotate(9deg); }

.play-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.24fr) minmax(0, 1fr);
  gap: 22px;
  align-items: start;
}

.board-card, .tools-card {
  min-width: 0;
  padding: clamp(16px, 3vw, 30px);
  border: 1px solid var(--line);
  border-radius: 22px;
}
.board-card { background: #edf2d8; box-shadow: 5px 6px 0 #d9e3bd; }
.tools-card { background: var(--paper); box-shadow: 5px 6px 0 #eee8d3; }
.board-topline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0 10px;
  margin: -5px 0 9px;
}
#garden-beds { margin: 0; font-weight: bold; font-size: .875rem; }
.reset-button {
  min-height: 44px;
  border: 0;
  padding: 5px;
  background: transparent;
  cursor: pointer;
  font-size: .875rem;
  text-decoration: underline;
  text-underline-offset: .25em;
}
.reset-button span { display: inline-block; margin-inline-end: 2px; font-size: 1.15em; }
.reset-button:disabled { opacity: .66; cursor: default; }

.board-frame {
  padding: clamp(8px, 1.7vw, 15px);
  border: 1px solid #1a4330;
  border-radius: 17px;
  background: #2b4938;
  box-shadow: inset 0 0 0 1px #44634b;
}
#garden-board {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  aspect-ratio: 1;
  gap: clamp(3px, .75vw, 8px);
}
.board-placeholder { grid-column: 1 / -1; align-self: center; justify-self: center; color: #f6f4df; }
.garden-cell {
  position: relative;
  display: grid;
  place-items: center;
  min-width: 0;
  min-height: 0;
  aspect-ratio: 1;
  border: 1px solid #83976c;
  border-radius: clamp(5px, 1vw, 11px);
  padding: 0;
  background: #d5e3b6;
  cursor: pointer;
  font: bold clamp(1.1rem, 3vw, 2rem)/1 var(--display);
}
.garden-cell:focus-visible { z-index: 2; outline-color: #ffd765; outline-offset: 2px; }
.garden-cell[data-bed="false"] {
  border-color: #6e7e6c;
  background: radial-gradient(ellipse at 42% 38%, #788679 0 15%, transparent 16%), #5d6c60;
}
.garden-cell[data-root="true"]::before {
  position: absolute;
  z-index: 1;
  width: 42%;
  aspect-ratio: 1;
  border: clamp(2px, .25vw, 4px) solid #34533b;
  border-radius: 50%;
  background: #edf2d8;
  content: "";
}
.garden-cell[data-root="true"][data-plant]::before {
  top: 11%;
  right: 11%;
  width: 20%;
  border-width: 2px;
  background: var(--paper);
}
.garden-cell[data-root="true"][data-planted-root]::before {
  border-color: var(--paper);
  background: var(--flower-center);
}
.garden-cell[data-root="true"][data-anchor="true"]::before {
  top: auto;
  right: auto;
  width: 38%;
  border-color: #663916;
  background: #ffeb9c;
  box-shadow: 0 0 0 2px #fff7d4;
}

.garden-cell[data-plant="daisy"], .garden-cell[data-preview-plant="daisy"], .seed-card[data-seed="daisy"] {
  --petal: #fff6d5;
  --plant-color: #edc764;
  --plant-edge: #a4752f;
  --flower-center: #b06732;
}
.garden-cell[data-plant="lavender"], .garden-cell[data-preview-plant="lavender"], .seed-card[data-seed="lavender"] {
  --petal: #f4e4ff;
  --plant-color: #b6a0d7;
  --plant-edge: #7e679c;
  --flower-center: #694e88;
}
.garden-cell[data-plant="poppy"], .garden-cell[data-preview-plant="poppy"], .seed-card[data-seed="poppy"] {
  --petal: #ffc9ae;
  --plant-color: #e8876b;
  --plant-edge: #a05543;
  --flower-center: #743f34;
}
.garden-cell[data-plant] { background: var(--plant-color); border-color: var(--plant-edge); }
.garden-cell[data-plant]::after {
  width: 62%;
  aspect-ratio: 1;
  border-radius: 50%;
  background:
    radial-gradient(circle at 50% 50%, var(--flower-center) 0 12%, transparent 14%),
    radial-gradient(circle at 50% 29%, var(--petal) 0 17%, transparent 19%),
    radial-gradient(circle at 29% 50%, var(--petal) 0 17%, transparent 19%),
    radial-gradient(circle at 71% 50%, var(--petal) 0 17%, transparent 19%),
    radial-gradient(circle at 50% 71%, var(--petal) 0 17%, transparent 19%);
  content: "";
}
.garden-cell[data-preview="valid"] {
  border: 2px dashed #3d6040;
  background: color-mix(in srgb, var(--plant-color, #efaf94) 61%, #fff8e8);
}
.garden-cell[data-preview="invalid"] {
  border: 2px dashed #8d4535;
  background: repeating-linear-gradient(135deg, #f3d3c7 0 5px, #e8b4a5 5px 8px);
}
.garden-cell[data-blocked="true"]::after {
  position: absolute;
  z-index: 2;
  width: auto;
  aspect-ratio: auto;
  padding: 0 .1em;
  border-radius: 4px;
  background: #f9d8c8;
  color: #742f23;
  content: "×";
}

.board-key {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 3px 18px;
  margin: 10px 0 0;
  padding: 0;
  list-style: none;
  color: #f6f4df;
  font-size: .76rem;
}
.board-key li { display: flex; align-items: center; gap: 6px; }
.key-swatch { width: 12px; height: 12px; flex: none; }
.key-bed { border-radius: 3px; background: #d5e3b6; }
.key-root { border: 2px solid #d5e3b6; border-radius: 50%; }
.key-stone { border: 1px solid #a2aca2; border-radius: 3px; background: #69786b; }
.no-script { margin: 12px 0 0; }

.tools-card h2, .completion-card h2, .store-card h2 {
  margin: 0;
  font: normal 1.8rem/1.15 var(--display);
  letter-spacing: -.025em;
}
#seed-tray {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin: 15px 0 21px;
}
.seed-card {
  display: grid;
  justify-items: center;
  align-content: start;
  min-width: 0;
  gap: 2px;
  padding: 8px 3px;
  border: 1px solid #cbd2b7;
  border-radius: 12px;
  background: #f7f3e6;
  cursor: pointer;
  text-align: center;
}
.seed-card[aria-pressed="true"] {
  border-color: #395944;
  outline: 2px solid #395944;
  outline-offset: -2px;
  background: #e7eed2;
}
.seed-card:focus-visible { outline: 3px solid #825110; outline-offset: 3px; }
.seed-card:disabled { cursor: default; }
.seed-name { font-weight: bold; font-size: .875rem; overflow-wrap: anywhere; }
.seed-state { color: var(--muted); font-size: .72rem; line-height: 1.35; }
.seed-shape {
  display: grid;
  grid-template-columns: repeat(var(--shape-cols, 4), 8px);
  grid-template-rows: repeat(var(--shape-rows, 4), 8px);
  place-content: center;
  align-self: center;
  height: 40px;
  gap: 2px;
}
.shape-cell { position: relative; border-radius: 2px; background: var(--plant-color); border: 1px solid var(--plant-edge); }
.shape-cell[data-row="1"] { grid-row: 1; }
.shape-cell[data-row="2"] { grid-row: 2; }
.shape-cell[data-row="3"] { grid-row: 3; }
.shape-cell[data-row="4"] { grid-row: 4; }
.shape-cell[data-column="1"] { grid-column: 1; }
.shape-cell[data-column="2"] { grid-column: 2; }
.shape-cell[data-column="3"] { grid-column: 3; }
.shape-cell[data-column="4"] { grid-column: 4; }
.shape-cell[data-origin="true"]::before {
  position: absolute;
  inset: 1px;
  border: 1px solid var(--flower-center);
  border-radius: 50%;
  content: "";
}

.action-group { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.play-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: .2em;
  min-height: 44px;
  padding: 8px 12px;
  border: 1px solid transparent;
  border-radius: 9px;
  font-size: .875rem;
  line-height: 1.35;
  font-weight: bold;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
}
.play-button:disabled { cursor: default; }
.secondary-button { border-color: #bdc7aa; background: #f4f4e4; }
.secondary-button:disabled { color: #58685c; background: #f3f0e2; }
.control-icon { font-size: 1.2em; }
.plant-button { grid-column: 1 / -1; background: var(--forest); color: #fff8e8; }
.plant-button:disabled { background: #dfe8d2; color: #536651; }
.play-status {
  min-height: 3.5em;
  margin: 14px 0 13px;
  padding: 10px 12px;
  border-left: 3px solid #638655;
  background: #eef2df;
  border-radius: 0 7px 7px 0;
  color: #284737;
  font-size: .875rem;
  line-height: 1.45;
}
.play-status[data-state="invalid"] { border-color: #a05543; background: #fae6da; color: #742f23; }
.play-status[data-state="complete"] { border-color: #638655; background: #e4edc8; }
.keyboard-help { color: var(--muted); font-size: .8rem; }
.keyboard-help summary { min-height: 44px; padding-block: 10px; cursor: pointer; }
.keyboard-help p { margin: 0 0 5px; }

.completion-card, .store-card {
  display: grid;
  align-items: center;
  gap: 16px;
  padding: 20px 23px;
  border: 1px solid var(--line);
  border-radius: 15px;
  margin-top: 22px;
}
.completion-card {
  grid-template-columns: minmax(0, 1fr) auto;
  background: var(--leaf);
  scroll-margin-block: 12px;
}
.completion-intro { display: flex; align-items: center; gap: 14px; }
.completion-flower { width: clamp(44px, 8vw, 60px); height: auto; flex: none; }
.store-card { grid-template-columns: auto minmax(0, 1fr) auto; background: var(--paper); }
.store-card img { width: 60px; height: 60px; border-radius: 13px; }
.completion-card p, .store-card p { margin: 5px 0 0; color: var(--muted); font-size: .9rem; }
.store-card h2 { font-size: 1.55rem; }
.share-tools { min-width: 0; }
.share-button { background: var(--gold); color: #362713; }
.store-button { background: var(--forest); color: #fff8e8; }
#share-fallback { margin-top: 8px; font-size: .8rem; }
#share-copy-text { display: block; width: 100%; padding: 8px; border: 1px solid #829670; border-radius: 6px; }
.share-status:empty { display: none; }
.play-footer { min-height: 81px; margin-top: 38px; border-top: 1px solid var(--line); }
.play-footer > span { font: bold 1.15rem/1.25 var(--display); }
.play-footer nav { display: flex; flex-wrap: wrap; column-gap: 20px; }

@media (prefers-reduced-motion: no-preference) {
  .completion-card:not([hidden]) .completion-flower {
    animation: garden-bloom .5s ease-out .16s both;
  }

  @keyframes garden-bloom {
    from { opacity: 0; transform: rotate(-12deg) scale(.55); }
    65% { opacity: 1; transform: rotate(3deg) scale(1.08); }
    to { opacity: 1; transform: rotate(0) scale(1); }
  }
}

@media (hover: hover) {
  .quiet-link:hover, .play-footer a:hover { color: var(--forest); }
  .garden-cell:hover { box-shadow: inset 0 0 0 2px #ffffff6b; }
  .seed-card:not(:disabled):hover { border-color: #527758; }
  .secondary-button:not(:disabled):hover { background: var(--leaf); }
  .plant-button:not(:disabled):hover, .store-button:hover { background: #24583e; }
  .share-button:not(:disabled):hover { background: #ffda7d; }
}

@media (max-width: 740px) {
  .play-wrap { width: min(520px, calc(100% - 32px)); }
  .play-layout { grid-template-columns: minmax(0, 1fr); gap: 15px; }
  .play-intro { padding-block: 24px 19px; }
  .intro-flower { display: none; }
  .board-card, .tools-card { border-radius: 16px; padding: 13px; box-shadow: 3px 4px 0 #d9e3bd; }
  .tools-card { box-shadow: 3px 4px 0 #eee8d3; }
  .board-topline { margin-bottom: 5px; }
  .board-frame { border-radius: 12px; }
  #seed-tray { margin: 10px 0 14px; }
  .store-card, .completion-card { gap: 12px; padding: 15px; }
  .completion-card { grid-template-columns: minmax(0, 1fr); }
  .store-card { grid-template-columns: auto minmax(0, 1fr); }
  .store-button { grid-column: 1 / -1; justify-self: start; }
}

@media (max-width: 460px) {
  .play-wrap { width: calc(100% - 24px); }
  .play-header { min-height: 54px; gap: 8px; }
  .play-brand { font-size: 1.2rem; }
  .play-brand img { width: 32px; height: 32px; border-radius: 8px; }
  .quiet-link { font-size: .75rem; }
  .play-intro { padding-block: 16px 15px; }
  .play-intro p { font-size: .875rem; }
  .play-intro h1 { font-size: clamp(2.15rem, 9.7vw, 2.72rem); margin-bottom: 7px; }
  .tools-card h2 { font-size: 1.55rem; }
  .board-frame { max-width: 320px; margin-inline: auto; }
  .board-key { gap: 3px 12px; font-size: .72rem; }
  .seed-card { padding-block: 5px; }
  .seed-shape { height: 34px; }
  .action-group { grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr) minmax(0, 1fr); gap: 6px; }
  .action-group .play-button { padding-inline: 6px; }
  .action-group .plant-button { grid-column: auto; }
  .play-status { min-height: 44px; margin: 10px 0 8px; padding: 8px 10px; }
  .store-card img { width: 50px; height: 50px; }
}
