/* ==========================================================================
   MeritBuy — Design System & App Shell
   --------------------------------------------------------------------------
   1. Tokens (light default + optional dark)
   2. Base / reset / typography
   3. Layout utilities
   4. Components (buttons, forms, chips, badges, cards, tabs, modal, drawer,
      menu, toast, tooltip, skeleton, empty/alert, stepper, accordion, table)
   5. App shell (header, search, drawer, bottom nav, footer, support widget)
   6. Shared cards (game card, cover art, section headers)
   7. Motion & reduced-motion
   Page-specific styles live in pages.css.
   ========================================================================== */

/* 1. TOKENS ---------------------------------------------------------------- */
/* Visual language: clean white surfaces on #F5F5F5, black header, blue
   (#4A88FC) primary, pink discount chips, pill buttons, 6–15px radii and
   very soft navy-tinted shadows. Light theme is the default. */
:root {
  --font-sans: 'Noto Sans', system-ui, -apple-system, 'Segoe UI', Roboto, Arial, sans-serif;
  --font-display: 'Noto Sans', system-ui, sans-serif;
  --font-fun: 'Carter One', 'Noto Sans', system-ui, sans-serif;

  --fs-2xs: 11px;
  --fs-xs: 12px;
  --fs-sm: 13px;
  --fs-base: 14px;
  --fs-md: 16px;
  --fs-lg: 18px;
  --fs-xl: 22px;
  --fs-2xl: clamp(22px, 2.2vw, 26px);
  --fs-3xl: clamp(26px, 3.2vw, 34px);
  --fs-4xl: clamp(30px, 4.2vw, 46px);

  --sp-1: 4px; --sp-2: 8px; --sp-3: 12px; --sp-4: 16px; --sp-5: 20px;
  --sp-6: 24px; --sp-8: 32px; --sp-10: 40px; --sp-12: 48px; --sp-16: 64px;

  --r-xs: 4px; --r-sm: 6px; --r-md: 10px; --r-lg: 12px; --r-xl: 15px; --r-pill: 9999px;

  --container: 1200px;
  --gutter: 16px;
  --header-h: 80px;
  --bottom-nav-h: 0px;

  --ease: cubic-bezier(.2, .8, .2, 1);
  --ease-in: cubic-bezier(.4, 0, 1, 1);
  --dur-1: 120ms; --dur-2: 200ms; --dur-3: 320ms;

  --z-header: 50; --z-dropdown: 60; --z-bottom: 55; --z-drawer: 80; --z-modal: 90; --z-toast: 100;

  /* Light (default) */
  color-scheme: light;
  --bg: #F5F5F5;
  --bg-soft: #EEF1F6;
  --surface: #FFFFFF;
  --surface-2: #F6F8FB;
  --surface-3: #ECEFF4;
  --surface-hover: #F3F7FF;
  --overlay: rgba(0, 0, 0, .55);
  --header-bg: #000000;
  --line: rgba(0, 0, 0, .08);
  --line-strong: rgba(0, 0, 0, .14);
  --text: #222222;
  --text-2: #666666;
  --text-3: #999999;
  --text-on-brand: #FFFFFF;

  --brand: #4A88FC;
  --brand-hover: #3A79F2;
  --brand-strong: #2A6BE6;
  --brand-soft: rgba(74, 136, 252, .10);
  --brand-line: rgba(74, 136, 252, .55);
  --brand-tint: #EAF2FF;

  --sale: #F44B9D;
  --sale-solid: #F44B9D;
  --sale-soft: rgba(244, 75, 157, .16);
  --gold: #FD8E12;
  --gold-soft: rgba(253, 142, 18, .12);
  --info: #4A88FC;
  --info-soft: rgba(74, 136, 252, .10);
  --warning: #E07B00;
  --warning-soft: rgba(253, 142, 18, .12);
  --danger: #EE3D4D;
  --danger-soft: rgba(238, 61, 77, .10);
  --success: #14A660;
  --success-soft: rgba(20, 166, 96, .10);

  --shadow-sm: 0 2px 8px rgba(23, 35, 63, .05);
  --shadow-md: 0 8px 24px rgba(23, 35, 63, .08);
  --shadow-lg: 0 16px 48px rgba(23, 35, 63, .18);
  --focus: 0 0 0 3px rgba(74, 136, 252, .35);

  --skeleton-a: #EEF0F4;
  --skeleton-b: #E2E6EE;
}

/* Optional dark appearance (Settings → Appearance) */
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0B0E15;
  --bg-soft: #0E121B;
  --surface: #151A25;
  --surface-2: #1B2130;
  --surface-3: #232B3C;
  --surface-hover: #1E2638;
  --overlay: rgba(0, 0, 0, .7);
  --header-bg: #000000;
  --line: rgba(255, 255, 255, .08);
  --line-strong: rgba(255, 255, 255, .16);
  --text: #EEF1F6;
  --text-2: #A8B1C2;
  --text-3: #737E91;
  --brand-strong: #7AA8FF;
  --brand-soft: rgba(74, 136, 252, .16);
  --brand-tint: rgba(74, 136, 252, .14);
  --sale: #FF6FB0;
  --sale-soft: rgba(244, 75, 157, .2);
  --success: #3DD68C;
  --success-soft: rgba(61, 214, 140, .14);
  --danger: #FF6B78;
  --danger-soft: rgba(255, 107, 120, .14);
  --warning: #FFAA45;
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, .35);
  --shadow-md: 0 8px 24px rgba(0, 0, 0, .4);
  --shadow-lg: 0 16px 48px rgba(0, 0, 0, .55);
  --skeleton-a: rgba(255, 255, 255, .05);
  --skeleton-b: rgba(255, 255, 255, .1);
}

:root[lang="ur"] {
  --font-sans: 'Noto Sans Arabic', 'Noto Sans', system-ui, sans-serif;
  --font-display: 'Noto Sans Arabic', 'Noto Sans', system-ui, sans-serif;
}

@media (min-width: 768px) { :root { --gutter: 24px; } }
@media (min-width: 1280px) { :root { --gutter: 32px; } }
@media (max-width: 767px) { :root { --header-h: 56px; --bottom-nav-h: 62px; } }

/* 2. BASE ------------------------------------------------------------------ */
*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: calc(var(--header-h) + 16px); }
@media (prefers-reduced-motion: no-preference) { html { scroll-behavior: smooth; } }

body {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  font-family: var(--font-sans);
  font-size: var(--fs-base);
  line-height: 1.55;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
  padding-bottom: var(--bottom-nav-h);
}
body.is-locked { overflow: hidden; }

img, svg, video { display: block; max-width: 100%; }
img { height: auto; }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; padding: 0; }
button:disabled { cursor: not-allowed; }
ul, ol { padding: 0; list-style: none; }
table { border-collapse: collapse; width: 100%; }
h1, h2, h3, h4 { font-family: var(--font-display); line-height: 1.2; font-weight: 700; letter-spacing: -.01em; }
:root[lang="ur"] h1, :root[lang="ur"] h2, :root[lang="ur"] h3, :root[lang="ur"] h4 { letter-spacing: 0; line-height: 1.5; }
p { overflow-wrap: anywhere; }
hr { border: 0; border-top: 1px solid var(--line); }
code, .mono { font-family: ui-monospace, 'SFMono-Regular', Menlo, Consolas, monospace; font-size: .92em; }
::selection { background: var(--brand-soft); color: var(--text); }

* { scrollbar-width: thin; scrollbar-color: var(--line-strong) transparent; }
::-webkit-scrollbar { width: 10px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--line-strong); border-radius: 8px; border: 2px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-thumb:hover { background: var(--text-3); background-clip: padding-box; border: 2px solid transparent; }
::-webkit-scrollbar-button { display: none; }

:focus { outline: none; }
:focus-visible { outline: 2px solid var(--brand-strong); outline-offset: 2px; border-radius: 4px; }

.skip-link {
  position: fixed; inset-inline-start: 12px; top: -60px; z-index: 200;
  background: var(--brand); color: var(--text-on-brand); padding: 10px 16px; border-radius: var(--r-sm);
  font-weight: 700; transition: top var(--dur-2) var(--ease);
}
.skip-link:focus { top: 12px; }

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

.icon { display: inline-block; vertical-align: -0.22em; width: 1.25em; height: 1.25em; flex-shrink: 0; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.icon-fill { fill: currentColor; }
[dir="rtl"] .icon-flip { transform: scaleX(-1); }

/* 3. LAYOUT ---------------------------------------------------------------- */
.container { width: 100%; max-width: var(--container); margin-inline: auto; padding-inline: var(--gutter); }
.page { flex: 1; width: 100%; padding-block: var(--sp-6) var(--sp-16); }
.page-narrow { max-width: 880px; }
.page-xnarrow { max-width: 520px; }
.section { margin-top: var(--sp-12); }
.section:first-child { margin-top: 0; }
.stack { display: flex; flex-direction: column; gap: var(--sp-4); }
.stack-sm { display: flex; flex-direction: column; gap: var(--sp-2); }
.stack-lg { display: flex; flex-direction: column; gap: var(--sp-6); }
.cluster { display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-2); }
.row { display: flex; align-items: center; gap: var(--sp-3); }
.between { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-3); }
.grow { flex: 1; min-width: 0; }
.muted { color: var(--text-2); }
.subtle { color: var(--text-3); }
.small { font-size: var(--fs-sm); }
.xsmall { font-size: var(--fs-xs); }
.strong { font-weight: 700; }
.center { text-align: center; }
.nowrap { white-space: nowrap; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.clamp-2 { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.text-brand { color: var(--brand-strong); }
.text-sale { color: var(--sale); }
.text-danger { color: var(--danger); }
.text-success { color: var(--success); }
.text-warning { color: var(--warning); }
.hidden, [hidden] { display: none !important; }
.divider { height: 1px; background: var(--line); border: 0; margin-block: var(--sp-4); }
.link { color: var(--brand-strong); font-weight: 600; }
.link:hover { text-decoration: underline; text-underline-offset: 3px; }

.grid-games {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--sp-3);
}
@media (min-width: 560px) { .grid-games { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (min-width: 900px) { .grid-games { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--sp-4); } }
@media (min-width: 1180px) { .grid-games { grid-template-columns: repeat(6, minmax(0, 1fr)); } }
.grid-games.cols-5 { }
@media (min-width: 1180px) { .grid-games.cols-5 { grid-template-columns: repeat(5, minmax(0, 1fr)); } }

.scroller {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(150px, 44%);
  gap: var(--sp-3);
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  padding-bottom: var(--sp-2);
  scrollbar-width: thin;
  overscroll-behavior-x: contain;
}
.scroller > * { scroll-snap-align: start; }
@media (min-width: 560px) { .scroller { grid-auto-columns: minmax(170px, 30%); } }
@media (min-width: 900px) { .scroller { grid-auto-columns: calc((100% - 5 * var(--sp-4)) / 6); gap: var(--sp-4); } }

/* 4. COMPONENTS ------------------------------------------------------------ */

/* Buttons */
.btn {
  --btn-h: 44px;
  position: relative;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: var(--btn-h); padding: 0 18px;
  border-radius: var(--r-md); border: 1px solid transparent;
  font-weight: 700; font-size: var(--fs-base); line-height: 1; white-space: nowrap;
  transition: background var(--dur-2) var(--ease), border-color var(--dur-2) var(--ease), color var(--dur-2) var(--ease), transform var(--dur-1) var(--ease), box-shadow var(--dur-2) var(--ease);
  user-select: none; -webkit-tap-highlight-color: transparent;
}
.btn:active:not(:disabled) { transform: translateY(1px) scale(.99); }
.btn:disabled, .btn[aria-disabled="true"] { opacity: .5; cursor: not-allowed; }
.btn .icon { width: 18px; height: 18px; }
.btn-sm { --btn-h: 36px; padding: 0 14px; font-size: var(--fs-sm); border-radius: var(--r-sm); }
.btn-xs { --btn-h: 30px; padding: 0 10px; font-size: var(--fs-xs); border-radius: var(--r-sm); gap: 6px; }
.btn-lg { --btn-h: 50px; padding: 0 24px; font-size: var(--fs-md); border-radius: var(--r-md); }
.btn-block { width: 100%; }
.btn-primary { background: var(--brand); color: var(--text-on-brand); }
.btn-primary:hover:not(:disabled) { background: var(--brand-hover); box-shadow: 0 6px 18px rgba(74, 136, 252, .3); }
.btn-secondary { background: var(--brand-tint); color: var(--brand-strong); }
.btn-secondary:hover:not(:disabled) { background: var(--brand); color: #fff; }
.btn-outline { border-color: var(--line-strong); color: var(--text); background: var(--surface); }
.btn-outline:hover:not(:disabled) { border-color: var(--brand); color: var(--brand); }
.btn-ghost { color: var(--text-2); background: transparent; }
.btn-ghost:hover:not(:disabled) { color: var(--text); background: var(--surface-2); }
.btn-danger { background: var(--danger-soft); color: var(--danger); }
.btn-danger:hover:not(:disabled) { background: var(--danger); color: #fff; }
.btn-link { height: auto; padding: 0; color: var(--brand-strong); font-weight: 600; }
.btn-link:hover { text-decoration: underline; text-underline-offset: 3px; }
.btn[aria-busy="true"] { color: transparent !important; pointer-events: none; }
.btn[aria-busy="true"]::after {
  content: ""; position: absolute; width: 18px; height: 18px; border-radius: 50%;
  border: 2px solid currentColor; border-color: var(--text-on-brand) transparent var(--text-on-brand) transparent;
  animation: spin .7s linear infinite;
}
.btn-secondary[aria-busy="true"]::after, .btn-outline[aria-busy="true"]::after, .btn-ghost[aria-busy="true"]::after { border-color: var(--text) transparent var(--text) transparent; }

.icon-btn {
  position: relative;
  display: inline-grid; place-items: center;
  width: 40px; height: 40px; border-radius: var(--r-md);
  color: var(--text-2);
  transition: background var(--dur-2) var(--ease), color var(--dur-2) var(--ease);
}
.icon-btn:hover { background: var(--surface-2); color: var(--text); }
.icon-btn .icon { width: 20px; height: 20px; }
.icon-btn.sm { width: 32px; height: 32px; }
.icon-btn.sm .icon { width: 16px; height: 16px; }
.count-badge {
  position: absolute; top: 4px; inset-inline-end: 4px;
  min-width: 16px; height: 16px; padding: 0 4px; border-radius: var(--r-pill);
  background: var(--sale-solid); color: #fff; font-size: 10px; font-weight: 800; line-height: 16px; text-align: center;
  box-shadow: 0 0 0 2px var(--bg);
}

.spinner { width: 20px; height: 20px; border-radius: 50%; border: 2px solid var(--line-strong); border-top-color: var(--brand-strong); animation: spin .7s linear infinite; }
.spinner.lg { width: 40px; height: 40px; border-width: 3px; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Forms */
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.label { font-size: var(--fs-sm); font-weight: 600; color: var(--text-2); display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.label .req { color: var(--sale); margin-inline-start: 2px; margin-inline-end: auto; }
.input, .select, .textarea {
  width: 100%; height: 46px; padding: 0 14px;
  background: var(--surface); color: var(--text);
  border: 1px solid var(--line-strong); border-radius: var(--r-md);
  font-size: 15px;
  transition: border-color var(--dur-2) var(--ease), box-shadow var(--dur-2) var(--ease), background var(--dur-2) var(--ease);
}
.textarea { height: auto; min-height: 110px; padding: 12px 14px; resize: vertical; line-height: 1.5; }
.input::placeholder, .textarea::placeholder { color: var(--text-3); }
.input:hover, .select:hover, .textarea:hover { border-color: var(--text-3); }
.input:focus, .select:focus, .textarea:focus { border-color: var(--brand-strong); box-shadow: var(--focus); outline: none; background-color: var(--surface); }
.input[readonly] { background: var(--surface-3); color: var(--text-2); }
.input.is-invalid, .select.is-invalid, .textarea.is-invalid { border-color: var(--danger); }
.input.is-invalid:focus { box-shadow: 0 0 0 3px var(--danger-soft); }
.input.is-valid { border-color: var(--brand-line); }
.select {
  appearance: none; -webkit-appearance: none; padding-inline-end: 40px; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%238793A6' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 14px center;
}
[dir="rtl"] .select { background-position: left 14px center; }
.select option { background: var(--surface); color: var(--text); }
.field-hint { font-size: var(--fs-xs); color: var(--text-3); }
.field-error { display: none; align-items: center; gap: 6px; font-size: var(--fs-xs); font-weight: 600; color: var(--danger); }
.field-error .icon { width: 14px; height: 14px; }
.field.has-error .field-error { display: flex; animation: fadeUp var(--dur-2) var(--ease); }
.field-success { display: flex; align-items: center; gap: 6px; font-size: var(--fs-xs); font-weight: 600; color: var(--success); }

.input-wrap { position: relative; display: flex; align-items: center; }
.input-wrap .input { flex: 1; }
.input-wrap .input.has-icon { padding-inline-start: 42px; }
.input-wrap .input.has-action { padding-inline-end: 48px; }
.input-wrap .input-icon { position: absolute; inset-inline-start: 14px; color: var(--text-3); pointer-events: none; width: 18px; height: 18px; }
.input-wrap .input-action { position: absolute; inset-inline-end: 4px; }
.input-group { display: flex; gap: var(--sp-2); }
.input-group .input { flex: 1; min-width: 0; }

.check { display: inline-flex; align-items: flex-start; gap: 10px; cursor: pointer; font-size: var(--fs-sm); color: var(--text-2); line-height: 1.4; }
.check input { appearance: none; -webkit-appearance: none; flex-shrink: 0; width: 18px; height: 18px; margin-top: 1px; border: 1.5px solid var(--line-strong); border-radius: 5px; background: var(--surface-2); display: grid; place-items: center; cursor: pointer; transition: all var(--dur-1) var(--ease); }
.check input[type="radio"] { border-radius: 50%; }
.check input:checked { background: var(--brand); border-color: var(--brand); }
.check input:checked::after { content: ""; width: 10px; height: 6px; border: 2px solid var(--text-on-brand); border-top: 0; border-right: 0; transform: rotate(-45deg) translate(1px, -1px); }
.check input[type="radio"]:checked::after { width: 8px; height: 8px; border: 0; border-radius: 50%; background: var(--text-on-brand); transform: none; }
.check input:focus-visible { box-shadow: var(--focus); }

.switch { position: relative; display: inline-flex; align-items: center; gap: 10px; cursor: pointer; }
.switch input { appearance: none; -webkit-appearance: none; width: 42px; height: 24px; border-radius: var(--r-pill); background: var(--surface-3); border: 1px solid var(--line-strong); position: relative; cursor: pointer; transition: background var(--dur-2) var(--ease); flex-shrink: 0; }
.switch input::after { content: ""; position: absolute; top: 2px; inset-inline-start: 2px; width: 18px; height: 18px; border-radius: 50%; background: var(--text-2); transition: transform var(--dur-2) var(--ease), background var(--dur-2) var(--ease); }
.switch input:checked { background: var(--brand); border-color: var(--brand); }
.switch input:checked::after { transform: translateX(18px); background: #fff; }
[dir="rtl"] .switch input:checked::after { transform: translateX(-18px); }
.switch input:focus-visible { box-shadow: var(--focus); }

.otp { display: flex; gap: 8px; justify-content: center; direction: ltr; }
.otp input { width: 48px; height: 56px; text-align: center; font-size: 22px; font-weight: 700; padding: 0; border-radius: var(--r-md); background: var(--surface-2); border: 1px solid var(--line-strong); color: var(--text); transition: border-color var(--dur-2), box-shadow var(--dur-2); }
.otp input:focus { border-color: var(--brand-strong); box-shadow: var(--focus); outline: none; }
.otp.is-invalid input { border-color: var(--danger); animation: shake .35s var(--ease); }
@media (max-width: 380px) { .otp { gap: 6px; } .otp input { width: 40px; height: 50px; font-size: 20px; } }

.qty { display: inline-flex; align-items: center; border: 1px solid var(--line-strong); border-radius: var(--r-md); overflow: hidden; background: var(--surface-2); }
.qty button { width: 42px; height: 42px; display: grid; place-items: center; color: var(--text-2); transition: background var(--dur-1); }
.qty button:hover:not(:disabled) { background: var(--surface-3); color: var(--text); }
.qty button:disabled { opacity: .35; }
.qty input { width: 52px; height: 42px; text-align: center; border: 0; background: transparent; font-weight: 700; font-size: 16px; -moz-appearance: textfield; }
.qty input::-webkit-outer-spin-button, .qty input::-webkit-inner-spin-button { -webkit-appearance: none; }
.qty input:focus { outline: none; background: var(--surface); }

.strength { display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; margin-top: 2px; }
.strength span { height: 4px; border-radius: 2px; background: var(--surface-3); transition: background var(--dur-2); }
.strength[data-level="1"] span:nth-child(-n+1) { background: var(--danger); }
.strength[data-level="2"] span:nth-child(-n+2) { background: var(--warning); }
.strength[data-level="3"] span:nth-child(-n+3) { background: var(--info); }
.strength[data-level="4"] span { background: var(--success); }

/* Chips & badges */
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  height: 36px; padding: 0 14px; border-radius: var(--r-pill);
  background: var(--surface); border: 1px solid var(--line);
  color: var(--text-2); font-size: var(--fs-sm); font-weight: 600; white-space: nowrap;
  transition: all var(--dur-2) var(--ease);
}
.chip:hover { color: var(--text); border-color: var(--line-strong); }
.chip.is-active, .chip[aria-pressed="true"], .chip[aria-selected="true"] { background: var(--brand); border-color: var(--brand); color: #fff; }
.chip .icon { width: 16px; height: 16px; }
.chip-sm { height: 30px; padding: 0 12px; font-size: var(--fs-xs); }
.chip-row { display: flex; gap: var(--sp-2); overflow-x: auto; scrollbar-width: none; padding-bottom: 2px; }
.chip-row::-webkit-scrollbar { display: none; }

.badge {
  display: inline-flex; align-items: center; gap: 4px;
  height: 22px; padding: 0 8px; border-radius: var(--r-xs);
  font-size: var(--fs-2xs); font-weight: 750; letter-spacing: .02em; white-space: nowrap;
  background: var(--surface-3); color: var(--text-2);
}
.badge .icon { width: 12px; height: 12px; }
.badge-sale { background: var(--sale-soft); color: var(--sale); }
.badge-sale-solid { background: var(--sale-solid); color: #fff; }
.badge-brand { background: var(--brand-soft); color: var(--brand-strong); }
.badge-gold { background: var(--gold-soft); color: var(--gold); }
.badge-info { background: var(--info-soft); color: var(--info); }
.badge-warning { background: var(--warning-soft); color: var(--warning); }
.badge-danger { background: var(--danger-soft); color: var(--danger); }
.badge-lg { height: 26px; padding: 0 10px; font-size: var(--fs-xs); }

.status { display: inline-flex; align-items: center; gap: 6px; height: 26px; padding: 0 10px; border-radius: var(--r-pill); font-size: var(--fs-xs); font-weight: 700; white-space: nowrap; }
.status::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.status-completed { background: var(--success-soft); color: var(--success); }
.status-processing { background: var(--info-soft); color: var(--info); }
.status-processing::before { animation: pulse 1.4s ease-in-out infinite; }
.status-awaiting_payment { background: var(--warning-soft); color: var(--warning); }
.status-failed { background: var(--danger-soft); color: var(--danger); }
.status-cancelled, .status-expired { background: var(--surface-3); color: var(--text-2); }
.status-refunded { background: var(--gold-soft); color: var(--gold); }

/* Cards */
.card { background: var(--surface); border: 0; border-radius: var(--r-xl); box-shadow: var(--shadow-sm); }
.card-pad { padding: var(--sp-5); }
@media (min-width: 768px) { .card-pad { padding: var(--sp-6); } }
.card-header { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-3); margin-bottom: var(--sp-4); }
.card-title { font-size: var(--fs-lg); font-weight: 700; display: flex; align-items: center; gap: 10px; }
.card-title .icon { color: var(--brand-strong); width: 20px; height: 20px; }
.step-num { display: inline-grid; place-items: center; width: 26px; height: 26px; border-radius: 8px; background: var(--brand-soft); color: var(--brand-strong); font-size: var(--fs-sm); font-weight: 800; flex-shrink: 0; }

.kv { display: grid; gap: 10px; }
.kv-row { display: flex; justify-content: space-between; align-items: baseline; gap: var(--sp-4); font-size: var(--fs-sm); }
.kv-row > :first-child { color: var(--text-2); }
.kv-row > :last-child { text-align: end; font-weight: 600; overflow-wrap: anywhere; min-width: 0; }
.kv-row.total { padding-top: var(--sp-3); border-top: 1px dashed var(--line-strong); font-size: var(--fs-md); }
.kv-row.total > :last-child { font-family: var(--font-display); font-size: var(--fs-xl); font-weight: 800; color: var(--text); }

/* Price */
.price { display: inline-flex; align-items: baseline; flex-wrap: wrap; gap: 4px 8px; }
.price-now { font-family: var(--font-display); font-weight: 800; color: var(--text); }
.price-was { font-size: .85em; color: var(--text-3); text-decoration: line-through; }

/* Tabs */
.tabs { display: flex; gap: var(--sp-1); border-bottom: 1px solid var(--line); overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tab {
  position: relative; padding: 12px 14px; font-weight: 650; font-size: var(--fs-base); color: var(--text-2); white-space: nowrap;
  display: inline-flex; align-items: center; gap: 8px;
  transition: color var(--dur-2);
}
.tab::after { content: ""; position: absolute; inset-inline: 10px; bottom: -1px; height: 2px; border-radius: 2px; background: var(--brand-strong); transform: scaleX(0); transition: transform var(--dur-2) var(--ease); }
.tab:hover { color: var(--text); }
.tab[aria-selected="true"], .tab.is-active { color: var(--text); }
.tab[aria-selected="true"]::after, .tab.is-active::after { transform: scaleX(1); }
.tab .tab-count { font-size: var(--fs-2xs); padding: 1px 7px; border-radius: var(--r-pill); background: var(--surface-3); color: var(--text-2); }
.tab-panel { animation: fadeUp var(--dur-3) var(--ease); }
.tab-panel:focus-visible { outline-offset: 6px; }

.segmented { display: inline-flex; padding: 4px; background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--r-md); gap: 2px; flex-wrap: wrap; }
.segmented button { height: 34px; padding: 0 14px; border-radius: var(--r-sm); font-size: var(--fs-sm); font-weight: 650; color: var(--text-2); transition: all var(--dur-2) var(--ease); }
.segmented button:hover { color: var(--text); }
.segmented button[aria-pressed="true"], .segmented button[aria-selected="true"] { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); }


/* Modal */
.modal-root { position: fixed; inset: 0; z-index: var(--z-modal); display: grid; place-items: center; padding: var(--sp-4); }
.modal-backdrop { position: absolute; inset: 0; background: var(--overlay); backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px); animation: fadeIn var(--dur-2) var(--ease); }
.modal {
  position: relative; width: 100%; max-width: 480px; max-height: calc(100vh - 32px); max-height: calc(100dvh - 32px);
  display: flex; flex-direction: column;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-xl);
  box-shadow: var(--shadow-lg);
  animation: modalIn var(--dur-3) var(--ease);
}
.modal.sm { max-width: 400px; }
.modal.lg { max-width: 720px; }
.modal.xl { max-width: 960px; }
.modal-head { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-3); padding: var(--sp-5) var(--sp-5) var(--sp-3); }
.modal-title { font-size: var(--fs-lg); font-weight: 700; display: flex; align-items: center; gap: 10px; }
.modal-title .icon { color: var(--brand-strong); }
.modal-body { padding: var(--sp-2) var(--sp-5) var(--sp-5); overflow-y: auto; overscroll-behavior: contain; }
.modal-foot { display: flex; gap: var(--sp-2); justify-content: flex-end; padding: var(--sp-4) var(--sp-5); border-top: 1px solid var(--line); }
.modal-root.is-closing .modal { animation: modalOut var(--dur-2) var(--ease-in) forwards; }
.modal-root.is-closing .modal-backdrop { animation: fadeOut var(--dur-2) var(--ease-in) forwards; }
@media (max-width: 599px) {
  .modal-root { place-items: end stretch; padding: 0; }
  .modal, .modal.lg, .modal.xl { max-width: none; border-radius: var(--r-xl) var(--r-xl) 0 0; max-height: 92vh; max-height: 92dvh; animation: sheetIn var(--dur-3) var(--ease); border-bottom: 0; padding-bottom: env(safe-area-inset-bottom); }
  .modal-root.is-closing .modal { animation: sheetOut var(--dur-2) var(--ease-in) forwards; }
  .modal::before { content: ""; width: 40px; height: 4px; border-radius: 2px; background: var(--line-strong); margin: 8px auto 0; flex-shrink: 0; }
  .modal-foot { flex-direction: column-reverse; }
  .modal-foot .btn { width: 100%; }
}

/* Drawer */
.drawer-root { position: fixed; inset: 0; z-index: var(--z-drawer); }
.drawer {
  position: absolute; top: 0; bottom: 0; inset-inline-start: 0; width: min(340px, 88vw);
  background: var(--surface); border-inline-end: 1px solid var(--line);
  display: flex; flex-direction: column; overflow-y: auto; overscroll-behavior: contain;
  animation: drawerIn var(--dur-3) var(--ease);
  box-shadow: var(--shadow-lg);
}
[dir="rtl"] .drawer { animation-name: drawerInRtl; }
.drawer-root.is-closing .drawer { animation: drawerOut var(--dur-2) var(--ease-in) forwards; }
[dir="rtl"] .drawer-root.is-closing .drawer { animation-name: drawerOutRtl; }
.drawer-root.is-closing .modal-backdrop { animation: fadeOut var(--dur-2) var(--ease-in) forwards; }

/* Menus / dropdowns */
.menu {
  position: absolute; z-index: var(--z-dropdown); min-width: 240px;
  background: var(--surface); border: 1px solid var(--line-strong); border-radius: var(--r-lg);
  box-shadow: var(--shadow-lg); padding: 6px;
  transform-origin: top right;
  animation: menuIn var(--dur-2) var(--ease);
}
[dir="rtl"] .menu { transform-origin: top left; }
.menu-item {
  width: 100%; display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: var(--r-sm);
  font-size: var(--fs-sm); font-weight: 550; color: var(--text-2); text-align: start;
  transition: background var(--dur-1), color var(--dur-1);
}
.menu-item:hover, .menu-item:focus-visible { background: var(--surface-2); color: var(--text); outline: none; }
.menu-item .icon { width: 18px; height: 18px; }
.menu-item.danger { color: var(--danger); }
.menu-item .menu-meta { margin-inline-start: auto; font-size: var(--fs-xs); color: var(--text-3); }
.menu-sep { height: 1px; background: var(--line); margin: 6px 4px; }
.menu-head { padding: 10px 12px 8px; }

/* Toast */
.toast-region { position: fixed; z-index: var(--z-toast); inset-inline-end: 16px; bottom: calc(16px + var(--bottom-nav-h)); display: flex; flex-direction: column; gap: 8px; width: min(380px, calc(100vw - 32px)); pointer-events: none; }
@media (max-width: 599px) { .toast-region { inset-inline: 16px; width: auto; top: calc(var(--header-h) + 8px); bottom: auto; } }
.toast {
  pointer-events: auto; display: flex; align-items: flex-start; gap: 12px;
  padding: 14px 14px 14px 16px; border-radius: var(--r-lg);
  background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow-lg);
  color: var(--text); font-size: var(--fs-sm); font-weight: 550;
  animation: toastIn var(--dur-3) var(--ease);
}

.toast.is-leaving { animation: toastOut var(--dur-2) var(--ease-in) forwards; }
.toast-icon { width: 20px; height: 20px; flex-shrink: 0; margin-top: 1px; }
.toast-success .toast-icon { color: var(--success); }
.toast-error .toast-icon { color: var(--danger); }
.toast-warning .toast-icon { color: var(--warning); }
.toast-info .toast-icon { color: var(--info); }
.toast-body { flex: 1; min-width: 0; }
.toast-title { font-weight: 700; }
.toast-text { color: var(--text-2); font-weight: 500; margin-top: 2px; }
.toast-action { color: var(--brand-strong); font-weight: 700; font-size: var(--fs-sm); white-space: nowrap; }
.toast-close { color: var(--text-3); }
.toast-close .icon { width: 16px; height: 16px; }

/* Tooltip */
[data-tooltip] { position: relative; }
[data-tooltip]::after {
  content: attr(data-tooltip); position: absolute; bottom: calc(100% + 8px); left: 50%; transform: translate(-50%, 4px);
  background: var(--text); color: var(--bg); font-size: var(--fs-xs); font-weight: 600; padding: 6px 10px; border-radius: var(--r-sm);
  white-space: nowrap; pointer-events: none; opacity: 0; transition: opacity var(--dur-2), transform var(--dur-2); z-index: 10;
}
[data-tooltip]:hover::after, [data-tooltip]:focus-visible::after { opacity: 1; transform: translate(-50%, 0); }

/* Skeleton */
.skeleton { position: relative; overflow: hidden; background: var(--skeleton-a); border-radius: var(--r-sm); }
.skeleton::after { content: ""; position: absolute; inset: 0; transform: translateX(-100%); background: linear-gradient(90deg, transparent, var(--skeleton-b), transparent); animation: shimmer 1.3s infinite; }
.sk-line { height: 12px; border-radius: 6px; }
.sk-title { height: 22px; width: 40%; border-radius: 6px; }
.sk-card { aspect-ratio: 1 / 1.32; border-radius: var(--r-lg); }
.sk-block { height: 120px; border-radius: var(--r-lg); }
@keyframes shimmer { to { transform: translateX(100%); } }

/* Empty / error / alert */
.empty { display: flex; flex-direction: column; align-items: center; text-align: center; gap: var(--sp-3); padding: var(--sp-12) var(--sp-5); }
.empty-icon { width: 64px; height: 64px; border-radius: 20px; display: grid; place-items: center; background: var(--surface-2); border: 1px solid var(--line); color: var(--text-3); margin-bottom: var(--sp-2); }
.empty-icon .icon { width: 28px; height: 28px; }
.empty.is-error .empty-icon { color: var(--danger); background: var(--danger-soft); border-color: transparent; }
.empty h3 { font-size: var(--fs-lg); }
.empty p { color: var(--text-2); max-width: 420px; }
.empty .cluster { justify-content: center; margin-top: var(--sp-2); }

.alert { display: flex; gap: 12px; padding: 14px 16px; border-radius: var(--r-md); font-size: var(--fs-sm); line-height: 1.5; border: 1px solid transparent; }
.alert .icon { width: 18px; height: 18px; flex-shrink: 0; margin-top: 1px; }
.alert strong { display: block; margin-bottom: 2px; }
.alert-info { background: var(--info-soft); color: var(--text); border-color: rgba(96,165,250,.25); }
.alert-info .icon { color: var(--info); }
.alert-warning { background: var(--warning-soft); color: var(--text); border-color: rgba(251,191,36,.25); }
.alert-warning .icon { color: var(--warning); }
.alert-danger { background: var(--danger-soft); color: var(--text); border-color: rgba(248,113,113,.25); }
.alert-danger .icon { color: var(--danger); }
.alert-success { background: var(--success-soft); color: var(--text); border-color: rgba(52,211,153,.25); }
.alert-success .icon { color: var(--success); }
.alert-demo { background: repeating-linear-gradient(-45deg, var(--surface-2), var(--surface-2) 10px, var(--surface-3) 10px, var(--surface-3) 20px); color: var(--text-2); border-color: var(--line-strong); }

/* Stepper */
.stepper { display: flex; align-items: center; gap: var(--sp-2); }
.stepper-item { display: flex; align-items: center; gap: 8px; font-size: var(--fs-sm); font-weight: 650; color: var(--text-3); white-space: nowrap; }
.stepper-dot { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; border: 1.5px solid var(--line-strong); font-size: var(--fs-xs); font-weight: 800; transition: all var(--dur-3) var(--ease); }
.stepper-dot .icon { width: 14px; height: 14px; }
.stepper-item.is-current { color: var(--text); }
.stepper-item.is-current .stepper-dot { border-color: var(--brand-strong); color: var(--brand-strong); box-shadow: 0 0 0 4px var(--brand-soft); }
.stepper-item.is-done { color: var(--text-2); }
.stepper-item.is-done .stepper-dot { background: var(--brand); border-color: var(--brand); color: var(--text-on-brand); }
.stepper-line { flex: 1; min-width: 16px; height: 2px; background: var(--line-strong); border-radius: 1px; }
.stepper-line.is-done { background: var(--brand); }
@media (max-width: 520px) { .stepper-item .stepper-label { display: none; } .stepper-item.is-current .stepper-label { display: inline; } }

/* Accordion */
.accordion { display: flex; flex-direction: column; gap: var(--sp-2); }
.acc-item { border: 1px solid var(--line); border-radius: var(--r-md); background: var(--surface-2); overflow: hidden; }
.acc-item summary { list-style: none; cursor: pointer; display: flex; align-items: center; justify-content: space-between; gap: var(--sp-3); padding: 14px 16px; font-weight: 650; }
.acc-item summary::-webkit-details-marker { display: none; }
.acc-item summary .icon { transition: transform var(--dur-2) var(--ease); color: var(--text-3); }
.acc-item[open] summary .icon { transform: rotate(180deg); }
.acc-item[open] summary { color: var(--brand-strong); }
.acc-body { padding: 0 16px 16px; color: var(--text-2); font-size: var(--fs-sm); line-height: 1.65; animation: fadeUp var(--dur-2) var(--ease); }

/* Breadcrumb */
.breadcrumb { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; font-size: var(--fs-sm); color: var(--text-3); margin-bottom: var(--sp-4); }
.breadcrumb a:hover { color: var(--text); }
.breadcrumb .icon { width: 14px; height: 14px; }
.breadcrumb [aria-current] { color: var(--text-2); font-weight: 600; }

/* Avatar */
.avatar { --hue: 160; width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; flex-shrink: 0; font-weight: 800; font-size: 14px; color: #fff; background: linear-gradient(135deg, hsl(var(--hue) 70% 45%), hsl(calc(var(--hue) + 40) 70% 38%)); text-transform: uppercase; }
.avatar.sm { width: 28px; height: 28px; font-size: 12px; }
.avatar.lg { width: 64px; height: 64px; font-size: 24px; border-radius: 20px; }
.avatar.xl { width: 84px; height: 84px; font-size: 32px; border-radius: 24px; }

/* Table */
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--r-lg); }
.table th, .table td { padding: 12px 16px; text-align: start; font-size: var(--fs-sm); border-bottom: 1px solid var(--line); vertical-align: middle; }
.table th { font-size: var(--fs-xs); font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--text-3); background: var(--surface-2); white-space: nowrap; }
.table tbody tr { transition: background var(--dur-1); }
.table tbody tr:hover { background: var(--surface-hover); }
.table tbody tr:last-child td { border-bottom: 0; }

.progress { height: 6px; border-radius: 3px; background: var(--surface-3); overflow: hidden; }
.progress > span { display: block; height: 100%; background: var(--brand); border-radius: inherit; transition: width var(--dur-3) var(--ease); }

.kbd { display: inline-grid; place-items: center; min-width: 22px; height: 22px; padding: 0 6px; border-radius: 6px; border: 1px solid var(--line-strong); font-size: 11px; font-weight: 700; color: var(--text-3); background: var(--surface-2); }

.rating { display: inline-flex; align-items: center; gap: 4px; color: var(--gold); font-weight: 700; font-size: var(--fs-sm); }
.rating .icon { width: 14px; height: 14px; }
.stars { display: inline-flex; gap: 2px; color: var(--gold); }
.stars .icon { width: 14px; height: 14px; }
.stars .off { color: var(--surface-3); }

.copy-box { display: flex; align-items: center; gap: var(--sp-2); padding: 6px 6px 6px 14px; border: 1px dashed var(--brand-line); border-radius: var(--r-md); background: var(--brand-soft); }
.copy-box code { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 700; color: var(--brand-strong); }

/* 5. APP SHELL ------------------------------------------------------------- */
/* Header: solid black bar, white pill search, translucent pill/circle buttons */
.site-header {
  position: sticky; top: 0; z-index: var(--z-header);
  background: #000; color: #fff;
  border-bottom: 1px solid rgba(255, 255, 255, .1);
  box-shadow: 0 8px 24px rgba(23, 35, 63, .04);
}
.hdr { height: var(--header-h); display: flex; align-items: center; gap: var(--sp-5); }
.logo { display: inline-flex; align-items: center; gap: 8px; flex-shrink: 0; font-family: var(--font-fun); font-weight: 400; font-size: 28px; letter-spacing: -.01em; color: var(--text); direction: ltr; line-height: 1; }
.site-header .logo, .site-footer .logo, .admin-top .logo { color: #fff; }
.logo-mark { width: 36px; height: 36px; }
.logo b { color: var(--brand); font-weight: 400; }
.hdr-nav { display: none; }
.hdr-search { flex: 1; max-width: 480px; position: relative; }
.hdr-actions { display: flex; align-items: center; gap: 10px; margin-inline-start: auto; }
.pref-btn {
  display: inline-flex; align-items: center; gap: 6px; height: 46px; padding: 0 16px;
  border-radius: 35px; background: rgba(255, 255, 255, .2); color: #fff; font-size: var(--fs-base); font-weight: 600; white-space: nowrap;
  transition: background var(--dur-2);
}
.pref-btn:hover { background: rgba(255, 255, 255, .3); }
.pref-btn .sep { opacity: .6; font-weight: 400; }
.hdr-circle {
  position: relative; width: 46px; height: 46px; border-radius: 50%; display: inline-grid; place-items: center;
  background: rgba(255, 255, 255, .2); color: #fff; transition: background var(--dur-2);
}
.hdr-circle:hover { background: rgba(255, 255, 255, .3); }
.hdr-circle .icon { width: 22px; height: 22px; }
.hdr-circle .count-badge { top: 2px; inset-inline-end: 2px; box-shadow: 0 0 0 2px #000; }
.login-btn { display: inline-flex; align-items: center; gap: 10px; height: 46px; padding: 0 16px 0 0; border-radius: 35px; color: #fff; font-weight: 600; font-size: var(--fs-md); white-space: nowrap; }
.login-btn .hdr-circle { pointer-events: none; }
.login-btn:hover .hdr-circle { background: rgba(255, 255, 255, .3); }
.account-btn { display: inline-flex; align-items: center; gap: 8px; height: 46px; padding: 0 12px 0 4px; border-radius: 35px; background: rgba(255, 255, 255, .2); color: #fff; }
.account-btn:hover { background: rgba(255, 255, 255, .3); }
.account-btn .name { font-size: var(--fs-base); font-weight: 600; max-width: 110px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.account-btn .avatar { width: 38px; height: 38px; }
.hdr-menu-btn, .hdr-mobile-only { display: none !important; }
.site-header .icon-btn { color: #fff; }
.site-header .icon-btn:hover { background: rgba(255, 255, 255, .15); color: #fff; }

@media (max-width: 1023px) { .pref-btn .pref-label, .account-btn .name, .login-btn .login-label { display: none; } .pref-btn { padding: 0 12px; } .login-btn { padding: 0; } }
@media (max-width: 767px) {
  .hdr { gap: var(--sp-2); }
  .hdr-menu-btn, .hdr-mobile-only { display: inline-grid !important; }
  .hdr-search, .hdr-desktop-only { display: none !important; }
  .logo { font-size: 23px; }
  .logo-mark { width: 30px; height: 30px; }
  .hdr-circle { width: 38px; height: 38px; }
  .hdr-circle .icon { width: 19px; height: 19px; }
  .account-btn { height: 38px; padding: 0; background: none; }
  .account-btn .avatar { width: 34px; height: 34px; }
}

/* Promo strip under the header (blue gradient) */
.promo-strip {
  position: relative; overflow: hidden; display: flex; align-items: center; justify-content: center; gap: 8px;
  height: 46px; padding: 0 var(--gutter);
  background: linear-gradient(90deg, #4A88FC 0%, #6AA5FF 50%, #4A88FC 100%);
  color: #fff; font-size: var(--fs-md); font-weight: 700; white-space: nowrap;
}
.promo-strip .icon { width: 20px; height: 20px; }
.promo-strip .muted-sep { font-weight: 400; opacity: .85; }
.promo-strip::before, .promo-strip::after { content: "✦"; position: absolute; font-size: 40px; color: rgba(255, 255, 255, .22); top: -6px; }
.promo-strip::before { left: 26%; transform: rotate(-12deg); }
.promo-strip::after { right: 30%; top: 4px; font-size: 26px; }
.promo-strip:hover .icon-arrow { transform: translateX(3px); }
.promo-strip .icon-arrow { transition: transform var(--dur-2); }
@media (max-width: 640px) { .promo-strip { font-size: var(--fs-sm); height: 40px; } .promo-strip .hide-xs { display: none; } }

/* Search box */
.searchbox { position: relative; }
.searchbox-field { position: relative; display: flex; align-items: center; }
.searchbox-field > .icon { position: absolute; inset-inline-start: 18px; width: 20px; height: 20px; color: #999; pointer-events: none; }
.searchbox-input {
  width: 100%; height: 48px; padding: 0 48px 0 52px; border-radius: var(--r-pill);
  background: #fff; border: 1.6px solid transparent; color: #222; font-size: var(--fs-md);
  transition: border-color var(--dur-2), box-shadow var(--dur-2);
}
[dir="rtl"] .searchbox-input { padding: 0 52px 0 48px; }
.searchbox-input::placeholder { color: #A8A8A8; }
.searchbox-input:focus { outline: none; border-color: var(--brand); box-shadow: var(--focus); }
.searchbox-input::-webkit-search-cancel-button { display: none; }
.searchbox-clear { position: absolute; inset-inline-end: 8px; width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; color: #999; }
.searchbox-clear:hover { color: #222; background: #F2F2F2; }
.searchbox-clear .icon { width: 16px; height: 16px; }
.searchbox.lg .searchbox-input { height: 54px; border: 1px solid var(--line-strong); box-shadow: var(--shadow-sm); }
.searchbox.lg .searchbox-input:focus { border-color: var(--brand); }

.search-panel {
  position: absolute; top: calc(100% + 8px); inset-inline: 0; z-index: var(--z-dropdown);
  background: var(--surface); color: var(--text); border: 1px solid var(--line); border-radius: var(--r-xl);
  box-shadow: var(--shadow-lg); max-height: min(70vh, 560px); overflow-y: auto; overscroll-behavior: contain;
  animation: menuIn var(--dur-2) var(--ease); transform-origin: top center;
}
.search-panel[hidden] { display: none; }
.sp-section { padding: 12px 8px 8px; }
.sp-section + .sp-section { border-top: 1px solid var(--line); }
.sp-head { display: flex; align-items: center; justify-content: space-between; padding: 0 8px 8px; font-size: var(--fs-sm); font-weight: 700; color: var(--text); }
.sp-head button { font-weight: 500; color: var(--text-3); font-size: var(--fs-xs); }
.sp-head button:hover { color: var(--brand-strong); }
.sp-chips { display: flex; flex-wrap: wrap; gap: 8px; padding: 0 8px 4px; }
.sp-option { display: flex; align-items: center; gap: 12px; width: 100%; padding: 8px; border-radius: var(--r-md); text-align: start; cursor: pointer; }
.sp-option:hover, .sp-option.is-active { background: var(--brand-tint); }
.sp-option .cover { width: 46px; height: 46px; border-radius: var(--r-sm); flex-shrink: 0; }
.sp-option-main { flex: 1; min-width: 0; }
.sp-option-title { font-weight: 700; font-size: var(--fs-base); color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sp-option-title mark { background: transparent; color: var(--brand); }
.sp-option-meta { font-size: var(--fs-xs); color: var(--text-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sp-option-side { text-align: end; flex-shrink: 0; display: flex; flex-direction: column; align-items: flex-end; gap: 4px; font-size: var(--fs-xs); }
.sp-option-side .from { color: var(--brand-strong); font-weight: 700; }
.sp-recent { display: flex; align-items: center; gap: 4px; }
.sp-recent .sp-option .icon { width: 16px; height: 16px; color: var(--text-3); }
.sp-recent .icon-btn { flex-shrink: 0; }
.sp-all { display: flex; align-items: center; justify-content: center; gap: 8px; width: 100%; padding: 12px; font-size: var(--fs-sm); font-weight: 700; color: var(--brand-strong); border-top: 1px solid var(--line); cursor: pointer; }
.sp-all:hover, .sp-all.is-active { background: var(--brand-tint); }
.sp-state { padding: var(--sp-6) var(--sp-4); text-align: center; color: var(--text-2); font-size: var(--fs-sm); }
.sp-state > .icon { width: 28px; height: 28px; color: var(--text-3); }
.sp-loading { display: flex; flex-direction: column; gap: 8px; padding: 12px; }
.sp-loading .row .skeleton:first-child { width: 46px; height: 46px; border-radius: 6px; flex-shrink: 0; }

/* Mobile search overlay */
.msearch { position: fixed; inset: 0; z-index: var(--z-drawer); background: var(--bg); display: flex; flex-direction: column; animation: fadeIn var(--dur-2) var(--ease); }
.msearch-top { display: flex; align-items: center; gap: 8px; padding: 10px var(--gutter); background: #000; }
.msearch-top .icon-btn { color: #fff; }
.msearch-top .searchbox { flex: 1; }
.msearch-top .searchbox-input { height: 42px; }
.msearch .search-panel { position: static; border: 0; border-radius: 0; box-shadow: none; max-height: none; flex: 1; animation: none; background: var(--surface); }
.msearch .searchbox { position: static; }

/* Drawer nav */
.dnav-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 16px; background: #000; }
.dnav-head .logo { color: #fff; }
.dnav-head .icon-btn { color: #fff; }
.dnav-user { display: flex; align-items: center; gap: 12px; padding: 16px; border-bottom: 1px solid var(--line); }
.dnav-section { padding: 10px 8px; border-bottom: 1px solid var(--line); }
.dnav-title { padding: 4px 12px 8px; font-size: var(--fs-xs); font-weight: 700; color: var(--text-3); }
.dnav-link { display: flex; align-items: center; gap: 12px; padding: 11px 12px; border-radius: var(--r-md); font-weight: 600; color: var(--text); width: 100%; text-align: start; }
.dnav-link:hover, .dnav-link[aria-current="page"] { background: var(--brand-tint); color: var(--brand-strong); }
.dnav-link .icon { width: 20px; height: 20px; color: var(--text-2); }
.dnav-link[aria-current="page"] .icon { color: var(--brand); }
.dnav-link .menu-meta { margin-inline-start: auto; font-size: var(--fs-xs); color: var(--text-3); }

/* Bottom nav (mobile) */
.bottom-nav { display: none; }
@media (max-width: 767px) {
  .bottom-nav {
    position: fixed; inset-inline: 0; bottom: 0; z-index: var(--z-bottom);
    display: grid; grid-template-columns: repeat(5, 1fr);
    height: calc(var(--bottom-nav-h) + env(safe-area-inset-bottom)); padding-bottom: env(safe-area-inset-bottom);
    background: var(--surface); border-top: 1px solid var(--line); box-shadow: 0 -6px 20px rgba(23, 35, 63, .06);
  }
  .bottom-nav a, .bottom-nav button { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; font-size: 11px; font-weight: 600; color: var(--text-3); }
  .bottom-nav .icon { width: 22px; height: 22px; }
  .bottom-nav [aria-current="page"] { color: var(--brand); }
  .bottom-nav .count-badge { top: 6px; inset-inline-end: calc(50% - 20px); box-shadow: 0 0 0 2px var(--surface); }
  body.hide-bottom-nav { --bottom-nav-h: 0px; }
  body.hide-bottom-nav .bottom-nav { display: none; }
}

/* Footer (dark, like the reference) */
.site-footer { margin-top: auto; background: #080B14; color: rgba(255, 255, 255, .7); padding-top: var(--sp-10); }
.ftr-grid { display: grid; gap: var(--sp-8); grid-template-columns: minmax(0, 1fr); }
@media (min-width: 640px) { .ftr-grid { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1024px) { .ftr-grid { grid-template-columns: 1.6fr repeat(4, 1fr); } }
.ftr-brand p { color: rgba(255, 255, 255, .6); font-size: var(--fs-sm); margin-top: var(--sp-3); max-width: 340px; }
.ftr-col h3 { font-family: var(--font-sans); font-size: var(--fs-base); font-weight: 700; color: #fff; margin-bottom: var(--sp-3); }
.ftr-col ul { display: grid; gap: 10px; }
.ftr-col a, .ftr-col button { font-size: var(--fs-sm); color: rgba(255, 255, 255, .65); text-align: start; }
.ftr-col a:hover, .ftr-col button:hover { color: #fff; }
.ftr-pay { display: flex; flex-wrap: wrap; gap: 6px; margin-top: var(--sp-4); }
.pay-chip { display: inline-flex; align-items: center; height: 26px; padding: 0 8px; border-radius: var(--r-xs); background: var(--surface-2); border: 1px solid var(--line); font-size: 10.5px; font-weight: 800; letter-spacing: .02em; color: var(--text-2); }
.site-footer .pay-chip { background: rgba(255, 255, 255, .08); border-color: rgba(255, 255, 255, .1); color: rgba(255, 255, 255, .8); }
.ftr-bottom { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--sp-4); margin-top: var(--sp-8); padding-block: var(--sp-5); border-top: 1px solid rgba(255, 255, 255, .08); font-size: var(--fs-xs); color: rgba(255, 255, 255, .5); }
.ftr-ratings { display: flex; align-items: center; gap: 10px; }
.ftr-ratings img { height: 32px; width: auto; border-radius: 4px; }

/* Floating side widget (back-to-top + support), white rounded panel */
.side-widget {
  position: fixed; z-index: var(--z-bottom); inset-inline-end: 16px; bottom: calc(110px + var(--bottom-nav-h));
  display: flex; flex-direction: column; background: var(--surface); border-radius: var(--r-xl); box-shadow: var(--shadow-md); overflow: hidden;
}
.side-widget button { width: 56px; height: 56px; display: grid; place-items: center; color: var(--text); transition: background var(--dur-2), color var(--dur-2); }
.side-widget button + button { border-top: 1px solid var(--line); }
.side-widget button:hover { background: var(--brand-tint); color: var(--brand); }
.side-widget .icon { width: 26px; height: 26px; }
.side-widget [data-top][hidden] { display: none; }
body.hide-fab .side-widget { display: none; }
@media (max-width: 767px) { .side-widget { inset-inline-end: 12px; bottom: calc(16px + var(--bottom-nav-h)); } .side-widget button { width: 48px; height: 48px; } .side-widget .icon { width: 22px; height: 22px; } }
@media (max-width: 1023px) { body[data-page="game"] .side-widget { bottom: calc(110px + var(--bottom-nav-h)); } }
.support-panel {
  position: fixed; z-index: var(--z-modal); inset-inline-end: 84px; bottom: calc(110px + var(--bottom-nav-h));
  width: min(380px, calc(100vw - 32px)); height: min(560px, calc(100vh - 160px));
  display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-xl); box-shadow: var(--shadow-lg);
  animation: menuIn var(--dur-3) var(--ease); transform-origin: bottom right; overflow: hidden;
}
@media (max-width: 599px) { .support-panel { inset: auto 0 0 0; width: 100%; height: 88dvh; border-radius: var(--r-xl) var(--r-xl) 0 0; animation: sheetIn var(--dur-3) var(--ease); } }
.support-head { padding: 16px; display: flex; align-items: center; gap: 12px; background: linear-gradient(90deg, #4A88FC, #6AA5FF); color: #fff; }
.support-head .icon-btn { color: #fff; }
.support-head .icon-btn:hover { background: rgba(255, 255, 255, .2); color: #fff; }
.support-head .text-success { color: #DFF7EA !important; }
.support-body { flex: 1; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 10px; background: var(--bg); }
.msg { max-width: 85%; padding: 10px 14px; border-radius: 16px; font-size: var(--fs-sm); line-height: 1.5; animation: fadeUp var(--dur-2) var(--ease); }
.msg-bot { background: var(--surface); border-end-start-radius: 4px; align-self: flex-start; box-shadow: var(--shadow-sm); }
.msg-user { background: var(--brand); color: #fff; border-end-end-radius: 4px; align-self: flex-end; font-weight: 500; }
.msg-typing { display: inline-flex; gap: 4px; padding: 14px; }
.msg-typing span { width: 6px; height: 6px; border-radius: 50%; background: var(--text-3); animation: typing 1s infinite; }
.msg-typing span:nth-child(2) { animation-delay: .15s; }
.msg-typing span:nth-child(3) { animation-delay: .3s; }
.support-quick { display: flex; flex-wrap: wrap; gap: 6px; padding: 10px 16px; background: var(--bg); }
.support-input { display: flex; gap: 8px; padding: 12px; border-top: 1px solid var(--line); }
.support-input .input { height: 42px; border-radius: var(--r-pill); }

/* 6. SHARED CARDS ---------------------------------------------------------- */
.section-head { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-4); margin-bottom: var(--sp-4); }
.section-title { font-size: 24px; font-weight: 700; color: var(--text); display: flex; align-items: center; gap: 10px; line-height: 1.2; }
.section-title .icon { color: var(--brand); width: 22px; height: 22px; }
.section-sub { color: var(--text-2); font-size: var(--fs-sm); margin-top: 4px; }
.see-all, .more-pill {
  display: inline-flex; align-items: center; gap: 2px; height: 32px; padding: 0 10px 0 14px; border-radius: var(--r-pill);
  background: var(--brand-tint); color: var(--brand); font-size: var(--fs-sm); font-weight: 800; letter-spacing: .02em; text-transform: uppercase; white-space: nowrap;
  transition: background var(--dur-2), color var(--dur-2);
}
.see-all:hover, .more-pill:hover { background: var(--brand); color: #fff; }
.see-all .icon, .more-pill .icon { width: 16px; height: 16px; stroke-width: 3; }

/* Cover art (real image or generated tile) */
.cover { position: relative; display: block; flex-shrink: 0; overflow: hidden; background: var(--surface-3); aspect-ratio: 1; border-radius: var(--r-xs); container-type: inline-size; }
.cover img { width: 100%; height: 100%; object-fit: cover; transition: transform var(--dur-3) var(--ease); }
.cover-gen {
  width: 100%; height: 100%; display: grid; place-items: center; position: relative;
  background: radial-gradient(120% 90% at 20% 10%, color-mix(in srgb, var(--a) 90%, white 10%), transparent 60%), linear-gradient(145deg, var(--a), var(--b));
  color: rgba(255, 255, 255, .96);
}
.cover-gen::before { content: ""; position: absolute; inset: 0; background-image: radial-gradient(rgba(255,255,255,.14) 1px, transparent 1px); background-size: 12px 12px; mask-image: linear-gradient(to bottom, black, transparent 80%); -webkit-mask-image: linear-gradient(to bottom, black, transparent 80%); }
.cover-gen .glyph { position: relative; font-family: var(--font-fun); font-weight: 400; letter-spacing: -.01em; text-shadow: 0 4px 18px rgba(0,0,0,.25); line-height: 1; direction: ltr; }
.cover-gen .glyph-icon { position: absolute; inset-inline-end: 10%; bottom: 10%; width: 22%; height: 22%; opacity: .55; }

/* Product card: white, 6px radius, padded image, bold title, pink %OFF chip */
.game-card {
  position: relative; display: flex; flex-direction: column;
  background: var(--surface); border-radius: var(--r-sm); overflow: hidden; padding-bottom: 12px;
  transition: transform var(--dur-2) var(--ease), box-shadow var(--dur-2) var(--ease);
  isolation: isolate;
}
.game-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-md); }
.game-card:hover .cover img { transform: scale(1.06); }
.card-media { position: relative; padding: 6px; margin-bottom: 4px; }
.game-card .cover { border-radius: var(--r-xs); }
.game-card-link { position: absolute; inset: 0; z-index: 1; border-radius: inherit; }
.game-card-link:focus-visible { outline-offset: -2px; }
.game-card-body { padding: 0 12px; display: flex; flex-direction: column; gap: 10px; flex: 1; }
.game-card-title { font-weight: 700; font-size: 16px; line-height: 1.25; color: rgba(0, 0, 0, .85); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; min-height: 2.5em; }
:root[data-theme="dark"] .game-card-title { color: var(--text); }
@media (min-width: 900px) { .game-card-title { font-size: 18px; } }
.game-card-meta { display: flex; align-items: center; justify-content: space-between; gap: 6px; margin-top: auto; font-size: var(--fs-xs); }
.off-chip { display: inline-flex; align-items: center; height: 20px; padding: 0 5px; border-radius: var(--r-xs); background: var(--sale-soft); color: var(--sale); font-size: 12px; font-weight: 600; white-space: nowrap; }
.game-card-meta .from { color: var(--text-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.game-card-meta .from strong { color: var(--brand-strong); font-weight: 700; }
.game-card-badges { position: absolute; top: 12px; inset-inline-start: 12px; display: flex; flex-direction: column; align-items: flex-start; gap: 4px; z-index: 2; pointer-events: none; }
.game-card .wish-btn { position: absolute; top: 12px; inset-inline-end: 12px; z-index: 2; opacity: 0; transition: opacity var(--dur-2); }
.game-card:hover .wish-btn, .game-card .wish-btn[aria-pressed="true"], .game-card .wish-btn:focus-visible { opacity: 1; }
@media (hover: none) { .game-card .wish-btn { opacity: 1; } }
.game-card.is-unavailable .cover img, .game-card.is-unavailable .cover-gen { filter: grayscale(.85); opacity: .6; }
.game-card .rank { position: absolute; bottom: -2px; inset-inline-start: 12px; z-index: 2; font-family: var(--font-fun); font-size: 48px; line-height: 1; color: #fff; -webkit-text-stroke: 2px var(--brand); text-shadow: 0 4px 14px rgba(23, 35, 63, .3); pointer-events: none; }

.wish-btn {
  width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center;
  background: rgba(255, 255, 255, .92); color: #555; box-shadow: var(--shadow-sm);
  transition: transform var(--dur-2) var(--ease), color var(--dur-2), opacity var(--dur-2);
}
.wish-btn:hover { transform: scale(1.08); color: var(--sale); }
.wish-btn .icon { width: 17px; height: 17px; }
.wish-btn[aria-pressed="true"] { color: var(--sale); }
.wish-btn[aria-pressed="true"] .icon { fill: currentColor; animation: pop .35s var(--ease); }

/* 7. MOTION ---------------------------------------------------------------- */
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes fadeOut { to { opacity: 0; } }
@keyframes fadeUp { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@keyframes modalIn { from { opacity: 0; transform: translateY(12px) scale(.97); } to { opacity: 1; transform: none; } }
@keyframes modalOut { to { opacity: 0; transform: translateY(8px) scale(.98); } }
@keyframes sheetIn { from { transform: translateY(100%); } to { transform: none; } }
@keyframes sheetOut { to { transform: translateY(100%); } }
@keyframes drawerIn { from { transform: translateX(-100%); } to { transform: none; } }
@keyframes drawerOut { to { transform: translateX(-100%); } }
@keyframes drawerInRtl { from { transform: translateX(100%); } to { transform: none; } }
@keyframes drawerOutRtl { to { transform: translateX(100%); } }
@keyframes menuIn { from { opacity: 0; transform: translateY(-4px) scale(.98); } to { opacity: 1; transform: none; } }
@keyframes toastIn { from { opacity: 0; transform: translateY(12px) scale(.96); } to { opacity: 1; transform: none; } }
@keyframes toastOut { to { opacity: 0; transform: translateX(24px); } }
@keyframes pop { 0% { transform: scale(1); } 40% { transform: scale(1.35); } 100% { transform: scale(1); } }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: .35; } }
@keyframes shake { 0%, 100% { transform: translateX(0); } 25% { transform: translateX(-6px); } 75% { transform: translateX(6px); } }
@keyframes typing { 0%, 60%, 100% { transform: translateY(0); opacity: .5; } 30% { transform: translateY(-4px); opacity: 1; } }

[data-reveal] { opacity: 0; transform: translateY(14px); transition: opacity .5s var(--ease), transform .5s var(--ease); }
[data-reveal].is-visible { opacity: 1; transform: none; }
.page-enter { animation: fadeUp var(--dur-3) var(--ease); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
  [data-reveal] { opacity: 1; transform: none; }
  .skeleton::after { display: none; }
}

@media print {
  .site-header, .site-footer, .bottom-nav, .support-fab, .no-print { display: none !important; }
  body { background: #fff; color: #000; padding: 0; }
  .card { border-color: #ddd; }
}
