:root {
  --pwa-ink: #082f36;
  --pwa-muted: #365a61;
  --pwa-brand: #155b61;
  --pwa-brand-dark: #0b3d43;
  --pwa-accent: #c0185b;
  --pwa-logo-pink: #ff438c;
  --pwa-logo-blue: #009aff;
  --pwa-soft: #fff8e6;
  --pwa-warning: #fff1a8;
  --pwa-line: rgba(8, 47, 54, 0.18);
  --pwa-shadow: 0 18px 48px rgba(8, 47, 54, 0.18);
}

.pwa-coach {
  position: fixed;
  right: max(16px, env(safe-area-inset-right));
  bottom: max(16px, env(safe-area-inset-bottom));
  z-index: 68;
  width: min(430px, calc(100vw - 24px));
  color: var(--pwa-ink);
  background: #fffdf7;
  border: 1px solid var(--pwa-line);
  border-radius: 8px;
  box-shadow: var(--pwa-shadow);
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  overflow: hidden;
}

body.has-dangerous-symptoms .pwa-coach,
body.has-continue-relief .pwa-coach {
  bottom: calc(96px + env(safe-area-inset-bottom));
}

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

.pwa-coach-inner {
  display: grid;
  gap: 10px;
  padding: 16px;
}

.pwa-coach-top {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.pwa-coach-icon {
  display: grid;
  flex: 0 0 44px;
  width: 44px;
  height: 44px;
  place-items: center;
  color: #fff;
  background: linear-gradient(135deg, var(--pwa-brand), var(--pwa-accent));
  border-radius: 8px;
  font-size: 24px;
  font-weight: 800;
  line-height: 1;
}

.pwa-coach-copy {
  min-width: 0;
}

.pwa-coach-title {
  margin: 0;
  color: var(--pwa-ink);
  font-size: 18px;
  font-weight: 700;
  line-height: 1.2;
}

.pwa-coach-text {
  margin: 6px 0 0;
  color: var(--pwa-muted);
  font-size: 15px;
  font-weight: 400;
  line-height: 1.45;
}

.pwa-coach-warning {
  margin: 0;
  padding: 10px 12px;
  color: #173d91;
  background: var(--pwa-warning);
  border-radius: 8px;
  font-size: 14px;
  font-weight: 400;
  line-height: 1.45;
}

.pwa-coach-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.pwa-coach button,
.pwa-coach a {
  min-height: 42px;
  border-radius: 8px;
  font: inherit;
  font-size: 14px;
  line-height: 1.15;
}

.pwa-coach-primary,
.pwa-coach-secondary,
.pwa-coach-plain {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 14px;
  cursor: pointer;
  text-decoration: none;
}

.pwa-coach-primary {
  color: #fff;
  background: var(--pwa-accent);
  border: 1px solid var(--pwa-accent);
  font-weight: 700;
}

.pwa-coach-secondary {
  color: var(--pwa-brand-dark);
  background: #fff;
  border: 1px solid rgba(21, 91, 97, 0.32);
  font-weight: 600;
}

.pwa-coach-plain {
  color: var(--pwa-muted);
  background: transparent;
  border: 1px solid transparent;
  font-weight: 500;
}

.pwa-coach-close {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 36px;
  height: 36px;
  color: var(--pwa-muted);
  background: transparent;
  border: 0;
  border-radius: 8px;
  cursor: pointer;
  font-size: 24px;
  line-height: 1;
}

.pwa-coach-close:hover,
.pwa-coach-close:focus-visible,
.pwa-coach a:focus-visible,
.pwa-coach button:focus-visible {
  outline: 3px solid rgba(192, 24, 91, 0.3);
  outline-offset: 2px;
}

.pwa-guide-page,
.pwa-offline-page {
  min-height: 100vh;
  margin: 0;
  color: var(--pwa-ink);
  background:
    linear-gradient(135deg, rgba(255, 248, 230, 0.95), rgba(245, 255, 253, 0.95)),
    #fffdf7;
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.pwa-guide-shell,
.pwa-offline-shell {
  width: min(1120px, calc(100% - 24px));
  margin: 0 auto;
}

.pwa-guide-shell {
  padding: 24px 0 48px;
}

.pwa-guide-hero,
.pwa-detected-card,
.pwa-warning-card,
.pwa-use-card,
.pwa-step-card,
.pwa-offline-shell {
  background: rgba(255, 255, 255, 0.88);
  border: 1px solid var(--pwa-line);
  border-radius: 8px;
  box-shadow: 0 12px 32px rgba(8, 47, 54, 0.08);
}

.pwa-guide-hero {
  padding: clamp(24px, 5vw, 52px);
}

.pwa-guide-hero img,
.pwa-offline-logo {
  width: min(220px, 70vw);
  height: auto;
}

.pwa-kicker {
  margin: 18px 0 8px;
  color: var(--pwa-accent);
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: uppercase;
}

.pwa-guide-hero h1,
.pwa-offline-shell h1 {
  max-width: 820px;
  margin: 0;
  color: var(--pwa-ink);
  font-size: clamp(34px, 5vw, 64px);
  font-weight: 800;
  line-height: 1.02;
  letter-spacing: 0;
}

.pwa-guide-hero p,
.pwa-offline-shell p,
.pwa-detected-card p,
.pwa-warning-card p,
.pwa-use-card p,
.pwa-use-card li,
.pwa-step-card li {
  color: var(--pwa-muted);
  font-size: 18px;
  font-weight: 400;
  line-height: 1.55;
}

.pwa-guide-hero > p:not(.pwa-kicker) {
  max-width: 780px;
  margin: 18px 0 0;
  font-size: clamp(19px, 2.6vw, 24px);
}

.pwa-guide-actions,
.pwa-warning-actions,
.pwa-offline-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 22px;
}

.pwa-primary-link,
.pwa-secondary-link,
.pwa-warning-actions a,
.pwa-offline-actions a,
.pwa-offline-actions button,
.pwa-step-card a {
  display: inline-flex;
  min-height: 48px;
  align-items: center;
  justify-content: center;
  padding: 12px 18px;
  border-radius: 8px;
  font-size: 16px;
  font-weight: 700;
  line-height: 1.2;
  text-decoration: none;
}

.pwa-primary-link,
.pwa-offline-actions button {
  color: #fff;
  background: var(--pwa-accent);
  border: 1px solid var(--pwa-accent);
}

.pwa-secondary-link,
.pwa-warning-actions a,
.pwa-offline-actions a,
.pwa-step-card a {
  color: var(--pwa-brand-dark);
  background: #fff;
  border: 1px solid rgba(21, 91, 97, 0.32);
}

.pwa-detected-card,
.pwa-warning-card,
.pwa-use-card {
  margin-top: 16px;
  padding: clamp(18px, 3vw, 28px);
}

.pwa-detected-card h2,
.pwa-warning-card h2,
.pwa-use-card h2,
.pwa-step-card h2 {
  margin: 0 0 10px;
  color: var(--pwa-ink);
  font-size: clamp(24px, 3vw, 34px);
  font-weight: 750;
  line-height: 1.12;
  letter-spacing: 0;
}

.pwa-warning-card {
  background: #fff8bf;
}

.pwa-warning-card p {
  color: #173d91;
}

.pwa-steps-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  margin-top: 16px;
}

.pwa-step-card {
  padding: clamp(18px, 2.4vw, 26px);
}

.pwa-step-card > span {
  display: inline-flex;
  margin-bottom: 12px;
  color: var(--pwa-accent);
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

.pwa-step-card ol,
.pwa-use-card ul {
  display: grid;
  gap: 10px;
  margin: 12px 0 0;
  padding-left: 22px;
}

[dir="rtl"] .pwa-step-card ol,
[dir="rtl"] .pwa-use-card ul {
  padding-right: 22px;
  padding-left: 0;
}

.pwa-step-card a {
  width: 100%;
  margin-top: 18px;
}

.pwa-language-help {
  display: grid;
  gap: 8px;
  margin-top: 24px;
  padding-top: 18px;
  border-top: 1px solid var(--pwa-line);
}

.pwa-language-help p {
  margin: 0;
  font-size: 16px;
}

.pwa-offline-shell {
  display: grid;
  min-height: calc(100vh - 32px);
  align-content: center;
  margin-top: 16px;
  margin-bottom: 16px;
  padding: clamp(24px, 5vw, 52px);
  box-sizing: border-box;
}

@media (max-width: 920px) {
  .pwa-steps-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  .pwa-coach {
    right: max(12px, env(safe-area-inset-right));
    bottom: max(12px, env(safe-area-inset-bottom));
    width: calc(100vw - 24px);
  }

  .pwa-coach-inner {
    padding: 14px;
  }

  .pwa-coach-actions {
    display: grid;
    grid-template-columns: 1fr;
  }

  .pwa-coach-primary,
  .pwa-coach-secondary,
  .pwa-coach-plain {
    width: 100%;
  }

  .pwa-guide-shell,
  .pwa-offline-shell {
    width: min(100% - 16px, 1120px);
  }

  .pwa-guide-shell {
    padding-top: 8px;
  }

  .pwa-guide-hero,
  .pwa-detected-card,
  .pwa-warning-card,
  .pwa-use-card,
  .pwa-step-card,
  .pwa-offline-shell {
    border-radius: 8px;
  }
}

.pwa-helper-page {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(237, 252, 249, 0.96)),
    #ffffff;
}

.pwa-helper-shell {
  display: grid;
  width: min(760px, calc(100% - 24px));
  min-height: 100vh;
  align-content: center;
  gap: 14px;
  margin: 0 auto;
  padding: 16px 0;
  box-sizing: border-box;
}

.pwa-helper-brand {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.pwa-helper-brand img {
  width: min(210px, 58vw);
  height: auto;
}

.pwa-helper-link {
  display: inline-flex;
  min-height: 0;
  align-items: center;
  justify-content: center;
  padding: 0;
  color: var(--pwa-ink);
  background: transparent;
  border: 0;
  border-radius: 0;
  font-size: 16px;
  font-weight: 700;
  line-height: 1.15;
  text-decoration: none;
}

.pwa-helper-card,
.pwa-helper-push,
.pwa-helper-mini {
  color: var(--pwa-ink);
  background: #ffffff;
  border: 1px solid rgba(8, 47, 54, 0.16);
  border-radius: 8px;
  box-shadow: 0 18px 48px rgba(8, 47, 54, 0.1);
}

.pwa-helper-card {
  display: grid;
  gap: 14px;
  padding: clamp(20px, 4vw, 34px);
}

.pwa-helper-steps {
  display: flex;
  align-items: center;
  gap: 0;
  width: 100%;
  overflow: hidden;
  border-radius: 999px;
  background: #f3f8f8;
  border: 1px solid rgba(21, 91, 97, 0.14);
}

.pwa-helper-steps span {
  position: relative;
  display: inline-flex;
  flex: 1 1 0;
  min-height: 30px;
  align-items: center;
  justify-content: center;
  padding: 6px 8px;
  color: #155b61;
  background: transparent;
  border: 0;
  border-radius: 0;
  font-size: 13px;
  font-weight: 650;
  line-height: 1.1;
  text-align: center;
  white-space: nowrap;
}

.pwa-helper-steps span + span {
  border-left: 1px solid rgba(21, 91, 97, 0.16);
}

[dir="rtl"] .pwa-helper-steps span + span {
  border-right: 1px solid rgba(21, 91, 97, 0.16);
  border-left: 0;
}

.pwa-helper-steps span:nth-child(1) {
  color: #ffffff;
  background: var(--pwa-logo-pink);
}

.pwa-helper-steps span:nth-child(2) {
  color: #ffffff;
  background: var(--pwa-logo-blue);
}

.pwa-helper-steps span:nth-child(3) {
  color: #073f2d;
  background: #bbf1d3;
}

.pwa-helper-steps span.is-done {
  color: #ffffff;
  background: var(--pwa-brand);
}

.pwa-helper-card h1 {
  max-width: 620px;
  margin: 4px 0 0;
  color: var(--pwa-ink);
  font-size: 44px;
  font-weight: 820;
  line-height: 1.02;
  letter-spacing: 0;
}

.pwa-helper-card p,
.pwa-helper-mini,
.pwa-helper-push p {
  color: var(--pwa-muted);
  font-size: 20px;
  font-weight: 400;
  line-height: 1.45;
}

.pwa-helper-actions {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
}

.pwa-helper-button,
.pwa-helper-push button {
  display: inline-flex;
  min-height: 56px;
  align-items: center;
  justify-content: center;
  padding: 14px 18px;
  border-radius: 8px;
  font-family: inherit;
  font-size: 18px;
  font-weight: 800;
  line-height: 1.15;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
}

.pwa-helper-button.primary,
.pwa-helper-push button {
  color: #ffffff;
  background: var(--pwa-logo-pink);
  border: 1px solid var(--pwa-logo-pink);
}

.pwa-helper-button[data-helper-action="enable-push"],
.pwa-helper-push button {
  color: #ffffff;
  background: var(--pwa-logo-blue);
  border-color: var(--pwa-logo-blue);
}

.pwa-helper-button.secondary {
  color: var(--pwa-brand-dark);
  background: #ffffff;
  border: 1px solid rgba(21, 91, 97, 0.34);
}

.pwa-helper-button.plain {
  color: var(--pwa-muted);
  background: transparent;
  border: 1px solid transparent;
  font-weight: 700;
}

.pwa-helper-note {
  min-height: 24px;
  margin: 0;
  color: #173d91 !important;
  font-size: 16px !important;
}

.pwa-helper-push {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 16px;
  align-items: center;
  padding: clamp(18px, 3vw, 26px);
}

.pwa-helper-push span {
  display: inline-flex;
  margin-bottom: 6px;
  color: var(--pwa-logo-blue);
  font-size: 13px;
  font-weight: 850;
  letter-spacing: 0;
  text-transform: uppercase;
}

.pwa-helper-push h2,
.pwa-helper-mini h2 {
  margin: 0 0 6px;
  color: var(--pwa-ink);
  font-size: 28px;
  font-weight: 800;
  line-height: 1.12;
  letter-spacing: 0;
}

.pwa-helper-push p,
.pwa-helper-mini div {
  margin: 0;
  font-size: 17px;
}

.pwa-helper-push button {
  min-width: 190px;
}

.pwa-helper-push button:disabled {
  color: var(--pwa-muted);
  background: #eef4f3;
  border-color: rgba(21, 91, 97, 0.16);
  cursor: not-allowed;
}

.pwa-helper-push.is-done {
  border-color: rgba(21, 91, 97, 0.4);
  background: #f1fbf8;
}

.pwa-helper-push.is-blocked {
  border-color: rgba(192, 24, 91, 0.3);
  background: #fff7fb;
}

.pwa-helper-mini {
  padding: 18px;
}

.pwa-helper-mini h2 {
  font-size: 21px;
}

.pwa-helper-mini div {
  color: var(--pwa-muted);
  line-height: 1.45;
}

.pwa-helper-button:focus-visible,
.pwa-helper-push button:focus-visible,
.pwa-helper-link:focus-visible {
  outline: 3px solid rgba(192, 24, 91, 0.28);
  outline-offset: 2px;
}

@media (max-width: 640px) {
  .pwa-helper-shell {
    width: min(100% - 16px, 760px);
    align-content: start;
    padding-top: 8px;
  }

  .pwa-helper-brand {
    align-items: flex-start;
  }

  .pwa-helper-link {
    min-width: 112px;
  }

  .pwa-helper-card {
    padding: 20px 16px;
  }

  .pwa-helper-card h1 {
    font-size: 32px;
  }

  .pwa-helper-card p,
  .pwa-helper-mini,
  .pwa-helper-push p {
    font-size: 18px;
  }

  .pwa-helper-push h2,
  .pwa-helper-mini h2 {
    font-size: 24px;
  }

  .pwa-helper-steps {
    grid-template-columns: 1fr;
  }

  .pwa-helper-push {
    grid-template-columns: 1fr;
    padding: 18px 16px;
  }

  .pwa-helper-push button {
    width: 100%;
    min-width: 0;
  }
}
