/* ==========================================================================
   Biến thiết kế — đổi màu thương hiệu tại đây
   ========================================================================== */
:root {
  --c-primary: #4338ca;
  --c-primary-hover: #3730a3;
  --c-primary-soft: #eef2ff;
  --c-accent: #0d9488;
  --c-game: #b45309;
  --c-game-soft: #fef3c7;

  --c-bg: #ffffff;
  --c-bg-alt: #f6f7fb;
  --c-surface: #ffffff;
  --c-text: #0f172a;
  --c-muted: #475569;
  --c-border: #e2e8f0;

  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --radius: 16px;
  --radius-sm: 10px;
  --shadow-sm: 0 1px 2px rgb(15 23 42 / 0.06), 0 1px 3px rgb(15 23 42 / 0.08);
  --shadow-lg: 0 12px 32px -8px rgb(15 23 42 / 0.18);
  --header-h: 68px;
  --gutter: clamp(16px, 4vw, 32px);
}

/* ==========================================================================
   Nền tảng
   ========================================================================== */
*,
*::before,
*::after { box-sizing: border-box; }

html { scroll-behavior: smooth; scroll-padding-top: calc(var(--header-h) + 12px); }

body {
  margin: 0;
  font-family: var(--font);
  font-size: 1rem;
  line-height: 1.65;
  color: var(--c-text);
  background: var(--c-bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

img { max-width: 100%; height: auto; display: block; }

h1, h2, h3 { line-height: 1.2; margin: 0 0 0.5em; letter-spacing: -0.02em; }
h1 { font-size: clamp(2rem, 1.3rem + 3vw, 3.25rem); font-weight: 800; }
h2 { font-size: clamp(1.5rem, 1.2rem + 1.2vw, 2rem); font-weight: 750; }
h3 { font-size: 1.25rem; font-weight: 700; }
p { margin: 0 0 1em; }

a { color: var(--c-primary); text-underline-offset: 3px; }

:focus-visible {
  outline: 3px solid var(--c-primary);
  outline-offset: 3px;
  border-radius: 6px;
}

.container { width: 100%; max-width: 1160px; margin-inline: auto; padding-inline: var(--gutter); }
.muted { color: var(--c-muted); }
.small { font-size: 0.875rem; }
.lead { font-size: clamp(1.05rem, 1rem + 0.3vw, 1.2rem); color: var(--c-muted); max-width: 60ch; }

.visually-hidden {
  position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

.skip-link {
  position: absolute; left: 12px; top: -60px; z-index: 100;
  padding: 10px 16px; border-radius: var(--radius-sm);
  background: var(--c-text); color: #fff; font-weight: 600; text-decoration: none;
  transition: top 0.2s;
}
.skip-link:focus { top: 12px; }

/* ==========================================================================
   Nút
   ========================================================================== */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 10px 20px;
  border: 2px solid transparent; border-radius: 999px;
  font: inherit; font-weight: 650; text-decoration: none; cursor: pointer;
  transition: transform 0.15s ease, background-color 0.15s ease, box-shadow 0.15s ease, color 0.15s ease;
}
.btn:active { transform: scale(0.97); }
.btn--sm { min-height: 40px; padding: 6px 16px; font-size: 0.95rem; }
.btn--lg { min-height: 52px; padding: 12px 28px; font-size: 1.05rem; }
.btn--primary { background: var(--c-primary); color: #fff; box-shadow: 0 6px 16px -6px rgb(67 56 202 / 0.6); }
.btn--primary:hover { background: var(--c-primary-hover); transform: translateY(-1px); }
.btn--ghost { background: transparent; color: var(--c-primary); border-color: #c7d2fe; }
.btn--ghost:hover { background: var(--c-primary-soft); border-color: var(--c-primary); }

/* Nút tải từ cửa hàng */
.store-btns { display: flex; flex-wrap: nowrap; gap: 8px; margin: 4px 0 16px; }
.store-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  flex: 0 1 auto; min-width: 0; white-space: nowrap;
  min-height: 48px; padding: 6px 14px 6px 10px;
  background: #0b0b0f; color: #fff; text-decoration: none;
  border-radius: 12px; border: 1px solid #0b0b0f;
  transition: transform 0.15s ease, box-shadow 0.15s ease, background-color 0.15s ease;
}
.store-btn:hover { background: #24242c; transform: translateY(-2px); box-shadow: var(--shadow-lg); }
.store-btn:active { transform: translateY(0) scale(0.97); }
.store-btn__icon { width: 24px; height: 24px; flex: none; }
.store-btn__text { display: flex; flex-direction: column; line-height: 1.1; font-weight: 650; font-size: 1rem; }
.store-btn__text small { font-size: 0.68rem; font-weight: 500; letter-spacing: 0.02em; opacity: 0.85; }
.store-btn--lg { min-height: 56px; padding-inline: 14px 22px; }
.store-btn--lg .store-btn__icon { width: 28px; height: 28px; }
.store-btn--lg .store-btn__text { font-size: 1.15rem; }
/* Nền tảng chưa phát hành */
.store-btn--soon,
.store-btn--soon:hover {
  background: #e2e8f0; color: #475569; border-color: #e2e8f0;
  cursor: not-allowed; transform: none; box-shadow: none;
}
.store-btn--soon .store-btn__icon { filter: grayscale(1); opacity: 0.6; }
/* Nút mở sản phẩm web */
.store-btn--web { background: var(--c-primary); border-color: var(--c-primary); }
.store-btn--web:hover { background: var(--c-primary-hover); }
.store-btn--web.store-btn--soon,
.store-btn--web.store-btn--soon:hover { background: #e2e8f0; color: #475569; border-color: #e2e8f0; }
/* Trong thẻ: hai nút chia đều một hàng */
.card .store-btn { flex: 1 1 0; }
.card .store-btn__text { font-size: 0.95rem; }
/* Có cả cửa hàng lẫn bản web: nút web đứng riêng một hàng phía trên */
.store-btns--trio { flex-wrap: wrap; }
.store-btns--trio .store-btn--web { flex: 1 1 100%; }
.store-btns--trio .store-btn:not(.store-btn--web) { flex: 1 1 0; }
/* Màn hình rất hẹp: cho phép xuống dòng để nút không bị cắt chữ */
@media (max-width: 359px) {
  .store-btns { flex-wrap: wrap; }
  .card .store-btn { flex-basis: 100%; }
}

/* ==========================================================================
   Đầu trang
   ========================================================================== */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: rgb(255 255 255 / 0.88);
  backdrop-filter: saturate(180%) blur(12px);
  -webkit-backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--c-border);
}
.site-header__inner { display: flex; align-items: center; justify-content: space-between; min-height: var(--header-h); gap: 16px; }

.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--c-text); text-decoration: none; font-weight: 800; font-size: 1.1rem; letter-spacing: -0.01em; }
.brand img { border-radius: 10px; }

.site-menu { list-style: none; margin: 0; padding: 0; display: flex; align-items: center; gap: 4px; }
.site-menu a:not(.btn) {
  display: block; padding: 8px 14px; border-radius: 999px;
  color: var(--c-text); text-decoration: none; font-weight: 550;
  transition: background-color 0.15s ease, color 0.15s ease;
}
.site-menu a:not(.btn):hover { background: var(--c-primary-soft); color: var(--c-primary); }
.site-menu__cta { margin-left: 8px; }

.site-header__inner nav { margin-left: auto; }
.header-actions { display: flex; align-items: center; gap: 8px; }
.lang-toggle {
  min-width: 44px; min-height: 40px; padding: 6px 10px;
  border: 1px solid var(--c-border); border-radius: 12px; background: var(--c-surface);
  color: var(--c-text); font: 700 0.9rem var(--font); letter-spacing: 0.04em; cursor: pointer;
  transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}
.lang-toggle:hover { border-color: var(--c-primary); color: var(--c-primary); background: var(--c-primary-soft); }

.nav-toggle {
  display: none; width: 44px; height: 44px; padding: 10px;
  background: transparent; border: 1px solid var(--c-border); border-radius: 12px; cursor: pointer;
  flex-direction: column; justify-content: center; gap: 5px;
}
.nav-toggle span { display: block; height: 2px; background: var(--c-text); border-radius: 2px; transition: transform 0.2s, opacity 0.2s; }
.nav-toggle[aria-expanded="true"] span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.nav-toggle[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
.nav-toggle[aria-expanded="true"] span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

@media (max-width: 900px) {
  .nav-toggle { display: flex; }
  .site-menu {
    position: absolute; left: 0; right: 0; top: 100%;
    flex-direction: column; align-items: stretch; gap: 2px;
    padding: 12px var(--gutter) 20px;
    background: #fff; border-bottom: 1px solid var(--c-border); box-shadow: var(--shadow-lg);
    display: none;
  }
  .site-menu.is-open { display: flex; }
  .site-menu a:not(.btn) { padding: 12px 14px; border-radius: var(--radius-sm); }
  .site-menu__cta { margin: 8px 0 0; }
  .site-menu__cta .btn { width: 100%; min-height: 48px; }
}

/* ==========================================================================
   Phần giới thiệu
   ========================================================================== */
.hero {
  position: relative; overflow: hidden;
  padding: clamp(48px, 8vw, 96px) 0 clamp(56px, 8vw, 104px);
  background:
    radial-gradient(60% 60% at 85% 20%, rgb(99 102 241 / 0.16), transparent 70%),
    radial-gradient(50% 50% at 10% 90%, rgb(13 148 136 / 0.12), transparent 70%),
    var(--c-bg);
}
.hero__inner { display: grid; grid-template-columns: 1.05fr 0.95fr; align-items: center; gap: clamp(32px, 5vw, 64px); }
.eyebrow {
  display: inline-block; margin-bottom: 16px; padding: 6px 14px;
  background: var(--c-primary-soft); color: var(--c-primary);
  border-radius: 999px; font-weight: 650; font-size: 0.9rem;
}
.text-gradient {
  background: linear-gradient(90deg, var(--c-primary), var(--c-accent));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.hero__actions { display: flex; flex-wrap: wrap; gap: 12px; margin: 28px 0 24px; }
.hero__points { list-style: none; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 8px 20px; color: var(--c-muted); font-weight: 550; font-size: 0.95rem; }
.hero__points li { display: inline-flex; align-items: center; gap: 8px; }
.hero__points li::before {
  content: ""; width: 18px; height: 18px; flex: none; border-radius: 50%;
  background: var(--c-accent) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='none' stroke='white' stroke-width='3' stroke-linecap='round' stroke-linejoin='round' d='m6 12 4 4 8-8'/%3E%3C/svg%3E") center / 12px no-repeat;
}
.hero__art img { width: 100%; max-width: 560px; margin-inline: auto; animation: float 6s ease-in-out infinite; }

@keyframes float { 50% { transform: translateY(-10px); } }

@media (max-width: 860px) {
  .hero__inner { grid-template-columns: 1fr; text-align: center; }
  .hero .lead { margin-inline: auto; }
  .hero__actions, .hero__points { justify-content: center; }
  .hero__art { order: -1; }
  .hero__art img { max-width: 380px; }
}
@media (max-width: 480px) {
  .hero__actions .btn { width: 100%; }
}

/* ==========================================================================
   Danh sách sản phẩm
   ========================================================================== */
.section { padding: clamp(56px, 7vw, 88px) 0; }
.section--alt { background: var(--c-bg-alt); }
.section__head { margin-bottom: 32px; max-width: 640px; }
.section__head h2 { display: flex; align-items: center; gap: 12px; }
.count:empty { display: none; }
.count {
  display: inline-grid; place-items: center; min-width: 32px; height: 32px; padding: 0 8px;
  border-radius: 999px; background: var(--c-primary-soft); color: var(--c-primary);
  font-size: 0.95rem; font-weight: 700; letter-spacing: 0;
}

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 320px), 1fr)); gap: 24px; }

.card {
  display: flex; flex-direction: column;
  background: var(--c-surface); border: 1px solid var(--c-border); border-radius: var(--radius);
  overflow: hidden; box-shadow: var(--shadow-sm);
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}
.card:hover { transform: translateY(-4px); box-shadow: var(--shadow-lg); border-color: #c7d2fe; }

.card__media { display: block; aspect-ratio: 16 / 9; overflow: hidden; background: var(--c-bg-alt); }
.card__media img { width: 100%; height: 100%; object-fit: cover; transition: transform 0.4s ease; }
.card:hover .card__media img { transform: scale(1.04); }

.card__media { position: relative; }
.ribbon {
  position: absolute; top: 12px; left: 12px;
  padding: 5px 12px; border-radius: 999px;
  background: rgb(15 23 42 / 0.82); color: #fff;
  font-size: 0.8rem; font-weight: 700; letter-spacing: 0.02em;
  backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px);
}
.soon-note {
  display: inline-flex; align-items: center; gap: 8px; align-self: flex-start;
  margin-bottom: 10px; padding: 4px 12px; border-radius: 999px;
  background: #fff7ed; color: #9a3412; font-size: 0.875rem; font-weight: 650;
}
.soon-note__dot { width: 8px; height: 8px; border-radius: 50%; background: #f97316; animation: pulse 1.8s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: 0.35; } }

.card__body { display: flex; flex-direction: column; flex: 1; padding: 20px 22px 18px; }
.card__meta { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-bottom: 8px; font-size: 0.875rem; }
.card__title { margin-bottom: 6px; }
.card__title a { color: var(--c-text); text-decoration: none; }
.card__title a:hover { color: var(--c-primary); text-decoration: underline; }
.card__desc { color: var(--c-muted); }
.card .store-btns { margin-top: auto; }
.card__footer {
  display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 8px;
  padding-top: 14px; border-top: 1px solid var(--c-border); font-size: 0.925rem;
}

.tag {
  display: inline-block; padding: 3px 10px; border-radius: 999px;
  font-size: 0.78rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em;
}
.tag--app { background: var(--c-primary-soft); color: var(--c-primary); }
.tag--game { background: var(--c-game-soft); color: #92400e; }
.tag--web { background: #ccfbf1; color: #115e59; }

.badges { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }
.badge {
  display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px;
  border: 1px solid var(--c-border); border-radius: 8px;
  font-size: 0.85rem; font-weight: 600; color: var(--c-muted); background: var(--c-bg);
}

/* Màu riêng cho từng nền tảng */
.badge--android { background: #dcfce7; border-color: #bbf7d0; color: #166534; }
.badge--ios { background: #dbeafe; border-color: #bfdbfe; color: #1e40af; }
.badge--web { background: #f3e8ff; border-color: #e9d5ff; color: #6b21a8; }

.privacy-link, .more-link {
  display: inline-flex; align-items: center; gap: 6px; min-height: 32px;
  font-weight: 600; text-decoration: none;
}
.privacy-link { color: var(--c-muted); }
.privacy-link:hover { color: var(--c-primary); text-decoration: underline; }
.more-link:hover { text-decoration: underline; }

.empty {
  padding: 32px; text-align: center; color: var(--c-muted);
  border: 2px dashed var(--c-border); border-radius: var(--radius);
}

/* ==========================================================================
   Trang chi tiết
   ========================================================================== */
.detail { padding-bottom: 72px; }
.breadcrumb ol { list-style: none; display: flex; flex-wrap: wrap; gap: 6px; padding: 0; margin: 24px 0; font-size: 0.925rem; color: var(--c-muted); }
.breadcrumb li + li::before { content: "/"; margin-right: 6px; color: #94a3b8; }
.breadcrumb a { color: var(--c-muted); }
.breadcrumb a:hover { color: var(--c-primary); }
.breadcrumb [aria-current] { color: var(--c-text); font-weight: 600; }

.detail-hero { display: grid; grid-template-columns: 1.1fr 1fr; gap: clamp(24px, 4vw, 56px); align-items: center; margin-bottom: 56px; }
.detail-hero__media { aspect-ratio: 16 / 9; border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow-lg); background: var(--c-bg-alt); }
.detail-hero__media img { width: 100%; height: 100%; object-fit: cover; }
.detail-hero h1 { margin-bottom: 12px; }

@media (max-width: 860px) {
  .detail-hero { grid-template-columns: 1fr; }
}

.detail-body { max-width: 860px; }
.detail-block { margin-bottom: 48px; }
.prose p { font-size: 1.05rem; }

.features { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 280px), 1fr)); gap: 12px; }
.features li {
  position: relative; padding: 14px 16px 14px 48px;
  background: var(--c-bg-alt); border-radius: var(--radius-sm); font-weight: 550;
}
.features li::before {
  content: ""; position: absolute; left: 16px; top: 16px; width: 20px; height: 20px; border-radius: 50%;
  background: var(--c-primary) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='none' stroke='white' stroke-width='3' stroke-linecap='round' stroke-linejoin='round' d='m6 12 4 4 8-8'/%3E%3C/svg%3E") center / 13px no-repeat;
}

.shots {
  list-style: none; margin: 0; padding: 4px 4px 16px;
  display: flex; gap: 16px; overflow-x: auto; scroll-snap-type: x mandatory;
  overscroll-behavior-x: contain;
}
.shots li { flex: 0 0 auto; width: clamp(180px, 42vw, 240px); scroll-snap-align: start; }
.shots.shots--wide li { width: min(560px, 85vw); }
.shots.shots--wide img { aspect-ratio: 16 / 9; border-radius: 12px; }
.shots img {
  width: 100%; aspect-ratio: 9 / 16; object-fit: cover;
  border-radius: 20px; border: 1px solid var(--c-border); box-shadow: var(--shadow-sm);
}

.video { position: relative; aspect-ratio: 16 / 9; border-radius: var(--radius); overflow: hidden; background: #0f172a; }
.video iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.video__placeholder { position: absolute; inset: 0; display: grid; place-items: center; text-align: center; color: #cbd5e1; padding: 16px; }
.video__placeholder code { color: #fff; }

.not-found { text-align: center; }
.back { margin-top: 8px; }

/* ==========================================================================
   Chân trang
   ========================================================================== */
.site-footer { background: #0f172a; color: #cbd5e1; padding-top: 56px; }
.site-footer__grid { display: grid; grid-template-columns: 2fr repeat(3, 1fr); gap: 32px; padding-bottom: 40px; }
.brand--footer { color: #fff; margin-bottom: 12px; }
.footer-text { max-width: 36ch; font-size: 0.95rem; }
.footer-title { font-size: 0.85rem; text-transform: uppercase; letter-spacing: 0.08em; color: #fff; margin-bottom: 12px; }
.footer-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.footer-link { color: #cbd5e1; text-decoration: none; display: inline-block; padding: 4px 0; word-break: break-all; }
.footer-link:hover { color: #fff; text-decoration: underline; }
.site-footer :focus-visible { outline-color: #a5b4fc; }
.site-footer__bottom { border-top: 1px solid #1e293b; padding-block: 20px; font-size: 0.9rem; color: #94a3b8; }
.site-footer__bottom p { margin: 0; }

@media (max-width: 820px) {
  .site-footer__grid { grid-template-columns: 1fr 1fr; }
  .site-footer__grid > :first-child { grid-column: 1 / -1; }
}
@media (max-width: 420px) {
  .site-footer__grid { grid-template-columns: 1fr; }
}

/* ==========================================================================
   Thông báo
   ========================================================================== */
.toast {
  position: fixed; left: 50%; bottom: 24px; z-index: 200;
  max-width: calc(100% - 32px); padding: 12px 18px;
  background: #0f172a; color: #fff; border-radius: 12px; box-shadow: var(--shadow-lg);
  font-size: 0.95rem; word-break: break-word;
  transform: translate(-50%, 20px); opacity: 0; pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
}
.toast.is-visible { opacity: 1; transform: translate(-50%, 0); }

/* ==========================================================================
   Giảm chuyển động
   ========================================================================== */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* ==========================================================================
   Trang chính sách
   ========================================================================== */
.policy { max-width: 780px; padding-bottom: 72px; }
.policy h1 { font-size: clamp(1.8rem, 1.3rem + 2vw, 2.5rem); margin-top: 8px; }
.policy h2 { font-size: 1.3rem; margin-top: 2em; }
.policy article p, .policy article li { font-size: 1.02rem; }
.policy article ul { padding-left: 1.2em; }
.policy article li + li { margin-top: 6px; }
.policy__meta { color: var(--c-muted); font-size: 0.95rem; }
.policy__lang { margin: 0; text-align: right; font-weight: 600; }
.policy__summary {
  margin: 24px 0 8px; padding: 18px 22px;
  background: var(--c-primary-soft); border-radius: var(--radius);
}
.policy__summary h2 { margin-top: 0; font-size: 1.1rem; }
.policy__summary ul { margin: 0; }
.policy__divider { margin: 56px 0; border: 0; border-top: 1px solid var(--c-border); }
.table-wrap { overflow-x: auto; margin: 12px 0 16px; }
.policy table { width: 100%; border-collapse: collapse; font-size: 0.98rem; }
.policy th, .policy td { padding: 10px 12px; text-align: left; border-bottom: 1px solid var(--c-border); vertical-align: top; }
.policy th { background: var(--c-bg-alt); font-weight: 700; }
