:root {
  --bg: #07111f;
  --bg-rgb: 7, 17, 31;
  --panel: rgba(10, 24, 43, 0.76);
  --text: #f6fbff;
  --muted: #a8bad1;
  --accent: #25d9ff;
  --accent-strong: #ffcf4a;
  --danger: #ff4b67;
  --border: rgba(255, 255, 255, 0.16);
  --shadow: 0 24px 80px rgba(0, 0, 0, 0.36);
}

:root[data-theme="light"] {
  --bg: #f4fbff;
  --bg-rgb: 244, 251, 255;
  --panel: rgba(255, 255, 255, 0.82);
  --text: #07111f;
  --muted: #52647a;
  --accent: #0077ff;
  --accent-strong: #ff9f1a;
  --danger: #d91545;
  --border: rgba(7, 17, 31, 0.14);
  --shadow: 0 24px 80px rgba(47, 88, 126, 0.22);
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
}

body {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  color: var(--text);
  background: var(--bg);
  font-family: "Trebuchet MS", "Avenir Next", Verdana, sans-serif;
  touch-action: none;
  user-select: none;
}

body::before {
  position: fixed;
  inset: 0;
  z-index: -1;
  content: "";
  background:
    radial-gradient(circle at 22% 18%, rgba(111, 145, 183, 0.28), transparent 28rem),
    radial-gradient(circle at 82% 24%, rgba(94, 110, 158, 0.24), transparent 24rem),
    radial-gradient(circle at 50% 82%, rgba(41, 63, 98, 0.28), transparent 26rem),
    var(--bg);
}

body.privacy-page {
  height: auto;
  min-height: 100%;
  overflow-x: hidden;
  overflow-y: auto;
  touch-action: auto;
  user-select: text;
  -webkit-overflow-scrolling: touch;
}

html.privacy-page {
  height: auto;
  min-height: 100%;
  overflow-x: hidden;
  overflow-y: auto;
}

html.privacy-page,
html.privacy-page body {
  height: auto;
}

button {
  border: 0;
  color: inherit;
  font: inherit;
  cursor: pointer;
}

a {
  color: inherit;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.52;
}

.app-shell {
  position: relative;
  width: 100vw;
  height: 100dvh;
  min-height: 100vh;
  overflow: hidden;
}

#gameCanvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  touch-action: none;
}

.screen {
  position: absolute;
  inset: max(18px, env(safe-area-inset-top)) 18px max(18px, env(safe-area-inset-bottom));
  z-index: 3;
  display: none;
  place-content: center;
  justify-items: center;
  gap: 18px;
  padding: 28px;
  text-align: center;
  overflow: auto;
  pointer-events: auto;
}

.screen--active {
  display: grid;
}

.screen::before {
  position: absolute;
  inset: 0;
  z-index: -1;
  content: "";
  border: 1px solid var(--border);
  border-radius: 34px;
  background: linear-gradient(145deg, var(--panel), rgba(var(--bg-rgb), 0.5));
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

#gameOverScreen::before {
  background: linear-gradient(145deg, rgba(var(--bg-rgb), 0.52), rgba(var(--bg-rgb), 0.24));
  backdrop-filter: blur(10px);
}

.brand-mark {
  display: grid;
  width: 86px;
  height: 86px;
  place-items: center;
  border-radius: 28px;
  color: #07111f;
  background:
    radial-gradient(circle at 25% 30%, #ff4b4b 0 17%, transparent 18%),
    radial-gradient(circle at 70% 28%, #25d9ff 0 15%, transparent 16%),
    radial-gradient(circle at 52% 72%, #ffe04d 0 22%, transparent 23%),
    #ffffff;
  box-shadow: 0 18px 38px rgba(37, 217, 255, 0.28);
  font-size: 1.35rem;
  font-weight: 900;
  letter-spacing: -0.08em;
}

.brand-mark--image {
  display: block;
  object-fit: cover;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: clamp(3.2rem, 16vw, 6.25rem);
  line-height: 0.85;
  letter-spacing: -0.08em;
  text-wrap: balance;
}

h2 {
  font-size: clamp(2.6rem, 14vw, 5rem);
  line-height: 0.9;
  letter-spacing: -0.07em;
}

.tagline {
  max-width: 30rem;
  color: var(--muted);
  font-size: clamp(1rem, 4.6vw, 1.2rem);
  line-height: 1.45;
}

.high-score {
  color: var(--accent-strong);
  font-size: 1.1rem;
  font-weight: 800;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.primary-button,
.secondary-button,
.toggle-button {
  min-width: 160px;
  min-height: 48px;
  border-radius: 999px;
  font-weight: 900;
  letter-spacing: 0.02em;
  transition:
    transform 160ms ease,
    box-shadow 160ms ease,
    background 160ms ease;
}

.primary-button {
  color: #07111f;
  background: linear-gradient(135deg, var(--accent-strong), var(--accent));
  box-shadow: 0 14px 32px rgba(37, 217, 255, 0.24);
}

.secondary-button,
.toggle-button {
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.1);
}

.primary-button:active,
.secondary-button:active,
.toggle-button:active {
  transform: scale(0.96);
}

.settings-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
}

.account-panel {
  display: grid;
  width: min(100%, 420px);
  gap: 12px;
  color: var(--muted);
}

.account-panel p {
  min-height: 1.35em;
  font-size: 0.95rem;
  line-height: 1.35;
}

.account-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
}

.account-actions .primary-button,
.account-actions .secondary-button {
  min-width: 128px;
}

.account-panel--game-over {
  margin-top: -4px;
}

.install-modal {
  position: absolute;
  inset: 0;
  z-index: 5;
  display: grid;
  place-items: center;
  padding: max(18px, env(safe-area-inset-top)) 18px max(18px, env(safe-area-inset-bottom));
}

.install-modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(4, 10, 20, 0.68);
  backdrop-filter: blur(12px);
}

.install-panel {
  position: relative;
  display: grid;
  width: min(100%, 460px);
  gap: 10px;
  padding: 18px;
  border: 1px solid var(--border);
  border-radius: 26px;
  background: linear-gradient(145deg, var(--panel), rgba(var(--bg-rgb), 0.72));
  box-shadow: var(--shadow);
}

.install-panel h2 {
  font-size: 1.2rem;
  line-height: 1.1;
  letter-spacing: 0;
}

.install-panel p {
  min-height: 1.35em;
  color: var(--muted);
  font-size: 0.95rem;
  line-height: 1.35;
}

.review-panel {
  display: grid;
  width: min(100%, 460px);
  gap: 10px;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.08);
}

.review-panel h2 {
  font-size: 1.2rem;
  line-height: 1.1;
  letter-spacing: 0;
}

.star-rating {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  margin: 0;
  padding: 0;
  border: 0;
}

.star-rating legend {
  width: 100%;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 900;
  text-transform: uppercase;
}

.star-rating label {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 7px 9px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  color: var(--text);
  font-size: 0.82rem;
  font-weight: 800;
}

.review-panel textarea {
  width: 100%;
  min-height: 78px;
  resize: vertical;
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 10px 12px;
  color: var(--text);
  background: rgba(255, 255, 255, 0.1);
  font: inherit;
  user-select: text;
}

.review-panel textarea::placeholder {
  color: var(--muted);
}

.hud {
  position: absolute;
  top: max(12px, env(safe-area-inset-top));
  right: 12px;
  left: 12px;
  z-index: 2;
  display: none;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 10px;
  pointer-events: none;
}

.hud--active {
  display: flex;
}

.hud-card {
  min-width: 112px;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--panel);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.18);
  text-align: center;
  backdrop-filter: blur(16px);
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.hud-card strong {
  display: inline-block;
  margin-left: 5px;
  color: var(--text);
  font-size: 1.05rem;
}

.hud-card[hidden],
[hidden] {
  display: none !important;
}

.hud-settings {
  display: flex;
  gap: 8px;
  pointer-events: auto;
}

.hud-toggle {
  min-width: 94px;
  min-height: 40px;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--panel);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.14);
  color: var(--text);
  font-size: 0.74rem;
  font-weight: 900;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  backdrop-filter: blur(16px);
}

.hud-toggle:active {
  transform: scale(0.96);
}

.score-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  width: min(100%, 360px);
}

.score-grid p {
  display: grid;
  gap: 6px;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.08);
  color: var(--muted);
  font-weight: 800;
}

.score-grid strong {
  color: var(--text);
  font-size: 2rem;
}

.status-text {
  min-height: 1.3em;
  color: var(--muted);
  font-size: 0.92rem;
}

.privacy-link,
.app-version {
  position: absolute;
  bottom: max(10px, env(safe-area-inset-bottom));
  z-index: 4;
  margin: 0;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  opacity: 0.9;
}

.privacy-link {
  left: 12px;
  pointer-events: auto;
}

.app-version {
  right: 12px;
  pointer-events: none;
}

.privacy-document {
  width: min(880px, calc(100% - 32px));
  margin: 0 auto;
  padding: 48px 0 64px;
  line-height: 1.6;
}

.privacy-document h1 {
  margin-bottom: 12px;
  font-size: clamp(2.2rem, 9vw, 4.5rem);
  letter-spacing: 0;
}

.privacy-document h2 {
  margin-top: 28px;
  margin-bottom: 8px;
  font-size: 1.35rem;
  letter-spacing: 0;
  line-height: 1.2;
}

.privacy-document p,
.privacy-document li {
  color: var(--muted);
}

.privacy-document ul {
  padding-left: 1.25rem;
}

.privacy-document a {
  color: var(--accent-strong);
}

.landing-page {
  min-height: 100%;
  overflow: auto;
  touch-action: auto;
  user-select: text;
}

.landing-page body {
  overflow: auto;
}

.landing-header,
.landing-hero,
.landing-reviews,
.landing-footer {
  width: min(1120px, calc(100% - 32px));
  margin: 0 auto;
}

.landing-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 18px 0;
}

.landing-brand,
.landing-header nav,
.landing-actions,
.landing-footer {
  display: flex;
  align-items: center;
}

.landing-brand {
  gap: 10px;
  color: var(--text);
  font-weight: 900;
  text-decoration: none;
}

.landing-brand-mark {
  width: 42px;
  height: 42px;
  display: block;
  flex: 0 0 auto;
  border-radius: 14px;
}

.landing-header nav {
  gap: 18px;
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 800;
}

.landing-header a,
.landing-footer a {
  text-decoration: none;
}

.nav-cta {
  color: var(--accent-strong);
}

.landing-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 390px);
  align-items: center;
  gap: 48px;
  min-height: calc(100dvh - 90px);
  padding: 24px 0 64px;
}

.landing-copy {
  display: grid;
  gap: 24px;
}

.landing-copy h1 {
  max-width: 760px;
  font-size: clamp(3.2rem, 10vw, 7rem);
}

.landing-copy p {
  max-width: 660px;
  color: var(--muted);
  font-size: 1.08rem;
  line-height: 1.65;
}

.landing-actions {
  flex-wrap: wrap;
  gap: 12px;
}

.landing-button {
  display: inline-grid;
  min-width: 160px;
  min-height: 48px;
  place-items: center;
  padding: 0 22px;
  text-decoration: none;
}

.phone-preview {
  position: relative;
  min-height: 560px;
  border: 1px solid var(--border);
  border-radius: 36px;
  background:
    linear-gradient(160deg, rgba(255, 255, 255, 0.12), transparent 38%),
    radial-gradient(circle at 30% 22%, rgba(37, 217, 255, 0.32), transparent 28%),
    radial-gradient(circle at 72% 74%, rgba(255, 207, 74, 0.24), transparent 32%),
    rgba(10, 24, 43, 0.72);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.landing-reviews {
  display: grid;
  gap: 24px;
  padding: 22px 0 72px;
}

.reviews-summary {
  display: flex;
  align-items: end;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
}

.section-kicker {
  color: var(--accent-strong);
  font-size: 0.82rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.reviews-summary h2 {
  width: min(100%, 640px);
  font-size: clamp(2.2rem, 6vw, 4.4rem);
  letter-spacing: -0.04em;
}

.reviews-summary p:not(.section-kicker) {
  max-width: 360px;
  color: var(--muted);
  line-height: 1.5;
}

.review-carousel {
  position: relative;
  padding: 22px;
  border: 1px solid var(--border);
  border-radius: 34px;
  background:
    radial-gradient(circle at 18% 22%, rgba(37, 217, 255, 0.18), transparent 22rem),
    radial-gradient(circle at 76% 80%, rgba(255, 207, 74, 0.16), transparent 24rem),
    linear-gradient(145deg, var(--panel), rgba(var(--bg-rgb), 0.48));
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.review-track {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  min-height: 232px;
}

.review-card {
  display: grid;
  align-content: start;
  gap: 14px;
  min-height: 232px;
  padding: 18px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background:
    linear-gradient(160deg, rgba(255, 255, 255, 0.12), transparent 42%),
    rgba(var(--bg-rgb), 0.5);
  color: var(--text);
  box-shadow: 0 14px 34px rgba(0, 0, 0, 0.2);
  backdrop-filter: blur(14px);
}

.review-card-rating {
  color: var(--accent-strong);
  font-size: 1.25rem;
  letter-spacing: 0.03em;
  text-shadow: 0 0 18px rgba(255, 207, 74, 0.28);
}

.review-card p {
  color: var(--text);
  line-height: 1.5;
}

.review-arrow {
  position: absolute;
  top: 50%;
  z-index: 2;
  display: grid;
  width: 44px;
  height: 44px;
  place-items: center;
  border: 1px solid var(--border);
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent-strong), var(--accent));
  box-shadow: 0 12px 30px rgba(37, 217, 255, 0.22);
  color: #07111f;
  font-size: 2rem;
  font-weight: 900;
  line-height: 1;
  transform: translateY(-50%);
}

.review-arrow--previous {
  left: -22px;
}

.review-arrow--next {
  right: -22px;
}

.review-arrow:disabled {
  background: rgba(255, 255, 255, 0.14);
  color: var(--muted);
  opacity: 0.52;
}

.review-dots {
  display: flex;
  justify-content: center;
  gap: 8px;
  min-height: 12px;
  margin-top: 18px;
}

.review-dot {
  width: 9px;
  height: 9px;
  padding: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.35);
  opacity: 1;
}

.review-dot[aria-current="true"] {
  width: 22px;
  border-radius: 999px;
  background: linear-gradient(135deg, var(--accent-strong), var(--accent));
}

.preview-hud {
  position: absolute;
  top: 18px;
  right: 18px;
  left: 18px;
  display: flex;
  justify-content: center;
  gap: 10px;
}

.preview-hud span {
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--panel);
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 900;
  text-transform: uppercase;
}

.preview-hud strong {
  color: var(--text);
}

.preview-circle {
  position: absolute;
  display: block;
  border-radius: 50%;
  box-shadow: 0 0 36px currentColor;
}

.preview-circle::after {
  position: absolute;
  top: 22%;
  left: 24%;
  width: 30%;
  height: 30%;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.38);
  content: "";
}

.preview-circle--red {
  top: 32%;
  left: 16%;
  width: 92px;
  height: 92px;
  color: #ff4b4b;
  background: #ff4b4b;
}

.preview-circle--cyan {
  top: 18%;
  right: 17%;
  width: 118px;
  height: 118px;
  color: #25d9ff;
  background: #25d9ff;
}

.preview-circle--yellow {
  right: 25%;
  bottom: 18%;
  width: 150px;
  height: 150px;
  color: #ffe04d;
  background: #ffe04d;
}

.preview-circle--purple {
  bottom: 34%;
  left: 28%;
  width: 76px;
  height: 76px;
  color: #b145ff;
  background: #b145ff;
}

.landing-footer {
  justify-content: space-between;
  gap: 18px;
  padding: 34px 0 42px;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 800;
}

.miss-flash {
  animation: miss-flash 180ms ease;
}

.danger-flash {
  animation: danger-flash 360ms ease;
}

@keyframes miss-flash {
  50% {
    background-color: rgba(255, 75, 103, 0.22);
  }
}

@keyframes danger-flash {
  35% {
    background-color: rgba(177, 69, 255, 0.42);
  }
}

@media (min-width: 720px) {
  .screen {
    inset: 50%;
    width: min(680px, calc(100vw - 48px));
    height: auto;
    min-height: 560px;
    transform: translate(-50%, -50%);
  }
}

@media (max-width: 820px) {
  .landing-header {
    align-items: flex-start;
  }

  .landing-header nav {
    flex-wrap: wrap;
    justify-content: flex-end;
  }

  .landing-hero {
    grid-template-columns: 1fr;
  }

  .landing-hero {
    min-height: auto;
  }

  .review-track {
    grid-template-columns: 1fr;
    min-height: 220px;
  }

  .review-card {
    min-height: 220px;
  }

  .review-arrow--previous {
    left: -10px;
  }

  .review-arrow--next {
    right: -10px;
  }

  .phone-preview {
    display: none;
  }
}

@media (max-width: 540px) {
  .landing-header {
    flex-direction: column;
  }

  .landing-header nav {
    justify-content: flex-start;
  }

  .landing-copy h1 {
    font-size: clamp(2.8rem, 18vw, 4.4rem);
  }

  .landing-button,
  .landing-actions {
    width: 100%;
  }

  .landing-footer {
    flex-direction: column;
    align-items: flex-start;
  }
}

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