/* MyVillage Planner page styles. Base chrome comes from
   ../styles.css + ../assets/members.css; this file only styles
   what is unique to the planner. Floors: body text >= 16px,
   every control >= 44px tall. */

.section-h { margin-bottom: 6px; }

/* ---- village picker ---- */
.village-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 16px;
  margin: 18px 0 8px;
}
.village-card {
  display: block;
  width: 100%;
  text-align: left;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px 22px;
  min-height: 88px;
  cursor: pointer;
  font: inherit;
  color: var(--ink);
  box-shadow: 0 1px 3px rgba(34, 48, 31, .06);
}
.village-card:hover, .village-card:focus-visible {
  border-color: var(--pine);
  box-shadow: 0 4px 14px rgba(14, 77, 46, .14);
}
.village-card-name {
  display: block;
  font-family: var(--serif);
  font-weight: 700;
  font-size: 1.3rem;
  color: var(--pine-dark);
  margin-bottom: 4px;
}
.village-card-meta { display: block; font-size: 1rem; color: #55604F; }

/* ---- editor toolbar ---- */
.ed-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 14px 22px;
  align-items: flex-start;
  margin: 10px 0 4px;
}
.ed-title { flex: 1 1 320px; }
.ed-title h2 { margin: 2px 0 4px; }
.ed-title p { margin: 0; color: #55604F; }
.ed-save { text-align: right; }
.ed-save .small { margin: 6px 0 0; max-width: 260px; }
#save-btn:disabled { opacity: .45; cursor: default; }

.board-tools {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 14px 0 10px;
}
.board-tools .btn { min-height: 48px; padding: 8px 18px; }

/* ---- the board ---- */
.board-wrap {
  background: #EFE9D8;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  line-height: 0;
}
#board {
  display: block;
  touch-action: none;
  cursor: grab;
  user-select: none;
  -webkit-user-select: none;
}
#board:active { cursor: grabbing; }
#board .piece { cursor: grab; }
.board-hint { margin-top: 10px; }

/* ---- below the board: details + legend ---- */
.ed-below {
  display: grid;
  grid-template-columns: minmax(280px, 380px) 1fr;
  gap: 20px;
  margin-top: 22px;
  align-items: start;
}
@media (max-width: 820px) {
  .ed-below { grid-template-columns: 1fr; }
  .ed-save { text-align: left; }
}
.sel-panel h2 { margin-top: 0; }
.sel-photo {
  display: block;
  width: 100%;
  max-height: 260px;
  object-fit: contain;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  margin: 10px 0;
}
.sel-meta { font-size: 1rem; }

.legend-panel h2 { margin-top: 0; }
.legend-list {
  list-style: none;
  margin: 10px 0 0;
  padding: 0;
  columns: 2;
  column-gap: 26px;
}
@media (max-width: 560px) { .legend-list { columns: 1; } }
.legend-list li { break-inside: avoid; margin-bottom: 6px; }
.legend-row {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 44px;
  padding: 6px 10px;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 10px;
  font: inherit;
  font-size: 1rem;
  color: var(--ink);
  text-align: left;
  cursor: pointer;
}
.legend-row:hover, .legend-row:focus-visible { border-color: var(--line); background: #fff; }
.legend-row.selected { border-color: var(--gold); background: #FBF3DC; }
.legend-badge {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px; height: 30px;
  border-radius: 50%;
  background: #093620;
  color: #F7F1E3;
  font-weight: 700;
  font-size: .95rem;
}
.legend-row.selected .legend-badge { background: var(--gold); color: #093620; }
.legend-name { flex: 1 1 auto; }
