/* =========================================================
   SubelJapan — "Mochi Soft": bỏ cạnh nổi kiểu nhựa → phẳng, mềm, bóng mờ
   + hoạt ảnh chuyển trang + Mochi đi dạo
   ========================================================= */
:root {
  --sh-1: 0 1px 2px rgba(58, 46, 77, .05), 0 6px 18px -10px rgba(58, 46, 77, .18);
  --sh-2: 0 2px 4px rgba(58, 46, 77, .05), 0 16px 32px -14px rgba(58, 46, 77, .24);
  --spring: cubic-bezier(.34, 1.56, .64, 1);
}
[data-dark] { --sh-1: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 20px -10px rgba(0, 0, 0, .6); --sh-2: 0 2px 4px rgba(0, 0, 0, .3), 0 18px 34px -14px rgba(0, 0, 0, .7); }

/* ---------- nút ---------- */
.btn {
  --b: var(--pri); --bt: #fff; --bs: color-mix(in srgb, var(--b) 55%, transparent);
  border: 0; border-radius: 999px; font-weight: 800; letter-spacing: .1px;
  background: var(--b); color: var(--bt);
  box-shadow: 0 8px 18px -10px var(--bs);
  transition: transform .35s var(--spring), box-shadow .25s, background .2s, color .2s;
}
.btn:hover { filter: none; transform: translateY(-2px); box-shadow: 0 14px 24px -12px var(--bs); background: color-mix(in srgb, var(--b) 90%, #fff); }
.btn:active { transform: scale(.94, .9); transition-duration: .09s; box-shadow: 0 4px 10px -8px var(--bs); }
.btn-sm, .btn-sm:hover { box-shadow: 0 6px 14px -10px var(--bs); }
.btn-sm:active { transform: scale(.93, .88); box-shadow: none; }
.btn-white, .btn-paper { --b: var(--card); --bt: var(--ink); --bs: rgba(58, 46, 77, .35); border: 1.5px solid var(--line); box-shadow: var(--sh-1); }
.btn-white:hover, .btn-paper:hover { background: var(--card); border-color: color-mix(in srgb, var(--pri) 40%, var(--line)); box-shadow: var(--sh-2); }
.btn-white:active, .btn-paper:active { box-shadow: var(--sh-1); }
.btn-soft { --b: var(--pri-l); --bt: var(--pri-t); --bs: transparent; box-shadow: none; }
.btn-green { --b: color-mix(in srgb, var(--mint) 66%, #0b6b4a); } /* xanh đậm hơn chút để chữ trắng rõ */
.btn-red { --b: var(--red); }
.btn-sky { --b: var(--sky); }
.btn-lav { --b: var(--lav); }
.btn-yel { --b: var(--sun); --bt: #5a3d00; }
.btn-ghost { --b: transparent; --bt: var(--pri-t); box-shadow: none; }
.btn-ghost:hover { background: var(--pri-l); box-shadow: none; transform: none; }
.btn[disabled], .btn.disabled { --b: var(--bg2); --bt: var(--ink3); box-shadow: none; border-color: transparent; transform: none; opacity: 1; cursor: not-allowed; }
.ub-guide { --b: rgba(255, 255, 255, .2); --bt: #fff; --bs: transparent; border: 1.5px solid rgba(255, 255, 255, .55); box-shadow: none; }
.ub-guide:hover { background: rgba(255, 255, 255, .3); box-shadow: none; }
.pn-pop .btn { --b: #fff; --bt: var(--uc); --bs: rgba(0, 0, 0, .3); }
.pn-pop .btn:hover { background: #fff; }
.icon-btn, .say-btn, .fav-btn { border: 1.5px solid var(--line); box-shadow: var(--sh-1); transition: transform .3s var(--spring), box-shadow .2s; }
.icon-btn:hover, .say-btn:hover, .fav-btn:hover { transform: translateY(-2px); box-shadow: var(--sh-2); }
.icon-btn:active, .say-btn:active, .fav-btn:active { transform: scale(.9); box-shadow: var(--sh-1); }
.chip-btn { border: 1.5px solid var(--line); box-shadow: none; transition: transform .3s var(--spring), background .2s, border-color .2s, color .2s; }
.chip-btn:active { transform: scale(.93); box-shadow: none; }
.chip-btn.active { box-shadow: none; border-color: color-mix(in srgb, var(--pri) 60%, var(--line)); }
.seg { border: 0; background: var(--bg2); }
.seg button { transition: background .25s, color .2s, transform .3s var(--spring); }
.seg button:active { transform: scale(.94); }
.seg button.active { box-shadow: var(--sh-1); }

/* ---------- thẻ & khối ---------- */
.card, .paper { border: 1.5px solid var(--line); box-shadow: var(--sh-1); }
.card.hov { transition: transform .35s var(--spring), box-shadow .25s; }
.card.hov:hover { transform: translateY(-4px); box-shadow: var(--sh-2); border-color: var(--line); }
.card.hov:active { transform: scale(.98); box-shadow: var(--sh-1); }
.mode-card { border: 1.5px solid var(--line); box-shadow: var(--sh-1); transition: transform .35s var(--spring), box-shadow .25s; }
.mode-card:hover { transform: translateY(-4px); box-shadow: var(--sh-2); }
.mode-card:active { transform: scale(.97); box-shadow: var(--sh-1); }
.unit-banner { box-shadow: 0 16px 30px -18px var(--ucd); }
.ub-icon { box-shadow: 0 6px 14px -8px rgba(0, 0, 0, .3); }
.page-head .ph-icon { border: 1.5px solid var(--line); box-shadow: var(--sh-1); }
.glyph, .sv-box, .vc-pic, .chip-kana, .chip-pic, .shop-item .si-pic, .b-pic { box-shadow: none; border-width: 1.5px; }
.spad-svg { border-width: 1.5px; box-shadow: var(--sh-1); }
.spad.complete .spad-svg { box-shadow: 0 0 0 4px var(--mint-l), var(--sh-1); }
.pad-canvas { box-shadow: var(--sh-1); }
.bubble { box-shadow: var(--sh-1); border-width: 1.5px; }
.bubble::before { border-width: 1.5px; }
.kcell { border-width: 1.5px; box-shadow: none; transition: transform .3s var(--spring), background .2s, border-color .2s, box-shadow .2s; }
.kcell:hover { transform: translateY(-3px); box-shadow: var(--sh-1); }
.kcell:active { transform: scale(.92); box-shadow: none; }
.wl-c { border-width: 1.5px; transition: transform .3s var(--spring); }
.wl-c:active { transform: scale(.9); }
.wl-c.on { box-shadow: 0 8px 16px -10px var(--pri); }
.gj-c.on { box-shadow: none; }
.side-me, .chip, .toast { border-width: 1.5px; }
.modal { border: 0; }
.tile, .slot.filled { border-width: 1.5px; box-shadow: var(--sh-1); transition: transform .3s var(--spring); }
.tile:active { transform: scale(.9); box-shadow: none; }
.mem-front, .mem-back { box-shadow: var(--sh-1); border-width: 1.5px; }
.mem-back { box-shadow: 0 10px 20px -12px var(--pri); }
.listen-btn { box-shadow: 0 14px 26px -14px var(--sky); transition: transform .35s var(--spring); }
.listen-btn:active { transform: scale(.9); box-shadow: 0 6px 12px -10px var(--sky); }
.listen-slow { box-shadow: none; }
.shop-item.worn { box-shadow: 0 0 0 3px var(--pri-l), var(--sh-1); }
.drill-bar { box-shadow: var(--sh-2); }
.lesson-foot { border-top-width: 1.5px; }

/* ---------- lựa chọn trong bài tập ---------- */
.opt { border: 2px solid var(--line); box-shadow: var(--sh-1); transition: transform .35s var(--spring), box-shadow .2s, background .2s, border-color .2s, color .2s; }
.opt:hover:not(:disabled) { transform: translateY(-2px); border-color: color-mix(in srgb, var(--pri) 45%, var(--line)); background: var(--card); box-shadow: var(--sh-2); }
.opt:active:not(:disabled) { transform: scale(.96); box-shadow: var(--sh-1); }
.opt.ok { box-shadow: 0 0 0 4px color-mix(in srgb, var(--mint) 22%, transparent); }
.opt.bad { box-shadow: 0 0 0 4px color-mix(in srgb, var(--red) 18%, transparent); }
.pairs .opt.sel { box-shadow: 0 0 0 4px color-mix(in srgb, var(--sky) 22%, transparent); transform: translateY(-2px); }
@keyframes okPop { 0% { transform: scale(1); } 35% { transform: scale(1.07); } 100% { transform: scale(1); } }

/* ---------- nút lộ trình: gối mochi mềm ---------- */
.pn-btn { box-shadow: inset 0 0 0 4px color-mix(in srgb, var(--uc) 35%, var(--card)), 0 12px 22px -14px var(--uc); transition: transform .4s var(--spring), box-shadow .25s; }
.pn-btn:hover { transform: translateY(-3px) scale(1.04); }
.pn-btn:active { transform: scale(.9, .84); }
.pnode.done .pn-btn { box-shadow: inset 0 -5px 0 rgba(0, 0, 0, .08), 0 12px 22px -12px var(--uc); }
.pnode.done .pn-btn:active { box-shadow: inset 0 -3px 0 rgba(0, 0, 0, .08), 0 6px 12px -10px var(--uc); }
.pnode.cur .pn-btn { box-shadow: inset 0 -6px 0 rgba(0, 0, 0, .08), 0 16px 26px -12px var(--uc); animation: nodeBreath 2.6s ease-in-out infinite; }
@keyframes nodeBreath { 50% { transform: scale(1.05); } }
.pnode.cur .pn-btn:active { animation: none; }
.pnode.chest .pn-btn { box-shadow: inset 0 0 0 2px var(--line), var(--sh-1); }
.pnode.chest.ready .pn-btn { box-shadow: inset 0 0 0 3px var(--sun), 0 12px 22px -12px var(--sun-d); }
.pn-start { border-width: 1.5px; box-shadow: var(--sh-1); }
.pn-start::after { border-width: 1.5px; }

/* =========================================================
   HOẠT ẢNH
   ========================================================= */
@keyframes viewIn { from { opacity: 0; transform: translateY(16px); } }
.view-in :is(.main-col, .rail, .page, .page-mid, .page-narrow, .game-setup) > * { animation: viewIn .55s cubic-bezier(.2, .9, .3, 1.15) both; }
.view-in :is(.main-col, .rail, .page, .page-mid, .page-narrow, .game-setup) > :nth-child(2) { animation-delay: .05s; }
.view-in :is(.main-col, .rail, .page, .page-mid, .page-narrow, .game-setup) > :nth-child(3) { animation-delay: .1s; }
.view-in :is(.main-col, .rail, .page, .page-mid, .page-narrow, .game-setup) > :nth-child(4) { animation-delay: .15s; }
.view-in :is(.main-col, .rail, .page, .page-mid, .page-narrow, .game-setup) > :nth-child(5) { animation-delay: .2s; }
.view-in :is(.main-col, .rail, .page, .page-mid, .page-narrow, .game-setup) > :nth-child(n+6) { animation-delay: .25s; }
.view-in :is(.game-grid, .mode-grid, .story-list, .shop-grid, .stat-grid, .badge-grid) > * { animation: viewIn .5s cubic-bezier(.2, .9, .3, 1.15) both; }
.view-in :is(.game-grid, .mode-grid, .story-list, .shop-grid, .stat-grid, .badge-grid) > :nth-child(2) { animation-delay: .04s; }
.view-in :is(.game-grid, .mode-grid, .story-list, .shop-grid, .stat-grid, .badge-grid) > :nth-child(3) { animation-delay: .08s; }
.view-in :is(.game-grid, .mode-grid, .story-list, .shop-grid, .stat-grid, .badge-grid) > :nth-child(4) { animation-delay: .12s; }
.view-in :is(.game-grid, .mode-grid, .story-list, .shop-grid, .stat-grid, .badge-grid) > :nth-child(5) { animation-delay: .16s; }
.view-in :is(.game-grid, .mode-grid, .story-list, .shop-grid, .stat-grid, .badge-grid) > :nth-child(n+6) { animation-delay: .2s; }
/* nút lộ trình bật lên khi cuộn tới */
.path.reveal .prow { opacity: 0; transform: translateY(18px) scale(.7); transition: opacity .35s, transform .55s var(--spring); }
.path.reveal .prow.in { opacity: 1; transform: none; }
/* chuyển thẻ trong bài học */
.slide-in-r { animation: slideInR .45s cubic-bezier(.2, .9, .3, 1.1) both; }
@keyframes slideInR { from { opacity: 0; transform: translateX(46px); } }
.quiz-opts .opt, .pairs .opt { animation: optIn .45s var(--spring) both; }
.quiz-opts .opt:nth-child(2), .pairs .opt:nth-child(2) { animation-delay: .05s; }
.quiz-opts .opt:nth-child(3), .pairs .opt:nth-child(3) { animation-delay: .1s; }
.quiz-opts .opt:nth-child(4), .pairs .opt:nth-child(4) { animation-delay: .15s; }
.pairs .opt:nth-child(n+5) { animation-delay: .2s; }
@keyframes optIn { from { opacity: 0; transform: translateY(14px) scale(.92); } }
.quiz-opts .opt.ok, .pairs .opt.done { animation: okPop .55s var(--spring); }
.quiz-opts .opt.bad { animation: shake .42s ease; }
.pairs .opt.err { animation: shake .4s ease; }
.q-big, .romaji-big, .q-word, .q-mean { animation: bounceIn .55s var(--spring) both .05s; }
.fb-badge { animation: bounceIn .5s var(--spring) both; }
.lesson-foot.ok, .lesson-foot.bad { animation: footIn .35s cubic-bezier(.2, .9, .3, 1.1); }
@keyframes footIn { from { transform: translateY(100%); } }
/* thanh tiến độ có ánh sáng chạy */
.bar > i { overflow: hidden; }
.lesson-prog > i::before { content: ""; position: absolute; top: 0; bottom: 0; width: 60px; left: -60px; background: linear-gradient(90deg, transparent, rgba(255, 255, 255, .55), transparent); animation: shine 2.6s ease-in-out infinite; }
@keyframes shine { 0% { left: -60px; } 60%, 100% { left: calc(100% + 60px); } }
/* menu */
.side-nav a { transition: background .25s, color .2s, transform .3s var(--spring); }
.side-nav a:active { transform: scale(.95); }
.side-nav a.active .ic { animation: navPop .5s var(--spring); }
@keyframes navPop { 40% { transform: scale(1.2) rotate(-8deg); } }
.bottombar .bb-ico { transition: background .2s, transform .3s var(--spring); }
.bottombar a:active .bb-ico, .bottombar button:active .bb-ico { transform: scale(.85); }
.bottombar .active .bb-ico .ic { animation: navPop .5s var(--spring); }
/* hộp thoại bật như thạch */
.modal { transform: translateY(30px) scale(.9); transition: transform .45s var(--spring); }
/* tai Mochi khẽ vẫy */
.mascot .m-ear { transform-box: fill-box; }
.mascot .m-ear.l { transform-origin: 85% 100%; animation: earL 6.5s ease-in-out infinite; }
.mascot .m-ear.r { transform-origin: 15% 100%; animation: earR 7.3s ease-in-out infinite 1.4s; }
@keyframes earL { 0%, 86%, 100% { transform: none; } 89% { transform: rotate(-12deg); } 92% { transform: rotate(4deg); } 95% { transform: rotate(-5deg); } }
@keyframes earR { 0%, 86%, 100% { transform: none; } 89% { transform: rotate(12deg); } 92% { transform: rotate(-4deg); } 95% { transform: rotate(5deg); } }
.mascot .m-paw { transform-box: fill-box; transform-origin: 50% 0%; }

/* =========================================================
   MOCHI ĐI DẠO
   ========================================================= */
.pet { position: fixed; left: 0; top: 0; z-index: 60; width: var(--pw, 76px); height: var(--pw, 76px); touch-action: none; user-select: none; -webkit-user-select: none; cursor: grab; will-change: transform; }
.pet.held { cursor: grabbing; z-index: 70; }
.pet-tilt { width: 100%; height: 100%; transform-origin: 50% 25%; }
.pet-flip { width: 100%; height: 100%; transition: transform .25s var(--spring); }
.pet.left .pet-flip { transform: scaleX(-1); }
/* không dùng filter drop-shadow: Mochi cử động liên tục nên bóng lọc phải vẽ lại mỗi khung hình (đã có .pet-shadow dưới chân) */
.pet .mascot { width: 100%; height: 100%; display: block; overflow: visible; }
.pet .mascot > ellipse:first-of-type { display: none; }
.pet .m-body { transform-origin: 60px 110px; }
.pet.walk .m-body { animation: petBob .42s ease-in-out infinite; }
.pet.run .m-body { animation: petBob .24s ease-in-out infinite; }
@keyframes petBob { 0%, 100% { transform: translateY(0) rotate(0); } 25% { transform: translateY(-3px) rotate(-2deg); } 75% { transform: translateY(-3px) rotate(2deg); } }
.pet.walk .m-paw.l, .pet.run .m-paw.l { animation: pawStep .42s ease-in-out infinite; }
.pet.walk .m-paw.r, .pet.run .m-paw.r { animation: pawStep .42s ease-in-out infinite -.21s; }
.pet.run .m-paw.l { animation-duration: .24s; }
.pet.run .m-paw.r { animation-duration: .24s; animation-delay: -.12s; }
@keyframes pawStep { 0%, 100% { transform: translate(-4px, 0); } 25% { transform: translate(0, -5px); } 50% { transform: translate(4px, 0); } }
.pet.walk .m-tail, .pet.run .m-tail { animation-duration: .8s; }
.pet.idle .m-body, .pet.sit .m-body { animation: petBreath 2.8s ease-in-out infinite; }
.pet.sleep .m-body { animation: petBreath 3.6s ease-in-out infinite; }
@keyframes petBreath { 50% { transform: scale(1.03, .97); } }
.pet.held .m-body { transform-origin: 60px 30px; animation: petHang .9s ease-in-out infinite alternate; }
@keyframes petHang { from { transform: scale(.95, 1.1); } to { transform: scale(.97, 1.06); } }
.pet.held .m-paw { animation: dangle .45s ease-in-out infinite alternate; }
.pet.held .m-paw.r { animation-delay: -.22s; }
@keyframes dangle { from { transform: translateY(3px) rotate(-10deg); } to { transform: translateY(6px) rotate(10deg); } }
.pet.held .m-tail { animation: tail .5s ease-in-out infinite; }
.pet.air .m-body { transform: scale(.96, 1.05); transform-origin: 60px 70px; }
.pet.air .m-paw { transform: translateY(4px); }
.pet.landing .m-body { animation: petLand .5s var(--spring) !important; }
@keyframes petLand { 0% { transform: scale(1.3, .7); } 50% { transform: scale(.92, 1.08); } 100% { transform: none; } }
.pet-shadow { position: fixed; left: 0; top: 0; z-index: 59; width: 52px; height: 9px; border-radius: 50%; background: rgba(58, 46, 77, .16); pointer-events: none; transform-origin: center; }
.pet-bubble {
  position: absolute; bottom: calc(100% + 4px); left: 50%; z-index: 2; width: max-content; max-width: 230px; padding: 7px 13px; border-radius: 16px;
  background: var(--card); border: 1.5px solid var(--line); box-shadow: var(--sh-2); color: var(--ink); font: 800 13px/1.35 var(--f-body); text-align: center;
  transform: translateX(-50%) translateY(6px) scale(.6); transform-origin: 50% 100%; opacity: 0; pointer-events: none; transition: opacity .2s, transform .35s var(--spring);
}
.pet-bubble.show { opacity: 1; transform: translateX(-50%) translateY(0) scale(1); }
.pet-bubble .jp { display: block; color: var(--pri-t); font-size: 14px; }
.pet-bubble.to-left { left: auto; right: 0; transform: translateY(6px) scale(.6); transform-origin: 85% 100%; }
.pet-bubble.to-left.show { transform: none; }
.pet-bubble.to-right { left: 0; transform: translateY(6px) scale(.6); transform-origin: 15% 100%; }
.pet-bubble.to-right.show { transform: none; }
.pet-heart { position: fixed; z-index: 71; pointer-events: none; animation: heartUp 1.1s ease-out both; }
@keyframes heartUp { 0% { opacity: 0; transform: translateY(0) scale(.4); } 20% { opacity: 1; transform: translateY(-10px) scale(1.1); } 100% { opacity: 0; transform: translate(var(--hx), -80px) scale(.9); } }
@media print { .pet, .pet-shadow { display: none !important; } }
html[data-motion="reduce"] .path.reveal .prow { opacity: 1; transform: none; }

/* =========================================================
   Nút "mochi khâu tay" — dấu riêng của SubelJapan:
   đường chỉ khâu chạy quanh mép trong như thú bông mochi,
   nút chính to có thêm đôi tai mèo của Mochi (vểnh lên khi rê chuột, thỉnh thoảng giật tai)
   ========================================================= */
.btn { --st: rgba(255, 255, 255, .62); }
.btn::before {
  content: ""; position: absolute; inset: 4px; border-radius: inherit; pointer-events: none;
  border: 1.6px dashed var(--st); transition: inset .35s var(--spring), border-color .2s;
}
.btn-lg::before { inset: 5px; }
.btn-sm::before { inset: 3px; border-width: 1.3px; }
.btn:hover::before { --st: rgba(255, 255, 255, .85); }
.btn:active::before { inset: 3px; }
.btn-lg:active::before { inset: 4px; }
.btn-sm:active::before { inset: 2px; }
.btn-white, .btn-paper { --st: color-mix(in srgb, var(--pri) 36%, transparent); }
.btn-white:hover::before, .btn-paper:hover::before { --st: color-mix(in srgb, var(--pri) 60%, transparent); }
.btn-soft, .btn-soft:hover::before { --st: color-mix(in srgb, var(--pri) 42%, transparent); }
.btn-yel, .btn-yel:hover::before { --st: rgba(110, 72, 0, .32); }
.btn[disabled], .btn.disabled, .btn[disabled]:hover::before, .btn.disabled:hover::before { --st: color-mix(in srgb, var(--ink3) 55%, transparent); }
.pn-pop .btn, .pn-pop .btn:hover::before { --st: color-mix(in srgb, var(--uc) 45%, transparent); }
.btn-ghost::before, .ub-guide::before, .btn-round::before { display: none; }

/* tai mèo cho nút chính */
.btn-cat { overflow: visible; }
.btn-cat .ear { position: absolute; bottom: calc(100% - 4px); width: 30px; height: 25px; pointer-events: none; transform-origin: 50% 100%; transition: transform .4s var(--spring); }
.btn-cat .ear.l { left: 17%; }
.btn-cat .ear.r { right: 17%; transform: scaleX(-1); }
.btn-cat .ear svg { display: block; width: 100%; height: 100%; overflow: visible; }
.btn-cat .ear .o { fill: var(--b); transition: fill .2s; }
.btn-cat .ear .i { fill: color-mix(in srgb, #fff 52%, var(--b)); }
.btn-cat:hover .ear .o { fill: color-mix(in srgb, var(--b) 90%, #fff); }
.btn-cat:hover .ear.l { transform: rotate(-9deg) translateY(-2px); }
.btn-cat:hover .ear.r { transform: scaleX(-1) rotate(-9deg) translateY(-2px); }
.btn-cat .ear.r { animation: earFlick 4.2s ease-in-out infinite 1.5s; }
@keyframes earFlick {
  0%, 88%, 100% { transform: scaleX(-1) rotate(0); }
  91% { transform: scaleX(-1) rotate(-16deg); }
  94% { transform: scaleX(-1) rotate(4deg); }
  97% { transform: scaleX(-1) rotate(-6deg); }
}
.btn-cat:hover .ear.r { animation: none; }
.btn-cat.btn-lg .ear { width: 34px; height: 28px; }
.btn-cat.btn-block .ear.l { left: 24%; } .btn-cat.btn-block .ear.r { right: 24%; }
html[data-motion="reduce"] .btn-cat .ear { animation: none !important; transition: none; }
.wl-go.btn-cat { margin-top: 36px; }
.btn-cat.btn-block .ear.l { left: max(17%, calc(50% - 175px)); }
.btn-cat.btn-block .ear.r { right: max(17%, calc(50% - 175px)); }
@media (max-width: 760px) {
  .hello .hello-cta.btn-cat { margin-top: 14px; }
  .hello .hello-cta.btn-cat .ear.l { left: calc(50% - 86px); }
  .hello .hello-cta.btn-cat .ear.r { right: calc(50% - 86px); }
}

/* =========================================================
   Thông báo: toast thường có chỉ khâu, thẻ THÀNH TỰU có huy hiệu ruy băng
   ========================================================= */
.toast { position: relative; border: 0; cursor: pointer; }
.toast::before { content: ""; position: absolute; inset: 4px; border-radius: 14px; border: 1.5px dashed color-mix(in srgb, var(--pri) 30%, transparent); pointer-events: none; }
.toast.hide { transform: translateY(-22px) scale(.94); opacity: 0; transition-duration: .3s; }

.toast.ach {
  --t: var(--sun); --tl: color-mix(in srgb, var(--t) 20%, var(--card)); --tt: color-mix(in srgb, var(--t) 62%, var(--ink));
  width: 100%; gap: 14px; padding: 14px 16px 16px 14px; border-radius: 24px; overflow: hidden; text-align: left;
  background: radial-gradient(120px 90px at 44px 50%, var(--tl), transparent 75%), linear-gradient(100deg, var(--tl) 0, var(--card) 62%);
  box-shadow: 0 22px 44px -20px color-mix(in srgb, var(--t) 75%, transparent), 0 2px 8px rgba(58, 46, 77, .08);
  transform: translateY(-60px) scale(.8) rotate(-3deg); transition: transform .6s var(--spring), opacity .25s;
}
.toast.ach.show { transform: none; }
.toast.ach.hide { transform: translateY(-30px) scale(.92); opacity: 0; transition: transform .3s ease-in, opacity .25s; }
.toast.ach::before { inset: 5px; border-radius: 19px; border-color: color-mix(in srgb, var(--t) 48%, transparent); }
.toast.ach-gold { --t: #ffb800; --tt: #a06f00; }
.toast.ach-mint { --t: var(--mint); --tt: var(--mint-t); }
.toast.ach-coral { --t: var(--coral); --tt: color-mix(in srgb, var(--coral) 65%, var(--ink)); }
.toast.ach-lav { --t: var(--lav); --tt: var(--lav-t); }
.toast.ach-pink { --t: var(--pri); --tt: var(--pri-t); }

.ach-medal { position: relative; flex: none; width: 64px; height: 64px; display: grid; place-items: center; }
.ach-rays { position: absolute; inset: -16px; border-radius: 50%;
  background: repeating-conic-gradient(color-mix(in srgb, var(--t) 34%, transparent) 0 9deg, transparent 9deg 22.5deg);
  -webkit-mask: radial-gradient(circle, #000 30%, transparent 68%); mask: radial-gradient(circle, #000 30%, transparent 68%);
  animation: achSpin 10s linear infinite, achFade .6s ease both .1s; }
.ach-tail { position: absolute; bottom: -7px; width: 14px; height: 20px; background: var(--t); clip-path: polygon(0 0, 100% 0, 100% 100%, 50% 76%, 0 100%); }
.ach-tail.l { left: 15px; transform: rotate(20deg); filter: brightness(.92); }
.ach-tail.r { right: 15px; transform: rotate(-20deg); }
.ach-disc { position: relative; z-index: 1; width: 58px; height: 58px; border-radius: 50%; display: grid; place-items: center; background: var(--card);
  box-shadow: inset 0 0 0 3.5px var(--t), 0 8px 16px -8px var(--t); animation: achPop .75s var(--spring) both .12s; }
.ach-disc::after { content: ""; position: absolute; inset: 6px; border-radius: 50%; border: 1.5px dashed color-mix(in srgb, var(--t) 55%, transparent); }
.ach-disc .ic { width: 36px; height: 36px; }
.ach-medal .sp { position: absolute; z-index: 2; width: 11px; height: 11px; background: #ffd85e; clip-path: polygon(50% 0, 61% 39%, 100% 50%, 61% 61%, 50% 100%, 39% 61%, 0 50%, 39% 39%); animation: achTw 1.8s ease-in-out infinite; }
.ach-medal .s1 { top: -5px; left: -3px; }
.ach-medal .s2 { top: 0; right: -7px; width: 8px; height: 8px; background: var(--t); animation-delay: .45s; }
.ach-medal .s3 { bottom: 6px; left: -9px; width: 7px; height: 7px; background: var(--t); animation-delay: .9s; }
.ach-medal .s4 { bottom: -3px; right: -5px; width: 9px; height: 9px; animation-delay: 1.3s; }
.ach-txt { flex: 1; min-width: 0; position: relative; }
.ach-kick { font: 900 11px/1.2 var(--f-body); letter-spacing: 1.1px; text-transform: uppercase; color: var(--tt); animation: achIn .45s ease both .2s; }
.ach-title { margin-top: 3px; font: 800 18px/1.2 var(--f-head); color: var(--ink); animation: achIn .45s ease both .28s; }
.ach-sub { margin-top: 3px; font: 700 13px/1.35 var(--f-body); color: var(--ink2); animation: achIn .45s ease both .36s; }
.ach-gifts { flex: none; display: flex; flex-direction: column; gap: 6px; align-items: flex-end; position: relative; }
.ach-gift { display: inline-flex; align-items: center; gap: 4px; padding: 5px 11px 5px 6px; border-radius: 999px; background: var(--card);
  box-shadow: inset 0 0 0 1.5px color-mix(in srgb, var(--sun) 55%, transparent), 0 6px 12px -8px rgba(160, 111, 0, .6);
  font: 900 15px/1 var(--f-body); color: #a06f00; animation: achGift .6s var(--spring) both .55s; }
.ach-gift .ic { width: 22px; height: 22px; }
.ach-gift.xp { color: var(--pri-t); box-shadow: inset 0 0 0 1.5px color-mix(in srgb, var(--pri) 40%, transparent), 0 6px 12px -8px var(--pri); animation-delay: .68s; }
.ach-gift.xp .ic { width: 19px; height: 19px; }
.ach-bar { position: absolute; left: 0; right: 0; bottom: 0; height: 3.5px; background: color-mix(in srgb, var(--t) 70%, transparent); transform-origin: left; animation: achBar var(--ms, 4s) linear both; }
@keyframes achSpin { to { rotate: 360deg; } }
@keyframes achFade { from { opacity: 0; scale: .4; } }
@keyframes achPop { 0% { transform: scale(.2) rotate(-35deg); } 55% { transform: scale(1.16) rotate(8deg); } 78% { transform: scale(.96) rotate(-3deg); } 100% { transform: none; } }
@keyframes achTw { 0%, 100% { transform: scale(.35); opacity: .25; } 50% { transform: scale(1.1) rotate(45deg); opacity: 1; } }
@keyframes achIn { from { opacity: 0; transform: translateX(10px); } }
@keyframes achGift { from { opacity: 0; transform: scale(.3) translateY(10px); } }
@keyframes achBar { from { transform: scaleX(1); } to { transform: scaleX(0); } }
@media (max-width: 420px) {
  .toast.ach { gap: 11px; padding: 12px 12px 14px 12px; }
  .ach-medal { width: 54px; height: 54px; }
  .ach-disc { width: 50px; height: 50px; }
  .ach-disc .ic { width: 31px; height: 31px; }
  .ach-tail.l { left: 11px; } .ach-tail.r { right: 11px; }
  .ach-title { font-size: 16px; }
  .ach-sub { font-size: 12.5px; }
}
html[data-motion="reduce"] .toast.ach *, html[data-motion="reduce"] .toast.ach { animation: none !important; transition: opacity .2s !important; }
html[data-motion="reduce"] .toast.ach .ach-bar { display: none; }

/* ---------- Bảng huy hiệu: huy chương ruy băng (đồng bộ với thẻ thành tựu) ---------- */
.badge { position: relative; gap: 5px; padding: 16px 8px 14px; border: 1.5px solid var(--line); background: var(--card); transition: transform .35s var(--spring), box-shadow .25s; }
.badge.got { background: linear-gradient(180deg, color-mix(in srgb, var(--sun) 17%, var(--card)), var(--card) 78%); border-color: color-mix(in srgb, var(--sun) 48%, var(--line)); box-shadow: 0 12px 22px -18px #c98a00; }
.badge.got::before { content: ""; position: absolute; inset: 4px; border-radius: 14px; border: 1.5px dashed color-mix(in srgb, var(--sun) 46%, transparent); pointer-events: none; }
.badge.got:hover { transform: translateY(-3px); }
.badge.got:hover .bd-medal { animation: wig .6s ease-in-out; }
.bd-medal { position: relative; width: 58px; height: 60px; display: grid; place-items: center; margin-bottom: 3px; }
.bd-disc { position: relative; z-index: 1; width: 54px; height: 54px; border-radius: 50%; display: grid; place-items: center; background: var(--card); box-shadow: inset 0 0 0 3px #ffb800, 0 6px 12px -8px #c98a00; }
.bd-disc::after { content: ""; position: absolute; inset: 5.5px; border-radius: 50%; border: 1.4px dashed color-mix(in srgb, #ffb800 55%, transparent); }
.bd-disc .ic { width: 34px; height: 34px; }
.bd-tail { position: absolute; bottom: -1px; width: 12px; height: 18px; background: #ffb800; clip-path: polygon(0 0, 100% 0, 100% 100%, 50% 76%, 0 100%); }
.bd-tail.l { left: 13px; transform: rotate(20deg); filter: brightness(.9); }
.bd-tail.r { right: 13px; transform: rotate(-20deg); }
.badge.got .bd-medal::before { content: ""; position: absolute; z-index: 2; top: -3px; right: -4px; width: 11px; height: 11px; background: #ffd85e; clip-path: polygon(50% 0, 61% 39%, 100% 50%, 61% 61%, 50% 100%, 39% 61%, 0 50%, 39% 39%); animation: achTw 2.6s ease-in-out infinite; }
.badge.got:nth-child(3n+2) .bd-medal::before { animation-delay: .8s; }
.badge.got:nth-child(3n) .bd-medal::before { animation-delay: 1.6s; }
.badge.locked .bd-disc { background: var(--bg2); box-shadow: inset 0 0 0 2px var(--line2); }
.badge.locked .bd-disc::after { border-color: var(--line2); }
.badge.locked .bd-tail { background: var(--line2); filter: none; }
.bd-lock { position: absolute; z-index: 2; right: -3px; bottom: 3px; width: 24px; height: 24px; border-radius: 50%; background: var(--card); box-shadow: var(--sh-1); display: grid; place-items: center; }
.badge.locked .bd-lock .ic { width: 16px; height: 16px; filter: grayscale(1) opacity(.55); }
.bd-date { margin-top: 3px; padding: 2px 8px; border-radius: 999px; background: color-mix(in srgb, var(--sun) 22%, var(--card)); font: 800 10.5px/1.4 var(--f-body); color: #a06f00; }
[data-dark] .bd-date { color: var(--sun-t); }
html[data-motion="reduce"] .badge .bd-medal, html[data-motion="reduce"] .badge .bd-medal::before { animation: none !important; }

/* =========================================================
   Bàn phím tiếng Nhật chuẩn JIS trên màn hình (trang Gõ phím)
   ========================================================= */
.jkb-host { max-width: 980px; margin: 16px auto 0; }
.jkb { padding: 14px 16px 12px; }
.jkb.off .jkb-body { display: none; }
.jkb.off .jkb-top { margin-bottom: 0; }
.jkb-top { display: flex; align-items: center; flex-wrap: wrap; gap: 10px 14px; margin-bottom: 12px; }
.jkb-title { display: flex; align-items: center; gap: 10px; margin-right: auto; text-align: left; }
.jkb-title b { display: block; font: 800 16px/1.2 var(--f-head); color: var(--ink); }
.jkb-title small { display: block; font: 700 12px/1.3 var(--f-body); color: var(--ink3); }
.jkb-seg button { font-size: 13.5px; padding: 7px 13px; }
.jkb-seg .jp { font-size: 13px; margin-right: 2px; }
.jkb-fing span { font-size: 13px; }
.jkb-keys { display: flex; flex-direction: column; gap: 5px; padding: 10px; border-radius: 18px; background: var(--bg2); box-shadow: inset 0 2px 6px rgba(58, 46, 77, .07); user-select: none; -webkit-user-select: none; touch-action: manipulation; }
.jkb-row { display: flex; gap: 5px; }
.k { --fc: #b3a9c2; flex: var(--w) 1 0; min-width: 0; position: relative; height: 50px; padding: 0; border: 0; border-radius: 10px; background: var(--card); color: var(--ink);
  box-shadow: 0 2px 0 var(--line2), inset 0 0 0 1px var(--line); cursor: pointer; font: inherit; -webkit-tap-highlight-color: transparent;
  transition: transform .08s, background .15s, box-shadow .15s; }
.k-lat { position: absolute; left: 8px; top: 6px; font: 800 16px/1 var(--f-body); color: var(--ink); }
.k-kana { position: absolute; right: 8px; bottom: 6px; font: 600 12.5px/1 var(--f-jp); color: var(--ink3); }
.k-skana { display: none; position: absolute; right: 7px; top: 5px; font: 600 11px/1 var(--f-jp); color: var(--ink3); }
.k-mod { display: block; padding: 0 3px; font: 800 11.5px/1.15 var(--f-body); color: var(--ink2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.k.mod { background: color-mix(in srgb, var(--ink3) 10%, var(--card)); }
.k.home::after { content: ""; position: absolute; left: 50%; bottom: 7px; width: 12px; height: 2.5px; margin-left: -6px; border-radius: 2px; background: var(--ink3); }
.k.enter { border-bottom-right-radius: 0; }
.k.enter2 { margin-top: -5px; height: 55px; border-top-left-radius: 0; border-top-right-radius: 0; box-shadow: 0 2px 0 var(--line2), inset -1px 0 0 var(--line), inset 1px 0 0 var(--line), inset 0 -1px 0 var(--line); }
.jkb[data-mode="kana"] .k-lat { font-size: 10.5px; color: var(--ink3); left: 6px; top: 5px; }
.jkb[data-mode="kana"] .k-kana { left: 0; right: 0; bottom: auto; top: 50%; transform: translateY(-38%); text-align: center; font-size: 20px; color: var(--ink); }
.jkb[data-mode="kana"] .k-skana { display: block; }
.jkb-body.fing .k:not(.mod):not(.space) { background: color-mix(in srgb, var(--fc) 20%, var(--card)); box-shadow: 0 2px 0 color-mix(in srgb, var(--fc) 45%, var(--line2)), inset 0 0 0 1px color-mix(in srgb, var(--fc) 30%, var(--line)); }
.f-lp { --fc: #ff8fb1; } .f-lr { --fc: #ffa94d; } .f-lm { --fc: #f2c200; } .f-li { --fc: #35c48b; }
.f-ri { --fc: #4aa8ff; } .f-rm { --fc: #9b7bff; } .f-rr { --fc: #ee6fc0; } .f-rp { --fc: #ff7a59; } .f-th { --fc: #b3a9c2; }
.k.down { transform: translateY(2px); box-shadow: 0 0 0 var(--line2), inset 0 0 0 1px var(--line) !important; background: color-mix(in srgb, var(--pri) 22%, var(--card)) !important; }
.k.next { z-index: 1; background: var(--pri) !important; box-shadow: 0 3px 0 var(--pri-d), 0 0 0 3px color-mix(in srgb, var(--pri) 30%, transparent) !important; animation: kNext 1.1s ease-in-out infinite; }
.k.next::before { content: ""; position: absolute; inset: 3px; border-radius: 8px; border: 1.4px dashed rgba(255, 255, 255, .65); pointer-events: none; }
.k.next .k-lat, .k.next .k-kana, .k.next .k-skana, .k.next .k-mod { color: #fff; }
.k.next.home::after { background: #fff; }
.k.next[data-code="Backspace"] { background: var(--red) !important; box-shadow: 0 3px 0 var(--red-d), 0 0 0 3px color-mix(in srgb, var(--red) 30%, transparent) !important; }
.k.next.down { transform: translateY(2px); }
@keyframes kNext { 50% { box-shadow: 0 3px 0 var(--pri-d), 0 0 0 7px color-mix(in srgb, var(--pri) 12%, transparent); } }
.jkb.shift-on .k.shift { background: var(--sun-l) !important; box-shadow: 0 2px 0 var(--sun-d), inset 0 0 0 1.5px var(--sun) !important; }
.jkb-info { min-height: 42px; display: flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: 6px 9px; margin-top: 10px; font: 800 14px/1.4 var(--f-body); color: var(--ink2); text-align: center; }
.jkb-info kbd { display: inline-grid; place-items: center; min-width: 32px; height: 32px; padding: 0 9px; border-radius: 9px; background: var(--pri); color: #fff; font: 900 15px var(--f-body); box-shadow: 0 2px 0 var(--pri-d); }
.jkb-info kbd.bad { background: var(--red); box-shadow: 0 2px 0 var(--red-d); }
.jkb-unit { font: 700 26px/1 var(--f-jp); color: var(--ink); }
.jkb-seq { display: inline-flex; gap: 1px; padding: 2px 8px; border-radius: 10px; background: var(--card2); box-shadow: inset 0 0 0 1.5px var(--line); }
.jkb-seq b { min-width: 13px; font: 900 18px/1.4 var(--f-body); color: var(--ink3); }
.jkb-seq b.dn { color: var(--mint-t); }
.jkb-seq b.cur { color: var(--pri-t); text-decoration: underline 3px; text-underline-offset: 4px; }
.jkb-finger { display: inline-flex; align-items: center; gap: 6px; padding: 4px 11px; border-radius: 999px; background: var(--card2); box-shadow: inset 0 0 0 1.5px var(--line); font-size: 13px; color: var(--ink2); }
.jkb-finger i { width: 11px; height: 11px; border-radius: 50%; background: var(--fc); }
.jkb-note { font-weight: 700; color: var(--ink2); }
.jkb-bad { color: var(--red-t); }
html[data-motion="reduce"] .k.next { animation: none; }
@media (max-width: 760px) {
  .jkb { padding: 12px 10px 10px; }
  .k { height: 46px; }
  .k-lat { font-size: 14px; left: 6px; top: 5px; }
}
@media (max-width: 600px) {
  .jkb-keys { padding: 6px; gap: 5px; border-radius: 14px; }
  .jkb-row { gap: 3px; }
  .k[data-code="Backquote"], .k[data-code="Tab"], .k[data-code="CapsLock"], .k[data-code="Enter2"], .k[data-code="ShiftRight"], .k[data-code^="Control"], .k[data-code="MetaLeft"], .k[data-code^="Alt"], .k[data-code="NonConvert"], .k[data-code="Convert"], .k[data-code="KanaMode"] { display: none; }
  .k { height: 44px; border-radius: 7px; }
  .k.enter { border-radius: 7px; }
  .k.next::before { inset: 2px; border-radius: 5px; }
  .jkb[data-mode="romaji"] .k-lat { left: 0; right: 0; top: 50%; transform: translateY(-50%); text-align: center; font-size: 16px; }
  .jkb[data-mode="romaji"] .k-kana { display: none; }
  .jkb[data-mode="kana"] .k-lat { display: none; }
  .jkb[data-mode="kana"] .k-kana { font-size: 17px; transform: translateY(-50%); }
  .jkb[data-mode="kana"] .k-skana { right: 2px; top: 2px; font-size: 9px; }
  .k-mod { font-size: 10.5px; }
  .k.home::after { bottom: 4px; width: 9px; margin-left: -4.5px; }
  .jkb-title small { display: none; }
  .jkb-fing { order: 5; }
}
/* tinh chỉnh bàn phím */
.jkb-tog { width: 38px; height: 38px; flex: none; }
.jkb-tog .gl { width: 20px; height: 20px; }
.k.home::after { left: 8px; margin-left: 0; bottom: 6px; }
.k-mod { white-space: normal; line-height: 1.12; }
.k[data-code="Backquote"] .k-mod, .k[data-code="CapsLock"] .k-mod, .k[data-code="NonConvert"] .k-mod, .k[data-code="Convert"] .k-mod, .k[data-code="KanaMode"] .k-mod { font-family: var(--f-jp); font-weight: 700; font-size: 11.5px; }
.k.space .k-mod i { font: 700 11px var(--f-body); font-style: normal; color: var(--ink3); letter-spacing: 1px; }
.k.enter { border-bottom-right-radius: 0; box-shadow: inset 1px 0 0 var(--line), inset -1px 0 0 var(--line), inset 0 1px 0 var(--line); }
.k.enter2 { box-shadow: 0 2px 0 var(--line2), inset 1px 0 0 var(--line), inset -1px 0 0 var(--line), inset 0 -1px 0 var(--line); }
.k.enter.down, .k.enter2.down { box-shadow: none !important; }
.jkb-body.fing .k:not(.mod):not(.space) { background: color-mix(in srgb, var(--fc) 15%, var(--card)); }
body[data-route="type"] .pet, body[data-route="type"] .pet-shadow { opacity: 0 !important; pointer-events: none !important; }

/* ---------- "Không nghe được lúc này" & thanh Tiếp chạy chậm (luyện tập) ---------- */
.nolisten-row { display: flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: 8px 14px; width: 100%; padding: 6px 0; }
.nolisten-row .btn { gap: 8px; }
.pr-foot .nolisten-row { margin-top: 6px; }
.noear { text-align: center; display: flex; flex-direction: column; align-items: center; gap: 8px; }
.noear h3 { font: 800 20px var(--f-head); margin: 4px 0 0; }
.noear p { max-width: 420px; margin: 0 0 8px; }
.pr-next { position: relative; overflow: hidden; }
.pr-next::after { content: ""; position: absolute; left: 0; bottom: 0; height: 3.5px; width: 100%; background: rgba(255, 255, 255, .75); transform-origin: left; animation: prBar var(--t, 2600ms) linear forwards; }
@keyframes prBar { from { transform: scaleX(0); } to { transform: scaleX(1); } }

/* =========================================================
   Nhiệm vụ: dòng nhiệm vụ mới (trang Nhiệm vụ + cột phải trang chủ)
   ========================================================= */
.qcard .card-title { margin-bottom: 8px; }
.qcard .card-title .more { display: inline-flex; align-items: center; gap: 3px; }
.qc-pill { margin-left: auto; padding: 4px 11px; border-radius: 999px; font: 800 12px/1.3 var(--f-body); white-space: nowrap; }
.qc-pill.pink { background: var(--pri-l); color: var(--pri-t); }
.qc-pill.lav { background: var(--lav-l); color: var(--lav-t); }
.qc-pill.sky { background: var(--sky-l); color: var(--sky-t); }
.qlist { display: flex; flex-direction: column; gap: 8px; }
.qrow { --tc: var(--pri); --tl: var(--pri-l); position: relative; display: grid; grid-template-columns: 48px minmax(0, 1fr) 96px; align-items: center; gap: 12px; padding: 11px 12px; border-radius: 18px; background: var(--card2); box-shadow: inset 0 0 0 1.5px var(--line); transition: background .25s, box-shadow .25s, transform .3s var(--spring); }
.qrow.t-lav { --tc: var(--lav); --tl: var(--lav-l); }
.qrow.t-sky { --tc: var(--sky); --tl: var(--sky-l); }
.qr-ico { position: relative; width: 48px; height: 48px; display: grid; place-items: center; border-radius: 15px; background: var(--tl); }
.qr-ico .ic { width: 30px; height: 30px; }
.qr-tick { position: absolute; right: -5px; bottom: -5px; width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; background: var(--mint); color: #fff; box-shadow: 0 0 0 2.5px var(--card); }
.qr-tick .gl { width: 13px; height: 13px; stroke-width: 3; }
.qr-main { min-width: 0; }
.qr-top { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin-bottom: 7px; }
.qr-title { min-width: 0; font: 800 14.5px/1.3 var(--f-body); color: var(--ink); }
.qr-count { flex: none; font: 800 12.5px var(--f-body); color: var(--ink3); }
.qr-count b { color: var(--ink2); font-weight: 900; }
.qr-bar { height: 9px; border-radius: 999px; background: color-mix(in srgb, var(--tc) 14%, var(--bg2)); overflow: hidden; }
.qr-bar i { display: block; height: 100%; min-width: 9px; border-radius: inherit; background: var(--tc); transition: width .6s var(--spring); }
.qr-sub { display: flex; align-items: center; gap: 8px; margin-top: 6px; font: 800 11.5px var(--f-body); color: var(--ink3); }
.qr-end { display: flex; justify-content: flex-end; }
.qr-rew { display: inline-flex; align-items: center; gap: 4px; padding: 5px 10px 5px 6px; border-radius: 999px; background: var(--card); box-shadow: inset 0 0 0 1.5px color-mix(in srgb, var(--sun) 45%, var(--line)); font: 900 14px/1 var(--f-body); color: #a06f00; }
.qr-rew .ic { width: 20px; height: 20px; }
.qr-claim { gap: 5px; padding: 6px 12px 6px 14px; white-space: nowrap; animation: qrWig 2.6s ease-in-out infinite; }
.qr-claim .ic { width: 20px; height: 20px; }
.qr-claim b { font-weight: 900; }
@keyframes qrWig { 0%, 80%, 100% { transform: none; } 85% { transform: rotate(-4deg) scale(1.05); } 90% { transform: rotate(3deg) scale(1.05); } 95% { transform: rotate(-1deg); } }
.qr-got { display: inline-flex; align-items: center; gap: 4px; font: 800 12.5px var(--f-body); color: var(--mint-t); }
.qr-got .gl { width: 16px; height: 16px; stroke-width: 3; }
/* sẵn sàng nhận quà: nền vàng nhạt, viền chỉ khâu */
.qrow.ready { --tc: var(--mint); background: color-mix(in srgb, var(--sun) 13%, var(--card)); box-shadow: inset 0 0 0 1.5px color-mix(in srgb, var(--sun) 55%, var(--line)), 0 10px 20px -16px #c98a00; }
.qrow.ready::before { content: ""; position: absolute; inset: 4px; border-radius: 14px; border: 1.5px dashed color-mix(in srgb, var(--sun) 50%, transparent); pointer-events: none; }
.qrow.ready .qr-ico { background: color-mix(in srgb, var(--sun) 30%, var(--card)); }
.qrow.ready .qr-count { color: var(--mint-t); }
/* đã nhận: dịu lại */
.qrow.claimed { --tc: var(--mint); background: transparent; }
.qrow.claimed .qr-title { color: var(--ink2); }
.qrow.claimed .qr-ico { background: var(--mint-l); }
.qrow.claimed .qr-ico .ic { opacity: .7; }
.qrow.claimed .qr-count { color: var(--mint-t); }
.mile-tier { display: inline-flex; gap: 4px; }
.mile-tier i { width: 9px; height: 9px; border-radius: 50%; background: var(--line2); }
.mile-tier i.ready { background: color-mix(in srgb, var(--sun) 55%, var(--card)); box-shadow: inset 0 0 0 1.5px var(--sun); }
.mile-tier i.on { background: var(--sun); }
/* cột phải trang chủ: gọn hơn */
.rail .qrow, .rail-mobile .qrow { grid-template-columns: 42px minmax(0, 1fr) auto; gap: 10px; padding: 9px 10px; }
.rail .qr-ico, .rail-mobile .qr-ico { width: 42px; height: 42px; border-radius: 13px; }
.rail .qr-ico .ic, .rail-mobile .qr-ico .ic { width: 27px; height: 27px; }
.rail .qr-title, .rail-mobile .qr-title { font-size: 13.5px; }
.rail .qr-rew { padding: 4px 8px 4px 5px; font-size: 13px; }
.rail .qr-claim { padding: 5px 10px; }

/* khung tóm tắt trên trang Nhiệm vụ */
.qhero { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 18px; padding: 18px 20px; background: linear-gradient(110deg, var(--pri-l), var(--card) 60%); }
.qh-ring .ring b { font: 900 22px/1 var(--f-head); color: var(--ink); }
.qh-ring .ring small { font: 800 11px var(--f-body); color: var(--ink3); }
.qh-txt b { display: block; font: 800 19px/1.25 var(--f-head); color: var(--ink); }
.qh-txt span { display: block; margin-top: 4px; font: 700 14px/1.4 var(--f-body); color: var(--ink2); }
.qh-txt span b { display: inline; font: inherit; font-weight: 900; color: var(--pri-t); }
.qh-stats { display: flex; gap: 8px; }
.qh-stat { display: grid; justify-items: center; gap: 1px; min-width: 82px; padding: 9px 10px 8px; border-radius: 16px; background: var(--card); box-shadow: inset 0 0 0 1.5px var(--line), var(--sh-1); color: var(--ink); text-decoration: none; transition: transform .3s var(--spring); }
.qh-stat:hover { transform: translateY(-2px); }
.qh-stat b { font: 900 18px/1.1 var(--f-head); }
.qh-stat small { font: 800 11px/1.2 var(--f-body); color: var(--ink3); white-space: nowrap; }
.qh-stat.fire b { color: var(--coral-d); } .qh-stat.fish b { color: var(--sky-t); } .qh-stat.xp b { color: #a06f00; }
@media (max-width: 760px) {
  .qhero { grid-template-columns: auto minmax(0, 1fr); padding: 16px; }
  .qh-stats { grid-column: 1 / -1; }
  .qh-stat { flex: 1; min-width: 0; }
  .qrow { grid-template-columns: 42px minmax(0, 1fr) auto; gap: 10px; padding: 10px; }
  .qr-ico { width: 42px; height: 42px; }
}
html[data-motion="reduce"] .qr-claim { animation: none; }
.qr-gift { position: absolute; right: -7px; bottom: -7px; width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; background: var(--card); box-shadow: 0 0 0 2px color-mix(in srgb, var(--sun) 60%, var(--card)), 0 4px 8px -4px #c98a00; animation: qrGift 1.8s ease-in-out infinite; }
.qr-gift .ic { width: 20px !important; height: 20px !important; opacity: 1 !important; }
@keyframes qrGift { 50% { transform: translateY(-2px) rotate(-6deg); } }
.qh-ring .ring-bg { stroke: color-mix(in srgb, #fff 85%, var(--pri-l)); }
[data-dark] .qh-ring .ring-bg { stroke: var(--bg2); }
.qh-ring .ring-in { gap: 2px; align-content: center; }
.qstats { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.qstats .stat-box { padding: 14px 16px; gap: 12px; }
.qstats .stat-box span { display: block; line-height: 1.3; }
@media (max-width: 560px) { .qstats { grid-template-columns: 1fr; } }
html[data-motion="reduce"] .qr-gift { animation: none; }
.qrow.ready .qr-count { display: none; }
.rail .qr-claim, .rail-mobile .qr-claim { padding: 5px 10px 5px 11px; gap: 3px; font-size: 13px; }
@media (max-width: 560px) {
  .qc-pill.pink, .qc-pill.sky { display: none; }
  .qr-claim { padding: 6px 10px 6px 11px; gap: 3px; }
  .qr-title { font-size: 14px; }
  .qh-txt b { font-size: 17px; }
}
@media (max-width: 600px) {
  .k.enter .k-mod { font-size: 0; }
  .k.enter .k-mod::after { content: "⏎"; font-size: 16px; color: var(--ink2); }
  .type-stage .row .btn-sm { white-space: nowrap; padding-left: 11px; padding-right: 11px; }
}
.k.home::after { top: 26px; bottom: auto; left: 9px; width: 11px; margin-left: 0; }
.jkb[data-mode="kana"] .k.home::after { top: auto; bottom: 4px; left: 50%; margin-left: -5.5px; }
@media (max-width: 600px) { .jkb[data-mode="romaji"] .k.home::after { top: auto; bottom: 4px; left: 50%; margin-left: -4.5px; width: 9px; } }
/* chú thích 2 loại chữ trên phím */
.jkb-legend { display: flex; align-items: center; gap: 12px; margin: 0 0 10px; padding: 9px 12px; border-radius: 14px; background: var(--sun-l); }
.lg-key { position: relative; flex: none; width: 46px; height: 42px; border-radius: 9px; background: var(--card); box-shadow: 0 2px 0 var(--line2), inset 0 0 0 1px var(--line); }
.lg-key b { position: absolute; left: 7px; top: 5px; font: 800 15px/1 var(--f-body); color: var(--ink); }
.lg-key i { position: absolute; right: 7px; bottom: 5px; font: 600 12px/1 var(--f-jp); font-style: normal; color: var(--ink3); }
.lg-key.kana b { font-size: 10px; color: var(--ink3); left: 6px; top: 4px; }
.lg-key.kana i { right: 0; left: 0; bottom: auto; top: 50%; transform: translateY(-40%); text-align: center; font-size: 18px; color: var(--ink); }
.lg-txt { font: 700 13px/1.45 var(--f-body); color: var(--ink2); text-align: left; }
.lg-txt b { color: var(--ink); }
@media (max-width: 600px) { .jkb-legend { padding: 8px 10px; gap: 10px; } .lg-txt { font-size: 12px; } .lg-key { width: 40px; height: 38px; } }

/* =========================================================
   Bàn phím điện thoại 12 phím kiểu vuốt (フリック入力)
   ========================================================= */
.jkb-seg button { display: inline-flex; align-items: baseline; gap: 5px; }
.jkb-seg button small { font: 700 11.5px var(--f-body); color: inherit; opacity: .75; }
.jkb[data-mode="flick"] .jkb-fing { display: none; }
.jkb[data-mode="flick"] .jkb-keys { padding: 14px; }
.fk-grid { position: relative; display: grid; grid-template-columns: .82fr 1fr 1fr 1fr .82fr; grid-template-rows: repeat(4, 60px); gap: 7px; max-width: 470px; margin: 0 auto; }
.fk { position: relative; display: grid; place-items: center; padding: 0; border: 0; border-radius: 14px; background: var(--card); color: var(--ink); cursor: pointer; font: inherit;
  box-shadow: 0 2px 0 var(--line2), inset 0 0 0 1px var(--line); touch-action: none; user-select: none; -webkit-user-select: none; -webkit-tap-highlight-color: transparent; transition: transform .08s, background .15s, box-shadow .15s; }
.fk-main { font: 600 25px/1 var(--f-jp); }
.fk-dk .fk-main { font-size: 18px; letter-spacing: -1px; }
.fk-dk .fk-main small { font-size: 12px; margin-right: 1px; }
.fk-h { position: absolute; font: 600 10.5px/1 var(--f-jp); font-style: normal; color: var(--ink3); pointer-events: none; transition: color .15s, font-size .15s; }
.fk-h.d1 { left: 7px; top: 50%; transform: translateY(-50%); }
.fk-h.d2 { top: 5px; left: 50%; transform: translateX(-50%); }
.fk-h.d3 { right: 7px; top: 50%; transform: translateY(-50%); }
.fk-h.d4 { bottom: 5px; left: 50%; transform: translateX(-50%); }
.fk-side { background: color-mix(in srgb, var(--ink3) 13%, var(--card)); color: var(--ink2); }
.fk-side b { font: 900 17px/1 var(--f-body); }
.fk-side .jp { font: 700 15px var(--f-jp); }
.fk-side.s-abc { grid-row: 3 / span 2; grid-column: 1; display: flex; flex-direction: column; gap: 3px; }
.fk-side.s-abc small { font: 700 10.5px var(--f-body); color: var(--ink3); }
.fk-side.s-enter { grid-row: 3 / span 2; grid-column: 5; background: color-mix(in srgb, var(--pri) 18%, var(--card)); color: var(--pri-t); }
.fk.down { transform: translateY(2px); box-shadow: 0 0 0 var(--line2), inset 0 0 0 1px var(--line); background: color-mix(in srgb, var(--pri) 20%, var(--card)); }
.fk.next { z-index: 1; background: var(--pri); color: #fff; box-shadow: 0 3px 0 var(--pri-d), 0 0 0 3px color-mix(in srgb, var(--pri) 30%, transparent); animation: kNext 1.1s ease-in-out infinite; }
.fk.next::before { content: ""; position: absolute; inset: 3px; border-radius: 11px; border: 1.4px dashed rgba(255, 255, 255, .65); pointer-events: none; }
.fk.next .fk-h { color: rgba(255, 255, 255, .7); }
.fk.next[data-act="bs"] { background: var(--red); box-shadow: 0 3px 0 var(--red-d), 0 0 0 3px color-mix(in srgb, var(--red) 30%, transparent); color: #fff; }
.fk.next[data-arrow]::after { content: attr(data-arrow); position: absolute; top: -11px; right: -9px; width: 27px; height: 27px; border-radius: 50%; display: grid; place-items: center; background: var(--sun); color: #5a3d00; font: 900 15px/1 var(--f-body); box-shadow: 0 3px 8px -3px rgba(160, 111, 0, .7), 0 0 0 2.5px var(--card); }
.fk.next[data-arrow="←"] .fk-h.d1, .fk.next[data-arrow="↑"] .fk-h.d2, .fk.next[data-arrow="→"] .fk-h.d3, .fk.next[data-arrow="↓"] .fk-h.d4 { color: #fff; font-size: 15px; font-weight: 800; text-shadow: 0 1px 0 rgba(0, 0, 0, .15); }
/* bảng vuốt hiện ra khi chạm giữ */
.fk-pop { position: absolute; left: 0; top: 0; z-index: 6; pointer-events: none; }
.fk-pop .pc { position: absolute; width: var(--w); height: var(--h); display: grid; place-items: center; border-radius: 14px; background: var(--card); color: var(--ink); font: 700 25px/1 var(--f-jp);
  box-shadow: 0 10px 22px -10px rgba(58, 46, 77, .45), inset 0 0 0 1.5px var(--line); transition: background .1s, transform .1s; }
.fk-pop .pc.d0 { left: var(--x); top: var(--y); }
.fk-pop .pc.d1 { left: calc(var(--x) - var(--w)); top: var(--y); }
.fk-pop .pc.d2 { left: var(--x); top: calc(var(--y) - var(--h)); }
.fk-pop .pc.d3 { left: calc(var(--x) + var(--w)); top: var(--y); }
.fk-pop .pc.d4 { left: var(--x); top: calc(var(--y) + var(--h)); }
.fk-pop .pc.on { z-index: 1; background: var(--pri); color: #fff; transform: scale(1.08); box-shadow: 0 12px 24px -10px var(--pri), 0 0 0 3px color-mix(in srgb, var(--pri) 30%, transparent); }
.jkb-dir { padding: 3px 10px; border-radius: 999px; background: var(--sun-l); color: #8a5d00; font-weight: 900; }
.jkb-info kbd.jp { font-family: var(--f-jp); font-weight: 700; font-size: 16px; }
/* chú thích: phím mẫu か với 4 chữ vuốt */
.lg-fl { position: relative; flex: none; width: 52px; height: 48px; border-radius: 11px; background: var(--card); box-shadow: 0 2px 0 var(--line2), inset 0 0 0 1px var(--line); }
.lg-fl b { position: absolute; inset: 0; display: grid; place-items: center; font: 600 20px var(--f-jp); color: var(--ink); }
.lg-fl i { position: absolute; font: 600 9.5px/1 var(--f-jp); font-style: normal; color: var(--pri-t); }
.lg-fl .d1 { left: 5px; top: 50%; transform: translateY(-50%); } .lg-fl .d2 { top: 4px; left: 50%; transform: translateX(-50%); }
.lg-fl .d3 { right: 5px; top: 50%; transform: translateY(-50%); } .lg-fl .d4 { bottom: 4px; left: 50%; transform: translateX(-50%); }
@media (max-width: 600px) {
  .jkb[data-mode="flick"] .jkb-keys { padding: 10px 8px; }
  .fk-grid { grid-template-rows: repeat(4, 54px); gap: 6px; }
  .fk-main { font-size: 23px; }
  .jkb-seg button { padding: 7px 10px; }
}
@media (max-width: 440px) { .jkb-seg button small { display: none; } }
html[data-motion="reduce"] .fk.next { animation: none; }
.fk-grid { width: 100%; }
.jkb-top .jkb-seg { order: 3; flex: 1 1 100%; display: flex; }
.jkb-top .jkb-seg button { flex: 1; justify-content: center; }
.jkb-top .jkb-fing { order: 2; }
.jkb-top .jkb-tog { order: 2; }

/* Mochi ngủ say khi máy để yên lâu (pet.js): dừng mọi cử động */
.pet.nap *, .pet.nap { animation-play-state: paused !important; }

/* ---------- chữ ký tác giả ---------- */
.made-by { display: flex; align-items: center; justify-content: center; gap: 4px; margin-top: 8px; padding: 4px 8px; border-radius: 999px; font: 700 11.5px var(--f-body); color: var(--ink3); transition: color .2s, background .2s; }
.made-by b { color: var(--pri-t); }
.made-by .ic { width: 14px; height: 14px; }
.made-by:hover { background: var(--pri-l); color: var(--ink2); }
.path-end .made-line { margin-top: 12px; font: 700 12.5px var(--f-body); color: var(--ink3); display: flex; align-items: center; justify-content: center; gap: 4px; width: 100%; }
.path-end .made-line a b { color: var(--pri-t); }
.path-end .made-line .ic { width: 14px; height: 14px; }
.about-row .by-name { font-weight: 900; color: var(--pri-t); }
.wl-by { position: absolute; left: 0; right: 0; bottom: calc(14px + env(safe-area-inset-bottom)); z-index: 3; display: flex; align-items: center; justify-content: center; gap: 4px; font: 700 12.5px var(--f-body); color: color-mix(in srgb, var(--pri-t) 70%, #fff); animation: wlUp .55s ease both 2.2s; pointer-events: none; }
.wl-by b { color: var(--pri-t); }
.wl-by .ic { width: 14px; height: 14px; }
[data-dark] .wl-by { color: rgba(255, 210, 230, .7); }
.welcome.bye .wl-by { animation: wlOut .3s ease forwards; }
