/* ═══════════════════════════════════════════════════════════════
   mobile-first.css — Universal mobile fixes ONLY
   No aggressive global overrides — page-specific styling stays untouched
   ═══════════════════════════════════════════════════════════════ */

/* ── 1. iOS auto-zoom on input focus (critical fix) ── */
html {
  -webkit-text-size-adjust: 100%;
  -ms-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

input, select, textarea {
  font-size: 16px;  /* Must be ≥16px to prevent iOS zoom on focus */
}

/* ── 2. Tap highlight & smooth touch ── */
* { -webkit-tap-highlight-color: transparent; }
button, a, input[type="checkbox"], input[type="radio"], label, [role="button"] {
  touch-action: manipulation; /* eliminates 300ms tap delay */
}

/* ── 3. Smooth scrolling on iOS ── */
body { -webkit-overflow-scrolling: touch; }

/* ── 4. Safe-area for notched iPhones ── */
@supports(padding: max(0px)) {
  body {
    padding-left: env(safe-area-inset-left);
    padding-right: env(safe-area-inset-right);
  }
}

/* ── 5. Better focus visibility for accessibility ── */
*:focus { outline: none; }
*:focus-visible {
  outline: 3px solid #38bdf8;
  outline-offset: 2px;
  border-radius: 6px;
}

/* ── 6. Prevent autocomplete background on iOS ── */
input:-webkit-autofill,
input:-webkit-autofill:hover,
input:-webkit-autofill:focus {
  -webkit-box-shadow: 0 0 0 1000px var(--bg-raised, #fff) inset !important;
  -webkit-text-fill-color: var(--text-0, #0f172a) !important;
  transition: background-color 5000s ease-in-out 0s;
}

/* ── 7. Hide hover effects on touch devices ── */
@media (hover: none) {
  *:hover { transition: none !important; }
}

/* ═══════════════════════════════════════════════════════════════
   PLAY PAGE & SETUP PAGE specific (only these pages)
   Scoped via #gp (play page) and .ps-page (setup page) IDs/classes
   ═══════════════════════════════════════════════════════════════ */

/* ── Play page: confirm dialog (critical fix) ── */
#gco {
  position: fixed !important;
  top: 0 !important;
  left: 0 !important;
  right: 0 !important;
  bottom: 0 !important;
  width: 100% !important;
  height: 100dvh !important;
  z-index: 2147483647 !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  padding: 16px !important;
  margin: 0 !important;
}
#gco.hidden { display: none !important; }
#gco-inner {
  background: #fff;
  border-radius: 18px;
  padding: 22px 20px;
  width: 100%;
  max-width: 360px;
  box-shadow: 0 20px 60px rgba(0,0,0,.4);
  direction: rtl;
}

/* ── Play page (#gp): no text selection in game UI ── */
#gp { -webkit-user-select: none; user-select: none; }
#gp input, #gp textarea { -webkit-user-select: text; user-select: text; }

/* ── Setup page (.ps-page) mobile tweaks ── */
@media (max-width: 480px) {
  .ps-page .ps-rounds-grid {
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
  }
  .ps-page .ps-round-card {
    min-height: 50px;
    font-size: 16px;
    font-weight: 800;
  }
  .ps-page .ps-player-chip {
    padding: 10px 14px;
    font-size: 14px;
    min-height: 44px;
  }
  .ps-page .ps-timer-preset {
    min-height: 56px;
    font-size: 15px;
    padding: 11px 8px;
  }
  /* Setup page: prevent input zoom */
  .ps-page input, .ps-page select, .ps-page textarea {
    font-size: 16px !important;
  }
}

/* ── PWA standalone mode ── */
@media (display-mode: standalone) {
  body { padding-top: env(safe-area-inset-top); }
}
