:root {
  color-scheme: dark;
  --page-width: 500px;
  --surface: rgba(20, 25, 36, .92);
  --surface-light: rgba(255, 255, 255, .08);
  --text: #f7f8fb;
  --muted: #aeb6c6;
  --blue: #1878ff;
  --gold: #e8ad38;
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

[hidden] {
  display: none !important;
}

html,
body {
  min-height: 100%;
  margin: 0;
  background: #080b12;
  color: var(--text);
  font-family: Inter, "PingFang SC", "Microsoft YaHei", Arial, sans-serif;
}

body {
  display: flex;
  justify-content: center;
}

button {
  font: inherit;
}

.page-shell {
  position: relative;
  width: min(100%, var(--page-width));
  min-height: 100dvh;
  padding: 18px 16px 40px;
  overflow: hidden;
  background-color: #0d111b;
  background-position: center;
  background-size: cover;
}

.page-shell::before {
  position: absolute;
  z-index: 0;
  inset: 0;
  background: radial-gradient(circle at 50% 0, rgba(47, 109, 209, .24), transparent 44%);
  content: "";
  pointer-events: none;
}

.page-shell > * {
  position: relative;
  z-index: 1;
}

.state-view {
  display: grid;
  min-height: calc(100dvh - 58px);
  place-content: center;
  justify-items: center;
  gap: 12px;
  color: var(--muted);
  text-align: center;
}

.state-view h1,
.state-view p {
  margin: 0;
}

.state-error button {
  min-height: 42px;
  padding: 0 22px;
  border: 0;
  border-radius: 10px;
  background: var(--blue);
  color: #fff;
  cursor: pointer;
}

.spinner {
  width: 34px;
  height: 34px;
  border: 3px solid rgba(255, 255, 255, .16);
  border-top-color: var(--gold);
  border-radius: 50%;
  animation: spin .8s linear infinite;
}

.brand-header {
  display: flex;
  align-items: center;
  min-height: 58px;
  gap: 12px;
  padding: 8px 4px 16px;
  font-size: 20px;
}

.brand-header img {
  width: auto;
  max-width: 148px;
  height: 42px;
  object-fit: contain;
}

.banner-section {
  margin-bottom: 18px;
  overflow: hidden;
  border-radius: 16px;
  background: var(--surface);
  box-shadow: 0 16px 44px rgba(0, 0, 0, .28);
}

.banner-list {
  display: grid;
  gap: 8px;
}

.banner-list img {
  display: block;
  width: 100%;
  height: auto;
}

.app-card {
  display: flex;
  align-items: center;
  min-height: 110px;
  gap: 16px;
  padding: 18px;
  border: 1px solid rgba(255, 255, 255, .1);
  border-radius: 18px;
  background: var(--surface);
  box-shadow: 0 16px 44px rgba(0, 0, 0, .22);
}

.app-logo {
  flex: none;
  width: 74px;
  height: 74px;
  border-radius: 16px;
  object-fit: cover;
}

.app-copy {
  min-width: 0;
}

.app-copy h1 {
  margin: 0 0 7px;
  font-size: 23px;
}

.app-copy p {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.55;
}

.primary-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-top: 18px;
}

.action-button {
  min-height: 50px;
  padding: 0 14px;
  border: 0;
  border-radius: 12px;
  color: #fff;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 10px 24px rgba(0, 0, 0, .2);
}

.action-button:active {
  transform: translateY(1px);
}

.action-button.android {
  background: #27a35b;
}

.action-button.ios {
  background: #2e3440;
}

.action-button.play {
  grid-column: 1 / -1;
  background: linear-gradient(135deg, #d29325, #f0c767);
  color: #251704;
}

.service-entry {
  position: fixed;
  z-index: 8;
  right: max(18px, calc((100vw - var(--page-width)) / 2 + 18px));
  bottom: calc(22px + env(safe-area-inset-bottom));
  display: grid;
  justify-items: center;
  gap: 4px;
  padding: 9px 11px;
  border: 1px solid rgba(255, 255, 255, .16);
  border-radius: 16px;
  background: rgba(22, 27, 38, .94);
  color: #fff;
  font-size: 12px;
  cursor: pointer;
  box-shadow: 0 10px 28px rgba(0, 0, 0, .32);
}

.service-entry img {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  object-fit: cover;
}

body.modal-open {
  overflow: hidden;
}

.modal {
  position: fixed;
  z-index: 40;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 20px;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, .68);
  backdrop-filter: blur(3px);
}

.modal-card {
  position: relative;
  z-index: 1;
  width: min(100%, 360px);
  max-height: 70vh;
  padding: 20px;
  overflow-y: auto;
  border: 1px solid rgba(255, 255, 255, .1);
  border-radius: 18px;
  outline: none;
  background: #171c27;
  box-shadow: 0 24px 60px rgba(0, 0, 0, .5);
}

.modal-card h2 {
  margin: 0 38px 16px 0;
  font-size: 19px;
}

.choice-list {
  display: grid;
  gap: 10px;
}

.choice-button {
  min-height: 48px;
  padding: 0 16px;
  border: 1px solid rgba(255, 255, 255, .12);
  border-radius: 10px;
  background: var(--surface-light);
  color: #fff;
  cursor: pointer;
}

.choice-button:hover,
.choice-button:focus-visible {
  border-color: var(--blue);
  background: rgba(24, 120, 255, .16);
}

.modal-close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 34px;
  height: 34px;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 28px;
  line-height: 1;
  cursor: pointer;
}

.toast {
  position: fixed;
  z-index: 60;
  left: 50%;
  bottom: calc(28px + env(safe-area-inset-bottom));
  max-width: min(84vw, 420px);
  padding: 10px 16px;
  border: 1px solid rgba(255, 190, 50, .55);
  border-radius: 999px;
  background: rgba(18, 13, 4, .96);
  color: #ffe0a4;
  font-size: 14px;
  text-align: center;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 12px);
  transition: opacity .2s ease, transform .2s ease;
}

.toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

@media (prefers-reduced-motion: reduce) {
  .spinner {
    animation: none;
  }

  .toast {
    transition: none;
  }
}
