:root {
  --bg-top: #effafc;
  --bg-bottom: #dff4e8;
  --panel: rgba(255, 255, 255, 0.74);
  --line: rgba(118, 188, 170, 0.22);
  --text: #345f4c;
  --muted: #628b7e;
  --cyan: #5da89a;
  --lime: #a7cf67;
  --pink: #f0aab2;
  --orange: #e6c062;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

* {
  box-sizing: border-box;
}

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

body {
  position: relative;
  overflow: hidden;
  color: var(--text);
  font-family: "Trebuchet MS", "Lucida Sans Unicode", sans-serif;
  background:
    radial-gradient(circle at top, rgba(160, 220, 255, 0.45), transparent 35%),
    linear-gradient(180deg, var(--bg-top), var(--bg-bottom));
}

button {
  font: inherit;
}

button:focus-visible {
  outline: 2px solid rgba(99, 239, 255, 0.85);
  outline-offset: 3px;
}

.ambient,
.mesh {
  position: fixed;
  inset: 0;
  pointer-events: none;
}

.ambient {
  filter: blur(24px);
  opacity: 0.6;
}

.ambient-a {
  background: radial-gradient(circle at 15% 18%, rgba(171, 225, 255, 0.55), transparent 30%);
}

.ambient-b {
  background: radial-gradient(circle at 82% 75%, rgba(192, 228, 160, 0.45), transparent 28%);
}

.mesh {
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.03) 1px, transparent 1px);
  background-size: 22px 22px;
  mask-image: linear-gradient(180deg, transparent, rgba(0, 0, 0, 0.95) 10%, rgba(0, 0, 0, 0.95) 90%, transparent);
  opacity: 0.3;
}

.app-shell {
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding:
    calc(14px + var(--safe-top))
    14px
    calc(14px + var(--safe-bottom));
}

.device-shell {
  width: min(100%, 460px);
  display: grid;
  gap: 12px;
}

.chrome-bar,
.cta-panel {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.9), rgba(238, 249, 241, 0.94));
  border: 1px solid var(--line);
  box-shadow: 0 24px 60px rgba(89, 145, 124, 0.14);
}

.chrome-bar {
  padding: 16px 18px;
  border-radius: 24px;
  display: grid;
  gap: 10px;
}

.chrome-top {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 12px;
}

.eyebrow {
  display: inline-block;
  font-size: 0.72rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--cyan);
}

.chrome-bar h1,
.cta-panel h2 {
  margin: 0;
  font-family: Impact, Haettenschweiler, "Arial Narrow Bold", sans-serif;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.chrome-bar h1 {
  font-size: clamp(1.9rem, 7vw, 2.5rem);
  line-height: 0.94;
}

.chrome-bar p,
.cta-panel p {
  margin: 0;
  color: var(--muted);
  line-height: 1.35;
}

.chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.mini-chip {
  padding: 8px 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.65);
  border: 1px solid rgba(118, 188, 170, 0.12);
  color: #57806e;
  font-size: 0.76rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.sound-toggle {
  flex: 0 0 auto;
  min-width: 114px;
  padding: 10px 14px;
  border-radius: 999px;
  border: 1px solid rgba(93, 168, 154, 0.2);
  background:
    radial-gradient(circle at top, rgba(171, 225, 255, 0.4), transparent 65%),
    rgba(255, 255, 255, 0.82);
  color: var(--text);
  cursor: pointer;
  transition:
    transform 160ms ease,
    border-color 160ms ease,
    background 160ms ease,
    box-shadow 160ms ease;
}

.sound-toggle:hover {
  transform: translateY(-1px);
  border-color: rgba(93, 168, 154, 0.34);
  background:
    radial-gradient(circle at top, rgba(171, 225, 255, 0.52), transparent 65%),
    rgba(255, 255, 255, 0.94);
  box-shadow: 0 12px 24px rgba(89, 145, 124, 0.12);
}

.sound-toggle.is-muted {
  border-color: rgba(118, 188, 170, 0.16);
  background:
    radial-gradient(circle at top, rgba(255, 255, 255, 0.18), transparent 65%),
    rgba(246, 252, 248, 0.9);
  color: var(--muted);
}

.game-wrap {
  position: relative;
  border-radius: 32px;
  padding: 12px;
  background:
    radial-gradient(circle at top, rgba(171, 225, 255, 0.22), transparent 45%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.84), rgba(230, 244, 234, 0.96)),
    rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(118, 188, 170, 0.18);
  box-shadow: 0 28px 80px rgba(89, 145, 124, 0.16);
}

.game-wrap::before {
  content: "";
  position: absolute;
  inset: 8px;
  border-radius: 24px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  pointer-events: none;
}

.game-badge {
  position: absolute;
  top: 22px;
  left: 24px;
  z-index: 4;
  padding: 8px 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.76);
  border: 1px solid rgba(118, 188, 170, 0.18);
  color: var(--muted);
  font-size: 0.78rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

#game-container {
  width: 100%;
  aspect-ratio: 390 / 844;
  border-radius: 24px;
  overflow: hidden;
}

#game-container canvas {
  display: block;
  width: 100%;
  height: 100%;
  cursor: pointer;
}

.cta-overlay {
  position: absolute;
  inset: 12px;
  z-index: 6;
  display: grid;
  place-items: center;
  padding: 18px;
  border-radius: 24px;
  background:
    radial-gradient(circle at top, rgba(171, 225, 255, 0.18), transparent 45%),
    rgba(233, 247, 238, 0.78);
  backdrop-filter: blur(14px);
}

.cta-overlay.is-hidden {
  display: none;
}

.cta-panel {
  width: 100%;
  padding: 24px;
  border-radius: 26px;
  display: grid;
  gap: 14px;
  text-align: center;
  position: relative;
  overflow: hidden;
}

.cta-panel::before {
  content: "";
  position: absolute;
  inset: auto -18% -38% -18%;
  height: 160px;
  background: radial-gradient(circle, rgba(255, 94, 189, 0.18), transparent 62%);
  pointer-events: none;
}

.cta-panel h2 {
  font-size: clamp(2rem, 8vw, 2.8rem);
  line-height: 0.94;
}

.stat-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
  position: relative;
  z-index: 1;
}

.stat-chip {
  padding: 10px 12px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: var(--muted);
  font-size: 0.88rem;
}

.cta-actions {
  display: grid;
  gap: 10px;
  position: relative;
  z-index: 1;
}

.primary-button,
.secondary-button {
  border: 0;
  border-radius: 16px;
  padding: 16px;
  cursor: pointer;
  transition:
    transform 160ms ease,
    opacity 160ms ease,
    box-shadow 160ms ease;
}

.primary-button {
  background: linear-gradient(135deg, var(--pink), var(--orange));
  color: var(--text);
  box-shadow: 0 14px 30px rgba(255, 94, 189, 0.28);
}

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

.primary-button:hover,
.secondary-button:hover {
  transform: translateY(-1px);
}

@media (min-width: 560px) {
  .app-shell {
    padding:
      calc(20px + var(--safe-top))
      20px
      calc(20px + var(--safe-bottom));
  }

  .device-shell {
    width: min(100%, 500px);
  }

  .chrome-bar,
  .game-wrap,
  .cta-panel {
    border-radius: 28px;
  }
}

@media (min-width: 920px) {
  .app-shell {
    padding: 24px;
  }

  .device-shell {
    width: min(100%, 540px);
  }

  .chrome-bar {
    padding: 18px 20px;
  }

  .game-wrap {
    box-shadow: 0 36px 96px rgba(0, 0, 0, 0.48);
  }
}

@media (max-width: 420px) {
  .chrome-top {
    align-items: flex-start;
  }

  .sound-toggle {
    min-width: 100px;
    padding-inline: 12px;
  }

  .mini-chip {
    font-size: 0.7rem;
  }

  .cta-panel {
    padding: 20px;
  }
}

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

  .ambient,
  .mesh {
    opacity: 0.2;
  }
}
