/* Responsive location list and refreshed icon tiles for the village screen. */
.village-frame {
  position: relative;
  isolation: isolate;
  background-position: center top;
  background-size: cover;
}

.village-frame::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background:
    linear-gradient(180deg, rgba(5, 18, 14, 0.38) 0%, rgba(5, 17, 16, 0.12) 28%, rgba(4, 13, 14, 0.24) 100%),
    radial-gradient(circle at 50% 8%, rgba(255, 223, 151, 0.08), transparent 46%);
}

.village-frame > .compact-player-panel,
.village-frame > .village-content {
  position: relative;
  z-index: 1;
}

.village-content {
  box-sizing: border-box;
  display: flex;
  flex: 1 1 0;
  flex-direction: column;
  height: auto;
  max-height: none;
  min-height: 0;
  overflow: hidden;
  padding: clamp(6px, 1.5vh, 12px) 12px calc(12px + var(--cf-safe-bottom, 0px));
}

.village-heading-row {
  display: grid;
  flex: 0 0 auto;
  grid-template-columns: 76px minmax(0, 1fr) 76px;
  align-items: center;
  gap: 6px;
  margin: 2px 0 8px;
}

.village-heading-row::after {
  content: "";
  width: 76px;
}

.village-back-button {
  align-self: center;
  justify-self: start;
  max-width: 76px;
  margin: 0;
}

.village-title {
  min-width: 0;
  margin: 0;
  text-align: center;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.92);
}

.village-title h1 {
  margin: 0;
  font-size: clamp(20px, 5.4vw, 25px);
  line-height: 1.05;
}

.village-title p {
  margin: 3px 0 0;
  font-size: 11px;
  line-height: 1.15;
}

.village-message {
  flex: 0 0 auto;
  margin: 0 auto 8px;
}

.village-list {
  box-sizing: border-box;
  display: grid;
  flex: 1 1 auto;
  grid-template-columns: minmax(0, 1fr);
  align-content: start;
  gap: 7px;
  height: auto;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  padding: 8px;
  border: 1px solid rgba(255, 220, 139, 0.42);
  background: linear-gradient(180deg, rgba(7, 23, 29, 0.58), rgba(18, 37, 31, 0.48));
  box-shadow: inset 0 2px 12px rgba(0, 0, 0, 0.46), 0 3px rgba(0, 0, 0, 0.3);
  backdrop-filter: blur(1.5px);
  overscroll-behavior: contain;
}

.village-list::-webkit-scrollbar {
  display: none;
}

.village-card {
  box-sizing: border-box;
  display: grid;
  grid-template-columns: 56px minmax(0, 1fr) 18px;
  align-items: center;
  gap: 9px;
  width: 100%;
  min-height: 66px;
  padding: 6px 9px;
  border: 1px solid rgba(255, 223, 158, 0.24);
  border-radius: 15px;
  color: #f6f1de;
  background:
    radial-gradient(circle at 8% 10%, rgba(255, 231, 168, 0.12), transparent 36%),
    linear-gradient(140deg, rgba(34, 74, 67, 0.98), rgba(10, 31, 39, 0.98));
  box-shadow: inset 0 1px rgba(255, 255, 255, 0.13), 0 2px rgba(0, 0, 0, 0.32);
  transition: transform 120ms ease, border-color 120ms ease, filter 120ms ease;
}

.village-card:hover {
  border-color: rgba(255, 224, 153, 0.58);
  filter: brightness(1.08);
}

.village-card:focus-visible {
  outline: 2px solid #ffe7a2;
  outline-offset: 2px;
}

.village-card:active {
  transform: translateY(1px);
}

.village-card-icon {
  box-sizing: border-box;
  position: relative;
  display: flex;
  flex: 0 0 56px;
  align-items: center;
  justify-content: center;
  width: 56px;
  height: 56px;
  overflow: hidden;
  padding: 2px;
  border: 1px solid var(--village-accent, #ffd66f);
  border-radius: 16px;
  background: linear-gradient(145deg, rgba(35, 67, 70, 0.96), rgba(8, 28, 36, 0.98));
  box-shadow:
    inset 0 1px rgba(255, 255, 255, 0.2),
    0 2px 5px rgba(0, 0, 0, 0.42);
}

.village-card-icon img {
  display: block;
  width: 50px;
  height: 50px;
  object-fit: cover;
  clip-path: inset(8.5% round 12px);
  filter: saturate(1.08) drop-shadow(0 2px 2px rgba(0, 0, 0, 0.58));
}

.village-card.druid { --village-accent: #8de58a; }
.village-card.witch { --village-accent: #d5a6ff; }
.village-card.blacksmith { --village-accent: #f2ad68; }
.village-card.monk { --village-accent: #f0dfa3; }
.village-card.home { --village-accent: #ffd374; }
.village-card.clan { --village-accent: #86d2ff; }
.village-card.shop { --village-accent: #9be4d5; }
.village-card.market { --village-accent: #ffad75; }
.village-card.trader { --village-accent: #ffd66f; }
.village-card.livestock { --village-accent: #a4e989; }
.village-card.guard { --village-accent: #c4d7e5; }
.village-card.travel { --village-accent: #81d7ff; }
.village-card.mine { --village-accent: #c7b6a0; }

.village-card-info {
  min-width: 0;
}

.village-card-title-row {
  align-items: center;
  gap: 4px 6px;
}

.village-card h3 {
  color: #fff0bf;
  font-size: 14px;
  line-height: 1.15;
}

.village-card p {
  display: -webkit-box;
  overflow: hidden;
  margin: 3px 0 0;
  color: #e2ece7;
  font-size: 11px;
  line-height: 1.25;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.village-card-arrow {
  color: var(--village-accent, #ffe3a0);
  font-size: 26px;
  line-height: 1;
}

.village-card.locked {
  filter: grayscale(0.72) brightness(0.78);
}

.village-location-panel {
  box-sizing: border-box;
  right: 12px;
  bottom: calc(12px + var(--cf-safe-bottom, 0px));
  left: 12px;
  max-height: min(36vh, 240px);
  overflow-y: auto;
  padding: 16px 14px 14px;
  border: 1px solid rgba(255, 224, 153, 0.58);
  background: linear-gradient(145deg, rgba(36, 72, 67, 0.98), rgba(10, 29, 37, 0.98));
  box-shadow: inset 0 1px rgba(255, 255, 255, 0.16), 0 10px 24px rgba(0, 0, 0, 0.58);
}

.village-close-panel {
  top: 7px;
  right: 7px;
  width: 30px;
  height: 30px;
  font-size: 21px;
}

@media (max-width: 360px) {
  .village-content {
    padding-right: 8px;
    padding-left: 8px;
  }

  .village-heading-row {
    grid-template-columns: 70px minmax(0, 1fr) 70px;
    gap: 4px;
  }

  .village-heading-row::after {
    width: 70px;
  }

  .village-back-button {
    max-width: 70px;
  }

  .village-card {
    grid-template-columns: 50px minmax(0, 1fr) 16px;
    gap: 7px;
    min-height: 60px;
    padding-right: 7px;
    padding-left: 7px;
  }

  .village-card-icon {
    flex-basis: 50px;
    width: 50px;
    height: 50px;
  }

  .village-card-icon img {
    width: 45px;
    height: 45px;
    clip-path: inset(8.5% round 10px);
  }

  .village-card p {
    font-size: 10px;
  }
}

@media (max-height: 640px) {
  .village-content {
    padding-top: 4px;
    padding-bottom: calc(8px + var(--cf-safe-bottom, 0px));
  }

  .village-heading-row {
    margin-top: 0;
    margin-bottom: 5px;
  }

  .village-title p {
    display: none;
  }

  .village-list {
    gap: 5px;
    padding: 6px;
  }

  .village-card {
    min-height: 58px;
    padding-top: 4px;
    padding-bottom: 4px;
  }

  .village-card-icon {
    width: 48px;
    height: 48px;
    flex-basis: 48px;
  }

  .village-card-icon img {
    width: 44px;
    height: 44px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .village-card {
    transition: none;
  }
}
