*, *::before, *::after { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #0b1410;
  -webkit-text-size-adjust: 100%;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

.pwa-app {
  position: fixed;
  top: 0;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  padding-top: env(safe-area-inset-top, 0);
  padding-left: env(safe-area-inset-left, 0);
  padding-right: env(safe-area-inset-right, 0);
  /* Phones: keep shell at phone width so iframe media queries match mobile site. */
  width: 100%;
  max-width: 430px;
}

@media (min-width: 431px) and (max-width: 599.98px) {
  body {
    background: #06100c;
  }
  .pwa-app {
    box-shadow: 0 0 0 1px rgba(156, 184, 164, 0.18), 0 18px 48px rgba(0, 0, 0, 0.45);
  }
}

/* Tablets / iPad (and wider): full-bleed — no phone gutters. */
@media (min-width: 600px) {
  body {
    background: #0b1410;
  }
  .pwa-app,
  html.pwa-tablet .pwa-app,
  .pwa-app.pwa-app--wide {
    left: 0 !important;
    right: 0 !important;
    transform: none !important;
    width: 100% !important;
    max-width: none !important;
    box-shadow: none !important;
  }
}

.pwa-frame {
  flex: 1 1 auto;
  width: 100%;
  min-height: 0;
  border: 0;
  background: #0b1410;
}

.pwa-hotbar {
  flex: 0 0 auto;
  display: flex;
  align-items: stretch;
  gap: 2px;
  min-height: 48px;
  padding: 4px 6px calc(4px + env(safe-area-inset-bottom, 0));
  background: linear-gradient(180deg, #122018 0%, #0b1410 100%);
  border-top: 1px solid rgba(156, 184, 164, 0.18);
  z-index: 10;
}

.pwa-hotbar__btn {
  flex: 1 1 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1px;
  min-width: 0;
  padding: 4px 2px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: #c8e6c9;
  text-decoration: none;
  font: inherit;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.pwa-hotbar__btn:active,
.pwa-hotbar__btn:focus-visible {
  background: rgba(46, 125, 50, 0.22);
  outline: none;
}

.pwa-hotbar__btn--icon {
  flex: 0 0 40px;
  max-width: 40px;
}

.pwa-hotbar__icon {
  font-size: 16px;
  line-height: 1;
}

.pwa-hotbar__icon-wrap {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  min-height: 18px;
}

.pwa-hotbar__badge {
  position: absolute;
  top: -6px;
  right: -10px;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  border-radius: 999px;
  background: #fd7728;
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  line-height: 16px;
  text-align: center;
  box-sizing: border-box;
  pointer-events: none;
}

.pwa-hotbar__badge.is-empty,
.pwa-hotbar__badge[hidden] {
  display: none !important;
}

.pwa-hotbar__label {
  font-size: 10px;
  line-height: 1.1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
  opacity: 0.92;
}

.pwa-hotbar__sep {
  flex: 0 0 1px;
  align-self: stretch;
  margin: 6px 2px;
  background: rgba(156, 184, 164, 0.2);
}

.pwa-hotbar__btn.is-push-on .pwa-hotbar__icon {
  filter: drop-shadow(0 0 4px #66bb6a);
}

/* Keep offline/boot out of the way — shell + iframe must paint immediately. */
.pwa-offline,
.pwa-offline:not([hidden]) {
  display: none !important;
}

.pwa-offline h1 {
  margin: 0;
  font-size: 1.25rem;
  font-weight: 600;
}

.pwa-offline p {
  margin: 0;
  max-width: 280px;
  color: #9cb8a4;
}

.pwa-offline button {
  margin-top: 8px;
  padding: 12px 24px;
  border: 0;
  border-radius: 10px;
  background: #2e7d32;
  color: #fff;
  font: inherit;
  cursor: pointer;
}

.pwa-banner {
  position: fixed;
  left: 12px;
  right: 12px;
  z-index: 30;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
  padding: 10px 14px;
  border-radius: 12px;
  background: #1b2e22;
  border: 1px solid rgba(102, 187, 106, 0.35);
  color: #e8f5e9;
  font-size: 14px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.35);
}

.pwa-banner[hidden] { display: none !important; }

.pwa-banner--push {
  bottom: calc(56px + env(safe-area-inset-bottom, 0));
  z-index: 10040;
}

.pwa-banner--denied {
  bottom: calc(56px + env(safe-area-inset-bottom, 0));
  background: rgba(40, 24, 24, 0.96);
  border-color: rgba(255, 120, 100, 0.35);
}

.pwa-banner--update {
  top: calc(12px + env(safe-area-inset-top, 0));
}

.pwa-banner p {
  flex: 1 1 180px;
  margin: 0;
}

.pwa-banner button {
  padding: 8px 14px;
  border: 0;
  border-radius: 8px;
  background: #2e7d32;
  color: #fff;
  font: inherit;
  cursor: pointer;
}

.pwa-banner__link {
  padding: 8px 10px;
  border: 0;
  background: transparent;
  color: #9cb8a4;
  font: inherit;
  cursor: pointer;
  text-decoration: underline;
}

.pwa-inapp-notify {
  position: fixed;
  left: 12px;
  right: 12px;
  top: calc(12px + env(safe-area-inset-top, 0));
  z-index: 10050;
  max-width: 420px;
  margin: 0 auto;
  padding: 14px 16px 14px;
  border-radius: 14px;
  background: #1b2e22;
  border: 1px solid rgba(102, 187, 106, 0.4);
  color: #e8f5e9;
  box-shadow: 0 10px 32px rgba(0, 0, 0, 0.45);
}

.pwa-inapp-notify[hidden] { display: none !important; }

.pwa-inapp-notify__close {
  position: absolute;
  top: 6px;
  right: 8px;
  width: 32px;
  height: 32px;
  border: 0;
  background: transparent;
  color: #9cb8a4;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
}

.pwa-inapp-notify__title {
  margin: 0 28px 6px 0;
  font-size: 15px;
  font-weight: 650;
}

.pwa-inapp-notify__body {
  margin: 0 0 12px;
  font-size: 14px;
  line-height: 1.4;
  color: #cde8d1;
}

.pwa-inapp-notify__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.pwa-inapp-notify__open,
.pwa-inapp-notify__read {
  display: inline-flex;
  min-height: 40px;
  padding: 8px 16px;
  border: 0;
  border-radius: 10px;
  font: inherit;
  font-weight: 650;
  cursor: pointer;
}

.pwa-inapp-notify__open {
  background: #2e7d32;
  color: #fff;
}

.pwa-inapp-notify__read {
  background: rgba(255, 255, 255, 0.12);
  color: #e8f5e9;
  border: 1px solid rgba(255, 255, 255, 0.22);
}

@media (min-width: 768px) {
  .pwa-hotbar {
    max-width: 640px;
    margin: 0 auto;
    border-radius: 12px 12px 0 0;
  }
}

/* Install gate — “download app” first screen in browser */
.pwa-install-gate {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px 16px calc(20px + env(safe-area-inset-bottom, 0));
  background:
    radial-gradient(90% 60% at 50% 0%, rgba(67, 160, 71, 0.22), transparent 60%),
    #0b1410;
  overflow: auto;
}

.pwa-install-gate[hidden] { display: none !important; }

.pwa-install-gate__card {
  width: 100%;
  max-width: 380px;
  text-align: center;
  color: #e8f5e9;
}

.pwa-install-gate__icon {
  width: 88px;
  height: 88px;
  border-radius: 22px;
  margin-bottom: 14px;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.4);
}

.pwa-install-gate__title {
  margin: 0 0 8px;
  font-size: 1.55rem;
  letter-spacing: -0.02em;
}

.pwa-install-gate__lead,
.pwa-install-gate__hint {
  margin: 0 0 16px;
  font-size: 0.95rem;
  line-height: 1.45;
  color: #9cb8a4;
}

.pwa-install-gate__btn {
  display: inline-flex;
  width: 100%;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  margin-bottom: 10px;
  padding: 12px 16px;
  border: 0;
  border-radius: 14px;
  background: linear-gradient(180deg, #43a047, #2e7d32);
  color: #fff;
  font: inherit;
  font-weight: 650;
  cursor: pointer;
}

.pwa-install-gate__btn.is-ready {
  box-shadow: 0 0 0 2px rgba(129, 199, 132, 0.45);
}

.pwa-install-gate__link,
.pwa-install-gate__chrome {
  display: inline-block;
  margin-bottom: 14px;
  padding: 8px;
  border: 0;
  background: transparent;
  color: #9cb8a4;
  font: inherit;
  text-decoration: underline;
  cursor: pointer;
}

.pwa-install-gate__steps {
  margin: 0 auto 10px;
  padding-left: 1.2rem;
  text-align: left;
  color: #d7ead9;
  font-size: 0.9rem;
  line-height: 1.45;
  max-width: 280px;
}

body.pwa-install-gate-open .pwa-app {
  visibility: hidden;
  pointer-events: none;
}

