/* Reading aloud (talk.js) and the Voice Studio (kids/voices.js).
   The 🔊 buttons are sunny yellow everywhere, so a child learns one thing: "the yellow button talks". */

/* ---------- the "say it" button ---------- */
.kbtn.talk-btn { --c: #ffb020; color: #2a1a00; }
.kbtn.talk-btn .e { font-size: 1.25em; line-height: 1; }
.kbtn.talk-btn.round { width: max(44px, calc(46px * var(--k))); min-height: max(44px, calc(46px * var(--k))); padding: 0; flex: none; border-radius: 50%; font-size: calc(17px * var(--k)); }
.kbtn.talk-btn.sm:not(.round) { min-height: max(44px, calc(40px * var(--k))); }
.kbtn.talk-btn.on { outline: 3px solid #fff; outline-offset: 2px; animation: talk-pulse 1.1s ease-in-out infinite; }
@keyframes talk-pulse { 50% { box-shadow: 0 4px 0 color-mix(in srgb, var(--c) 55%, #000), 0 0 0 9px color-mix(in srgb, var(--c) 30%, transparent); } }
.buddy-row > .talk-btn { align-self: center; }
.kbubble.speaking { box-shadow: 0 0 0 4px #ffb020, 0 6px 18px rgba(0, 0, 0, .25); }
.helper .msg.speaking { box-shadow: 0 0 0 3px #ffb020; border-radius: 16px; }

/* ---------- the child's own switch at the top ---------- */
.kstat.talk-toggle { font: inherit; font-size: 22px; line-height: 1; min-width: 50px; min-height: 44px; justify-content: center; padding: 4px 12px; color: var(--text); }
.kstat.talk-toggle.on { background: #ffb020; border-color: #ffb020; box-shadow: 0 3px 0 #b97700; }
.kstat.talk-toggle.locked { border-style: dashed; opacity: .85; }
.kstat.talk-toggle:focus-visible { outline: 3px solid #fff; outline-offset: 2px; }
@media (max-width: 699px) { .kstat.talk-toggle { min-width: 46px; padding: 4px 8px; } }

/* ---------- "tap to hear me": shown until the first tap lets the browser speak ---------- */
.talk-hint { position: fixed; left: 50%; bottom: calc(24px + var(--safe-b)); transform: translateX(-50%); z-index: 64; display: inline-flex; align-items: center; gap: 10px; min-height: 56px; padding: 10px 26px;
  border: 0; border-radius: 999px; background: #ffb020; color: #2a1a00; font: 800 calc(18px * var(--k))/1.1 var(--display, inherit); cursor: pointer; white-space: nowrap; box-shadow: 0 5px 0 #b97700, 0 12px 28px rgba(0, 0, 0, .35); animation: talk-glow 1.4s ease-in-out infinite; }
.talk-hint .e { font-size: 1.5em; }
@keyframes talk-glow { 50% { box-shadow: 0 5px 0 #b97700, 0 12px 28px rgba(0, 0, 0, .35), 0 0 0 12px rgba(255, 176, 32, .35); } }   /* a glow, not a hop: a button that keeps still is easier for small fingers */
@media (max-width: 699px) { .talk-hint { bottom: calc(var(--tabbar) + 16px + var(--safe-b)); } }

/* ---------- Voice Studio ---------- */
.vs-lock { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; } .vs-lock .e { font-size: calc(30px * var(--k)); } .vs-lock .main { flex: 1 1 220px; min-width: 0; } .vs-lock small { display: block; color: var(--muted); }
.vs-stage { overflow: hidden; display: flex; gap: calc(18px * var(--k)); align-items: center; flex-wrap: wrap; }
.vs-fig { flex: 0 0 calc(190px * var(--k)); max-width: 46%; margin: 0 auto; } .vs-fig svg { width: 100%; height: auto; display: block; }
.vs-say { flex: 1 1 280px; min-width: 0; display: grid; gap: 12px; justify-items: start; }
.vs-say .kbubble { font-size: calc(16.5px * var(--k)); max-width: none; justify-self: stretch; }
.vs-who { display: flex; flex-wrap: wrap; gap: 8px; } .vs-who .kchip { min-height: 44px; font-weight: 700; } .vs-who .small { font-weight: 500; opacity: .8; }
.vs-now { color: var(--muted); font-size: calc(13.5px * var(--k)); } .vs-now b { color: var(--text); white-space: nowrap; }
.vs-ai { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border-radius: 14px; font-size: calc(13.5px * var(--k)); justify-self: stretch; background: color-mix(in srgb, var(--blue, #2f8fff) 14%, var(--panel2)); border: 2px solid color-mix(in srgb, var(--blue, #2f8fff) 45%, var(--line)); }
.vs-ai .e { font-size: 22px; line-height: 1.15; }
.vs-group { margin: 16px 0 8px; font-size: calc(14px * var(--k)); color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.vs-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(calc(200px * var(--k)), 1fr)); gap: 12px; }
.vs-card { display: grid; gap: 8px; padding: 10px; border-radius: 20px; border: 2px solid var(--line); background: var(--panel2); min-width: 0; align-content: start; }
.vs-card.heard { border-color: #ffb020; }
.vs-card.on { border-color: var(--gold); background: color-mix(in srgb, var(--gold) 18%, var(--panel2)); box-shadow: 0 0 0 2px var(--gold); }
.vs-hear { display: grid; grid-template-columns: auto minmax(0, 1fr); grid-template-areas: "e main" "play play"; gap: 6px 10px; align-items: center; width: 100%; min-height: 76px; padding: 8px; border: 0; border-radius: 14px; background: transparent; color: var(--text); font: inherit; text-align: left; cursor: pointer; }
.vs-hear:hover { background: color-mix(in srgb, #ffb020 14%, transparent); } .vs-hear:focus-visible { outline: 3px solid var(--gold); outline-offset: 1px; }
.vs-hear .e { grid-area: e; font-size: calc(38px * var(--k)); line-height: 1; } .vs-hear .main { grid-area: main; min-width: 0; } .vs-hear b { display: block; font-size: calc(16px * var(--k)); } .vs-hear small { display: block; color: var(--muted); }
.vs-hear .play { grid-area: play; justify-self: start; padding: 5px 14px; border-radius: 999px; background: #ffb020; color: #2a1a00; font-weight: 800; font-size: calc(13.5px * var(--k)); box-shadow: 0 3px 0 #b97700; }
.vs-card .kbtn { width: 100%; min-height: max(44px, calc(40px * var(--k))); }
.vs-match { grid-template-columns: minmax(0, 1fr) auto; align-items: center; margin-bottom: 4px; } .vs-match .kbtn { width: auto; }
/* reading speed: the same three big choices as in Settings and Accessibility */
.vs-speedrow .kchips { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; } .vs-speedrow .kchip { min-height: max(52px, calc(52px * var(--k))); padding-left: 6px; padding-right: 6px; font-size: calc(15.5px * var(--k)); white-space: nowrap; }
@media (max-width: 379px) { .vs-speedrow .kchip { font-size: 14px; } }
.vs-speed { display: flex; align-items: center; gap: 12px; } .vs-speed > span { font-size: calc(26px * var(--k)); text-align: center; line-height: 1.1; } .vs-speed small { display: block; font-size: 12px; color: var(--muted); }
.vs-speed input[type=range] { flex: 1; min-width: 0; height: 44px; accent-color: #ffb020; cursor: pointer; }
.vs-set { margin: 0; font-size: inherit; font-weight: 400; color: var(--text); flex-wrap: wrap; } label.vs-set { cursor: pointer; }
.vs-set .main { min-width: 150px; } .vs-set .main b { display: block; font-weight: 700; } .vs-set:focus-within .switch > span { outline: 2px solid var(--gold); outline-offset: 2px; }
.vs-selrow label.main { margin: 0; font-size: inherit; font-weight: 400; color: var(--text); flex: 1 1 180px; } .vs-selrow select { flex: 0 1 300px; width: auto; min-width: 190px; max-width: 100%; }
.vs-buddies { display: grid; grid-template-columns: repeat(auto-fill, minmax(calc(78px * var(--k)), 1fr)); gap: 8px; }
.vs-buddy { display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 8px 4px 6px; border-radius: 18px; border: 2px solid var(--line); background: var(--panel2); color: var(--text); font: inherit; font-weight: 700; cursor: pointer; min-height: 44px; }
.vs-buddy .pic { width: calc(56px * var(--k)); aspect-ratio: 1; border-radius: 50%; overflow: hidden; display: grid; place-items: center; background: var(--panel3); } .vs-buddy .pic svg { width: 100%; height: 100%; } .vs-buddy svg.avatar * { animation: none !important; }
.vs-buddy.on, .vs-manner.on { border-color: var(--gold); background: color-mix(in srgb, var(--gold) 18%, var(--panel2)); box-shadow: 0 0 0 2px var(--gold); }
.vs-manners { display: grid; grid-template-columns: repeat(auto-fill, minmax(calc(200px * var(--k)), 1fr)); gap: 8px; }
.vs-manner { display: flex; align-items: center; gap: 12px; width: 100%; min-height: calc(52px * var(--k)); padding: 8px 12px; border-radius: 16px; border: 2px solid var(--line); background: var(--panel2); color: var(--text); text-align: left; font: inherit; cursor: pointer; }
.vs-manner .e { font-size: calc(26px * var(--k)); flex: none; } .vs-manner b { display: block; } .vs-manner small { display: block; color: var(--muted); }
.vs-more > summary { cursor: pointer; font-weight: 700; min-height: 44px; display: flex; align-items: center; gap: 8px; }
@media (max-width: 699px) { .vs-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; } .vs-hear { grid-template-columns: minmax(0, 1fr); grid-template-areas: "e" "main" "play"; } .vs-match { grid-template-columns: minmax(0, 1fr); } .vs-match .kbtn { width: 100%; } .vs-selrow select { flex: 1 1 100%; } .vs-fig { flex-basis: 150px; } }
@media (max-width: 359px) { .vs-grid { grid-template-columns: minmax(0, 1fr); } }

/* ---------- a bot's voice in the AI Lab ---------- */
.ai-voice { display: flex; align-items: flex-end; gap: 10px; flex-wrap: wrap; margin-top: 10px; } .ai-voice label { flex: 1 1 200px; min-width: 0; } .ai-voice select { width: 100%; }
.ai-chat .bot .talk-btn { margin: 6px 0 0; display: flex; }

/* less movement when asked for */
body.calm .talk-hint, body.calm .kbtn.talk-btn.on { animation: none; }
@media (prefers-reduced-motion: reduce) { .talk-hint, .kbtn.talk-btn.on { animation: none; } }
