:root {
  --night: #141b2f;
  --night-soft: #243152;
  --cream: #fff2cf;
  --cream-light: #fff8e7;
  --cream-shadow: #e5c982;
  --gold: #f5bf45;
  --gold-dark: #9d6f16;
  --self: #2477df;
  --opponent: #d85b46;
  --neutral: #d6d7bd;
  --muted: #65708a;
  --danger: #d95545;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  color: var(--night);
  background: var(--night);
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-synthesis: none;
}

* {
  box-sizing: border-box;
}

body {
  min-height: 100vh;
  margin: 0;
  overflow: hidden;
  background: var(--night);
}

button {
  border: 0;
  font: inherit;
}

.app-shell {
  min-height: 100dvh;
  overflow: hidden;
}

.welcome,
.gps-screen {
  position: relative;
  min-height: 100dvh;
  overflow: hidden;
  color: var(--cream-light);
  background:
    radial-gradient(circle at 24% 18%, rgba(245, 191, 69, 0.32), transparent 24%),
    radial-gradient(circle at 86% 8%, rgba(36, 119, 223, 0.28), transparent 28%),
    linear-gradient(180deg, #243152 0%, #141b2f 68%, #0e1425 100%);
}

.animated-board {
  position: absolute;
  inset: -12%;
  opacity: 0.8;
  background:
    linear-gradient(32deg, transparent 0 44%, rgba(245, 191, 69, 0.18) 44% 46%, transparent 46% 100%),
    linear-gradient(146deg, transparent 0 50%, rgba(255, 248, 231, 0.12) 50% 52%, transparent 52% 100%),
    radial-gradient(circle at 24% 70%, rgba(139, 196, 111, 0.82) 0 13%, transparent 13.4%),
    radial-gradient(circle at 62% 56%, rgba(36, 119, 223, 0.86) 0 10%, transparent 10.4%),
    radial-gradient(circle at 82% 78%, rgba(216, 91, 70, 0.72) 0 9%, transparent 9.4%),
    linear-gradient(180deg, #44afc9 0 32%, #77b963 32% 100%);
  filter: saturate(1.12);
  transform: rotate(-5deg) scale(1.05);
  animation: boardDrift 12s ease-in-out infinite alternate;
}

.animated-board::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    repeating-linear-gradient(0deg, rgba(20, 27, 47, 0.14) 0 1px, transparent 1px 34px),
    repeating-linear-gradient(90deg, rgba(20, 27, 47, 0.12) 0 1px, transparent 1px 34px);
  mix-blend-mode: multiply;
}

.welcome-content,
.gps-card {
  position: relative;
  z-index: 1;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: max(26px, var(--safe-top)) 22px max(26px, var(--safe-bottom));
  text-align: center;
}

.welcome-logo {
  width: 86px;
  height: 86px;
  padding: 12px;
  border: 3px solid var(--gold-dark);
  border-radius: 28px;
  background: var(--gold);
  box-shadow: 0 15px 0 rgba(157, 111, 22, 0.34), 0 22px 40px rgba(0, 0, 0, 0.24);
  animation: softFloat 3.6s ease-in-out infinite;
}

.welcome h1 {
  margin: 0;
  color: var(--cream-light);
  font-size: clamp(56px, 16vw, 86px);
  line-height: 0.9;
  font-weight: 1000;
  letter-spacing: 0;
  text-shadow: 0 5px 0 rgba(20, 27, 47, 0.85), 0 11px 30px rgba(0, 0, 0, 0.24);
}

.welcome-content > strong,
.gps-card h1 {
  margin: 0;
  color: var(--gold);
  font-size: clamp(25px, 7vw, 34px);
  line-height: 1.02;
  font-weight: 1000;
  text-shadow: 0 3px 0 rgba(20, 27, 47, 0.7);
}

.welcome-content > p,
.gps-card p {
  max-width: 330px;
  margin: 0;
  color: #fff4d6;
  font-size: 15px;
  line-height: 1.35;
  font-weight: 800;
}

.welcome-actions {
  width: min(100%, 330px);
  display: grid;
  gap: 10px;
  margin-top: 10px;
}

.hero-button,
.ghost-button,
.auth-button {
  min-height: 56px;
  border: 2px solid var(--night);
  border-radius: 20px;
  font-size: 16px;
  font-weight: 1000;
  box-shadow: 0 10px 18px rgba(0, 0, 0, 0.22);
}

.hero-button {
  color: var(--night);
  background: linear-gradient(180deg, #ffd45d 0%, var(--gold) 100%);
  border-bottom: 6px solid var(--gold-dark);
}

.ghost-button {
  color: var(--cream-light);
  background: rgba(20, 27, 47, 0.72);
  border-color: rgba(255, 248, 231, 0.72);
  border-bottom: 5px solid rgba(0, 0, 0, 0.28);
}

.gps-card {
  width: min(calc(100% - 28px), 380px);
  min-height: auto;
  margin: auto;
  padding: 20px;
  border: 3px solid var(--gold);
  border-bottom: 8px solid var(--gold-dark);
  border-radius: 30px;
  justify-content: center;
  background:
    radial-gradient(circle at 50% 34%, rgba(245, 191, 69, 0.24), transparent 24%),
    linear-gradient(180deg, rgba(36, 49, 82, 0.7), rgba(20, 27, 47, 0.96));
  box-shadow: 0 22px 44px rgba(0, 0, 0, 0.28);
}

.gps-screen {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 8px;
  padding: max(18px, var(--safe-top)) 0 max(18px, var(--safe-bottom));
}

.gps-illustration {
  position: relative;
  width: min(72vw, 270px);
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  margin-bottom: 4px;
}

.capture-tile {
  position: absolute;
  width: 72%;
  height: 50%;
  border: 4px solid var(--night);
  border-radius: 34px;
  background:
    linear-gradient(135deg, rgba(36, 119, 223, 0.88), rgba(33, 168, 120, 0.9)),
    repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.13) 0 8px, transparent 8px 18px);
  box-shadow: 0 14px 0 rgba(11, 16, 32, 0.24);
  transform: rotate(-10deg);
}

.capture-ring {
  position: absolute;
  width: 92%;
  height: 92%;
  border: 5px solid rgba(245, 191, 69, 0.9);
  border-radius: 50%;
  animation: ringPulse 1.8s ease-in-out infinite;
}

.hero-avatar {
  position: relative;
  width: 92px;
  height: 92px;
  border: 5px solid white;
  border-radius: 32px;
  display: grid;
  place-items: center;
  color: var(--night);
  background: var(--gold);
  font-size: 46px;
  font-weight: 1000;
  box-shadow: 0 11px 0 var(--gold-dark), 0 24px 36px rgba(0, 0, 0, 0.26);
}

.loading-screen {
  min-height: 100dvh;
  display: grid;
  place-content: center;
  gap: 10px;
  text-align: center;
  color: var(--cream-light);
  background:
    radial-gradient(circle at 25% 10%, rgba(245, 191, 69, 0.28), transparent 28%),
    linear-gradient(180deg, #243152 0%, #141b2f 100%);
}

.loading-screen h1 {
  margin: 0;
  font-size: 44px;
  font-weight: 950;
}

.loading-screen p {
  margin: 0;
  color: var(--gold);
  font-weight: 900;
}

.game {
  position: relative;
  min-height: 100dvh;
  background: var(--night);
  color: var(--night);
  overflow: hidden;
}

.top-hud {
  position: absolute;
  z-index: 10;
  top: max(10px, var(--safe-top));
  left: 10px;
  right: 10px;
  display: flex;
  gap: 8px;
  align-items: flex-start;
}

.objective {
  flex: 1;
  min-width: 0;
  display: flex;
  gap: 8px;
  align-items: center;
  padding: 8px;
  border: 2px solid var(--gold);
  border-radius: 20px;
  color: var(--cream-light);
  background: rgba(20, 27, 47, 0.9);
  box-shadow: 0 8px 18px rgba(11, 16, 32, 0.22);
}

.sigil {
  width: 36px;
  height: 36px;
  border: 2px solid var(--gold-dark);
  border-radius: 13px;
  display: grid;
  place-items: center;
  background: var(--gold);
  color: var(--night);
  font-size: 20px;
  font-weight: 950;
  flex: 0 0 auto;
}

.objective strong,
.objective span {
  display: block;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.objective strong {
  font-size: 14px;
  font-weight: 950;
}

.objective span {
  color: #f9df97;
  font-size: 11px;
  font-weight: 850;
}

.currency {
  min-width: 86px;
  padding: 8px 10px;
  border: 2px solid var(--gold-dark);
  border-radius: 20px;
  background: var(--cream-light);
  box-shadow: 0 8px 18px rgba(11, 16, 32, 0.22);
  text-align: right;
}

.currency strong {
  display: block;
  font-size: 14px;
  font-weight: 950;
}

.currency span {
  color: #7b6332;
  font-size: 10px;
  font-weight: 900;
}

.install-banner,
.update-banner,
.ios-help {
  position: absolute;
  z-index: 12;
  left: 10px;
  right: 10px;
  bottom: calc(76px + var(--safe-bottom));
  display: flex;
  gap: 8px;
  align-items: center;
  padding: 10px;
  border: 2px solid var(--night);
  border-radius: 18px;
  background: var(--cream-light);
  box-shadow: 0 10px 24px rgba(11, 16, 32, 0.24);
}

.ios-help {
  align-items: flex-start;
}

.install-banner[hidden],
.update-banner[hidden],
.ios-help[hidden] {
  display: none;
}

.banner-copy {
  flex: 1;
  min-width: 0;
}

.banner-copy strong {
  display: block;
  font-size: 13px;
  font-weight: 950;
}

.banner-copy span {
  display: block;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  line-height: 1.25;
}

.primary,
.secondary,
.icon-close {
  min-height: 42px;
  border-radius: 14px;
  font-weight: 950;
}

.primary {
  padding: 0 14px;
  border: 2px solid var(--night);
  border-bottom: 5px solid #123c89;
  color: white;
  background: var(--self);
}

.secondary {
  padding: 0 12px;
  border: 2px solid var(--night);
  border-bottom: 4px solid var(--cream-shadow);
  color: var(--night);
  background: var(--cream);
}

.icon-close {
  width: 42px;
  border: 2px solid var(--night);
  background: var(--cream);
  color: var(--night);
}

.map-wrap {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(180deg, rgba(62, 169, 201, 0.95) 0 28%, rgba(139, 196, 111, 0.96) 28% 100%);
}

.dimmed-map::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(circle at 50% 58%, transparent 0 23%, rgba(20, 27, 47, 0.62) 28% 100%);
}

.map-svg {
  width: 100%;
  height: 100%;
  display: block;
  touch-action: none;
}

.map-svg.terrain .zone {
  opacity: 0.12;
}

.map-svg.control .zone {
  opacity: 0.42;
}

.map-svg.control .zone.neutral {
  opacity: 0.22;
}

.map-svg.control .zone.selected {
  opacity: 0.78;
}

.map-svg.political .zone {
  display: none;
}

.map-svg.political .sector-fill {
  opacity: 0.58;
}

.map-svg:not(.political) .sector-fill {
  opacity: 0;
}

.map-svg.terrain .commune-border {
  opacity: 0.62;
}

.map-svg.terrain .road-secondary {
  opacity: 0.95;
}

.map-svg.control .terrain-details {
  opacity: 0.58;
}

.map-svg.control .road-secondary {
  opacity: 0.25;
}

.map-svg.political .terrain-details,
.map-svg.political .road,
.map-svg.political .river-line {
  opacity: 0.18;
}

.map-svg.political .poi:not(.poi-cityHall) {
  opacity: 0.72;
}

.map-svg:not(.political) .sector-label {
  display: none;
}

.commune-border {
  fill: rgba(63, 141, 90, 0.08);
  pointer-events: none;
  stroke: var(--night);
  stroke-width: 5px;
  vector-effect: non-scaling-stroke;
}

.sector-fill {
  pointer-events: none;
  stroke: var(--night);
  stroke-width: 2px;
  vector-effect: non-scaling-stroke;
}

.zone {
  stroke: rgba(20, 27, 47, 0.34);
  stroke-width: 0.75px;
  vector-effect: non-scaling-stroke;
  transition: opacity 160ms ease, fill 160ms ease;
}

.zone.selected {
  stroke: white;
  stroke-width: 3px;
  opacity: 0.78;
}

.zone.starter-protected {
  stroke: var(--gold);
  stroke-dasharray: 7 4;
  stroke-width: 3px;
}

.zone.self {
  fill: var(--self);
}

.zone.opponent {
  fill: var(--opponent);
}

.zone.neutral {
  fill: rgba(255, 248, 231, 0.68);
}

.map-label {
  pointer-events: none;
  paint-order: stroke;
  stroke: var(--cream-light);
  stroke-width: 0.00016px;
  fill: var(--night);
  font-size: 0.00088px;
  font-weight: 900;
  text-anchor: middle;
}

.sector-label {
  pointer-events: none;
}

.sector-label-bg {
  fill: rgba(255, 248, 231, 0.88);
  stroke: rgba(20, 27, 47, 0.7);
  stroke-width: 0.00012px;
}

.sector-status {
  fill: #6a5a3e;
  font-size: 0.00058px;
  font-weight: 800;
}

.player {
  fill: var(--self);
  stroke: white;
  stroke-width: 4px;
  vector-effect: non-scaling-stroke;
}

.activity-marker {
  pointer-events: none;
}

.activity-halo {
  fill: rgba(255, 198, 70, 0.22);
  stroke: var(--gold);
  stroke-width: 3px;
  vector-effect: non-scaling-stroke;
  animation: activityPulse 1.8s ease-in-out infinite;
}

.activity-icon {
  fill: var(--night);
  font-size: 12px;
  font-weight: 1000;
  text-anchor: middle;
}

.activity-marker.PROTECTION_PLACED .activity-halo {
  fill: rgba(36, 119, 223, 0.2);
  stroke: var(--self);
}

.capture-focus .zone.selected {
  animation: zonePulse 1.1s ease-in-out infinite;
}

.map-svg .zone.selected.self {
  animation: capturedZoneGlow 1.8s ease-in-out infinite;
}

.gps-radius {
  fill: rgba(36, 119, 223, 0.14);
  stroke: rgba(18, 60, 137, 0.55);
  stroke-width: 2px;
  vector-effect: non-scaling-stroke;
}

.mode-switch {
  position: absolute;
  z-index: 11;
  top: calc(max(10px, var(--safe-top)) + 62px);
  left: 10px;
  right: 10px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
}

.mode-button {
  height: 38px;
  border: 2px solid var(--night);
  border-bottom: 4px solid var(--cream-shadow);
  border-radius: 14px;
  background: rgba(255, 248, 231, 0.94);
  color: var(--night);
  font-size: 11px;
  font-weight: 950;
}

.mode-button.active {
  border-color: var(--gold);
  border-bottom-color: var(--gold-dark);
  color: white;
  background: var(--night);
}

.map-controls {
  position: absolute;
  z-index: 12;
  top: calc(max(10px, var(--safe-top)) + 116px);
  right: 10px;
  display: grid;
  gap: 7px;
}

.map-controls button {
  width: 42px;
  height: 42px;
  border: 2px solid var(--night);
  border-bottom: 5px solid var(--gold-dark);
  border-radius: 15px;
  color: var(--night);
  background: var(--gold);
  font-size: 21px;
  font-weight: 1000;
  box-shadow: 0 8px 18px rgba(11, 16, 32, 0.22);
}

.quest-chip {
  position: absolute;
  z-index: 12;
  top: calc(max(10px, var(--safe-top)) + 250px);
  right: 10px;
  border: 2px solid var(--night);
  border-bottom: 5px solid var(--gold-dark);
  border-radius: 15px;
  color: var(--night);
  background: var(--gold);
  box-shadow: 0 8px 18px rgba(11, 16, 32, 0.22);
  font-weight: 1000;
  padding: 9px 12px;
}

.activity-chip {
  position: absolute;
  z-index: 12;
  top: calc(max(10px, var(--safe-top)) + 306px);
  right: 10px;
  border: 2px solid var(--night);
  border-bottom: 5px solid #1f6f63;
  border-radius: 15px;
  color: var(--cream-light);
  background: #249c88;
  box-shadow: 0 8px 18px rgba(11, 16, 32, 0.22);
  font-weight: 1000;
  padding: 9px 12px;
}

.terrain-details {
  pointer-events: none;
}

.road {
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
  paint-order: stroke;
}

.road-main {
  stroke: #f5d88a;
  stroke-width: 7px;
  vector-effect: non-scaling-stroke;
  filter: drop-shadow(0 0.0012px 0 rgba(20, 27, 47, 0.45));
}

.road-secondary {
  stroke: #ffe8a8;
  stroke-width: 5px;
  vector-effect: non-scaling-stroke;
  opacity: 0.86;
}

.river-line {
  fill: none;
  stroke: rgba(63, 169, 209, 0.78);
  stroke-linecap: round;
  stroke-width: 5px;
  vector-effect: non-scaling-stroke;
}

.poi-marker {
  fill: var(--cream-light);
  stroke: var(--night);
  stroke-width: 2px;
  vector-effect: non-scaling-stroke;
}

.poi-gold {
  fill: var(--gold);
}

.poi {
  cursor: pointer;
  pointer-events: auto;
  transition: opacity 180ms ease, filter 180ms ease;
}

.poi-hit {
  fill: rgba(255, 255, 255, 0);
  pointer-events: all;
}

.poi.selected,
.poi:hover {
  filter: drop-shadow(0 0 9px rgba(255, 198, 70, 0.72));
}

.poi-shadow {
  fill: rgba(0, 0, 0, 0.22);
}

.poi-base {
  fill: var(--cream-light);
  stroke: var(--night);
  stroke-width: 3px;
  vector-effect: non-scaling-stroke;
}

.poi-cityHall .poi-base,
.poi-castle .poi-base,
.poi-port .poi-base {
  fill: var(--gold);
}

.poi-park .poi-base,
.poi-viewpoint .poi-base {
  fill: #8bd46e;
}

.poi-icon {
  pointer-events: none;
  fill: var(--night);
  font-size: 13px;
  font-weight: 1000;
  text-anchor: middle;
  vector-effect: non-scaling-stroke;
}

.poi-label {
  pointer-events: none;
  paint-order: stroke;
  stroke: rgba(255, 248, 231, 0.94);
  stroke-width: 5px;
  fill: var(--night);
  font-size: 12px;
  font-weight: 950;
  text-anchor: middle;
  vector-effect: non-scaling-stroke;
}

.poi-cityHall {
  animation: poiGlow 2.4s ease-in-out infinite;
}

.poi-castle {
  filter: drop-shadow(0 7px 0 rgba(20, 27, 47, 0.22));
}

.sheet {
  position: absolute;
  z-index: 11;
  left: 0;
  right: 0;
  bottom: calc(58px + var(--safe-bottom));
  min-height: 132px;
  padding: 8px 10px 10px;
  border: 2px solid var(--night);
  border-radius: 26px 26px 0 0;
  background: var(--cream-light);
  box-shadow: 0 -12px 28px rgba(11, 16, 32, 0.22);
}

.sheet-glow {
  box-shadow: 0 -12px 28px rgba(11, 16, 32, 0.22), 0 0 0 4px rgba(245, 191, 69, 0.24);
}

.poi-sheet {
  border-color: var(--gold-dark);
}

.poi-owner {
  min-width: 42px;
  text-align: center;
  color: var(--night);
  background: var(--gold);
}

.grip {
  width: 48px;
  height: 5px;
  margin: 0 auto 8px;
  border-radius: 999px;
  background: var(--gold-dark);
  opacity: 0.7;
}

.sheet-head {
  display: flex;
  justify-content: space-between;
  gap: 10px;
}

.sheet small {
  display: block;
  color: var(--gold-dark);
  font-size: 10px;
  font-weight: 950;
  text-transform: uppercase;
}

.sheet h2 {
  margin: 0;
  font-size: 18px;
  line-height: 1.05;
}

.owner {
  align-self: flex-start;
  padding: 6px 9px;
  border: 2px solid var(--night);
  border-bottom-width: 4px;
  border-radius: 14px;
  background: var(--neutral);
  font-size: 11px;
  font-weight: 950;
}

.sheet-line {
  margin: 8px 0;
  color: #6d5f47;
  font-size: 12px;
  font-weight: 850;
}

.sheet-actions {
  display: flex;
  gap: 8px;
}

.capture-button {
  position: relative;
  overflow: hidden;
  min-width: 138px;
  min-height: 52px;
  font-size: 17px;
}

.capture-button::after {
  content: "";
  position: absolute;
  inset: -40% auto -40% -60%;
  width: 44%;
  transform: rotate(18deg);
  background: rgba(255, 255, 255, 0.34);
  animation: buttonShine 1.5s ease-in-out infinite;
}

.owned-button {
  min-height: 52px;
  color: var(--night);
  background: #5bd28a;
  border-bottom-color: #21894b;
}

.capture-bar {
  height: 10px;
  margin: 9px 0 8px;
  overflow: hidden;
  border: 2px solid var(--night);
  border-radius: 999px;
  background: #ead9aa;
}

.capture-bar span {
  display: block;
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--self), var(--gold));
  transition: width 160ms linear;
}

.capture-bar::after {
  content: "";
  display: block;
  height: 100%;
  width: 26%;
  margin-top: -10px;
  background: rgba(255, 255, 255, 0.32);
  animation: captureSweep 900ms linear infinite;
}

.first-conquest-arrow,
.arrival-banner,
.tutorial-bubble,
.success-pop,
.auth-overlay {
  position: absolute;
  z-index: 20;
}

.arrival-banner {
  top: calc(max(10px, var(--safe-top)) + 116px);
  left: 20px;
  right: 76px;
  padding: 10px 13px;
  border: 2px solid var(--night);
  border-bottom: 5px solid var(--gold-dark);
  border-radius: 20px;
  color: var(--night);
  background: rgba(255, 248, 231, 0.96);
  box-shadow: 0 12px 25px rgba(11, 16, 32, 0.22);
  animation: bubbleIn 280ms ease both;
}

.arrival-banner strong,
.arrival-banner span {
  display: block;
}

.arrival-banner strong {
  font-size: 14px;
  font-weight: 1000;
}

.arrival-banner span {
  color: #6d5f47;
  font-size: 12px;
  font-weight: 850;
}

.first-conquest-arrow {
  top: 48%;
  left: 50%;
  width: min(74vw, 310px);
  transform: translate(-50%, -118%);
  padding: 12px 16px;
  border: 2px solid var(--night);
  border-bottom: 6px solid var(--gold-dark);
  border-radius: 24px;
  color: var(--night);
  background: var(--gold);
  font-size: 18px;
  font-weight: 1000;
  text-align: center;
  box-shadow: 0 15px 28px rgba(0, 0, 0, 0.24);
  animation: softFloat 1.8s ease-in-out infinite;
}

.first-conquest-arrow::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: -17px;
  width: 24px;
  height: 24px;
  border-right: 2px solid var(--night);
  border-bottom: 2px solid var(--night);
  background: var(--gold);
  transform: translateX(-50%) rotate(45deg);
}

.tutorial-bubble {
  top: calc(max(10px, var(--safe-top)) + 118px);
  left: 22px;
  right: 22px;
  padding: 12px 15px;
  border: 2px solid var(--night);
  border-bottom: 5px solid var(--cream-shadow);
  border-radius: 22px;
  color: var(--night);
  background: var(--cream-light);
  font-size: 16px;
  font-weight: 950;
  text-align: center;
  box-shadow: 0 12px 25px rgba(11, 16, 32, 0.22);
  animation: bubbleIn 280ms ease both;
}

.success-pop {
  top: 43%;
  left: 50%;
  width: min(84vw, 340px);
  transform: translate(-50%, -50%);
  padding: 18px;
  border: 3px solid var(--night);
  border-bottom: 8px solid var(--gold-dark);
  border-radius: 28px;
  color: var(--night);
  background: var(--cream-light);
  text-align: center;
  box-shadow: 0 24px 44px rgba(0, 0, 0, 0.3);
  animation: popIn 360ms cubic-bezier(0.2, 1.4, 0.35, 1) both;
}

.success-pop::before,
.success-pop::after {
  content: "";
  position: absolute;
  top: -18px;
  width: 80px;
  height: 80px;
  background:
    radial-gradient(circle, var(--gold) 0 8px, transparent 9px),
    radial-gradient(circle at 70% 35%, var(--self) 0 6px, transparent 7px),
    radial-gradient(circle at 28% 72%, #5bd28a 0 5px, transparent 6px);
  animation: confettiPop 900ms ease-out infinite alternate;
}

.success-pop::before {
  left: -34px;
}

.success-pop::after {
  right: -34px;
  transform: scaleX(-1);
}

.success-pop h2 {
  margin: 0 0 6px;
  font-size: 27px;
  font-weight: 1000;
}

.success-pop h2::before {
  content: "K ";
  color: var(--gold-dark);
}

.success-pop strong {
  display: block;
  color: #21894b;
  font-size: 22px;
  font-weight: 1000;
}

.success-pop p {
  margin: 8px 0 0;
  color: #6d5f47;
  font-weight: 850;
}

.auth-overlay {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: grid;
  place-items: end center;
  padding: 18px 14px max(18px, var(--safe-bottom));
  background: rgba(7, 11, 22, 0.58);
}

.auth-panel {
  position: relative;
  width: min(100%, 390px);
  padding: 18px;
  border: 3px solid var(--night);
  border-bottom: 8px solid var(--gold-dark);
  border-radius: 28px;
  color: var(--night);
  background: var(--cream-light);
  box-shadow: 0 24px 46px rgba(0, 0, 0, 0.34);
}

.auth-panel h2 {
  margin: 0 0 6px;
  font-size: 24px;
  font-weight: 1000;
}

.auth-panel p {
  margin: 0 0 14px;
  color: #6d5f47;
  font-weight: 850;
}

.auth-actions {
  display: grid;
  gap: 9px;
}

.auth-button {
  color: var(--night);
  background: white;
  border-bottom: 5px solid #d9c89f;
}

.auth-button.google {
  color: white;
  background: var(--night);
  border-bottom-color: #050916;
}

.auth-button.apple {
  color: white;
  background: #111111;
  border-bottom-color: #000000;
}

.auth-close {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 38px;
  min-height: 38px;
  margin: 0;
  color: #695d45;
  background: var(--cream);
  font-weight: 950;
}

.auth-panel small {
  display: block;
  margin-top: 10px;
  color: #7b6b4c;
  font-size: 11px;
  font-weight: 800;
  text-align: center;
}

.activity-panel {
  position: absolute;
  z-index: 14;
  left: 12px;
  right: 12px;
  bottom: calc(182px + var(--safe-bottom));
  max-height: 38dvh;
  overflow: auto;
  border: 2px solid rgba(255, 198, 70, 0.82);
  border-radius: 22px;
  color: var(--night);
  background: rgba(255, 248, 231, 0.98);
  box-shadow: 0 8px 0 rgba(0, 0, 0, 0.28);
  padding: 13px;
}

.activity-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.activity-head h2 {
  margin: 0;
}

.activity-head small {
  color: var(--gold-dark);
  font-size: 11px;
  font-weight: 1000;
  text-transform: uppercase;
}

.activity-row {
  width: 100%;
  margin-top: 8px;
  border: 2px solid rgba(20, 27, 47, 0.18);
  border-radius: 14px;
  background: #fffdf5;
  color: var(--night);
  text-align: left;
  padding: 10px;
}

.activity-row strong,
.activity-row span {
  display: block;
}

.activity-row span {
  margin-top: 3px;
  color: #6a5a3e;
  font-size: 12px;
  font-weight: 850;
}

.dev-note.dark {
  color: #6a5a3e;
}

.bottom-nav {
  position: absolute;
  z-index: 13;
  left: 0;
  right: 0;
  bottom: 0;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
  padding: 6px 8px calc(6px + var(--safe-bottom));
  background: var(--night);
}

.secondary-screen,
.quest-screen {
  min-height: calc(100dvh - 64px);
  padding: calc(16px + var(--safe-top)) 14px calc(82px + var(--safe-bottom));
  color: var(--cream-light);
  background:
    radial-gradient(circle at top left, rgba(255, 198, 70, 0.26), transparent 30%),
    linear-gradient(180deg, #23335a 0%, var(--night) 46%, #10182b 100%);
  overflow-y: auto;
}

.screen-card,
.quest-header,
.quest-card,
.quest-history {
  border: 2px solid rgba(255, 198, 70, 0.76);
  border-radius: 22px;
  color: var(--night);
  background: rgba(255, 248, 231, 0.96);
  box-shadow: 0 7px 0 rgba(0, 0, 0, 0.22);
  padding: 16px;
}

.quest-header,
.quest-card-head,
.quest-card-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.quest-header {
  margin-bottom: 14px;
}

.quest-header h1,
.quest-card h2,
.quest-history h2 {
  margin: 0;
}

.quest-header p,
.quest-card p,
.quest-history p,
.dev-note {
  margin: 6px 0 0;
  color: #6a5a3e;
  font-size: 13px;
  font-weight: 800;
}

.quest-orb {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  border: 3px solid var(--night);
  border-radius: 50%;
  background: var(--gold);
  box-shadow: 0 4px 0 var(--gold-dark);
  font-size: 22px;
  font-weight: 1000;
}

.quest-list {
  display: grid;
  gap: 12px;
}

.quest-card.ready {
  animation: capturedZoneGlow 1.8s ease-in-out infinite;
}

.quest-card small,
.quest-header small {
  color: var(--gold-dark);
  font-size: 11px;
  font-weight: 1000;
  text-transform: uppercase;
}

.quest-progress {
  height: 13px;
  margin: 14px 0;
  overflow: hidden;
  border: 2px solid var(--night);
  border-radius: 999px;
  background: rgba(20, 27, 47, 0.14);
}

.quest-progress span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--self), var(--gold));
}

.quest-history {
  margin-top: 14px;
}

.dev-note {
  color: rgba(255, 248, 231, 0.78);
  text-align: center;
}

.nav-item {
  min-height: 46px;
  border-radius: 14px;
  color: #d5d9e2;
  background: transparent;
  font-size: 11px;
  font-weight: 950;
}

.nav-item.active {
  color: var(--night);
  background: var(--gold);
  box-shadow: inset 0 -4px 0 var(--gold-dark);
}

@media (max-width: 360px) {
  .welcome h1 {
    font-size: 52px;
  }
  .hero-button,
  .ghost-button,
  .auth-button {
    min-height: 52px;
  }
  .objective strong {
    font-size: 13px;
  }
  .currency {
    min-width: 74px;
  }
  .install-banner,
  .update-banner,
  .ios-help {
    bottom: calc(70px + var(--safe-bottom));
  }
}

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

@keyframes boardDrift {
  from {
    transform: rotate(-5deg) scale(1.05) translate3d(-2%, -1%, 0);
  }
  to {
    transform: rotate(-3deg) scale(1.08) translate3d(2%, 1%, 0);
  }
}

@keyframes softFloat {
  0%,
  100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-8px);
  }
}

@keyframes ringPulse {
  0%,
  100% {
    opacity: 0.28;
    transform: scale(0.9);
  }
  50% {
    opacity: 0.9;
    transform: scale(1);
  }
}

@keyframes zonePulse {
  0%,
  100% {
    stroke-width: 3px;
  }
  50% {
    stroke-width: 5px;
  }
}

@keyframes capturedZoneGlow {
  0%,
  100% {
    filter: drop-shadow(0 0 0 rgba(36, 119, 223, 0));
  }
  50% {
    filter: drop-shadow(0 0 10px rgba(36, 119, 223, 0.55));
  }
}

@keyframes activityPulse {
  0%,
  100% {
    opacity: 0.35;
    transform: scale(0.88);
  }
  50% {
    opacity: 0.9;
    transform: scale(1.16);
  }
}

@keyframes poiGlow {
  0%,
  100% {
    filter: drop-shadow(0 0 0 rgba(255, 198, 70, 0));
  }
  50% {
    filter: drop-shadow(0 0 8px rgba(255, 198, 70, 0.42));
  }
}

@keyframes captureSweep {
  from {
    transform: translateX(-120%);
  }
  to {
    transform: translateX(420%);
  }
}

@keyframes buttonShine {
  from {
    left: -60%;
  }
  to {
    left: 130%;
  }
}

@keyframes bubbleIn {
  from {
    opacity: 0;
    transform: translateY(-10px) scale(0.96);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes popIn {
  from {
    opacity: 0;
    transform: translate(-50%, -45%) scale(0.84);
  }
  to {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
  }
}

@keyframes confettiPop {
  from {
    opacity: 0.5;
    transform: translateY(0) rotate(-8deg);
  }
  to {
    opacity: 1;
    transform: translateY(-8px) rotate(8deg);
  }
}
