/* Street Poker — iOS install prompt + standalone mode polish */

/* ───────── Safe-area support (notch + home indicator) ───────── */
html.sp-standalone,
html.sp-standalone body {
  /* Let the app paint under the notch; per-element padding handles layout */
  padding: 0;
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  background: #06060b;
}

/* When running from the Home Screen, give the app a safe-area-aware padded
   frame so the top nav and bottom tabs don't collide with the notch/home bar. */
html.sp-standalone body > header,
html.sp-standalone body > .app-header,
html.sp-standalone body > #app-shell > header,
html.sp-standalone body > #app-shell > .app-header,
html.sp-standalone body > #app-shell > .topbar,
html.sp-standalone body > #app-shell > .app-topbar,
html.sp-standalone #tab-nav,
html.sp-standalone #dashboard > #tab-nav,
html.sp-standalone body > #app-shell #tab-nav {
  padding-top: calc(env(safe-area-inset-top, 0px) + 8px);
}

html.sp-standalone body > footer,
html.sp-standalone body > .app-footer,
html.sp-standalone body > #app-shell > footer,
html.sp-standalone body > #app-shell > .app-footer,
html.sp-standalone body > #app-shell > .tabbar,
html.sp-standalone body > #app-shell > .bottom-nav {
  padding-bottom: calc(env(safe-area-inset-bottom, 0px) + 8px);
}

/* Generic shell padding fallback for containers that fill the viewport */
html.sp-standalone .sp-safe-top    { padding-top: env(safe-area-inset-top, 0px); }
html.sp-standalone .sp-safe-bottom { padding-bottom: env(safe-area-inset-bottom, 0px); }
html.sp-standalone .sp-safe-left   { padding-left: env(safe-area-inset-left, 0px); }
html.sp-standalone .sp-safe-right  { padding-right: env(safe-area-inset-right, 0px); }

/* Block iOS text-size adjust shrinking in landscape */
html.sp-ios { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }

/* Kill tap-highlight flash on buttons/links for a more "app-like" feel */
html.sp-ios button,
html.sp-ios a,
html.sp-ios [role="button"] {
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

/* ───────── Install prompt overlay ───────── */
#sp-ios-install {
  position: fixed;
  inset: 0;
  z-index: 100000;
  opacity: 0;
  pointer-events: none;
  transition: opacity 200ms ease-out;
  font-family: 'Outfit', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  color: #e2e8f0;
}

#sp-ios-install.is-open {
  opacity: 1;
  pointer-events: auto;
}

.sp-ios-install__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(4, 4, 10, 0.72);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.sp-ios-install__sheet {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(180deg, #0f172a 0%, #060a17 100%);
  border-top-left-radius: 22px;
  border-top-right-radius: 22px;
  border: 1px solid rgba(59, 130, 246, 0.18);
  border-bottom: none;
  padding: 22px 22px calc(env(safe-area-inset-bottom, 0px) + 22px);
  max-width: 520px;
  margin: 0 auto;
  transform: translateY(16px);
  transition: transform 220ms cubic-bezier(0.2, 0.8, 0.2, 1);
  box-shadow: 0 -24px 48px rgba(0, 0, 0, 0.5);
}

#sp-ios-install.is-open .sp-ios-install__sheet {
  transform: translateY(0);
}

.sp-ios-install__close {
  position: absolute;
  top: 10px;
  right: 14px;
  width: 36px;
  height: 36px;
  border: none;
  background: transparent;
  color: #94a3b8;
  font-size: 28px;
  line-height: 1;
  cursor: pointer;
  border-radius: 50%;
}
.sp-ios-install__close:hover { color: #f1f5f9; background: rgba(255,255,255,0.04); }

.sp-ios-install__icon {
  display: flex;
  justify-content: center;
  margin-top: 4px;
  margin-bottom: 10px;
}
.sp-ios-install__icon-tile {
  width: 64px;
  height: 64px;
  border-radius: 14px;
  background: linear-gradient(135deg, #1d4ed8 0%, #3b82f6 100%);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 40px;
  box-shadow: 0 10px 24px rgba(29, 78, 216, 0.38);
}

#sp-ios-install h2 {
  margin: 6px 0 6px;
  text-align: center;
  font-size: 1.25rem;
  color: #f1f5f9;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.sp-ios-install__lede {
  margin: 0 0 16px;
  text-align: center;
  color: #94a3b8;
  font-size: 0.92rem;
  line-height: 1.4;
}

.sp-ios-install__steps {
  list-style: none;
  padding: 0;
  margin: 0 0 18px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.sp-ios-install__steps li {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 12px;
  padding: 12px 14px;
  font-size: 0.92rem;
  line-height: 1.4;
  color: #e2e8f0;
}
.sp-ios-install__step-num {
  flex: 0 0 22px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #1d4ed8;
  color: #fff;
  font-weight: 600;
  font-size: 0.78rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-top: 1px;
}
.sp-ios-install__inline-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  vertical-align: -5px;
  width: 26px;
  height: 26px;
  border-radius: 6px;
  background: rgba(14, 165, 233, 0.12);
  border: 1px solid rgba(14, 165, 233, 0.25);
  margin: 0 2px;
}
.sp-ios-install__inline-icon svg { display: block; }

.sp-ios-install__actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 4px;
}
.sp-ios-install__btn {
  width: 100%;
  min-height: 46px;
  padding: 12px 18px;
  border-radius: 12px;
  font-size: 1rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  border: 1px solid transparent;
  transition: background 120ms ease-out, transform 80ms ease-out;
}
.sp-ios-install__btn:active { transform: scale(0.98); }
.sp-ios-install__btn--primary {
  background: #1d4ed8;
  color: #fff;
}
.sp-ios-install__btn--primary:hover { background: #2563eb; }
.sp-ios-install__btn--ghost {
  background: transparent;
  color: #94a3b8;
  border-color: rgba(255, 255, 255, 0.08);
}
.sp-ios-install__btn--ghost:hover { color: #e2e8f0; background: rgba(255,255,255,0.03); }

.sp-ios-install__hint {
  margin: 14px 0 0;
  text-align: center;
  color: #64748b;
  font-size: 0.78rem;
}
.sp-ios-install__hint code {
  background: rgba(255,255,255,0.05);
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 0.78rem;
  color: #e2e8f0;
}

/* ───────── Touch-friendly global polish ───────── */
@media (pointer: coarse) {
  /* Minimum 44pt tap-target for common interactive controls */
  button, .btn, [role="button"], a.btn, input[type="button"], input[type="submit"] {
    min-height: 44px;
  }
  /* Prevent iOS from auto-zooming when focusing inputs (<16px triggers zoom) */
  input, select, textarea {
    font-size: max(16px, 1rem);
  }
}

/* Hide the prompt entirely when installed — never spam standalone users */
html.sp-standalone #sp-ios-install { display: none !important; }
