:root {
  color-scheme: dark;
  --bg: #0b1112;
  --fg: #f8f4ea;
  --button-bg: #8b5e3c;
  --button-fg: #fffaf0;
  --sheet-bg: #151d1e;
  --sheet-fg: #fffaf0;
  --muted: rgba(248, 244, 234, 0.7);
  --toggle-bg: rgba(255, 250, 240, 0.09);
  --toggle-border: rgba(255, 250, 240, 0.2);
  --toggle-fg: #fffaf0;
  --line: rgba(255, 250, 240, 0.16);
  --accent: #f2c51d;
  --menu-active-accent: var(--accent);
  --input-bg: rgba(255, 250, 240, 0.08);
  --glow: rgba(242, 197, 29, 0.12);
  --wood: #9a6742;
  --history-cashback: var(--muted);
  --history-discount: var(--accent);
  --app-content-width: 640px;
  --app-auth-width: 430px;
  --app-section-gap: 32px;
  --app-row-padding: 16px;
  --app-control-radius: 16px;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

:root[data-theme="light"] {
  color-scheme: light;
  --bg: #f3efe7;
  --fg: #1d2525;
  --button-bg: #9a6a45;
  --button-fg: #fffaf0;
  --sheet-bg: #fffdf8;
  --sheet-fg: #202727;
  --muted: rgba(29, 37, 37, 0.68);
  --toggle-bg: rgba(29, 37, 37, 0.07);
  --toggle-border: rgba(29, 37, 37, 0.16);
  --toggle-fg: #202727;
  --line: rgba(29, 37, 37, 0.14);
  --accent: #c99424;
  --menu-active-accent: var(--accent);
  --input-bg: rgba(255, 255, 255, 0.78);
  --glow: rgba(201, 148, 36, 0.1);
  --wood: #8c5c3c;
  --history-cashback: var(--muted);
  --history-discount: var(--accent);
}

:root[data-theme-family="neon-forest"][data-theme="dark"] {
  color-scheme: dark;
  --bg: #032f23;
  --fg: #effff8;
  --button-bg: #b7ff5a;
  --button-fg: #071b19;
  --sheet-bg: #102a2c;
  --sheet-fg: #f1fffb;
  --muted: rgba(226, 255, 245, 0.7);
  --toggle-bg: rgba(79, 255, 194, 0.12);
  --toggle-border: rgba(124, 255, 212, 0.28);
  --toggle-fg: #c9ffeb;
  --line: rgba(124, 255, 212, 0.18);
  --accent: #4dffc2;
  --menu-active-accent: var(--button-bg);
  --input-bg: rgba(7, 21, 26, 0.56);
  --glow: rgba(77, 255, 194, 0.12);
  --history-cashback: var(--muted);
  --history-discount: var(--button-bg);
}

:root[data-theme-family="neon-forest"][data-theme="light"] {
  color-scheme: light;
  --bg: #e8f6f2;
  --fg: #073b35;
  --button-bg: #0fcf95;
  --button-fg: #02251f;
  --sheet-bg: #f7fffc;
  --sheet-fg: #073b35;
  --muted: rgba(7, 59, 53, 0.68);
  --toggle-bg: rgba(15, 207, 149, 0.1);
  --toggle-border: rgba(7, 59, 53, 0.18);
  --toggle-fg: #075d4f;
  --line: rgba(7, 59, 53, 0.14);
  --accent: #08a978;
  --menu-active-accent: var(--accent);
  --input-bg: rgba(255, 255, 255, 0.76);
  --glow: rgba(15, 207, 149, 0.1);
  --history-cashback: var(--muted);
  --history-discount: var(--accent);
}

* {
  box-sizing: border-box;
}

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

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display", system-ui, sans-serif;
  font-optical-sizing: auto;
  -webkit-font-smoothing: antialiased;
  background: var(--bg);
  color: var(--fg);
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: auto;
}

button,
input {
  font: inherit;
}

.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;
  row-gap: clamp(18px, 4svh, 34px);
  justify-items: center;
  align-items: start;
  padding: max(34px, 6svh) 24px calc(28px + var(--safe-bottom));
  overflow: hidden;
}

.install-card .version-badge {
  position: absolute;
  top: max(6px, env(safe-area-inset-top, 0px));
  right: max(68px, calc(42px + env(safe-area-inset-right, 0px)));
  padding: 6px 0;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.version-update {
  position: absolute;
  top: max(6px, env(safe-area-inset-top, 0px));
  right: max(68px, calc(42px + env(safe-area-inset-right, 0px)));
  min-height: 32px;
  padding: 6px 11px;
  border: 1px solid var(--toggle-border);
  border-radius: 10px;
  background: var(--button-bg);
  color: var(--button-fg);
  font: inherit;
  font-size: 13px;
  font-weight: 750;
  cursor: pointer;
}

.version-update:disabled {
  opacity: .7;
  cursor: wait;
}

.version-update:hover,
.version-update:focus-visible {
  filter: brightness(1.06);
}

.version-update:focus-visible {
  outline: 2px solid var(--button-fg);
  outline-offset: 3px;
}

.brand-logo {
  position: relative;
  width: clamp(208px, 62.4vw, 256px);
  aspect-ratio: 360 / 82;
  overflow: hidden;
  display: grid;
  place-items: center;
}

.brand-logo img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center;
  display: block;
  mix-blend-mode: normal;
  filter: none;
}

.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: 750;
}

.install-card h1 {
  align-self: end;
  margin: -2svh 0 0;
}

h1 span {
  display: block;
}

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

a.install-button {
  text-decoration: none;
}

.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: 18px;
  font-weight: 700;
  letter-spacing: 0;
  cursor: pointer;
  touch-action: manipulation;
}

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

.install-button:active,
.version-update:active,
.theme-toggle:active {
  transform: scale(0.98);
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
  }
}

.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: 184px;
  height: 184px;
  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);
}

.push-permission-modal[hidden] {
  display: none;
}

.push-permission-modal {
  position: fixed;
  inset: 0;
  z-index: 11;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(0, 22, 14, 0.52);
}

.push-permission-modal__panel {
  width: min(100%, 430px);
  border: 1px solid var(--toggle-border);
  border-radius: 24px;
  padding: 26px 22px calc(22px + var(--safe-bottom));
  background: var(--sheet-bg);
  color: var(--sheet-fg);
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.28);
}

.push-permission-modal__panel h2 {
  margin: 0 0 10px;
  font-size: 22px;
  line-height: 1.14;
}

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

.push-permission-modal__actions {
  display: grid;
  gap: 10px;
  margin-top: 22px;
}

.push-permission-modal__actions .install-button {
  width: 100%;
}

.push-permission-modal__later {
  min-height: 44px;
  border: 1px solid var(--toggle-border);
  border-radius: 999px;
  background: transparent;
  color: var(--sheet-fg);
  font: inherit;
  font-weight: 750;
  cursor: pointer;
}

.push-permission-modal__panel [data-push-modal-status]:empty {
  display: none;
}

.push-permission-modal__panel [data-push-modal-status] {
  margin-top: 12px;
  text-align: center;
}

.guest-name-modal[hidden] {
  display: none;
}

.guest-name-modal {
  position: fixed;
  inset: 0;
  z-index: 12;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(0, 22, 14, 0.52);
}

.guest-name-modal__panel {
  width: min(100%, 390px);
  display: grid;
  gap: 16px;
  border: 1px solid var(--toggle-border);
  border-radius: 24px;
  padding: 26px 22px calc(22px + var(--safe-bottom));
  background: var(--sheet-bg);
  color: var(--sheet-fg);
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.28);
}

.guest-name-modal__panel h2,
.guest-name-modal__panel p {
  margin: 0;
}

.guest-name-modal__panel h2 {
  font-size: 22px;
  line-height: 1.14;
}

.guest-name-modal__panel p {
  color: var(--muted);
  font-size: 16px;
  line-height: 1.45;
}

.guest-name-modal__panel label {
  margin-top: 0;
  color: var(--muted);
  font-size: 14px;
  font-weight: 650;
}

.guest-name-modal__panel input {
  min-height: 48px;
  width: 100%;
  border: 1px solid var(--toggle-border);
  border-radius: 14px;
  padding: 0 14px;
  background: var(--input-bg);
  color: var(--sheet-fg);
  font: inherit;
  font-size: 17px;
  outline: none;
}

.guest-name-modal__panel input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 22%, transparent);
}

.guest-name-modal__panel .install-button {
  width: 100%;
  margin-top: 10px;
}

.guest-name-modal__panel [data-guest-name-status]:empty {
  display: none;
}

.guest-name-modal__panel [data-guest-name-status] {
  text-align: center;
}

@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;
  }

  .install-card h1 {
    font-size: 38px;
  }
}
