/* ==========================================================================
   Giáng sinh – giao diện game
   Mọi chuyển động nền đều dùng transform/opacity (chạy trên GPU, không vẽ lại).
   Tốc độ mặt đất = tốc độ ống khói = 1000px / 7.5s ≈ 133.33 px/s.
   ========================================================================== */

:root
{
   --font: "Baloo 2", "Nunito", "Arial Rounded MT Bold", "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
   --ink: #16224d;
   --red: #d92b2b;
   --red-dark: #7d0f1c;
   --gold: #ffd84d;
}

@keyframes scrollX {
   to { transform: translate3d(calc(var(--tile) * -1), 0, 0); }
}
@keyframes snowFall {
   to { transform: translate3d(calc(var(--tw) * -1), var(--th), 0); }
}
@keyframes twinkle {
   from { opacity: .35; }
   to { opacity: 1; }
}
@keyframes blink {
   0%, 49.9% { opacity: 0; }
   50%, 100% { opacity: 1; }
}

/* người chơi */
@keyframes hover {
   from { transform: translate3d(0, -5px, 0); }
   to { transform: translate3d(0, 5px, 0); }
}
@keyframes deerBob {
   from { transform: translateY(-.7px); }
   to { transform: translateY(.9px); }
}
@keyframes sleighBob {
   from { transform: translateY(.8px) rotate(1.5deg); }
   to { transform: translateY(-.6px) rotate(-1.5deg); }
}
@keyframes legBack {
   from { transform: rotate(38deg); }
   to { transform: rotate(-22deg); }
}
@keyframes legFront {
   from { transform: rotate(18deg); }
   to { transform: rotate(-42deg); }
}
@keyframes headNod {
   from { transform: rotate(-4deg); }
   to { transform: rotate(4deg); }
}
@keyframes hatSway {
   from { transform: rotate(-10deg); }
   to { transform: rotate(14deg); }
}
@keyframes noseGlow {
   from { opacity: .15; }
   to { opacity: .55; }
}
@keyframes sparkleFly {
   from { opacity: 1; transform: translate3d(0, 0, 0) scale(1) rotate(0deg); }
   to { opacity: 0; transform: translate3d(-46px, 12px, 0) scale(.2) rotate(140deg); }
}

/* giao diện */
@keyframes tapPulse {
   0%, 100% { transform: translateY(0) scale(1); }
   50% { transform: translateY(3px) scale(.9); }
}
@keyframes tapRing {
   0% { transform: scale(.4); opacity: .9; }
   100% { transform: scale(1.5); opacity: 0; }
}
@keyframes titleFloat {
   from { transform: translateY(-3px) rotate(-2deg); }
   to { transform: translateY(3px) rotate(-2deg); }
}

*,
*:before,
*:after
{
   box-sizing: border-box;
   -webkit-touch-callout: none;
   -webkit-user-select: none;
   -moz-user-select: none;
   user-select: none;
   -webkit-tap-highlight-color: transparent;
}

html,
body
{
   height: 100%;
   overflow: hidden;
   font-family: var(--font);
   font-size: 14px;
   color: #fff;
   background: #070d2b;
   touch-action: manipulation;
   overscroll-behavior: none;
}
body
{
   position: fixed;
   top: 0;
   left: 0;
   width: 100%;
}

#gamecontainer
{
   /* kích thước + tỉ lệ phóng do fitScreen() trong main.js đặt */
   position: absolute;
   top: 0;
   left: 0;
   width: 100%;
   height: 100%;
   transform-origin: 0 0;
}

#gamescreen
{
   position: absolute;
   width: 100%;
   height: 100%;
   overflow: hidden;
}

/* ---------- Bầu trời ---------- */
#sky
{
   position: absolute;
   top: 0;
   width: 100%;
   height: 80%;
   overflow: hidden;
   background: linear-gradient(to bottom, #01030c 0%, #040820 40%, #0a1338 74%, #14244f 100%);
}

.stars
{
   position: absolute;
   top: 0;
   left: 0;
   width: 100%;
   height: 100%;
   background-image: url('../assets/stars.svg');
   background-repeat: repeat;
   pointer-events: none;
}
/* một lớp sao đứng yên, một lớp nhấp nháy */
.stars-a { background-size: 320px 320px; }
.stars-b { background-size: 440px 440px; background-position: 130px 70px; will-change: opacity; animation: twinkle 2.6s ease-in-out infinite alternate; }

#moon
{
   position: absolute;
   top: 7%;
   right: 9%;
   width: 64px;
   height: 64px;
   border-radius: 50%;
   background: url('../assets/moon.svg') center / 86px 86px no-repeat;
   box-shadow: 0 0 34px 10px rgba(255, 240, 180, .28), 0 0 90px 36px rgba(255, 240, 180, .12);
   pointer-events: none;
}

/* một lớp phông: rộng hơn màn hình đúng 1 tile rồi trượt sang trái 1 tile, lặp vô hạn */
.layer
{
   position: absolute;
   left: 0;
   bottom: var(--bottom, 0px);
   width: calc(100% + var(--tile));
   height: var(--h);
   background-repeat: repeat-x;
   background-size: var(--tile) var(--h);
   pointer-events: none;
   will-change: transform;
   animation: scrollX var(--dur) linear infinite;
}
.layer-mountains { --tile: 720px; --h: 230px; --bottom: 84px; --dur: 90s; background-image: url('../assets/mountains.svg'); }
.layer-village   { --tile: 640px; --h: 170px; --bottom: 26px; --dur: 32s; background-image: url('../assets/village.svg'); }
.layer-near      { --tile: 560px; --h: 150px; --dur: 12.4s; background-image: url('../assets/near.svg'); }

#flyarea
{
   position: absolute;
   bottom: 0;
   height: 420px;
   width: 100%;
}

/* dây đèn nháy đánh dấu trần bay */
#ceiling
{
   --tile: 120px;
   position: absolute;
   top: -6px;
   left: 0;
   height: 20px;
   width: calc(100% + 120px);
   background: url('../assets/lights-a.svg') repeat-x;
   background-size: 120px 20px;
   pointer-events: none;
   will-change: transform;
   animation: scrollX .9s linear infinite;
}
#ceiling:after
{
   content: "";
   position: absolute;
   top: 0; left: 0; right: 0; bottom: 0;
   background: #0f1b4a url('../assets/lights-b.svg') repeat-x;
   background-size: 120px 20px;
   background-color: transparent;
   animation: blink 1.1s linear infinite;
}

/* ---------- Mặt đất ---------- */
#land
{
   position: absolute;
   bottom: 0;
   width: 100%;
   height: 20%;
   overflow: hidden;
   /* 14px trên cùng trùng màu chân lớp tiền cảnh để mép tuyết liền mạch */
   background: linear-gradient(to bottom, #a3bbe4 0, #a3bbe4 14px, #79b1ea 14px, #4a82cc 64px, #2a5597 100%);
   z-index: 20;
}
.land-strip
{
   --tile: 480px;
   position: absolute;
   top: 0;
   left: 0;
   width: calc(100% + 480px);
   height: 64px;
   background: url('../assets/land-top.svg') repeat-x;
   background-size: 480px 64px;
   will-change: transform;
   animation: scrollX 3.6s linear infinite;
}

/* ---------- Tuyết rơi ---------- */
#snowcanvas
{
   position: absolute;
   top: 0;
   left: 0;
   width: 100%;
   height: 100%;
   pointer-events: none;
   z-index: 30;
}

#flash
{
   position: absolute;
   top: 0; left: 0; right: 0; bottom: 0;
   background: #fff;
   opacity: 0;
   pointer-events: none;
   z-index: 60;
}

/* ---------- Người chơi ---------- */
#player
{
   left: 60px;
   top: 0;
   z-index: 15;
   will-change: transform;
}

/* .bird là khung va chạm 66x36 – hình vẽ lớn hơn một chút và nằm chính giữa */
.bird
{
   position: absolute;
   width: 66px;
   height: 36px;
}
.player-art
{
   position: absolute;
   left: -6px;
   top: -4px;
   width: 78px;
   height: 44px;
   will-change: transform;
}
/* quầng sáng vàng sau nhân vật (viền trắng do addOutline() trong main.js vẽ) */
.player-art:before
{
   content: "";
   position: absolute;
   left: -16px;
   right: -16px;
   top: -18px;
   bottom: -18px;
   border-radius: 50%;
   background: radial-gradient(closest-side, rgba(255, 226, 122, .5), rgba(255, 226, 122, 0));
}
.player-art svg { position: relative; }
.player-art svg
{
   display: block;
   width: 100%;
   height: 100%;
   overflow: visible;
}
.state-splash .player-art { animation: hover .7s ease-in-out infinite alternate; }

.deer   { animation: deerBob .26s ease-in-out infinite alternate; }
.sleigh { transform-origin: 18px 22px; animation: sleighBob .52s ease-in-out infinite alternate; }
.leg-back  { transform-origin: 42px 21px; animation: legBack .2s ease-in-out infinite alternate; }
.leg-front { transform-origin: 51px 21px; animation: legFront .2s ease-in-out infinite alternate; }
.leg.far   { animation-delay: -.1s; }
.head      { transform-origin: 52px 15px; animation: headNod .4s ease-in-out infinite alternate; }
.hat-tail  { transform-origin: 18px 3.5px; animation: hatSway .32s ease-in-out infinite alternate; }
.nose-glow { animation: noseGlow .6s ease-in-out infinite alternate; }

.state-dead #player *,
.state-dead #player { animation-play-state: paused !important; }

.sparkle
{
   position: absolute;
   width: 9px;
   height: 9px;
   margin: -4.5px 0 0 -4.5px;
   background: var(--gold);
   clip-path: polygon(50% 0, 62% 38%, 100% 50%, 62% 62%, 50% 100%, 38% 62%, 0 50%, 38% 38%);
   pointer-events: none;
   z-index: 14;
   animation: sparkleFly .65s ease-out forwards;
}
.sparkle.alt { background: #ffffff; width: 6px; height: 6px; }

/* ---------- Ống khói ---------- */
.pipe
{
   position: absolute;
   left: 0;
   top: 0;
   width: 70px;
   height: 100%;
   z-index: 10;
   will-change: transform;
}
.pipe_upper,
.pipe_lower
{
   position: absolute;
   left: 0;
   width: 70px;
   z-index: 1;
}
.pipe_upper { top: 0; }
.pipe_lower { bottom: 0; }

.pipe .body,
.pipe .cap
{
   position: absolute;
   left: 0;
   width: 70px;
}
.pipe .body
{
   background-image: url('../assets/pipe-body.svg');
   background-repeat: repeat-y;
   background-size: 70px auto;
}
.pipe .cap
{
   height: 35px;
   background-repeat: no-repeat;
   background-size: 70px 35px;
}
.pipe_upper .body { top: 0; bottom: 32px; background-position: 0 100%; }
.pipe_upper .cap  { bottom: 0; background-image: url('../assets/pipe-cap-down.svg'); }
.pipe_lower .body { top: 32px; bottom: 0; background-position: 0 0; }
.pipe_lower .cap  { top: 0; background-image: url('../assets/pipe-cap-up.svg'); }

/* ống dựng sẵn lúc bắt đầu ván: trượt vào từ trên/dưới */
@keyframes pipeInUpper { from { opacity: 0; transform: translate3d(0, -40px, 0); } to { opacity: 1; transform: none; } }
@keyframes pipeInLower { from { opacity: 0; transform: translate3d(0, 40px, 0); } to { opacity: 1; transform: none; } }
.pipe-in .pipe_upper { animation: pipeInUpper .45s ease-out both; }
.pipe-in .pipe_lower { animation: pipeInLower .45s ease-out both; }

/* ---------- Hộp quà thả vào ống khói ---------- */
.gift-wrap
{
   position: absolute;
   left: 0;
   top: 0;
   width: 0;
   height: 0;
   z-index: 0;            /* dưới lớp gạch: rơi tới miệng ống là khuất dần vào trong */
   will-change: transform;
}
.gift
{
   position: absolute;
   left: -9px;
   top: -9px;
   width: 18px;
   height: 18px;
   border-radius: 3px;
   background:
      linear-gradient(90deg, transparent 38%, var(--rb) 38%, var(--rb) 62%, transparent 62%),
      linear-gradient(0deg, transparent 38%, var(--rb) 38%, var(--rb) 62%, transparent 62%),
      var(--bx);
   box-shadow: 0 0 0 1.5px #fff, 0 0 8px rgba(255, 226, 122, .8);
   will-change: transform;
}
.gift:before,
.gift:after
{
   content: "";
   position: absolute;
   top: -6px;
   width: 8px;
   height: 7px;
   background: var(--rb);
   border: 1px solid #fff;
}
.gift:before { left: 1px; border-radius: 60% 40% 10% 60%; }
.gift:after  { right: 1px; border-radius: 40% 60% 60% 10%; }
.gift-1 { --bx: #e23b3b; --rb: #ffd84d; }
.gift-2 { --bx: #35b56a; --rb: #ffffff; }
.gift-3 { --bx: #3fa9f5; --rb: #ffd84d; }

.puff
{
   position: absolute;
   width: 11px;
   height: 11px;
   margin: -5.5px 0 0 -5.5px;
   background: var(--gold);
   clip-path: polygon(50% 0, 62% 38%, 100% 50%, 62% 62%, 50% 100%, 38% 62%, 0 50%, 38% 38%);
   pointer-events: none;
   z-index: 2;
}
.puff.snowy { background: #fff; clip-path: none; border-radius: 50%; width: 8px; height: 8px; }

/* ---------- Chữ viền ---------- */
.digit,
.splash-title,
.splash-tap,
.gameover-title
{
   font-family: var(--font);
   font-weight: 900;
   color: #fff;
   text-shadow:
      2px 0 0 var(--ink), -2px 0 0 var(--ink), 0 2px 0 var(--ink), 0 -2px 0 var(--ink),
      1.5px 1.5px 0 var(--ink), -1.5px 1.5px 0 var(--ink), 1.5px -1.5px 0 var(--ink), -1.5px -1.5px 0 var(--ink),
      0 5px 0 var(--ink);
}

#bigscore
{
   position: absolute;
   top: 26px;
   left: 0;
   width: 100%;
   text-align: center;
   z-index: 40;
   pointer-events: none;
   will-change: transform;
}
#bigscore .digit
{
   display: inline-block;
   font-size: 46px;
   line-height: 1;
   letter-spacing: 1px;
}

/* ---------- Màn hình chờ ---------- */
#splash
{
   position: absolute;
   opacity: 0;
   top: 0;
   left: 0;
   width: 100%;
   height: 100%;
   z-index: 40;
   pointer-events: none;
}
.splash-title
{
   position: absolute;
   top: 62px;
   left: 0;
   width: 100%;
   text-align: center;
   font-size: 40px;
   line-height: 1;
   color: var(--gold);
   animation: titleFloat 1.4s ease-in-out infinite alternate;
}
.splash-tap
{
   position: absolute;
   top: 262px;
   left: 0;
   width: 100%;
   text-align: center;
   font-size: 18px;
}
.tap-icon
{
   position: relative;
   display: block;
   width: 40px;
   height: 40px;
   margin: 0 auto 4px;
   animation: tapPulse 1s ease-in-out infinite;
}
.tap-icon svg { position: relative; display: block; width: 100%; height: 100%; }
.tap-icon:before
{
   content: "";
   position: absolute;
   left: 4px;
   top: -8px;
   width: 28px;
   height: 28px;
   border: 3px solid #fff;
   border-radius: 50%;
   animation: tapRing 1s ease-out infinite;
}

/* ---------- Bảng điểm ---------- */
#scoreboard
{
   position: absolute;
   top: 0; left: 0; right: 0; bottom: 0;
   display: none;
   flex-direction: column;
   align-items: center;
   justify-content: center;
   padding: 16px;
   background: rgba(7, 13, 43, .45);
   z-index: 100;
}
#scoreboard > * { flex: 0 0 auto; }

.gameover-title
{
   font-size: 40px;
   line-height: 1;
   color: #ff5a5a;
   margin-bottom: 16px;
}

.card
{
   width: 100%;
   max-width: 300px;
   background: #fff8ec;
   color: #4a1d24;
   border: 3px solid var(--red-dark);
   border-radius: 16px;
   box-shadow: 0 5px 0 var(--red-dark), 0 14px 28px rgba(0, 0, 0, .4);
}

#scorepanel
{
   display: flex;
   align-items: center;
   padding: 12px 14px;
   margin-bottom: 16px;
}
#medal
{
   flex: 0 0 auto;
   width: 52px;
   height: 52px;
   margin-right: 8px;
   border-radius: 50%;
   border: 2px dashed #e2c9a8;
}
.medal
{
   position: relative;
   width: 100%;
   height: 100%;
   margin: -2px;
   box-sizing: content-box;
   border-radius: 50%;
   border: 2px solid rgba(0, 0, 0, .25);
   background: radial-gradient(circle at 35% 30%, #fff 0, var(--m1) 28%, var(--m2) 100%);
   box-shadow: inset 0 0 0 4px rgba(255, 255, 255, .35);
}
.medal:after
{
   content: "★";
   position: absolute;
   top: 0; left: 0; right: 0; bottom: 0;
   font-size: 28px;
   line-height: 52px;
   text-align: center;
   color: rgba(255, 255, 255, .92);
   text-shadow: 0 1px 0 rgba(0, 0, 0, .25);
}
.medal-bronze   { --m1: #e7a26a; --m2: #a8632f; }
.medal-silver   { --m1: #e3e8f0; --m2: #8f9bb0; }
.medal-gold     { --m1: #ffe27a; --m2: #e0a100; }
.medal-platinum { --m1: #d9fbff; --m2: #58b9d6; }

.scorecol
{
   flex: 1 1 0;
   text-align: center;
}
.scorecol .label
{
   display: block;
   font-size: 12px;
   font-weight: 700;
   letter-spacing: .08em;
   text-transform: uppercase;
   color: #a0626a;
}
#currentscore,
#highscore
{
   display: block;
   font-size: 32px;
   font-weight: 900;
   line-height: 1.1;
   color: var(--red);
   font-variant-numeric: tabular-nums;
}

#replay
{
   display: flex;
   align-items: center;
   justify-content: center;
   min-width: 170px;
   padding: 11px 24px;
   font-size: 20px;
   font-weight: 900;
   color: #fff;
   background: linear-gradient(to bottom, #3fc47c, #1f9a5a);
   border: 3px solid #0f5a35;
   border-radius: 999px;
   box-shadow: 0 5px 0 #0f5a35, 0 12px 22px rgba(0, 0, 0, .35);
   cursor: pointer;
}
#replay svg
{
   width: 22px;
   height: 22px;
   margin-right: 8px;
}
#replay:active
{
   box-shadow: 0 2px 0 #0f5a35, 0 6px 12px rgba(0, 0, 0, .35);
   margin-top: 3px;
   margin-bottom: -3px;
}

.boundingbox
{
   position: absolute;
   display: none;
   top: 0;
   left: 0;
   width: 0;
   height: 0;
   border: 1px solid red;
   z-index: 200;
   pointer-events: none;
}

@media (prefers-reduced-motion: reduce)
{
   .stars, .splash-title { animation: none; }
}

/* ---------- Phủ tối phông nền (núi, làng, cây) để nhân vật nổi lên ---------- */
#skydim
{
   position: absolute;
   top: 0; left: 0; right: 0; bottom: 0;
   background: linear-gradient(to bottom, rgba(1, 3, 12, .2) 0%, rgba(1, 3, 12, .5) 100%);
   pointer-events: none;
}

/* ---------- Vé ---------- */
.ticket-ico
{
   display: inline-block;
   flex: 0 0 auto;
   width: 22px;
   height: 14px;
   vertical-align: middle;
   border-radius: 3px;
   background:
      radial-gradient(circle at 0 50%, transparent 3px, #ffd24d 3.5px) left / 51% 100% no-repeat,
      radial-gradient(circle at 100% 50%, transparent 3px, #ffb52e 3.5px) right / 51% 100% no-repeat;
   transform: rotate(-12deg);
}
.ticket-ico.big { width: 44px; height: 28px; border-radius: 5px; background-size: 51% 100%; }

#tickethud
{
   position: absolute;
   top: 10px;
   left: 10px;
   display: none;
   align-items: center;
   padding: 4px 10px 4px 8px;
   font-size: 16px;
   font-weight: 900;
   color: #fff;
   background: rgba(3, 6, 22, .6);
   border: 2px solid rgba(255, 210, 77, .7);
   border-radius: 999px;
   z-index: 20;
   pointer-events: none;
}
#tickethud .ticket-ico { margin-right: 7px; }
.state-play #tickethud, .state-splash #tickethud { display: flex; }

.ticket-pop
{
   position: absolute;
   font-size: 18px;
   font-weight: 900;
   color: #ffd24d;
   text-shadow: 0 2px 0 #7d0f1c, 0 0 10px rgba(255, 210, 77, .8);
   white-space: nowrap;
   z-index: 30;
   pointer-events: none;
}

#ticketcard
{
   padding: 12px 14px 14px;
   margin-bottom: 18px;
}
.ticket-row { display: flex; align-items: center; }
.ticket-info { margin-left: 14px; }
.ticket-total { font-size: 18px; font-weight: 700; }
.ticket-total b { font-size: 26px; font-weight: 900; color: var(--red); }
.ticket-run { font-size: 13px; font-weight: 700; color: #1d7257; }
.ticket-progress
{
   height: 8px;
   margin: 10px 0 5px;
   background: #f0dcc0;
   border-radius: 999px;
   overflow: hidden;
}
.ticket-progress i { display: block; height: 100%; width: 0; background: linear-gradient(to right, #ffd24d, #ff9d2e); border-radius: 999px; }
.ticket-next { font-size: 12px; color: #a0626a; text-align: center; }

.btn-gold
{
   margin-top: 10px;
   padding: 9px 16px;
   text-align: center;
   font-size: 17px;
   font-weight: 900;
   color: #5a2a00;
   background: linear-gradient(to bottom, #ffe27a, #ffb52e);
   border: 3px solid #a86400;
   border-radius: 999px;
   box-shadow: 0 4px 0 #a86400;
   cursor: pointer;
}
.btn-gold:active { box-shadow: 0 1px 0 #a86400; transform: translateY(3px); }

/* ---------- Kho quà ---------- */
#shop
{
   position: absolute;
   top: 0; left: 0; right: 0; bottom: 0;
   display: none;
   flex-direction: column;
   align-items: center;
   background: rgba(3, 6, 22, .94);
   color: #fff;
   z-index: 120;
}
.shop-head
{
   flex: 0 0 auto;
   display: flex;
   align-items: center;
   width: 100%;
   max-width: 420px;
   padding: 14px 14px 10px;
}
.shop-title { flex: 1 1 auto; font-size: 26px; font-weight: 900; color: #ffd24d; }
.shop-balance
{
   display: flex;
   align-items: center;
   padding: 4px 12px 4px 9px;
   font-size: 18px;
   border: 2px solid rgba(255, 210, 77, .7);
   border-radius: 999px;
}
.shop-balance .ticket-ico { margin-right: 8px; }
#closeshop
{
   width: 36px;
   height: 36px;
   margin-left: 10px;
   font-size: 18px;
   line-height: 36px;
   text-align: center;
   background: rgba(255, 255, 255, .14);
   border-radius: 50%;
   cursor: pointer;
}
.shop-body
{
   flex: 1 1 auto;
   width: 100%;
   max-width: 420px;
   padding: 0 14px 20px;
   overflow-y: auto;
   -webkit-overflow-scrolling: touch;
}
.shop-note { font-size: 13px; color: #b9c4ea; margin-bottom: 10px; }
.shop-body h3 { margin: 16px 0 6px; font-size: 15px; font-weight: 900; color: #ffd24d; }

.gift-item
{
   display: flex;
   align-items: center;
   padding: 10px;
   margin-bottom: 9px;
   background: #fff8ec;
   color: #4a1d24;
   border-radius: 14px;
   border: 2px solid var(--red-dark);
}
.gift-ico
{
   flex: 0 0 auto;
   position: relative;
   width: 40px;
   height: 40px;
   border-radius: 10px;
   background: #d92b2b;
}
.gift-ico:before, .gift-ico:after { content: ""; position: absolute; background: #ffd24d; }
.gift-ico:before { left: 17px; top: 0; width: 6px; height: 100%; }
.gift-ico:after { top: 17px; left: 0; height: 6px; width: 100%; }
.gift-ico-spin { border-radius: 50%; background: conic-gradient(#d92b2b 0 25%, #3fb56f 0 50%, #ffd24d 0 75%, #4563a8 0); }
.gift-ico-spin:before { left: 15px; top: 15px; width: 10px; height: 10px; border-radius: 50%; background: #fff; }
.gift-ico-spin:after { display: none; }
.gift-ico-coupon { background: #1f9a5a; }
.gift-ico-credit { background: #d92b2b; }

.gift-text { flex: 1 1 auto; min-width: 0; margin: 0 10px; }
.gift-name { font-size: 15px; font-weight: 900; }
.gift-desc { font-size: 12px; color: #a0626a; }
.gift-buy
{
   flex: 0 0 auto;
   min-width: 78px;
   padding: 6px 8px;
   text-align: center;
   color: #fff;
   background: linear-gradient(to bottom, #3fc47c, #1f9a5a);
   border: 2px solid #0f5a35;
   border-radius: 12px;
   cursor: pointer;
}
.gift-buy.confirm { background: linear-gradient(to bottom, #ff8a3d, #e0531a); border-color: #8a2c08; }
.gift-cost { display: block; font-size: 15px; font-weight: 900; }
.gift-cost .ticket-ico { width: 16px; height: 10px; margin-right: 5px; }
.gift-btn { display: block; font-size: 12px; font-weight: 700; }
.gift-item.locked .gift-buy { background: #b9b1a6; border-color: #8a8378; cursor: default; }
.gift-item.locked { opacity: .78; }

#shop-history li
{
   display: flex;
   padding: 6px 0;
   font-size: 13px;
   border-bottom: 1px solid rgba(255, 255, 255, .12);
}
#shop-history .h-name { flex: 1 1 auto; }
#shop-history .h-value { font-weight: 900; color: #ffd24d; margin: 0 10px; }
#shop-history .h-date { color: #b9c4ea; }
#shop-history .empty { color: #b9c4ea; border: 0; }

#shop-result
{
   position: absolute;
   top: 0; left: 0; right: 0; bottom: 0;
   display: none;
   align-items: center;
   justify-content: center;
   padding: 20px;
   background: rgba(3, 6, 22, .8);
   z-index: 130;
}
.result-card { padding: 18px 16px; text-align: center; }
.result-label { font-size: 15px; font-weight: 700; color: #a0626a; }
.result-value { font-size: 46px; font-weight: 900; line-height: 1.2; color: var(--red); }
.result-sub { font-size: 13px; color: #4a1d24; }

/* ---------- Thanh ngôn ngữ + tài khoản ---------- */
#topbar
{
   position: absolute;
   top: 8px;
   right: 8px;
   display: flex;
   align-items: center;
   max-width: calc(100% - 16px);
   padding: 4px 6px 4px 10px;
   font-size: 12px;
   font-weight: 700;
   color: #fff;
   background: rgba(3, 6, 22, .62);
   border-radius: 999px;
   z-index: 90;
}
.state-play #topbar { display: none; }
#acct-who { max-width: 130px; margin-right: 8px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: #b9c4ea; }
.top-btn { margin-right: 8px; padding: 3px 9px; color: #5a2a00; background: #ffd24d; border-radius: 999px; cursor: pointer; white-space: nowrap; }
#acct-logout { color: #fff; background: rgba(255, 255, 255, .18); }
.langs { white-space: nowrap; }
.langs b { display: inline-block; padding: 3px 7px; font-weight: 700; color: #b9c4ea; border-radius: 999px; cursor: pointer; }
.langs b.on { color: #03061a; background: #fff; }

#splash-guest { margin-top: 14px; font-size: 13px; font-weight: 700; color: #ffd24d; text-shadow: 0 1px 0 #03061a; }
.tap-loading { display: none; }
.starting .tap-text, .starting .tap-icon { display: none; }
.starting .tap-loading { display: inline; }

#card-login { display: none; }
#ticketcard.guest .ticket-progress, #ticketcard.guest .ticket-total { display: none; }
#ticketcard.guest .ticket-run { font-size: 14px; color: #4a1d24; }

/* ---------- Đếm ngược / kết thúc sự kiện ---------- */
#eventgate
{
   position: absolute;
   top: 0; left: 0; right: 0; bottom: 0;
   display: none;
   align-items: center;
   justify-content: center;
   padding: 20px;
   background: rgba(3, 6, 22, .72);
   z-index: 80;
}
.gate-card { padding: 20px 16px; text-align: center; }
.gate-title { font-size: 22px; font-weight: 900; color: var(--red); }
.gate-text { margin-top: 8px; font-size: 16px; font-weight: 700; font-variant-numeric: tabular-nums; }

/* ---------- Đăng nhập ---------- */
#loginbox
{
   position: absolute;
   top: 0; left: 0; right: 0; bottom: 0;
   display: none;
   align-items: center;
   justify-content: center;
   padding: 20px;
   background: rgba(3, 6, 22, .85);
   z-index: 140;
}
.login-card { padding: 18px 16px 12px; }
.login-title { margin-bottom: 12px; font-size: 18px; font-weight: 900; text-align: center; color: var(--red); }
.login-card label { display: block; margin-bottom: 10px; font-size: 12px; font-weight: 700; color: #a0626a; }
.login-card input
{
   display: block;
   width: 100%;
   margin-top: 4px;
   padding: 10px 12px;
   font: inherit;
   font-size: 16px;            /* >= 16px để iOS không tự phóng to khi gõ */
   color: #4a1d24;
   background: #fff;
   border: 2px solid #e2c9a8;
   border-radius: 10px;
   box-sizing: border-box;
   -webkit-user-select: text;
   user-select: text;
}
#login-error { min-height: 18px; font-size: 13px; font-weight: 700; color: #c81e2b; text-align: center; }
.login-card button { display: block; width: 100%; font-family: inherit; box-sizing: border-box; }
.login-or { margin: 10px 0 0; font-size: 12px; text-align: center; color: #a0626a; }
.btn-plain
{
   margin-top: 8px;
   padding: 10px 16px;
   font-size: 15px;
   font-weight: 700;
   color: #333;
   background: #fff;
   border: 2px solid #c9c9c9;
   border-radius: 999px;
   cursor: pointer;
}
.btn-link { margin-top: 8px; padding: 8px; font-size: 13px; color: #a0626a; background: none; border: 0; cursor: pointer; }

.result-extra { margin-top: 4px; font-size: 12px; color: #a0626a; }
.result-value.code { font-size: 22px; letter-spacing: .04em; word-break: break-all; -webkit-user-select: text; user-select: text; }
#shop-history .h-value.code { -webkit-user-select: text; user-select: text; }
