:root {
  color-scheme: dark;
  --bg-top: #081321;
  --bg-mid: #0f1e31;
  --bg-bottom: #172b2b;
  --panel: rgba(7, 17, 27, 0.82);
  --panel-soft: rgba(14, 29, 45, 0.78);
  --line: rgba(146, 198, 210, 0.2);
  --line-strong: rgba(146, 198, 210, 0.38);
  --text: #eef7fb;
  --muted: rgba(220, 233, 238, 0.72);
  --accent: #f1c96e;
  --accent-strong: #ff9d57;
  --teal: #5fd7c6;
  --danger: #ff7f7f;
  --shadow: 0 26px 60px rgba(0, 0, 0, 0.36);
  --radius-xl: 30px;
  --radius-lg: 24px;
  --radius-md: 18px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-right: env(safe-area-inset-right, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-left: env(safe-area-inset-left, 0px);
}

* {
  box-sizing: border-box;
}

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

body {
  font-family: "Segoe UI", "Trebuchet MS", sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(95, 215, 198, 0.16), transparent 32%),
    radial-gradient(circle at bottom right, rgba(241, 201, 110, 0.12), transparent 30%),
    linear-gradient(180deg, var(--bg-top) 0%, var(--bg-mid) 54%, var(--bg-bottom) 100%);
}

button,
input {
  font: inherit;
}

.zoom-page {
  min-height: 100dvh;
  padding: 0;
}

.topbar {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 22px;
}

.topbar__brand {
  max-width: 720px;
}

.eyebrow {
  margin: 0 0 10px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  font-size: 12px;
  color: var(--accent);
}

.topbar h1 {
  margin: 0;
  font-size: clamp(40px, 8vw, 78px);
  line-height: 0.94;
}

.lead {
  margin: 14px 0 0;
  max-width: 64ch;
  line-height: 1.6;
  color: var(--muted);
}

.topbar__actions {
  display: grid;
  gap: 14px;
  justify-items: end;
}

.seed-box {
  display: grid;
  gap: 8px;
  min-width: min(100%, 460px);
}

.seed-box__label {
  font-size: 13px;
  color: var(--muted);
}

.seed-box__row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 10px;
}

.seed-box__input {
  min-height: 48px;
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 12px 14px;
  color: var(--text);
  background: rgba(6, 13, 22, 0.8);
}

.seed-box__input:focus {
  outline: none;
  border-color: var(--line-strong);
  box-shadow: 0 0 0 3px rgba(95, 215, 198, 0.14);
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  border-radius: 16px;
  border: 1px solid transparent;
  padding: 12px 18px;
  cursor: pointer;
  text-decoration: none;
  color: var(--text);
  transition: transform 0.16s ease, border-color 0.16s ease, background 0.16s ease;
}

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

.button--primary {
  background: linear-gradient(180deg, #ffb86f 0%, #ff8f58 100%);
  color: #1d1407;
  font-weight: 700;
}

.button--secondary {
  background: rgba(95, 215, 198, 0.14);
  border-color: rgba(95, 215, 198, 0.26);
}

.button--ghost {
  background: rgba(255, 255, 255, 0.05);
  border-color: var(--line);
}

.layout {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(290px, 0.65fr);
  gap: 20px;
  align-items: start;
}

.playground {
  display: grid;
  gap: 0;
  min-height: 0;
}

.zoom-hud {
  grid-template-columns: repeat(6, minmax(0, 1fr));
}

.stat {
  display: grid;
  gap: 4px;
  box-shadow: none;
}

.stat--wide {
  grid-column: span 2;
}

.stat__label {
  font-size: 12px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
}

.stat strong {
  font-size: 20px;
}

.stat__hint {
  color: var(--muted);
}

.bar {
  height: 11px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
}

.bar__fill {
  height: 100%;
  width: 0%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--teal) 0%, var(--accent) 100%);
  transition: width 0.18s ease;
}

.buff-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.buff {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  border-radius: 999px;
  padding: 8px 12px;
  background: rgba(95, 215, 198, 0.12);
  border: 1px solid rgba(95, 215, 198, 0.24);
  color: var(--text);
  font-size: 13px;
}

.buff--muted {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(255, 255, 255, 0.08);
  color: var(--muted);
}

.game-shell {
  position: relative;
  overflow: hidden;
  height: 100%;
  min-height: 0;
  border-radius: 14px;
  border: 1px solid var(--line);
  background:
    linear-gradient(180deg, rgba(4, 15, 24, 0.85) 0%, rgba(5, 10, 18, 0.96) 100%),
    radial-gradient(circle at top, rgba(95, 215, 198, 0.12), transparent 40%);
  box-shadow: var(--shadow);
  overscroll-behavior: contain;
  touch-action: none;
  -webkit-user-select: none;
  user-select: none;
}

#game-canvas {
  display: block;
  width: 100%;
  height: 100%;
  min-height: 0;
  touch-action: none;
}

.overlay {
  position: absolute;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 22px;
  background: rgba(4, 8, 15, 0.62);
  backdrop-filter: blur(10px);
}

.overlay--visible {
  display: flex;
}

.panel {
  padding: 22px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--line);
  background: var(--panel-soft);
  box-shadow: var(--shadow);
}

.panel h2 {
  margin: 0 0 12px;
  font-size: 24px;
}

.panel p {
  margin: 0;
  color: var(--muted);
  line-height: 1.6;
}

.panel--modal {
  width: min(100%, 720px);
  padding: 28px;
}

.panel__actions {
  display: flex;
  justify-content: flex-start;
  gap: 12px;
  margin-top: 22px;
}

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

.modal-grid div {
  padding: 16px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.modal-grid strong {
  display: block;
  margin-bottom: 8px;
}

.upgrade-options {
  display: grid;
  gap: 12px;
  margin-top: 18px;
}

.upgrade-card {
  width: 100%;
  text-align: left;
  border: 1px solid rgba(95, 215, 198, 0.16);
  border-radius: 20px;
  padding: 18px;
  color: var(--text);
  background: linear-gradient(180deg, rgba(17, 39, 57, 0.96) 0%, rgba(8, 19, 30, 0.96) 100%);
  cursor: pointer;
}

.upgrade-card:hover {
  border-color: rgba(241, 201, 110, 0.42);
  background: linear-gradient(180deg, rgba(24, 47, 68, 0.96) 0%, rgba(10, 24, 38, 0.96) 100%);
}

.upgrade-card__title {
  display: block;
  margin-bottom: 8px;
  font-size: 20px;
  font-weight: 700;
}

.upgrade-card__tag {
  display: inline-flex;
  margin-top: 12px;
  border-radius: 999px;
  padding: 6px 10px;
  background: rgba(241, 201, 110, 0.12);
  color: var(--accent);
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

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

.death-stats div {
  display: grid;
  gap: 8px;
  padding: 14px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.death-stats span {
  font-size: 12px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.14em;
}

.sidebar {
  display: grid;
  gap: 16px;
}

.feature-list {
  margin: 0;
  padding-left: 18px;
  color: var(--muted);
  line-height: 1.7;
}

.feature-list li + li {
  margin-top: 8px;
}

.event-feed,
.poi-feed {
  display: grid;
  gap: 10px;
}

.event-feed__empty,
.poi-feed__empty {
  color: var(--muted);
}

.event-chip,
.poi-chip {
  padding: 12px 14px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.event-chip strong,
.poi-chip strong {
  display: block;
  margin-bottom: 4px;
}

.touch-ui {
  position: absolute;
  inset: auto 0 0;
  display: none;
  justify-content: space-between;
  gap: 20px;
  padding:
    18px
    calc(18px + var(--safe-right))
    calc(18px + var(--safe-bottom))
    calc(18px + var(--safe-left));
  pointer-events: none;
  overscroll-behavior: contain;
  touch-action: none;
}

.touch-pad {
  position: relative;
  width: min(33vw, 168px);
  aspect-ratio: 1;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background:
    radial-gradient(circle at center, rgba(95, 215, 198, 0.13) 0%, rgba(5, 13, 22, 0.78) 74%),
    rgba(5, 13, 22, 0.86);
  box-shadow: 0 16px 34px rgba(0, 0, 0, 0.3);
  pointer-events: auto;
  touch-action: none;
}

.touch-pad__label {
  position: absolute;
  top: 12px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 12px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: rgba(235, 246, 250, 0.64);
}

.touch-pad__knob {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 44%;
  aspect-ratio: 1;
  border-radius: 50%;
  transform: translate(-50%, -50%);
  background: linear-gradient(180deg, rgba(241, 201, 110, 0.94) 0%, rgba(255, 141, 88, 0.94) 100%);
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.24);
}

@media (max-width: 1180px) {
  .zoom-hud {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .zoom-sidecar {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 900px) {
  .zoom-hud {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .stat--wide {
    grid-column: span 2;
  }

  .zoom-sidecar {
    grid-template-columns: 1fr;
  }

  .zoom-sidecar .seed-box__row {
    grid-template-columns: 1fr;
  }

  .panel,
  .panel--modal {
    padding: 18px;
  }

  .modal-grid,
  .death-stats {
    grid-template-columns: 1fr;
  }
}

@media (hover: none), (pointer: coarse), (max-width: 900px) {
  .touch-ui {
    display: flex;
  }
}

@media (max-width: 640px) {
  .topbar h1 {
    font-size: clamp(34px, 14vw, 56px);
  }

  .stat strong {
    font-size: 18px;
  }

  .panel__actions {
    flex-direction: column;
  }

  .button {
    width: 100%;
  }

  .game-shell {
    min-height: 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  .button,
  .bar__fill,
  .upgrade-card {
    transition: none;
  }

  .overlay {
    backdrop-filter: none;
  }
}
