/* Counting Money: its own look (a green market morning, a striped awning, a wooden stand and a dish). A big-kid game,
   still calm: soft colors, slow smooth motion (0.4 to 0.8 s, ease in and out), nothing loops or flashes. */
:root {
  --bg: #eef4ea;
  --bg-2: #e0ebd9;
  --card: #fffdf7;
  --ink: #3b2a1a;
  --soft: #6d6250;
  --blue: #3f7fc4;
  --blue-d: #1f5fa8;
  --green: #3fa34d;
  --green-d: #2a7a36;
  --sun: #f4c55a;
  --wood: #d9a066;
  --wood-d: #a8713a;
  /* Coin buttons: at least 2 cm (76 CSS px) on every phone (rule 12), bigger where there's room. */
  --coin: clamp(84px, 24vw, 120px);
  --radius: 20px;
  color-scheme: light;
}
/* Evening: dimmer and warmer (rule 4). */
body.evening { --bg: #e6dcc8; --bg-2: #dacdb4; --card: #f6eedc; }
body.evening main, body.evening .top { filter: brightness(.9); }

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  min-height: 100dvh;
  background: radial-gradient(circle at 10% 6%, #faf6ee 0 14%, transparent 15%), radial-gradient(circle at 92% 28%, var(--bg-2) 0 12%, transparent 13%), var(--bg);
  color: var(--ink);
  font: 500 18px/1.45 'Fredoka', system-ui, sans-serif;
  overscroll-behavior: none;
  overflow-x: hidden;
}
h1, h2 { font-family: 'Fredoka', system-ui, sans-serif; font-weight: 700; line-height: 1.1; margin: 0; }
button { font: inherit; color: inherit; cursor: pointer; }
a { color: var(--blue-d); }

/* top bar */
.top { display: flex; align-items: center; gap: 10px; padding: max(10px, env(safe-area-inset-top)) 16px 6px; min-height: 64px; }
.grow { flex: 1; }
.brand { display: block; width: 40px; height: 40px; }
.back, .round {
  min-height: 48px; min-width: 48px; border: 3px solid var(--ink); border-radius: 16px; background: var(--card);
  box-shadow: 0 4px 0 var(--ink); font-weight: 700; padding: 6px; display: inline-flex; align-items: center; justify-content: center;
}
.back:active, .round:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--ink); }
#sound .mute { display: none; }
#sound[aria-pressed='false'] .mute { display: inline; }
#sound[aria-pressed='false'] .waves { display: none; }

main { max-width: 1600px; margin: 0 auto; padding: 0 16px calc(28px + env(safe-area-inset-bottom)); }
.screen { display: grid; gap: 18px; }

/* home */
.hero { text-align: center; display: grid; gap: 8px; padding-top: 4px; }
.hero h1 { font-size: clamp(34px, 10vw, 54px); }
.lede { margin: 0; font-size: 20px; color: var(--soft); }
.demo { display: flex; justify-content: center; margin-top: 6px; }
.demo { align-items: center; gap: 6px; }
.demo-coin { width: 64px; }
.demo-coin.c-dime { width: 50px; }
.demo-coin.c-penny { width: 54px; }
.demo-pic { width: 84px; height: 84px; margin-left: 10px; }
.demo svg { display: block; width: 100%; height: auto; }
.big {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px; width: 100%; min-height: 76px;
  border: 3px solid var(--ink); border-radius: 24px; font-size: 30px; font-weight: 700; box-shadow: 0 7px 0 var(--ink); padding: 10px 20px;
}
.big:active { transform: translateY(5px); box-shadow: 0 2px 0 var(--ink); }
.big.go { background: var(--green); color: #fff; text-shadow: 0 2px 0 #0003; }
.big.plain { background: var(--card); font-size: 24px; min-height: 64px; }
.pick { border: 0; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; min-width: 0; }
.pick legend { font-weight: 700; font-size: 18px; margin-bottom: 8px; padding: 0; }
.pick button {
  border: 3px solid var(--ink); border-radius: 18px; background: var(--card); box-shadow: 0 4px 0 var(--ink); padding: 10px 4px;
  display: grid; justify-items: center; align-content: start; gap: 4px; font-weight: 700; font-size: 20px; line-height: 1.15; min-height: 96px;
}
.pick button small { font-size: 14px; font-weight: 500; color: var(--soft); }
.pick button[aria-pressed='true'] { background: #dff3e1; border-color: var(--green-d); box-shadow: 0 4px 0 var(--green-d); outline: 3px solid var(--green); outline-offset: 1px; }
.pick button:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--ink); }
.mini-num { display: inline-grid; place-items: center; min-width: 64px; padding: 2px 8px; border-radius: 999px; background: #fff; border: 2px solid var(--ink); font-size: 15px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chips legend { width: 100%; }
.chips button { display: inline-flex; min-height: 48px; padding: 6px 14px; font-size: 18px; align-items: center; }
.grownups, .about { background: var(--card); border: 3px solid var(--ink); border-radius: var(--radius); padding: 14px 16px; box-shadow: 0 5px 0 #3b2a1a33; }
.grownups summary { font-weight: 700; cursor: pointer; min-height: 32px; }
.grownups p, .about p { margin: 10px 0 0; }
.about h2 { font-size: 22px; margin-top: 14px; }
.about h2:first-child { margin-top: 0; }
.about h3 { font-size: 18px; margin: 12px 0 0; }
.about ul { padding-left: 22px; display: grid; gap: 6px; }
.small { font-size: 14px; color: var(--soft); }

/* play */
#play-screen { gap: 12px; justify-items: center; grid-template-columns: minmax(0, 1fr); }
.dots { list-style: none; display: flex; justify-content: center; gap: 8px; margin: 0; padding: 0; }
.dots li { width: 16px; height: 16px; border-radius: 50%; background: #d6e3d0; border: 2px solid #a3bc9a; }
.dots li.now { background: var(--sun); border-color: var(--ink); }
.dots li.done { background: var(--green); border-color: var(--green-d); }
/* The stand: a striped awning over a wooden counter with the thing for sale and the paper bag. */
.stand { width: min(100%, 520px); }
.awning {
  height: 34px; border: 4px solid var(--ink); border-bottom: 0; border-radius: 18px 18px 0 0;
  background: repeating-linear-gradient(90deg, #d65a55 0 40px, #fff4dc 40px 80px);
}
.counter {
  display: flex; align-items: flex-end; justify-content: center; gap: 24px; padding: 10px 16px 14px; border: 4px solid var(--ink); border-radius: 0 0 22px 22px;
  background: repeating-linear-gradient(90deg, #0000 0 26px, #ffffff14 26px 28px, #0000 28px 60px, #0000000f 60px 62px), linear-gradient(#e9b97f, var(--wood));
  box-shadow: inset 0 -8px 0 var(--wood-d), 0 6px 0 #6b4a2a55;
}
.item { position: relative; display: grid; justify-items: center; }
.item img { width: clamp(100px, 30vw, 150px); height: auto; position: relative; z-index: 2; }
.item.sold img { visibility: hidden; }
.tag {
  position: absolute; right: -60px; top: -26px; z-index: 3; padding: 4px 12px 4px 18px; border: 3px solid var(--ink); border-radius: 8px 12px 12px 8px;
  background: #fffaf0; font-size: clamp(24px, 7vw, 32px); font-weight: 700; transform: rotate(8deg); box-shadow: 0 3px 0 #3b2a1a55;
}
.tag::before { content: ''; position: absolute; left: 6px; top: calc(50% - 4px); width: 8px; height: 8px; border-radius: 50%; border: 2px solid var(--ink); }
.bag { width: clamp(70px, 20vw, 100px); }
.bag svg, .coin-btn svg, .in-dish svg { display: block; width: 100%; height: auto; }
.ask { display: flex; align-items: center; justify-content: center; gap: 12px; width: 100%; }
.again-btn { flex: none; width: 56px; height: 56px; border: 3px solid var(--ink); border-radius: 50%; background: var(--card); box-shadow: 0 4px 0 var(--ink); display: grid; place-items: center; }
.said { margin: 0; min-height: 30px; font-size: clamp(18px, 5vw, 22px); font-weight: 700; color: var(--green-d); }
/* The dish: a soft blue plate with the total on its rim. */
.dish {
  width: min(100%, 520px); min-height: 120px; border: 4px solid var(--ink); border-radius: 60px / 40px; background: radial-gradient(ellipse at 50% 40%, #f4f8fb 0 55%, #dbe6ee 56%);
  padding: 8px 18px 12px; display: grid; gap: 4px; justify-items: center; transition: box-shadow .6s ease-in-out;
}
.dish.over { box-shadow: 0 0 0 5px #f0a95a; }
.dish-total { margin: 0; display: flex; align-items: baseline; gap: 8px; font-size: 16px; color: var(--soft); }
.dish-total b { font-size: 30px; color: var(--ink); }
.dish-coins { display: flex; flex-wrap: wrap; justify-content: center; gap: 2px; min-height: 52px; }
/* Coins in the dish: tap one to take it back. The tap area stays 48 px or more around a smaller drawing. */
.in-dish { width: 52px; min-height: 52px; padding: 2px; border: 0; background: none; border-radius: 50%; }
.in-dish.c-dollar { width: 64px; }
/* The purse: one big button per coin, with its name. */
.purse { display: grid; grid-template-columns: repeat(3, minmax(0, var(--coin))); justify-content: center; gap: 10px; width: min(100%, 520px); }
/* Four coins: two rows of two on a phone, so every button stays big (rule 12); one row where there's room. */
.purse.n4 { grid-template-columns: repeat(2, minmax(0, var(--coin))); }
@media (min-width: 440px) { .purse.n4 { grid-template-columns: repeat(4, minmax(0, var(--coin))); } }
.coin-btn {
  display: grid; justify-items: center; gap: 0; padding: 6px 4px 4px; min-height: 96px; border: 3px solid var(--ink); border-radius: 18px;
  background: var(--card); box-shadow: 0 4px 0 var(--ink); font-size: 16px; font-weight: 700; transition: box-shadow .6s ease-in-out;
}
.coin-btn svg { width: 74%; }
.coin-btn:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--ink); }
/* The hint: the screen dims around it (spotlight.js, Doug's standing rule Oct 6: no circles). */

/* finish */
#finish { text-align: center; padding-top: 10px; }
.cheer { font-size: clamp(32px, 9vw, 46px); }
.receipt {
  list-style: none; margin: 0 auto; padding: 12px 16px; width: min(100%, 420px); background: #fffef9; border: 3px solid var(--ink); border-radius: 8px;
  display: grid; gap: 4px; text-align: left; animation: arrive .6s ease-in-out both; font-size: 18px;
}
.receipt li { display: grid; grid-template-columns: 44px 1fr auto; gap: 10px; align-items: center; border-bottom: 2px dashed #d8cfbf; padding-bottom: 4px; }
.receipt li:last-child { border-bottom: 0; }
.receipt img { width: 44px; height: 44px; }
.round-total { margin: 0; font-size: 20px; font-weight: 700; }
@keyframes arrive { from { opacity: 0; transform: translateY(-16px); } to { opacity: 1; transform: none; } }
.talk { margin: 0; background: #f4fbf6; border: 2px dashed var(--green-d); border-radius: 16px; padding: 12px 14px; text-align: left; font-size: 18px; }

/* Wide screens: the stand on the left, the dish and purse on the right. */
@media (min-width: 900px) {
  #play-screen { grid-template-columns: 1fr 1fr; align-items: start; column-gap: 32px; max-width: 1100px; margin: 0 auto; }
  .dots, .ask { grid-column: 1 / -1; }
  .stand { grid-column: 1; grid-row: 2 / 5; justify-self: end; }
  .dish, .purse { grid-column: 2; justify-self: start; }
  #finish { max-width: 900px; margin: 0 auto; }
}
/* Phones held sideways: smaller coins. */
@media (orientation: landscape) and (max-height: 520px) {
  :root { --coin: 80px; }
  .top { min-height: 52px; padding-top: max(6px, env(safe-area-inset-top)); }
}
