.wordmark:has(.village-trigger) { position: relative; min-width: 0; }
.wordmark:has(.village-trigger) .brand-pine { flex: none; }
.wordmark:has(.village-trigger) h1 { min-width: 0; }
.village-trigger {
  display: flex;
  align-items: center;
  gap: .28em;
  max-width: 100%;
  min-height: 44px;
  border: 0;
  border-radius: 5px;
  padding: 0 4px 0 0;
  background: transparent;
  color: inherit;
  font: inherit;
  letter-spacing: inherit;
  text-align: left;
  pointer-events: auto;
}
.village-current { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.village-trigger:hover .village-current, .village-trigger[aria-expanded="true"] .village-current {
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: .18em;
}
.village-chevron {
  flex: none;
  width: .27em;
  height: .27em;
  margin-inline: .05em;
  border: solid currentColor;
  border-width: 0 2px 2px 0;
  transform: translateY(-.06em) rotate(45deg);
}
.village-trigger[aria-expanded="true"] .village-chevron { transform: translateY(.07em) rotate(225deg); }
.village-count {
  display: inline-grid;
  flex: none;
  place-items: center;
  min-width: 1.25rem;
  height: 1.25rem;
  border-radius: 30px;
  padding: 0 .32rem;
  background: var(--berry);
  color: white;
  font: 700 .72rem/1 var(--sans);
  letter-spacing: 0;
  text-shadow: none;
}
.village-inbox { position: relative; align-self: center; }
.village-inbox .village-count { position: absolute; top: 0; right: -1px; min-width: 17px; height: 17px; font-size: .65rem; }
body:not([data-screen="plaza"]) .village-inbox { display: none; }
body[data-screen="plaza"] .screen-header:has(.village-trigger[aria-expanded="true"]) { z-index: 6; }
.village-picker {
  position: absolute;
  top: calc(100% + 7px);
  left: 0;
  z-index: 1;
  width: min(330px, calc(100vw - 32px));
  max-height: calc(100dvh - var(--menu-viewport-space));
  overflow: auto;
  overscroll-behavior: contain;
  border: 1px solid var(--menu-line);
  border-radius: 17px;
  padding: 10px;
  background: var(--menu-paper);
  color: var(--menu-ink);
  box-shadow: var(--menu-shadow);
  text-shadow: none;
  pointer-events: auto;
}
.picker-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  min-height: 37px;
  margin-bottom: 3px;
}
.picker-heading h2, .picker-section h2 {
  margin-left: 3px;
  color: var(--menu-muted);
  font-size: .79rem;
  font-weight: 750;
  letter-spacing: .01em;
}
.village-picker-places {
  display: grid;
  gap: 2px;
  max-height: min(34dvh, 214px);
  overflow-y: auto;
  overscroll-behavior: contain;
}
.picker-section {
  margin-top: 8px;
  padding-top: 9px;
  border-top: 1px solid #dce7dd;
}
.picker-section h2 { margin-bottom: 6px; }
.village-picker-item {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  min-width: 0;
  min-height: 36px;
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 5px 8px;
  background: transparent;
  color: inherit;
  font: 650 .88rem/1.2 var(--sans);
  text-align: left;
}
.village-picker-item .picker-label { min-width: 0; overflow-wrap: anywhere; }
.village-picker-item > .ui-icon { width: 18px; height: 18px; color: var(--menu-muted); }
.village-picker-item:hover { background: var(--menu-hover); }
.village-picker-item:focus-visible { outline-offset: -2px; }
.village-picker-item[aria-current="true"] {
  border-color: #bfd7c8;
  background: var(--menu-selected);
  color: #234f40;
}
.village-picker-item[aria-current="true"] > .ui-icon { color: #386957; }
.village-tick { flex: none; margin-left: auto; color: #35634f; }
.picker-create {
  gap: 4px;
  width: auto;
  padding-inline: 7px 9px;
  border-color: #c9dbcf;
  border-radius: 20px;
  background: var(--menu-hover);
  white-space: nowrap;
  font-size: .77rem;
}
.picker-create > .ui-icon { width: 15px; height: 15px; }
.picker-create:hover { background: var(--menu-selected); }
.picker-shortcuts { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: 5px; }
.picker-shortcuts .village-picker-item {
  position: relative;
  flex-direction: column;
  justify-content: center;
  gap: 3px;
  min-height: 52px;
  padding: 4px 2px;
  border-color: #dce8de;
  background: #f1f6ef;
  font-size: .76rem;
  text-align: center;
}
.picker-shortcuts .village-picker-item:hover { border-color: #bdd4c6; background: var(--menu-selected); }
.picker-shortcuts .village-count {
  position: absolute;
  top: 3px;
  right: 4px;
  min-width: 16px;
  height: 16px;
  padding-inline: 4px;
  font-size: .64rem;
}
.village-children-entry { margin-top: 4px; min-height: 44px; }
@media (max-height: 440px) {
  .village-picker-places { max-height: none; overflow: visible; }
}

.village-sheet {
  width: min(480px, calc(100% - 28px));
  max-width: 100%;
  max-height: min(88dvh, 710px);
  padding: 0;
  border: 1px solid #a7bfc7;
  border-radius: 14px;
  background: #f7fbfc;
  box-shadow: 0 16px 64px #153e4e42;
  overflow: hidden;
}
.village-sheet[open] { display: flex; flex-direction: column; }
.village-sheet::backdrop { background: #18394263; }
.village-sheet-head {
  display: flex;
  flex: none;
  align-items: center;
  gap: 7px;
  min-height: 66px;
  padding: 8px 12px 8px 21px;
  border-bottom: 1px solid #c9dce0;
  background: linear-gradient(153deg, #eef7f7, #e5f0f3);
}
.village-sheet-head:has(button:first-child:not([hidden])) { padding-left: 8px; }
.village-sheet-head h2 { flex: 1; min-width: 0; font-size: 1.42rem; letter-spacing: -.045em; overflow-wrap: anywhere; }
.village-sheet-head h2:focus { outline: 0; }
.village-sheet-head .icon-button { flex: none; border-radius: 50%; }
.village-sheet-body { display: grid; align-content: start; gap: 21px; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 20px 22px 23px; }
.village-sheet-body :is(p, h3), .village-sheet .village-feedback { margin: 0; }
.village-group { display: grid; gap: 4px; min-width: 0; }
.village-group h3 { font-size: .87rem; font-weight: 700; color: #45616c; }
.village-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 2px 9px;
  min-width: 0;
  min-height: 57px;
  padding: 7px 0;
}
.village-row + .village-row { border-top: 1px solid #dbe6e9; }
.village-identity { display: grid; flex: 1 1 95px; min-width: 0; line-height: 1.32; overflow-wrap: anywhere; }
.village-identity strong { font-size: 1rem; font-weight: 650; }
.village-identity small { color: var(--muted); font-size: .82rem; }
.village-child-sharing { flex-wrap: nowrap; cursor: pointer; }
.village-child-toggle {
  appearance: none;
  flex: none;
  width: 44px;
  height: 25px;
  margin: 0;
  border: 1px solid #617680;
  border-radius: 20px;
  background: radial-gradient(circle closest-side, #fff 93%, transparent) 3px center / 17px 17px no-repeat #647984;
  cursor: pointer;
}
.village-child-toggle:checked {
  border-color: #2a6352;
  background-color: #367662;
  background-position: right 3px center;
}
.village-child-toggle:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.village-child-sharing:has(.village-child-toggle[aria-disabled="true"]),
.village-child-toggle[aria-disabled="true"] { cursor: wait; }
@media (forced-colors: active) {
  .village-child-toggle { appearance: auto; width: 22px; }
}
.village-row-actions, .village-confirm-actions { display: flex; flex-wrap: wrap; gap: 2px 10px; }
.village-confirm-actions { justify-content: flex-end; }
.village-link, .village-transfer > summary {
  display: inline-flex;
  align-items: center;
  justify-self: start;
  min-height: 40px;
  border: 0;
  padding: 2px;
  background: transparent;
  color: #146575;
  font: 650 .89rem/1.2 var(--sans);
  cursor: pointer;
  overflow-wrap: anywhere;
}
.village-link:hover, .village-transfer > summary:hover { text-decoration: underline; }
.village-link.village-subtle { color: var(--muted); }
.village-link.village-destructive { color: var(--berry); }
.village-transfer > summary { display: list-item; padding-block: 11px; }
.village-note { color: var(--muted); font-size: .94rem; line-height: 1.5; }
.village-share-entry { justify-self: start; margin-bottom: 8px; }
.village-share-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.village-share-url {
  min-width: 0;
  width: 100%;
  height: 44px;
  border: 1px solid #9eb8c2;
  border-radius: 5px;
  padding: 0 10px;
  background: #fff;
  color: var(--ink);
  font: 400 1rem/1.35 var(--sans);
}
.village-form { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: end; gap: 8px; }
.village-row + .village-form { margin-top: 10px; }
.village-field { display: grid; min-width: 0; gap: 5px; font-size: .9rem; font-weight: 650; overflow-wrap: anywhere; }
.village-input-wrap {
  display: flex;
  align-items: center;
  gap: 2px;
  border: 1px solid #9eb8c2;
  border-radius: 5px;
  padding: 0 9px;
  background: #fff;
}
.village-input-wrap:focus-within { outline: 2px solid var(--accent); outline-offset: 1px; }
.village-at { color: #58737d; font-weight: 500; }
.village-field input {
  min-width: 0;
  width: 100%;
  height: 42px;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--ink);
  font: 400 1rem/1.35 var(--sans);
}
.village-field input:focus { outline: 0; }
.village-form .button, .village-confirm-actions .button { border-radius: 6px; }
.village-sheet .village-feedback { flex: none; border-top: 1px solid var(--line); padding: 10px 22px; background: #e2efea; color: #23554a; font-size: .9rem; }
.village-sheet .village-feedback:empty { display: none; }
.village-sheet .village-feedback.is-error { background: #f7e7e6; color: #813543; }
.village-scenes { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 7px; padding: 4px 0; }
.village-scene {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 6px;
  border: 1px solid #b6cad0;
  border-radius: 7px;
  padding: 4px 4px 7px;
  background: #fff;
  color: var(--ink);
  font: 650 .83rem/1.1 var(--sans);
}
.village-scene[aria-pressed="true"] { border-color: #34665f; box-shadow: 0 0 0 1px #34665f; background: #e3efeb; }
.village-scene::before {
  content: "";
  aspect-ratio: 8 / 3;
  border-radius: 4px;
  background: #d5e5e9 url("./village-scene-previews.webp") center top / 100% 300% no-repeat;
}
.village-scene[data-scene="twilight"]::before { background-position-y: center; }
.village-scene[data-scene="gingerbread"]::before { background-position-y: bottom; }
@media (max-width: 540px) {
  .village-sheet {
    width: 100%;
    max-height: min(90dvh, 700px);
    margin: auto 0 0;
    border-radius: 18px 18px 0 0;
    padding-bottom: env(safe-area-inset-bottom);
  }
  .village-sheet-head { min-height: 59px; }
  .village-sheet-body { padding: 15px 18px 21px; }
  .village-picker { top: calc(100% + 4px); }
  body[data-screen="plaza"] .screen-header:has(.village-trigger) { column-gap: 5px; }
  .village-trigger { position: relative; gap: .32em; }
  .village-current {
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    white-space: normal;
    overflow-wrap: anywhere;
  }
  .village-trigger .village-count {
    position: absolute;
    top: calc(50% - 12px);
    right: 1px;
    min-width: 6px;
    width: 6px;
    height: 6px;
    padding: 0;
    font-size: 0;
  }
}
@media (max-width: 380px) {
  .wordmark:has(.village-trigger) .brand-pine { font-size: 28px; }
  .village-sheet .button { padding-inline: 10px; }
}
