/* tính năng mở rộng — Ghép vần (js/game-spell.js). Tiền tố lớp: gsp- (gs- đã thuộc về trò "Bóng của ai?") */
body[data-scene="ghep-van"] { --sky1: #FF8E9E; --sky2: #FFE8E4; --wide: 1280px; }
/* màn hẹp: lời của Gấu Con lúc một dòng lúc hai dòng — giữ sẵn chỗ hai dòng để bảng chơi không nhảy lên nhảy xuống giữa câu */
@media (max-width: 520px) {
  body[data-scene="ghep-van"] .ask .bubble { display: flex; align-items: center; min-height: calc(2.5em + 28px); }
}
@media (max-width: 520px) and (max-height: 700px) { body[data-scene="ghep-van"] .ask .bubble { min-height: calc(2.5em + 20px); } }

/* Bảng chơi: khu chữ (.gsp-play) và khu hình (.gsp-prize). Chiều cao do js đặt = phần màn hình còn lại.
   Màn ngang: chữ bên trái, hình bên phải. Màn dọc (.gsp-tall): hình ở trên, chữ ở dưới gần tay bé. */
.gsp-board { display: grid; grid-template-columns: minmax(0, 1fr) clamp(30%, calc(var(--gsp-h, 400px) * 1.15), 40%); gap: clamp(6px, 1.2vw, 14px);
  width: 100%; height: clamp(170px, calc(var(--vh) - var(--over) - 60px), 900px); padding: clamp(6px, 1.1vw, 12px);
  border: 6px solid transparent; border-radius: 34px; background: linear-gradient(#fff, #fff) padding-box, var(--rainbow) border-box;
  box-shadow: var(--lift); }
.gsp-board.gsp-tall { grid-template-columns: minmax(0, 1fr); grid-template-rows: minmax(0, 1.4fr) minmax(0, 1fr); }
.gsp-board.gsp-tall[data-kind="miss"] { grid-template-rows: minmax(0, 1fr) minmax(0, 1fr); }
.gsp-tall .gsp-prize { order: -1; }
.gsp-play, .gsp-prize { position: relative; min-width: 0; min-height: 0; container-type: size; border-radius: 24px; }
.gsp-play { --t: min(34cqw, 76cqh); touch-action: none; }
/* màn dọc: bề ngang là thứ hiếm, nên chữ và ô chọn lấy phần ngang nhiều hơn */
.gsp-tall .gsp-play { --t: min(36cqw, 78cqh); }
.gsp-tall .gsp-tile.gsp-c { --x: 20; } .gsp-tall .gsp-tile.gsp-v { --x: 80; }
.gsp-tall .gsp-tile.gsp-ready.gsp-c { --x: 24; } .gsp-tall .gsp-tile.gsp-ready.gsp-v { --x: 76; }
.gsp-tall .gsp-plus { font-size: calc(var(--t) * .2); }
.gsp-tall .gsp-plus2 { left: 70.5%; font-size: calc(var(--t) * .16); }
.gsp-tall .gsp-card { height: min(90cqh, 62cqw); }
.gsp-tall .gsp-word { --m: min(36cqw, 46cqh); }
.gsp-tall .gsp-opt { --o: max(60px, min(28cqw, 38cqh)); }
.gsp-l1 { color: color-mix(in srgb, var(--blue) 80%, var(--navy)); }
.gsp-l2 { color: color-mix(in srgb, var(--red) 84%, var(--navy)); }
.gsp-board b { font-weight: 700; }
.gsp-board button { -webkit-tap-highlight-color: transparent; }

/* ---------- khu hình: hộp quà chờ mở, rồi hình thật to ---------- */
.gsp-prize { overflow: hidden; background: radial-gradient(circle at 50% 44%, #fff 0 28%, #FFF4C8 68%, #FFE49C 100%); }
.gsp-gift, .gsp-show { position: absolute; inset: 0; display: grid; place-items: center; width: 100%; height: 100%; touch-action: manipulation; }
.gsp-gift .emo { font-size: calc(min(60cqh, 60cqw) / 1.12); filter: drop-shadow(0 6px 0 rgba(30, 42, 94, .16)); animation: gsp-wob 2.4s ease-in-out infinite; }
.gsp-gift::before, .gsp-gift::after { content: "?"; position: absolute; left: 14%; top: 10%; font: 800 min(20cqh, 20cqw)/1 var(--font-ui); color: var(--pink);
  text-shadow: 0 .06em 0 #fff, 0 -.06em 0 #fff, .06em 0 0 #fff, -.06em 0 0 #fff; rotate: -14deg; animation: gsp-float 2.2s ease-in-out infinite; pointer-events: none; }
.gsp-gift::after { left: auto; right: 13%; top: 16%; color: var(--blue); font-size: min(15cqh, 15cqw); rotate: 12deg; animation-delay: -1.1s; }
.gsp-gift.gsp-shake .emo { animation: gsp-shake .5s; }
.gsp-show { opacity: 0; scale: 0; pointer-events: none; }
.gsp-pic { font-size: calc(min(96cqh, 92cqw) / 1.12); filter: drop-shadow(0 6px 0 rgba(30, 42, 94, .16)); }
span.gsp-pic { font-size: min(74cqh, 70cqw); }
/* hình của tiếng "ba": một khối số 3 (khối đồ chơi có bề dày, mặt bóng), bên dưới là ba quả táo 3D để bé đếm */
span.gsp-num { display: grid; justify-items: center; align-content: center; gap: .1em; font-size: min(39cqh, 42cqw); line-height: 1; filter: none; }
.gsp-numblock { position: relative; display: grid; place-items: center; width: 1.3em; height: 1.3em; border-radius: .24em;
  background: linear-gradient(160deg, #7CC0FF 0, #3B8DFF 46%, #2468E0 100%);
  box-shadow: inset 0 .05em 0 rgba(255, 255, 255, .6), inset .04em 0 0 rgba(255, 255, 255, .22), inset -.04em 0 0 rgba(0, 0, 0, .12), inset 0 -.07em 0 rgba(0, 0, 0, .2),
    0 .1em 0 #1947A8, 0 .12em 0 #12357F, 0 .22em .2em rgba(30, 42, 94, .38); }
.gsp-numblock::before { content: ""; position: absolute; left: 8%; right: 8%; top: 6%; height: 40%; border-radius: .18em .18em 50% 50% / .18em .18em 30% 30%; background: linear-gradient(rgba(255, 255, 255, .5), rgba(255, 255, 255, 0)); }
.gsp-numblock b { position: relative; font: 800 1em/1 var(--font-ui); color: #fff; text-shadow: 0 .035em 0 #CFE4FF, 0 .07em 0 #1947A8, 0 .1em .06em rgba(0, 0, 0, .35); }
.gsp-numrow { display: flex; justify-content: center; gap: .05em; font-size: .4em; }
.gsp-numrow .emo { filter: drop-shadow(0 .06em .05em rgba(60, 40, 10, .35)); }
.card .block.gsp-wide { width: 1.75em; aspect-ratio: auto; height: 1.25em; }
.td-art .block.gsp-wide { width: 1.55em; aspect-ratio: auto; height: 1.15em; font-size: .7em; } /* trong vòng tròn nhiệm vụ hôm nay */
.gsp-open .gsp-gift { pointer-events: none; opacity: 0; visibility: hidden; animation: gsp-out .4s; }
.gsp-open .gsp-show { opacity: 1; scale: 1; pointer-events: auto; animation: gsp-in .6s cubic-bezier(.3, 1.5, .5, 1); }
.gsp-open.gsp-still .gsp-gift { display: none; }
.gsp-open.gsp-still .gsp-show { animation: gsp-in .4s; }

/* ---------- câu ghép: hai mảnh chữ ---------- */
.gsp-tile { --c: var(--blue); position: absolute; z-index: 1; left: calc(var(--x) * 1%); top: 50%; width: var(--t); height: var(--t);
  margin: calc(var(--t) / -2) 0 0 calc(var(--t) / -2); display: grid; place-items: center; background: #fff;
  border: calc(var(--t) * .07) solid var(--c); border-radius: calc(var(--t) * .2);
  color: color-mix(in srgb, var(--c) 82%, var(--navy)); font: 700 calc(var(--t) * .62)/1 var(--font-letter);
  box-shadow: 0 calc(var(--t) * .07) 0 color-mix(in srgb, var(--c) 60%, #000), 0 calc(var(--t) * .12) calc(var(--t) * .14) rgba(30, 42, 94, .25);
  transform: translate(var(--dx, 0px), var(--dy, 0px)) rotate(var(--rot, 0deg)) scale(var(--sc, 1));
  transition: left .3s cubic-bezier(.3, 1.3, .5, 1), transform .3s cubic-bezier(.3, 1.3, .5, 1);
  touch-action: none; cursor: grab; animation: gsp-enter .4s backwards, gsp-bob 2.6s ease-in-out .4s infinite; }
.gsp-tile.gsp-c { --x: 19; --rot: -5deg; }
.gsp-tile.gsp-v { --c: var(--red); --x: 81; --rot: 5deg; animation-delay: .1s, -.9s; }
.gsp-tile.gsp-ready { --rot: 0deg; animation: none; box-shadow: 0 calc(var(--t) * .07) 0 color-mix(in srgb, var(--c) 60%, #000), 0 0 0 calc(var(--t) * .05) rgba(255, 210, 63, .7), 0 calc(var(--t) * .12) calc(var(--t) * .14) rgba(30, 42, 94, .25); }
.gsp-tile.gsp-ready.gsp-c { --x: 24; }
.gsp-tile.gsp-ready.gsp-v { --x: 76; }
.gsp-tile.gsp-drag { --sc: 1.08; --rot: 0deg; z-index: 3; transition: none; animation: none; cursor: grabbing; }
.gsp-joined .gsp-tile { --rot: 0deg; animation: none; }
.gsp-joined .gsp-tile.gsp-c { left: calc(50% - var(--t) * .44); }
.gsp-joined .gsp-tile.gsp-v { left: calc(50% + var(--t) * .44); }
.gsp-tile span, .gsp-opt span { display: block; pointer-events: none; translate: 0 -5%; }
.gsp-poke { animation: gsp-poke .3s; }
/* dấu cộng, hai mũi tên chỉ vào nhau: không cần đọc cũng hiểu là đẩy hai chữ lại gần */
.gsp-plus { position: absolute; left: 50%; top: 50%; translate: -50% -50%; display: flex; align-items: center; gap: .3em;
  font: 800 calc(var(--t) * .26)/1 var(--font-ui); color: var(--orange); pointer-events: none; }
.gsp-plus i { font-style: normal; }
.gsp-plus::before, .gsp-plus::after { content: ""; width: .5em; height: .5em; border: solid currentColor; border-width: .16em .16em 0 0; border-radius: .06em; rotate: 45deg; animation: gsp-push-l 1.1s ease-in-out infinite; }
.gsp-plus::after { rotate: -135deg; animation-name: gsp-push-r; }
.gsp-joined .gsp-plus { opacity: 0; }
.gsp-plus2 { left: 69%; font-size: calc(var(--t) * .2); animation: gsp-enter .3s backwards; }
.gsp-plus2::before, .gsp-plus2::after { display: none; }

/* thẻ tiếng sau khi ghép: nửa viền xanh, nửa viền đỏ như hai mảnh dính vào nhau */
.gsp-syl { position: absolute; z-index: 1; left: 50%; top: 50%; width: calc(var(--t) * 1.62); height: var(--t);
  margin: calc(var(--t) / -2) 0 0 calc(var(--t) * -.81); display: flex; align-items: center; justify-content: center;
  border: calc(var(--t) * .07) solid transparent; border-radius: calc(var(--t) * .2);
  background: linear-gradient(#fff, #fff) padding-box, linear-gradient(90deg, var(--blue) 0 50%, var(--red) 50% 100%) border-box;
  font: 700 calc(var(--t) * .62)/1 var(--font-letter);
  box-shadow: 0 calc(var(--t) * .07) 0 rgba(30, 42, 94, .45), 0 calc(var(--t) * .12) calc(var(--t) * .14) rgba(30, 42, 94, .25);
  transition: left .3s; touch-action: manipulation; }
.gsp-syl b { display: block; transition: scale .16s, translate .16s, text-shadow .16s; pointer-events: none; }
.gsp-syl.gsp-aside { left: 36%; }
.gsp-pop { animation: gsp-pop .42s cubic-bezier(.3, 1.5, .5, 1); }
.gsp-syl b.gsp-on { scale: 1.3; translate: 0 -6%; text-shadow: 0 0 .22em var(--yellow), 0 0 .5em var(--yellow); }
.gsp-syl b.gsp-mark { scale: 1.22; translate: 0 2%; text-shadow: 0 -.12em .22em var(--yellow), 0 -.2em .5em var(--orange); }
.gsp-syl.gsp-all { animation: gsp-beat .55s; }
.gsp-syl.gsp-all b { text-shadow: 0 0 .22em var(--yellow), 0 0 .5em var(--yellow); }
/* dấu thanh: một viên tròn vàng, bé kéo hoặc chạm để gắn lên chữ */
.gsp-tone { --k: max(64px, calc(var(--t) * .56)); position: absolute; z-index: 2; left: 84%; top: 50%; width: var(--k); height: var(--k); margin: calc(var(--k) / -2) 0 0 calc(var(--k) / -2);
  display: grid; place-items: center; border-radius: 50%; background: #FFF6CC; border: 5px solid var(--yellow); color: var(--red);
  box-shadow: 0 5px 0 color-mix(in srgb, var(--yellow) 60%, #000), 0 9px 12px rgba(30, 42, 94, .22);
  transform: translate(var(--dx, 0px), var(--dy, 0px)) scale(var(--sc, 1)); transition: transform .32s cubic-bezier(.4, 0, .2, 1), opacity .32s;
  touch-action: none; cursor: grab; animation: gsp-drop .5s cubic-bezier(.3, 1.4, .5, 1) backwards, gsp-bob 1.6s ease-in-out .5s infinite; }
.gsp-tone svg { width: 64%; height: 64%; pointer-events: none; }
.gsp-tone.gsp-drag { --sc: 1.1; transition: none; animation: none; cursor: grabbing; }
.gsp-tone.gsp-fly { --sc: .5; opacity: .15; animation: none; }
.gsp-tone.hinted { border-radius: 50%; }

/* ---------- câu đố nghe – chọn thẻ ---------- */
.gsp-play.gsp-hear { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: clamp(8px, 1.6vw, 18px); align-items: center; padding: 4px; touch-action: manipulation; }
.gsp-card { display: flex; align-items: center; justify-content: center; width: 100%; height: min(88cqh, 46cqw); background: #fff;
  border: min(1.6cqw, 9px) solid var(--c); border-radius: min(5cqw, 28px); font: 700 min(17cqw, 46cqh)/1 var(--font-letter);
  box-shadow: 0 min(1.6cqw, 9px) 0 color-mix(in srgb, var(--c) 60%, #000), 0 14px 16px rgba(30, 42, 94, .2);
  transition: opacity .2s, scale .2s; animation: gsp-enter .4s backwards; }
.gsp-card:nth-child(2) { animation-delay: .08s; } .gsp-card:nth-child(3) { animation-delay: .16s; }
.gsp-card b { display: block; pointer-events: none; }
.gsp-card.gsp-ok, .gsp-opt.gsp-ok { --c: var(--green); background: #EAFBEA; animation: gsp-beat .5s; }
.gsp-tried { opacity: .6; }
.gsp-dim { opacity: .3; scale: .94; }
.gsp-no { animation: gsp-no .45s; }

/* ---------- câu đố chữ còn thiếu ---------- */
.gsp-play.gsp-miss { display: grid; grid-template-rows: minmax(0, 1.1fr) minmax(0, 1fr); place-items: center; touch-action: manipulation; }
.gsp-word { --m: min(28cqw, 48cqh); display: flex; width: calc(var(--m) * 1.7); height: var(--m); padding: calc(var(--m) * .05);
  border: calc(var(--m) * .07) solid transparent; border-radius: calc(var(--m) * .2);
  background: linear-gradient(#fff, #fff) padding-box, linear-gradient(90deg, var(--blue) 0 50%, var(--red) 50% 100%) border-box;
  font: 700 calc(var(--m) * .6)/1 var(--font-letter); box-shadow: 0 calc(var(--m) * .07) 0 rgba(30, 42, 94, .45), 0 calc(var(--m) * .12) calc(var(--m) * .14) rgba(30, 42, 94, .22);
  animation: gsp-enter .4s backwards; }
.gsp-cell { flex: 1; min-width: 0; display: grid; place-items: center; }
.gsp-gap { border: calc(var(--m) * .04) dashed var(--pink); border-radius: calc(var(--m) * .14); color: var(--pink); font: 800 .8em/1 var(--font-ui); background: #FFF0F7; animation: gsp-wait 1.2s ease-in-out infinite; }
.gsp-in { animation: gsp-pop .4s; }
.gsp-word.gsp-full { animation: gsp-beat .5s; }
.gsp-opts { display: flex; justify-content: center; gap: clamp(8px, 5cqw, 34px); }
.gsp-opt { --c: var(--red); --o: max(60px, min(24cqw, 38cqh)); width: var(--o); height: var(--o); display: grid; place-items: center; background: #fff;
  border: calc(var(--o) * .08) solid var(--c); border-radius: calc(var(--o) * .22); color: color-mix(in srgb, var(--c) 82%, var(--navy));
  font: 700 calc(var(--o) * .6)/1 var(--font-letter); box-shadow: 0 calc(var(--o) * .08) 0 color-mix(in srgb, var(--c) 60%, #000), 0 calc(var(--o) * .14) calc(var(--o) * .16) rgba(30, 42, 94, .22);
  transition: opacity .2s, scale .2s; animation: gsp-enter .4s backwards; }
.gsp-opt.gsp-c { --c: var(--blue); }
.gsp-opt:nth-child(2) { animation-delay: .08s; } .gsp-opt:nth-child(3) { animation-delay: .16s; }
.gsp-opt.gsp-flying { z-index: 3; transition: transform .3s cubic-bezier(.4, 0, .2, 1); animation: none; }
.gsp-opt.gsp-gone { visibility: hidden; }

@keyframes gsp-enter { from { scale: .5; opacity: 0; } 70% { scale: 1.06; opacity: 1; } to { scale: 1; opacity: 1; } }
@keyframes gsp-bob { 0%, 100% { translate: 0 0; } 50% { translate: 0 -5%; } }
@keyframes gsp-poke { 0%, 100% { transform: scale(1); } 45% { transform: scale(1.22) rotate(-4deg); } }
@keyframes gsp-pop { 0% { scale: .55; } 60% { scale: 1.14; } 100% { scale: 1; } }
@keyframes gsp-beat { 0%, 100% { scale: 1; } 40% { scale: 1.12; } }
@keyframes gsp-no { 0%, 100% { translate: 0 0; rotate: 0deg; } 20% { translate: -8px 0; rotate: -4deg; } 50% { translate: 8px 0; rotate: 4deg; } 80% { translate: -5px 0; } }
@keyframes gsp-wob { 0%, 100% { rotate: -5deg; scale: 1; } 50% { rotate: 5deg; scale: 1.05; } }
@keyframes gsp-shake { 0%, 100% { rotate: 0deg; } 20% { rotate: -14deg; } 40% { rotate: 12deg; } 60% { rotate: -9deg; } 80% { rotate: 6deg; } }
@keyframes gsp-float { 0%, 100% { translate: 0 0; } 50% { translate: 0 -18%; } }
@keyframes gsp-out { from { scale: 1; opacity: 1; visibility: visible; } to { scale: 1.6; opacity: 0; visibility: hidden; } }
@keyframes gsp-in { 0% { scale: 0; rotate: -14deg; opacity: 0; } 60% { scale: 1.1; rotate: 4deg; opacity: 1; } 100% { scale: 1; rotate: 0deg; opacity: 1; } }
@keyframes gsp-push-l { 0%, 100% { translate: -35% 0; opacity: .35; } 55% { translate: 25% 0; opacity: 1; } }
@keyframes gsp-push-r { 0%, 100% { translate: 35% 0; opacity: .35; } 55% { translate: -25% 0; opacity: 1; } }
@keyframes gsp-wait { 0%, 100% { scale: 1; } 50% { scale: .92; } }
@keyframes gsp-drop { from { translate: 0 -130%; opacity: 0; } to { translate: 0 0; opacity: 1; } }

/* máy đặt "giảm chuyển động": bỏ bay nhảy, mọi thứ đổi chỗ tức thì */
@media (prefers-reduced-motion: reduce) {
  .gsp-board *, .gsp-board *::before, .gsp-board *::after { animation: none !important; transition: none !important; }
}

/* ---------- wave 7: hình khối (3D) ---------- */
/* Khu chữ là một mặt khay lõm, khu hình là một sân khấu nhỏ. Mảnh chữ, thẻ tiếng, ô chọn là những khối đồ chơi bằng nhựa:
   mặt hơi ngả màu của viền, có vệt sáng phía trên, cạnh dưới dày, bóng đổ xuống khay. --gsp-bg: các lớp nền của một khối màu --c. */
.gsp-play { background: linear-gradient(#F8FAFF, #E8EEFC); box-shadow: inset 0 3px 8px rgba(30, 42, 94, .17), inset 0 -2px 0 #fff; }
.gsp-prize { box-shadow: inset 0 3px 8px rgba(140, 90, 10, .2), inset 0 -2px 0 rgba(255, 255, 255, .8); }
.gsp-pic, .gsp-gift .emo { filter: drop-shadow(0 .05em .045em rgba(60, 40, 10, .34)); }
/* dấu hỏi quanh hộp quà: hình 3D thay cho chữ "?" phẳng */
.gsp-gift::before, .gsp-gift::after { content: ""; width: 1em; height: 1em; text-shadow: none; background: url(../img/g3-dau-hoi.png) center / contain no-repeat; filter: drop-shadow(0 .06em .04em rgba(60, 40, 10, .3)); }
.gsp-gift::after { filter: hue-rotate(215deg) drop-shadow(0 .06em .04em rgba(60, 40, 10, .3)); }
/* ảnh thật của tiếng: phủ kín khu hình, mép ảnh lõm vào khung, có vệt sáng chéo như mặt kính; nút "i" ghi tác giả ảnh */
.gsp-photo { position: absolute; top: 0; left: 0; width: 100%; height: 100%; object-fit: cover; filter: none; pointer-events: none; -webkit-user-drag: none; }
.gsp-hasphoto .gsp-show::after { content: ""; position: absolute; top: 0; right: 0; bottom: 0; left: 0; border-radius: 24px; pointer-events: none;
  background: linear-gradient(118deg, rgba(255, 255, 255, .32) 0, rgba(255, 255, 255, .06) 24%, rgba(255, 255, 255, 0) 40%);
  box-shadow: inset 0 0 0 4px rgba(255, 255, 255, .88), inset 0 10px 16px rgba(0, 0, 0, .22), inset 0 -6px 12px rgba(0, 0, 0, .14); }
.gsp-info { position: absolute; z-index: 2; right: 10px; top: 10px; display: none; place-items: center; width: 28px; height: 28px; padding: 0; border-radius: 50%;
  background: linear-gradient(#fff, #E4EAFA); color: var(--navy); font: italic 800 16px/1 Georgia, 'Times New Roman', serif; opacity: .85;
  box-shadow: inset 0 -2px 0 rgba(30, 42, 94, .12), 0 2px 0 rgba(30, 42, 94, .3), 0 4px 6px rgba(30, 42, 94, .2); }
.gsp-info::after { content: ""; position: absolute; top: -9px; right: -9px; bottom: -9px; left: -9px; border-radius: 50%; }
.gsp-open .gsp-info { display: grid; }
.gsp-credits { position: fixed; top: 0; right: 0; bottom: 0; left: 0; z-index: 60; display: grid; place-items: center; padding: 14px; background: rgba(30, 42, 94, .5); }
.gsp-credits-in { box-sizing: border-box; max-width: min(520px, 100%); padding: 14px 18px; border-radius: 20px; background: #fff; color: var(--navy); font: 600 14px/1.45 var(--font-ui); box-shadow: var(--lift); }
.gsp-credits-in h3 { margin: 0 0 6px; font-size: 16px; }
.gsp-credits-in p { margin: 0; } .gsp-credits-in p + p { margin-top: 8px; opacity: .7; font-size: 12px; }

.gsp-tile, .gsp-opt, .gsp-card { border-color: transparent;
  --gsp-bg: linear-gradient(rgba(255, 255, 255, .34), rgba(255, 255, 255, 0) 46%) padding-box, linear-gradient(rgba(255, 255, 255, .9), rgba(255, 255, 255, .83)) padding-box, linear-gradient(var(--c), var(--c)) padding-box,
    linear-gradient(165deg, rgba(255, 255, 255, .62) 0, rgba(255, 255, 255, 0) 42%, rgba(0, 0, 0, .2) 100%) border-box, linear-gradient(var(--c), var(--c)) border-box;
  background: var(--gsp-bg); }
.gsp-card.gsp-ok, .gsp-opt.gsp-ok { background: var(--gsp-bg); }
.gsp-opt, .gsp-card { position: relative; }
.gsp-tile::before, .gsp-opt::before, .gsp-card::before { content: ""; position: absolute; left: 7%; right: 7%; top: 5%; height: 32%; border-radius: 16% 16% 50% 50% / 34% 34% 26% 26%;
  background: linear-gradient(rgba(255, 255, 255, .75), rgba(255, 255, 255, 0)); pointer-events: none; }
.gsp-tile span, .gsp-opt span, .gsp-card b { position: relative; text-shadow: 0 .035em 0 #fff, 0 .06em .05em rgba(30, 42, 94, .24); }
.gsp-tile { box-shadow: inset 0 calc(var(--t) * .02) calc(var(--t) * .03) rgba(30, 42, 94, .2), 0 calc(var(--t) * .075) 0 rgba(0, 0, 0, .36), 0 calc(var(--t) * .075) 0 var(--c),
    0 calc(var(--t) * .11) calc(var(--t) * .03) rgba(30, 42, 94, .3), 0 calc(var(--t) * .2) calc(var(--t) * .16) rgba(30, 42, 94, .3); }
.gsp-tile.gsp-ready { box-shadow: inset 0 calc(var(--t) * .02) calc(var(--t) * .03) rgba(30, 42, 94, .2), 0 calc(var(--t) * .075) 0 rgba(0, 0, 0, .36), 0 calc(var(--t) * .075) 0 var(--c),
    0 0 0 calc(var(--t) * .05) rgba(255, 210, 63, .8), 0 calc(var(--t) * .2) calc(var(--t) * .16) rgba(30, 42, 94, .3); }
/* đang cầm trên tay: khối nhấc khỏi khay, bóng đổ xa và nhoè hơn */
.gsp-tile.gsp-drag { box-shadow: inset 0 calc(var(--t) * .02) calc(var(--t) * .03) rgba(30, 42, 94, .2), 0 calc(var(--t) * .075) 0 rgba(0, 0, 0, .36), 0 calc(var(--t) * .075) 0 var(--c),
    0 calc(var(--t) * .34) calc(var(--t) * .26) rgba(30, 42, 94, .36); }
.gsp-opt { box-shadow: inset 0 calc(var(--o) * .02) calc(var(--o) * .03) rgba(30, 42, 94, .2), 0 calc(var(--o) * .085) 0 rgba(0, 0, 0, .36), 0 calc(var(--o) * .085) 0 var(--c),
    0 calc(var(--o) * .12) calc(var(--o) * .03) rgba(30, 42, 94, .3), 0 calc(var(--o) * .22) calc(var(--o) * .18) rgba(30, 42, 94, .3); }
.gsp-card { box-shadow: inset 0 2px 4px rgba(30, 42, 94, .18), 0 8px 0 rgba(0, 0, 0, .36), 0 8px 0 var(--c), 0 12px 3px rgba(30, 42, 94, .26), 0 22px 20px rgba(30, 42, 94, .28); }

/* thẻ tiếng và thẻ "chữ còn thiếu": hai nửa xanh – đỏ dính vào nhau, cũng là một khối có bề dày */
.gsp-syl, .gsp-word {
  background: linear-gradient(rgba(255, 255, 255, .36), rgba(255, 255, 255, 0) 46%) padding-box, linear-gradient(90deg, #E6F1FF 0, #E6F1FF 50%, #FFEAED 50%, #FFEAED 100%) padding-box,
    linear-gradient(165deg, rgba(255, 255, 255, .62) 0, rgba(255, 255, 255, 0) 42%, rgba(0, 0, 0, .2) 100%) border-box, linear-gradient(90deg, var(--blue) 0, var(--blue) 50%, var(--red) 50%, var(--red) 100%) border-box; }
.gsp-syl { box-shadow: inset 0 calc(var(--t) * .02) calc(var(--t) * .03) rgba(30, 42, 94, .2), 0 calc(var(--t) * .075) 0 #39457F, 0 calc(var(--t) * .11) calc(var(--t) * .03) rgba(30, 42, 94, .3), 0 calc(var(--t) * .2) calc(var(--t) * .16) rgba(30, 42, 94, .3); }
.gsp-syl b, .gsp-word b { text-shadow: 0 .035em 0 #fff, 0 .06em .05em rgba(30, 42, 94, .24); }
.gsp-word { box-shadow: inset 0 calc(var(--m) * .02) calc(var(--m) * .03) rgba(30, 42, 94, .2), 0 calc(var(--m) * .075) 0 #39457F, 0 calc(var(--m) * .11) calc(var(--m) * .03) rgba(30, 42, 94, .3), 0 calc(var(--m) * .2) calc(var(--m) * .16) rgba(30, 42, 94, .28); }
/* chỗ trống: một ô lõm, bên trong là dấu hỏi 3D */
.gsp-gap { border-style: solid; border-color: rgba(255, 109, 179, .5); background: linear-gradient(#FFD9EA, #FFF3F9); box-shadow: inset 0 calc(var(--m) * .04) calc(var(--m) * .06) rgba(160, 30, 90, .32); }
.gsp-gap .emo { filter: drop-shadow(0 .05em .04em rgba(60, 40, 10, .3)); }

/* dấu thanh: một viên nút vàng bóng; nét dấu nổi lên */
.gsp-tone { border: 4px solid #fff; background: radial-gradient(circle at 34% 26%, #FFFEF2 0, #FFF2AC 36%, #FFD23F 76%, #F0B000 100%);
  box-shadow: inset 0 -5px 6px rgba(160, 100, 0, .3), 0 6px 0 #C58A00, 0 8px 3px rgba(30, 42, 94, .26), 0 14px 14px rgba(30, 42, 94, .3); }
.gsp-tone svg { filter: drop-shadow(0 2px 0 rgba(130, 16, 32, .55)); }
.gsp-tone.gsp-drag { box-shadow: inset 0 -5px 6px rgba(160, 100, 0, .3), 0 6px 0 #C58A00, 0 22px 18px rgba(30, 42, 94, .34); }
/* dấu cộng: hình 3D */
.gsp-plus i { display: block; width: 1.2em; height: 1.2em; overflow: hidden; color: transparent; background: url(../img/g3-dau-cong.png) center / contain no-repeat; filter: drop-shadow(0 .06em .04em rgba(30, 42, 94, .3)); }
.gsp-plus::before, .gsp-plus::after { border-width: .2em .2em 0 0; border-radius: .08em; }

/* ---------- wave 6: compat (trình duyệt cũ) ---------- */
/* Bản dự phòng cho máy cũ của các luật phía trên (giải thích ở cuối css/style.css); sửa luật gốc thì sửa luôn dòng tương ứng ở đây. */
/* chưa có color-mix(): bóng đổ của mảnh chữ, thẻ, ô chọn, dấu thanh nay nằm ở khối "wave 7" (không dùng color-mix); ở đây chỉ còn màu chữ */
@supports not (color: color-mix(in srgb, red, blue)) {
  .gsp-l1 { color: #3585DF; }
  .gsp-l2 { color: #DB5163; }
  .gsp-tile { --ck: var(--k-blue); color: var(--ck, var(--navy)); }
  .gsp-tile.gsp-v { --ck: var(--k-red); }
  .gsp-card.gsp-ok, .gsp-opt.gsp-ok { --ck: var(--k-green); }
  .gsp-opt { --ck: var(--k-red); color: var(--ck, var(--navy)); }
  .gsp-opt.gsp-c { --ck: var(--k-blue); }
}
/* chưa có đơn vị cqw/cqh, @container */
@supports not (width: 1cqw) {
  .gsp-play, .gsp-prize { --cq: size; contain: size; }
  .gsp-play { --t: min(calc(34 * var(--cq-w)), calc(76 * var(--cq-h))); }
  .gsp-tall .gsp-play { --t: min(calc(36 * var(--cq-w)), calc(78 * var(--cq-h))); }
  .gsp-tall .gsp-card { height: min(calc(90 * var(--cqh)), calc(62 * var(--cqw))); }
  .gsp-tall .gsp-word { --m: min(calc(36 * var(--cqw)), calc(46 * var(--cqh))); }
  .gsp-tall .gsp-opt { --o: max(60px, min(calc(28 * var(--cqw)), calc(38 * var(--cqh)))); }
  .gsp-gift .emo { font-size: calc(min(calc(60 * var(--cqh)), calc(60 * var(--cqw))) / 1.12); }
  .gsp-gift::before, .gsp-gift::after { font: 800 min(calc(20 * var(--cqh)), calc(20 * var(--cqw)))/1 var(--font-ui); }
  .gsp-gift::after { font-size: min(calc(15 * var(--cqh)), calc(15 * var(--cqw))); }
  .gsp-pic { font-size: calc(min(calc(96 * var(--cqh)), calc(92 * var(--cqw))) / 1.12); }
  span.gsp-pic { font-size: min(calc(74 * var(--cqh)), calc(70 * var(--cqw))); }
  span.gsp-num { font-size: min(calc(39 * var(--cqh)), calc(42 * var(--cqw))); }
  .gsp-card { height: min(calc(88 * var(--cqh)), calc(46 * var(--cqw))); border: min(calc(1.6 * var(--cqw)), 9px) solid var(--c); border-radius: min(calc(5 * var(--cqw)), 28px); font: 700 min(calc(17 * var(--cqw)), calc(46 * var(--cqh)))/1 var(--font-letter); }
  .gsp-word { --m: min(calc(28 * var(--cqw)), calc(48 * var(--cqh))); }
  .gsp-opts { gap: clamp(8px, calc(5 * var(--cqw)), 34px); }
  .gsp-opt { --o: max(60px, min(calc(24 * var(--cqw)), calc(38 * var(--cqh)))); }
}
/* chưa có translate/rotate/scale rời */
@supports not (translate: 0) {
  :where(.gsp-gift .emo) { transform: var(--i-t); }
  .gsp-gift::before, .gsp-gift::after { --i-r: -14deg; transform: var(--i-t); }
  .gsp-gift::after { --i-r: 12deg; transform: var(--i-t); }
  :where(.gsp-gift.gsp-shake .emo) { transform: var(--i-t); }
  .gsp-show { --i-sx: 0; --i-sy: 0; transform: var(--i-t); }
  :where(.gsp-open .gsp-gift) { transform: var(--i-t); }
  .gsp-open .gsp-show { --i-sx: 1; --i-sy: 1; transform: var(--i-t); }
  :where(.gsp-open.gsp-still .gsp-show) { transform: var(--i-t); }
  .gsp-tile { transform: var(--i-t) translate(var(--dx, 0px), var(--dy, 0px)) rotate(var(--rot, 0deg)) scale(var(--sc, 1)); }
  .gsp-tile span, .gsp-opt span { --i-tx: 0px; --i-ty: -5%; transform: var(--i-t); }
  .gsp-plus { --i-tx: -50%; --i-ty: -50%; transform: var(--i-t); }
  .gsp-plus::before, .gsp-plus::after { --i-r: 45deg; transform: var(--i-t); }
  .gsp-plus::after { --i-r: -135deg; transform: var(--i-t); }
  :where(.gsp-plus2) { transform: var(--i-t); }
  .gsp-syl b { transition: --i-sx .16s, --i-sy .16s, --i-tx .16s, --i-ty .16s, text-shadow .16s; }
  :where(.gsp-pop) { transform: var(--i-t); }
  .gsp-syl b.gsp-on { --i-sx: 1.3; --i-sy: 1.3; --i-tx: 0px; --i-ty: -6%; transform: var(--i-t); }
  .gsp-syl b.gsp-mark { --i-sx: 1.22; --i-sy: 1.22; --i-tx: 0px; --i-ty: 2%; transform: var(--i-t); }
  :where(.gsp-syl.gsp-all) { transform: var(--i-t); }
  .gsp-tone { transform: var(--i-t) translate(var(--dx, 0px), var(--dy, 0px)) scale(var(--sc, 1)); }
  .gsp-card { transition: opacity .2s, --i-sx .2s, --i-sy .2s; transform: var(--i-t); }
  :where(.gsp-card.gsp-ok), :where(.gsp-opt.gsp-ok) { transform: var(--i-t); }
  .gsp-dim { --i-sx: .94; --i-sy: .94; transform: var(--i-t); }
  :where(.gsp-no) { transform: var(--i-t); }
  :where(.gsp-word) { transform: var(--i-t); }
  :where(.gsp-gap) { transform: var(--i-t); }
  :where(.gsp-in) { transform: var(--i-t); }
  :where(.gsp-word.gsp-full) { transform: var(--i-t); }
  .gsp-opt { transition: opacity .2s, --i-sx .2s, --i-sy .2s; transform: var(--i-t); }
  @keyframes gsp-enter { from { --i-sx: .5; --i-sy: .5; opacity: 0; } 70% { --i-sx: 1.06; --i-sy: 1.06; opacity: 1; } to { --i-sx: 1; --i-sy: 1; opacity: 1; } }
  @keyframes gsp-bob { 0%, 100% { --i-tx: 0px; --i-ty: 0px; } 50% { --i-tx: 0px; --i-ty: -5%; } }
  @keyframes gsp-pop { 0% { --i-sx: .55; --i-sy: .55; } 60% { --i-sx: 1.14; --i-sy: 1.14; } 100% { --i-sx: 1; --i-sy: 1; } }
  @keyframes gsp-beat { 0%, 100% { --i-sx: 1; --i-sy: 1; } 40% { --i-sx: 1.12; --i-sy: 1.12; } }
  @keyframes gsp-no { 0%, 100% { --i-tx: 0px; --i-ty: 0px; --i-r: 0deg; } 20% { --i-tx: -8px; --i-ty: 0px; --i-r: -4deg; } 50% { --i-tx: 8px; --i-ty: 0px; --i-r: 4deg; } 80% { --i-tx: -5px; --i-ty: 0px; } }
  @keyframes gsp-wob { 0%, 100% { --i-r: -5deg; --i-sx: 1; --i-sy: 1; } 50% { --i-r: 5deg; --i-sx: 1.05; --i-sy: 1.05; } }
  @keyframes gsp-shake { 0%, 100% { --i-r: 0deg; } 20% { --i-r: -14deg; } 40% { --i-r: 12deg; } 60% { --i-r: -9deg; } 80% { --i-r: 6deg; } }
  @keyframes gsp-float { 0%, 100% { --i-tx: 0px; --i-ty: 0px; } 50% { --i-tx: 0px; --i-ty: -18%; } }
  @keyframes gsp-out { from { --i-sx: 1; --i-sy: 1; opacity: 1; visibility: visible; } to { --i-sx: 1.6; --i-sy: 1.6; opacity: 0; visibility: hidden; } }
  @keyframes gsp-in { 0% { --i-sx: 0; --i-sy: 0; --i-r: -14deg; opacity: 0; } 60% { --i-sx: 1.1; --i-sy: 1.1; --i-r: 4deg; opacity: 1; } 100% { --i-sx: 1; --i-sy: 1; --i-r: 0deg; opacity: 1; } }
  @keyframes gsp-push-l { 0%, 100% { --i-tx: -35%; --i-ty: 0px; opacity: .35; } 55% { --i-tx: 25%; --i-ty: 0px; opacity: 1; } }
  @keyframes gsp-push-r { 0%, 100% { --i-tx: 35%; --i-ty: 0px; opacity: .35; } 55% { --i-tx: -25%; --i-ty: 0px; opacity: 1; } }
  @keyframes gsp-wait { 0%, 100% { --i-sx: 1; --i-sy: 1; } 50% { --i-sx: .92; --i-sy: .92; } }
  @keyframes gsp-drop { from { --i-tx: 0px; --i-ty: -130%; opacity: 0; } to { --i-tx: 0px; --i-ty: 0px; opacity: 1; } }
}
