/* ============================================================
   Mahjong Cash Link — Premium emerald + gold game aesthetic
   Layout: HUD header, tile bento grid, bottom game dock
   ============================================================ */

:root {
  --green-deep: #062318;
  --green-mid: #0a3d2a;
  --green-light: #0f5238;
  --gold: #f7d157;
  --gold-dark: #c9a030;
  --gold-gradient: linear-gradient(135deg, #ffe082 0%, #f7d157 45%, #d4a017 100%);
  --pink-glow: #ff6b9d;
  --cream: #f5f0e6;
  --cream-muted: rgba(245, 240, 230, 0.72);
  --charcoal: rgba(12, 18, 15, 0.82);
  --glass: rgba(15, 22, 18, 0.65);
  --glass-border: rgba(247, 209, 87, 0.22);
  --red-badge: #e63946;
  --font-serif: "Playfair Display", "Cormorant Garamond", Georgia, serif;
  --font-body: "DM Sans", system-ui, sans-serif;
  --radius-sm: 12px;
  --radius-md: 18px;
  --radius-lg: 24px;
  --radius-pill: 999px;
  --shadow-gold: 0 0 32px rgba(247, 209, 87, 0.35);
  --shadow-card: 0 12px 40px rgba(0, 0, 0, 0.45);
  --dock-h: 76px;
  --hud-h: 88px;
  --transition: 200ms ease;
}

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

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

body {
  margin: 0;
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.6;
  color: var(--cream);
  background: var(--green-deep);
  background-image:
    radial-gradient(ellipse 80% 50% at 50% -10%, rgba(15, 82, 56, 0.6) 0%, transparent 60%),
    linear-gradient(180deg, var(--green-mid) 0%, var(--green-deep) 55%, #041a12 100%);
  min-height: 100vh;
  overflow-x: hidden;
}

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

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

button { font: inherit; cursor: pointer; border: none; background: none; }

.container {
  width: min(1120px, calc(100% - 32px));
  margin-inline: auto;
}

.section { padding-block: 80px; }

.section--defer {
  content-visibility: auto;
  contain-intrinsic-size: auto 480px;
}

.skip-link {
  position: absolute;
  top: -100%;
  left: 16px;
  z-index: 9999;
  padding: 10px 16px;
  background: var(--gold);
  color: var(--green-deep);
  border-radius: var(--radius-sm);
  font-weight: 600;
}

.skip-link:focus { top: 16px; }

/* ---- Ambient (static gradients, no blur) ---- */
.ambient {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
  contain: strict;
}

.ambient__glow {
  position: absolute;
  border-radius: 50%;
}

.ambient__glow--gold {
  width: 520px;
  height: 520px;
  top: 8%;
  right: -12%;
  background: radial-gradient(circle, rgba(247, 209, 87, 0.14) 0%, transparent 68%);
}

.ambient__glow--pink {
  width: 400px;
  height: 400px;
  bottom: 18%;
  left: -10%;
  background: radial-gradient(circle, rgba(255, 107, 157, 0.07) 0%, transparent 68%);
}

/* ---- HUD Header ---- */
.hud {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  background: #0c1210;
  border-bottom: 1px solid var(--glass-border);
  transition: box-shadow var(--transition);
}

.hud--scrolled {
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.4);
}

.hud__status {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 10px 16px;
  max-width: 1120px;
  margin-inline: auto;
}

.hud__brand {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
  transition: opacity var(--transition);
}

.hud__brand:hover { opacity: 0.85; }

.hud__icon {
  border-radius: 10px;
  border: 1px solid var(--glass-border);
}

.hud__name {
  font-weight: 600;
  font-size: 0.95rem;
  white-space: nowrap;
}

.hud__progress {
  flex: 1;
  min-width: 0;
  display: none;
}

.hud__progress-label {
  display: block;
  font-size: 0.7rem;
  color: var(--cream-muted);
  margin-bottom: 4px;
}

.hud__progress-track {
  height: 8px;
  background: rgba(0, 0, 0, 0.4);
  border-radius: var(--radius-pill);
  border: 1px solid var(--glass-border);
  overflow: hidden;
}

.hud__progress-fill {
  height: 100%;
  background: var(--gold-gradient);
  border-radius: inherit;
  box-shadow: var(--shadow-gold);
}

.hud__menu-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: rgba(247, 209, 87, 0.12);
  border: 1px solid var(--glass-border);
  color: var(--gold);
  transition: background var(--transition), transform var(--transition);
}

.hud__menu-btn:hover { background: rgba(247, 209, 87, 0.22); }

.ticker {
  overflow: hidden;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  background: rgba(0, 0, 0, 0.25);
  height: 28px;
}

.ticker__track {
  display: flex;
  gap: 48px;
  white-space: nowrap;
  animation: ticker 40s linear infinite;
  padding-block: 5px;
  will-change: transform;
}

.ticker__track span {
  font-size: 0.75rem;
  color: var(--cream-muted);
  letter-spacing: 0.02em;
}

.ticker__track span::before {
  content: "✦ ";
  color: var(--gold);
}

@keyframes ticker {
  0% { transform: translateX(0); }
  100% { transform: translateX(-50%); }
}

/* ---- Side Nav ---- */
.side-nav[hidden] { display: none; }

.side-nav:not([hidden]) {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: block;
}

.side-nav__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.72);
}

.side-nav__panel {
  position: absolute;
  top: 0;
  right: 0;
  width: min(300px, 85vw);
  height: 100%;
  background: var(--charcoal);
  border-left: 1px solid var(--glass-border);
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 24px;
  animation: slideIn 250ms ease;
}

@keyframes slideIn {
  from { transform: translateX(100%); }
  to { transform: translateX(0); }
}

.side-nav__close {
  align-self: flex-end;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.06);
  color: var(--cream);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background var(--transition);
}

.side-nav__close:hover { background: rgba(255, 255, 255, 0.12); }

.side-nav__links {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.side-nav__links a {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  color: var(--cream-muted);
  transition: background var(--transition), color var(--transition);
}

.side-nav__links a:hover {
  background: rgba(247, 209, 87, 0.1);
  color: var(--gold);
}

.side-nav__links svg { width: 20px; height: 20px; }

/* ---- Typography helpers ---- */
.eyebrow {
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--gold);
  margin: 0 0 12px;
}

.eyebrow--gold { color: var(--gold-dark); }

.script-accent {
  font-family: "Cormorant Garamond", serif;
  font-style: italic;
  font-weight: 600;
  color: var(--gold);
  text-shadow: 0 0 24px rgba(247, 209, 87, 0.4);
}

.badge {
  display: inline-block;
  padding: 6px 14px;
  background: var(--cream);
  color: var(--green-deep);
  font-size: 0.78rem;
  font-weight: 700;
  border-radius: var(--radius-pill);
  letter-spacing: 0.04em;
}

.badge--float {
  position: relative;
  z-index: 2;
  box-shadow: var(--shadow-card);
  margin-bottom: 20px;
}

/* ---- Buttons ---- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 22px;
  border-radius: var(--radius-pill);
  font-weight: 600;
  font-size: 0.95rem;
  transition: transform var(--transition), box-shadow var(--transition), background var(--transition);
  cursor: pointer;
}

.btn svg { width: 20px; height: 20px; }

.btn--gold {
  background: var(--gold-gradient);
  color: var(--green-deep);
  box-shadow: 0 4px 20px rgba(247, 209, 87, 0.35);
  border: 1px solid rgba(255, 255, 255, 0.25);
}

.btn--gold:hover {
  box-shadow: 0 6px 28px rgba(247, 209, 87, 0.5);
  transform: translateY(-1px);
}

.btn--ghost {
  background: transparent;
  color: var(--cream);
  border: 1px solid var(--glass-border);
}

.btn--ghost:hover {
  background: rgba(247, 209, 87, 0.08);
  border-color: var(--gold);
  color: var(--gold);
}

.btn--lg { padding: 14px 28px; font-size: 1rem; }
.btn--block { width: 100%; }

/* ---- Hero ---- */
.hero {
  position: relative;
  z-index: 1;
  padding-top: calc(var(--hud-h) + 48px);
  padding-bottom: 60px;
  min-height: 70vh;
  display: flex;
  align-items: center;
}

.hero__grid {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.hero__copy {
  max-width: 640px;
}

.hero__lead {
  font-size: 1.05rem;
  color: var(--cream-muted);
  max-width: 520px;
  margin: 0 auto 28px;
}

.hero__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 36px;
  justify-content: center;
}

.hero__stats {
  display: flex;
  gap: 28px;
  margin: 0;
  justify-content: center;
}

.hero__stats div { text-align: center; }

.hero__stats dt {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--cream-muted);
  margin-bottom: 4px;
}

.hero__stats dd {
  margin: 0;
  font-family: var(--font-serif);
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--gold);
}

.hero__title {
  font-family: var(--font-serif);
  font-size: clamp(2.4rem, 6vw, 3.8rem);
  font-weight: 700;
  line-height: 1.12;
  margin: 0 0 20px;
  text-shadow: 0 2px 24px rgba(0, 0, 0, 0.4);
}

.hero__title em {
  font-style: italic;
  color: var(--gold);
}

/* ---- Section head ---- */
.section-head {
  text-align: center;
  max-width: 620px;
  margin: 0 auto 48px;
}

.section-head__title {
  font-family: var(--font-serif);
  font-size: clamp(1.8rem, 4vw, 2.6rem);
  margin: 0 0 16px;
  line-height: 1.2;
}

.section-head__lead {
  color: var(--cream-muted);
  margin: 0;
}

/* ---- Tile board (bento grid) ---- */
.tile-board {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
}

.tile-card {
  background: var(--cream);
  color: var(--green-deep);
  border-radius: var(--radius-md);
  padding: 24px;
  border: 2px solid rgba(247, 209, 87, 0.35);
  box-shadow: var(--shadow-card);
  transition: border-color var(--transition), box-shadow var(--transition), transform var(--transition);
  cursor: default;
}

.tile-card:hover {
  border-color: var(--gold);
  box-shadow: var(--shadow-card), 0 0 16px rgba(247, 209, 87, 0.15);
}

.tile-card__icon {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: var(--green-mid);
  color: var(--gold);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 14px;
}

.tile-card__icon svg { width: 22px; height: 22px; }

.tile-card h3 {
  font-family: var(--font-serif);
  font-size: 1.15rem;
  margin: 0 0 8px;
}

.tile-card p {
  margin: 0;
  font-size: 0.9rem;
  color: #3d4f47;
  line-height: 1.55;
}

.tile-card--wide { grid-column: span 2; }
.tile-card--tall { grid-row: span 2; display: flex; flex-direction: column; justify-content: center; }

.tile-card--accent {
  background: linear-gradient(145deg, var(--green-light), var(--green-mid));
  color: var(--cream);
  border-color: var(--gold);
}

.tile-card--accent p { color: var(--cream-muted); }
.tile-card--accent .tile-card__icon { background: rgba(247, 209, 87, 0.15); }

/* ---- Brand strip ---- */
.brand-strip {
  position: relative;
  z-index: 1;
  padding-block: 0 48px;
}

.brand-strip__img {
  width: 100%;
  border-radius: var(--radius-lg);
  border: 1px solid var(--glass-border);
  box-shadow: var(--shadow-card);
}

/* ---- Gallery grid ---- */
.gallery {
  position: relative;
  z-index: 1;
  padding-top: 0;
}

.gallery__grid {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 16px;
  max-width: 960px;
  margin-inline: auto;
}

.gallery__tile {
  margin: 0;
  border-radius: var(--radius-md);
  overflow: hidden;
  border: 2px solid var(--glass-border);
  box-shadow: var(--shadow-card);
  transition: border-color var(--transition), box-shadow var(--transition);
  cursor: pointer;
}

.gallery__tile:hover {
  border-color: var(--gold);
  box-shadow: var(--shadow-card), var(--shadow-gold);
}

.gallery__tile img {
  width: min(160px, 42vw);
  height: auto;
  display: block;
}

@media (min-width: 640px) {
  .gallery__grid { gap: 18px; }

  .gallery__tile img { width: 168px; }
}

@media (min-width: 1024px) {
  .gallery__grid {
    gap: 20px;
    max-width: 1100px;
  }

  .gallery__tile img { width: 196px; }
}

/* ---- Download ---- */
.download { padding-bottom: calc(80px + var(--dock-h)); }

.download__panel {
  position: relative;
  text-align: center;
  padding: 56px 32px;
  border-radius: var(--radius-lg);
  background: #101916;
  border: 1px solid var(--glass-border);
  overflow: hidden;
}

.download__glow {
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at center, rgba(247, 209, 87, 0.15) 0%, transparent 65%);
  pointer-events: none;
}

.download__title {
  font-family: var(--font-serif);
  font-size: clamp(1.8rem, 4vw, 2.4rem);
  margin: 0 0 16px;
  position: relative;
}

.download__lead {
  color: var(--cream-muted);
  max-width: 520px;
  margin: 0 auto 32px;
  position: relative;
}

.download__stores {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  justify-content: center;
  position: relative;
}

.store-btn {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  padding: 14px 24px;
  border-radius: var(--radius-pill);
  background: var(--gold-gradient);
  color: var(--green-deep);
  font-weight: 600;
  border: 1px solid rgba(255, 255, 255, 0.3);
  box-shadow: 0 4px 20px rgba(247, 209, 87, 0.3);
  transition: transform var(--transition), box-shadow var(--transition);
  cursor: pointer;
}

.store-btn svg { width: 24px; height: 24px; }

.store-btn span {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  line-height: 1.2;
}

.store-btn small {
  font-size: 0.65rem;
  font-weight: 500;
  opacity: 0.75;
}

.store-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 28px rgba(247, 209, 87, 0.45);
}

.store-btn--outline {
  background: transparent;
  color: var(--cream);
  border: 1px solid var(--glass-border);
  box-shadow: none;
}

.store-btn--outline:hover {
  background: rgba(247, 209, 87, 0.1);
  border-color: var(--gold);
  box-shadow: none;
}

/* ---- Game Dock (bottom nav) ---- */
.game-dock {
  position: fixed;
  bottom: 16px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 90;
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 8px 12px;
  background: #0c1210;
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-pill);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
}

.game-dock__item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 8px 10px;
  border-radius: var(--radius-pill);
  color: var(--cream-muted);
  font-size: 0.6rem;
  font-weight: 500;
  transition: color var(--transition), background var(--transition);
  cursor: pointer;
  position: relative;
  min-width: 48px;
}

.game-dock__item svg { width: 22px; height: 22px; }

.game-dock__item:hover,
.game-dock__item--active {
  color: var(--gold);
  background: rgba(247, 209, 87, 0.1);
}

.game-dock__item--cta {
  background: var(--gold-gradient);
  color: var(--green-deep);
  padding: 10px 18px;
  margin-inline: 4px;
}

.game-dock__item--cta:hover {
  background: var(--gold-gradient);
  color: var(--green-deep);
  box-shadow: var(--shadow-gold);
}

.game-dock__badge {
  position: absolute;
  top: 2px;
  right: 8px;
  width: 16px;
  height: 16px;
  background: var(--red-badge);
  color: #fff;
  font-size: 0.6rem;
  font-weight: 700;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

/* ---- Footer ---- */
.footer {
  position: relative;
  z-index: 1;
  padding: 24px 0 calc(var(--dock-h) + 32px);
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.footer__inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  text-align: center;
}

.footer__copy {
  margin: 0;
  font-size: 0.85rem;
  color: var(--cream-muted);
}

.footer__links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 20px;
  justify-content: center;
}

.footer__links a {
  font-size: 0.85rem;
  color: var(--cream-muted);
  transition: color var(--transition);
}

.footer__links a:hover { color: var(--gold); }

/* ---- Modal ---- */
.modal[hidden] { display: none; }

.modal:not([hidden]) {
  position: fixed;
  inset: 0;
  z-index: 300;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.72);
}

.modal__panel {
  position: relative;
  width: min(400px, 100%);
  background: var(--cream);
  color: var(--green-deep);
  border-radius: var(--radius-lg);
  padding: 36px 28px 28px;
  text-align: center;
  box-shadow: var(--shadow-card);
  animation: modalIn 250ms ease;
}

@keyframes modalIn {
  from { opacity: 0; transform: scale(0.95) translateY(8px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

.modal__close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.06);
  color: var(--green-deep);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background var(--transition);
  cursor: pointer;
}

.modal__close:hover { background: rgba(0, 0, 0, 0.12); }

.modal__icon {
  width: 56px;
  height: 56px;
  margin: 0 auto 16px;
  border-radius: 50%;
  background: var(--gold-gradient);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--green-deep);
}

.modal__icon svg { width: 28px; height: 28px; }

.modal__panel h2 {
  font-family: var(--font-serif);
  font-size: 1.6rem;
  margin: 0 0 12px;
}

.modal__panel p {
  color: #3d4f47;
  margin: 0 0 24px;
  font-size: 0.95rem;
}

/* ---- Responsive ---- */
@media (min-width: 640px) {
  .hud__progress { display: block; }
  .hud__name { font-size: 1rem; }
}

@media (min-width: 768px) {
  .tile-board {
    grid-template-columns: repeat(4, 1fr);
    gap: 18px;
  }

  .tile-card--wide { grid-column: span 2; }
  .tile-card--tall { grid-row: span 2; }

  .footer__inner {
    flex-direction: row;
    justify-content: space-between;
    text-align: left;
  }
}

/* ---- Reduced motion ---- */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }

  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }

  .ticker__track {
    animation: none;
    will-change: auto;
  }
}
