/*
 * Desktop layout is built on the 1440px Figma frame (assets are exported @3x).
 * 1rem = 10 design px at 1440px wide, so the whole page scales with the viewport.
 */

/* Lato 2.015 Black (team font pack "Lato Black.ttf", OFL) subset to Latin + Vietnamese.
   Google Fonts' Lato lacks Vietnamese glyphs (ả, ộ, ồ, ẩ...). Used only by gift item names. */
@font-face {
  font-family: "Lato Vi";
  font-weight: 900;
  font-style: normal;
  font-display: swap;
  src: url("../fonts/lato-black-vi.woff2") format("woff2");
}

html {
  font-size: calc(100vw / 144);
  scroll-behavior: smooth;
}

*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  background: #f2f2f2;
  overflow-x: hidden;
}

img {
  display: block;
  max-width: none;
}

/* <picture> only swaps sources; let its <img> lay out as if unwrapped */
picture {
  display: contents;
}

a {
  color: inherit;
  text-decoration: none;
}

button {
  border: 0;
  background: none;
  cursor: pointer;
}

/* Shared hover glow for image buttons */
.hero-btn img,
.sticky-btn img,
.mb-nav-btn img,
.mb-nav-socials img,
.gift-btn img,
.feature-arrow img {
  transition: filter 0.2s, transform 0.2s;
}

.hero-btn:hover img,
.sticky-btn:hover img,
.mb-nav-btn:hover img,
.mb-nav-socials a:hover img,
.gift-btn:hover img,
.feature-arrow:hover img {
  filter: brightness(1.2) drop-shadow(0 0 0.6rem rgba(255, 190, 90, 0.6));
}

/* Mobile-only menu bar (styled in the mobile media query) */
.mb-nav,
.mb-nav-backdrop {
  display: none;
}

/* ---------- Hero banner + menu ---------- */
.hero {
  position: relative;
  height: 72.8rem;
  background: url("../assets/banner-bg.webp") center top / 100% auto no-repeat;
}

.logo {
  position: absolute;
  top: 2.6rem;
  left: 1.4rem;
  display: flex;
  align-items: center;
  gap: 1rem;
}

.logo-text {
  width: 1.2rem;
}

.logo-icon {
  position: relative;
  width: 10rem;
}

.logo-icon img {
  width: 100%;
  border-radius: 1.6rem;
}

/* Glow gif has wide black padding; scale it up so the light brackets wrap the icon */
.logo-glow {
  position: absolute;
  top: 45%;
  left: 45%;
  width: 160% !important;
  height: 170%;
  transform: translate(-50%, -50%);
  pointer-events: none;
  mix-blend-mode: screen;
}

.menu {
  position: absolute;
  top: 1.3rem;
  left: 105.8rem;
  display: flex;
}

.menu-btn {
  position: relative;
  width: 19.1rem;
}

.menu-btn + .menu-btn {
  margin-left: -3rem;
}

.menu-btn img {
  width: 100%;
}

/* Hover swaps to the lit version of the brush button */
.menu-btn-hover {
  position: absolute;
  inset: 0;
  opacity: 0;
  transition: opacity 0.25s;
}

.menu-btn:hover .menu-btn-hover {
  opacity: 1;
}

.hero-title {
  position: absolute;
  top: 38.2rem;
  left: 50%;
  width: 60rem;
  transform: translateX(-50%);
}

/* Action bar: children are positioned in --u units (bar width = 393u, from the mockup) */
.hero-actions {
  --u: calc(56rem / 393);
  position: absolute;
  top: 50.5rem;
  left: 50%;
  width: 56rem;
  height: calc(56rem * 552 / 1740);
  transform: translateX(-50%);
  background: url("../assets/banner-action-bar.webp") center / 100% 100% no-repeat;
  z-index: 2;
}

.hero-btn {
  position: absolute;
}

.hero-btn img {
  width: 100%;
}

.hero-btn--dang-ky,
.hero-btn--gia-lap {
  top: calc(-31 * var(--u));
  width: calc(179 * var(--u));
}

.hero-btn--dang-ky {
  left: calc(-26 * var(--u));
}

.hero-btn--gia-lap {
  left: calc(245 * var(--u));
}

.hero-btn--app-store,
.hero-btn--ch-play {
  left: calc(109 * var(--u));
  width: calc(180 * var(--u));
}

.hero-btn--app-store {
  top: calc(14 * var(--u));
}

.hero-btn--ch-play {
  top: calc(58 * var(--u));
}

/* ---------- Sticky bar (PC) ---------- */
/* Children positioned in --u units of the 489x834 bar artwork */
.sticky-bar {
  --u: calc(19rem / 489);
  position: fixed;
  top: 13rem;
  right: 4rem;
  z-index: 100;
  width: 19rem;
  height: calc(834 * var(--u));
  background: url("../assets/sticky-bg.webp") center / 100% 100% no-repeat;
}

.sticky-btn {
  position: absolute;
  display: block;
}

.sticky-btn img {
  width: 100%;
}

/* Dark banner body spans x 99..431 (center 265) of the 489px artwork */
.sticky-btn--nap-the {
  top: calc(10 * var(--u) - 2rem);
  left: calc(75 * var(--u));
  width: calc(380 * var(--u));
}

/* Download buttons stacked with a fixed 5px (design) gap */
.sticky-downloads {
  position: absolute;
  top: calc(248 * var(--u) - 1rem);
  left: calc(123 * var(--u));
  width: calc(284 * var(--u));
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.sticky-downloads .sticky-btn {
  position: static;
}

.sticky-socials {
  position: absolute;
  top: calc(590 * var(--u) - 1rem);
  left: calc(137 * var(--u));
  display: flex;
  gap: calc(10 * var(--u));
}

.sticky-socials .sticky-btn {
  position: static;
  width: calc(78 * var(--u));
}

.sticky-btn--top {
  top: calc(658 * var(--u) - 1rem);
  left: calc(213 * var(--u));
  width: calc(104 * var(--u));
}

/* ---------- Main content background (gift + feature) ---------- */
.gift {
  position: relative;
  margin-top: -23rem;
  height: 70.1rem;
  background: url("../assets/gift-section-bg.webp") center top / 100% auto no-repeat;
}

.section-title {
  position: absolute;
  left: 50%;
  width: 65.5rem;
  transform: translateX(-50%);
  z-index: 1;
  pointer-events: none;
}

.gift-title {
  top: 19.3rem;
}

/* ---------- Register gifts ---------- */
/* Scroll artwork is 967x423 design px */
.gift-scroll {
  position: absolute;
  top: 27.8rem;
  left: calc(50% - 48.35rem + 3rem);
  width: 96.7rem;
  height: 42.3rem;
  background: url("../assets/gift-scroll-bg.webp") center / 100% 100% no-repeat;
}

.gift-list {
  position: absolute;
  top: 6.5rem;
  left: 4.6rem;
  display: flex;
  list-style: none;
}

.gift-item {
  width: 20rem;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.gift-item-icon {
  width: 19rem;
  height: 19.8rem;
  display: flex;
  align-items: center;
  justify-content: center;
  background: url("../assets/gift-item-bg.webp") center / contain no-repeat;
}

/* Icon artwork has the same canvas as the frame, so it fills it */
.gift-item-icon img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.gift-item-name {
  width: 20rem;
  height: 6.5rem;
  margin-top: -3.6rem;
  display: flex;
  align-items: center;
  justify-content: center;
  background: url("../assets/gift-item-name-bg.webp") center / 100% 100% no-repeat;
  font-family: "Lato Vi", "Lato", sans-serif;
  font-weight: 900;
  font-size: 1.6rem;
  line-height: 1;
  color: #fff;
  white-space: nowrap;
}

.gift-btn {
  position: absolute;
  top: 30.6rem;
  left: 34rem;
  width: 21.6rem;
}

.gift-btn img {
  width: 100%;
}

/* ---------- Featured slider ---------- */
.feature {
  position: relative;
  height: 66rem;
  /* gift background continues behind the feature title */
  background: url("../assets/gift-section-bg.webp") center -70.1rem / 100% auto no-repeat;
}

/* Dragon landscape fades in under the slider */
.feature::before {
  content: "";
  position: absolute;
  inset: auto 0 0;
  height: 52.8rem;
  background: url("../assets/feature-section-bg.webp") center bottom / 100% auto no-repeat;
  -webkit-mask-image: linear-gradient(transparent, #000 20%);
  mask-image: linear-gradient(transparent, #000 20%);
}

.feature-title {
  top: 0.5rem;
}

.feature-band {
  position: absolute;
  top: 10rem;
  left: 0;
  width: 100%;
  height: 44.8rem;
}

.feature-slider-clip {
  height: 100%;
  overflow: hidden;
}

/* Slides are stacked; JS marks prev/active/next so the loop always has both side panels */
.feature-slider {
  position: relative;
  height: 100%;
}

.feature-slide {
  position: absolute;
  top: 0;
  left: calc(50% - 42rem);
  width: 84rem;
  height: 44.8rem;
  opacity: 0;
  transform: scaleY(0.815);
  filter: brightness(0.35) grayscale(0.4);
  transition: transform 0.9s ease-in-out, filter 0.9s, opacity 0.9s;
}

.feature-slide.is-prev {
  opacity: 1;
  transform: translateX(-76rem) scaleY(0.815);
}

.feature-slide.is-next {
  opacity: 1;
  transform: translateX(76rem) scaleY(0.815);
}

.feature-slide.is-active {
  z-index: 1;
  opacity: 1;
  transform: none;
  filter: none;
}

.feature-arrow {
  position: absolute;
  top: 50%;
  z-index: 2;
  width: 20.1rem;
  transform: translate(-50%, -50%);
}

.feature-arrow img {
  width: 100%;
}

.feature-arrow--prev {
  left: calc(50% - 49.3rem);
}

.feature-arrow--next {
  left: calc(50% + 48.6rem);
}

.feature-dots {
  position: absolute;
  top: 45.2rem;
  left: 50%;
  display: flex;
  align-items: center;
  gap: 0.6rem;
  transform: translateX(-50%);
}

.feature-dot {
  width: 3.3rem;
  height: 2.9rem;
  background: url("../assets/feature-dot.webp") center / contain no-repeat;
  transition: transform 0.2s;
}

.feature-dot:hover {
  transform: scale(1.1);
}

.feature-dot.is-active {
  width: 6.1rem;
  height: 5.5rem;
  background-image: url("../assets/feature-dot-active.webp");
}

/* ---------- Footer ---------- */
.footer {
  height: 13.6rem;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 2.2rem;
  background: url("../assets/footer-bg.webp") center / cover no-repeat;
  color: #fff;
  font-family: "Be Vietnam Pro", sans-serif;
  font-weight: 500;
  font-size: 1.2rem;
  line-height: 2.3rem;
}

.footer-icon {
  width: 8.6rem;
  border-radius: 1.4rem;
}

.footer-name {
  font-weight: 700;
  font-size: 1.5rem;
  line-height: 2.3rem;
  text-transform: uppercase;
}

.footer a:hover {
  text-decoration: underline;
}

/* inline-block keeps the separator out of the link underline */
.footer-links a:not(:last-child)::after {
  content: "|";
  display: inline-block;
  margin-left: 0.4rem;
}

/* ---------- Register / login popups ---------- */
/* Popup artwork is 2952x1854 (@3x) → 98.4 x 61.8 design rem */
.popup {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.75);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.25s, visibility 0.25s;
}

.popup.is-open {
  opacity: 1;
  visibility: visible;
}

.popup-dialog {
  position: relative;
  width: 98.4rem;
  height: 61.8rem;
  background: center / 100% 100% no-repeat;
}

.popup-dialog--register {
  background-image: url("../assets/popup-register-bg.webp");
}

.popup-dialog--login {
  background-image: url("../assets/popup-login-bg.webp");
}

.popup-dialog--success {
  background-image: url("../assets/popup-success-bg.webp");
}

.popup-close {
  position: absolute;
  top: 3.5rem;
  left: 91.1rem;
  width: 7.3rem;
}

.popup-dialog--success .popup-close {
  top: 4.4rem;
}

.popup-close img,
.popup-submit img,
.popup-download img,
.popup-socials img {
  width: 100%;
  transition: filter 0.2s;
}

.popup-close:hover img,
.popup-submit:hover img,
.popup-download:hover img,
.popup-socials a:hover img {
  filter: brightness(1.15) drop-shadow(0 0 0.6rem rgba(255, 190, 90, 0.6));
}

/* Form area sits inside the dark panel, left of the vertical tag */
.popup-form {
  position: absolute;
  top: 12.2rem;
  left: 9.9rem;
  width: 73.4rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  font-family: "Lato", sans-serif;
  color: #fff;
}

.popup-field {
  width: 100%;
  display: flex;
  align-items: center;
  margin-bottom: 0.7rem;
}

.popup-field span {
  flex: 0 0 19.4rem;
  font-weight: 700;
  font-size: 2.4rem;
  line-height: 4.6rem;
  white-space: nowrap;
}

.popup-field input {
  flex: 1;
  height: 4.6rem;
  padding: 0 1.4rem;
  border: 0;
  border-radius: 0.6rem;
  background: #fff;
  font-family: "Inter", sans-serif;
  font-size: 1.6rem;
  color: #222;
  outline: none;
}

.popup-field input::placeholder {
  color: #8c8c8c;
}

.popup-field input:focus {
  box-shadow: 0 0 0 0.2rem #ffd987;
}

/* Highlight empty required fields after a submit attempt */
.popup-form.is-validated input:invalid {
  box-shadow: 0 0 0 0.2rem #e5342b;
}

.popup-submit {
  width: 24.8rem;
  margin-top: 1.4rem;
}

.popup-form[data-api="login"] .popup-submit {
  margin-top: 2.7rem;
}

.popup-socials {
  display: flex;
  gap: 0.6rem;
  margin-top: 1.6rem;
}

.popup-socials a {
  width: 19rem;
}

.popup-switch {
  margin-top: 1.9rem;
  font-weight: 700;
  font-size: 2.4rem;
  text-align: center;
}

/* Button column is centered on the dark panel (center 46.4rem), not on the form */
.popup-form[data-api] .popup-submit,
.popup-form[data-api] .popup-socials,
.popup-form[data-api] .popup-switch {
  position: relative;
  left: -0.2rem;
}

/* Status text follows the same column as the switch line above it */
.popup-form[data-api] .popup-message {
  left: -0.2rem;
  right: 0.2rem;
}

.popup-switch a {
  color: #ffd987;
}

.popup-switch a:hover {
  text-decoration: underline;
}

/* Status text is absolutely placed so it never pushes the layout */
.popup-message {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  margin-top: 0.4rem;
  font-size: 1.6rem;
  color: #ffd987;
  text-align: center;
}

/* ---------- Registration success popup ---------- */
.popup-success {
  top: 11.8rem;
  left: 10.4rem;
  width: 74rem;
}

/* Two-line heading: white line + gold line, Lato 700 36px / 52px */
.popup-success-title {
  font-weight: 700;
  font-size: 3.6rem;
  line-height: 5.2rem;
  text-align: center;
  white-space: nowrap;
}

.popup-success-title span {
  display: block;
  color: #ffd987;
}

/* Mockup title sits 1.2rem left of the code / button column */
.popup-success-title {
  position: relative;
  left: -1.2rem;
}

/* Gift code from the API, on a white fade bar (artwork 1506x168 @3x) */
.popup-code {
  width: 50.2rem;
  height: 5.6rem;
  margin-top: 1.3rem;
  display: flex;
  align-items: center;
  justify-content: center;
  background: url("../assets/popup-code-bg.webp") center / 100% 100% no-repeat;
  font-family: "Inter", sans-serif;
  font-weight: 400;
  font-size: 3.6rem;
  color: #000;
  user-select: all;
}

.popup-code[hidden] {
  display: none;
}

.popup-download {
  width: 23.5rem;
  margin-top: 1.7rem;
}

.popup-success .popup-socials {
  margin-top: 1.7rem;
}

.popup-success .popup-switch {
  margin-top: 3rem;
}

/* Lock page scroll while a popup is open */
body.is-popup-open {
  overflow: hidden;
}

/* ==========================================================================
 * Mobile (<= 767px): 375px Figma frame, 1rem = 10 design px at 375px wide.
 * Image swaps for <img> are done with <picture> in index.html; background
 * images are swapped here.
 * ========================================================================== */
@media (max-width: 767px) {
  html {
    font-size: calc(100vw / 37.5);
  }

  .menu,
  .sticky-bar,
  .logo-text,
  .logo-glow {
    display: none;
  }

  /* ---------- Menu bar + banner ---------- */
  .hero {
    height: 60.5rem;
    background: url("../assets/mb-banner-bg.webp") center 4.7rem / 100% auto no-repeat;
  }

  /* Logo sits above the menu bar and the backdrop */
  .logo {
    top: 1.2rem;
    left: 3.1rem;
    z-index: 12;
  }

  .mb-nav {
    display: block;
    position: absolute;
    top: 0;
    left: 0;
    z-index: 11;
    width: 100%;
    height: 4.7rem;
    background: url("../assets/mb-menu-bg.webp") center / 100% 100% no-repeat;
  }

  .mb-nav-btn,
  .mb-nav-toggle {
    position: absolute;
  }

  .mb-nav-btn {
    top: 1.6rem;
    width: 10.3rem;
  }

  .mb-nav-btn img,
  .mb-nav-toggle img {
    width: 100%;
  }

  .mb-nav-btn--home {
    left: 11.1rem;
  }

  .mb-nav-btn--dang-ky {
    left: 21.5rem;
  }

  .mb-nav-toggle {
    top: 1.5rem;
    left: 32.7rem;
    width: 3.6rem;
  }

  /* Feature panel drops down under the bar, right-aligned */
  .mb-nav-panel {
    position: absolute;
    top: 100%;
    right: 0;
    width: 27.1rem;
    height: 14.4rem;
    padding-top: 0.8rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    background: url("../assets/mb-menu-panel-bg.webp") center / cover no-repeat;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-1rem);
    transition: opacity 0.25s, transform 0.25s, visibility 0.25s;
  }

  /* Full panel width so every label centers; divider keeps its own width */
  .mb-nav-link {
    width: 100%;
    padding: 0.8rem 0;
    font-family: "Lato", sans-serif;
    font-weight: 900;
    font-size: 1.1rem;
    line-height: 1;
    text-align: center;
    text-transform: uppercase;
    white-space: nowrap;
    color: #fff;
  }

  /* Divider between the three text links */
  .mb-nav-link:not(:nth-child(3)) {
    background: url("../assets/mb-menu-divider.webp") center bottom / 16rem 0.1rem no-repeat;
  }

  .mb-nav-socials {
    margin-top: -0.2rem;
    display: flex;
    gap: 0.4rem;
  }

  .mb-nav-socials img {
    width: 4rem;
  }

  .mb-nav-backdrop {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 10;
    background: rgba(0, 0, 0, 0.6);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.25s, visibility 0.25s;
  }

  .is-menu-open .mb-nav-panel,
  .is-menu-open .mb-nav-backdrop {
    opacity: 1;
    visibility: visible;
    transform: none;
  }

  .logo-icon {
    width: 6.5rem;
  }

  .logo-icon img {
    border-radius: 1.2rem;
  }

  .hero-title {
    top: 32.8rem;
    width: 33.8rem;
  }

  .hero-actions {
    top: 39.4rem;
    width: 37.1rem;
    height: 12rem;
    background-image: url("../assets/mb-banner-action-bar.webp");
  }

  .hero-btn--dang-ky,
  .hero-btn--gia-lap {
    top: -0.9rem;
  }

  .hero-btn--dang-ky {
    left: 1rem;
    width: 11.7rem;
  }

  .hero-btn--gia-lap {
    left: 24.9rem;
    width: 11rem;
  }

  .hero-btn--app-store,
  .hero-btn--ch-play {
    left: 10.7rem;
    width: 16.5rem;
  }

  .hero-btn--app-store {
    top: 2.1rem;
  }

  .hero-btn--ch-play {
    top: 6.1rem;
  }

  /* ---------- Register gifts ---------- */
  .gift {
    margin-top: -17.3rem;
    height: 59.7rem;
    background-image: url("../assets/mb-gift-section-bg.webp");
  }

  .section-title {
    width: 36.9rem;
  }

  .gift-title {
    top: 12.2rem;
  }

  .gift-scroll {
    top: 19rem;
    left: 0;
    width: 37.5rem;
    height: 40.2rem;
    background-image: url("../assets/mb-gift-scroll-bg.webp");
  }

  /* 2x2 grid; icon artwork (14.7rem) is wider than the column, so it overlaps on purpose */
  .gift-list {
    top: 1.5rem;
    left: 6.2rem;
    display: grid;
    grid-template-columns: repeat(2, 12.8rem);
    row-gap: 0.5rem;
  }

  .gift-item {
    width: 14.7rem;
  }

  .gift-item-icon {
    width: 14.7rem;
    height: 15.4rem;
    background-image: url("../assets/mb-gift-item-bg.webp");
  }

  .gift-item-name {
    width: 14rem;
    height: 4.5rem;
    margin-top: -5.7rem;
    background-image: url("../assets/mb-gift-item-name-bg.webp");
    font-size: 1.3rem;
  }

  .gift-btn {
    top: 31.2rem;
    left: calc(50% - 8.45rem);
    width: 16.9rem;
  }

  /* ---------- Featured slider: one slide, fade between slides ---------- */
  .feature {
    height: 30rem;
    background: url("../assets/mb-gift-section-bg.webp") center -59.7rem / 100% auto no-repeat;
  }

  .feature::before {
    display: none;
  }

  .feature-band {
    top: 6.6rem;
    height: 19.4rem;
  }

  .feature-slide {
    left: calc(50% - 17.45rem);
    width: 34.9rem;
    height: 19.4rem;
    transform: none;
    filter: none;
    transition: opacity 0.6s;
  }

  .feature-slide.is-prev,
  .feature-slide.is-next {
    opacity: 0;
    transform: none;
  }

  .feature-arrow {
    width: 7.6rem;
  }

  .feature-arrow--prev {
    left: 3.2rem;
  }

  .feature-arrow--next {
    left: 34.4rem;
  }

  .feature-dots {
    top: 20.8rem;
    gap: 0.5rem;
    transform: translate(-50%, -50%);
  }

  .feature-dot {
    width: 2rem;
    height: 1.8rem;
    background-image: url("../assets/mb-feature-dot.webp");
  }

  .feature-dot.is-active {
    width: 3.7rem;
    height: 3.3rem;
    background-image: url("../assets/mb-feature-dot-active.webp");
  }

  /* ---------- Footer ---------- */
  .footer {
    height: 17.7rem;
    justify-content: flex-start;
    gap: 1.3rem;
    padding-left: 6.5rem;
    background-image: url("../assets/mb-footer-bg.webp");
    font-size: 1rem;
    line-height: 1.6rem;
  }

  .footer-icon {
    width: 9.3rem;
    border-radius: 1.6rem;
  }

  .footer-info {
    max-width: 17rem;
  }

  .footer-name {
    margin-bottom: 0.2rem;
    white-space: nowrap;
  }

  .footer-links a {
    display: block;
  }

  /* Mobile mockup shows a separator after every link */
  .footer-links a:last-child::after {
    content: "|";
    display: inline-block;
    margin-left: 0.4rem;
  }
  /* ---------- Popups (mobile artwork 1098x1218 @3x → 36.6 x 40.6 rem) ---------- */
  .popup-dialog {
    width: 36.6rem;
    height: 40.6rem;
  }

  .popup-dialog--register {
    background-image: url("../assets/mb-popup-register-bg.webp");
  }

  .popup-dialog--login {
    background-image: url("../assets/mb-popup-login-bg.webp");
  }

  .popup-close,
  .popup-dialog--success .popup-close {
    top: 1.6rem;
    left: 31.8rem;
    width: 4.5rem;
  }

  .popup-form {
    top: 8.6rem;
    left: 7.1rem;
    width: 25.7rem;
  }

  .popup-field {
    margin-bottom: 0;
  }

  /* Fixed label column like the mockup: the input sits on top of an over-long label */
  .popup-field span {
    flex: 0 0 9.2rem;
    width: 9.2rem;
    font-size: 1.4rem;
    line-height: 3.7rem;
  }

  .popup-field input {
    position: relative;
    min-width: 0;
  }

  .popup-field input {
    height: 2.1rem;
    padding: 0 1rem;
    border-radius: 0.5rem;
    font-size: 1rem;
  }

  .popup-submit {
    width: 15rem;
    margin-top: 1rem;
  }

  .popup-form[data-api="login"] .popup-submit {
    margin-top: 2.1rem;
  }

  .popup-socials {
    gap: 0.3rem;
    margin-top: 1.2rem;
  }

  .popup-form[data-api] .popup-submit,
  .popup-form[data-api] .popup-socials,
  .popup-form[data-api] .popup-switch {
    left: -0.45rem;
  }

  .popup-form[data-api] .popup-message {
    left: -0.45rem;
    right: 0.45rem;
  }

  .popup-socials a {
    width: 11.4rem;
  }

  .popup-switch {
    margin-top: 0.7rem;
    font-size: 1.3rem;
    line-height: normal;
  }

  /* Mobile mockup puts the link on its own line, ending with "!" */
  .popup-switch a {
    display: block;
  }

  .popup-switch a::after {
    content: "!";
  }

  /* No room under the switch line on mobile: show the status text in its place */
  .popup-form:has(.popup-message:not(:empty)) .popup-switch {
    visibility: hidden;
  }

  .popup-message {
    top: auto;
    bottom: 0;
    margin-top: 0;
    font-size: 1.1rem;
    line-height: 3.2rem;
  }
  /* ---------- Registration success popup (mobile) ---------- */
  .popup-dialog--success {
    background-image: url("../assets/mb-popup-success-bg.webp");
  }

  .popup-success {
    top: 7.5rem;
    left: 6rem;
    width: 27.6rem;
  }

  /* Lato 700 16px / 24px; narrower box wraps each line in two like the mockup */
  .popup-success-title {
    left: 0;
    width: 18.7rem;
    font-size: 1.6rem;
    line-height: 2.4rem;
    white-space: normal;
  }

  .popup-code {
    width: 25.3rem;
    height: 3.3rem;
    margin-top: 0.7rem;
    background-image: url("../assets/mb-popup-code-bg.webp");
    font-size: 2rem;
  }

  .popup-download {
    width: 15.7rem;
    margin-top: 1.5rem;
  }

  .popup-code[hidden] + .popup-download {
    margin-top: 0.7rem;
  }

  .popup-success .popup-socials {
    margin-top: 1.9rem;
  }

  .popup-success .popup-switch {
    margin-top: 1.8rem;
  }

  /* Newbie-code variant (Figma 156:1847): content starts higher, title wraps wider */
  .popup-success:has(.popup-code:not([hidden])) {
    top: 6rem;
  }

  .popup-success:has(.popup-code:not([hidden])) .popup-success-title {
    left: -1.05rem;
    width: 20.9rem;
  }

  /* Gold line keeps the narrower 18.7rem wrap ("...Chiến / Game Chưa?") */
  .popup-success:has(.popup-code:not([hidden])) .popup-success-title span {
    max-width: 18.7rem;
    margin: 0 auto;
  }

  .popup-success:has(.popup-code:not([hidden])) .popup-socials {
    margin-top: 1.3rem;
  }
}

/* Ảnh pixel trong <noscript>: thay cho style="display:none" gốc (CSP chặn style nội tuyến). */
.pixel-noscript {
  display: none;
}

/* ---------- Dải trạng thái đăng nhập ----------
 * Không có trong thiết kế gốc: thêm vì HTML gốc không có chỗ nào hiện tên hay nút Đăng xuất.
 * Chỉ hiện khi đã đăng nhập. Nằm trên sticky bar (z-index 100), dưới popup (200). */
.session-strip {
  position: fixed;
  top: 0;
  right: 0;
  z-index: 150;
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.6rem 1.4rem;
  font-size: 1.4rem;
  color: #fff;
  background: rgba(0, 0, 0, 0.7);
  border-bottom-left-radius: 0.8rem;
}

.session-strip[hidden] {
  display: none;
}

.session-strip-logout {
  padding: 0.2rem 1rem;
  font: inherit;
  color: #ffd987;
  background: transparent;
  border: 1px solid #ffd987;
  border-radius: 0.4rem;
  cursor: pointer;
}

.session-strip-logout:disabled {
  opacity: 0.5;
  cursor: default;
}

@media (max-width: 767px) {
  .session-strip {
    font-size: 3.4vw;
    gap: 2vw;
    padding: 1.2vw 3vw;
    border-bottom-left-radius: 2vw;
  }
}
