:root {
  --app-install-safe-bottom: max(18px, env(safe-area-inset-bottom));
  --app-install-safe-right: max(18px, env(safe-area-inset-right));
}

.app-install-launcher {
  position: fixed;
  right: var(--app-install-safe-right);
  bottom: var(--app-install-safe-bottom);
  z-index: 880;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 48px;
  max-width: min(260px, calc(100vw - 36px));
  padding: 10px 15px 10px 11px;
  border: 1px solid rgba(214, 180, 107, .58);
  border-radius: 999px;
  color: #f5f1e8;
  background: rgba(8, 20, 31, .94);
  box-shadow: 0 16px 44px rgba(0, 0, 0, .34), inset 0 1px 0 rgba(255, 255, 255, .05);
  font: 700 13px/1.2 Inter, Arial, sans-serif;
  letter-spacing: .02em;
  cursor: pointer;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  transition: transform .2s ease, border-color .2s ease, background .2s ease;
}

.app-install-launcher:hover {
  transform: translateY(-2px);
  border-color: #e7c76f;
  background: #102638;
}

.app-install-launcher:focus-visible,
.app-install-dialog button:focus-visible,
.app-install-dialog a:focus-visible {
  outline: 2px solid #f0c85a;
  outline-offset: 4px;
}

.app-install-launcher__mark {
  display: grid;
  width: 28px;
  height: 28px;
  flex: 0 0 28px;
  place-items: center;
  border-radius: 50%;
  color: #07131f;
  background: linear-gradient(135deg, #f2d27d, #d9aa3b);
  font-size: 18px;
  line-height: 1;
}

.app-install-layer[hidden] { display: none !important; }

.app-install-layer {
  position: fixed;
  inset: 0;
  z-index: 1200;
  display: grid;
  place-items: end;
  padding: 24px;
  background: rgba(2, 8, 14, .66);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.app-install-dialog {
  position: relative;
  width: min(760px, 100%);
  max-height: calc(100dvh - 48px);
  overflow: auto;
  border: 1px solid rgba(214, 180, 107, .46);
  background: #0b1c2a;
  box-shadow: 0 28px 90px rgba(0, 0, 0, .55);
  color: #f3efe7;
}

.app-install-dialog__grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 220px;
  gap: 32px;
  padding: 34px;
}

.app-install-dialog__eyebrow {
  margin: 0 0 12px;
  color: #e5bd59;
  font: 800 12px/1.4 Inter, Arial, sans-serif;
  letter-spacing: .14em;
  text-transform: uppercase;
}

.app-install-dialog h2 {
  max-width: 19ch;
  margin: 0 0 14px;
  color: #f3efe7;
  font: 500 clamp(28px, 4vw, 42px)/1.04 Georgia, serif;
}

.app-install-dialog__lead {
  max-width: 52ch;
  margin: 0;
  color: #b8c4cd;
  font: 400 16px/1.6 Inter, Arial, sans-serif;
}

.app-install-dialog__steps {
  display: grid;
  gap: 10px;
  margin: 24px 0 0;
  padding: 0;
  list-style: none;
  counter-reset: app-step;
}

.app-install-dialog__steps li {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr);
  gap: 10px;
  align-items: start;
  color: #d7dfe5;
  font: 500 14px/1.5 Inter, Arial, sans-serif;
  counter-increment: app-step;
}

.app-install-dialog__steps li::before {
  content: counter(app-step, decimal-leading-zero);
  color: #e5bd59;
  font: 800 11px/1.5 Inter, Arial, sans-serif;
  letter-spacing: .06em;
}

.app-install-dialog__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 24px;
}

.app-install-dialog__action,
.app-install-dialog__secondary {
  min-height: 46px;
  padding: 12px 17px;
  border: 1px solid #d8ae4e;
  font: 750 13px/1.2 Inter, Arial, sans-serif;
  cursor: pointer;
}

.app-install-dialog__action {
  color: #07131f;
  background: linear-gradient(135deg, #f1d078, #d9aa3b);
}

.app-install-dialog__secondary {
  color: #edf0ee;
  background: transparent;
}

.app-install-dialog__qr {
  align-self: center;
  padding: 15px;
  border: 1px solid rgba(214, 180, 107, .35);
  background: #f8f4ea;
}

.app-install-dialog__qr img {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 1;
}

.app-install-dialog__qr p {
  margin: 11px 0 0;
  color: #253443;
  font: 700 12px/1.4 Inter, Arial, sans-serif;
  text-align: center;
}

.app-install-dialog__close {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 2;
  display: grid;
  width: 44px;
  height: 44px;
  padding: 0;
  place-items: center;
  border: 0;
  color: #f4eee3;
  background: transparent;
  font: 400 28px/1 Arial, sans-serif;
  cursor: pointer;
}

.app-install-status {
  min-height: 1.5em;
  margin: 14px 0 0;
  color: #e5bd59;
  font: 600 13px/1.5 Inter, Arial, sans-serif;
}

html.app-install-modal-open,
body.app-install-modal-open { overflow: hidden !important; }

@media (max-width: 720px) {
  .app-install-launcher {
    right: max(12px, env(safe-area-inset-right));
    bottom: max(12px, env(safe-area-inset-bottom));
    min-height: 46px;
    padding: 9px 13px 9px 9px;
  }

  .app-install-layer {
    align-items: end;
    padding: 0;
  }

  .app-install-dialog {
    width: 100%;
    max-height: min(88dvh, 720px);
    border-right: 0;
    border-bottom: 0;
    border-left: 0;
    border-radius: 18px 18px 0 0;
  }

  .app-install-dialog__grid {
    grid-template-columns: 1fr;
    gap: 22px;
    padding: 30px 22px max(24px, env(safe-area-inset-bottom));
  }

  .app-install-dialog__qr {
    display: none;
  }
}

@media (max-width: 430px) {
  .app-install-launcher__label { max-width: 112px; }
  .app-install-dialog h2 { font-size: 30px; }
}

@media (display-mode: standalone) {
  .app-install-launcher,
  .app-install-layer { display: none !important; }
}

@media (prefers-reduced-motion: reduce) {
  .app-install-launcher { transition: none; }
}
