:root {
  font-family: system-ui, "Microsoft JhengHei", sans-serif;
  color: #173f35;
  background: #e8eee3;
  color-scheme: light;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { overscroll-behavior: none; }
body { margin: 0; }
button {
  font: inherit;
  color: inherit;
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}
button:disabled { cursor: default; }
button:focus-visible { outline: 3px solid #634319; outline-offset: 2px; }
.game {
  max-width: 710px;
  min-height: 100dvh;
  padding: 5px clamp(11px, 4vw, 22px) 8px;
  margin: auto;
  background: #faf6ec;
  text-align: center;
}
header, .tools, #instruction { display: flex; align-items: center; }
header { justify-content: space-between; min-height: 44px; font-weight: 750; }
.tools { gap: 6px; }
.tools button, #read {
  display: grid;
  place-items: center;
  background: #fff;
  border: 1px solid #91aea2;
  border-radius: 10px;
  padding: 0 7px;
  min-width: 44px;
  min-height: 44px;
}
.mute, [aria-pressed="false"] .waves { display: none; }
[aria-pressed="false"] .mute { display: inline; }
#read:disabled { opacity: .52; }
html[data-app-shell] :is(.tools, #result, #opening) { display: none !important; }
html[data-app-shell] header { min-height: 26px; }
h1 { margin: 0; color: #24665e; font-size: clamp(24px, 5vw, 38px); }
#instruction { min-height: 44px; margin: 2px auto 5px; justify-content: center; gap: 7px; }
#prompt { margin: 0; font-size: clamp(16px, 3vw, 22px); line-height: 1.22; }
.pond {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  max-width: 580px;
  height: clamp(182px, 35dvh, 330px);
  margin: auto;
  border: 1px solid #8fb6a5;
  border-radius: 16px;
  background: #c9ded5;
}
.scenery { position: absolute; inset: 0; width: 100%; height: 100%; }
.lily { position: absolute; width: 42px; height: 20px; background: #8fb79b; border-radius: 50%; transform: rotate(-12deg); }
.lily::after { content: ""; position: absolute; inset: 0; clip-path: polygon(50% 50%, 100% 30%, 100% 70%); background: #c9ded5; }
.lily-one { left: 4%; bottom: 12%; }
.lily-two { right: 9%; top: 20%; width: 31px; height: 15px; }
.stones, .frogs { position: absolute; inset: 0 3px; }
.stone, .frog { position: absolute; transform: translateX(-50%); }
.stone { top: 67%; width: min(30%, 130px); }
.stone svg { display: block; width: 100%; height: 34px; }
.frog {
  --frog-size: clamp(70px, 20vw, 118px);
  --frog-outline: #375e48;
  --frog-mid: #89bc73;
  --frog-light: #bed992;
  --frog-dark: #689958;
  --frog-belly: #f5e5b5;
  --frog-white: #fffdf4;
  --frog-blush: #eca48b;
  --team: #24665e;
  --ink: #24665e;
  z-index: 2;
  width: min(32%, 145px);
  height: calc(var(--frog-size) * .72 + 46px);
  padding: 0;
  top: calc(70% - var(--frog-size) * .72);
  background: transparent;
  border: 0;
  border-radius: 10px;
  display: grid;
  justify-items: center;
  grid-template-rows: calc(var(--frog-size) * .72) 46px;
}
.frog.gold { --frog-mid: #e8b653; --frog-light: #f3d597; --frog-dark: #c79845; --team: #e5a938; --ink: #966112; }
.frog svg { width: min(100%, var(--frog-size)); height: 100%; overflow: visible; }
.frog[aria-current="step"] { z-index: 3; }
.frog[aria-current="step"]::before {
  content: "";
  position: absolute;
  left: calc(50% - 9px);
  top: -15px;
  height: 19px;
  width: 18px;
  background: #244e43;
  clip-path: polygon(33% 0, 67% 0, 67% 48%, 100% 48%, 50% 100%, 0 48%, 33% 48%);
  pointer-events: none;
}
.frog[aria-current="step"] .group-card { outline: 2px solid var(--ink); outline-offset: 2px; }
.frog[data-jumping] { z-index: 4; }
.group-card {
  display: flex;
  align-content: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 3px;
  width: 66px;
  height: 44px;
  padding: 3px 7px;
  background: #fffdf6;
  border: 2px solid var(--ink);
  border-radius: 10px;
}
.counter { width: 13px; height: 13px; border-radius: 50%; background: var(--team); }
#answer-area { margin: 7px auto 0; max-width: 520px; }
.order-options, #equations, .keypad { display: grid; gap: 5px; }
.order-options { grid-template-columns: repeat(2, minmax(0, 1fr)); }
#equations { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 7px; }
.equation-label { font-size: clamp(13px, 3vw, 16px); font-weight: 700; margin-bottom: 2px; }
.equation {
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: clamp(3px, 1vw, 8px);
  font-size: clamp(16px, 4.8vw, 29px);
  font-weight: 780;
}
.operand { font-weight: 850; }
.operand.green { color: #24665e; }
.operand.gold { color: #885811; }
.blank, .order-options button, .keypad button {
  min-height: 44px;
  padding: 2px 4px;
  border: 1px solid #729d8c;
  border-radius: 9px;
  background: #fff;
  font-weight: 800;
}
.blank { min-width: 44px; }
.order-options button { font-size: clamp(23px, 5vw, 32px); }
.keypad { grid-template-columns: repeat(5, minmax(0, 1fr)); margin-top: 5px; }
.keypad button { font-size: clamp(18px, 4.5vw, 25px); }
[aria-pressed="true"]:is(.blank, .order-options button) { border: 2px solid #996c21; background: #fff0c5; }
[data-solved] .blank { background: #dff2e7; border-color: #2b9a68; }
.primary, #replay {
  margin-top: 6px;
  min-height: 44px;
  min-width: 100px;
  padding: 5px 16px;
  background: #24665e;
  color: white;
  border: 0;
  border-radius: 10px;
  font-size: 17px;
  font-weight: 750;
}
.primary:disabled { opacity: .58; }
#feedback { min-height: 1.2em; margin: 4px 0 0; font-size: 14px; font-weight: 740; color: #7f3d33; }
[data-solved] #feedback { color: #24665e; }
#result, #opening { margin: 24px auto; }
.result-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; }
.result-actions > :is(button, a) {
  display: inline-flex; align-items: center; justify-content: center; min-height: 44px;
  padding: 0 12px; color: inherit; background: #fff; border: 1px solid #91aea2; border-radius: 10px;
}
#demo-home:focus-visible { outline: 3px solid #634319; outline-offset: 2px; }
.demo-note { max-width: 42ch; margin: 0 auto 16px; font-size: 1rem; line-height: 1.5; }
@media (max-height: 590px) {
  .pond { height: clamp(154px, 32dvh, 194px); }
  .frog { --frog-size: clamp(67px, 18vw, 90px); top: calc(68% - var(--frog-size) * .72); }
  .stone { top: 65%; }
}
@media (min-width: 700px) and (min-height: 820px) {
  .keypad button { min-height: 52px; }
  .order-options button { min-height: 58px; }
}
