/* Layer: 02-map.css
 * map province discussion, legend, region panel
 *
 * Split out of app.css, which had grown to 8346 lines. Loaded in
 * order by app.css; do not reorder the @import lines there. Several rules in
 * the later layers override earlier ones by source order alone.
 */
/* —— Map province discussion —— */
.map-comments {
  margin: 12px 0;
}

.map-comments__toggle {
  width: 100%;
}

.map-comments__toggle.is-active {
  border-color: var(--accent, #a16a38);
}

.map-comments--open {
  border: 1px solid var(--border, #5a4a36);
  background: rgba(255, 248, 236, 0.95);
  padding: 10px 12px 12px;
  box-shadow: 2px 2px 0 rgba(0, 0, 0, 0.06);
}

.map-comments__title-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
}

.map-comments__clear {
  font-size: 0.8rem;
  padding: 4px 8px;
}

.map-comments__list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 280px;
  overflow-y: auto;
  margin-bottom: 8px;
}

.map-comments__item {
  padding: 6px 0;
  border-bottom: 1px solid rgba(90, 74, 54, 0.15);
}

.map-comments__head {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: baseline;
  font-size: 0.85rem;
}

.map-comments__time {
  opacity: 0.65;
  font-size: 0.75rem;
}

.map-comments__text {
  margin: 4px 0;
  font-size: 0.9rem;
  white-space: pre-wrap;
}

.map-comments__actions {
  display: flex;
  gap: 10px;
}

.map-comments__link {
  background: none;
  border: 0;
  padding: 0;
  font: inherit;
  font-size: 0.78rem;
  color: var(--accent, #a16a38);
  cursor: pointer;
  text-decoration: underline;
}

.map-comments__compose {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid rgba(90, 74, 54, 0.2);
}

.map-comments__speaker {
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-size: 0.8rem;
}

.map-comments__input {
  width: 100%;
  box-sizing: border-box;
  padding: 6px 8px;
  border: 1px solid var(--border, #5a4a36);
  background: #fff8ec;
  font: inherit;
  resize: vertical;
}

.map-comments__muted,
.map-comments__hint {
  margin: 0;
  font-size: 0.82rem;
  opacity: 0.75;
}

.region-panel__check {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 8px 0;
  font-size: 0.85rem;
}

.npc-comments__list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  overflow: visible;
}

.npc-comment {
  padding: 6px 0;
  border-bottom: 1px solid rgba(90, 74, 54, 0.15);
}

.npc-comment__row {
  display: flex;
  gap: 8px;
  align-items: flex-start;
}

.npc-comment__av {
  flex: 0 0 28px;
  width: 28px;
  height: 28px;
  border: 1px solid var(--border, #5a4a36);
  background: var(--parchment, #d8cbb6);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.7rem;
}

.npc-comment__av img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.npc-comment__meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  font-size: 0.75rem;
  opacity: 0.8;
  margin-bottom: 4px;
}

.npc-comment__meta strong {
  color: var(--accent, #a16a38);
}

.npc-comment__text {
  margin: 0;
  font-size: 0.9rem;
  white-space: pre-wrap;
  word-break: break-word;
}

.npc-comment__reply,
.npc-link {
  margin-top: 4px;
  padding: 0;
  border: 0;
  background: none;
  color: var(--accent, #a16a38);
  font: inherit;
  font-size: 0.8rem;
  text-decoration: underline;
  cursor: pointer;
}

.npc-thread {
  margin-top: 6px;
  margin-left: 8px;
}

.npc-thread__sum {
  cursor: pointer;
  font-size: 0.8rem;
  opacity: 0.75;
}

.npc-speaker {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}

.npc-speaker__art {
  flex: 0 0 40px;
  width: 40px;
  height: 40px;
  border: 1px solid var(--border, #5a4a36);
  background: var(--parchment, #d8cbb6);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
}

.npc-speaker__art img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.npc-speaker__pick {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-size: 0.75rem;
  opacity: 0.9;
}

.npc-speaker__select {
  width: 100%;
  box-sizing: border-box;
  border: 1px solid var(--border, #5a4a36);
  background: #fff8ec;
  color: inherit;
  font: inherit;
  font-size: 0.85rem;
  padding: 5px 8px;
}

.npc-comments__compose {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.npc-comments__input {
  width: 100%;
  box-sizing: border-box;
  padding: 8px 10px;
  border: 1px solid var(--border, #5a4a36);
  background: #fff8ec;
  font: inherit;
  resize: vertical;
}

.npc-comments__hint {
  margin: 0 0 6px;
  font-size: 0.8rem;
  color: var(--ink-soft, #4a3220);
  opacity: 1;
}

.npc-muted {
  margin: 0;
  font-size: 0.85rem;
  color: var(--ink-soft, #4a3220);
  opacity: 1;
}

.btn,
.nav-btn,
.mode-btn {
  padding: 7px 14px;
  min-height: 36px;
  border: 2px solid var(--border, #4a2c14);
  border-radius: var(--btn-radius, 6px);
  background:
    linear-gradient(180deg, #f0c878 0%, var(--accent, #d87a24) 42%, #8a4a18 100%);
  color: var(--ink, #2b1a0e);
  font-family: var(--font-pixel, monospace);
  font-size: 1.15rem;
  letter-spacing: 0.03em;
  line-height: 1.1;
  cursor: pointer;
  box-shadow: var(--bevel-out);
  text-shadow: 0 1px 0 rgba(255, 240, 200, 0.35);
  image-rendering: pixelated;
}

.btn:hover,
.nav-btn:hover,
.mode-btn:hover {
  filter: brightness(1.06);
}

.btn:active,
.nav-btn:active,
.mode-btn:active {
  box-shadow: var(--bevel-in);
  transform: translateY(1px);
}

.btn--primary,
.mode-btn--active,
.nav-btn--active {
  background:
    linear-gradient(180deg, #ffe08a 0%, var(--brass, #e0b040) 40%, #a86820 100%);
  color: var(--ink, #2b1a0e);
  border-color: var(--wood-dark, #3d2210);
  animation: none;
}

.btn--ghost {
  background: linear-gradient(180deg, #e8c898, #c89860);
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  filter: grayscale(0.2);
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.auth-modal-host {
  position: fixed;
  inset: 0;
  z-index: 40;
}

.auth-modal-host[hidden] {
  display: none !important;
}

.auth-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(20, 14, 8, 0.45);
}

.auth-modal {
  position: relative;
  z-index: 1;
  width: min(400px, calc(100% - 32px));
  margin: 12vh auto 0;
  padding: 16px;
  background: #ebe1d0;
  border: 1px solid #5a4a36;
}

.auth-modal h2 {
  margin: 0 0 8px;
}

.auth-modal__form {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin: 12px 0;
}

.auth-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 0.9rem;
}

.auth-field input {
  padding: 6px 8px;
  border: 1px solid #8a7a62;
  background: #f4ecde;
  font: inherit;
}

.auth-modal__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.auth-forgot {
  color: inherit;
  font-size: 0.85rem;
}

.auth-modal__hint {
  color: #7a1f1f;
  font-size: 0.9rem;
}

@media (max-width: 720px) {
  .map-stage {
    flex-direction: column;
    display: flex;
    --region-panel-width: 0px;
    overflow: auto;
  }

  .map-canvas {
    position: relative;
    inset: auto;
    width: 100%;
    min-height: 50vh;
    height: 50vh;
    flex: 0 0 auto;
  }

  .map-root {
    min-height: 0;
  }

  .map-modes--rail {
    position: relative;
    left: auto;
    top: auto;
    width: auto;
    flex-direction: row;
    flex-wrap: wrap;
    margin: 0;
  }

  .map-chrome-left {
    position: relative;
    left: auto;
    top: auto;
    width: auto;
    margin: 8px;
    flex-direction: column;
  }

  .map-modes--rail .mode-btn__label {
    display: none;
  }

  .map-modes--rail .mode-btn {
    width: auto;
    min-width: 44px;
    justify-content: center;
    padding: 8px 10px;
  }

  .hud-vault--map {
    position: relative;
    top: auto;
    right: auto;
    width: auto;
    max-height: none;
    margin: 8px;
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .region-panel,
  .region-panel--overlay {
    position: relative;
    top: auto;
    right: auto;
    bottom: auto;
    flex: none;
    width: auto;
    max-height: none;
    margin: 8px;
    border-left: 2px solid var(--border, #4a2c14);
  }

  .map-legend,
  .map-legend--overlay {
    position: relative;
    top: auto;
    right: auto;
    bottom: auto;
    width: auto;
    max-height: none;
    margin: 0 8px 8px;
  }

  .schedule-strip-host--overlay {
    position: relative;
    top: auto;
    left: auto;
    transform: none;
    width: auto;
    max-width: none;
    margin: 8px;
  }
}

.nav-btn {
  position: relative;
}

.nav-btn__badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.15rem;
  height: 1.15rem;
  margin-left: 6px;
  padding: 0 4px;
  border-radius: 999px;
  background: #8b2e2e;
  color: #f5efe4;
  font-size: 0.7rem;
  font-weight: 700;
  line-height: 1;
  vertical-align: middle;
}

.wh-room {
  padding: 12px 14px 28px;
  display: flex;
  flex-direction: column;
  gap: 18px;
  color: var(--ink, #2b1a0e);
}

.wh-section {
  padding: 12px 14px;
  border: 2px solid var(--border, #4a2c14);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(250, 235, 200, 0.96), rgba(243, 223, 184, 0.94)),
    var(--theme-parchment, var(--parchment, #f5d1a0));
  background-size: auto, cover;
  box-shadow: var(--bevel-out);
  color: var(--ink, #2b1a0e);
}

.wh-section h3 {
  margin: 0 0 6px;
  font-size: 1.15rem;
  color: var(--ink, #2b1a0e);
}

.wh-lead {
  margin: 0 0 10px;
  font-size: 0.85rem;
  color: var(--ink-soft, #4a3220);
  opacity: 1;
}

.wh-muted {
  margin: 4px 0;
  font-size: 0.82rem;
  color: var(--ink-soft, #4a3220);
  opacity: 1;
}

.wh-vault {
  display: grid;
  gap: 6px;
  max-width: none;
}

.wh-vault__row {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 10px;
  align-items: baseline;
  padding: 6px 10px;
  border: 1px solid var(--border, #5a4a36);
  background: var(--panel-soft, #f4ecde);
}

.wh-votes,
.wh-loc-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 10px;
}

.wh-vote,
.wh-loc-card,
.wh-branch-open {
  border: 2px solid var(--border, #4a2c14);
  border-radius: 8px;
  background: linear-gradient(180deg, #faebc8, #f0d8a0);
  padding: 10px 12px;
  box-shadow: var(--bevel-out);
  color: var(--ink, #2b1a0e);
}

.wh-vote h4,
.wh-loc-card h4 {
  margin: 0 0 6px;
  /* The card already sets `--ink`; overriding it with `--accent` dropped these
   * headings to ~2.6:1 on the light card. Ink keeps them readable. */
  color: var(--ink, #2b1a0e);
}

.wh-vote__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

.wh-duchy-pick {
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-width: 320px;
  margin-bottom: 12px;
  font-size: 0.85rem;
}

.wh-duchy-pick select,
.wh-duchy-pick input {
  padding: 6px 10px;
  border: 1px solid var(--border, #5a4a36);
  background: var(--panel-soft, #f4ecde);
  font: inherit;
}
