:root {
  color-scheme: dark;
  --bg: #005436;
  --fg: #ffffff;
  --button-bg: #b7ff35;
  --button-fg: #001f14;
  --sheet-bg: #073f2d;
  --sheet-fg: #ffffff;
  --muted: rgba(255, 255, 255, 0.75);
  --toggle-bg: rgba(255, 255, 255, 0.13);
  --toggle-border: rgba(255, 255, 255, 0.24);
  --toggle-fg: #ffffff;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

:root[data-theme="light"] {
  color-scheme: light;
  --bg: #defdec;
  --fg: #00412f;
  --button-bg: #6fba27;
  --button-fg: #001f14;
  --sheet-bg: #f7fff9;
  --sheet-fg: #003223;
  --muted: rgba(0, 50, 35, 0.72);
  --toggle-bg: rgba(0, 50, 35, 0.08);
  --toggle-border: rgba(0, 50, 35, 0.16);
  --toggle-fg: #003f2d;
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
  background: var(--bg);
  color: var(--fg);
}

.install-shell {
  min-height: 100svh;
  display: grid;
  place-items: center;
  padding: 18px;
}

.install-card {
  position: relative;
  width: min(100%, 430px);
  min-height: min(100svh - 36px, 860px);
  display: grid;
  grid-template-rows: auto 1fr auto auto;
  justify-items: center;
  align-items: start;
  padding: max(56px, 10svh) 24px calc(34px + var(--safe-bottom));
  overflow: hidden;
}

.brand-logo {
  position: relative;
  width: clamp(148px, 43vw, 190px);
  aspect-ratio: 3.7 / 1;
  overflow: hidden;
  display: grid;
  place-items: center;
}

.brand-logo img {
  position: absolute;
  width: 130.5%;
  height: auto;
  left: -15.2%;
  top: -193%;
  max-width: none;
  display: block;
  mix-blend-mode: multiply;
  filter: invert(1) contrast(1.08);
}

:root[data-theme="dark"] .brand-logo img {
  mix-blend-mode: screen;
  filter: contrast(1.1);
}

.theme-toggle {
  position: absolute;
  top: 18px;
  right: 18px;
  width: 42px;
  height: 42px;
  border: 0;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--toggle-bg);
  color: var(--toggle-fg);
  box-shadow: inset 0 0 0 1px var(--toggle-border);
  cursor: pointer;
}

.theme-toggle__icon {
  grid-area: 1 / 1;
  width: 21px;
  height: 21px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  transition: opacity 160ms ease, transform 160ms ease;
}

.theme-toggle__icon--moon {
  opacity: 0;
  transform: scale(0.78);
}

:root[data-theme="light"] .theme-toggle__icon--sun {
  opacity: 0;
  transform: scale(0.78);
}

:root[data-theme="light"] .theme-toggle__icon--moon {
  opacity: 1;
  transform: scale(1);
}

.theme-toggle:focus-visible {
  outline: 2px solid currentColor;
  outline-offset: 3px;
}

h1 {
  align-self: center;
  width: min(100%, 360px);
  margin: -4svh 0 0;
  font-size: clamp(41px, 11.1vw, 57px);
  line-height: 0.98;
  letter-spacing: 0;
  text-align: center;
  font-weight: 850;
}

h1 span {
  display: block;
}

.install-actions {
  display: grid;
  justify-items: center;
  gap: 14px;
  min-height: 94px;
}

.install-button {
  appearance: none;
  border: 0;
  border-radius: 999px;
  min-width: 188px;
  min-height: 58px;
  padding: 0 30px;
  display: inline-grid;
  place-items: center;
  background: var(--button-bg);
  color: var(--button-fg);
  font: inherit;
  font-size: 24px;
  font-weight: 850;
  letter-spacing: 0;
  cursor: pointer;
  touch-action: manipulation;
}

.install-button:focus-visible {
  outline: 3px solid currentColor;
  outline-offset: 4px;
}

.install-status {
  max-width: 290px;
  min-height: 18px;
  margin: 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.35;
  text-align: center;
}

.install-qr {
  display: grid;
  justify-items: center;
  gap: 8px;
  margin-top: 12px;
}

.install-qr img {
  width: 92px;
  height: 92px;
  display: block;
  border-radius: 16px;
  padding: 8px;
  background: #ffffff;
  box-shadow: 0 0 22px rgba(183, 255, 53, 0.26);
}

.install-qr span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 750;
  line-height: 1.2;
}

.install-sheet[hidden] {
  display: none;
}

.install-sheet {
  position: fixed;
  inset: 0;
  z-index: 10;
  display: grid;
  align-items: end;
  background: rgba(0, 22, 14, 0.45);
  padding: 18px;
}

.install-sheet__panel {
  position: relative;
  width: min(100%, 430px);
  margin: 0 auto;
  border-radius: 22px;
  padding: 26px 22px calc(24px + var(--safe-bottom));
  background: var(--sheet-bg);
  color: var(--sheet-fg);
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.24);
}

.install-sheet__panel h2 {
  margin: 0 42px 10px 0;
  font-size: 22px;
  line-height: 1.14;
  letter-spacing: 0;
}

.install-sheet__panel p {
  margin: 0;
  color: var(--muted);
  font-size: 16px;
  line-height: 1.45;
}

.install-sheet__close {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 38px;
  height: 38px;
  border: 0;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.08);
  color: inherit;
  font: inherit;
  font-size: 28px;
  line-height: 1;
  cursor: pointer;
}

:root[data-theme="dark"] .install-button {
  box-shadow: 0 0 32px rgba(183, 255, 53, 0.92), 0 0 70px rgba(183, 255, 53, 0.46);
}

:root[data-theme="dark"] .install-sheet__close {
  background: rgba(255, 255, 255, 0.13);
}

@media (min-width: 640px) {
  body {
    background:
      radial-gradient(circle at 50% 0%, rgba(255, 255, 255, 0.3), transparent 28rem),
      var(--bg);
  }

  .install-card {
    min-height: min(820px, calc(100svh - 48px));
    border: 1px solid rgba(255, 255, 255, 0.26);
    border-radius: 42px;
    box-shadow: 0 30px 90px rgba(0, 42, 28, 0.2);
  }
}

@media (max-width: 374px) {
  .install-card {
    padding-inline: 18px;
  }

  .install-button {
    min-width: 174px;
    min-height: 54px;
    font-size: 22px;
  }
}
