/**
 * Mobile Design System + sitewide mobile polish
 * Scope: max-width 767px ONLY. Desktop defaults untouched.
 * Load with: media="screen and (max-width: 767px)"
 *
 * Brand: Deep Green + Gold + Ivory · Indian Rummy
 * Forbidden accents: blue / purple / neon orange
 */

@media (max-width: 767px) {
  :root {
    /* —— Color tokens (aliases for mobile authors) —— */
    --m-green: var(--rummy-green, #064e3b);
    --m-green-dark: var(--rummy-green-dark, #033528);
    --m-green-light: var(--rummy-green-light, #0a6b50);
    --m-gold: var(--rummy-gold, #fbbf24);
    --m-gold-soft: var(--rummy-gold-soft, #fcd34d);
    --m-gold-dark: var(--rummy-gold-dark, #d97706);
    --m-ivory: var(--rummy-ivory, #f5faf7);
    --m-white: #fff;
    --m-muted: rgba(245, 250, 247, .62);

    /* Spacing */
    --m-space-4: 4px;
    --m-space-8: 8px;
    --m-space-12: 12px;
    --m-space-16: 16px;
    --m-space-20: 20px;
    --m-space-24: 24px;
    --m-space-32: 32px;
    --m-space-40: 40px;
    --m-space-48: 48px;

    /* Radius */
    --m-radius-6: 6px;
    --m-radius-8: 8px;
    --m-radius-12: 12px;
    --m-radius-14: 14px;
    --m-radius-16: 16px;
    --m-radius-20: 20px;
    --m-radius-24: 24px;

    /* Type */
    --m-fs-10: .625rem;
    --m-fs-11: .6875rem;
    --m-fs-12: .75rem;
    --m-fs-13: .8125rem;
    --m-fs-14: .875rem;
    --m-fs-15: .9375rem;
    --m-fs-16: 1rem;
    --m-fs-18: 1.125rem;
    --m-fs-20: 1.25rem;
    --m-fs-22: 1.375rem;
    --m-fs-24: 1.5rem;
    --m-fs-28: 1.75rem;
    --m-fs-32: 2rem;

    --m-touch: 44px;
    --m-btn-h: 50px;
    --m-header-h: 54px;
    --m-anim: .18s;
  }

  /* —— Overflow safety —— */
  html,
  body {
    overflow-x: clip;
    max-width: 100vw;
  }

  img,
  svg,
  video {
    max-width: 100%;
    height: auto;
  }

  /* —— Shared header (content + home; play page overrides separately) —— */
  body:not(.is-playing) .site-header {
    min-height: var(--m-header-h);
  }
  body:not(.is-playing) .site-header > .wrap.header-row,
  body:not(.is-playing) .header-row {
    position: relative;
    min-height: var(--m-header-h);
    padding-left: var(--m-space-16);
    /* Reserve room for absolute EN/हिं so logo never overlaps */
    padding-right: 78px;
    gap: var(--m-space-8);
    box-sizing: border-box;
    overflow: visible;
  }
  /* Nav must span full header content width (padL 16 + padR 78) — no overflow clip */
  body:not(.is-playing) .site-header .nav,
  body:not(.is-playing) .header-row > .nav,
  body.home .nav {
    display: grid !important;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    width: calc(100% + 16px + 78px) !important;
    max-width: none !important;
    margin-left: -16px !important;
    margin-right: -78px !important;
    box-sizing: border-box !important;
    min-width: 0;
  }
  body:not(.is-playing) .site-header .nav a,
  body.home .nav a {
    min-width: 0;
    max-width: 100%;
    overflow: hidden;
    text-overflow: clip;
    white-space: nowrap;
    font-size: .82rem;
    padding-left: 2px;
    padding-right: 2px;
  }
  body:not(.is-playing) .logo {
    font-size: var(--m-fs-16);
    gap: var(--m-space-8);
  }
  body:not(.is-playing) .logo-mark,
  body:not(.is-playing) .logo-emblem {
    width: 36px;
    height: 36px;
  }
  body:not(.is-playing) .nav-btn,
  body:not(.is-playing) .lang-toggle,
  body:not(.is-playing) .nav-dl {
    min-height: var(--m-touch);
    min-width: var(--m-touch);
  }

  /* —— Buttons / CTA —— */
  .btn,
  .btn-gold,
  .btn-ghost,
  .btn-ok,
  .nav-dl,
  a.btn {
    min-height: var(--m-btn-h);
    min-width: var(--m-touch);
    padding: 12px 16px;
    font-size: var(--m-fs-15);
    font-weight: 800;
    border-radius: var(--m-radius-12);
    transition: transform var(--m-anim) ease, opacity var(--m-anim) ease, box-shadow var(--m-anim) ease;
  }
  .btn:active,
  .btn-gold:active,
  .btn-ghost:active {
    transform: scale(.98);
    opacity: .92;
  }
  .cta-row {
    gap: var(--m-space-12);
  }
  .cta-row .btn {
    width: 100%;
  }

  /* —— Typography scale —— */
  body:not(.play) h1,
  body.home #home-h1,
  body.home h1 {
    font-size: clamp(1.5rem, 6.2vw, 2rem) !important; /* 24–32 */
    line-height: 1.2;
  }
  body:not(.play) h2,
  body.home h2 {
    font-size: clamp(1.125rem, 4.5vw, 1.375rem) !important; /* 18–22 */
    line-height: 1.3;
  }
  body:not(.play) .lead,
  body.home .lead {
    font-size: var(--m-fs-14) !important;
    line-height: 1.5;
    color: var(--m-muted);
  }
  body:not(.play) p,
  body:not(.play) li {
    font-size: var(--m-fs-14);
    line-height: 1.55;
  }
  body:not(.play) .crumbs,
  body:not(.play) .entity,
  body:not(.play) .small {
    font-size: var(--m-fs-12);
  }

  /* —— Sections / cards — less chrome —— */
  body:not(.is-playing) main .wrap > section,
  body.home main section {
    margin-bottom: var(--m-space-32);
    padding-top: var(--m-space-8);
  }
  body:not(.is-playing) .card,
  body.home .card {
    border-radius: var(--m-radius-12);
    box-shadow: none;
    border: 1px solid rgba(245, 250, 247, .1);
    padding: var(--m-space-16);
  }
  body:not(.is-playing) .faq details {
    margin-bottom: var(--m-space-8);
    border-radius: var(--m-radius-8);
  }

  /* —— Home hero (mobile composition, not desktop shrink) —— */
  body.home .lp-hero {
    padding: var(--m-space-12) 0 var(--m-space-20);
    overflow: visible;
  }
  body.home .hero-grid {
    gap: 14px;
  }
  body.home .hero-kicker {
    font-size: var(--m-fs-11);
    letter-spacing: .06em;
    margin-bottom: 6px;
  }
  body.home .lp-hero h1,
  body.home #home-h1 {
    margin-bottom: 10px !important;
  }
  body.home .lead {
    margin-bottom: 14px !important;
  }
  body.home .dl-hint {
    margin-bottom: 10px;
    font-size: var(--m-fs-12);
  }
  body.home .hero-cta {
    margin-bottom: 12px;
  }
  body.home .hero-cta .btn,
  body.home .cta-row.hero-cta .btn {
    min-height: var(--m-btn-h);
    font-size: var(--m-fs-15);
  }
  body.home .trust-checks {
    gap: 6px;
    margin-bottom: 10px;
  }
  body.home .trust-checks li {
    padding: 6px 10px;
    font-size: .78rem;
  }
  body.home .entity {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 4px;
  }
  body.home .entity span {
    font-size: var(--m-fs-11);
    padding: 4px 8px;
  }
  body.home .hero-corner {
    opacity: .08;
    width: 40px;
  }
  body.home .hero-mandala {
    opacity: .08 !important;
  }
  body.home .hero-pattern {
    opacity: .05 !important;
  }
  body.home .hero-visual {
    min-height: 0 !important;
    margin-top: 4px;
  }
  body.home .phone-hero {
    max-width: min(260px, 82vw);
    width: min(260px, 82vw);
    margin-inline: auto;
    transform: none;
  }
  body.home .phone-hero-screen {
    min-height: 340px !important;
  }

  /* —— Content pages padding —— */
  body:not(.home):not(.play) main .wrap,
  body:not(.home):not(.is-playing) main#main > .wrap {
    padding-left: var(--m-space-16);
    padding-right: var(--m-space-16);
  }

  /* —— Footer —— */
  .site-footer {
    padding: var(--m-space-24) 0 max(var(--m-space-24), env(safe-area-inset-bottom, 0px));
    font-size: var(--m-fs-12);
  }

  /* —— Sticky download bar (all mobile pages; PC stays display:none) —— */
  body:not(.is-playing) {
    padding-bottom: 100px;
  }
  body.is-playing .sticky-cta,
  body.is-playing .sticky-dl {
    display: none !important;
    pointer-events: none !important;
    visibility: hidden !important;
  }
  .sticky-dl {
    opacity: 0;
    pointer-events: none;
    transform: translateY(12px);
    transition: opacity .25s ease, transform .25s ease;
    background: rgba(4, 17, 13, .94);
    color: #1a1204;
    border-color: rgba(251, 191, 36, .28);
    box-shadow: 0 10px 28px rgba(0, 0, 0, .45);
    max-width: calc(100vw - 20px);
    min-width: 0;
    overflow: hidden;
  }
  .sticky-dl.is-visible {
    opacity: 1 !important;
    pointer-events: auto !important;
    transform: none;
    visibility: visible;
  }
  .sticky-cta-btns {
    display: flex;
    flex-direction: row;
    align-items: stretch;
    gap: 6px;
    width: 100%;
    min-width: 0;
    max-width: 100%;
    box-sizing: border-box;
  }
  #sticky-play-now .btn,
  #sticky-play-now .btn.btn-gold,
  #sticky-play-now .btn.btn-ghost,
  .sticky-cta .btn.btn-gold,
  .sticky-cta .btn.btn-ghost {
    flex: 1 1 0;
    min-width: 0 !important;
    max-width: none;
    width: auto;
    min-height: 44px;
    height: 44px;
    padding: 6px 8px;
    font-size: .75rem;
    font-weight: 800;
    letter-spacing: 0;
    line-height: 1.15;
    white-space: nowrap;
    text-align: center;
    overflow: hidden;
    text-overflow: ellipsis;
    box-sizing: border-box;
    border-radius: 10px;
    box-shadow: none;
    transform: none;
  }

  /* —— Touch / INP —— */
  .btn,
  .btn-gold,
  .btn-ghost,
  .nav-play,
  .nav-dl,
  .sticky-dl a,
  .cta-row a,
  summary {
    touch-action: manipulation;
  }

  /* —— Motion —— */
  @media (prefers-reduced-motion: reduce) {
    .btn,
    .btn-gold,
    .btn-ghost,
    .pcard {
      transition: none !important;
    }
  }
}
