:root {
  font-family: "Trebuchet MS", sans-serif;
  color: #354e42;
  background: #f4eedf;
}
* {
  box-sizing: border-box;
}
html,
body {
  margin: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
}
body {
  height: 100dvh;
  padding: env(safe-area-inset-top) max(10px, env(safe-area-inset-right))
    env(safe-area-inset-bottom) max(10px, env(safe-area-inset-left));
  display: flex;
  flex-direction: column;
}
button,
a {
  font: inherit;
  color: inherit;
  -webkit-tap-highlight-color: transparent;
}
button {
  cursor: pointer;
  border: 1px solid #d9d9c4;
  background: #fff9ec;
  border-radius: 14px;
  padding: 10px 15px;
  min-height: 44px;
  font-weight: bold;
}
button:disabled {
  opacity: 0.4;
  cursor: default;
}
button:focus-visible,
a:focus-visible {
  outline: 3px solid #b17835;
  outline-offset: 3px;
}
header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  width: min(720px, 100%);
  margin: auto;
  padding: 8px 4px;
  flex: none;
}
header a {
  text-decoration: none;
  font-size: 12px;
  font-weight: bold;
}
.brand {
  font-family: Georgia, serif;
  font-size: clamp(16px, 3vw, 23px);
  letter-spacing: -0.7px;
}
.brand-dot {
  color: #b28b47;
  padding-left: 6px;
}
header button {
  padding: 5px 14px;
}
main {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto 34px;
  gap: 8px;
  min-height: 0;
  flex: 1;
  width: min(640px, 100%);
  margin: 0 auto;
  padding-bottom: 7px;
}
.intro {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 2px 9px;
}
.eyebrow {
  font-size: 9px;
  letter-spacing: 2px;
  font-weight: bold;
  color: #7c8b70;
  margin: 0 0 5px;
}
h1 {
  font:
    clamp(20px, 4vw, 30px) Georgia,
    serif;
  margin: 0;
  letter-spacing: -0.5px;
}
.intro button {
  min-width: 44px;
  border-radius: 50%;
  background: transparent;
}
.landscape {
  position: relative;
  min-height: 0;
  overflow: hidden;
  border: 3px solid #fffaf0;
  border-radius: 28px;
  background: #d4dfb1;
  box-shadow: 0 9px 25px #46634614;
}
.landscape svg {
  display: block;
  width: 100%;
  height: 100%;
  touch-action: manipulation;
}
.controls {
  display: grid;
  grid-template-columns: 48px 1fr 48px;
  gap: 8px;
}
.controls button {
  min-height: 48px;
}
.controls #release {
  background: #366750;
  color: #fff9df;
  border: 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 22px;
  box-shadow: 0 3px 0 #274c3b;
}
#status {
  font-size: 12px;
  text-align: center;
  margin: 0;
  line-height: 1.4;
  align-self: center;
  padding: 0 6px;
}
.turn {
  cursor: pointer;
}
.turn:focus {
  outline: none;
}
.turn:focus-visible .rim {
  stroke: #a77636;
  stroke-width: 4;
}
.stream {
  stroke-dasharray: 5 17;
  animation: flow 1.2s linear infinite;
}
.leaf {
  transform-box: fill-box;
  transform-origin: bottom;
  animation: sway 4s ease-in-out infinite alternate;
}
.bloom {
  animation: appear 0.7s ease-out;
  transform-box: fill-box;
  transform-origin: center;
}
.ripple {
  animation: pulse 3s ease-in-out infinite;
}
.leak {
  animation: pulse 0.7s infinite alternate;
}
#result {
  position: absolute;
  left: 50%;
  top: 14px;
  transform: translateX(-50%);
  background: #fff9e8f5;
  border: 1px solid #d9d2a9;
  border-radius: 22px;
  text-align: center;
  padding: 15px 22px;
  width: min(300px, 85%);
  box-shadow: 0 8px 20px #365c4320;
}
#result .eyebrow {
  font-size: 8px;
  letter-spacing: 1px;
}
#result h2 {
  font:
    27px Georgia,
    serif;
  margin: 6px 0 12px;
}
#result button {
  background: #366750;
  color: #fff9df;
  width: 100%;
  border: 0;
}
dialog {
  background: #fbf5e7;
  border: 0;
  border-radius: 24px;
  padding: 24px;
  color: #354e42;
  width: min(460px, 92vw);
  max-height: 85dvh;
  line-height: 1.65;
}
dialog::backdrop {
  background: #294a3a88;
  backdrop-filter: blur(4px);
}
dialog h2 {
  font:
    28px Georgia,
    serif;
}
dialog li {
  padding: 5px 0;
}
.close {
  float: right;
  margin-bottom: 15px;
}
dialog .eyebrow {
  clear: both;
  padding-top: 10px;
}
#level-list {
  display: grid;
  gap: 8px;
}
#level-list button {
  text-align: left;
  display: flex;
  justify-content: space-between;
}
#level-list .current {
  background: #dfdfbb;
}
[hidden] {
  display: none !important;
}
@keyframes flow {
  to {
    stroke-dashoffset: -44;
  }
}
@keyframes sway {
  to {
    transform: rotate(5deg);
  }
}
@keyframes appear {
  from {
    transform: scale(0.1);
    opacity: 0;
  }
  to {
    transform: scale(1);
    opacity: 1;
  }
}
@keyframes pulse {
  50% {
    opacity: 0.45;
  }
}
@media (max-height: 550px) {
  header {
    padding: 3px;
  }
  .intro {
    padding: 0;
  }
  h1 {
    font-size: 18px;
  }
  main {
    grid-template-rows: auto minmax(0, 1fr) auto 22px;
    gap: 4px;
  }
  .controls button {
    min-height: 36px;
    padding: 5px;
  }
  .eyebrow {
    margin-bottom: 2px;
  }
  #status {
    font-size: 10px;
  }
  #result {
    top: 4px;
    padding: 6px 14px;
  }
  #result h2 {
    font-size: 20px;
    margin: 2px;
  }
  #result button {
    min-height: 32px;
    padding: 4px;
  }
}
@media (prefers-reduced-motion: reduce) {
  * {
    animation: none !important;
    transition: none !important;
  }
}

.settings {
  display: flex;
  gap: 5px;
  align-items: center;
}
.settings #sound {
  border-radius: 13px;
  font-size: 12px;
  min-width: 62px;
  padding: 8px;
}
.build-tools {
  display: flex;
  gap: 5px;
  justify-content: center;
  align-items: center;
}
.build-tools button {
  min-height: 40px;
  font-size: 11px;
  padding: 7px 10px;
  flex: 1;
}
.build-tools button[aria-pressed="true"] {
  background: #d3dfb6;
  border-color: #748e60;
}
.building {
  grid-template-rows: auto minmax(0, 1fr) auto auto 34px;
}
.plot:hover .rim {
  fill: #f1e9c8;
}
@media (max-height: 550px) {
  .building {
    grid-template-rows: auto minmax(0, 1fr) auto auto 22px;
  }
  .build-tools button {
    min-height: 30px;
    padding: 4px;
  }
  .settings #sound {
    min-height: 34px;
    padding: 4px;
  }
}
.source-control{cursor:pointer;outline:none}
.source-control:focus-visible>ellipse:first-of-type{stroke:#a77636;stroke-width:5}
.source-control[aria-disabled=true]{cursor:default}
