/* ═══════════════════════════════════════════════════════════════════════════
 * JLearn Online — Animated PWA Installation Guide
 * Device & Browser Detection + Pure CSS Interactive Mockup Animations
 * ═══════════════════════════════════════════════════════════════════════════ */

:root {
  --pwa-primary: #6366f1;
  --pwa-primary-glow: rgba(99, 102, 241, 0.35);
  --pwa-accent: #10b981;
  --pwa-accent-glow: rgba(16, 185, 129, 0.35);
  --pwa-surface: #0e1320;
  --pwa-surface-card: #141b2d;
  --pwa-surface-subtle: rgba(255, 255, 255, 0.05);
  --pwa-border: rgba(255, 255, 255, 0.1);
  --pwa-border-active: rgba(99, 102, 241, 0.6);
  --pwa-text-high: #ffffff;
  --pwa-text-med: #94a3b8;
  --pwa-text-low: #64748b;
  --pwa-phone-bezel: #1e293b;
  --pwa-phone-screen: #020617;
  --pwa-ease: cubic-bezier(0.16, 1, 0.3, 1);
}

[data-theme="light"] {
  --pwa-surface: #ffffff;
  --pwa-surface-card: #f8fafc;
  --pwa-surface-subtle: rgba(15, 23, 42, 0.04);
  --pwa-border: rgba(15, 23, 42, 0.12);
  --pwa-border-active: #6366f1;
  --pwa-text-high: #0f172a;
  --pwa-text-med: #475569;
  --pwa-text-low: #94a3b8;
  --pwa-phone-bezel: #cbd5e1;
  --pwa-phone-screen: #ffffff;
}

/* ── Modal Overlay ── */
.pwa-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(3, 7, 18, 0.78);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  z-index: 100000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  padding-bottom: max(16px, env(safe-area-inset-bottom, 16px));
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s var(--pwa-ease), visibility 0.3s var(--pwa-ease);
}

.pwa-modal-overlay.active {
  opacity: 1;
  visibility: visible;
}

/* ── Modal Window ── */
.pwa-modal-window {
  position: relative;
  width: 100%;
  max-width: 860px;
  max-height: 92vh;
  max-height: min(94vh, 94dvh);
  background: var(--pwa-surface);
  border: 1px solid var(--pwa-border);
  border-radius: 24px;
  box-shadow: 0 25px 60px -15px rgba(0, 0, 0, 0.6), 0 0 40px rgba(99, 102, 241, 0.12);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transform: scale(0.94) translateY(12px);
  transition: transform 0.32s var(--pwa-ease);
}

.pwa-modal-overlay.active .pwa-modal-window {
  transform: scale(1) translateY(0);
}

/* ── Modal Header ── */
.pwa-modal-header {
  padding: 20px 24px 16px;
  border-bottom: 1px solid var(--pwa-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  background: var(--pwa-surface-subtle);
}

.pwa-modal-title-group {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1 1 auto;
  min-width: 0;
}

.pwa-modal-title-text {
  min-width: 0;
}

.pwa-modal-header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 0 0 auto;
}

.pwa-modal-app-icon {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.25);
  display: block;
}

.pwa-modal-title {
  margin: 0;
  font-family: var(--dusk-font-display, "Bricolage Grotesque", system-ui, sans-serif);
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--pwa-text-high);
  letter-spacing: -0.01em;
}

.pwa-modal-subtitle {
  margin: 2px 0 0;
  font-size: 0.82rem;
  color: var(--pwa-text-med);
  display: flex;
  align-items: center;
  gap: 6px;
}

.pwa-detected-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 10px;
  border-radius: 999px;
  background: rgba(16, 185, 129, 0.12);
  border: 1px solid rgba(16, 185, 129, 0.35);
  color: var(--pwa-accent);
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.pwa-detected-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--pwa-accent);
  box-shadow: 0 0 8px var(--pwa-accent);
  animation: pwa-pulse-dot 1.8s infinite;
}

@keyframes pwa-pulse-dot {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.4; transform: scale(0.85); }
}

.pwa-modal-close {
  background: var(--pwa-surface-subtle);
  border: 1px solid var(--pwa-border);
  color: var(--pwa-text-med);
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
  flex-shrink: 0;
}

.pwa-modal-close:hover {
  background: var(--pwa-primary);
  color: #fff;
  border-color: var(--pwa-primary);
  transform: rotate(90deg);
}

/* ── Direct 1-Click Install Banner (Chromium / Edge) ── */
.pwa-one-click-banner {
  margin: 16px 24px 0;
  padding: 14px 18px;
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.15), rgba(16, 185, 129, 0.12));
  border: 1px solid rgba(99, 102, 241, 0.35);
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  animation: pwa-banner-glow 3s infinite alternate;
}

@keyframes pwa-banner-glow {
  0% { box-shadow: 0 4px 16px rgba(99, 102, 241, 0.08); }
  100% { box-shadow: 0 6px 24px rgba(16, 185, 129, 0.18); }
}

.pwa-one-click-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.pwa-one-click-title {
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--pwa-text-high);
  display: flex;
  align-items: center;
  gap: 6px;
}

.pwa-one-click-desc {
  font-size: 0.8rem;
  color: var(--pwa-text-med);
}

.pwa-one-click-btn {
  background: linear-gradient(135deg, #6366f1, #4f46e5);
  color: #ffffff;
  border: none;
  border-radius: 999px;
  padding: 10px 22px;
  font-size: 0.88rem;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  box-shadow: 0 4px 16px rgba(99, 102, 241, 0.4);
  transition: all 0.2s ease;
  white-space: nowrap;
  flex-shrink: 0;
}

.pwa-one-click-btn:hover {
  transform: translateY(-1px) scale(1.02);
  box-shadow: 0 8px 24px rgba(99, 102, 241, 0.55);
}

/* ── Platform Switcher Tabs ── */
.pwa-tabs-section {
  padding: 16px 24px 0;
}

.pwa-device-tabs {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  flex-wrap: nowrap;
  padding-bottom: 8px;
  scrollbar-width: thin;
  -webkit-overflow-scrolling: touch;
}

.pwa-device-tab {
  background: var(--pwa-surface-subtle);
  border: 1px solid var(--pwa-border);
  color: var(--pwa-text-med);
  border-radius: 12px;
  padding: 8px 14px;
  font-size: 0.84rem;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: all 0.2s ease;
  white-space: nowrap;
  flex-shrink: 0;
  min-height: 0;
}

.pwa-device-tab:hover {
  background: rgba(99, 102, 241, 0.1);
  color: var(--pwa-text-high);
  border-color: rgba(99, 102, 241, 0.3);
}

.pwa-device-tab.active {
  background: var(--pwa-primary);
  color: #ffffff;
  border-color: var(--pwa-primary);
  box-shadow: 0 4px 14px var(--pwa-primary-glow);
}

.pwa-device-tab .pwa-tab-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--pwa-accent);
}

/* ── Brand icons (real logos, tinted by the chip's text colour) ── */
.pwa-tab-icon,
.pwa-pill-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  line-height: 1;
}

.pwa-brand-icon {
  display: block;
  width: 1em;
  height: 1em;
  fill: currentColor;
  overflow: visible;
}

.pwa-tab-icon {
  font-size: 1.12em;
  width: 1.12em;
  height: 1.12em;
}

.pwa-pill-icon {
  font-size: 1.05em;
  width: 1.05em;
  height: 1.05em;
}

.pwa-browser-pill {
  gap: 6px;
}

.pwa-tab-label,
.pwa-pill-label {
  white-space: nowrap;
}
/* ── Browser Sub-Pills ── */
.pwa-browser-pills {
  display: flex;
  gap: 6px;
  margin-top: 10px;
  overflow-x: auto;
  flex-wrap: nowrap;
  padding-bottom: 4px;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}

.pwa-browser-pills::-webkit-scrollbar {
  display: none;
}

.pwa-browser-pill {
  background: transparent;
  border: 1px solid var(--pwa-border);
  color: var(--pwa-text-low);
  border-radius: 999px;
  padding: 4px 12px;
  font-size: 0.76rem;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all 0.2s ease;
  white-space: nowrap;
  flex-shrink: 0;
  min-height: 0;
}

.pwa-browser-pill:hover {
  border-color: var(--pwa-text-med);
  color: var(--pwa-text-high);
}

.pwa-browser-pill.active {
  background: rgba(99, 102, 241, 0.14);
  border-color: var(--pwa-primary);
  color: var(--pwa-primary);
  font-weight: 700;
}

/* ── Modal Body / Content Layout ── */
.pwa-modal-body {
  padding: 16px 24px 24px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  flex: 1 1 auto;
  min-height: 0;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  align-items: start;
}


/* ── Steps Column ── */
.pwa-steps-container {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.pwa-step-card {
  background: var(--pwa-surface-card);
  border: 1px solid var(--pwa-border);
  border-radius: 16px;
  padding: 14px 16px;
  display: flex;
  gap: 14px;
  align-items: flex-start;
  transition: all 0.25s var(--pwa-ease);
  position: relative;
  overflow: hidden;
}

.pwa-step-card.active-step {
  border-color: var(--pwa-primary);
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.1), rgba(16, 185, 129, 0.05));
  box-shadow: 0 6px 20px rgba(99, 102, 241, 0.15);
}

.pwa-step-number {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--pwa-surface-subtle);
  border: 1px solid var(--pwa-border);
  color: var(--pwa-text-med);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
  font-weight: 800;
  flex-shrink: 0;
  transition: all 0.2s ease;
}

.pwa-step-card.active-step .pwa-step-number {
  background: var(--pwa-primary);
  border-color: var(--pwa-primary);
  color: #ffffff;
  box-shadow: 0 0 10px var(--pwa-primary-glow);
}

.pwa-step-content {
  flex: 1;
}

.pwa-step-title {
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--pwa-text-high);
  margin-bottom: 4px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.pwa-step-desc {
  font-size: 0.82rem;
  color: var(--pwa-text-med);
  line-height: 1.45;
  margin: 0;
}

.pwa-step-badge {
  display: inline-block;
  background: rgba(99, 102, 241, 0.16);
  border: 1px solid rgba(99, 102, 241, 0.4);
  color: var(--pwa-primary);
  font-family: monospace;
  font-size: 0.76rem;
  padding: 1px 6px;
  border-radius: 6px;
  margin: 0 2px;
}

/* ── Interactive Animation Column ── */
.pwa-animation-container {
  background: var(--pwa-surface-card);
  border: 1px solid var(--pwa-border);
  border-radius: 20px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 392px;
  padding-top: 40px;
  position: relative;
  overflow: hidden;
}

.pwa-animation-label {
  position: absolute;
  top: 12px;
  left: 14px;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--pwa-text-low);
  display: flex;
  align-items: center;
  gap: 6px;
}

.pwa-animation-label::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--pwa-accent);
  box-shadow: 0 0 6px var(--pwa-accent);
}

/* ═══════════════════════════════════════════════════════════════════════════
 * DEVICE CSS MOCKUPS & ANIMATIONS
 * ═══════════════════════════════════════════════════════════════════════════ */

/* ── 1. Phone Frame (iOS / Android) ── */
.pwa-phone-mockup {
  width: 210px;
  height: 330px;
  background: var(--pwa-phone-bezel);
  border-radius: 36px;
  padding: 8px;
  box-shadow: 0 16px 36px rgba(0, 0, 0, 0.45), inset 0 0 0 2px rgba(255, 255, 255, 0.1);
  display: flex;
  flex-direction: column;
  position: relative;
}

.pwa-phone-screen-content {
  flex: 1;
  background: var(--pwa-phone-screen);
  border-radius: 28px;
  display: flex;
  flex-direction: column;
  position: relative;
  overflow: hidden;
}

/* Notch / Dynamic Island */
.pwa-phone-notch {
  width: 64px;
  height: 12px;
  background: var(--pwa-phone-bezel);
  border-radius: 0 0 10px 10px;
  margin: 0 auto;
  z-index: 10;
}

/* Web content mock */
.pwa-mock-webpage {
  flex: 1;
  padding: 12px 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.pwa-mock-hero-bar {
  height: 24px;
  background: linear-gradient(90deg, #6366f1, #8b5cf6);
  border-radius: 8px;
  display: flex;
  align-items: center;
  padding: 0 8px;
}

.pwa-mock-hero-text {
  width: 60px;
  height: 6px;
  background: rgba(255, 255, 255, 0.8);
  border-radius: 3px;
}

.pwa-mock-lines {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 6px;
}

.pwa-mock-line {
  height: 6px;
  background: var(--pwa-surface-subtle);
  border-radius: 3px;
}
.pwa-mock-line.w80 { width: 80%; }
.pwa-mock-line.w60 { width: 60%; }
.pwa-mock-line.w90 { width: 90%; }

/* ── Apple SF Symbol Share Icon ── */
.pwa-apple-share-icon {
  display: inline-block;
  vertical-align: -2px;
  stroke: currentColor;
  fill: none;
  flex-shrink: 0;
  transition: transform 0.2s ease, stroke 0.2s ease;
}

/* ── 1. iOS Safari (iPhone) Mockup & Animations ── */
.pwa-ios-toolbar {
  height: 40px;
  background: rgba(20, 24, 38, 0.95);
  backdrop-filter: blur(8px);
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  display: flex;
  align-items: center;
  justify-content: space-around;
  padding: 0 6px;
  position: relative;
  z-index: 5;
}

.pwa-ios-icon {
  color: #94a3b8;
  font-size: 13px;
  position: relative;
}

.pwa-ios-share-btn {
  width: 30px;
  height: 30px;
  border-radius: 7px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #38bdf8;
  position: relative;
  background: rgba(56, 189, 248, 0.12);
  border: 1px solid rgba(56, 189, 248, 0.3);
  animation: pwa-ios-btn-tap 5.5s infinite;
}

@keyframes pwa-ios-btn-tap {
  0%, 18% { transform: scale(1); background: rgba(56, 189, 248, 0.12); }
  22%, 26% { transform: scale(0.86); background: rgba(56, 189, 248, 0.45); box-shadow: 0 0 10px rgba(56, 189, 248, 0.7); }
  30%, 100% { transform: scale(1); background: rgba(56, 189, 248, 0.12); }
}

/* Pulsing Aura on target */
.pwa-pulse-target {
  animation: pwa-halo-pulse 2s infinite;
}

@keyframes pwa-halo-pulse {
  0% {
    box-shadow: 0 0 0 0 rgba(56, 189, 248, 0.8), 0 0 10px rgba(99, 102, 241, 0.6);
    background: rgba(56, 189, 248, 0.25);
  }
  70% {
    box-shadow: 0 0 0 12px rgba(56, 189, 248, 0), 0 0 20px rgba(99, 102, 241, 0);
    background: rgba(56, 189, 248, 0.1);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(56, 189, 248, 0);
    background: transparent;
  }
}

/* iOS Simulated Action Sheet */
.pwa-ios-sheet {
  position: absolute;
  left: 6px;
  right: 6px;
  bottom: 44px;
  background: rgba(30, 41, 59, 0.98);
  backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 14px;
  padding: 8px;
  z-index: 20;
  box-shadow: 0 -8px 26px rgba(0, 0, 0, 0.6);
  animation: pwa-sheet-slide 5.5s infinite cubic-bezier(0.16, 1, 0.3, 1);
}

.pwa-ios-sheet-handle {
  width: 28px;
  height: 3.5px;
  background: rgba(255, 255, 255, 0.35);
  border-radius: 2px;
  margin: 0 auto 6px;
}

.pwa-ios-sheet-header {
  display: flex;
  align-items: center;
  gap: 6px;
  padding-bottom: 6px;
  margin-bottom: 6px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.pwa-ios-sheet-thumb {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: transparent;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  filter: drop-shadow(0 2px 5px rgba(0, 0, 0, 0.3));
}

.pwa-ios-sheet-title {
  display: flex;
  flex-direction: column;
  line-height: 1.1;
  font-size: 9px;
  color: #e2e8f0;
}

.pwa-ios-sheet-title span {
  font-size: 7.5px;
  color: #94a3b8;
}

@keyframes pwa-sheet-slide {
  0%, 25% { transform: translateY(125%); opacity: 0; }
  32%, 86% { transform: translateY(0); opacity: 1; }
  94%, 100% { transform: translateY(125%); opacity: 0; }
}

.pwa-ios-sheet-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 10px;
  border-radius: 8px;
  font-size: 10px;
  font-weight: 600;
  color: #f1f5f9;
}

.pwa-ios-sheet-item.highlight {
  background: rgba(99, 102, 241, 0.3);
  border: 1px solid rgba(99, 102, 241, 0.6);
  color: #ffffff;
  animation: pwa-item-glow 5.5s infinite;
}

@keyframes pwa-item-glow {
  0%, 50% { box-shadow: 0 0 0 0 rgba(99, 102, 241, 0.4); background: rgba(99, 102, 241, 0.3); }
  54%, 82% { box-shadow: 0 0 14px 2px rgba(56, 189, 248, 0.8); background: rgba(99, 102, 241, 0.7); }
  90%, 100% { box-shadow: 0 0 0 0 rgba(99, 102, 241, 0.4); background: rgba(99, 102, 241, 0.3); }
}

/* Animated Tap Finger for iPhone (Synchronized 2-step: Share then Add) */
.pwa-tap-finger,
.pwa-iphone-tap-finger {
  position: absolute;
  width: 24px;
  height: 24px;
  pointer-events: none;
  z-index: 30;
  bottom: 8px;
  left: 50%;
  margin-left: -12px;
  animation: pwa-iphone-sequence 5.5s infinite cubic-bezier(0.25, 1, 0.5, 1);
}

.pwa-tap-finger::after,
.pwa-iphone-tap-finger::after {
  content: '👆';
  font-size: 22px;
  display: block;
  transform: rotate(-15deg);
  filter: drop-shadow(0 4px 8px rgba(0,0,0,0.6));
}

@keyframes pwa-iphone-sequence {
  0% { opacity: 0; transform: translate(14px, 28px) scale(0.9); }
  14% { opacity: 1; transform: translate(0, 0) scale(1); }
  22% { transform: translate(0, 3px) scale(0.82); }
  28% { transform: translate(0, 0) scale(1); }
  38% { transform: translate(0, -78px) scale(1); }
  52% { transform: translate(0, -75px) scale(0.82); }
  58% { transform: translate(0, -78px) scale(1); }
  75% { opacity: 1; transform: translate(0, -78px) scale(1); }
  88%, 100% { opacity: 0; transform: translate(12px, -65px) scale(0.9); }
}

/* ── 1B. Apple iPad Tablet Mockup & Top-Right Toolbar ── */
.pwa-ipad-mockup {
  width: 250px;
  height: 174px;
  background: #0f172a;
  border-radius: 16px;
  border: 4px solid #334155;
  box-shadow: 0 14px 34px rgba(0, 0, 0, 0.5), inset 0 0 0 1px rgba(255, 255, 255, 0.08);
  position: relative;
  display: flex;
  flex-direction: column;
  box-sizing: border-box;
}

.pwa-ipad-camera {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: #1e293b;
  margin: 3px auto 2px;
  box-shadow: inset 0 0 2px rgba(0,0,0,0.8);
}

.pwa-ipad-screen {
  flex: 1;
  margin: 0 4px 4px;
  background: #020617;
  border-radius: 10px;
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.pwa-ipad-toolbar {
  height: 32px;
  background: rgba(30, 41, 59, 0.95);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 8px;
  font-size: 11px;
  z-index: 5;
}

.pwa-ipad-nav-group,
.pwa-ipad-actions-group {
  display: flex;
  align-items: center;
  gap: 8px;
}

.pwa-ipad-tool-icon {
  color: #94a3b8;
  font-size: 11px;
}

.pwa-ipad-url-capsule {
  background: rgba(15, 23, 42, 0.85);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 6px;
  padding: 2px 8px;
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 9px;
  color: #cbd5e1;
}

.pwa-ipad-url-text {
  font-family: monospace;
}

.pwa-ipad-reload {
  font-size: 9px;
  color: #64748b;
}

/* iPad Top-Right Share Button */
.pwa-ipad-share-btn {
  width: 24px;
  height: 24px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #38bdf8;
  background: rgba(56, 189, 248, 0.12);
  border: 1px solid rgba(56, 189, 248, 0.3);
  position: relative;
  animation: pwa-ipad-btn-tap 5.5s infinite;
}

@keyframes pwa-ipad-btn-tap {
  0%, 18% { transform: scale(1); background: rgba(56, 189, 248, 0.12); }
  22%, 26% { transform: scale(0.86); background: rgba(56, 189, 248, 0.45); box-shadow: 0 0 10px rgba(56, 189, 248, 0.7); }
  30%, 100% { transform: scale(1); background: rgba(56, 189, 248, 0.12); }
}

.pwa-ipad-body {
  flex: 1;
  position: relative;
  overflow: hidden;
  padding: 6px;
}

/* iPad Floating Action Popover under Top-Right Share Button */
.pwa-ipad-popover {
  position: absolute;
  top: 4px;
  right: 6px;
  width: 146px;
  background: rgba(30, 41, 59, 0.98);
  backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 10px;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.65);
  z-index: 20;
  padding: 6px;
  animation: pwa-ipad-popover-anim 5.5s infinite cubic-bezier(0.16, 1, 0.3, 1);
}

.pwa-ipad-popover-arrow {
  position: absolute;
  top: -6px;
  right: 18px;
  width: 0;
  height: 0;
  border-left: 6px solid transparent;
  border-right: 6px solid transparent;
  border-bottom: 6px solid rgba(30, 41, 59, 0.98);
}

.pwa-ipad-popover-header {
  display: flex;
  align-items: center;
  gap: 6px;
  padding-bottom: 4px;
  margin-bottom: 4px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.pwa-ipad-popover-thumb {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: transparent;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.3));
}

.pwa-ipad-popover-meta {
  display: flex;
  flex-direction: column;
  line-height: 1.1;
  font-size: 8.5px;
  color: #e2e8f0;
}

.pwa-ipad-popover-meta span {
  font-size: 7px;
  color: #94a3b8;
}

.pwa-ipad-popover-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 4px 6px;
  border-radius: 6px;
  font-size: 8.5px;
  font-weight: 600;
  color: #f1f5f9;
}

.pwa-ipad-popover-item.highlight {
  background: rgba(99, 102, 241, 0.35);
  border: 1px solid rgba(99, 102, 241, 0.7);
  color: #ffffff;
  animation: pwa-item-glow 5.5s infinite;
}

.pwa-popover-tag {
  font-size: 7.5px;
  background: #6366f1;
  color: #fff;
  padding: 1px 4px;
  border-radius: 3px;
  font-weight: 700;
}

@keyframes pwa-ipad-popover-anim {
  0%, 25% { transform: translateY(-8px) scale(0.9); opacity: 0; }
  32%, 86% { transform: translateY(0) scale(1); opacity: 1; }
  94%, 100% { transform: translateY(-8px) scale(0.9); opacity: 0; }
}

/* iPad Tap Finger Animation */
.pwa-ipad-tap-finger {
  position: absolute;
  top: 14px;
  right: 18px;
  width: 24px;
  height: 24px;
  pointer-events: none;
  z-index: 30;
  animation: pwa-ipad-finger-sequence 5.5s infinite cubic-bezier(0.25, 1, 0.5, 1);
}

.pwa-ipad-tap-finger::after {
  content: '👆';
  font-size: 20px;
  display: block;
  transform: rotate(-15deg);
  filter: drop-shadow(0 4px 8px rgba(0,0,0,0.6));
}

@keyframes pwa-ipad-finger-sequence {
  0% { opacity: 0; transform: translate(16px, -18px) scale(0.9); }
  14% { opacity: 1; transform: translate(0, 0) scale(1); }
  22% { transform: translate(0, 3px) scale(0.82); }
  28% { transform: translate(0, 0) scale(1); }
  38% { transform: translate(-38px, 48px) scale(1); }
  52% { transform: translate(-38px, 51px) scale(0.82); }
  58% { transform: translate(-38px, 48px) scale(1); }
  75% { opacity: 1; transform: translate(-38px, 48px) scale(1); }
  88%, 100% { opacity: 0; transform: translate(-25px, 35px) scale(0.9); }
}

/* ── 2. Android Chrome Mockup ── */
.pwa-android-bar {
  height: 38px;
  background: #1e293b;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 10px;
  font-size: 11px;
}

.pwa-android-url {
  background: rgba(0, 0, 0, 0.3);
  padding: 3px 10px;
  border-radius: 12px;
  color: #94a3b8;
  font-size: 9px;
  width: 120px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.pwa-android-dots {
  color: #f8fafc;
  font-size: 14px;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
}

.pwa-android-menu {
  position: absolute;
  top: 42px;
  right: 8px;
  width: 140px;
  background: #1e293b;
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 10px;
  box-shadow: 0 10px 25px rgba(0,0,0,0.5);
  padding: 6px;
  z-index: 25;
  animation: pwa-menu-drop 4s infinite cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes pwa-menu-drop {
  0%, 25% { transform: scale(0.8) translateY(-10px); opacity: 0; }
  35%, 85% { transform: scale(1) translateY(0); opacity: 1; }
  95%, 100% { transform: scale(0.8) translateY(-10px); opacity: 0; }
}

.pwa-android-menu-item {
  padding: 5px 8px;
  font-size: 10px;
  color: #cbd5e1;
  display: flex;
  align-items: center;
  gap: 6px;
  border-radius: 6px;
}

.pwa-android-menu-item.highlight {
  background: rgba(16, 185, 129, 0.25);
  color: #10b981;
  font-weight: 700;
  border: 1px solid rgba(16, 185, 129, 0.4);
}

/* ── 3. Desktop Browser Window (Chrome / Edge / Safari Desktop) ── */
.pwa-desktop-mockup {
  width: 290px;
  background: #0f172a;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 12px;
  box-shadow: 0 16px 36px rgba(0, 0, 0, 0.5);
  overflow: hidden;
  position: relative;
}

.pwa-desktop-header {
  height: 32px;
  background: #1e293b;
  display: flex;
  align-items: center;
  padding: 0 10px;
  gap: 8px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.pwa-desktop-traffic-lights {
  display: flex;
  gap: 4px;
}

.pwa-desktop-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
}
.pwa-desktop-dot.red { background: #ef4444; }
.pwa-desktop-dot.yellow { background: #f59e0b; }
.pwa-desktop-dot.green { background: #10b981; }

.pwa-desktop-omnibox {
  flex: 1;
  height: 20px;
  background: rgba(0, 0, 0, 0.35);
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 8px;
  font-size: 9px;
  color: #94a3b8;
}

.pwa-desktop-install-icon {
  width: 18px;
  height: 18px;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #38bdf8;
  font-size: 10px;
}

/* Desktop Install Modal Dropdown */
.pwa-desktop-prompt {
  position: absolute;
  top: 36px;
  right: 18px;
  width: 170px;
  background: #1e293b;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 10px;
  padding: 10px;
  box-shadow: 0 12px 30px rgba(0,0,0,0.6);
  z-index: 25;
  animation: pwa-desktop-dialog 4s infinite cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes pwa-desktop-dialog {
  0%, 25% { transform: translateY(-8px); opacity: 0; }
  35%, 85% { transform: translateY(0); opacity: 1; }
  95%, 100% { transform: translateY(-8px); opacity: 0; }
}

.pwa-desktop-prompt-header {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 8px;
}

.pwa-desktop-prompt-icon {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: transparent;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.pwa-desktop-prompt-title {
  font-size: 9px;
  font-weight: 700;
  color: #ffffff;
}

.pwa-desktop-prompt-btn {
  background: #6366f1;
  color: #ffffff;
  border: none;
  border-radius: 6px;
  padding: 4px 10px;
  font-size: 9px;
  font-weight: 700;
  width: 100%;
  cursor: pointer;
  display: block;
  text-align: center;
}

/* Desktop body preview */
.pwa-desktop-body {
  height: 140px;
  background: #090d16;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* Mouse pointer animation */
.pwa-mouse-cursor {
  position: absolute;
  width: 16px;
  height: 16px;
  pointer-events: none;
  z-index: 30;
  animation: pwa-mouse-move 4s infinite cubic-bezier(0.25, 1, 0.5, 1);
}

.pwa-mouse-cursor::after {
  content: '↖';
  font-size: 18px;
  font-weight: bold;
  color: #ffffff;
  display: block;
  filter: drop-shadow(0 2px 4px rgba(0,0,0,0.8));
}

@keyframes pwa-mouse-move {
  0% { opacity: 0; transform: translate(50px, 80px); }
  25% { opacity: 1; transform: translate(18px, 14px); }
  35% { transform: translate(18px, 14px) scale(0.9); }
  45% { transform: translate(18px, 14px) scale(1); }
  75% { opacity: 1; transform: translate(18px, 14px); }
  90%, 100% { opacity: 0; transform: translate(50px, 80px); }
}

/* ── 4. macOS Dock Bounce Animation ── */
.pwa-mac-dock {
  height: 38px;
  background: rgba(255, 255, 255, 0.15);
  backdrop-filter: blur(12px);
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 10px;
  margin-top: 14px;
}

.pwa-dock-icon {
  width: 24px;
  height: 24px;
  border-radius: 6px;
  background: transparent;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
}

.pwa-dock-icon.pwa-dock-finder {
  border-radius: 6px;
  overflow: hidden;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.35);
}

.pwa-dock-icon.pwa-dock-safari {
  border-radius: 50%;
  overflow: hidden;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.35);
}

.pwa-dock-icon.jlearn-bounce {
  background: transparent;
  animation: pwa-dock-bounce 4s infinite cubic-bezier(0.16, 1, 0.3, 1);
  filter: drop-shadow(0 4px 10px rgba(99, 102, 241, 0.5));
}

@keyframes pwa-dock-bounce {
  0%, 40% { transform: translateY(0); opacity: 0.3; }
  50% { transform: translateY(-16px) scale(1.1); opacity: 1; }
  60% { transform: translateY(0) scale(1); }
  70% { transform: translateY(-8px); }
  80%, 100% { transform: translateY(0); }
}

/* ── 5. Unclosable Mandatory Student Mode ── */
.pwa-modal-overlay.pwa-modal-unclosable .pwa-modal-close {
  display: none !important;
}


/* ── Discrete PWA Bypass at the Bottom of Scrollable Body (Not in Sticky Footer) ── */
.pwa-bypass-section {
  display: flex;
  justify-content: center;
  align-items: center;
  width: 100%;
  margin-top: 16px;
  margin-bottom: 6px;
  grid-column: 1 / -1;
  opacity: 0.45;
  transition: opacity 0.25s ease;
}

.pwa-bypass-section:hover,
.pwa-bypass-section:focus-within {
  opacity: 1;
}

.pwa-bypass-container {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 999px;
  padding: 2.5px 4px 2.5px 9px;
  transition: all 0.2s ease;
}

.pwa-bypass-icon {
  font-size: 0.65rem;
  color: var(--pwa-text-low);
  opacity: 0.7;
}

.pwa-bypass-container:focus-within {
  border-color: rgba(99, 102, 241, 0.45);
  box-shadow: 0 0 10px rgba(99, 102, 241, 0.2);
  background: rgba(255, 255, 255, 0.06);
}

#pwaInstallGuideModal input.pwa-bypass-input,
#pwaInstallGuideModal .pwa-bypass-container input[type="password"] {
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
  border-radius: 0 !important;
  outline: none !important;
  color: var(--pwa-text-high) !important;
  font-size: 0.72rem !important;
  width: 76px !important;
  height: 24px !important;
  min-height: 24px !important;
  max-height: 24px !important;
  padding: 0 4px !important;
  margin: 0 !important;
  letter-spacing: 0.04em;
}

.pwa-bypass-input::placeholder {
  color: var(--pwa-text-low) !important;
  font-size: 0.66rem !important;
  opacity: 0.7;
  letter-spacing: 0;
}

.pwa-bypass-input.error {
  color: #f87171 !important;
}

.pwa-bypass-input.error::placeholder {
  color: #f87171 !important;
}

.pwa-bypass-btn {
  background: rgba(99, 102, 241, 0.16);
  border: 1px solid rgba(99, 102, 241, 0.32);
  color: #a5b4fc;
  font-size: 0.66rem;
  font-weight: 700;
  padding: 2.5px 8px;
  border-radius: 999px;
  cursor: pointer;
  min-height: 0 !important;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.pwa-bypass-btn:hover {
  background: var(--pwa-primary);
  color: #ffffff;
  border-color: var(--pwa-primary);
}

[data-theme="light"] .pwa-bypass-container {
  background: rgba(15, 23, 42, 0.03);
  border-color: rgba(15, 23, 42, 0.1);
}

[data-theme="light"] .pwa-bypass-container:focus-within {
  background: rgba(15, 23, 42, 0.06);
  border-color: rgba(79, 70, 229, 0.4);
}

[data-theme="light"] .pwa-bypass-input {
  color: #0f172a !important;
}

[data-theme="light"] .pwa-bypass-btn {
  background: rgba(79, 70, 229, 0.1);
  border-color: rgba(79, 70, 229, 0.3);
  color: #4338ca;
}

[data-theme="light"] .pwa-bypass-btn:hover {
  background: #4f46e5;
  color: #ffffff;
}

/* ── Back to Home Navigation & Modal Footer ── */
.pwa-modal-footer {
  padding: 14px 24px;
  border-top: 1px solid var(--pwa-border);
  background: var(--pwa-surface-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.pwa-footer-note {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.8rem;
  color: var(--pwa-text-med);
  line-height: 1.4;
}

.pwa-footer-note i {
  font-size: 0.95rem;
  flex-shrink: 0;
}

.pwa-back-home-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.2), rgba(99, 102, 241, 0.1));
  border: 1px solid rgba(99, 102, 241, 0.45);
  color: #ffffff;
  text-decoration: none;
  font-size: 0.88rem;
  font-weight: 700;
  padding: 9px 20px;
  border-radius: 999px;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.25);
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  white-space: nowrap;
  flex-shrink: 0;
}

.pwa-back-home-btn:hover {
  background: linear-gradient(135deg, #6366f1, #4f46e5);
  border-color: #6366f1;
  color: #ffffff;
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(99, 102, 241, 0.4);
}

.pwa-back-home-btn i {
  font-size: 0.82rem;
  transition: transform 0.2s ease;
}

.pwa-back-home-btn:hover i {
  transform: translateX(-3px);
}

[data-theme="light"] .pwa-back-home-btn {
  background: linear-gradient(135deg, #4f46e5, #4338ca) !important;
  color: #ffffff !important;
  border-color: #4338ca !important;
  box-shadow: 0 4px 14px rgba(79, 70, 229, 0.3) !important;
}

/* ── 6. Standalone PWA Mode: Completely Hide All Install Guides & Buttons ── */
@media all and (display-mode: standalone) {
  [data-pwa-install],
  [data-ios-install],
  .lp-dusk-install-pill,
  #student-pwa-gate-banner,
  .pwa-student-gate-card,
  #jl-ios-pwa-banner,
  .pwa-modal-overlay {
    display: none !important;
    visibility: hidden !important;
    pointer-events: none !important;
  }
}

html.is-pwa-standalone [data-pwa-install],
html.is-pwa-standalone [data-ios-install],
html.is-pwa-standalone .lp-dusk-install-pill,
html.is-pwa-standalone #student-pwa-gate-banner,
html.is-pwa-standalone .pwa-student-gate-card,
html.is-pwa-standalone #jl-ios-pwa-banner,
html.is-pwa-standalone .pwa-modal-overlay {
  display: none !important;
  visibility: hidden !important;
  pointer-events: none !important;
}

/* ═══════════════════════════════════════════════════════════════════════════
 * RESPONSIVE LAYOUT (kept last so these rules override the base styles above)
 * ═══════════════════════════════════════════════════════════════════════════ */

@media (max-width: 768px) {
  .pwa-modal-overlay {
    padding: 8px;
    padding-bottom: max(10px, env(safe-area-inset-bottom, 10px));
  }
  .pwa-modal-window {
    border-radius: 20px;
    max-height: min(92vh, 92dvh);
    display: flex;
    flex-direction: column;
    overflow: hidden;
  }
  .pwa-modal-header {
    flex-shrink: 0;
    padding: 13px 16px 11px;
    gap: 10px;
  }
  .pwa-modal-title {
    font-size: 1.05rem;
  }
  .pwa-modal-subtitle {
    font-size: 0.76rem;
  }
  .pwa-modal-app-icon {
    width: 36px;
    height: 36px;
    border-radius: 10px;
  }
  .pwa-modal-close {
    width: 32px;
    height: 32px;
    font-size: 0.9rem;
  }

  /* ── Tabs section: compact, sleek, scaled-down for mobile ── */
  .pwa-tabs-section {
    flex-shrink: 0;
    padding: 6px 12px 4px;
    background: var(--pwa-surface);
    border-bottom: 1px solid var(--pwa-border);
    position: relative;
    z-index: 2;
  }
  .pwa-device-tabs {
    display: flex;
    gap: 5px;
    overflow-x: auto;
    overflow-y: hidden;
    flex-wrap: nowrap;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior-x: contain;
    touch-action: pan-x;
    scroll-snap-type: x proximity;
    scrollbar-width: none;
    padding: 1px 1px 3px;
    margin: -1px -1px 0;
  }
  .pwa-device-tabs::-webkit-scrollbar {
    display: none;
  }
  .pwa-device-tab {
    flex: 0 0 auto;
    white-space: nowrap;
    padding: 4px 9px;
    font-size: 0.73rem;
    line-height: 1.1;
    border-radius: 999px;
    scroll-snap-align: center;
    gap: 5px;
    min-height: 0 !important;
    height: auto;
  }
  .pwa-tab-icon {
    font-size: 0.95em;
    width: 0.95em;
    height: 0.95em;
  }
  .pwa-device-tab .pwa-tab-dot {
    width: 5px;
    height: 5px;
    flex-shrink: 0;
  }
  .pwa-browser-pills {
    display: flex;
    gap: 4px;
    margin-top: 4px;
    overflow-x: auto;
    overflow-y: hidden;
    flex-wrap: nowrap;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior-x: contain;
    touch-action: pan-x;
    scroll-snap-type: x proximity;
    scrollbar-width: none;
    padding: 1px 1px 2px;
    margin-left: -1px;
    margin-right: -1px;
  }
  .pwa-browser-pills::-webkit-scrollbar {
    display: none;
  }
  .pwa-browser-pill {
    flex: 0 0 auto;
    white-space: nowrap;
    padding: 2.5px 8px;
    font-size: 0.68rem;
    line-height: 1.15;
    scroll-snap-align: center;
    gap: 4px;
    min-height: 0 !important;
    height: auto;
  }
  .pwa-pill-icon {
    font-size: 0.9em;
    width: 0.9em;
    height: 0.9em;
  }

  .pwa-one-click-banner {
    flex-shrink: 0;
    margin: 8px 14px 0;
    padding: 10px 14px;
    border-radius: 12px;
    flex-direction: column;
    align-items: stretch;
  }

  /* ── Body: the only scrolling region; children never squash ── */
  .pwa-modal-body {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 14px;
    padding: 12px 14px 20px;
    padding-bottom: max(20px, calc(16px + env(safe-area-inset-bottom, 0px)));
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior-y: contain;
    touch-action: pan-y;
    scroll-behavior: smooth;
    scroll-padding-block: 12px;
    scrollbar-width: thin;
  }
  .pwa-steps-container {
    flex: 0 0 auto;
    width: 100%;
  }
  .pwa-animation-container {
    flex: 0 0 auto;
    width: 100%;
    margin-left: auto;
    margin-right: auto;
    box-sizing: border-box;
  }
  .pwa-steps-container {
    gap: 10px;
  }
  .pwa-step-card {
    padding: 10px 12px;
    gap: 10px;
    border-radius: 14px;
    scroll-margin-top: 8px;
  }
  .pwa-step-number {
    width: 24px;
    height: 24px;
    font-size: 0.75rem;
  }
  .pwa-step-title {
    font-size: 0.86rem;
    margin-bottom: 2px;
    overflow-wrap: anywhere;
  }
  .pwa-step-desc {
    font-size: 0.78rem;
    line-height: 1.45;
    overflow-wrap: anywhere;
  }
  .pwa-step-badge {
    white-space: normal;
    overflow-wrap: anywhere;
  }
  .pwa-animation-container {
    /* Height is the scaled mockup height + padding + border so the transform
       never gets clipped by overflow: hidden. Phone mockup is 330px tall.
       Top padding reserves room for the absolute .pwa-animation-label. */
    height: 320px;
    min-height: 320px;
    max-height: 320px;
    padding: 28px 12px 12px;
    border-radius: 16px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
  }
  .pwa-animation-label {
    left: 50% !important;
    right: auto !important;
    transform: translateX(-50%) !important;
    white-space: nowrap !important;
    text-align: center !important;
    justify-content: center !important;
  }
  .pwa-phone-mockup {
    max-width: 100%;
    transform: scale(0.82);
    transform-origin: center center;
    margin: -24px 0;
  }
  .pwa-ipad-mockup {
    max-width: 100%;
    transform: scale(0.82);
    transform-origin: center center;
  }
  .pwa-desktop-mockup {
    max-width: 100%;
    transform: scale(0.88);
    transform-origin: center center;
    margin: -12px 0;
  }
  .pwa-modal-footer {
    flex-shrink: 0;
    padding: 10px 14px;
    padding-bottom: max(10px, env(safe-area-inset-bottom, 10px));
    flex-direction: column-reverse;
    align-items: stretch;
    gap: 8px;
  }
  .pwa-back-home-btn {
    width: 100%;
    padding: 9px 16px;
    font-size: 0.86rem;
  }
  .pwa-footer-note {
    font-size: 0.75rem;
    justify-content: center;
    text-align: center;
  }
}

@media (max-width: 480px) {
  .pwa-modal-overlay {
    padding: 6px;
  }
  .pwa-modal-window {
    border-radius: 16px;
    max-height: min(94vh, 94dvh);
  }
  .pwa-modal-header {
    padding: 10px 13px;
    gap: 8px;
  }
  .pwa-modal-title {
    font-size: 0.98rem;
  }
  .pwa-modal-subtitle {
    font-size: 0.72rem;
  }
  .pwa-modal-app-icon {
    width: 32px;
    height: 32px;
  }
  .pwa-modal-close {
    width: 30px;
    height: 30px;
    font-size: 0.84rem;
  }
  .pwa-tabs-section {
    padding: 5px 10px 3px;
  }
  .pwa-device-tabs {
    gap: 4px;
    padding-bottom: 3px;
  }
  .pwa-device-tab {
    padding: 3.5px 8px;
    font-size: 0.70rem;
    gap: 4px;
  }
  .pwa-browser-pills {
    margin-top: 3px;
    gap: 3px;
    padding-bottom: 2px;
  }
  .pwa-browser-pill {
    padding: 2px 7px;
    font-size: 0.65rem;
    gap: 3px;
  }
  .pwa-one-click-banner {
    margin: 6px 12px 0;
    padding: 8px 12px;
  }
  .pwa-modal-body {
    padding: 10px 12px 16px;
    padding-bottom: max(16px, calc(12px + env(safe-area-inset-bottom, 0px)));
    gap: 12px;
  }
  .pwa-step-card {
    padding: 9px 11px;
    gap: 9px;
    border-radius: 12px;
  }
  .pwa-step-number {
    width: 22px;
    height: 22px;
    font-size: 0.72rem;
  }
  .pwa-step-title {
    font-size: 0.84rem;
  }
  .pwa-step-desc {
    font-size: 0.76rem;
  }
  .pwa-detected-badge {
    display: none; /* Hide auto-detected badge on ultra-narrow screens to keep header clean */
  }
  .pwa-animation-label {
    font-size: 0.62rem;
    letter-spacing: 0.04em;
    white-space: nowrap;
    top: 10px;
    left: 50% !important;
    transform: translateX(-50%) !important;
    text-align: center;
    justify-content: center;
  }
  .pwa-phone-mockup {
    transform: scale(0.72);
    margin: -32px 0;
  }
  .pwa-ipad-mockup {
    transform: scale(0.72);
  }
  .pwa-desktop-mockup {
    transform: scale(0.82);
    margin: -18px 0;
  }
  .pwa-animation-container {
    height: 290px;
    min-height: 290px;
    max-height: 290px;
  }
}

@media (max-width: 360px) {
  .pwa-modal-overlay {
    padding: 4px;
  }
  .pwa-tabs-section {
    padding: 4px 8px 3px;
  }
  .pwa-device-tab {
    padding: 3px 7px;
    font-size: 0.67rem;
    gap: 3px;
  }
  .pwa-browser-pill {
    padding: 2px 6px;
    font-size: 0.63rem;
    gap: 3px;
  }
  .pwa-step-card {
    padding: 8px 10px;
    gap: 8px;
  }
  .pwa-phone-mockup {
    transform: scale(0.7);
    margin: -40px 0;
  }
  .pwa-ipad-mockup {
    transform: scale(0.7);
  }
  .pwa-desktop-mockup {
    transform: scale(0.76);
    margin: -24px 0;
  }
  .pwa-animation-container {
    height: 280px;
    min-height: 280px;
    max-height: 280px;
  }
}

/* Landscape phones / very short windows: give the scrolling body room. */
@media (max-height: 520px) and (max-width: 900px) {
  .pwa-modal-overlay {
    padding: 4px;
  }
  .pwa-modal-window {
    max-height: calc(100vh - 8px);
    max-height: calc(100dvh - 8px);
    border-radius: 14px;
  }
  .pwa-modal-header {
    padding: 8px 12px;
  }
  .pwa-modal-app-icon {
    width: 28px;
    height: 28px;
  }
  .pwa-modal-title {
    font-size: 0.92rem;
  }
  .pwa-modal-subtitle {
    font-size: 0.7rem;
  }
  .pwa-tabs-section {
    padding: 4px 12px 2px;
  }
  .pwa-modal-body {
    padding: 8px 12px 12px;
    gap: 10px;
  }
  .pwa-modal-footer {
    padding: 8px 12px;
  }
  .pwa-animation-container {
    height: 220px;
    min-height: 220px;
    max-height: 220px;
    padding: 8px;
  }
  .pwa-phone-mockup {
    transform: scale(0.6);
    margin: -66px 0;
  }
  .pwa-ipad-mockup {
    transform: scale(0.66);
  }
  .pwa-desktop-mockup {
    transform: scale(0.72);
    margin: -30px 0;
  }
}

/* Short phones: the student-portal "Back to Home" footer steals ~100px, so
   drop the secondary note and tighten the footer. This keeps the whole mockup
   visible inside the scrolling body at 320×568. */
@media (max-height: 620px) and (max-width: 480px) {
  .pwa-modal-footer {
    padding: 8px 12px;
    padding-bottom: max(8px, env(safe-area-inset-bottom, 8px));
    gap: 0;
  }
  .pwa-footer-note {
    display: none;
  }
  .pwa-back-home-btn {
    padding: 8px 14px;
    font-size: 0.82rem;
  }
  .pwa-animation-container {
    height: 260px;
    min-height: 260px;
    max-height: 260px;
  }
  .pwa-phone-mockup {
    transform: scale(0.66);
    margin: -58px 0;
  }
}

/* Standard header on phones (normal AND unclosable student modal): one-line
   title and subtitle that ellipsize instead of wrapping, so the header is the
   same height in both modes. The footer already carries "Back to Home". */
@media (max-width: 768px) {
  .pwa-modal-title,
  .pwa-modal-subtitle {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
  }
  .pwa-modal-subtitle > span {
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .pwa-modal-unclosable   .pwa-modal-unclosable .pwa-footer-note {
    display: none;
  }
  .pwa-modal-unclosable .pwa-modal-footer {
    padding-top: 8px;
    padding-bottom: max(8px, env(safe-area-inset-bottom, 8px));
    gap: 0;
  }
  .pwa-modal-unclosable .pwa-back-home-btn {
    padding: 8px 14px;
    font-size: 0.84rem;
  }
  .pwa-modal-unclosable .pwa-animation-container {
    height: 280px;
    min-height: 280px;
    max-height: 280px;
  }
  .pwa-modal-unclosable .pwa-phone-mockup {
    transform: scale(0.72);
    margin: -32px 0;
  }
}

@media (max-width: 340px) {
  .pwa-modal-unclosable .pwa-animation-container {
    height: 220px;
    min-height: 220px;
    max-height: 220px;
    padding-top: 24px;
  }
  .pwa-modal-unclosable .pwa-phone-mockup {
    transform: scale(0.54);
    margin: -76px 0;
  }
}

