:root {
  font-family: ui-rounded, "Avenir Next", "Trebuchet MS", system-ui, sans-serif;
  color: #193e36;
  background: #f6f7ee;
  font-synthesis: none;
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
  background:
    radial-gradient(ellipse at 92% 0, #e5efdc 0, transparent 45%), #f6f7ee;
}
button,
a {
  -webkit-tap-highlight-color: transparent;
}
button {
  font: inherit;
  cursor: pointer;
}
button:focus-visible,
a:focus-visible,
canvas:focus-visible {
  outline: 3px solid #efad48;
  outline-offset: 4px;
}
.shell {
  max-width: 1240px;
  margin: auto;
  padding: 30px 40px 20px;
}
header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  color: #244c3d;
  font-weight: 900;
  font-size: 22px;
  letter-spacing: -1px;
  text-decoration: none;
}
.brand svg {
  width: 37px;
  height: 37px;
}
.brand-light {
  font-weight: 500;
  margin-left: 3px;
}
.pill {
  background: #eaf0e4;
  border: 1px solid #dce6d4;
  border-radius: 30px;
  font-size: 12px;
  font-weight: 700;
  padding: 10px 15px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.pill i {
  width: 7px;
  height: 7px;
  background: #70975b;
  border-radius: 50%;
}
.intro {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 37px 0 26px;
}
.eyebrow {
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 2.3px;
  color: #6c8569;
}
h1 {
  font-size: 36px;
  letter-spacing: -1.2px;
  margin: 9px 0 8px;
  line-height: 1.15;
}
h1 span {
  color: #d39444;
}
.intro p {
  font-size: 14px;
  color: #718277;
  margin: 0;
}
.intro-note {
  display: flex;
  gap: 12px;
  align-items: center;
  color: #8b967e;
  font-size: 13px;
  line-height: 1.5;
  transform: rotate(-4deg);
}
.leaf {
  font-size: 40px;
  color: #a8ba86;
}
.game-card {
  border: 1px solid #d7e2d2;
  border-radius: 22px;
  overflow: hidden;
  box-shadow: 0 18px 50px #234b3612;
  background: #fff;
}
.game-bar {
  height: 60px;
  display: flex;
  align-items: center;
  gap: 25px;
  padding: 0 23px;
  background: #fffdf6;
}
.zone {
  font-size: 13px;
  font-weight: 750;
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 175px;
}
.zone-dot {
  width: 9px;
  height: 9px;
  background: #91ac6a;
  border-radius: 50%;
}
.progress {
  height: 7px;
  background: #e9eddf;
  position: relative;
  border-radius: 7px;
  flex: 1;
  margin: 0 42px 0 20px;
}
.progress-fill {
  height: 100%;
  width: 0%;
  background: #8baa5c;
  border-radius: 7px;
  transition: width 0.15s;
}
.progress span {
  position: absolute;
  right: -39px;
  top: -5px;
  font-size: 11px;
  font-weight: 700;
  color: #738568;
}
.game-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}
.star-count {
  color: #bd852c;
  font-size: 16px;
  font-weight: 800;
  margin-right: 14px;
}
.star-count .total {
  color: #98a28a;
  font-size: 12px;
  font-weight: 500;
}
.game-actions button {
  background: #f0f3e8;
  color: #486245;
  border: 0;
  border-radius: 10px;
  width: 32px;
  height: 32px;
  font-weight: 900;
  font-size: 18px;
}
.stage {
  position: relative;
  height: 490px;
  overflow: hidden;
  background: #c4e5d8;
}
canvas {
  display: block;
  width: 100%;
  height: 100%;
  outline: none;
}
.stage-badge {
  position: absolute;
  bottom: 14px;
  left: 20px;
  background: #fbfff0bd;
  color: #486b47;
  border-radius: 20px;
  padding: 7px 12px;
  font-size: 10px;
  pointer-events: none;
}
.stage-badge span {
  margin: 0 6px;
  color: #a0ab8b;
}
.controls {
  display: flex;
  align-items: center;
  gap: 26px;
  padding: 18px 22px;
  background: #fffdf7;
  font-size: 11px;
}
.controls > div {
  display: flex;
  align-items: center;
  gap: 5px;
}
.key {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  width: 25px;
  height: 25px;
  border: 1px solid #dce2d4;
  border-bottom: 3px solid #dce2d4;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 800;
  background: white;
  color: #5a7254;
}
.key.wide {
  width: 60px;
  font-size: 10px;
}
.control-label {
  font-weight: 750;
  margin-left: 4px;
  color: #4c6546;
}
.or {
  color: #9aa38d;
  font-size: 10px;
  margin-left: 3px;
}
.tip {
  margin-left: auto;
  color: #85947b;
}
.tip span {
  font-size: 20px;
  color: #afbf88;
}
.controls button {
  border: 0;
  background: none;
  color: #829177;
  font-size: 11px;
  padding: 7px;
}
.controls button:hover {
  color: #3d6342;
}
.overlay {
  z-index: 2;
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #244d3829;
  backdrop-filter: blur(3px);
  padding: 18px;
}
.overlay.hidden {
  display: none;
}
.modal {
  background: #fffdf5;
  width: 410px;
  max-width: 100%;
  padding: 28px 28px 25px;
  border-radius: 24px;
  box-shadow: 0 15px 60px #244a3928;
  text-align: center;
  border: 1px solid #fff;
}
.modal .modal-eyebrow {
  color: #91a16e;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 2px;
}
.modal h2 {
  font-size: 26px;
  letter-spacing: -0.7px;
  margin: 9px 0;
}
.modal p {
  font-size: 12px;
  line-height: 1.65;
  color: #809075;
  margin: 0 0 20px;
}
.animals {
  display: flex;
  gap: 10px;
  justify-content: center;
  margin: 19px 0 22px;
}
.animal {
  border: 1px solid #e3e8d5;
  background: #f4f6e9;
  border-radius: 15px;
  padding: 9px 5px 11px;
  flex: 1;
  color: #708167;
  font-size: 11px;
  font-weight: 750;
}
.animal svg {
  display: block;
  width: 68px;
  height: 66px;
  margin: 0 auto 5px;
}
.animal.selected {
  border: 2px solid #81a35c;
  background: #edf2d9;
  padding: 8px 4px 10px;
  color: #34532f;
  box-shadow: 0 0 0 3px #8dae6410;
}
.primary {
  border: 0;
  border-radius: 12px;
  padding: 14px 20px;
  background: #2c5945;
  color: #fff;
  font-weight: 800;
  font-size: 13px;
  width: 100%;
  box-shadow: 0 4px 0 #1e4133;
}
.primary:hover {
  background: #38694f;
  transform: translateY(-1px);
}
.modal .small {
  font-size: 10px;
  color: #a2ad94;
  margin-top: 14px;
  margin-bottom: 0;
}
.secondary {
  border: 0;
  background: none;
  color: #819071;
  font-size: 11px;
  margin-top: 16px;
}
.finish-stars {
  font-size: 37px;
  color: #eeb24e;
  letter-spacing: 9px;
  margin: 8px 0 15px;
}
.score {
  display: flex;
  justify-content: center;
  gap: 25px;
  margin: 20px 0;
}
.score strong {
  display: block;
  font-size: 23px;
  color: #3b6244;
}
.score span {
  font-size: 10px;
  color: #87977a;
}
#toast {
  position: absolute;
  top: 18px;
  left: 50%;
  transform: translate(-50%, -8px);
  padding: 11px 19px;
  background: #fffdf1ed;
  border-radius: 14px;
  box-shadow: 0 5px 20px #33542b22;
  color: #48673b;
  font-size: 12px;
  font-weight: 750;
  opacity: 0;
  pointer-events: none;
  transition: 0.2s;
  white-space: nowrap;
}
#toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}
footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: #97a28c;
  font-size: 10px;
  padding: 17px 5px;
}
footer p {
  margin: 0;
}
footer span {
  font-size: 9px;
  color: #aeb6a2;
}
@media (min-width: 1450px) {
  .shell {
    padding-top: 42px;
  }
  .intro {
    margin-top: 45px;
  }
  .stage {
    height: 560px;
  }
}
@media (max-width: 850px) {
  .shell {
    padding: 20px;
  }
  .intro-note,
  .or,
  .tip,
  footer span {
    display: none;
  }
  .intro {
    margin-top: 28px;
  }
  h1 {
    font-size: 29px;
  }
  .game-bar {
    gap: 10px;
    padding: 0 15px;
  }
  .zone {
    min-width: 125px;
    font-size: 11px;
  }
  .progress {
    margin-left: 0;
    margin-right: 33px;
  }
  .game-actions {
    gap: 5px;
  }
  .star-count {
    margin-right: 4px;
  }
  .stage {
    height: 440px;
  }
  .controls {
    gap: 15px;
    padding: 14px;
  }
  .controls button {
    margin-left: auto;
  }
}
@media (max-width: 500px) {
  .shell {
    padding: 14px;
  }
  .brand {
    font-size: 18px;
  }
  .brand svg {
    width: 29px;
  }
  .pill {
    font-size: 10px;
    padding: 8px;
  }
  .intro p {
    font-size: 12px;
  }
  .stage {
    height: 390px;
  }
  .zone {
    min-width: 105px;
  }
  .progress {
    display: none;
  }
  .game-actions {
    margin-left: auto;
  }
  .controls {
    flex-wrap: wrap;
  }
  .controls button {
    margin-left: 0;
  }
  .modal {
    padding: 23px 20px;
  }
  .modal h2 {
    font-size: 24px;
  }
  .animal svg {
    width: 60px;
  }
}

/* Touch UI is capability-gated in JavaScript, leaving desktop keyboard layout intact. */
.touch-controls {
  display: none;
}
.touch-controls[hidden],
.touch-button[hidden] {
  display: none !important;
}
.touch-movement {
  display: flex;
  gap: 8px;
}
.touch-button {
  width: 60px;
  height: 60px;
  border: 1px solid #c7d7bb;
  border-bottom: 4px solid #b6c8a8;
  border-radius: 17px;
  background: #eef3e3;
  color: #31573e;
  font-size: 28px;
  font-weight: 900;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
}
.touch-button.pressed {
  background: #cddbaf;
  border-bottom-width: 1px;
  transform: translateY(2px);
}
.touch-button:disabled {
  opacity: 0.45;
}
.touch-jump {
  width: 76px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1px;
  background: #315a44;
  border-color: #244734;
  color: #fff9e8;
}
.touch-jump span:last-child {
  font-size: 12px;
}
.touch-friend {
  width: 87px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  background: #fff0e4;
  border-color: #dbc2a7;
  color: #976a52;
}
.touch-friend span:last-child {
  font-size: 11px;
}
.resume-animal {
  width: 76px;
  height: 76px;
  margin: 12px auto 14px;
}
.resume-animal svg {
  width: 100%;
  height: 100%;
}
/* Prevent native text selection/callouts across the game, including nearby labels. */
.touch-enabled .game-card,
.touch-enabled .game-card * {
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
}

/* The capability gate applies to the complete mobile layout, in every game state. */
html.touch-enabled,
.touch-enabled body {
  height: 100%;
  overflow: hidden;
}
.touch-enabled body {
  height: 100vh;
  height: 100dvh;
}
.touch-enabled header,
.touch-enabled .intro,
.touch-enabled footer,
.touch-enabled .controls .keyboard-hint,
.touch-enabled .controls .tip,
.touch-enabled .progress {
  display: none;
}
.touch-enabled .shell {
  width: 100%;
  max-width: none;
  height: 100%;
  margin: 0;
  padding: 0;
}
.touch-enabled .game-card {
  display: grid;
  grid-template-rows: 48px minmax(0, 1fr) auto 28px;
  height: 100%;
  padding: env(safe-area-inset-top) env(safe-area-inset-right)
    env(safe-area-inset-bottom) env(safe-area-inset-left);
  border: 0;
  border-radius: 0;
  box-shadow: none;
}
.touch-enabled .game-bar {
  height: auto;
  min-width: 0;
  gap: 6px;
  padding: 0 12px;
}
.touch-enabled .zone {
  font-size: 10px;
  line-height: 1.35;
  min-width: 0;
  flex: 1;
}
.touch-enabled .zone-dot {
  flex-shrink: 0;
}
.touch-enabled .game-actions button {
  width: 32px;
  height: 32px;
}
.touch-enabled .star-count {
  font-size: 14px;
  white-space: nowrap;
}
.touch-enabled .stage {
  height: auto;
  min-height: 0;
  min-width: 0;
}
.touch-enabled .touch-controls {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  background: #fffdf7;
  padding: 10px 16px;
}
.touch-enabled .controls {
  padding: 0 12px;
  min-height: 0;
  justify-content: flex-end;
  flex-wrap: nowrap;
}
.touch-enabled .controls button {
  margin: 0;
  padding: 4px 7px;
}
.touch-enabled .stage-badge {
  left: 12px;
  bottom: 10px;
  font-size: 9px;
  padding: 6px 9px;
}
.touch-enabled #toast {
  font-size: 10px;
  max-width: calc(100% - 24px);
  white-space: normal;
  text-align: center;
  padding: 9px 12px;
}
.touch-enabled .overlay {
  overflow-y: auto;
  overscroll-behavior: contain;
  align-items: flex-start;
  padding: 12px;
}
.touch-enabled .modal {
  margin: auto;
  padding: 18px 20px;
}
.touch-enabled .modal h2 {
  font-size: 23px;
}
.touch-enabled .modal p {
  margin-bottom: 12px;
}
.touch-enabled .animals {
  margin: 12px 0 15px;
}
.touch-enabled .animal svg {
  height: 56px;
  width: 58px;
}
@media (max-height: 520px) {
  .touch-enabled .game-card {
    grid-template-rows: 40px minmax(0, 1fr) auto 26px;
  }
  .touch-enabled .touch-controls {
    padding: 5px 14px;
  }
  .touch-enabled .touch-button {
    height: 56px;
    border-radius: 14px;
  }
  .touch-enabled .modal {
    width: 370px;
  }
  .touch-enabled .stage-badge {
    top: 10px;
    bottom: auto;
  }
}
@media (max-width: 360px) {
  .touch-enabled .touch-controls {
    padding: 10px;
    gap: 6px;
  }
  .touch-enabled .touch-movement {
    gap: 6px;
  }
  .touch-enabled .touch-button {
    width: 54px;
    height: 56px;
  }
  .touch-enabled .touch-jump {
    width: 64px;
  }
  .touch-enabled .touch-friend {
    width: 78px;
  }
}
