/* SubelJapan — giao diện 3 trò chơi mới: Câu cá chữ · Mochi đập chữ · Bóng bay あいうえお
 * .g3 = khung chung (thanh HUD, chữ bay "+2", pháo hoa nhỏ, lớp tạm dừng, bong bóng cách đọc)
 * .fp-* = ao cá · .wk-* = bãi cỏ đập mochi · .bl-* = bầu trời bóng bay. Mọi hình đều là SVG vẽ tay.
 */

/* =========================================================
   KHUNG CHUNG
   ========================================================= */
.g3 { position: relative; padding-bottom: 64px; }
.g3 .k { stroke: var(--ink-ic); stroke-width: 2.6; stroke-linejoin: round; stroke-linecap: round; }
.g3 .ns { vector-effect: non-scaling-stroke; }
/* Mochi đi dạo (pet.js) tạm lánh khi đang chơi, để không che ao / hang / bóng bay */
body:has(.g3-scene) .pet, body:has(.g3-scene) .pet-shadow { display: none !important; }
.g3-top { gap: 10px; margin-bottom: 14px; }
.g3-top .icon-btn { flex: none; }

/* đồng hồ */
.g3-timer {
  flex: 1; min-width: 0; display: flex; align-items: center; gap: 8px; height: 44px; padding: 0 14px 0 6px;
  border-radius: 999px; background: var(--card); border: 1.5px solid var(--line); box-shadow: var(--sh-1);
}
.g3-timer > .ic { flex: none; width: 30px; height: 30px; transform-origin: 50% 60%; }
.g3-timer .timer-bar { height: 12px; }
.g3-timer .timer-fill { background: linear-gradient(90deg, var(--mint), color-mix(in srgb, var(--mint) 55%, #fff)); }
.g3-timer .timer-fill.low { background: var(--red); }
.g3-timer b { flex: none; min-width: 22px; text-align: right; font: 900 17px/1 var(--f-body); font-variant-numeric: tabular-nums; color: var(--ink); }
.g3-timer { position: relative; }
.g3-timer.low > .ic { animation: g3ring .5s ease-in-out infinite; }
.g3-tdelta { position: absolute; right: 8px; top: 50%; z-index: 3; padding: 4px 10px; border-radius: 999px; font: 900 13px/1 var(--f-body); white-space: nowrap; pointer-events: none; box-shadow: var(--sh-1); animation: g3tdelta 1.1s cubic-bezier(.2, .9, .3, 1) forwards; }
.g3-tdelta.minus { background: var(--red); color: #fff; }
.g3-tdelta.plus { background: var(--mint); color: #fff; }
@keyframes g3tdelta { 0% { opacity: 0; transform: translateY(-50%) scale(.4); } 18% { opacity: 1; transform: translateY(-120%) scale(1.12); } 30% { transform: translateY(-125%) scale(1); } 75% { opacity: 1; } 100% { opacity: 0; transform: translateY(-190%); } }
.g3-timer.low b { color: var(--red-t); }
.g3-timer.minus { animation: g3minus .45s ease; }
.g3-timer.plus { animation: g3plus .6s var(--spring); }
@keyframes g3ring { 25% { transform: rotate(-14deg); } 75% { transform: rotate(14deg); } }
@keyframes g3minus { 0%, 100% { transform: none; } 20% { transform: translateX(-5px); border-color: var(--red); } 45% { transform: translateX(5px); border-color: var(--red); } 70% { transform: translateX(-2px); } }
@keyframes g3plus { 0%, 100% { transform: none; } 40% { transform: scale(1.04); border-color: var(--mint); box-shadow: 0 0 0 4px var(--mint-l), var(--sh-1); } }

/* điểm + hệ số combo */
.g3-score {
  flex: none; display: inline-flex; align-items: center; gap: 6px; height: 44px; padding: 0 16px 0 10px; border-radius: 999px;
  background: var(--sun-l); color: var(--sun-t); font: 900 19px/1 var(--f-body); font-variant-numeric: tabular-nums; box-shadow: var(--sh-1);
}
.g3-score > .ic { flex: none; }
.g3-score b { display: inline-block; min-width: 1ch; }
.g3-score.bump b { animation: g3bump .45s var(--spring); }
@keyframes g3bump { 40% { transform: scale(1.38); } }
.g3-mult { display: none; align-items: center; height: 24px; padding: 0 9px; margin-left: 2px; border-radius: 999px; background: var(--coral); color: #fff; font: 900 13.5px/1 var(--f-body); box-shadow: 0 6px 12px -8px var(--coral-d); }
.g3-mult.on { display: inline-flex; animation: g3pop .45s var(--spring) backwards; }

/* khung cảnh */
.g3-scene {
  position: relative; overflow: hidden; border-radius: 28px; border: 1.5px solid var(--line); box-shadow: var(--sh-2); isolation: isolate;
  user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; touch-action: manipulation;
}
.g3-scene button { font: inherit; color: inherit; }
.g3-tip { display: flex; align-items: center; justify-content: center; gap: 6px; margin: 12px 6px 0; text-align: center; font: 700 13.5px/1.45 var(--f-body); color: var(--ink2); }
.g3-tip .gl { flex: none; color: var(--sun-d); }

/* chữ bay "+2", pháo hoa nhỏ */
.g3-float {
  position: absolute; z-index: 30; pointer-events: none; transform: translate(-50%, -50%); white-space: nowrap; text-align: center;
  font: 900 26px/1 var(--f-body); color: var(--pri-t); text-shadow: 0 2px 0 #fff, 0 0 10px #fff, 0 0 2px #fff;
  animation: g3float 1s cubic-bezier(.2, .9, .3, 1) forwards;
}
.g3-float small { display: block; margin-top: 3px; font-size: 13.5px; color: var(--coral-d); }
.g3-float.bad { font-size: 18px; color: var(--red-t); }
.g3-float.gold { font-size: 18px; color: var(--sun-t); }
.g3-float.big { display: inline-flex; align-items: center; gap: 6px; padding: 8px 16px; border-radius: 999px; background: var(--card); box-shadow: var(--sh-2); text-shadow: none; font-size: 18px; animation-duration: 1.6s; }
@keyframes g3float {
  0% { opacity: 0; transform: translate(-50%, -30%) scale(.5); }
  18% { opacity: 1; transform: translate(-50%, -62%) scale(1.15); }
  30% { transform: translate(-50%, -68%) scale(1); }
  75% { opacity: 1; }
  100% { opacity: 0; transform: translate(-50%, -150%) scale(1); }
}
.g3-burst { position: absolute; z-index: 25; width: 0; height: 0; pointer-events: none; }
.g3-burst i { position: absolute; left: -5px; top: -5px; width: 10px; height: 10px; border-radius: 50%; background: var(--c); border: 1.5px solid var(--ink-ic); transform: rotate(var(--a)) translateX(6px); animation: g3burst .62s cubic-bezier(.2, .8, .3, 1) forwards; }
.g3-burst i:nth-child(3n) { left: -8px; top: -8px; width: 16px; height: 16px; border: 0; border-radius: 0; background: #ffd85e; clip-path: polygon(50% 0, 62% 38%, 100% 50%, 62% 62%, 50% 100%, 38% 62%, 0 50%, 38% 38%); }
@keyframes g3burst { 0% { transform: rotate(var(--a)) translateX(6px) scale(1); opacity: 1; } 65% { opacity: 1; } 100% { transform: rotate(var(--a)) translateX(var(--d)) scale(.3); opacity: 0; } }
@keyframes g3pop { 0% { opacity: 0; transform: scale(.55); } 60% { opacity: 1; transform: scale(1.07); } 100% { transform: scale(1); } }
@keyframes g3out { to { opacity: 0; transform: scale(.92); } }
@keyframes g3hop { 0%, 100% { transform: none; } 30% { transform: translateY(-14px) scale(.94, 1.08); } 62% { transform: translateY(0) scale(1.08, .92); } }
@keyframes g3cloud { from { transform: translateX(-150px); } to { transform: translateX(min(100vw, 800px)); } }

/* bong bóng "き = ki" khi chọn nhầm */
.g3-say {
  position: absolute; left: 50%; top: -6px; z-index: 6; transform: translate(-50%, -100%); padding: 4px 11px; border-radius: 999px; white-space: nowrap; pointer-events: none;
  background: var(--card); border: 1.5px solid var(--line); box-shadow: var(--sh-1); color: var(--ink); font: 900 14px/1.25 var(--f-body);
  animation: g3sayIn .42s var(--spring) backwards;
}
.g3-say .jp { font: 600 17px/1 var(--f-kana); }
@keyframes g3sayIn { from { opacity: 0; transform: translate(-50%, -60%) scale(.5); } }

/* tạm dừng khi rời tab */
.g3-pause {
  position: absolute; inset: 0; z-index: 40; display: grid; place-content: center; justify-items: center; gap: 4px; padding: 0; border: 0; cursor: pointer;
  background: color-mix(in srgb, var(--card) 72%, transparent); -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px);
}
.g3-pause b { font: 800 21px var(--f-head); color: var(--ink); }
.g3-pause small { font: 700 14px var(--f-body); color: var(--ink2); }
.g3-pause .mascot { pointer-events: none; }

/* =========================================================
   1. CÂU CÁ CHỮ — ao nước nhìn ngang
   ========================================================= */
.fp-scene { --surf: 108px; --fw: 124px; --rise: 280px; height: 460px; background: #dcefff; }
.fp-sky { position: absolute; z-index: 0; left: 0; right: 0; top: 0; height: calc(var(--surf) + 4px); background: linear-gradient(#cbe6ff, #eef7ff 85%); }
.fp-cloud { position: absolute; left: 0; top: 10px; width: 92px; height: 43px; animation: g3cloud 62s linear infinite -20s; }
.fp-cloud.c2 { top: 42px; width: 64px; height: 30px; opacity: .9; animation-duration: 90s; animation-delay: -66s; }
.fp-hills { position: absolute; left: 0; bottom: 2px; width: 100%; height: 30px; }
.fp-hills .k { stroke-width: 1.6; stroke-opacity: .45; }
.fp-water { position: absolute; z-index: 2; left: 0; right: 0; top: var(--surf); bottom: 0; background: linear-gradient(#a6daf7, #8ccdf2 42%, #74bbe8); }
.fp-wave { position: absolute; left: 0; top: -11px; width: 1600px; height: 24px; animation: fpWave 10s linear infinite; }
.fp-wave .wf { fill: #a6daf7; }
.fp-wave .ws { fill: none; stroke: #fff; stroke-width: 2.6; stroke-linecap: round; opacity: .9; }
@keyframes fpWave { to { transform: translateX(-800px); } }
.fp-rays {
  position: absolute; inset: 0; background: repeating-linear-gradient(112deg, transparent 0 46px, rgba(255, 255, 255, .17) 46px 76px, transparent 76px 150px);
  -webkit-mask-image: linear-gradient(#000, transparent 78%); mask-image: linear-gradient(#000, transparent 78%); animation: fpRays 12s ease-in-out infinite alternate;
}
@keyframes fpRays { to { background-position: 90px 0; } }
.fp-sand { position: absolute; left: 0; bottom: 0; z-index: 1; width: 100%; height: 42px; }
.fp-peb { position: absolute; z-index: 2; left: var(--l); bottom: var(--b); width: var(--w); height: calc(var(--w) * .62); border-radius: 50%; background: var(--c); border: 1.5px solid var(--ink-ic); }
.fp-weed { position: absolute; z-index: 1; left: var(--l); bottom: 20px; width: 32px; height: 64px; transform-origin: 50% 100%; animation: fpSway 3.8s ease-in-out infinite alternate; }
@keyframes fpSway { from { transform: rotate(-5deg); } to { transform: rotate(5deg); } }
.fp-bub {
  position: absolute; z-index: 2; left: var(--l); bottom: 30px; width: var(--s); height: var(--s); border-radius: 50%; opacity: 0;
  border: 1.5px solid rgba(255, 255, 255, .95); background: radial-gradient(circle at 32% 30%, #fff 0 16%, rgba(255, 255, 255, .2) 22%);
  animation: fpBub var(--d) linear infinite var(--dl);
}
@keyframes fpBub { 0% { opacity: 0; transform: translate(0, 0); } 12% { opacity: .9; } 50% { transform: translate(7px, calc(var(--rise) * -.5)); } 88% { opacity: .85; } 100% { opacity: 0; transform: translate(-3px, calc(var(--rise) * -1)); } }
.fp-rip { position: absolute; z-index: 3; left: var(--l); top: calc(var(--surf) + 3px); width: 70px; height: 14px; margin-left: -35px; border-radius: 50%; border: 2px solid rgba(255, 255, 255, .9); opacity: 0; animation: fpRip 4.2s ease-out infinite var(--dl); }
@keyframes fpRip { 0% { transform: scale(.2); opacity: 0; } 15% { opacity: .95; } 100% { transform: scale(1.5); opacity: 0; } }
.fp-lily { position: absolute; z-index: 3; left: var(--l); top: calc(var(--surf) - 15px); width: var(--w); height: auto; animation: fpLily 4.6s ease-in-out infinite alternate; }
@keyframes fpLily { from { transform: translateY(-1px) rotate(-2deg); } to { transform: translateY(2px) rotate(2deg); } }
.fp-bank { position: absolute; z-index: 1; left: -4px; top: calc(var(--surf) - 31px); width: 156px; height: 46px; }
.fp-mochi { position: absolute; z-index: 5; left: 12px; top: calc(var(--surf) - 84px); pointer-events: none; transform-origin: 50% 100%; }
.fp-mochi.hop, .wk-mochi.hop, .bl-mochi.hop { animation: g3hop .6s var(--spring); }

/* đề bài */
.fp-ask {
  position: absolute; z-index: 8; top: 12px; right: 12px; display: flex; flex-direction: column; align-items: center; min-width: 136px; padding: 8px 24px 10px;
  border-radius: 22px; background: var(--card); border: 1.5px solid var(--line); box-shadow: var(--sh-2); cursor: pointer; transition: transform .3s var(--spring);
}
.fp-ask:active { transform: scale(.95); }
.fp-ask small { font: 800 12px/1.3 var(--f-body); color: var(--ink2); white-space: nowrap; }
.fp-ask b { font: 900 36px/1.05 var(--f-body); color: var(--pri-t); letter-spacing: .5px; }
.fp-ask b.jp { font: 600 40px/1.1 var(--f-kana); color: var(--ink); letter-spacing: 0; }
.fp-ask small .gl { margin: -2px 0 0 2px; color: var(--ink3); }
.fp-ask.new { animation: g3pop .5s var(--spring); }

/* cần câu & dây */
.fp-lines { position: absolute; inset: 0; z-index: 7; width: 100%; height: 100%; overflow: visible; pointer-events: none; }
.fp-rod { fill: none; stroke-linecap: round; }
.fp-rod.o1 { stroke: var(--ink-ic); stroke-width: 7.5; }
.fp-rod.o2 { stroke: #d39a62; stroke-width: 3.6; }
.fp-idle, .fp-line { fill: none; stroke: var(--ink-ic); stroke-width: 1.6; stroke-linecap: round; opacity: .8; }
.fp-idle, .fp-bobber { transition: opacity .15s; }
.fp-lines.busy .fp-idle, .fp-lines.busy .fp-bobber { opacity: 0; }
.fpb-in { animation: fpBobber 2.2s ease-in-out infinite; }
@keyframes fpBobber { 50% { transform: translateY(2.5px); } }

/* cá */
.fp-fishes { position: absolute; inset: 0; z-index: 6; }
.fp-fish { position: absolute; left: 0; top: 0; width: var(--fw); height: calc(var(--fw) * .6); padding: 0; border: 0; background: none; cursor: pointer; will-change: transform; -webkit-tap-highlight-color: transparent; outline: none; }
.fp-in { position: absolute; inset: 0; display: block; transition: transform .3s var(--spring), opacity .35s; }
.fp-flip { position: absolute; inset: 0; display: block; }
.fp-fish.l .fp-flip { transform: scaleX(-1); }
.fp-svg { display: block; width: 100%; height: 100%; overflow: visible; filter: drop-shadow(0 5px 0 rgba(36, 92, 140, .13)); }
.fp-svg .k { stroke-width: 3; }
.fp-tail { transform-box: view-box; transform-origin: 37px 36px; animation: fpTail .5s ease-in-out infinite alternate; }
@keyframes fpTail { from { transform: rotate(-12deg); } to { transform: rotate(12deg); } }
.fp-tag {
  position: absolute; left: 53%; top: 51%; transform: translate(-50%, -50%); display: grid; place-items: center;
  min-width: calc(var(--fw) * .33); height: calc(var(--fw) * .33); padding: 0 5px; border-radius: 999px;
  background: #fff; border: 2px solid var(--ink-ic); box-shadow: inset 0 -3px 0 rgba(58, 46, 77, .07); color: #3a2e4d;
  font: 600 calc(var(--fw) * .215)/1 var(--f-kana); transition: box-shadow .2s;
}
.fp-fish.l .fp-tag { left: 47%; }
.fp-tag.ro { font: 900 calc(var(--fw) * .15)/1 var(--f-body); padding: 0 7px; }
.fp-fish:focus-visible .fp-tag { box-shadow: 0 0 0 4px var(--pri); }
.fp-fish.new .fp-in { animation: fpIn .55s var(--spring) backwards; animation-delay: var(--dl, 0s); }
@keyframes fpIn { from { opacity: 0; transform: scale(.3); } }
.fp-fish.hooked { cursor: default; z-index: 2; }
.fp-fish.hooked .fp-tail { animation-duration: .1s; }
.fp-fish.got .fp-in { animation: fpGot .32s ease-in forwards; }
@keyframes fpGot { 40% { transform: scale(1.25); } 100% { transform: scale(.2); opacity: 0; } }
.fp-fish.flee { pointer-events: none; }
.fp-fish.flee .fp-in { animation: fpScare .5s ease forwards; }
.fp-fish.flee.calm .fp-in { animation: none; opacity: .5; }
@keyframes fpScare { 0% { transform: none; } 22% { transform: translateY(-6px) rotate(-9deg) scale(1.06); } 48% { transform: translateY(2px) rotate(6deg); } 100% { transform: none; opacity: .6; } }
.fp-fish.hint .fp-tag { animation: fpHint .55s ease-in-out infinite alternate; }
@keyframes fpHint { from { box-shadow: 0 0 0 3px #ffd85e; } to { box-shadow: 0 0 0 7px rgba(255, 216, 94, .6), 0 0 18px 6px rgba(255, 216, 94, .65); } }
@media (hover: hover) {
  .fp-fish:not(.hooked):not(.flee):hover .fp-in { transform: scale(1.08); }
  .fp-fish:not(.hooked):not(.flee):hover .fp-tag { box-shadow: 0 0 0 4px rgba(255, 255, 255, .7); }
}
/* bắn nước khi chọn nhầm */
.fp-splash { position: absolute; z-index: 7; width: 0; height: 0; pointer-events: none; }
.fp-splash::before { content: ""; position: absolute; left: -44px; top: -18px; width: 88px; height: 36px; border-radius: 50%; border: 4px solid #fff; box-shadow: 0 0 0 2px rgba(255, 255, 255, .45); animation: fpRing .65s ease-out forwards; }
.fp-splash i { position: absolute; left: -6px; top: -9px; width: 12px; height: 17px; border-radius: 50% 50% 50% 50% / 62% 62% 38% 38%; background: #d4efff; border: 1.5px solid var(--ink-ic); transform: rotate(var(--a)); animation: fpDrop .6s cubic-bezier(.2, .7, .4, 1) forwards; }
@keyframes fpRing { from { transform: scale(.3); opacity: 1; } to { transform: scale(1.4); opacity: 0; } }
@keyframes fpDrop { 0% { transform: rotate(var(--a)) translateY(-6px); } 100% { transform: rotate(var(--a)) translateY(-44px) scale(.55); opacity: 0; } }
.fp-fish .g3-say { top: auto; bottom: -4px; transform: translate(-50%, 100%); animation-name: fpSayIn; }
@keyframes fpSayIn { from { opacity: 0; transform: translate(-50%, 60%) scale(.5); } }

/* =========================================================
   2. MOCHI ĐẬP CHỮ — bãi cỏ 3×3 hang
   ========================================================= */
.wk-head { display: flex; align-items: center; gap: 10px; max-width: 580px; margin: 0 auto 12px; }
.wk-mochi { flex: none; width: 80px; height: 80px; transform-origin: 50% 100%; }
.wk-mochi .mascot { display: block; }
.wk-ask {
  position: relative; flex: 1; min-width: 0; display: flex; align-items: center; gap: 12px; min-height: 76px; margin-left: 8px; padding: 8px 18px;
  border-radius: 22px; background: var(--card); border: 1.5px solid var(--line); box-shadow: var(--sh-1); cursor: pointer; text-align: left; color: var(--ink); font: inherit;
  transition: transform .3s var(--spring), box-shadow .25s;
}
.wk-ask::before { content: ""; position: absolute; left: -9px; top: 50%; width: 16px; height: 16px; margin-top: -8px; background: var(--card); border-left: 1.5px solid var(--line); border-bottom: 1.5px solid var(--line); border-radius: 0 0 0 5px; transform: rotate(45deg); }
.wk-ask:active { transform: scale(.97); }
.wk-ask.new { animation: g3pop .5s var(--spring); }
.wa-t { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.wa-t small { font: 800 12.5px/1.3 var(--f-body); color: var(--ink2); }
.wa-t b { font: 900 38px/1.05 var(--f-body); color: var(--pri-t); letter-spacing: .5px; }
.wa-t b.jp { font: 600 42px/1.1 var(--f-kana); color: var(--ink); letter-spacing: 0; }
.wa-side { flex: none; display: flex; flex-direction: column; align-items: flex-end; gap: 10px; color: var(--ink3); }
.wk-pips { display: flex; gap: 5px; }
.wk-pips i { width: 12px; height: 12px; border-radius: 50%; background: var(--bg2); border: 1.5px solid var(--line2); transition: background .2s, border-color .2s, transform .4s var(--spring); }
.wk-pips i.on { background: var(--sun); border-color: var(--sun-d); transform: scale(1.22); }

.wk-field {
  padding: 16px;
  background:
    radial-gradient(circle at 50% 50%, rgba(255, 255, 255, .55) 0 1.6px, transparent 2.4px) 0 0 / 34px 34px,
    radial-gradient(ellipse at 50% 0%, rgba(255, 255, 255, .6), transparent 60%),
    linear-gradient(#e2f5d3, #c8ebb2);
}
.wk-deco { position: absolute; inset: 0; z-index: 0; pointer-events: none; }
.wk-fl { position: absolute; }
.wk-tuft { position: absolute; height: auto; }
.wk-tuft .k { stroke: #6fbf5f; stroke-width: 2.2; }
.wk-petal { position: absolute; top: -16px; left: var(--l); width: 12px; height: 9px; border-radius: 80% 0 80% 0; background: #ffc4d4; box-shadow: inset -2px -2px 0 rgba(255, 143, 174, .5); opacity: 0; animation: wkPetal var(--d) linear infinite var(--dl); }
@keyframes wkPetal { 0% { opacity: 0; transform: translate(0, 0) rotate(0); } 10% { opacity: .95; } 90% { opacity: .9; } 100% { opacity: 0; transform: translate(70px, 600px) rotate(320deg); } }
.wk-grid { position: relative; z-index: 2; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; max-width: 540px; margin: 0 auto; }
.wk-cell { position: relative; aspect-ratio: 1 / .82; padding: 0; border: 0; border-radius: 22px; background: none; cursor: pointer; container-type: inline-size; -webkit-tap-highlight-color: transparent; outline: none; }
.wk-cell:focus-visible { box-shadow: 0 0 0 3px var(--pri); }
.wk-cell kbd { position: absolute; left: 50%; bottom: -2%; z-index: 4; transform: translateX(-50%); min-width: 20px; height: 20px; font-size: 10.5px; opacity: .85; pointer-events: none; }
.wk-hole, .wk-lip { position: absolute; left: 6%; bottom: 7%; width: 88%; height: 30%; overflow: visible; pointer-events: none; }
.wk-hole .k, .wk-lip .k { stroke-width: 2.4; }
.wk-lip { z-index: 2; }
.wk-clip { position: absolute; z-index: 1; left: 14.8%; right: 14.8%; top: 0; bottom: 11.5%; overflow: hidden; border-radius: 0 0 50% 50% / 0 0 10.7% 10.7%; pointer-events: none; }
.wk-mole { position: absolute; left: 0; right: 0; bottom: -3%; aspect-ratio: 1; transform: translateY(115%); transition: transform .22s cubic-bezier(.55, 0, .8, .3); }
.wk-cell.up .wk-mole { transform: translateY(0); transition: transform .4s var(--spring); }
.wk-bod { position: absolute; inset: 0; transform-origin: 50% 100%; transition: transform .3s var(--spring); }
.wk-svg { display: block; width: 100%; height: 100%; overflow: visible; }
.wk-svg .k { stroke-width: 3; }
.wk-svg .e-x, .wk-svg .e-w { display: none; }
.wk-cell.hit .e-n, .wk-cell.oops .e-n { display: none; }
.wk-cell.hit .e-x, .wk-cell.oops .e-w { display: inline; }
.wk-tag {
  position: absolute; left: 50%; top: 61%; transform: translate(-50%, -50%); display: grid; place-items: center;
  min-width: 31cqw; height: 31cqw; padding: 0 3cqw; border-radius: 999px; background: #fff; border: 2px solid var(--ink-ic);
  box-shadow: inset 0 -3px 0 rgba(58, 46, 77, .07); color: #3a2e4d; font: 600 22px/1 var(--f-kana); font-size: min(22cqw, 36px); white-space: nowrap;
}
.wk-tag.ro { font: 900 15px/1 var(--f-body); font-size: min(13cqw, 22px); }
.wk-cell.hit .wk-bod { transform: scale(1.16, .74); transition-duration: .08s; }
.wk-cell.oops .wk-bod { animation: wkTease .5s ease; }
.wk-cell.oops .wk-tag { border-color: var(--red); box-shadow: 0 0 0 3px var(--red-l); }
@keyframes wkTease { 20% { transform: rotate(-8deg); } 45% { transform: rotate(6deg); } 70% { transform: rotate(-3deg); } }
.wk-stars { position: absolute; z-index: 3; left: 50%; top: 0; width: 62%; height: 22%; transform: translateX(-50%); display: none; pointer-events: none; }
.wk-cell.hit .wk-stars { display: block; }
.wk-stars i { position: absolute; top: 40%; width: 17cqw; height: 17cqw; max-width: 26px; max-height: 26px; background: #ffd85e; clip-path: polygon(50% 0, 62% 35%, 98% 36%, 69% 58%, 80% 94%, 50% 72%, 20% 94%, 31% 58%, 2% 36%, 38% 35%); animation: wkStar .6s ease-out both; }
.wk-stars i:nth-child(1) { left: 0; --x: -9px; }
.wk-stars i:nth-child(2) { left: 50%; margin-left: -8.5cqw; top: 0; --x: 0px; animation-delay: .05s; }
.wk-stars i:nth-child(3) { right: 0; --x: 9px; animation-delay: .1s; }
@keyframes wkStar { 0% { opacity: 0; transform: translateY(12px) scale(.2); } 40% { opacity: 1; transform: translateY(-4px) scale(1.15); } 100% { opacity: 0; transform: translate(var(--x), -16px) rotate(70deg) scale(.7); } }
.wk-cell.dust::after { content: ""; position: absolute; left: 30%; bottom: 13%; width: 40%; height: 14%; border-radius: 50%; background: radial-gradient(closest-side, rgba(226, 180, 138, .9), rgba(226, 180, 138, 0)); pointer-events: none; animation: wkDust .45s ease-out forwards; }
@keyframes wkDust { from { transform: scale(.4); opacity: 1; } to { transform: scale(1.6, 1.2) translateY(-6px); opacity: 0; } }
.wk-cell .g3-say { top: 2%; transform: translate(-50%, 0); font-size: 13px; padding: 3px 9px; }
@keyframes wkSayIn { from { opacity: 0; transform: translate(-50%, 6px) scale(.5); } }
.wk-cell .g3-say { animation-name: wkSayIn; }
@media (hover: hover) { .wk-cell.up:not(.hit):not(.oops):hover .wk-bod { transform: scale(1.04); } }

/* búa piko piko */
.wk-mallet { position: absolute; left: 0; top: 0; z-index: 20; width: 108px; height: 108px; pointer-events: none; opacity: 0; transition: opacity .18s; will-change: transform; }
.wk-mallet.show { opacity: 1; }
.wm-in { width: 100%; height: 100%; transform-origin: 91.25% 61.25%; transform: rotate(38deg); filter: drop-shadow(0 6px 4px rgba(58, 46, 77, .2)); }
.wm-in svg { display: block; width: 100%; height: 100%; overflow: visible; }
.wm-in .k { stroke-width: 3; }
.wk-mallet.swing .wm-in { animation: wkSwing .32s cubic-bezier(.3, .7, .4, 1); }
@keyframes wkSwing { 0% { transform: rotate(38deg); } 34% { transform: rotate(-7deg) scale(1.02, .96); } 54% { transform: rotate(3deg); } 100% { transform: rotate(38deg); } }
.wk-field.fine, .wk-field.fine .wk-cell { cursor: none; }

/* =========================================================
   3. BÓNG BAY あいうえお — hàng ô chữ + bầu trời
   ========================================================= */
.bl-row { display: flex; align-items: center; gap: 12px; min-height: 86px; padding: 10px 14px; margin-bottom: 12px; border-radius: 22px; background: var(--card); border: 1.5px solid var(--line); box-shadow: var(--sh-1); }
.bl-rowname { flex: none; display: flex; flex-direction: column; align-items: center; min-width: 58px; line-height: 1; }
.bl-rowname small { font: 800 11px/1.2 var(--f-body); color: var(--ink2); text-transform: uppercase; letter-spacing: .6px; }
.bl-rowname b { font: 600 34px/1.15 var(--f-kana); color: var(--pri-t); }
.bl-rowname span { font: 800 11px/1.2 var(--f-body); color: var(--ink3); }
.bl-slots { flex: 1; min-width: 0; display: grid; grid-template-columns: repeat(var(--n, 5), minmax(0, 96px)); justify-content: center; gap: 10px; padding-right: 58px; }
.bl-slot {
  position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; height: 72px; border-radius: 18px;
  border: 2px dashed var(--line2); background: var(--card2); transition: background .25s, border-color .25s;
}
.bl-sk { display: block; height: 34px; font: 600 34px/34px var(--f-kana); color: var(--ink); }
.bl-slot small { font: 800 14px/1 var(--f-body); color: var(--ink3); }
.bl-slot small b { font-weight: 900; color: var(--pri-t); }
.bl-slot.next { border-style: solid; border-color: color-mix(in srgb, var(--pri) 70%, var(--line)); background: var(--pri-l); animation: blNext 1.3s ease-in-out infinite; }
.bl-slot.next small { color: var(--pri-t); }
.bl-slot.on { border-style: solid; border-color: var(--mint); background: var(--mint-l); animation: none; }
.bl-slot.on small, .bl-slot.on small b { color: var(--mint-t); }
.bl-slot.on .bl-sk { animation: bounceIn .5s var(--spring); }
.bl-row.new .bl-slot { animation: blIn .45s var(--spring) backwards; animation-delay: calc(var(--i) * .05s); }
.bl-row.new .bl-slot.next { animation: blIn .45s var(--spring) backwards, blNext 1.3s ease-in-out .5s infinite; }
.bl-row.done .bl-slot.on { animation: blWave .6s var(--spring) both; animation-delay: calc(var(--i) * .07s); }
.bl-slot.shake { animation: shake .4s ease; }
@keyframes blNext { 50% { box-shadow: 0 0 0 5px color-mix(in srgb, var(--pri) 20%, transparent); } }
@keyframes blIn { from { opacity: 0; transform: translateY(10px) scale(.9); } }
@keyframes blWave { 40% { transform: translateY(-9px) scale(1.07); } }

.bl-sky { --bw: 76px; height: 460px; background: linear-gradient(#c6e4ff 0%, #e1f0ff 52%, #fde8f1 100%); }
.bl-sun { position: absolute; left: 14px; top: 12px; z-index: 0; animation: float 5s ease-in-out infinite; }
.bl-sun .ic { display: block; filter: drop-shadow(0 0 14px rgba(255, 216, 94, .75)); }
.bl-cloud { position: absolute; left: 0; z-index: 1; animation: g3cloud 64s linear infinite; }
.bl-cloud.c1 { top: 86px; width: 104px; height: 49px; animation-delay: -14s; }
.bl-cloud.c2 { top: 200px; width: 76px; height: 36px; opacity: .85; animation-duration: 88s; animation-delay: -52s; }
.bl-cloud.c3 { top: 24px; width: 60px; height: 28px; opacity: .9; animation-duration: 100s; animation-delay: -74s; }
.bl-layer { position: absolute; inset: 0; z-index: 3; }
.bl-hills { position: absolute; left: 0; bottom: 0; z-index: 4; width: 100%; height: 80px; pointer-events: none; }
.bl-flw { position: absolute; bottom: 8px; z-index: 5; pointer-events: none; }
.bl-flw .ic { display: block; }
.bl-mochi { position: absolute; right: 5%; bottom: 10px; z-index: 6; pointer-events: none; transform-origin: 50% 100%; }
.bl-mochi .mascot { display: block; }

.bl-b { position: absolute; left: 0; top: 0; width: var(--bw); height: calc(var(--bw) * 1.75); padding: 0; border: 0; background: none; cursor: pointer; will-change: transform; -webkit-tap-highlight-color: transparent; outline: none; }
.bl-in { position: absolute; inset: 0; display: block; transform-origin: 50% 32%; transition: transform .3s var(--spring); }
.bl-svg { display: block; width: 100%; height: 100%; overflow: visible; filter: drop-shadow(0 8px 8px rgba(80, 60, 120, .13)); }
.bl-body { transform-box: fill-box; transform-origin: 50% 45%; }
.bl-str { transform-box: fill-box; transform-origin: 50% 0; }
.bl-k { position: absolute; left: 50%; top: 32%; transform: translate(-50%, -50%); font: 600 calc(var(--bw) * .44)/1 var(--f-kana); color: #3a2e4d; text-shadow: 0 1.5px 0 rgba(255, 255, 255, .85); pointer-events: none; }
.bl-b.in .bl-in { animation: blInflate .6s var(--spring) backwards; animation-delay: var(--dl, 0s); }
@keyframes blInflate { from { opacity: 0; transform: translateY(26px) scale(.25); } }
.bl-b:focus-visible .bl-svg { filter: drop-shadow(0 0 0 var(--pri)) drop-shadow(0 0 5px var(--pri)); }
@media (hover: hover) { .bl-b:not(.popped):hover .bl-in { transform: scale(1.07); } }
.bl-b.popped { pointer-events: none; }
.bl-b.popped .bl-body { animation: blPop .26s ease-out forwards; }
.bl-b.popped .bl-k { opacity: 0; }
.bl-b.popped .bl-str { animation: blStr .7s ease-in forwards; }
@keyframes blPop { 40% { transform: scale(1.22); } 100% { transform: scale(1.5); opacity: 0; } }
@keyframes blStr { to { transform: translateY(70px) rotate(18deg); opacity: 0; } }
.bl-b.no .bl-in { animation: blNo .5s ease; }
@keyframes blNo { 15% { transform: rotate(-11deg); } 35% { transform: rotate(9deg); } 55% { transform: rotate(-6deg); } 75% { transform: rotate(3deg); } }
.bl-b.hint .bl-svg { filter: drop-shadow(0 0 8px rgba(255, 200, 60, .95)) drop-shadow(0 0 2px #ffb800); }
.bl-b.hint .bl-in { animation: blHint 1s ease-in-out infinite; }
@keyframes blHint { 50% { transform: scale(1.09); } }
.bl-say {
  position: absolute; left: 50%; top: 56%; transform: translate(-50%, 0); padding: 3px 10px; border-radius: 999px; white-space: nowrap; pointer-events: none; opacity: 0;
  background: var(--card); border: 1.5px solid var(--line); box-shadow: var(--sh-1); color: var(--ink); font: 900 13.5px/1.2 var(--f-body);
}
.bl-say.show { animation: blSay 1.6s ease both; }
@keyframes blSay { 0% { opacity: 0; transform: translate(-50%, 6px) scale(.6); } 14% { opacity: 1; transform: translate(-50%, 0) scale(1.06); } 24% { transform: translate(-50%, 0) scale(1); } 80% { opacity: 1; } 100% { opacity: 0; } }
.bl-fly { position: absolute; left: 0; top: 0; z-index: 60; transform: translate(-50%, -50%); font: 600 34px/1 var(--f-kana); color: var(--ink); text-shadow: 0 2px 0 var(--card); pointer-events: none; transition: transform .5s cubic-bezier(.5, -.35, .3, 1.25); }
.bl-banner { position: absolute; inset: 0; z-index: 9; display: grid; place-items: center; pointer-events: none; }
.bl-banner > div {
  display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 14px 28px 16px; border-radius: 26px; background: var(--card); border: 1.5px solid var(--line); box-shadow: var(--sh-2);
  animation: g3pop .55s var(--spring) backwards, g3out .28s ease 1.12s forwards;
}
.bl-banner small { display: inline-flex; align-items: center; gap: 4px; font: 800 14px var(--f-body); color: var(--pri-t); }
.bl-banner b { font: 600 44px/1.15 var(--f-kana); letter-spacing: 6px; color: var(--ink); }
.bl-banner span { padding: 3px 12px; border-radius: 999px; background: var(--mint-l); color: var(--mint-t); font: 900 13.5px var(--f-body); }

/* =========================================================
   ĐIỆN THOẠI
   ========================================================= */
@media (max-width: 760px) {
  .g3 { padding: 14px 20px 56px; }
  .g3-top { gap: 8px; margin-bottom: 12px; }
  .g3-timer { gap: 6px; padding: 0 12px 0 5px; }
  .g3-timer > .ic { width: 26px; height: 26px; }
  .g3-timer b { font-size: 16px; }
  .g3-score { gap: 4px; padding: 0 12px 0 8px; font-size: 17px; }
  .g3-score > .ic { width: 20px; height: 20px; }
  .g3-mult { height: 22px; padding: 0 7px; font-size: 12.5px; }
  .g3-scene { border-radius: 24px; }
  .g3-tip { font-size: 12.5px; margin-top: 10px; }
  .g3-float { font-size: 22px; }
  .fp-scene, .bl-sky { height: 400px; height: clamp(380px, calc(100svh - 230px), 520px); }
  .fp-ask { top: 10px; right: 10px; min-width: 0; padding: 6px 16px 8px; border-radius: 18px; }
  .fp-ask small { font-size: 11px; }
  .fp-ask b { font-size: 30px; }
  .fp-ask b.jp { font-size: 34px; }
  .wk-head { gap: 6px; margin-bottom: 10px; }
  .wk-mochi, .wk-mochi .mascot { width: 66px; height: 66px; }
  .wk-ask { min-height: 66px; padding: 6px 14px; gap: 8px; border-radius: 18px; }
  .wa-t small { font-size: 11.5px; }
  .wa-t b { font-size: 32px; }
  .wa-t b.jp { font-size: 36px; }
  .wk-field { padding: 10px; }
  .wk-grid { gap: 8px; }
  .wk-mallet { width: 72px; height: 72px; }
  .bl-row { gap: 8px; min-height: 76px; padding: 8px 10px; border-radius: 18px; margin-bottom: 10px; }
  .bl-rowname { min-width: 40px; }
  .bl-rowname b { font-size: 28px; }
  .bl-slots { gap: 5px; padding-right: 0; }
  .bl-slot { height: 58px; border-radius: 13px; gap: 3px; }
  .bl-sk { height: 26px; font-size: 25px; line-height: 26px; }
  .bl-slot small { font-size: 11.5px; }
  .bl-slot small { font-size: 11.5px; }
  .bl-sun .ic { width: 52px; height: 52px; }
  .bl-mochi .mascot { width: 58px; height: 58px; }
  .bl-hills { height: 66px; }
  .bl-banner b { font-size: 36px; letter-spacing: 4px; }
  .bl-fly { font-size: 28px; }
}

/* =========================================================
   GIẢM CHUYỂN ĐỘNG
   ========================================================= */
html[data-motion="reduce"] .fp-cloud, html[data-motion="reduce"] .bl-cloud, html[data-motion="reduce"] .fp-wave, html[data-motion="reduce"] .fp-rays { animation: none !important; }
html[data-motion="reduce"] .fp-cloud { transform: translateX(42vw); }
html[data-motion="reduce"] .bl-cloud.c1 { transform: translateX(30vw); }
html[data-motion="reduce"] .bl-cloud.c2 { transform: translateX(55vw); }
html[data-motion="reduce"] .bl-cloud.c3 { transform: translateX(20vw); }
html[data-motion="reduce"] .fp-bub, html[data-motion="reduce"] .fp-rip, html[data-motion="reduce"] .wk-petal { display: none; }
html[data-motion="reduce"] .fp-fish.new .fp-in, html[data-motion="reduce"] .bl-b.in .bl-in, html[data-motion="reduce"] .bl-row.new .bl-slot { animation: none !important; }
html[data-motion="reduce"] .g3-float { animation: g3fade 1s linear forwards !important; transform: translate(-50%, -70%); }
html[data-motion="reduce"] .bl-say.show { animation: g3hold 1.6s linear both !important; }
html[data-motion="reduce"] .bl-banner > div { animation: g3hold 1.4s linear both !important; }
html[data-motion="reduce"] .g3-tdelta { animation: g3fade 1.1s linear forwards !important; transform: translateY(-125%); }
@keyframes g3fade { 0%, 70% { opacity: 1; } 100% { opacity: 0; } }
@keyframes g3hold { 0%, 92% { opacity: 1; } 100% { opacity: 0; } }

/* =========================================================
   Mưa chữ — giọt mưa chứa chữ (trước đây chưa có kiểu nên chữ dồn sang trái)
   ========================================================= */
.rain-area { background: linear-gradient(180deg, #cfe8ff 0%, #e6f3ff 45%, #fff6f9 100%); }
.rain-area .rain-cloud.c1 { left: 24%; top: 6px; animation: rainCloud 7s ease-in-out infinite; }
.rain-area .rain-cloud.c2 { left: 76%; top: 14px; animation: rainCloud 9s ease-in-out infinite reverse; opacity: .9; }
@keyframes rainCloud { 50% { translate: 14px 3px; } }
.rain-ground { height: 30px; opacity: 1; background: linear-gradient(180deg, #a8e6a1, #7fd38a); border-radius: 50% 50% 0 0 / 60% 60% 0 0; box-shadow: inset 0 4px 0 rgba(255, 255, 255, .35); }
.rain-item { position: absolute; top: 0; z-index: 2; width: 66px; height: 72px; display: grid; place-items: center; padding-top: 10px; color: var(--ink); font: 700 33px/1 var(--f-kana);
  background: radial-gradient(circle at 36% 40%, #fff 0 18%, #eef8ff 46%, #cfe7ff 100%); border: 2px solid #a9d3fa;
  border-radius: 50% 50% 50% 50% / 62% 62% 40% 40%; box-shadow: inset -4px -6px 0 rgba(90, 160, 230, .16), 0 10px 16px -12px rgba(40, 110, 190, .65); will-change: transform; transition: border-color .2s, box-shadow .2s, color .2s; }
.rain-item::before { content: ""; position: absolute; top: -9px; left: 50%; width: 16px; height: 16px; margin-left: -8px; background: inherit; border: 2px solid #a9d3fa; border-right: 0; border-bottom: 0; border-radius: 3px 0 0 0; transform: rotate(45deg); z-index: -1; }
.rain-item.target { color: var(--pri-t); border-color: var(--pri); box-shadow: 0 0 0 5px rgba(255, 107, 154, .18), 0 12px 18px -12px var(--pri); }
.rain-item.target::before { border-color: var(--pri); }
.rain-item.boom { animation: rainBoom .5s ease forwards; }
.rain-item.splat { animation: rainSplat .55s ease forwards; border-color: var(--red); color: var(--red-t); }
.rain-item .boom-r { top: -14px; left: 50%; padding: 2px 9px; border-radius: 999px; background: #fff; box-shadow: var(--sh-1); font-size: 15px; }
.rain-item.splat .boom-r { color: var(--red-t); }
@keyframes rainBoom { 40% { scale: 1.25; } to { scale: 1.7; opacity: 0; } }
@keyframes rainSplat { 30% { scale: 1.2 .8; } to { scale: 1.6 .2; opacity: 0; } }
html[data-motion="reduce"] .rain-area .rain-cloud { animation: none; }
