/* Chiếc nón kỳ diệu */
.nk-hello { display: flex; align-items: flex-end; gap: 12px; margin-bottom: 8px; }
.nk-hello img { width: 90px; height: auto; flex: none; }
.nk-bubble { position: relative; flex: 1; background: #fff; border: 3px solid #f9a11b; border-radius: 22px; padding: 12px 16px; font-weight: 600; line-height: 1.45; color: #2b2420; box-shadow: 0 4px 0 #c97a08; }
.nk-bubble::before { content: ""; position: absolute; left: -11px; bottom: 22px; width: 16px; height: 16px; background: #fff; border-left: 3px solid #f9a11b; border-bottom: 3px solid #f9a11b; transform: rotate(45deg); }
.nk-bubble.pop { animation: nkPop .35s cubic-bezier(.3,1.6,.5,1); }
@keyframes nkPop { from { transform: scale(.94); } to { transform: none; } }
.nk-rules { margin: 4px 0 14px; padding: 10px 14px; border: 2px dashed #cfe3f6; border-radius: 16px; background: #f5faff; }
.nk-rules summary { cursor: pointer; font-weight: 700; color: #0f5fa8; }
.nk-rules ul { margin: 8px 0 0; padding-left: 20px; display: grid; gap: 6px; font-size: .92rem; line-height: 1.5; }

.nk-stage { display: grid; gap: 14px; }
body.nk-page, .nk-page .nk, .nk-page .nk button, .nk-page .nk input, .nk-page .nk textarea, .nk-page .nk select, .nk-t i, .nk-keys button, .nk-p .rp, .nk-ans, .nk-rank b, .nk-roundbar { font-family: 'Be Vietnam Pro', system-ui, sans-serif !important; }
.nk-roundbar { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; font-family: 'Baloo 2', 'Be Vietnam Pro', sans-serif; font-weight: 800; font-size: 1.1rem; color: #0b2f85; }

.nk-top { position: relative; min-height: 150px; display: flex; align-items: flex-end; gap: 12px; }
.nk-mc { flex: none; width: 104px; display: flex; align-items: flex-end; justify-content: center; }
.nk-mc img { width: 100%; height: auto; max-height: 150px; object-fit: contain; transform-origin: 50% 100%; animation: nkBob 3.4s ease-in-out infinite; }
.nk-mc.mood-think img, .nk-mc.mood-talk img { animation-duration: 2.6s; }
.nk-mc.mood-sad img { animation: nkSad 2.4s ease-in-out infinite; }
.nk-mc.mood-happy img { animation: nkHop .8s ease-in-out infinite; }
@keyframes nkBob { 0%, 100% { transform: translateY(0) rotate(-.6deg); } 50% { transform: translateY(-3px) rotate(.8deg); } }
@keyframes nkSad { 0%, 100% { transform: translateY(2px); } 50% { transform: translateY(4px); } }
@keyframes nkHop { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-9px) rotate(1.5deg); } }
.nk-top .nk-bubble { min-height: 70px; display: flex; flex-direction: column; justify-content: center; gap: 6px; }
.nk-catline { display: block; text-align: right; padding-top: 6px; border-top: 2px dashed #f9c76a; font-size: .85rem; font-weight: 600; color: #6f665f; }
.nk-catline b { color: #f0558c; font-weight: 800; font-size: 1rem; }

/* ô chữ */
.nk-board { display: grid; gap: 8px; justify-items: center; padding: 14px 8px; background: #0f5fa8; border: 4px solid #0b2f85; border-radius: 22px; box-shadow: 0 6px 0 #082060; }
.nk-row { display: flex; gap: 14px; justify-content: center; flex-wrap: nowrap; }
.nk-word { display: flex; gap: 4px; }
.nk-t { width: clamp(22px, 6.4vw, 38px); height: clamp(30px, 8.4vw, 50px); border-radius: 7px; background: #fff; border: 2px solid #cfe3f6; display: grid; place-items: center; perspective: 400px; }
.nk-t i { font-style: normal; font-weight: 800; font-family: 'Baloo 2', 'Be Vietnam Pro', sans-serif; font-size: clamp(1rem, 4.4vw, 1.7rem); color: #0b2f85; line-height: 1; }
.nk-t:not(.on) { background: linear-gradient(#fff, #e9f3ff); }
.nk-t.on { background: #fff3c4; border-color: #f9a11b; }
.nk-t.flip { animation: nkFlip .6s ease; }
@keyframes nkFlip { 0% { transform: rotateX(90deg); } 60% { transform: rotateX(-12deg); } 100% { transform: none; } }

/* bảng điểm */
.nk-score { display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); gap: 8px; }
.nk-p { position: relative; display: grid; gap: 0; justify-items: center; padding: 8px 6px 6px; background: #fff; border: 3px solid #cfe3f6; border-radius: 18px; box-shadow: 0 3px 0 #cfe3f6; text-align: center; min-width: 0; }
.nk-p .nm { font-weight: 700; font-size: .85rem; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nk-p .rp { font-family: 'Baloo 2', sans-serif; font-weight: 800; font-size: 1.6rem; line-height: 1.1; color: #0b2f85; }
.nk-p .tt { font-size: .75rem; color: #6f665f; }
.nk-p .ex { position: absolute; top: -8px; right: -4px; font-size: .75rem; font-weight: 800; background: #f6c000; border-radius: 999px; padding: 1px 7px; }
.nk-p.me { border-color: #f0558c; background: #fff0f6; box-shadow: 0 4px 0 #c23468; transform: translateY(-2px); }
.nk-p.me .rp { color: #c23468; }

/* nón */
.nk-wheelbox { position: relative; width: min(100%, 340px); margin: 26px auto 0; }
.nk-wheelbox canvas { display: block; width: 100%; aspect-ratio: 1; height: auto; filter: drop-shadow(0 8px 10px rgba(0,0,0,.25)); }
.nk-pointer { position: absolute; left: 50%; top: -12px; width: 0; height: 0; transform: translateX(-50%); border-left: 15px solid transparent; border-right: 15px solid transparent; border-top: 30px solid #e8334a; z-index: 2; filter: drop-shadow(0 3px 2px rgba(0,0,0,.35)); }
.nk-actions { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }
.nk-spin { position: absolute; left: 50%; top: 50%; z-index: 3; transform: translate(-50%, -50%); width: 27%; aspect-ratio: 1; border-radius: 50%; border: 4px solid #fff; background: radial-gradient(circle at 35% 30%, #ff7aa8, #f0558c 60%, #c23468); color: #fff; font-weight: 800; font-size: clamp(.8rem, 3.6vw, 1.05rem); line-height: 1.1; cursor: pointer; box-shadow: 0 5px 0 #8f2150, 0 8px 12px rgba(0,0,0,.3); transition: transform .1s, box-shadow .1s; padding: 0; }
.nk-spin:not(:disabled):hover { filter: brightness(1.06); }
.nk-spin:not(:disabled):active { transform: translate(-50%, calc(-50% + 3px)); box-shadow: 0 2px 0 #8f2150; }
.nk-spin:disabled { background: #c9c9c9; box-shadow: 0 5px 0 #8d8d8d; color: #777; cursor: default; }
.nk-spin[hidden] { display: none; }
.nk-solve { display: flex; gap: 8px; flex-wrap: wrap; }
.nk-solve input { flex: 1 1 200px; min-width: 0; }
.nk-solve[hidden] { display: none; }

/* bàn phím chữ cái */
.nk-keys { display: grid; grid-template-columns: repeat(auto-fill, minmax(40px, 1fr)); gap: 6px; opacity: .55; transition: opacity .2s; }
.nk-keys.on { opacity: 1; }
.nk-keys button { height: 44px; border-radius: 12px; border: 2.5px solid #cfe3f6; background: #fff; box-shadow: 0 3px 0 #cfe3f6; font: 800 1.05rem 'Baloo 2', 'Be Vietnam Pro', sans-serif; color: #0b2f85; cursor: pointer; transition: transform .1s, box-shadow .1s; }
.nk-keys.on button:not(:disabled):hover { border-color: #f9a11b; box-shadow: 0 3px 0 #c97a08; }
.nk-keys button:not(:disabled):active { transform: translateY(3px); box-shadow: 0 0 0 #cfe3f6; }
.nk-keys button.yes { background: #ecf8e6; border-color: #3fa022; box-shadow: 0 3px 0 #2c7a16; color: #2c7a16; }
.nk-keys button.no { background: #eee; border-color: #cfcfcf; box-shadow: none; color: #aaa; text-decoration: line-through; }
.nk-keys button:disabled:not(.yes):not(.no) { cursor: default; }

/* tổng kết */
.nk-ans { text-align: center; font-family: 'Baloo 2', sans-serif; font-weight: 800; font-size: 1.5rem; color: #0b2f85; margin: 4px 0 10px; }
.nk-rank { list-style: none; margin: 0 0 6px; padding: 0; display: grid; gap: 8px; }
.nk-rank li { display: flex; align-items: center; gap: 10px; padding: 10px 14px; background: #fff; border: 3px solid #cfe3f6; border-radius: 18px; box-shadow: 0 3px 0 #cfe3f6; }
.nk-rank li.win { background: #fff3c4; border-color: #f9a11b; box-shadow: 0 4px 0 #c97a08; }
.nk-rank .rk { width: 30px; text-align: center; font-weight: 800; font-size: 1.2rem; }
.nk-rank .nm { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; font-weight: 700; }
.nk-rank b { font-family: 'Baloo 2', sans-serif; font-size: 1.3rem; color: #0b2f85; }

/* hoa giấy */
.nk-confetti { position: fixed; inset: 0; pointer-events: none; z-index: 3000; overflow: hidden; }
.nk-confetti i { position: absolute; top: -20px; width: 10px; height: 16px; border-radius: 2px; animation: nkFall 2.2s linear forwards; }
@keyframes nkFall { to { top: 110%; transform: translateX(60px) rotate(720deg); } }
@media (prefers-reduced-motion: reduce) { .nk-mc img, .nk-t.flip, .nk-bubble.pop, .nk-confetti i { animation: none !important; } }

/* khung chứa toàn bộ game: nền sân khấu cố định */
.nk-box { position: relative; padding: 16px; border-radius: 28px; border: 3px solid #0b2f85; box-shadow: 0 8px 0 #082060, 0 14px 24px rgba(0,0,0,.25); background: linear-gradient(rgba(4,8,40,.25), rgba(4,8,40,.5)), #0a1650 url(../img/bg.jpg) center / cover fixed no-repeat; display: grid; gap: 14px; overflow: hidden; }
.nk-box > * { margin: 0; }
.nk-box .card { background: rgba(255,255,255,.96); }
.nk-box .card.nk-over { margin-top: 30px; }
.nk-roundbar { color: #0b2f85; }
.nk-roundbar > #nkRound { background: #fff; border-radius: 999px; padding: 4px 16px 2px; box-shadow: 0 3px 0 rgba(0,0,0,.25); }
.nk-time { background: #fff; color: #0b2f85; border-radius: 999px; padding: 4px 16px 2px; box-shadow: 0 3px 0 rgba(0,0,0,.25); min-width: 82px; text-align: center; font-variant-numeric: tabular-nums; }
.nk-time.low { background: #e8334a; color: #fff; animation: nkBlink .5s ease-in-out infinite alternate; }
@keyframes nkBlink { to { transform: scale(1.08); } }
.nk-tbar { height: 8px; border-radius: 99px; background: rgba(255,255,255,.3); overflow: hidden; }
.nk-tbar i { display: block; height: 100%; width: 100%; background: linear-gradient(90deg, #f9a11b, #f0558c); border-radius: 99px; }
.nk-timer { display: flex; align-items: center; gap: 10px; }
.nk-timer[hidden] { display: none; }
.nk-timer.idle { visibility: hidden; }
.nk-timer .nk-tbar { flex: 1; height: 12px; }
.nk-actions .btn { background: #fff; }
@media (max-width: 480px) { .nk-box { padding: 12px; } }
