/* Lingua Quest — special mini-games: trace, speak, battle */
.sp-root { width: 100%; height: 100%; display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 8px 14px 12px; overflow-y: auto; scrollbar-width: none; font-family: var(--font); color: var(--text); }
.sp-root::-webkit-scrollbar { display: none; }
.sp-q { font-size: 16px; font-weight: 800; text-align: center; color: var(--teal); }
.sp-card { width: 100%; max-width: 360px; background: rgba(255, 248, 236, .92); border: 2px solid var(--mint); border-radius: 18px; padding: 10px 14px; display: flex; flex-direction: column; align-items: center; gap: 4px; position: relative; box-shadow: 0 3px 0 rgba(61, 143, 134, .18); animation: sp-pop .25s cubic-bezier(.3, 1.5, .5, 1); }
.sp-target { font-size: 40px; font-weight: 900; line-height: 1.2; text-align: center; word-break: break-word; }
.sp-target.mid { font-size: 28px; }
.sp-sub { font-size: 16px; color: var(--teal); font-weight: 700; text-align: center; }
.sp-mean { font-size: 15px; color: var(--text2, var(--text)); text-align: center; }
.sp-row { display: flex; gap: 10px; justify-content: center; align-items: center; flex-wrap: wrap; width: 100%; }
.sp-round { min-width: 48px; height: 48px; padding: 0 14px; border-radius: 24px; border: 2px solid var(--teal); background: #fff; font-size: 18px; font-family: var(--font); font-weight: 800; color: var(--text); cursor: pointer; display: inline-flex; align-items: center; gap: 6px; transition: transform .1s; }
.sp-round:active { transform: scale(.93); }
.sp-round span { font-size: 14px; }
.sp-wrap { position: relative; border-radius: 16px; transition: box-shadow .3s; touch-action: none; }
.sp-wrap.good { box-shadow: 0 0 0 4px var(--ink-glow), 0 0 26px 6px var(--ink-glow); }
.sp-wrap.bad { animation: sp-shake .4s; }
.sp-pad { display: block; border-radius: 16px; touch-action: none; user-select: none; -webkit-user-select: none; cursor: crosshair; }
.sp-hint { font-size: 14px; color: var(--text2, var(--text)); text-align: center; }
.sp-note { font-size: 14px; color: var(--text2, var(--text)); text-align: center; min-height: 20px; max-width: 340px; }
.sp-mic { width: 96px; height: 96px; border-radius: 50%; border: 3px solid var(--teal); background: radial-gradient(circle at 35% 30%, #fff, var(--mint)); font-size: 42px; cursor: pointer; position: relative; box-shadow: 0 5px 0 rgba(61, 143, 134, .35); transition: transform .1s; flex: none; }
.sp-mic:active { transform: scale(.94) translateY(2px); }
.sp-mic::after { content: ""; position: absolute; inset: -4px; border-radius: 50%; border: 3px solid var(--ink-glow); opacity: 0; pointer-events: none; }
.sp-mic.listening { background: radial-gradient(circle at 35% 30%, #fff, #ffe3c9); border-color: var(--apricot); }
.sp-mic.listening::after { animation: sp-ring 1s ease-out infinite; }
.sp-bar { width: 100%; max-width: 280px; height: 14px; border-radius: 7px; background: rgba(61, 143, 134, .15); overflow: hidden; }
.sp-bar i { display: block; height: 100%; width: 0; border-radius: 7px; background: linear-gradient(90deg, var(--apricot), #ffd27a, var(--ink-glow)); transition: width .5s cubic-bezier(.3, 1.2, .5, 1); }
.sp-heard { font-size: 16px; font-weight: 700; text-align: center; min-height: 22px; word-break: break-word; }
.sp-spark { position: absolute; left: 50%; top: 50%; width: 8px; height: 8px; border-radius: 50%; background: var(--ink-glow); pointer-events: none; animation: sp-spark .7s ease-out forwards; }

/* battle */
.sp-battle { width: 100%; height: 100%; display: flex; flex-direction: column; min-height: 0; font-family: var(--font); color: var(--text); }
.sp-stage { flex: none; width: 100%; position: relative; overflow: hidden; border-bottom: 3px solid var(--mint); }
.sp-stage canvas { display: block; }
.sp-bottom { flex: 1; min-height: 0; display: flex; flex-direction: column; gap: 8px; padding: 8px 12px 10px; overflow-y: auto; scrollbar-width: none; align-items: center; }
.sp-bottom::-webkit-scrollbar { display: none; }
.sp-bq { width: 100%; max-width: 380px; display: flex; align-items: center; justify-content: center; gap: 10px; text-align: center; background: rgba(255, 248, 236, .95); border: 2px solid var(--mint); border-radius: 16px; padding: 6px 12px; min-height: 66px; animation: sp-pop .22s cubic-bezier(.3, 1.5, .5, 1); }
.sp-bq .sp-bt { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.sp-bq small { font-size: 13px; color: var(--teal); font-weight: 700; }
.sp-bq b { font-size: 26px; font-weight: 900; line-height: 1.2; word-break: break-word; }
.sp-bq b.sm { font-size: 19px; }
.sp-bq em { font-style: normal; font-size: 14px; color: var(--text2, var(--text)); }
.sp-bq .sp-round { height: 44px; min-width: 44px; padding: 0 10px; }
.sp-bopts { width: 100%; max-width: 380px; display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.sp-bopt { min-height: 56px; border-radius: 14px; border: 2px solid var(--mint); background: #fffdf6; font-family: var(--font); color: var(--text); font-size: 17px; font-weight: 800; cursor: pointer; display: flex; align-items: center; gap: 6px; padding: 4px 8px; text-align: left; position: relative; transition: transform .1s, background .2s, border-color .2s; box-shadow: 0 3px 0 rgba(61, 143, 134, .2); animation: sp-pop .22s cubic-bezier(.3, 1.5, .5, 1) both; }
.sp-bopt:active:not([disabled]) { transform: scale(.96) translateY(2px); }
.sp-bopt .sp-k { flex: none; width: 22px; height: 22px; border-radius: 50%; background: var(--mint); color: var(--teal); font-size: 13px; display: grid; place-items: center; }
.sp-bopt .sp-bl { display: flex; flex-direction: column; min-width: 0; flex: 1; line-height: 1.2; word-break: break-word; }
.sp-bopt .sp-bl small { font-size: 12px; color: var(--teal); font-weight: 700; }
.sp-bopt[disabled] { cursor: default; }
.sp-bopt.good { background: #d9f7ee; border-color: var(--good); box-shadow: 0 0 14px var(--ink-glow); }
.sp-bopt.bad { background: #ffe0dc; border-color: var(--bad); animation: sp-shake .4s; }
.sp-bopt.reveal { border-color: var(--good); background: #eafbf4; }
.sp-bopt.kfocus, .sp-round.kfocus, .sp-mic.kfocus { outline: 3px solid var(--apricot); outline-offset: 2px; }

@keyframes sp-pop { from { transform: scale(.85); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes sp-shake { 0%, 100% { transform: none; } 25% { transform: translateX(-6px); } 75% { transform: translateX(6px); } }
@keyframes sp-ring { from { transform: scale(1); opacity: .9; } to { transform: scale(1.5); opacity: 0; } }
@keyframes sp-spark { from { transform: translate(-50%, -50%); opacity: 1; } to { transform: translate(calc(-50% + cos(var(--a)) * var(--d)), calc(-50% + sin(var(--a)) * var(--d))); opacity: 0; } }
