/*
 * Tollamus Kids · Color play — kids.css
 *
 * One stylesheet for the whole page. The room (wall, window, shelf, floor, rug)
 * is drawn in CSS so the page needs no image files; the kitten is an SVG symbol
 * in index.html. Sizes for phones come in the media queries at the end.
 */

:root {
  font-family: ui-rounded, "Arial Rounded MT Bold", "Trebuchet MS", system-ui, sans-serif;
  color: #28473d;
  background: #f7f3e8;
  font-synthesis: none;
  --ink: #28473d;
  --teal: #237d70;
  --muted: #788576;
  --line: #dce1d1;
}
* { box-sizing: border-box; }
body { margin: 0; }
button, input { font: inherit; }
button { color: inherit; cursor: pointer; touch-action: manipulation; -webkit-tap-highlight-color: transparent; border: 0; }
button:disabled { cursor: default; opacity: .45; }
button:focus-visible, a:focus-visible, input:focus-visible { outline: 4px solid #7fa7de; outline-offset: 4px; }
svg { display: block; pointer-events: none; }
[hidden] { display: none !important; }

/* Little hands tap, press and drag all over the page. Without this, a long press
   selects the speech bubble's words or opens the iPad's callout menu. Dialogs keep
   normal selection so a grown-up can type the password. */
.app, .cover { -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }

/* ---- Page frame ------------------------------------------------------------ */
.app { width: min(1120px, 100%); margin: auto; padding: 22px 28px 16px; }
.header { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 21px; }
.brand { font-weight: 900; font-size: 25px; letter-spacing: -1px; display: flex; align-items: center; gap: 7px; }
.brand b { color: #e88748; }
.spark { height: 28px; width: 24px; color: #e7b445; }
.tools { display: flex; gap: 10px; }
.tool { background: #ebeede; border: 1px solid #dce1d1; border-radius: 50%; height: 44px; width: 44px; display: grid; place-items: center; }
.tool svg { width: 19px; height: 19px; }
.teacher-btn { border-radius: 24px; width: auto; display: flex; gap: 7px; padding: 0 15px; font-size: 12px; font-weight: 700; background: transparent; }
.heading { display: flex; align-items: end; justify-content: space-between; margin: 0 5px 15px; gap: 12px; }
.heading h1 { font-size: 28px; letter-spacing: -.8px; margin: 0 0 5px; }
.heading p { font-size: 13px; color: var(--muted); margin: 0; }
.pill { font-size: 10px; letter-spacing: 1px; font-weight: 800; color: #73816e; background: #e9eddf; padding: 7px 11px; border-radius: 20px; white-space: nowrap; }
.pill.teacher-mode { background: #f2ead6; color: #846b46; }
.footer { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 15px 5px 0; color: #7d8877; font-size: 11px; }
.footer button { background: transparent; font-size: 11px; padding: 0; color: #6b7f69; border-bottom: 1px solid #c4cbb7; }
.source-note { font-size: 10px; color: #9aa48d; letter-spacing: .7px; margin: 22px 5px 0; }

/* ---- The room -------------------------------------------------------------- */
.playroom { height: clamp(470px, 73svh, 690px); min-height: 470px; max-height: 780px; position: relative; border: 1px solid #d7decd; border-radius: 30px; overflow: hidden; isolation: isolate; background: #efe9d5; box-shadow: 0 12px 40px #3e51380b; }
.wall { position: absolute; inset: 0 0 35%; background: linear-gradient(110deg, #f4efda, #e5ebd7); }
.wall:after { content: ''; position: absolute; inset: 0; background-image: radial-gradient(#9d9d6d13 1px, transparent 1px); background-size: 8px 8px; }
.baseboard { position: absolute; bottom: 35%; height: 10px; background: #c8b890; left: 0; right: 0; box-shadow: 0 3px 0 #a58b5a24; }
.floor { position: absolute; bottom: 0; height: 35%; width: 100%; background: repeating-linear-gradient(90deg, transparent 0, transparent 174px, #a9875818 175px, #a9875818 177px), linear-gradient(#dbc198, #e8d4b2); }
.window { position: absolute; top: 9%; left: 11%; width: 154px; height: 169px; border: 9px solid #e0cda7; outline: 1px solid #c9b58d; border-radius: 56px 56px 5px 5px; background: #bce1dc; box-shadow: 7px 7px 0 #6c724811; overflow: hidden; }
.window:before { content: ''; position: absolute; width: 150px; height: 90px; border-radius: 50%; background: #87b68b; bottom: -45px; left: -20px; box-shadow: 75px 0 0 #a2c595; }
.window:after { content: ''; position: absolute; top: 0; bottom: 0; width: 7px; background: #e0cda7; left: 50%; transform: translateX(-50%); }
.sun { position: absolute; top: 23px; right: 18px; width: 31px; height: 31px; border-radius: 50%; background: #f8d67d; }
.cloud { position: absolute; top: 40px; left: 12px; width: 48px; height: 12px; border-radius: 30px; background: #ffffffb0; }
.cloud:before { content: ''; position: absolute; width: 24px; height: 24px; left: 11px; bottom: 0; background: #ffffff90; border-radius: 50%; }
.shelf { position: absolute; right: 12%; top: 18%; display: flex; align-items: flex-end; gap: 7px; width: 120px; border-bottom: 8px solid #c7a477; padding-left: 8px; box-shadow: 0 5px 0 #8c764914; }
.book { width: 17px; height: 51px; background: #7fa58e; border-radius: 3px 3px 0 0; }
.book:nth-child(2) { height: 61px; background: #dc9a6b; transform: rotate(-8deg); }
.book:nth-child(3) { height: 44px; background: #b5b97c; }
.vase { position: relative; width: 27px; height: 30px; background: #d5ac78; border-radius: 5px 5px 11px 11px; margin-left: 8px; }
.vase:before, .vase:after { content: ''; position: absolute; width: 16px; height: 27px; bottom: 22px; left: 0; border-radius: 90% 5% 90% 5%; background: #73976c; transform: rotate(-20deg); }
.vase:after { transform: rotate(75deg); left: 12px; bottom: 24px; }
.rug { position: absolute; width: 83%; height: 26%; left: 8.5%; bottom: 4%; border-radius: 50%; background: #e4ab7f62; border: 8px solid #edc6a15c; box-shadow: inset 0 0 0 3px #b37c4818; }

/* ---- The kitten and its speech bubble --------------------------------------- */
.cat { position: absolute; left: 18%; bottom: 34%; height: 190px; width: 210px; z-index: 2; }
.cat svg { height: 100%; width: 100%; overflow: visible; }
.cat.happy { animation: catHappy .6s ease; }
.tail { transform-origin: 146px 128px; animation: tail 4s ease-in-out infinite; }
.eye { animation: blink 7s infinite; }
.bubble { position: absolute; left: 40%; bottom: 52%; background: #fffdf6; padding: 13px 20px; border-radius: 21px 21px 21px 3px; font-size: 22px; font-weight: 800; box-shadow: 0 5px 15px #52613b0b; max-width: 44%; text-align: center; z-index: 3; min-width: 110px; }
.bubble:after { content: ''; position: absolute; left: -10px; bottom: 0; border: 8px solid transparent; border-bottom-color: #fffdf6; }
.replay { position: absolute; right: 20px; top: 18px; display: grid; place-items: center; border-radius: 50%; width: 57px; height: 57px; background: #fffdf4; color: #277e71; box-shadow: 0 3px 0 #345c3d12; z-index: 5; }
.replay svg { width: 26px; height: 26px; }
.round-dots { position: absolute; left: 22px; top: 27px; display: flex; gap: 8px; align-items: center; }
.round-dots i { display: block; width: 10px; height: 10px; background: #c9d1bb; border-radius: 50%; }
.round-dots i.done { background: #618d65; box-shadow: 0 0 0 4px #618d6513; }

/* ---- The basket -------------------------------------------------------------
   The wrapper places the basket in the room. Inside it, the pile of balls sits
   behind the basket (z-index 1 under 2), so the lower part of each ball hides
   behind the rim and the balls look as if they are in the basket. */
.basket-wrap { position: absolute; left: 69%; top: 48%; width: 148px; height: 106px; transform: translateX(-50%); z-index: 3; }
.basket { position: relative; z-index: 2; display: block; width: 100%; height: 100%; padding: 0; border-radius: 9px 9px 37px 37px; background: repeating-linear-gradient(0deg, transparent 0, transparent 13px, #f4d5a570 14px, #f4d5a570 18px), repeating-linear-gradient(90deg, #c49b6e 0, #c49b6e 17px, #ddba8c 18px, #ddba8c 23px); border: 4px solid #a47c53; border-top: 12px solid #aa8057; box-shadow: inset 0 4px 0 #72573618, 0 8px 0 #81643b13; transition: filter .2s, outline .15s; }
.basket:before { content: ''; position: absolute; left: 21px; right: 21px; top: -60px; height: 62px; border: 8px solid #b58a5d; border-bottom: 0; border-radius: 60px 60px 0 0; z-index: -1; }
.basket.over { outline: 4px dashed #568570; outline-offset: 9px; filter: brightness(1.08); }
.basket.ready { outline: 3px dashed #9caf82; outline-offset: 8px; }
/* The pile's bottom edge is the rim's top edge. kids.js gives each ball a left and
   a bottom in pixels; bottoms below zero sit behind the basket's front. */
.pile { position: absolute; left: -2px; right: -2px; bottom: 100%; height: 0; z-index: 1; pointer-events: none; }
.pile .ball { position: absolute; transform: var(--spin, none); }
.pile .ball.drop { animation: drop .35s cubic-bezier(.3, 1.4, .5, 1); }

/* ---- Balls ------------------------------------------------------------------ */
.toys { position: absolute; left: 10%; right: 10%; bottom: 7%; display: flex; justify-content: space-evenly; gap: 25px; z-index: 4; }
.toy { background: transparent; border-radius: 28px; padding: 15px 20px; min-width: 108px; min-height: 111px; touch-action: none; transition: opacity .2s, background .2s; }
.toy:hover { background: #fff9e32e; }
.toy.selected { outline: 3px dashed #456e61; outline-offset: 1px; background: #fff9e340; }
.toy.placed { opacity: 0; pointer-events: none; }
.toy.drag-origin { opacity: .15; }
/* --ring outlines a ball that would vanish against the cream room (white). */
.ball { width: 78px; height: 78px; display: block; border-radius: 50%; background: var(--color); box-shadow: inset 0 0 0 2px var(--ring, transparent), inset -10px -8px 0 #0000000c, 0 7px 0 #805c2e16; position: relative; pointer-events: none; }
.ball:before { content: ''; position: absolute; width: 19px; height: 11px; left: 17px; top: 11px; border-radius: 50%; background: #ffffff60; transform: rotate(-35deg); }
.ball:after { content: ''; position: absolute; border: 2px solid #ffffff40; border-top: 0; border-bottom: 0; border-radius: 50%; inset: 0 17px; transform: rotate(30deg); }
/* Five or more balls: kids.js measures the floor and sets --cell (each ball's tap
   area), --ball (its size) and --pady (vertical padding). Highlights switch to
   percentages so small balls keep their shine in proportion. Pile balls do too. */
.toys.many { left: 3%; right: 3%; gap: 0; flex-wrap: wrap; justify-content: center; }
.toys.many .toy { width: var(--cell); min-width: 0; min-height: 0; padding: var(--pady, 11px) 0; display: grid; place-items: center; border-radius: 18px; }
.toys.many .ball { width: var(--ball); height: var(--ball); }
.toys.many .ball:before, .pile .ball:before { left: 22%; top: 14%; width: 24%; height: 14%; }
.toys.many .ball:after, .pile .ball:after { inset: 0 22%; }
.drag-ghost { position: fixed; pointer-events: none; z-index: 1000; transform: translate(-50%, -50%); filter: drop-shadow(0 10px 7px #0002); }

.cue { position: absolute; left: 50%; bottom: 9px; transform: translateX(-50%); font-size: 12px; font-weight: 700; color: #52664c; background: #fff9e4b0; padding: 6px 12px; border-radius: 20px; white-space: nowrap; max-width: 90%; z-index: 4; }

/* ---- Covers: welcome, break, sound trouble, the end --------------------------- */
.cover { position: fixed; inset: 0; z-index: 30; background: #f7f3e8f2; backdrop-filter: blur(8px); display: flex; align-items: center; justify-content: center; padding: 25px; overflow: auto; }
.cover-card { max-width: 490px; text-align: center; }
.cover-cat { height: 155px; width: 165px; margin: 0 auto 16px; }
.cover-cat svg { width: 100%; height: 100%; }
.cover h2 { font-size: 38px; line-height: 1.15; margin: 0 0 14px; letter-spacing: -1.4px; }
.cover p { font-size: 15px; line-height: 1.65; color: #7a8675; margin: 0 0 22px; }
.cover small { display: block; color: #87917e; font-size: 11px; line-height: 1.6; margin: 19px auto 0; max-width: 360px; }
.primary { border-radius: 30px; background: var(--teal); color: #fff; padding: 15px 27px; display: inline-flex; align-items: center; justify-content: center; gap: 12px; font-weight: 800; font-size: 17px; min-height: 56px; }
.primary svg { height: 21px; width: 21px; }
.text-btn { display: block; margin: 18px auto 0; padding: 4px; background: transparent; color: #6c806b; font-size: 12px; text-decoration: underline; text-underline-offset: 4px; }
.badge { display: inline-block; background: #f1ecdd; padding: 7px 12px; border-radius: 20px; color: #846b46; font-size: 11px; margin-bottom: 17px; }
.badge.ready { background: #e7efdc; color: #58805e; }
.room-cover { position: absolute; background: #f8f4e9ed; z-index: 10; }
.room-cover .cover-card { max-width: 400px; }
.room-cover h2 { font-size: 31px; }
.error-cover h2 { font-size: 26px; }
.error-cover p { font-size: 13px; }
/* The ending card sits on the empty floor, so the kitten and the full basket stay in view. */
.end-cover { background: #f8f4e933; backdrop-filter: none; align-items: flex-end; padding: 0 20px 4%; }
.end-cover .cover-card { max-width: 560px; background: #fffdf6f2; border-radius: 28px; padding: 18px 34px 22px; box-shadow: 0 14px 40px #3e51381a; }
.end-cover h2 { font-size: 30px; margin-bottom: 4px; }
.end-cover p { margin-bottom: 14px; }
.end-spark { color: #e4b64c; font-size: 28px; line-height: 1; margin-bottom: 4px; }

.petal { position: absolute; width: 9px; height: 16px; border-radius: 6px; background: var(--c); pointer-events: none; z-index: 12; top: 30%; animation: fall 1.3s ease-out forwards; }
.nudge { animation: nudge .4s; }

/* ---- Teacher setup and the grown-up gate ---------------------------------------
   A 5-second press fills a bar along the button's foot, then asks for the password. */
.hold { position: relative; overflow: hidden; touch-action: none; }
.hold:after { content: ''; position: absolute; left: 0; bottom: 0; height: 3px; width: 0; background: var(--teal); }
.hold.holding:after { width: 100%; transition: width 5s linear; }
dialog { border: 1px solid #d4dccb; border-radius: 24px; background: #fffdf6; color: var(--ink); width: min(600px, calc(100% - 28px)); max-height: 90svh; overflow: auto; padding: 27px; box-shadow: 0 25px 90px #173e3238; }
dialog::backdrop { background: #183d3266; backdrop-filter: blur(4px); }
#gate { width: min(390px, calc(100% - 28px)); }
.dialog-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.dialog-head h2 { font-size: 25px; margin: 0; letter-spacing: -.6px; }
.close { height: 38px; width: 38px; background: #e9eddf; border-radius: 50%; font-size: 25px; }
.explain { font-size: 13px; line-height: 1.65; color: #71806e; margin: 0 0 17px; }
.gate-row { display: flex; gap: 8px; align-items: center; }
.gate-row input { flex: 1; min-width: 0; min-height: 48px; border: 1px solid #d4dccb; border-radius: 14px; padding: 0 14px; background: #f6f4ea; color: var(--ink); }
.gate-row .primary { font-size: 14px; min-height: 48px; padding: 0 20px; }
.message { font-size: 12px; line-height: 1.6; margin-top: 9px; white-space: pre-line; color: #a36e42; }
.setup-section { border-top: 1px solid #e3e6d8; padding: 17px 0; }
.setup-section h3 { font-size: 15px; margin: 0 0 8px; }
.setup-section p { font-size: 12px; line-height: 1.65; color: #77816f; margin: 7px 0; }
.setup-note { font-size: 12px; padding: 10px 12px; background: #f1ecdd; border-radius: 10px; line-height: 1.6; margin: 12px 0; }
.setup-note.ready { background: #e7efdc; }
.check-row { display: flex; justify-content: space-between; gap: 20px; align-items: center; font-size: 13px; margin: 14px 0; }
.check-row input { width: 23px; height: 23px; accent-color: var(--teal); }
.audio-list { display: grid; grid-template-columns: 1fr 1fr; gap: 3px 15px; margin-top: 13px; }
.audio-row { display: flex; align-items: center; gap: 7px; padding: 6px 0; font-size: 12px; min-width: 0; }
.audio-row span { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.audio-row b { font-size: 10px; color: #a0865d; white-space: nowrap; }
.audio-row b.loaded { color: #518063; }
.audio-row button { font-size: 12px; width: 29px; height: 29px; background: #edf0e3; border-radius: 50%; flex-shrink: 0; }
.audio-row button:disabled { opacity: .25; }
.small-button { display: inline-flex; align-items: center; justify-content: center; padding: 11px 15px; min-height: 44px; background: #e4eddb; border-radius: 22px; font-size: 12px; font-weight: 700; margin: 5px 6px 5px 0; color: var(--ink); }
.fine { font-size: 11px; color: #8a947e; line-height: 1.6; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0, 0, 0, 0); }

/* ---- Motion ------------------------------------------------------------------ */
@keyframes tail { 0%, 100% { transform: rotate(-5deg); } 50% { transform: rotate(9deg); } }
@keyframes blink { 0%, 42%, 46%, 100% { opacity: 1; } 44% { opacity: 0; } }
@keyframes catHappy { 0%, 100% { transform: translateY(0) rotate(0); } 40% { transform: translateY(-12px) rotate(-4deg); } 70% { transform: translateY(-4px) rotate(3deg); } }
@keyframes nudge { 0%, 100% { transform: translateX(0); } 25% { transform: translateX(-6px); } 75% { transform: translateX(6px); } }
@keyframes fall { 0% { opacity: 0; transform: translateY(0) rotate(0); } 10% { opacity: 1; } 100% { opacity: 0; transform: translateY(180px) rotate(200deg); } }
@keyframes drop { 0% { transform: translateY(-40px) var(--spin, rotate(0)); opacity: .4; } 100% { transform: translateY(0) var(--spin, rotate(0)); opacity: 1; } }

/* ---- Phones and short screens -------------------------------------------------- */
@media (max-width: 720px) {
  .app { padding: 15px 14px 12px; }
  .header { margin-bottom: 17px; }
  .brand { font-size: 23px; }
  .brand .spark { width: 21px; height: 25px; }
  .teacher-btn { font-size: 11px; padding: 0 11px; }
  .tools { gap: 7px; }
  .tool { height: 41px; min-width: 41px; }
  .heading { margin: 0 3px 12px; }
  .heading h1 { font-size: 24px; }
  .heading p { font-size: 11px; max-width: 240px; line-height: 1.5; }
  .pill { font-size: 8px; padding: 6px 9px; letter-spacing: .7px; }
  .playroom { border-radius: 24px; height: clamp(470px, 72svh, 620px); }
  .window { width: 112px; height: 141px; left: 9%; top: 13%; border-width: 7px; }
  .shelf { right: 8%; top: 23%; transform: scale(.75); transform-origin: right top; }
  .cat { left: 8%; bottom: 34%; width: 154px; height: 145px; }
  .bubble { left: 46%; bottom: 51%; font-size: 18px; padding: 11px 14px; max-width: 46%; }
  .basket-wrap { left: 72%; top: 56%; width: 113px; height: 83px; }
  .basket { border-width: 3px; border-top-width: 9px; border-radius: 5px 5px 27px 27px; }
  .basket:before { height: 48px; top: -46px; left: 18px; right: 18px; border-width: 6px; }
  .toys { left: 3%; right: 3%; bottom: 7%; gap: 6px; }
  .toy { padding: 14px 10px; min-width: 85px; min-height: 94px; border-radius: 23px; }
  .ball { height: 66px; width: 66px; }
  .ball:before { left: 14px; top: 10px; width: 16px; height: 9px; }
  .ball:after { inset: 0 14px; }
  .round-dots { top: 28px; left: 19px; }
  .round-dots i { width: 8px; height: 8px; }
  .replay { width: 52px; height: 52px; top: 17px; right: 17px; }
  .cue { font-size: 10px; bottom: 9px; padding: 5px 9px; }
  .footer { font-size: 10px; line-height: 1.5; margin-top: 12px; }
  .footer button { font-size: 10px; white-space: nowrap; }
  .source-note { font-size: 9px; margin-top: 18px; }
  .cover h2 { font-size: 34px; }
  .cover p { font-size: 14px; }
  .cover-cat { height: 140px; width: 150px; }
  .cover small { font-size: 10px; }
  .end-cover .cover-card { padding: 14px 18px 18px; }
  .end-cover h2 { font-size: 23px; }
  .end-cover p { font-size: 13px; margin-bottom: 10px; }
  .end-cover .primary { min-height: 48px; padding: 11px 22px; font-size: 16px; }
  .audio-list { grid-template-columns: 1fr; }
  dialog { padding: 21px; }
  .dialog-head h2 { font-size: 22px; }
}
@media (max-width: 370px) {
  .app { padding: 12px 10px; }
  .brand { font-size: 21px; }
  .heading h1 { font-size: 22px; }
  .teacher-btn { font-size: 10px; }
  .pill { display: none; }
  .cat { left: 5%; width: 140px; height: 135px; }
  .bubble { left: 45%; font-size: 16px; }
  .toy { min-width: 77px; padding: 13px 8px; }
  .ball { height: 60px; width: 60px; }
  .basket-wrap { width: 103px; left: 73%; }
}
@media (max-height: 660px) and (min-width: 721px) {
  .app { padding-top: 12px; }
  .header { margin-bottom: 10px; }
  .heading { margin-bottom: 9px; }
  .heading h1 { font-size: 22px; }
  .heading p { display: none; }
  .playroom { height: 74svh; min-height: 360px; }
  .cat { bottom: 34%; height: 160px; width: 180px; }
  .bubble { bottom: 52%; }
  .window { top: 8%; height: 130px; width: 127px; }
  .ball { height: 65px; width: 65px; }
  .toys { bottom: 5%; }
  .basket-wrap { height: 85px; width: 125px; top: 49%; }
  .basket:before { height: 48px; top: -46px; }
  .cue { bottom: 4px; font-size: 10px; }
  .source-note { display: none; }
  .footer { margin-top: 9px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *:before, *:after { animation: none !important; transition: none !important; }
}
.sprites { position: absolute; width: 0; height: 0; overflow: hidden; }
