   MOBILE RESPONSIVE
   Strategy: CSS vars drive all sizing.
   Breakpoints shrink cards, slots,
   territories, and strip heights.
══════════════════════════════════ */

/* Tablet — up to 900px */
@media (max-width: 900px) {
  /* Shrink header */
  #logo { font-size: 1.4rem; letter-spacing: 5px; }
  #turn-badge { font-size: .75rem; padding: 4px 10px; letter-spacing: 2px; }
  .ph { font-size: .5rem; padding: 3px 6px; }
  #timer-bar-outer { width: 60px; }
  .hdr-btn { font-size: .62rem; padding: 4px 8px; }

  /* Shrink cards to 96x130 */
  .card { width: 96px; height: 130px; }
  .slot { width: 98px; height: 134px; }
  /* c-art is position:absolute — no height needed */
  .c-art .art-emoji { font-size: 1.7rem; }
  .c-name { font-size: .62rem; max-width: 62px; }
  .c-cost { font-size: 1.1rem; }
  .c-text { font-size: .48rem; }
  .stat { font-size: .88rem; }
  .c-typebar { font-size: .46rem; }

  /* Shrink territory */
  .territory-card, .territory-card.empty { width: 220px; height: 66px; }
  .terr-art { width: 52px; font-size: 1.6rem; }
  .terr-name { font-size: .85rem; }
  .terr-effect { font-size: .5rem; }

  /* Shrink trap zone */
  .trap-zone { width: 52px; height: 72px; }
  .face-down-card { width: 46px; height: 66px; }

  /* Player strip */
  .money-box { font-size: 1.5rem; padding: 4px 10px; }
  .pname { font-size: .95rem; }

  /* Deck builder panel */
  #db-main { grid-template-columns: 1fr 220px; }
  #collection-grid { grid-template-columns: repeat(auto-fill, minmax(80px, 1fr)); }
}

/* Mobile — up to 600px */
@media (max-width: 600px) {
  /* Compact header — hide non-essential items */
  #logo small { display: none; }
  #logo { font-size: 1.2rem; letter-spacing: 4px; }
  #turn-badge { font-size: .68rem; padding: 3px 8px; letter-spacing: 1px; }
  .ph { font-size: .46rem; padding: 2px 5px; }
  .hdr-btn { font-size: .58rem; padding: 3px 7px; }
  #timer-bar-outer { width: 50px; }
  #timer-num { font-size: .75rem; min-width: 20px; }

  /* Cards: 76x104 on mobile */
  .card { width: 76px; height: 104px; border-radius: 4px; }
  .slot { width: 78px; height: 108px; border-radius: 4px; }
  .c-top { padding: 3px 4px 2px; }
  /* c-art is position:absolute — fills card automatically */
  .c-art .art-emoji { font-size: 1.4rem; }
  .c-name { font-size: .54rem; max-width: 50px; }
  .c-crew-tag { font-size: .4rem; }
  .c-cost { font-size: .95rem; min-width: 14px; }
  .c-typebar { font-size: .4rem; padding: 1px 3px; }
  .c-text { font-size: .42rem; padding: 2px 3px; }
  .c-stats { padding: 2px 4px; }
  .stat { font-size: .78rem; }
  .stat-l { font-size: .36rem; }
  .equip-badge { font-size: .38rem; padding: 1px 2px; max-width: 34px; }

  /* Tighten field row gaps — prevent overflow */
  .field-row { gap: 3px; padding: 4px 4px; overflow-x: auto; flex-wrap: nowrap; }
  .field-row.opp-row { padding-bottom: 4px; }
  .field-row.p-row { padding-top: 4px; }
  /* Board should not overflow viewport */
  #board { overflow-x: hidden; }

  /* Territory: full width, shorter */
  #territory-strip { grid-template-columns: 1fr 24px 1fr; }
  .territory-card, .territory-card.empty { width: 160px; height: 58px; }
  .terr-art { width: 40px; font-size: 1.3rem; }
  .terr-name { font-size: .72rem; letter-spacing: 1px; }
  .terr-effect { font-size: .42rem; -webkit-line-clamp: 2; }
  .terr-tag { font-size: .38rem; }
  .terr-side { padding: 4px 6px; }
  .dur-heart { font-size: .7rem; }
  #terr-center-label { font-size: .5rem; letter-spacing: 2px; padding: 0 4px; }

  /* Trap zone — compact, label hidden */
  .trap-zone-wrap { margin: 0 2px; }
  .trap-zone-label { display: none; }
  .trap-zone { width: 42px; height: 58px; }
  .face-down-card { width: 38px; height: 52px; font-size: 1rem; }
  .face-down-card::after { display: none; }

  /* Player strips — tighter */
  .pstrip { padding: 4px 8px; gap: 6px; }
  .avatar { width: 26px; height: 26px; font-size: .8rem; }
  .pname { font-size: .85rem; letter-spacing: 2px; }
  .money-box { font-size: 1.3rem; padding: 3px 8px; }
  .money-box::before { font-size: .7rem; }
  .income-badge { font-size: .5rem; padding: 2px 5px; display: none; } /* hide on small screens */
  .synergy-pill { font-size: .46rem; padding: 1px 4px; }
  .deck-info { font-size: .52rem; }
  #opp-hand-backs { gap: 2px; }
  .card-back { width: 20px; height: 28px; }

  /* Hand area */
  #hand-area { padding: 5px 8px 7px; }
  #hand-lbl { font-size: .5rem; margin-bottom: 5px; }
  #hand-cards { gap: 5px; }

  /* Action bar */
  #actbar { padding: 5px 8px; gap: 5px; }
  #log { font-size: .62rem; }
  .btn { font-size: .7rem; padding: 6px 10px; letter-spacing: 1px; }

  /* Floating notif */
  #notif { font-size: .8rem; padding: 6px 16px; letter-spacing: 2px; }

  /* Inspect overlay — full screen on mobile */
  /* Inspect overlay — properly centered on mobile */
  #inspect-overlay {
    align-items: center;
    justify-content: center;
    padding: 20px;
  }
  #inspect-inner {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
  }
  #inspect-inner .card {
    width: min(240px, 70vw);
    height: min(330px, 96vw);
  }
  /* c-art is position:absolute — no height needed */
  #inspect-inner .c-text { display: block !important; }
  #inspect-hint { font-size: .6rem; letter-spacing: 2px; }

  /* Deck builder on mobile — stack panels */
  #db-main { grid-template-columns: 1fr; grid-template-rows: 1fr auto; }
  #deck-panel { border-left: none; border-top: 1px solid var(--border); max-height: 280px; }
  #db-filters { gap: 5px; padding: 5px 10px; }
  .filter-btn { font-size: .55rem; padding: 3px 7px; }
  #collection-grid { grid-template-columns: repeat(auto-fill, minmax(72px, 1fr)); gap: 7px; }
  #db-hdr { padding: 7px 10px; gap: 7px; }
  #deck-name-input { width: 120px; font-size: .75rem; padding: 5px 8px; }
}

/* Very small phones — 380px and below */
@media (max-width: 380px) {
  .card { width: 64px; height: 88px; }
  .slot { width: 66px; height: 92px; }
  /* c-art position:absolute */
  .c-art .art-emoji { font-size: 1.1rem; }
  .c-name { font-size: .46rem; max-width: 42px; }
  .c-cost { font-size: .82rem; }
  .c-text { font-size: .38rem; }
  .stat { font-size: .68rem; }
  .field-row { gap: 3px; padding: 3px 4px; }
  .territory-card, .territory-card.empty { width: 136px; height: 52px; }
  .terr-art { width: 34px; font-size: 1.1rem; }
  .terr-name { font-size: .62rem; }
  .terr-effect { display: none; } /* too small to show */
  .trap-zone { width: 36px; height: 50px; }
  .face-down-card { width: 32px; height: 44px; font-size: .85rem; }
  .money-box { font-size: 1.1rem; padding: 2px 6px; }
  .pname { font-size: .75rem; }
  .synergy-bar { display: none; } /* hide synergy pills — no room */
  #log { font-size: .55rem; }
  .btn { font-size: .62rem; padding: 5px 8px; }
  #hdr { padding: 5px 8px; gap: 6px; }
}

/* Landscape mobile — phones rotated */
@media (max-height: 500px) and (max-width: 900px) {
  /* In landscape, reduce hand height and compress strips */
  .pstrip { padding: 3px 8px; }
  .money-box { font-size: 1.1rem; padding: 2px 8px; }
  .avatar { width: 22px; height: 22px; font-size: .7rem; }
  #hand-area { padding: 3px 8px 5px; }
  #hand-lbl { margin-bottom: 3px; font-size: .48rem; }
  .field-row { padding: 3px 8px; }
  .field-row.opp-row { padding-bottom: 5px; }
  .field-row.p-row { padding-top: 5px; }
  .territory-card, .territory-card.empty { height: 48px; }
  .terr-body { padding: 3px 8px; }
  .terr-effect { display: none; }
  #actbar { padding: 3px 8px; }
}

/* Center territory responsive */
@media (max-width: 600px) {
  #center-territory,
  #center-territory.territory-card,
  #center-territory.territory-card.empty { width: 280px; height: 68px; }
  .terr-unclaimed-icon { font-size: 1.2rem; }
  .terr-empty-sub { display: none; }
  #coin-box { padding: 24px 20px; }
  .coin-emoji { font-size: 3rem; }
  #coin-box-title { font-size: 1.3rem; letter-spacing: 4px; }
}
@media (max-width: 380px) {
  #center-territory,
  #center-territory.territory-card,
  #center-territory.territory-card.empty { width: 220px; height: 58px; }
}

/* ── Mobile overflow fix ── */
@media (max-width: 600px) {
  #game-screen { overflow-x: hidden; }
  #board { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .field-row { min-width: 0; }
  /* Synergy bar wraps instead of overflowing */
  .synergy-bar { flex-wrap: wrap; gap: 3px; }
  /* Header — hide less important items on tiny screens */
  #btn-sound { display: none; }
  /* Trap zone smaller to save space */
  .trap-zone-wrap { flex-shrink: 0; }
}
