/* Xếp Bánh Chưng (xep-banh-chung.html). Colours follow the app's StackPalette and theme. */
@font-face {
  font-family: 'Gilroy';
  src: url('../assets/fonts/gilroy_extra_bold.otf') format('opentype');
  font-weight: 800;
  font-display: swap;
}

:root {
  --xbc-gold: #FFD54A;
  --xbc-button: #FFC107;
  --xbc-button-rim: #FFF3C4;
  --xbc-button-text: #8E0000;
  --xbc-red: #C62828;
  --xbc-red-dark: #8E0000;
  --xbc-panel: rgba(42, 20, 8, .86);
  --xbc-panel-solid: #3A1C0C;
  --xbc-panel-top: #6E2A12;
  --xbc-cream: #FFF3B0;
  --xbc-combo: #FF9F43;
  --xbc-green: #7CE38B;
  --xbc-ink: #2b1408;
  --xbc-paper: #fff8ea;
}

.xbc-page { margin: 0; background: #fff8ea; color: var(--xbc-ink); font-family: Nunito, system-ui, sans-serif; }
.xbc-page [hidden] { display: none !important; }
.xbc-main { padding: clamp(.75rem, 2vw, 1.5rem) clamp(.5rem, 2vw, 1.5rem) 2.5rem; background: radial-gradient(circle at 20% 0%, #ffe3b0 0, rgba(255, 227, 176, 0) 45%), linear-gradient(180deg, #fff1d6, #fff8ea 60%); }

.xbc-layout { display: grid; grid-template-columns: auto minmax(0, 380px); justify-content: center; align-items: start; gap: clamp(1rem, 3vw, 2.5rem); max-width: 1100px; margin: 0 auto; }

/* ---------- the stage: a portrait play area, full screen while a round runs ---------- */
.xbc-game { --xbc-h: max(520px, min(780px, calc(100svh - 110px))); position: relative; width: calc(var(--xbc-h) * .58); max-width: 100%; height: var(--xbc-h); }
.xbc-stage { position: relative; width: 100%; height: 100%; overflow: hidden; border-radius: 28px; background: linear-gradient(#9ED4F7, #FFF1BE); box-shadow: 0 24px 60px rgba(76, 33, 8, .28), 0 0 0 1px rgba(110, 42, 18, .18); outline: none; touch-action: manipulation; user-select: none; -webkit-user-select: none; -webkit-tap-highlight-color: transparent; }
.xbc-canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }

body.xbc-playing { overflow: hidden; }
body.xbc-playing #header-container,
body.xbc-playing #footer-container,
body.xbc-playing .xbc-side,
body.xbc-playing .xbc-seo { display: none !important; }
/* style.css animates <main> with a transform, which would make it the fixed stage's box. */
body.xbc-playing .xbc-main { transform: none !important; animation: none !important; padding: 0; }
body.xbc-playing .xbc-game { position: fixed; z-index: 1000; inset: 0; width: 100vw; height: 100dvh; min-height: 0; display: grid; place-items: center; background: #1c0b04; }
body.xbc-playing .xbc-stage { width: min(100vw, calc(100dvh * .62)); height: 100dvh; border-radius: 0; box-shadow: none; }
@media (min-width: 760px) {
  body.xbc-playing .xbc-stage { height: min(100dvh, 900px); border-radius: 26px; }
}

/* ---------- shared buttons ---------- */
.xbc-round-btn { display: grid; place-items: center; width: 44px; height: 44px; padding: 0; border: 2px solid rgba(255, 213, 74, .55); border-radius: 50%; color: var(--xbc-gold); background: var(--xbc-panel); cursor: pointer; text-decoration: none; transition: transform .15s ease-out, background .15s; }
.xbc-round-btn:hover, .xbc-round-btn:focus-visible { transform: translateY(-1px); background: var(--xbc-panel-top); }
.xbc-round-btn svg { width: 20px; height: 20px; }

.xbc-play-btn, .xbc-red-btn { display: inline-flex; align-items: center; justify-content: center; gap: .5rem; width: 100%; min-height: 56px; padding: 0 1.25rem; border-radius: 999px; font: 900 1.25rem/1 Nunito, system-ui, sans-serif; cursor: pointer; transition: transform .12s ease-out, filter .12s; }
.xbc-play-btn { border: 2px solid var(--xbc-button-rim); color: var(--xbc-button-text); background: var(--xbc-button); box-shadow: 0 6px 0 #c98f00, 0 12px 24px rgba(0, 0, 0, .25); }
.xbc-red-btn { min-height: 52px; border: 2px solid var(--xbc-gold); color: #fff; background: var(--xbc-red); box-shadow: 0 5px 0 var(--xbc-red-dark), 0 10px 20px rgba(0, 0, 0, .22); font-size: 1.12rem; }
.xbc-play-btn:hover, .xbc-red-btn:hover { filter: brightness(1.05); }
.xbc-play-btn:active, .xbc-red-btn:active { transform: translateY(3px); }
.xbc-play-btn svg, .xbc-red-btn svg { width: 22px; height: 22px; }
.xbc-text-btn { display: inline-flex; align-items: center; justify-content: center; gap: .4rem; min-height: 40px; padding: .25rem .75rem; border: 0; color: rgba(255, 243, 196, .85); background: none; font: 800 .95rem Nunito, system-ui, sans-serif; cursor: pointer; }
.xbc-text-btn:hover { color: #fff; }
.xbc-text-btn svg { width: 18px; height: 18px; }
.xbc-play-btn:focus-visible, .xbc-red-btn:focus-visible, .xbc-text-btn:focus-visible, .xbc-small-btn:focus-visible, .xbc-store:focus-visible { outline: 3px solid #fff; outline-offset: 2px; }

/* ---------- start screen ---------- */
.xbc-start { position: absolute; inset: 0; z-index: 5; display: flex; flex-direction: column; padding: max(14px, env(safe-area-inset-top)) 16px max(16px, env(safe-area-inset-bottom)); pointer-events: none; }
.xbc-start > * { pointer-events: auto; }
.xbc-topbar { display: flex; align-items: center; gap: 10px; }
.xbc-topbar-space { flex: 1; }
.xbc-title-card { display: grid; justify-items: center; gap: .45rem; margin: clamp(10px, 4%, 38px) auto 0; width: min(100%, 340px); padding: 1.1rem 1.1rem 1rem; border: 1px solid rgba(255, 213, 74, .35); border-radius: 24px; color: #fff; background: var(--xbc-panel); box-shadow: 0 16px 40px rgba(0, 0, 0, .3); text-align: center; }
.xbc-title-icon { width: 84px; height: 84px; border-radius: 20px; box-shadow: 0 6px 16px rgba(0, 0, 0, .35); }
.xbc-title-card h1 { margin: 0; color: var(--xbc-gold); font: 800 clamp(1.6rem, 6.4vw, 2rem)/1.1 Gilroy, Nunito, sans-serif; letter-spacing: .01em; text-shadow: 0 2px 0 var(--xbc-red-dark); }
.xbc-record { width: 100%; padding: .65rem .75rem .7rem; border: 1px solid rgba(255, 213, 74, .55); border-radius: 18px; background: rgba(0, 0, 0, .22); }
.xbc-record-label { display: flex; align-items: center; justify-content: center; gap: .35rem; margin: 0; color: var(--xbc-gold); font-size: .78rem; font-weight: 900; letter-spacing: .12em; }
.xbc-record-label svg { width: 16px; height: 16px; }
.xbc-record-value { display: grid; justify-items: center; margin: .1rem 0 0; line-height: 1.05; }
.xbc-record-value strong { color: #fff; font: 800 2.6rem/1.05 Gilroy, Nunito, sans-serif; font-variant-numeric: tabular-nums; }
.xbc-record-value span { color: rgba(255, 243, 196, .72); font-size: .82rem; font-weight: 800; }
.xbc-start-actions { display: grid; gap: .85rem; width: min(100%, 360px); margin: auto auto 0; }
.xbc-start-row { display: flex; justify-content: center; gap: clamp(.75rem, 6vw, 1.75rem); }
.xbc-small-btn { display: grid; justify-items: center; gap: .3rem; min-width: 64px; padding: 0; border: 0; color: #fff; background: none; font: 800 .78rem Nunito, system-ui, sans-serif; text-decoration: none; text-shadow: 0 1px 3px rgba(0, 0, 0, .7); cursor: pointer; }
.xbc-small-icon { display: grid; place-items: center; width: 46px; height: 46px; border: 2px solid rgba(255, 213, 74, .6); border-radius: 50%; color: var(--xbc-gold); background: var(--xbc-panel); transition: transform .15s ease-out; }
.xbc-small-btn:hover .xbc-small-icon { transform: translateY(-2px); }
.xbc-small-icon svg { width: 21px; height: 21px; }
.xbc-small-btn > span:last-child { padding: 1px 8px; border-radius: 999px; background: rgba(42, 20, 8, .7); text-shadow: none; }

/* ---------- HUD ---------- */
.xbc-hud-wrap { position: absolute; z-index: 6; inset: 0 0 auto; padding: max(10px, env(safe-area-inset-top)) 12px 0; pointer-events: none; }
.xbc-hud { display: grid; grid-template-columns: 44px 1fr 1fr 1.25fr 44px; align-items: center; gap: 6px; padding: 6px; border: 1px solid rgba(255, 213, 74, .3); border-radius: 999px; background: var(--xbc-panel); box-shadow: 0 8px 20px rgba(0, 0, 0, .25); pointer-events: auto; }
.xbc-hud .xbc-round-btn { width: 40px; height: 40px; }
.xbc-hud-value { display: grid; justify-items: center; line-height: 1.05; min-width: 0; }
.xbc-hud-value small { color: rgba(255, 255, 255, .7); font-size: .66rem; font-weight: 800; }
.xbc-hud-value strong { max-width: 100%; overflow: hidden; color: #fff; font: 800 1.2rem/1.1 Gilroy, Nunito, sans-serif; font-variant-numeric: tabular-nums; text-overflow: ellipsis; white-space: nowrap; }
.xbc-hud-value strong.is-gold { color: var(--xbc-gold); }
.xbc-hud-value strong.is-cream { color: var(--xbc-cream); font-size: 1.02rem; }
.xbc-chips { display: flex; justify-content: center; gap: 6px; min-height: 26px; margin-top: 6px; }
.xbc-chip { padding: 3px 10px; border-radius: 999px; background: var(--xbc-panel); font-size: .78rem; font-weight: 900; }
.xbc-chip.is-combo { color: var(--xbc-combo); }
.xbc-chip.is-combo.is-hot { color: #2b1408; background: var(--xbc-combo); }
.xbc-chip.is-best { color: var(--xbc-gold); border: 1px solid rgba(255, 213, 74, .6); }
.xbc-chip.is-pop { animation: xbc-pop .5s ease-out; }
@keyframes xbc-pop { 0% { transform: scale(.6); } 60% { transform: scale(1.15); } 100% { transform: scale(1); } }
.xbc-tap-hint { position: absolute; z-index: 6; left: 50%; bottom: max(22px, env(safe-area-inset-bottom)); display: inline-flex; align-items: center; gap: .4rem; margin: 0; padding: .45rem 1rem; border-radius: 999px; color: #fff; background: rgba(42, 20, 8, .78); font-weight: 900; transform: translateX(-50%); pointer-events: none; animation: xbc-breathe 1.4s ease-in-out infinite; }
.xbc-tap-hint svg { width: 18px; height: 18px; color: var(--xbc-gold); }
@keyframes xbc-breathe { 0%, 100% { opacity: .75; transform: translateX(-50%) scale(1); } 50% { opacity: 1; transform: translateX(-50%) scale(1.06); } }

/* ---------- cards ---------- */
.xbc-scrim { position: absolute; z-index: 20; inset: 0; display: grid; place-items: center; padding: 16px; overflow-y: auto; background: rgba(0, 0, 0, .55); animation: xbc-fade .25s ease-out; }
@keyframes xbc-fade { from { opacity: 0; } }
.xbc-card { position: relative; display: grid; gap: .7rem; width: min(100%, 360px); margin: auto; padding: 1.25rem 1.1rem 1rem; border: 1px solid rgba(255, 213, 74, .4); border-radius: 26px; color: #fff; background: linear-gradient(180deg, var(--xbc-panel-top), var(--xbc-panel-solid) 55%); box-shadow: 0 24px 60px rgba(0, 0, 0, .45); text-align: center; animation: xbc-rise .3s ease-out; }
@keyframes xbc-rise { from { opacity: 0; transform: translateY(14px) scale(.97); } }
.xbc-card h2 { margin: 0; color: var(--xbc-gold); font: 800 1.55rem/1.15 Gilroy, Nunito, sans-serif; }
.xbc-card-small { gap: .8rem; padding-top: 1.4rem; }
.xbc-card-sub { margin: -.35rem 0 0; color: rgba(255, 243, 196, .8); font-size: .88rem; }
.xbc-close { position: absolute; top: 10px; right: 10px; display: grid; place-items: center; width: 36px; height: 36px; border: 0; border-radius: 50%; color: var(--xbc-gold); background: rgba(0, 0, 0, .25); cursor: pointer; }
.xbc-close svg { width: 18px; height: 18px; }

.xbc-result { gap: .55rem; }
.xbc-badge { justify-self: center; padding: 4px 14px; border-radius: 999px; color: var(--xbc-red-dark); background: var(--xbc-gold); font-size: .8rem; font-weight: 900; letter-spacing: .06em; animation: xbc-pop .6s ease-out; }
.xbc-result-line { margin: -.3rem 0 0; color: rgba(255, 243, 196, .8); font-size: .85rem; }
.xbc-result-score { color: var(--xbc-gold); font: 800 3rem/1 Gilroy, Nunito, sans-serif; font-variant-numeric: tabular-nums; }
.xbc-result-best { margin: -.2rem 0 .1rem; color: rgba(255, 255, 255, .7); font-size: .82rem; font-weight: 700; }
.xbc-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.xbc-stats div { display: grid; padding: .45rem .25rem; border-radius: 14px; background: rgba(0, 0, 0, .25); }
.xbc-stats strong { font: 800 1.35rem/1.1 Gilroy, Nunito, sans-serif; }
.xbc-stats small { color: rgba(255, 255, 255, .7); font-size: .72rem; font-weight: 700; }
.xbc-stats div:nth-child(2) strong { color: var(--xbc-cream); }
.xbc-stats div:nth-child(3) strong { color: var(--xbc-combo); }

.xbc-app-box { display: grid; gap: .45rem; padding: .7rem .75rem .75rem; border: 1px dashed rgba(255, 213, 74, .55); border-radius: 18px; background: rgba(0, 0, 0, .2); text-align: left; }
.xbc-app-box-title { display: flex; align-items: center; gap: .5rem; margin: 0; color: var(--xbc-gold); font-weight: 900; }
.xbc-app-box-title img { border-radius: 8px; }
.xbc-app-box ul { display: grid; gap: .2rem; margin: 0; padding: 0; list-style: none; font-size: .82rem; font-weight: 700; }
.xbc-app-box li { display: flex; align-items: center; gap: .45rem; }
.xbc-app-box li svg { flex: none; width: 16px; height: 16px; color: var(--xbc-gold); }

.xbc-store-row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.xbc-store { display: inline-flex; align-items: center; justify-content: center; gap: .5rem; min-height: 46px; padding: .35rem .6rem; border: 1px solid rgba(255, 255, 255, .25); border-radius: 14px; color: #fff; background: #111; font-weight: 900; font-size: .92rem; line-height: 1.05; text-align: left; text-decoration: none; transition: transform .15s ease-out; }
.xbc-store:hover { transform: translateY(-1px); }
.xbc-store small { display: block; color: rgba(255, 255, 255, .72); font-size: .64rem; font-weight: 700; }
.xbc-store img { flex: none; }
.xbc-store.is-secondary { opacity: .72; }
[data-platform='android'] .xbc-store-row, [data-platform='ios'] .xbc-store-row { grid-template-columns: 1.4fr 1fr; }
[data-platform='ios'] .xbc-store[data-xbc-store='ios'] { order: -1; }

.xbc-guide { display: grid; gap: .55rem; margin: 0; padding: 0; list-style: none; text-align: left; font-size: .92rem; font-weight: 700; line-height: 1.3; }
.xbc-guide li { display: flex; align-items: center; gap: .65rem; }
.xbc-guide-icon { display: grid; flex: none; place-items: center; width: 34px; height: 34px; border-radius: 50%; color: #fff; }
.xbc-guide-icon svg { width: 18px; height: 18px; }
.xbc-guide-icon.is-gold { background: #E0A800; }
.xbc-guide-icon.is-orange { background: #F08A24; }
.xbc-guide-icon.is-red { background: #D84343; }
.xbc-guide-icon.is-blue { background: #3E8ED0; }
.xbc-guide-icon.is-green { background: #3FA35B; }
.xbc-guide-icon.is-purple { background: #8B5CC7; }

.xbc-skins { width: min(100%, 400px); }
.xbc-skins-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 0; padding: 0; list-style: none; }
.xbc-skin { display: grid; justify-items: center; gap: .2rem; padding: .55rem .4rem .5rem; border: 1px solid rgba(255, 255, 255, .12); border-radius: 16px; background: rgba(0, 0, 0, .22); }
.xbc-skin > img { width: 100%; height: auto; max-height: 40px; object-fit: contain; filter: saturate(.85); }
.xbc-skin strong { font-size: .84rem; }
.xbc-skin span { display: inline-flex; align-items: center; gap: 3px; color: rgba(255, 243, 196, .7); font-size: .7rem; font-weight: 700; }
.xbc-skin.is-current { border-color: var(--xbc-gold); background: rgba(255, 213, 74, .12); }
.xbc-skin.is-current > img { filter: none; }
.xbc-skin.is-current span { color: var(--xbc-green); }

/* ---------- side column and SEO ---------- */
.xbc-side { display: grid; gap: .9rem; padding-top: .5rem; }
.xbc-eyebrow { margin: 0; color: var(--xbc-red); font-size: .8rem; font-weight: 900; letter-spacing: .1em; text-transform: uppercase; }
.xbc-side h2 { margin: 0; color: #5a1a08; font: 800 clamp(1.5rem, 3vw, 2rem)/1.15 Gilroy, Nunito, sans-serif; }
.xbc-lead { margin: 0; color: #5b3a26; font-size: 1rem; line-height: 1.6; }
.xbc-app-card { display: grid; grid-template-columns: 64px 1fr; gap: .9rem; padding: 1.1rem; border-radius: 22px; color: #fff; background: linear-gradient(160deg, #8E0000, #5a1206); box-shadow: 0 16px 36px rgba(142, 0, 0, .25); }
.xbc-app-card > img { border-radius: 16px; box-shadow: 0 6px 14px rgba(0, 0, 0, .3); }
.xbc-app-card h3 { margin: 0 0 .45rem; color: var(--xbc-gold); font-size: 1.1rem; }
.xbc-app-card ul { display: grid; gap: .35rem; margin: 0; padding: 0; list-style: none; font-size: .9rem; font-weight: 700; }
.xbc-app-card li { display: flex; align-items: flex-start; gap: .45rem; }
.xbc-app-card li svg { flex: none; width: 17px; height: 17px; margin-top: 1px; color: var(--xbc-gold); }
.xbc-app-card .xbc-store-row { grid-column: 1 / -1; }

.xbc-seo { max-width: 1100px; margin: 2.5rem auto 0; padding: 0 .5rem; }
.xbc-seo h2 { margin: 0 0 1rem; color: #5a1a08; font: 800 1.5rem/1.2 Gilroy, Nunito, sans-serif; }
.xbc-seo-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1rem; }
.xbc-seo article { padding: 1.1rem 1.2rem; border: 1px solid rgba(142, 0, 0, .12); border-radius: 18px; background: #fff; }
.xbc-seo h3 { margin: 0 0 .5rem; color: var(--xbc-red); font-size: 1.05rem; }
.xbc-seo p { margin: 0; color: #4d3526; line-height: 1.6; }
.xbc-note { margin-top: 1rem !important; color: #7a5a44 !important; font-size: .9rem; }

@media (max-width: 899px) {
  .xbc-layout { grid-template-columns: minmax(0, 1fr); justify-items: center; }
  .xbc-side { max-width: 520px; }
  .xbc-seo-grid { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 560px) {
  .xbc-main { padding: .5rem .5rem 2rem; }
  .xbc-game { --xbc-h: max(560px, calc(100svh - 84px)); width: 100%; }
  .xbc-stage { border-radius: 22px; }
}
@media (max-height: 640px) {
  .xbc-title-icon { width: 60px; height: 60px; }
  .xbc-record-value strong { font-size: 2rem; }
}
@media (prefers-reduced-motion: reduce) {
  .xbc-tap-hint, .xbc-chip.is-pop, .xbc-badge, .xbc-card, .xbc-scrim { animation: none; }
}
.xbc-coin, .xbc-skin .xbc-coin { flex: none; width: 14px; height: 14px; vertical-align: -2px; }
