.village-page {
  --village-ink: #f0eefb;
  --village-muted: #a7a7c1;
  --village-line: #373750;
  color: var(--village-ink);
  background:
    radial-gradient(ellipse at 50% 10%, rgb(var(--village-surface-rgb)) 0%, transparent 58%),
    #101229;
}

.village-main {
  width: min(calc(100% - 64px), 1016px);
  margin: calc(52px + env(safe-area-inset-top)) auto 0;
  padding-bottom: 30px;
}

.village-intro {
  display: grid;
  justify-items: center;
  margin: 0 0 26px;
  text-align: center;
}

.village-intro .village-moon {
  margin-bottom: 13px;
}

.village-intro h1 {
  margin: 0;
  color: var(--village-title);
  font-family: var(--font-village);
  font-size: clamp(2.25rem, 5vw, 3.5rem);
  font-weight: 400;
  line-height: 1.25;
  letter-spacing: 0.1em;
  text-indent: 0.1em;
  text-shadow: 2px 2px #514264;
}

.village-intro p,
.village-hud p {
  font-family: var(--font-village);
}

.village-intro p {
  margin: 10px 0 0;
  color: #c0bdd5;
  font-size: 0.9rem;
  letter-spacing: 0.09em;
}

.village-game {
  overflow: hidden;
  border: 1px solid var(--village-line);
  border-radius: 14px;
  background: #17192f;
  box-shadow: 0 18px 55px #06081765;
  isolation: isolate;
}

.village-hud {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 48px;
  padding: 0 19px;
  border-bottom: 1px solid var(--village-line);
  background: #1b1d35;
}

.village-hud p {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  font-size: 0.78rem;
  letter-spacing: 0.05em;
}

.village-location {
  color: #e9e5f2;
  white-space: nowrap;
}

.village-location b {
  font-weight: 400;
}

.village-location > span {
  width: 10px;
  height: 10px;
  background: #c3a8fa;
  clip-path: polygon(40% 0, 60% 0, 60% 30%, 70% 30%, 70% 40%, 100% 40%, 100% 60%, 70% 60%, 70% 70%, 60% 70%, 60% 100%, 40% 100%, 40% 70%, 30% 70%, 30% 60%, 0 60%, 0 40%, 30% 40%, 30% 30%, 40% 30%);
}

.village-population {
  color: var(--village-muted);
  text-align: right;
}

.village-population-count {
  white-space: nowrap;
}

.village-population strong {
  color: var(--village-gold);
  font-size: 1rem;
  font-weight: 400;
  font-variant-numeric: tabular-nums;
  line-height: 1;
}

.village-population-icon {
  flex: none;
  width: 12px;
  height: 12px;
  color: #d4b780;
  background: currentColor;
  clip-path: polygon(25% 0, 75% 0, 75% 17%, 90% 17%, 90% 55%, 70% 55%, 70% 67%, 90% 67%, 90% 85%, 100% 85%, 100% 100%, 0% 100%, 0% 85%, 10% 85%, 10% 67%, 30% 67%, 30% 55%, 10% 55%, 10% 17%, 25% 17%);
}

.village-viewport {
  position: relative;
  height: clamp(315px, 41vw, 440px);
  overflow: hidden;
  background: #131630;
}

.village-viewport canvas {
  display: block;
  width: 100%;
  height: 100%;
  image-rendering: pixelated;
}

.village-player-marker {
  position: absolute;
  top: 0;
  left: 0;
  display: none;
  padding: 1px 7px 2px;
  border: 1px solid #ffd993;
  border-radius: 4px;
  color: #251b2d;
  background: #ffe2a9;
  box-shadow: 0 2px 8px #1711257a;
  font-size: 0.66rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  line-height: 1.55;
  pointer-events: none;
  translate: -50% -100%;
}

.village-player-marker::after {
  position: absolute;
  top: 100%;
  left: 50%;
  width: 8px;
  height: 5px;
  content: "";
  background: #ffe2a9;
  clip-path: polygon(0 0, 100% 0, 50% 100%);
  translate: -50%;
}

.village-unavailable {
  position: absolute;
  inset: 30% 0 auto;
  margin: 0;
  padding: 1rem;
  color: var(--village-ink);
  text-align: center;
}

.village-controls {
  position: absolute;
  inset: auto 8px 8px;
  display: flex;
  justify-content: space-between;
  pointer-events: none;
}

.village-controls button {
  display: grid;
  place-items: center;
  min-width: 44px;
  height: 44px;
  padding: 0;
  border: 0;
  border-radius: 7px;
  color: var(--village-ink);
  background: transparent;
  cursor: pointer;
  font: 700 30px/1 system-ui, sans-serif;
  text-shadow: 0 1px 3px #101229, 0 0 4px #101229;
  pointer-events: auto;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
}

.village-controls button:hover,
.village-controls button[data-pressed] {
  color: var(--village-gold);
}

.village-controls button:focus-visible {
  outline: 2px solid var(--village-gold);
  outline-offset: 3px;
}

.village-note {
  margin: 15px 0 0;
  color: var(--village-muted);
  font-size: 0.72rem;
  letter-spacing: 0.04em;
  text-align: center;
}

.village-sr-only {
  position: absolute;
  overflow: hidden;
  width: 1px;
  height: 1px;
  padding: 0;
  border: 0;
  clip-path: inset(50%);
  white-space: nowrap;
}

@media (max-width: 640px) {
  .village-main {
    width: calc(100% - 28px);
  }

  .village-intro {
    margin-bottom: 17px;
  }

  .village-intro .village-moon {
    margin-bottom: 7px;
    scale: 0.88;
  }

  .village-intro p {
    margin-top: 6px;
    font-size: 0.78rem;
  }

  .village-viewport {
    height: clamp(270px, 82vw, 355px);
  }

  .village-hud {
    min-height: 43px;
    padding-inline: 12px;
  }

  .village-hud p {
    gap: 5px;
    font-size: 0.69rem;
  }

  .village-controls button {
    min-width: 48px;
    height: 48px;
  }
}
