/* Android draws its own translucent tap flash over whatever was tapped, even
   above a dialog that the tap just opened; buttons have their own pressed and
   focus styles instead. */
html {
  -webkit-tap-highlight-color: transparent;
}
:root {
  font-family: ui-sans-serif, system-ui, sans-serif;
  color: #e9eddf;
  background: #112521;
  font-synthesis: none;
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
  min-height: 100svh;
  background: radial-gradient(ellipse at 50% 40%, #24433a 0, transparent 65%);
}
/* Page layout (story stage, garden bar, board) lives in layout.css. */
.eyebrow {
  margin: 0;
  font-size: 10px;
  letter-spacing: 2px;
  color: #c5cf9d;
}
h1 {
  font:
    normal clamp(25px, 4vw, 34px) Georgia,
    serif;
  margin: 6px 0 0;
}
#board {
  display: grid;
  grid-template-columns: repeat(var(--size), minmax(0, 1fr));
  grid-template-rows: repeat(var(--size), minmax(0, 1fr));
  align-content: stretch;
  flex: none;
  min-height: 0;
  max-height: 420px;
  max-width: 100%;
  width: var(--board-side, min(100%, 420px));
  height: var(--board-side, auto);
  aspect-ratio: 1;
  gap: 5px;
  padding: 8px;
  border: 1px solid #40564a;
  border-radius: 20px;
  background: #0e211c;
  box-shadow: 0 20px 60px #0003;
}
.tile {
  width: 100%;
  height: 100%;
  min-height: 0;
  min-width: 0;
  display: block;
  padding: 0;
  background: #213a31;
  border: 1px solid #2b4439;
  border-radius: 10px;
  cursor: pointer;
  transition: background 0.2s;
  touch-action: manipulation;
}
.tile:hover {
  background: #2d493b;
}
.tile svg {
  display: block;
  width: 100%;
  height: 100%;
  overflow: hidden;
}
.pipes {
  stroke: #819b8d;
  stroke-width: 7;
  stroke-linecap: round;
}
.tile circle {
  fill: #819b8d;
}
.tile text {
  fill: #172b22;
  font: 24px Georgia;
  text-anchor: middle;
}
.tile.lit {
  background: #304938;
}
.light-flow {
  fill: none;
  stroke: #f4df95;
  stroke-width: 7;
  stroke-linecap: round;
  stroke-dasharray: 1;
  stroke-dashoffset: 0;
  filter: drop-shadow(0 0 3px #e5d38680);
}
.tile.lit .light-head {
  fill: #fff9d8;
  filter: drop-shadow(0 0 4px #fff1ae);
  pointer-events: none;
}
.tile.lit circle:where(:not(.portal-ring)) {
  fill: #ecdc98;
}
.tile:disabled {
  cursor: default;
  opacity: 1;
}
button {
  font: inherit;
}
button:focus-visible,
a:focus-visible {
  outline: 3px solid #f2d88d;
  outline-offset: 3px;
}
#message {
  flex: none;
  height: 40px;
  width: 100%;
  margin: 0;
  display: grid;
  place-items: center;
  text-align: center;
  font-size: 12px;
  line-height: 18px;
  color: #cedac9;
}
.tools {
  flex: none;
  width: 100%;
  height: 44px;
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 4px;
}
.tools button {
  width: 100%;
  height: 44px;
  min-height: 44px;
  padding: 4px;
  border: 0;
  border-radius: 22px;
  color: #c5d3bf;
  background: transparent;
  font-size: 12px;
  cursor: pointer;
}
.next-slot {
  min-width: 0;
  height: 44px;
}
.tools .primary {
  background: #e6d28a;
  color: #233529;
}
.primary[hidden] {
  display: none;
}
#garden-dialog {
  width: min(600px, 94vw);
  max-height: 94svh;
  padding: 20px 28px 24px;
  border: 1px solid #60735a;
  border-radius: 24px;
  color: #e9eddf;
  background:
    radial-gradient(ellipse at 75% 60%, #354d3833, transparent 65%), #142b24;
  box-shadow: 0 28px 100px #0008;
  overflow: auto;
}
#garden-dialog::backdrop {
  background: #061710bd;
  backdrop-filter: blur(8px);
}
.atlas-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.atlas-wordmark {
  font-size: 10px;
  letter-spacing: 3px;
  color: #bac7a4;
}
#gardens-close {
  width: 44px;
  height: 44px;
  border: 1px solid #5e725455;
  border-radius: 50%;
  background: transparent;
  color: #b8c7ad;
  font: 27px Georgia;
  cursor: pointer;
}
.atlas-heading {
  text-align: center;
  padding: 18px 0 24px;
}
.atlas-heading .eyebrow {
  font-size: 9px;
  letter-spacing: 2px;
  color: #b9c591;
}
.atlas-heading h2 {
  font:
    normal clamp(29px, 5vw, 40px) Georgia,
    serif;
  letter-spacing: -1px;
  margin: 12px 0 8px;
  color: #f0eacc;
}
.atlas-heading > p:last-child {
  font-size: 12px;
  color: #a8bca8;
  margin: 0;
}
.chapter-tabs {
  display: flex;
  gap: 20px;
  justify-content: center;
  border-bottom: 1px solid #65795344;
}
.chapter-tabs button {
  min-height: 48px;
  padding: 8px 3px 12px;
  border: 0;
  border-bottom: 2px solid transparent;
  background: none;
  color: #91a58c;
  cursor: pointer;
  font: 16px Georgia;
}
.chapter-tabs button span {
  display: block;
  font: 9px system-ui;
  letter-spacing: 2px;
  margin-top: 5px;
}
.chapter-tabs button[aria-pressed="true"] {
  border-bottom-color: #daca8c;
  color: #eee1b3;
}
.garden-landscape {
  position: relative;
  margin: 16px 0 10px;
  padding: 0 0 12px;
}
.garden-trail {
  position: absolute;
  width: 100%;
  height: 100%;
  inset: 0;
  pointer-events: none;
}
.garden-trail path {
  fill: none;
  stroke: #9aa773;
  stroke-opacity: 0.22;
  stroke-width: 1;
  stroke-dasharray: 3 7;
}
#garden-map {
  position: relative;
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 22px 8px;
  padding: 4px 0 12px;
}
.garden-node {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 0;
  width: 100%;
  height: 88px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: #aebf9f;
  cursor: pointer;
}
.garden-node:nth-child(even) {
  transform: translateY(12px);
}
.map-flower {
  width: 56px;
  height: 56px;
  display: block;
  margin: 0 auto;
  overflow: visible;
}
.petals {
  fill: #d6d69d;
  stroke: #f1e8b155;
  stroke-width: 0.5;
}
.flower-heart {
  fill: #fff0b6;
}
.bud {
  fill: #5e785844;
  stroke: #91aa75;
  stroke-width: 1.2;
}
.bud-stem {
  fill: none;
  stroke: #91aa75;
  stroke-width: 1;
}
.garden-number {
  display: block;
  line-height: 18px;
  font: 600 14px system-ui;
  letter-spacing: 0.5px;
}
.garden-node.current .map-flower {
  background: radial-gradient(circle, #c6d18a29, transparent 70%);
  outline: 1px solid #d8d99c66;
  outline-offset: 1px;
  border-radius: 50%;
}
.garden-node.current {
  color: #f2e4a8;
}
.here-mark {
  position: static;
  order: 3;
  display: block;
  margin-top: 2px;
  line-height: 12px;
  font: 600 10px system-ui;
  letter-spacing: 1px;
  white-space: nowrap;
  color: #d8d99c;
}
.garden-node.locked {
  color: #bac6af;
  cursor: default;
}
.garden-node.locked .map-flower {
  opacity: 0.35;
}
.garden-node:not(:disabled):hover .map-flower {
  filter: drop-shadow(0 0 7px #d8d58b55);
  transform: translateY(-3px);
}
.map-flower {
  transition:
    transform 0.2s,
    filter 0.2s;
}
.atlas-bottom {
  border-top: 1px solid #65795333;
  text-align: center;
  padding-top: 17px;
}
.atlas-bottom p {
  font: italic 16px Georgia;
  color: #ddd8af;
  margin: 0 0 6px;
}
.atlas-bottom > span {
  font-size: 10px;
  color: #98ae99;
}
@media (max-width: 400px) {
  #garden-dialog {
    padding: 12px 16px 20px;
  }
  .atlas-heading {
    padding: 10px 0 18px;
  }
  .map-flower {
    width: 44px;
    height: 44px;
  }
  .garden-node {
    height: 76px;
  }
  .here-mark {
    top: 72px;
    font-size: 10px;
    letter-spacing: 0.4px;
  }
  #garden-map {
    gap: 18px 6px;
  }
}
.tile.fixed {
  border: 2px solid #91a696;
  border-radius: 3px;
  background: #34463e;
  cursor: default;
}
.stone-mark {
  fill: #d2d8bf;
  stroke: #142c25;
  stroke-width: 2px;
}
.tile.hint {
  outline: 3px solid #f7de93;
  outline-offset: -3px;
}
@media (max-width: 599px) {
  #board {
    padding: 5px;
    gap: 4px;
    border-radius: 14px;
  }
  .tools button {
    font-size: 11px;
  }
}
@media (prefers-reduced-motion: reduce) {
  * {
    animation: none !important;
    transition: none !important;
  }
}
#feedback-dialog {
  box-sizing: border-box;
  width: min(460px, 94vw);
  max-height: 90svh;
  overflow: auto;
  padding: 20px;
  border: 1px solid #668c77;
  border-radius: 14px;
  background: #142c25;
  color: #edf1de;
}
#feedback-dialog::backdrop {
  background: #0009;
}
#feedback-dialog h2 {
  font: 600 22px system-ui;
  margin: 0 0 12px;
}
#feedback-dialog p {
  font: 14px/1.5 system-ui;
}
#feedback-dialog label {
  display: block;
  margin: 12px 0 6px;
  font: 14px system-ui;
}
#feedback-dialog select,
#feedback-dialog textarea {
  box-sizing: border-box;
  width: 100%;
  min-height: 44px;
  background: #fff9ef;
  color: #263d35;
  font: 16px system-ui;
  border-radius: 6px;
  padding: 8px;
}
.feedback-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}
.feedback-actions button {
  min-height: 44px;
  padding: 10px;
  background: #d5e29d;
  color: #142c25;
  border: 0;
  border-radius: 6px;
  font: 14px system-ui;
}

.feedback-heading {
  display: flex;
  align-items: start;
  gap: 8px;
  position: sticky;
  top: -20px;
  background: #142c25;
  z-index: 1;
  padding-top: 8px;
}
#feedback-dismiss {
  flex: none;
  width: 44px;
  height: 44px;
  margin-left: auto;
  font-size: 28px;
  color: #edf1de;
  background: #284b3d;
  border: 0;
  border-radius: 50%;
  cursor: pointer;
}
#feedback-image {
  max-width: 100%;
  color: inherit;
  min-height: 44px;
}
#feedback-dialog small {
  display: block;
  font-size: 12px;
  margin-top: 6px;
}
#feedback-toast {
  position: fixed;
  bottom: 12px;
  left: 50%;
  transform: translateX(-50%);
  max-width: 90vw;
  margin: 0;
  padding: 10px 16px;
  background: #e5dfba;
  color: #142c25;
  border-radius: 18px;
  font-size: 13px;
  pointer-events: none;
  z-index: 5;
}
#feedback-toast:empty {
  display: none;
}
#board.blooming {
  box-shadow: 0 0 32px #e5d38630;
}
.blooming .goal svg > text:not(.tone-mark) {
  transform-origin: 50% 50%;
  transform-box: view-box;
  animation: flower-bloom 900ms ease-out both;
  animation-delay: var(--bloom-delay, 0ms);
}
.blooming .goal {
  background: #4c6140;
}
@keyframes flower-bloom {
  0% {
    transform: scale(0.6);
    opacity: 0.6;
  }
  65% {
    transform: scale(1.12);
    opacity: 1;
  }
  100% {
    transform: scale(1);
    opacity: 1;
  }
}
.atlas-top {
  position: sticky;
  top: -20px;
  background: #142b24;
  z-index: 2;
}
@media (min-width: 600px) and (max-height: 560px) {
  #garden-dialog[open] {
    display: grid;
    grid-template-columns: 220px minmax(0, 1fr);
    column-gap: 24px;
    width: min(740px, 94vw);
    padding: 10px 22px 14px;
  }
  .atlas-top {
    grid-column: 1/-1;
    grid-row: 1;
  }
  .atlas-heading {
    grid-column: 1;
    grid-row: 2/4;
    align-self: center;
    padding: 10px 0;
    text-align: left;
  }
  .atlas-heading h2 {
    font-size: 36px;
  }
  .chapter-tabs {
    grid-column: 2;
    grid-row: 2;
  }
  .garden-landscape {
    grid-column: 2;
    grid-row: 3;
    margin: 5px 0;
    padding: 0;
  }
  #garden-map {
    gap: 20px 8px;
    padding-bottom: 10px;
  }
  .garden-node {
    height: 76px;
  }
  .map-flower {
    width: 44px;
    height: 44px;
  }
  .here-mark {
    top: 62px;
    font-size: 10px;
    letter-spacing: 0.4px;
  }
  .garden-node:nth-child(even) {
    transform: translateY(6px);
  }
  .atlas-bottom {
    grid-column: 1/-1;
    grid-row: 4;
    padding-top: 8px;
  }
  .atlas-bottom p {
    font-size: 14px;
    display: inline;
    margin-right: 12px;
  }
}
@media (min-width: 500px) and (max-width: 599px) and (max-height: 560px) and (orientation: landscape) {
  #garden-dialog[open] {
    display: grid;
    grid-template-columns: 155px minmax(0, 1fr);
    column-gap: 12px;
    width: min(540px, 96vw);
    padding: 8px 12px 10px;
  }
  .atlas-top {
    grid-column: 1 / -1;
    grid-row: 1;
  }
  .atlas-heading {
    grid-column: 1;
    grid-row: 2 / 4;
    align-self: center;
    padding: 4px 0;
    text-align: left;
  }
  .atlas-heading h2 {
    font-size: 29px;
  }
  .chapter-tabs {
    grid-column: 2;
    grid-row: 2;
  }
  .chapter-tabs button {
    min-height: 40px;
    padding: 2px 3px 5px;
    font-size: 14px;
  }
  .garden-landscape {
    grid-column: 2;
    grid-row: 3;
    margin: 2px 0;
    padding: 0;
  }
  #garden-map {
    gap: 6px 4px;
    padding: 4px 0 12px;
  }
  .garden-node {
    height: 70px;
  }
  .garden-node:nth-child(even) {
    transform: translateY(2px);
  }
  .map-flower {
    width: 38px;
    height: 38px;
  }
  .here-mark {
    top: 57px;
    font-size: 9px;
    letter-spacing: 0.4px;
  }
  .atlas-bottom {
    grid-column: 1 / -1;
    grid-row: 4;
    padding-top: 4px;
  }
  .atlas-bottom p {
    display: inline;
    margin-right: 12px;
    font-size: 12px;
  }
}

/* Supporting copy stays readable on narrow screens without shrinking the board. */
.atlas-wordmark,
.atlas-heading .eyebrow {
  font-size: 11px;
  letter-spacing: 1.5px;
  color: #ced8b4;
}
.chapter-tabs button span {
  font-size: 12px;
  letter-spacing: 1px;
}
.atlas-bottom > span {
  font-size: 12px;
  line-height: 16px;
  color: #b5c9b6;
}
.garden-number {
  line-height: 18px;
}
.here-mark {
  font-size: 11px;
  line-height: 13px;
}
.garden-node {
  height: 92px;
}
@media (max-width: 400px) {
  .garden-node {
    height: 80px;
  }
  .atlas-heading {
    padding-bottom: 12px;
  }
  .garden-landscape {
    margin: 10px 0 6px;
  }
  #garden-map {
    gap: 14px 6px;
  }
}
@media (min-width: 600px) and (max-height: 560px) {
  .garden-node {
    height: 80px;
  }
}
@media (min-width: 500px) and (max-width: 599px) and (max-height: 560px) and (orientation: landscape) {
  .garden-node {
    height: 74px;
  }
}

/* Chapter navigation keeps ten gardens on screen, even as the campaign grows. */
.chapter-pager {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin: 12px 0 8px;
}
.chapter-pager > div {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  flex-wrap: wrap;
}
.chapter-pager strong {
  font: inherit;
  font-size: 16px;
  color: #f1e9c8;
}
.chapter-pager span {
  color: #bed0b7;
  font-size: 12px;
  letter-spacing: 0.08em;
}
.chapter-pager button {
  width: 44px;
  height: 44px;
  padding: 0;
  flex: none;
  font-size: 20px;
}
.chapter-pager button:disabled {
  opacity: 0.3;
}
.tile .portal-ring {
  fill: #213a31;
  stroke: #d7c9ef;
  stroke-width: 3;
}
.tile .portal-ring.inner {
  fill: none;
  stroke-width: 1.5;
}
.tile .dew-mark {
  fill: #193d37;
  stroke: #badbce;
  stroke-width: 3;
}
.tile.moon-endpoint > svg > circle:not(.light-head) {
  fill: #bfd9ef;
}
.tile .tone-mark {
  font-size: 19px;
  fill: #d5e9ff;
}
.tile.moon-light .light-flow {
  stroke: #c5e7ff;
}
.tile.moon-light .light-head {
  fill: #eff9ff;
}
@media (max-height: 500px) {
  .chapter-pager {
    margin: 0 0 4px;
  }
  .chapter-pager button {
    height: 40px;
  }
}
.chapter-pager button {
  border: 1px solid #50694e;
  border-radius: 50%;
  background: transparent;
  color: #dce3be;
  cursor: pointer;
}
.chapter-pager button:not(:disabled):hover {
  background: #2c4633;
}
.chapter-pager button:focus-visible {
  outline: 2px solid #e9d796;
  outline-offset: 3px;
}
.chapter-pager button:disabled {
  cursor: default;
}

.garden-node.locked .map-flower {
  opacity: 0.65;
}
.map-lock {
  fill: none;
  stroke: #bac6af;
  stroke-width: 2;
}
.tile .tone-mark {
  font-size: 27px;
  fill: #fff4c1;
  stroke: #142c25;
  stroke-width: 3px;
  paint-order: stroke;
}
.tile.moon-endpoint .tone-mark {
  fill: #eef6ff;
}

/* The background covers the canvas even when the play column is centered. */
body {
  display: flow-root;
}
@media (min-width: 768px) and (min-height: 740px) {
  #board {
    max-height: 520px;
  }
}

/* Keep dismissal separate from chapter navigation on short landscape screens. */
@media (min-width: 500px) and (max-height: 560px) and (orientation: landscape) {
  .atlas-top {
    margin-bottom: 16px;
  }
}

/* The flower is reached but dew beads are still dark: not a win. */
.tile.dew-missed .dew-mark {
  stroke: #f0b88a;
  stroke-width: 4;
  animation: dew-waiting 1.6s ease-in-out infinite;
}
.tile.goal.waiting svg > text:not(.tone-mark) {
  opacity: 0.45;
  filter: grayscale(0.6);
}
@keyframes dew-waiting {
  50% {
    stroke: #fff1d6;
    transform: scale(1.12);
  }
}
.tile.dew-missed .dew-mark {
  transform-origin: 50px 50px;
  transform-box: view-box;
}
@media (prefers-reduced-motion: reduce) {
  .tile.dew-missed .dew-mark {
    animation: none;
  }
}

/* ---------- Polish, 2026-09-28 art review ---------- */
/* Headings and guidance wrap in balanced lines; card copy avoids orphans. */
h1,
h2,
#message,
.atlas-heading h2,
.valley-heading h2 {
  text-wrap: balance;
}
#story-body p,
.story-next,
.place-words,
.daily-lede {
  text-wrap: pretty;
}

/* Tools: the two quiet actions sit together in the middle. On a win the
   nudge steps aside and Next garden takes its place as the primary. The
   row keeps its fixed height, so the board never moves. */
.tools {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 12px;
  padding-inline: 4px;
}
.tools button {
  width: auto;
  min-width: 44px;
  padding: 4px 14px;
  white-space: nowrap;
}
.next-slot {
  display: contents;
}
.tools.won #hint {
  display: none;
}
.tools .primary {
  padding: 4px 22px;
  font-weight: 600;
}

/* Sources and flowers: discs ~40% of the tile. With sun and moon lights,
   each disc wears its tone: a warm gold ring or a cool moon-blue ring. */
.tile svg > text:not(.tone-mark) {
  font-size: 29px;
}
.tile circle.tone-sun {
  fill: #a3a07c;
  stroke: #e8c766;
  stroke-width: 4;
}
.tile.moon-endpoint > svg > circle.tone-moon {
  fill: #a9c8df;
  stroke: #9fd0f4;
  stroke-width: 4;
}
.tile.lit circle.tone-sun {
  fill: #ecdc98;
}
.tile.lit.moon-endpoint > svg > circle.tone-moon {
  fill: #c5e7ff;
}
.tile .tone-mark {
  font-size: 25px;
}

/* Dew beads: a cool water tone that never reads as a grey path. When the
   flower is lit but a bead is dark, it breathes slowly. */
.tile .dew-mark {
  fill: #15434b;
  stroke: #86d3dc;
  stroke-width: 3.5;
}
.tile.dew-missed .dew-mark {
  animation: dew-waiting 2.8s ease-in-out infinite;
}
@keyframes dew-waiting {
  50% {
    stroke: #fff1d6;
    transform: scale(1.07);
  }
}
@media (prefers-reduced-motion: reduce) {
  .tile.dew-missed .dew-mark {
    animation: none;
  }
}
