/* Compact mobile PWA install card */

html.mamosta-native .pwa-install-root,
html.mamosta-native .pwa-install-hint,
html.mamosta-native .pwa-install-entry,
html.mamosta-native .player-footer {
  display: none !important;
}

html.pwa-standalone,
html.pwa-standalone body,
body.pwa-standalone {
  overscroll-behavior: none;
  overscroll-behavior-y: none;
  -webkit-overflow-scrolling: auto;
}

@media (display-mode: standalone), (display-mode: fullscreen), (display-mode: minimal-ui) {
  html,
  body {
    overscroll-behavior: none;
  }

  .player-footer {
    display: none !important;
  }

  .pwa-install-root,
  .pwa-install-hint,
  .pwa-install-entry {
    display: none !important;
  }
}

.pwa-install-root[hidden],
.pwa-install-hint[hidden],
.pwa-install-entry[hidden] {
  display: none !important;
}

.pwa-install-root {
  position: fixed;
  inset: 0;
  z-index: 16000;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 0 10px calc(10px + env(safe-area-inset-bottom, 0px));
  font-family: 'Vazirmatn', 'Segoe UI', Tahoma, sans-serif;
  direction: rtl;
  pointer-events: none;
}

body.player-has-tabbar .pwa-install-root {
  padding-bottom: calc(var(--player-tabbar-h, 64px) + env(safe-area-inset-bottom, 0px) + 10px);
}

.pwa-install-card {
  pointer-events: auto;
  position: relative;
  width: 100%;
  max-width: 420px;
  display: grid;
  grid-template-columns: 44px 1fr auto;
  grid-template-areas:
    "icon copy btn"
    "later later later";
  align-items: center;
  column-gap: 10px;
  row-gap: 8px;
  padding: 10px 12px 8px;
  background: #fffefb;
  border-radius: 18px;
  border: 1.5px solid rgba(230, 170, 90, 0.45);
  box-shadow: 0 10px 28px rgba(80, 40, 20, 0.22);
  color: #5c3824;
  animation: pwaCardUp 0.32s cubic-bezier(0.22, 1, 0.36, 1);
}

.pwa-install-icon {
  grid-area: icon;
  width: 44px;
  height: 44px;
  border-radius: 12px;
  display: block;
  box-shadow: 0 4px 10px rgba(200, 120, 30, 0.22);
}

.pwa-install-copy {
  grid-area: copy;
  min-width: 0;
}

.pwa-install-copy strong {
  display: block;
  font-size: 0.95rem;
  font-weight: 900;
  line-height: 1.25;
}

.pwa-install-copy span {
  display: block;
  margin-top: 2px;
  color: #8b6b52;
  font-size: 0.75rem;
  font-weight: 600;
  line-height: 1.35;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.pwa-install-btn {
  grid-area: btn;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  min-width: 88px;
  padding: 0 14px;
  border: none;
  border-radius: 999px;
  background: linear-gradient(135deg, #ffc85a, #ff9a3c);
  color: #5c3824;
  font-weight: 800;
  font-size: 0.9rem;
  box-shadow: 0 4px 12px rgba(200, 120, 30, 0.28);
  touch-action: manipulation;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.pwa-install-btn:active {
  transform: scale(0.96);
}

.pwa-install-later {
  grid-area: later;
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 36px;
  margin: 0;
  padding: 0 2px;
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
  color: #6d3f26;
  font-weight: 700;
  font-size: 0.82rem;
}

.pwa-install-later input {
  width: 20px;
  height: 20px;
  margin: 0;
  accent-color: #c47a3a;
  flex-shrink: 0;
}

.pwa-install-close {
  position: absolute;
  top: -8px;
  left: -8px;
  width: 28px;
  height: 28px;
  border: none;
  border-radius: 50%;
  background: #fff6e8;
  color: #8b6b52;
  font-size: 0.85rem;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 8px rgba(80, 40, 20, 0.18);
  touch-action: manipulation;
  cursor: pointer;
}

@keyframes pwaCardUp {
  from {
    transform: translateY(18px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

@media (max-width: 360px) {
  .pwa-install-card {
    grid-template-columns: 40px 1fr auto;
    padding: 9px 10px 7px;
    column-gap: 8px;
  }

  .pwa-install-icon {
    width: 40px;
    height: 40px;
  }

  .pwa-install-btn {
    min-width: 76px;
    padding: 0 12px;
    font-size: 0.85rem;
  }

  .pwa-install-copy span {
    white-space: normal;
  }
}

@media (prefers-reduced-motion: reduce) {
  .pwa-install-card {
    animation: none;
  }
}

.pwa-install-hint {
  position: fixed;
  inset: 0;
  z-index: 17000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  background: rgba(40, 22, 8, 0.45);
  font-family: 'Vazirmatn', 'Segoe UI', Tahoma, sans-serif;
  direction: rtl;
}

.pwa-install-hint-card {
  width: 100%;
  max-width: 360px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.65rem;
  padding: 1.25rem 1.1rem 1rem;
  background: #fffefb;
  border-radius: 22px;
  border: 1.5px solid rgba(230, 170, 90, 0.45);
  box-shadow: 0 16px 40px rgba(80, 40, 20, 0.28);
  color: #5c3824;
  text-align: center;
}

.pwa-install-hint-card strong {
  font-size: 1.05rem;
  font-weight: 900;
}

.pwa-install-hint-card p {
  margin: 0;
  color: #8b6b52;
  font-size: 0.9rem;
  font-weight: 600;
  line-height: 1.55;
}

.pwa-install-hint-card .pwa-install-btn {
  min-width: 120px;
}

#homePwaInstallBtn i {
  margin-inline-end: 0.35rem;
}
