/* Shadowing and IPA pages. Word marks and the microphone use the class names from game-speech.js. */
body.speak-page { background: var(--vg-night); color: var(--vg-text); font-family: 'Be Vietnam Pro', system-ui, sans-serif; }
.speak-main { max-width: 860px; margin: 0 auto; padding: 24px 16px 110px; display: grid; gap: 18px; }
.speak-hero { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.speak-hero p { margin: 6px 0 0; color: var(--vg-text-2); font-size: 16px; line-height: 1.5; }
.speak-otter { width: 104px; height: auto; flex: none; }

.speak-levels { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 4px; }
.speak-level { flex: none; min-height: 44px; padding: 8px 16px; border: 1px solid rgba(255, 255, 255, .18); border-radius: 999px; background: rgba(255, 255, 255, .06); color: var(--vg-text); font: 700 15px 'Be Vietnam Pro', system-ui, sans-serif; cursor: pointer; }
.speak-level[aria-selected="true"] { background: var(--vg-gold, #f5b82e); border-color: transparent; color: var(--vg-night); }
.speak-progress { margin: 0; color: var(--vg-text-2); font-size: 15px; }

.speak-card { display: grid; gap: 16px; padding: 22px 20px; border-radius: 20px; background: var(--vg-night-2); border: 1px solid rgba(255, 255, 255, .1); }
.speak-card-head { display: flex; flex-wrap: wrap; gap: 8px; min-height: 0; }
.speak-card-head:empty { display: none; }
.speak-done { background: rgba(47, 227, 154, .18); color: #7dffc4; }
.speak-row { display: flex; flex-wrap: wrap; gap: 10px; }
.speak-row:empty, .speak-result:empty { display: none; }
.speak-status { margin: 0; text-align: center; color: var(--vg-text-2); font-size: 15px; line-height: 1.5; }
.speak-mic { display: grid; place-items: center; padding: 8px 0; }
.speak-score { margin: 0; font: 800 44px/1 var(--vg-display); text-align: center; }
.speak-score.pass { color: #7dffc4; }
.speak-score.again { color: var(--vg-gold, #f5b82e); }
.speak-finish { display: grid; gap: 12px; justify-items: start; }
.speak-finish p { margin: 0; color: var(--vg-text-2); }

.sp-sentence { margin: 0; font: 700 clamp(22px, 5vw, 30px)/1.4 var(--vg-display); color: #fff; }
.sp-word { display: inline-block; border-radius: 8px; padding: 0 3px; transition: background .25s, color .25s; }
.sp-word.watch { text-decoration: underline dotted var(--vg-gold, #f5b82e) 3px; text-underline-offset: 7px; }
.sp-word.ok { color: #7dffc4; background: rgba(47, 227, 154, .14); }
.sp-word.bad { color: #ffb3c1; background: rgba(255, 77, 109, .2); text-decoration: underline wavy #ff4d6d 2px; text-underline-offset: 6px; }
.sp-word.miss { color: #ff8da1; background: rgba(255, 77, 109, .12); text-decoration: line-through 3px #ff4d6d; }
.sp-practise { margin-top: 10px; padding: 12px 14px; border-radius: 14px; background: rgba(255, 77, 109, .1); border: 1px solid rgba(255, 77, 109, .35); }
.sp-practise strong { display: block; margin-bottom: 6px; font-size: 14px; }
.sp-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.sp-chip { padding: 4px 12px; border-radius: 999px; background: rgba(255, 77, 109, .22); font-weight: 800; font-size: 14px; }
.sp-mic { position: relative; display: grid; place-items: center; width: 96px; height: 96px; padding: 0; border: 0; border-radius: 50%; background: var(--vg-gold, #f5b82e); cursor: pointer; box-shadow: 0 0 0 calc(var(--lvl, 0) * 18px) rgba(245, 184, 46, .28); transition: box-shadow .08s; }
.sp-mic[data-state="rec"] { background: #ff4d6d; }
.sp-mic[data-state="wait"] { opacity: .6; pointer-events: none; }
.sp-mic:focus-visible { outline: 3px solid var(--vg-aqua); outline-offset: 4px; }
.sp-mic-icon { font-size: 38px; }
.sp-mic-ring, .sp-mic-time { display: none; }

.ipa-group { display: grid; gap: 10px; }
.ipa-group h2 { margin: 0; font: 800 20px/1.3 var(--vg-display); color: var(--vg-text); }
.ipa-tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); gap: 8px; }
.ipa-tile { display: grid; justify-items: center; gap: 2px; padding: 12px 4px; border-radius: 14px; background: var(--vg-night-2); border: 1px solid rgba(255, 255, 255, .12); color: var(--vg-text); text-decoration: none; }
.ipa-tile:hover, .ipa-tile:focus-visible { border-color: var(--vg-gold, #f5b82e); }
.ipa-tile strong { font-size: 24px; font-family: 'Segoe UI', Roboto, 'Noto Sans', Arial, sans-serif; font-weight: 700; color: #fff; }
.ipa-tile small { font-size: 14px; color: var(--vg-text-2); }
.ipa-note { margin: 0; color: var(--vg-text-3); font-size: 14px; }
.ipa-details[hidden] { display: none; }
.ipa-details { display: grid; gap: 14px; }
.ipa-details > h2 { margin: 0; font: 800 20px/1.3 var(--vg-display); }

.ipa-dialog { width: min(560px, calc(100vw - 24px)); max-height: 86vh; padding: 22px 18px; border: 1px solid rgba(255, 255, 255, .16); border-radius: 20px; background: var(--vg-night-2); color: var(--vg-text); }
.ipa-dialog::backdrop { background: rgba(8, 5, 25, .72); }
.ipa-close { position: absolute; top: 10px; right: 10px; width: 44px; height: 44px; border: 0; border-radius: 50%; background: rgba(255, 255, 255, .1); color: var(--vg-text); font-size: 18px; cursor: pointer; }
.ipa-sound { display: grid; gap: 10px; }
.ipa-sound h3 { margin: 0; }
.ipa-symbol { font: 700 44px/1.1 'Segoe UI', Roboto, 'Noto Sans', Arial, sans-serif; color: var(--vg-gold, #f5b82e); }
.ipa-sound h4 { margin: 8px 0 0; font-size: 14px; font-weight: 700; color: var(--vg-text-2); }
.ipa-tip { margin: 0; font-size: 16px; line-height: 1.55; }
.ipa-words { display: grid; gap: 8px; }
.ipa-word { display: grid; grid-template-columns: 44px 1fr 44px; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 14px; background: rgba(255, 255, 255, .06); }
.ipa-play, .ipa-mic { width: 44px; height: 44px; border: 0; border-radius: 50%; font-size: 18px; cursor: pointer; }
.ipa-play { background: var(--vg-violet-lite, #b8a8ff); color: var(--vg-night); }
.ipa-mic { background: var(--vg-gold, #f5b82e); }
.ipa-mic[data-state="rec"] { background: #ff4d6d; }
.ipa-word-text { display: grid; }
.ipa-word-text strong { font-size: 17px; color: #fff; }
.ipa-word-text small { font: 14px 'Segoe UI', Roboto, 'Noto Sans', Arial, sans-serif; color: var(--vg-text-2); }
.ipa-result { grid-column: 1 / -1; font-size: 14px; color: var(--vg-text-2); }
.ipa-result:empty { display: none; }
.ipa-result a { color: var(--vg-gold, #f5b82e); font-weight: 700; }
.ipa-result.pass { color: #7dffc4; font-weight: 700; }
.ipa-result.again { color: var(--vg-gold, #f5b82e); font-weight: 700; }

/* Motion for these two pages (the shared layer is study-motion.css). */
.speak-otter { transition: scale .2s; }
.speak-dots { display: inline-flex; gap: 5px; margin-right: 10px; vertical-align: middle; }
.speak-dots i { width: 10px; height: 10px; border-radius: 50%; background: rgba(255, 255, 255, .18); transition: background .3s; }
.speak-dots i.on { background: #7dffc4; box-shadow: 0 0 10px rgba(125, 255, 196, .7); }
.speak-level { transition: background .2s, color .2s, scale .22s cubic-bezier(.3, 1.6, .5, 1); }
.sp-word.now { background: rgba(245, 184, 46, .28); color: #fff; scale: 1.05; }
.sp-word { transition: background .12s, color .12s, scale .12s; }
.sp-sentence.marked .sp-word { animation: sp-mark .42s cubic-bezier(.3, 1.6, .5, 1) backwards; animation-delay: calc(var(--i, 0) * 55ms); }
@keyframes sp-mark { from { scale: .7; opacity: .3; } }
.speak-playing { box-shadow: 0 0 0 3px rgba(255, 255, 255, .35); animation: speak-glow 1s ease-in-out infinite; }
@keyframes speak-glow { 50% { filter: brightness(1.2); } }
.sp-mic:not([data-state]), .sp-mic[data-state=""] { animation: speak-breathe 2.2s ease-in-out infinite; }
@keyframes speak-breathe { 50% { box-shadow: 0 0 0 14px rgba(245, 184, 46, .18); } }
.sp-mic[data-state="wait"] .sp-mic-icon { animation: speak-spin 1s linear infinite; }
@keyframes speak-spin { to { rotate: 360deg; } }
.ipa-count { margin: 0; padding: 10px 14px; border-radius: 12px; font-weight: 700; font-size: 15px; background: linear-gradient(90deg, rgba(125, 255, 196, .22) calc(var(--done, 0) * 100%), rgba(255, 255, 255, .06) 0); transition: background .4s; }
.ipa-tile { position: relative; transition: scale .22s cubic-bezier(.3, 1.6, .5, 1), border-color .2s, translate .2s; }
@media (hover: hover) { .ipa-tile:hover { translate: 0 -3px; } }
.ipa-tile.practised { border-color: #7dffc4; }
.ipa-tile.practised::after { content: '✓'; position: absolute; top: 4px; right: 8px; color: #7dffc4; font-size: 13px; font-weight: 800; }
.ipa-dialog[open] { animation: ipa-spring .34s cubic-bezier(.2, 1.3, .4, 1); }
.ipa-dialog[open]::backdrop { animation: ipa-fade .25s ease-out; }
@keyframes ipa-spring { from { opacity: 0; translate: 0 40px; scale: .92; } }
@keyframes ipa-fade { from { opacity: 0; } }
.ipa-dialog[open] .ipa-symbol { display: inline-block; animation: ipa-symbol .5s cubic-bezier(.3, 1.8, .5, 1) .08s backwards; }
@keyframes ipa-symbol { from { scale: .4; rotate: -8deg; opacity: 0; } }
.ipa-dialog[open] .ipa-word { animation: ipa-row .35s ease-out backwards; }
.ipa-dialog[open] .ipa-word:nth-child(2) { animation-delay: .06s; }
.ipa-dialog[open] .ipa-word:nth-child(3) { animation-delay: .12s; }
@keyframes ipa-row { from { opacity: 0; translate: 16px 0; } }
.ipa-play.playing { animation: ipa-playing .7s ease-out infinite; }
@keyframes ipa-playing { to { box-shadow: 0 0 0 14px rgba(184, 168, 255, 0); } from { box-shadow: 0 0 0 0 rgba(184, 168, 255, .6); } }
.ipa-mic[data-state="rec"] { animation: ipa-recording .8s ease-out infinite; }
@keyframes ipa-recording { to { box-shadow: 0 0 0 14px rgba(255, 77, 109, 0); } from { box-shadow: 0 0 0 0 rgba(255, 77, 109, .6); } }
@media (prefers-reduced-motion: reduce) {
  .speak-playing, .sp-mic, .sp-mic-icon, .sp-sentence.marked .sp-word, .ipa-dialog[open], .ipa-dialog[open]::backdrop, .ipa-symbol, .ipa-word, .ipa-play.playing, .ipa-mic[data-state="rec"] { animation: none !important; }
  .sp-word.now { scale: 1; }
}

/* /θ/ is not /Θ/: a heading style must never change a phonetic symbol. */
.ipa-sound h3, .ipa-symbol, .ipa-tile strong, .ipa-word-text small { text-transform: none !important; }
.sp-mic, .ipa-play, .ipa-mic, .ipa-close { border-radius: 50% !important; }
.speak-level { border-radius: 999px !important; }
.ipa-tile, .ipa-word, .speak-card, .ipa-dialog { border-radius: 16px !important; }
.speak-dots i { border-radius: 50% !important; }

.ipa-own { margin: 6px 6px 0 0; min-height: 40px; padding: 6px 12px; border: 1px solid rgba(255, 255, 255, .25); border-radius: 999px !important; background: rgba(255, 255, 255, .08); color: var(--vg-text); font: 700 14px 'Be Vietnam Pro', system-ui, sans-serif; cursor: pointer; }
.ipa-result { display: block; }
.speak-caveat { margin: 8px 0 0; font-size: 13px; line-height: 1.5; color: var(--vg-text-3); }
