/* Counting Lights: its own look, a dusk-blue evening with a string of colored light bulbs.
   Each string is five warm coral bulbs, then five soft blue ones (the bead rack's two colors).
   Calm by design: soft colors, one group glides at a time (0.6 s, ease in and out), a bulb that turns on glows up
   slowly and then holds still: nothing twinkles, chases, loops or flickers. kids.css turns all motion off under
   Reduce motion. */
:root {
  --sky: #26355c;
  --sky-2: #34467a;
  --hill: #1f2c4c;
  --card: #fff6e2;
  --ink: #1d2440;
  --text: #fff4dc;
  --soft: #cdd3ee;
  --warm: #ff8f66;
  --warm-off: #8a6660;
  --cool: #7cbcff;
  --cool-off: #66718f;
  --glow: #ffd27a;
  --green: #3fa34d;
  --cord: #9fbf96;
  --socket: #2b3040;
  --radius: 20px;
  color-scheme: dark;
}
/* Evening look (after 6 PM, or as a grown-up sets it): a little dimmer and warmer. */
body.evening {
  --sky: #241f3a;
  --sky-2: #302746;
  --hill: #1c1730;
  --card: #f6e7c9;
  --text: #f6e6c6;
  --soft: #c9bfd6;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  min-height: 100dvh;
  background:
    radial-gradient(ellipse 120% 40% at 50% 104%, var(--hill) 0 60%, transparent 61%),
    linear-gradient(var(--sky), var(--sky-2));
  background-attachment: fixed;
  color: var(--text);
  font: 500 18px/1.45 'Fredoka', system-ui, sans-serif;
  overscroll-behavior: none;
}
h1, h2, h3 { font-weight: 700; line-height: 1.1; margin: 0; }
button { font: inherit; color: inherit; cursor: pointer; }
a { color: #ffd98f; }

/* 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: inline-flex; gap: 2px; }
.brand .w { fill: var(--warm); }
.brand .k { fill: var(--cool); }
.back, .round {
  min-height: 48px; min-width: 48px; border: 3px solid var(--ink); border-radius: 16px; background: var(--card); color: var(--ink);
  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(24px + env(safe-area-inset-bottom)); }
.screen { display: grid; gap: 18px; grid-template-columns: minmax(0, 1fr); }

/* home */
.hero { text-align: center; display: grid; gap: 8px; padding-top: 4px; }
.hero h1 { font-size: clamp(34px, 9vw, 54px); }
.lede { margin: 0; font-size: 20px; color: var(--soft); }
.demo { position: relative; display: flex; align-items: center; justify-content: center; gap: 2px; margin: 10px auto 0; max-width: 520px; width: 100%; }
.demo svg { flex: none; width: min(7vw, 42px); height: auto; position: relative; }
.demo .cord, .string .cord { position: absolute; background: var(--cord); opacity: .75; border-radius: 3px; }
/* The wire runs through the sockets: the bulbs hang just below it. */
.demo .cord { left: 0; right: 0; top: calc(50% - min(7vw, 42px) * 0.6); height: 3px; }
.demo .gap { flex: none; width: min(9vw, 60px); }
.demo .w { fill: var(--warm-off); }
.demo .k { fill: var(--cool-off); }
.demo .w.on { fill: var(--warm); filter: drop-shadow(0 0 7px #ff9a7099); }
.demo .k.on { fill: var(--cool); filter: drop-shadow(0 0 7px #8cc6ff99); }

.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; color: var(--ink);
}
.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; }
.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); color: var(--ink); box-shadow: 0 4px 0 var(--ink); padding: 10px 6px;
  display: grid; justify-items: center; gap: 2px; font-weight: 700; font-size: 20px; min-height: 80px; align-content: center;
}
.pick button small { font-weight: 500; font-size: 15px; color: #5a5f7a; }
.pick button[aria-pressed='true'] { background: var(--glow); }
.pick.chips button { min-height: 56px; font-size: 17px; }

.grownups, .about { background: #ffffff12; border: 2px solid #ffffff2a; border-radius: var(--radius); padding: 14px 16px; }
.grownups summary { font-weight: 700; cursor: pointer; min-height: 32px; }
.grownups p, .about p { margin: 10px 0; }
.about h2 { font-size: 24px; margin-top: 14px; }
.about h2:first-child { margin-top: 0; }
.about h3 { font-size: 19px; margin-top: 12px; }
.small { font-size: 15px; color: var(--soft); }
.grownups .pick { margin-top: 10px; }

/* a round */
.dots { list-style: none; display: flex; justify-content: center; gap: 10px; margin: 0; padding: 0; }
.dots li { width: 14px; height: 14px; border-radius: 50%; border: 2px solid var(--soft); }
.dots li.done { background: var(--soft); }
.dots li.now { background: var(--glow); border-color: var(--glow); }

#play-screen { min-height: calc(100dvh - 90px - env(safe-area-inset-top)); height: calc(100dvh - 90px - env(safe-area-inset-top)); grid-template-rows: auto auto minmax(0, 1fr) 88px; gap: 12px; }
.head { display: flex; align-items: center; gap: 14px; }
.card {
  flex: none; min-width: 96px; height: 96px; padding: 0 14px; border: 3px solid var(--ink); border-radius: 22px; background: var(--card); color: var(--ink);
  box-shadow: 0 5px 0 var(--ink); font-size: 60px; font-weight: 700; line-height: 1; display: grid; place-items: center;
  transition: background-color 0.6s ease-in-out;
}
.card.long { font-size: 40px; }
.card.right { background: var(--glow); }
.words { min-width: 0; }
.ask, .praise { margin: 0; }
.ask { font-size: 22px; font-weight: 700; }
.praise { font-size: 20px; color: var(--glow); min-height: 1.4em; }
.praise.soft { color: var(--soft); font-size: 18px; }

.strings { position: relative; display: flex; flex-direction: column; min-height: 0; border-radius: 26px; background: #ffffff08; transition: background-color 0.6s ease-in-out; }
.strings.warm { background: #ffd27a1f; }
.strings.up { flex-direction: row; }
.string { position: relative; flex: 1; min-height: 0; min-width: 0; touch-action: none; }
/* The wire runs through the sockets. Across, bulbs hang down from it; on standing strings they hang sideways. */
.across .string .cord { left: 4px; right: 4px; top: calc(50% - var(--size) * 0.6); height: 3px; margin-top: -1.5px; }
.up .string .cord { top: 4px; bottom: 4px; left: calc(50% - var(--size) * 0.6); width: 3px; margin-left: -1.5px; }

.lan {
  position: absolute; left: 0; top: 0; border: 0; padding: 0; background: none; display: grid; place-items: center;
  transition: transform 0.6s ease-in-out;
}
.across .lan { width: var(--step); height: 100%; }
.up .lan { height: var(--step); width: 100%; }
.lan svg { width: var(--size); height: calc(var(--size) * 1.3); overflow: visible; }
.up .lan svg { transform: rotate(-90deg); }
.lan:disabled { cursor: default; }
/* Bigger buttons (helps) must not stretch a bulb past its place on the string: layout() sizes them. */
html.h-big #strings .lan { min-height: 0; min-width: 0; }
/* The glow is a still radial gradient (defined once in index.html); it fades in once, then holds. */
.lan .glow { fill: url(#glow-warm); opacity: 0; transition: opacity 0.6s ease-in-out; }
.lan.cool .glow { fill: url(#glow-cool); }
.lan.lit .glow { opacity: 1; }
.lan .glass { fill: var(--warm-off); stroke: #00000038; stroke-width: 1.2; transition: fill 0.6s ease-in-out; }
.lan.cool .glass { fill: var(--cool-off); }
.lan.lit .glass { fill: var(--warm); }
.lan.cool.lit .glass { fill: var(--cool); }
.lan .shine { fill: none; stroke: #fff; stroke-width: 2.6; stroke-linecap: round; opacity: .3; transition: opacity 0.6s ease-in-out; }
.lan.lit .shine { opacity: .75; }
.lan .socket { fill: var(--socket); stroke: #00000055; stroke-width: 1; }
.lan .ridge { fill: none; stroke: #ffffff33; stroke-width: 1.4; stroke-linecap: round; }
.lan:focus-visible { outline: 3px solid var(--glow); outline-offset: -3px; border-radius: 12px; }
/* Placing lights for a new number: no glide. */
.strings.still .lan, .strings.still .lan * { transition: none !important; }

/* The still hint: the five (or the ten) places on the lit end stay bright while the screen dims around them
   (spotlight.js, Doug's standing rule Oct 6: no circles). The .ring box is only where the spotlight goes. */
.ring { position: absolute; border: 0; opacity: 0; pointer-events: none; }
.across .ring { left: var(--from); width: var(--len); top: 50%; height: calc(var(--size) * 1.55); transform: translateY(-50%); }
.up .ring { top: var(--from); height: var(--len); left: 50%; width: calc(var(--size) * 1.8); transform: translateX(-50%); }

.foot { display: grid; align-items: center; }
.options { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.num {
  min-height: 84px; border: 3px solid var(--ink); border-radius: 22px; background: var(--card); color: var(--ink); box-shadow: 0 5px 0 var(--ink);
  font-size: 48px; font-weight: 700; line-height: 1; transition: opacity 0.6s ease-in-out;
}
.num:active { transform: translateY(4px); box-shadow: 0 1px 0 var(--ink); }
.num.not { opacity: .5; }
.num.yes { background: var(--glow); }
.big.next { min-height: 80px; }

/* all done */
#finish { text-align: center; justify-items: center; padding-top: 10px; }
.cheer { font-size: clamp(38px, 10vw, 56px); }
.max-card {
  display: grid; place-items: center; width: 150px; height: 190px; position: relative;
}
.max-card svg { position: absolute; inset: 0; width: 100%; height: 100%; fill: var(--warm); filter: drop-shadow(0 0 18px #ff9a7088); }
/* The number sits in the round of the bulb, below the socket. */
.max-card span { position: relative; font-size: 60px; font-weight: 700; color: var(--ink); padding-top: 44px; }
.talk { margin: 0; background: var(--card); color: var(--ink); border-radius: var(--radius); padding: 14px 16px; font-size: 19px; max-width: 560px; }
#finish .big { max-width: 560px; }

/* Phones on their side and short screens: the card and the cards to pick sit on the left, the strings on the right. */
@media (orientation: landscape) and (max-height: 560px) {
  .top { min-height: 56px; padding-top: max(6px, env(safe-area-inset-top)); }
  main { max-width: none; }
  #play-screen {
    grid-template-columns: minmax(220px, 34%) 1fr; grid-template-rows: auto 1fr auto; gap: 10px 16px;
    height: calc(100dvh - 72px); min-height: 0;
  }
  .dots { grid-column: 1; justify-content: flex-start; }
  .head { grid-column: 1; flex-direction: column; align-items: flex-start; gap: 8px; }
  .card { height: 80px; min-width: 80px; font-size: 48px; }
  .card.long { font-size: 34px; }
  .ask { font-size: 20px; }
  .strings { grid-column: 2; grid-row: 1 / 4; }
  .foot { grid-column: 1; grid-row: 3; }
  .options { gap: 8px; }
  .num { min-height: 72px; font-size: 38px; }
  .big.next { min-height: 64px; font-size: 26px; }
  #finish { grid-template-columns: auto 1fr; text-align: left; justify-items: start; align-items: center; }
  #finish .cheer, #finish .talk, #finish .big, #done-line { grid-column: 2; }
  .max-card { grid-column: 1; grid-row: 1 / 6; }
}
