/* Phòng Trò Chơi Lớp Học: style chung. Vùng duy nhất của site được dùng màu rực, bo tròn lớn, hoạt ảnh. */
/* Bản sắc Cam rạng (đợt 6): tiêu đề, điểm, nút, băng rôn dùng Lexend như web; chỉ nạp 700 (~20 KB), thân chữ vẫn font hệ thống
   cho nhẹ. url tương đối so với /_w/<hash>/games/games.css. present.css (trình chiếu) dùng chung khai báo này. */
@font-face { font-family: "Lexend"; font-style: normal; font-display: swap; font-weight: 700; src: url(../fonts/lexend-vietnamese-700-normal.woff2) format("woff2"); unicode-range: U+0102-0103,U+0110-0111,U+0128-0129,U+0168-0169,U+01A0-01A1,U+01AF-01B0,U+0300-0301,U+0303-0304,U+0308-0309,U+0323,U+0329,U+1EA0-1EF9,U+20AB; }
@font-face { font-family: "Lexend"; font-style: normal; font-display: swap; font-weight: 700; src: url(../fonts/lexend-latin-700-normal.woff2) format("woff2"); unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD; }
.tg-root, .pc { --tg-display: "Lexend", "Be Vietnam Pro", system-ui, -apple-system, "Segoe UI", sans-serif; }
.tg-h, .tg-h3, .tg-btn, .tg-hud-score, .tg-hud-prog, .tg-q-tag, .tg-banner, .tg-result .tg-score, .tg-stat strong, .tg-wager strong, .tg-lb .s { font-family: var(--tg-display); font-weight: 700; }
.tg-root {
  --tg-bg1: #2b1b6b; --tg-bg2: #5b2fbf; --tg-ink: #1d1340; --tg-yellow: #ffd23f; --tg-pink: #ff5d8f;
  --tg-green: #2ee59d; --tg-red: #ff4d4d; --tg-blue: #4cc9f0;
  position: fixed; inset: 0; z-index: 1000; overflow: hidden;
  background: linear-gradient(180deg, var(--tg-bg1), var(--tg-bg2));
  color: #fff; font-family: "Be Vietnam Pro", system-ui, -apple-system, "Segoe UI", sans-serif;
  -webkit-tap-highlight-color: transparent; touch-action: none; user-select: none; -webkit-user-select: none;
}
.tg-root *, .tg-root *::before, .tg-root *::after { box-sizing: border-box; }
.tg-loading { position: absolute; inset: 0; display: flex; flex-direction: column; gap: 16px; align-items: center; justify-content: center; font-weight: 700; text-align: center; padding: 24px; }

.tg-stage { position: absolute; inset: 0; }
.tg-canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }

/* thanh trên */
.tg-hud { position: absolute; left: 0; right: 0; top: 0; background: linear-gradient(rgba(20,12,48,.72), rgba(20,12,48,0)); display: flex; align-items: center; gap: 8px; padding: 8px 10px; padding-top: max(8px, env(safe-area-inset-top)); z-index: 5; pointer-events: none; }
.tg-hud > * { pointer-events: auto; }
.tg-hud-prog { font-weight: 700; font-size: .9rem; background: rgba(0,0,0,.28); padding: 6px 12px; border-radius: 999px; white-space: nowrap; }
.tg-hud-extra { flex: 1; display: flex; gap: 4px; align-items: center; font-size: 1.15rem; min-width: 0; pointer-events: none; }
.tg-hud-score { font-weight: 800; font-size: 1.15rem; background: var(--tg-yellow); color: var(--tg-ink); padding: 5px 14px; border-radius: 999px; min-width: 64px; text-align: center; }
.tg-hud-score.bump { animation: tg-bump .3s ease-out; }
.tg-ibtn { width: 44px; height: 44px; flex: none; border-radius: 50%; border: 0; background: rgba(0,0,0,.3); color: #fff; font-size: 1.15rem; display: inline-flex; align-items: center; justify-content: center; text-decoration: none; cursor: pointer; font-family: inherit; }
.tg-ibtn:hover { background: rgba(0,0,0,.45); }
.tg-ibtn[hidden] { display: none; }
.tg-heart { filter: drop-shadow(0 2px 0 rgba(0,0,0,.25)); }
.tg-heart.off { filter: grayscale(1) opacity(.35); }

/* khung câu hỏi */
.tg-q { position: absolute; left: 50%; top: 60px; transform: translateX(-50%); width: min(94vw, 820px); max-height: 42%; overflow: auto; background: #fff; color: var(--tg-ink); border-radius: 22px; padding: 12px 16px 14px; box-shadow: 0 6px 0 rgba(0,0,0,.22); z-index: 4; text-align: center; touch-action: pan-y; user-select: text; -webkit-user-select: text; }
.tg-q[hidden] { display: none; }
.tg-q.in { animation: tg-drop .35s cubic-bezier(.2, 1.4, .4, 1); }
.tg-q[data-twist="boss"] { background: #ffe0e0; box-shadow: 0 6px 0 #b3202a; }
.tg-q[data-twist="trap"] { background: #fff1c2; box-shadow: 0 6px 0 #b8860b; }
.tg-q[data-twist="fate"] { background: #efe0ff; box-shadow: 0 6px 0 #6a2fb3; }
.tg-q-tag { display: inline-block; font-size: .72rem; font-weight: 800; letter-spacing: .06em; background: var(--tg-ink); color: #fff; border-radius: 999px; padding: 2px 10px; margin-bottom: 6px; }
.tg-q-text { font-weight: 700; line-height: 1.32; overflow-wrap: anywhere; }
.tg-q-opts { margin-top: 8px; text-align: left; font-size: .82rem; font-weight: 600; line-height: 1.3; border-top: 2px dashed #d9d0f5; padding-top: 6px; }
.tg-q-opts div { margin: 2px 0; overflow-wrap: anywhere; }
.tg-note-pop { position: absolute; left: 50%; bottom: 14%; transform: translateX(-50%); max-width: min(92vw, 640px); background: rgba(20,10,50,.86); color: #fff; padding: 8px 16px; border-radius: 16px; font-weight: 600; font-size: .92rem; text-align: center; z-index: 6; animation: tg-pop .25s ease-out; pointer-events: none; }
.tg-note-pop[hidden] { display: none; }
.tg-note-pop[data-kind="ok"] { background: #138a5b; }
.tg-note-pop[data-kind="bad"] { background: #b3202a; }

/* nút */
.tg-btn { appearance: none; border: 0; cursor: pointer; font: inherit; font-weight: 800; min-height: 48px; padding: 10px 22px; border-radius: 999px; text-decoration: none; display: inline-flex; align-items: center; justify-content: center; gap: 6px; line-height: 1.1; transition: transform .1s; }
.tg-btn:active { transform: translateY(2px) scale(.98); }
.tg-btn-main { background: var(--tg-yellow); color: var(--tg-ink); box-shadow: 0 4px 0 #c9951a; }
.tg-btn-ghost { background: rgba(255,255,255,.16); color: #fff; box-shadow: inset 0 0 0 2px rgba(255,255,255,.4); }
.tg-btn:focus-visible, .tg-ibtn:focus-visible, .tg-input:focus-visible { outline: 3px solid var(--tg-blue); outline-offset: 2px; }

/* hộp thoại */
.tg-modal { position: absolute; inset: 0; z-index: 20; display: flex; align-items: center; justify-content: center; padding: 16px; background: rgba(15,6,40,.72); overflow: auto; touch-action: pan-y; animation: tg-fade .2s; }
.tg-box { width: min(100%, 440px); max-height: 100%; overflow: auto; background: #fff; color: var(--tg-ink); border-radius: 28px; padding: 22px 20px; text-align: center; box-shadow: 0 8px 0 rgba(0,0,0,.25); animation: tg-pop .3s cubic-bezier(.2, 1.4, .4, 1); margin: auto; }
.tg-h { margin: 0 0 8px; font-size: 1.5rem; font-weight: 800; line-height: 1.15; }
.tg-h3 { margin: 16px 0 6px; font-size: 1rem; font-weight: 800; }
.tg-p { margin: 0 0 14px; line-height: 1.45; font-size: .98rem; }
.tg-err { color: #b3202a; min-height: 1.2em; margin: 6px 0; font-size: .9rem; font-weight: 600; }
.tg-note { margin: 10px 0 0; font-size: .85rem; line-height: 1.4; color: #5a4a8a; }
.tg-input { width: 100%; min-height: 52px; border-radius: 16px; border: 3px solid #cbb8ff; padding: 8px 14px; font: inherit; font-size: 1.1rem; font-weight: 700; color: var(--tg-ink); text-align: center; background: #fff; user-select: text; -webkit-user-select: text; }
.tg-box .tg-btn-main { width: 100%; }
.tg-box-fate { background: #f3e8ff; }
.tg-wagers { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.tg-wager { flex-direction: column; background: #fff; color: var(--tg-ink); box-shadow: 0 4px 0 #b9a0f0, inset 0 0 0 3px #b9a0f0; min-height: 64px; }
.tg-wager strong { font-size: 1.4rem; }
.tg-wager small { font-weight: 600; opacity: .75; }

/* màn kết quả */
.tg-result .tg-score { font-size: 3.4rem; font-weight: 800; line-height: 1; color: #6a2fb3; }
.tg-result .tg-score-l { font-size: .85rem; font-weight: 700; opacity: .7; margin-bottom: 10px; }
.tg-stats { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; margin-top: 6px; }
.tg-stat { background: #f1eaff; border-radius: 16px; padding: 8px 14px; min-width: 84px; }
.tg-stat strong { display: block; font-size: 1.25rem; }
.tg-stat small { font-size: .72rem; font-weight: 600; opacity: .75; }
.tg-lb { list-style: none; counter-reset: lb; padding: 0; margin: 0; text-align: left; max-height: 190px; overflow: auto; }
.tg-lb li { counter-increment: lb; display: flex; gap: 8px; padding: 5px 10px; border-radius: 12px; font-weight: 600; font-size: .92rem; }
.tg-lb li::before { content: counter(lb); width: 1.4em; font-weight: 800; color: #8a6fd0; }
.tg-lb li:nth-child(odd) { background: #f6f2ff; }
.tg-lb li.me { background: var(--tg-yellow); }
.tg-lb .n { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tg-lb .s { font-weight: 800; }
.tg-actions { display: flex; flex-direction: column; gap: 8px; margin-top: 16px; }
.tg-result .tg-btn-ghost { background: #f1eaff; color: #4a2a9a; box-shadow: inset 0 0 0 2px #cbb8ff; }

/* banner chạy ngang */
.tg-banner { position: absolute; left: 0; right: 0; top: 38%; z-index: 15; pointer-events: none; padding: 14px 0; text-align: center; font-weight: 800; font-size: clamp(1.7rem, 7vw, 3.2rem); letter-spacing: .04em; color: #fff; text-shadow: 0 3px 0 rgba(0,0,0,.35); transform: skewY(-3deg); animation: tg-banner .85s cubic-bezier(.2, .8, .3, 1) both; }
.tg-banner-info { background: var(--tg-blue); color: var(--tg-ink); text-shadow: none; }
.tg-banner-trap { background: #f59f00; color: #2b1a00; text-shadow: none; }
.tg-banner-boss { background: #d6283a; }
.tg-banner-warn { background: #111; color: var(--tg-yellow); }
.tg-banner-good { background: #14a36b; }
.tg-banner span { display: inline-block; }

@keyframes tg-banner { 0% { transform: translateX(110%) skewY(-3deg); } 20% { transform: translateX(0) skewY(-3deg); } 80% { transform: translateX(0) skewY(-3deg); } 100% { transform: translateX(-110%) skewY(-3deg); } }
@keyframes tg-pop { from { transform: scale(.8); opacity: 0; } to { transform: scale(1); opacity: 1; } }
@keyframes tg-drop { from { transform: translate(-50%, -30px); opacity: 0; } to { transform: translate(-50%, 0); opacity: 1; } }
@keyframes tg-fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes tg-bump { 0% { transform: scale(1); } 40% { transform: scale(1.25); } 100% { transform: scale(1); } }

@media (max-width: 480px) { #game-root .tg-hud .tg-ibtn:last-child { display: none; } .tg-hud { gap: 6px; } .tg-hud-prog { padding: 6px 10px; font-size: .82rem; } }
@media (min-width: 900px) {
  .tg-q { top: 70px; padding: 16px 24px 18px; }
  .tg-hud { padding: 12px 20px; }
}
@media (max-width: 599px) { .tg-q { max-height: 36%; } }
@media (max-height: 420px) { .tg-q { top: 52px; max-height: 40%; } }

@media (prefers-reduced-motion: reduce) {
  .tg-meme { animation: tg-fade .9s both; }
  .tg-banner { animation: tg-fade .6s both; transform: skewY(-3deg); }
  .tg-box, .tg-modal, .tg-note-pop, .tg-hud-score.bump { animation: none; }
  .tg-q.in { animation: none; }
  .tg-btn { transition: none; }
}

.tg-q-opts[data-kind="ok"] { background: #dcfbe9; color: #0b5d3c; border-radius: 12px; border-top: 0; padding: 8px 10px; text-align: center; }
.tg-q-opts[data-kind="bad"] { background: #ffe3e3; color: #8a1520; border-radius: 12px; border-top: 0; padding: 8px 10px; text-align: center; }

/* meme sticker: chữ to nghiêng, nảy rồi biến mất; không chặn gameplay */
.tg-meme { position: absolute; left: calc(50% + var(--x, 0%)); top: calc(env(safe-area-inset-top, 0px) + 4px); z-index: 14; pointer-events: none; max-width: 90%; text-align: center; font-weight: 900; font-size: clamp(1.5rem, 7vw, 3rem); line-height: 1.05; color: var(--col, #ffe14d); -webkit-text-stroke: 6px var(--edge, #000); paint-order: stroke fill; text-shadow: 0 5px 0 var(--edge, #000), 0 8px 14px rgba(0,0,0,.35); transform: translate(-50%, 0) rotate(var(--r, -6deg)); animation: tg-meme .9s cubic-bezier(.2, 1.4, .4, 1) both; white-space: pre-wrap; }
@keyframes tg-meme {
  0% { transform: translate(-50%, 20px) rotate(var(--r)) scale(.2); opacity: 0; }
  18% { transform: translate(-50%, 0) rotate(var(--r)) scale(1.3); opacity: 1; }
  30% { transform: translate(-50%, 0) rotate(calc(var(--r) * -.7)) scale(.95); }
  42% { transform: translate(-48%, 0) rotate(var(--r)) scale(1.06); }
  54% { transform: translate(-52%, 0) rotate(calc(var(--r) * .8)) scale(1.02); }
  66% { transform: translate(-50%, 0) rotate(var(--r)) scale(1.04); opacity: 1; }
  100% { transform: translate(-50%, -30px) rotate(var(--r)) scale(.9); opacity: 0; }
}
.tg-demo { background: #fff6d6; color: #5a3d00; border-radius: 12px; padding: 8px 12px; font-weight: 700; }

/* thuộc tính hidden luôn thắng display của các lớp tg-* */
.tg-root [hidden] { display: none !important; }

.tg-result-img { display: block; height: 140px; max-width: 100%; width: auto; object-fit: contain; margin: -6px auto 4px; }
@media (max-height: 640px) { .tg-result-img { height: 104px; } }
.tg-art-loading { background: rgba(20,10,50,.85); z-index: 50; }
