/* Layer: 01-base.css
 * reset, tokens plumbing, header, calendar, sync status
 *
 * 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.
 */
*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  height: 100%;
  font-family: var(--font-lore, Georgia, "Times New Roman", serif);
  color: var(--ink, #1a1510);
  background: var(--wood, #3d2918);
}

body {
  display: flex;
  flex-direction: column;
  min-height: 100%;
  background-color: var(--wood, #3d2918);
  background-image:
    radial-gradient(ellipse at center, transparent 40%, rgba(0, 0, 0, 0.45) 100%),
    linear-gradient(180deg, rgba(40, 28, 16, 0.35), rgba(10, 8, 6, 0.55)),
    var(--theme-wood),
    var(--grain);
  background-size: auto, auto, 320px 320px, auto;
  background-attachment: fixed;
}

.app-header__brand h1 {
  font-family: var(--font-pixel, monospace);
  letter-spacing: 0.04em;
  font-weight: 400;
  font-size: clamp(1.45rem, 2.4vw, 2rem);
  color: var(--torch-glow, #f7e26b);
  text-shadow: 0 0 12px rgba(255, 137, 51, 0.35);
}

.app-header__tagline {
  margin: 2px 0 0;
  font-family: var(--font-lore, Georgia, serif);
  font-size: 0.8rem;
  font-style: italic;
  color: var(--parchment, #e4d4b8);
  opacity: 0.85;
}

.app-header {
  flex: 0 0 auto;
  position: sticky;
  top: 0;
  z-index: 40;
  padding: 10px 16px 8px;
  border-bottom: 3px solid var(--border, #3a2818);
  background:
    linear-gradient(180deg, rgba(90, 60, 30, 0.55), rgba(40, 28, 16, 0.85)),
    var(--theme-wood);
  background-size: auto, 280px 280px;
  box-shadow: 0 4px 0 rgba(0, 0, 0, 0.35);
}

.qa-banner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 14px;
  margin: 0 0 8px;
  padding: 8px 10px;
  border: 1px solid #8a6a20;
  background: #f3e6b8;
  color: #3a2e10;
  font-size: 0.85rem;
}

.qa-banner[hidden] {
  display: none !important;
}

.sync-toast {
  position: fixed;
  bottom: 16px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 80;
  max-width: min(520px, calc(100vw - 24px));
  padding: 10px 14px;
  border: 2px solid var(--danger, #a02828);
  border-radius: 8px;
  background: #fff4e8;
  color: var(--ink, #2b1a0e);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.25);
  font-size: 0.9rem;
}

.sync-toast[hidden] {
  display: none !important;
}

.epic-banner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 0.75rem;
  margin: 0 0 0.5rem;
  padding: 0.55rem 0.75rem;
  border: 2px solid #8b1e1e;
  background: linear-gradient(90deg, #fff0e4, #f8d9c8);
  color: #3a1a10;
  font-size: 0.9rem;
}

.hud-guild-level {
  margin: 0.35rem 0 0;
  font-size: 0.75rem;
  opacity: 0.9;
}

/* Castanorian calendar plaque (header) */
.calendar-plaque {
  position: relative;
  margin-top: 0.45rem;
  max-width: 16rem;
}

.calendar-plaque__btn {
  display: grid;
  gap: 0.1rem;
  width: 100%;
  text-align: left;
  border: 1px solid #5c3a21;
  background: linear-gradient(180deg, #f3e4c8, #e6d2a8);
  color: #2a1a10;
  padding: 0.35rem 0.55rem;
  cursor: pointer;
  font: inherit;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.35);
}

.calendar-plaque__btn:hover {
  background: linear-gradient(180deg, #f7ead2, #e0c990);
}

.calendar-plaque__kicker {
  font-size: 0.65rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  opacity: 0.7;
}

.calendar-plaque__ingame {
  font-family: var(--font-display, "Spectral", Georgia, serif);
  font-weight: 700;
  font-size: 0.95rem;
  line-height: 1.2;
}

.calendar-plaque__real {
  font-size: 0.72rem;
  opacity: 0.75;
}

.calendar-plaque__pop {
  position: absolute;
  z-index: 40;
  top: calc(100% + 6px);
  left: 0;
  min-width: 15rem;
  max-width: 20rem;
  padding: 0.65rem 0.75rem;
  border: 1px solid #5c3a21;
  background: #f7edd8;
  color: #2a1a10;
  box-shadow: 0 8px 20px rgba(40, 24, 10, 0.25);
}

.calendar-plaque__pop-title {
  margin: 0 0 0.25rem;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  opacity: 0.7;
}

.calendar-plaque__pop-ingame {
  margin: 0;
  font-family: var(--font-display, "Spectral", Georgia, serif);
  font-weight: 700;
  font-size: 1.05rem;
}

.calendar-plaque__pop-real,
.calendar-plaque__pop-ctx,
.calendar-plaque__pop-session {
  margin: 0.35rem 0 0;
  font-size: 0.78rem;
  line-height: 1.35;
  opacity: 0.85;
}

html[data-layout='mobile'] .calendar-plaque {
  max-width: none;
}

.wh-unlock-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.35rem;
}

.wh-unlock {
  font-size: 0.88rem;
  opacity: 0.65;
}

.wh-unlock--on {
  opacity: 1;
  font-weight: 600;
}

.wh-bribes {
  display: grid;
  gap: 0.6rem;
}

.wh-bribe {
  display: grid;
  gap: 0.25rem;
}

.qa-banner strong {
  letter-spacing: 0.02em;
}

.app-header__row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 16px;
}

.app-header h1 {
  margin: 0;
}

html:not([data-layout='mobile']) body {
  overflow: hidden;
}

html:not([data-layout='mobile']) .app-body {
  overflow: hidden;
}

.app-header__hint {
  margin: 2px 0 0;
  font-size: 0.8rem;
  opacity: 0.75;
}

.boot-banner {
  position: fixed;
  left: 12px;
  right: 12px;
  bottom: 12px;
  z-index: 100;
  padding: 12px 14px;
  border: 1px solid var(--danger, #8b2e2e);
  background: #f4ecde;
  color: var(--ink, #1a1510);
  font-size: 0.95rem;
  box-shadow: 2px 2px 0 rgba(0, 0, 0, 0.12);
}

.boot-banner[hidden] {
  display: none !important;
}

/* Sync status: a failed/queued server write used to be console-only. */
.sync-banner {
  position: fixed;
  left: 12px;
  right: 12px;
  bottom: 12px;
  z-index: 110;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border: 2px solid var(--border, #4a2c14);
  background: #f4ecde;
  color: var(--ink, #1a1510);
  font-size: 0.9rem;
  box-shadow: 2px 2px 0 rgba(0, 0, 0, 0.12);
}

.sync-banner[hidden] {
  display: none !important;
}

.sync-banner--error {
  border-color: var(--danger, #8b2e2e);
  background: #f6e3e0;
}

.sync-banner__icon {
  font-size: 1rem;
  line-height: 1;
  animation: sync-banner-spin 2s linear infinite;
}

.sync-banner--error .sync-banner__icon {
  animation: none;
}

.sync-banner__text {
  flex: 1 1 auto;
}

.sync-banner__retry {
  flex: 0 0 auto;
}

@keyframes sync-banner-spin {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

@media (prefers-reduced-motion: reduce) {
  .sync-banner__icon {
    animation: none;
  }
}

.boot-skeleton {
  margin: 16px;
  padding: 18px 20px;
  max-width: 420px;
  border: 3px solid var(--border, #4a2c14);
  background:
    linear-gradient(180deg, rgba(250, 244, 228, 0.96), rgba(236, 220, 188, 0.94)),
    var(--theme-parchment, #f5d1a0);
  box-shadow: var(--bevel-out, 2px 2px 0 rgba(0, 0, 0, 0.15));
}

.boot-skeleton__title {
  margin: 0 0 12px;
  font-family: var(--font-display, Georgia, serif);
  font-size: 1.05rem;
}

.boot-skel-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 4px 0;
}

.boot-skel-bar {
  display: block;
  height: 12px;
  width: 72px;
  margin-bottom: 8px;
  border-radius: 2px;
  background: linear-gradient(
    90deg,
    rgba(74, 44, 20, 0.12),
    rgba(74, 44, 20, 0.22),
    rgba(74, 44, 20, 0.12)
  );
  background-size: 200% 100%;
  animation: boot-skel-pulse 1.1s ease-in-out infinite;
}

.boot-skel-bar--wide {
  width: 100%;
  max-width: 280px;
  height: 14px;
}

.boot-skel-bar--mid {
  width: 60%;
  max-width: 200px;
}

@keyframes boot-skel-pulse {
  0% {
    background-position: 100% 0;
  }
  100% {
    background-position: -100% 0;
  }
}

.app-header__actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.app-role {
  font-size: 0.85rem;
  opacity: 0.85;
}

.room-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

.room-nav[hidden],
.map-hud[hidden] {
  display: none !important;
}

.map-hud {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 14px;
  margin-top: 8px;
  font-size: 0.85rem;
  width: 100%;
}

.map-hud span {
  white-space: nowrap;
}

.room-root {
  flex: 1 1 auto;
  min-height: 0;
  min-width: 0;
  display: flex;
  flex-direction: column;
  overflow: auto;
  padding-bottom: 8px;
}

.room-root:has(.map-room--bleed) {
  overflow: hidden;
  padding-bottom: 0;
}

.app-body {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: row;
  align-items: stretch;
}

.guild-chat {
  flex: 0 0 var(--chat-width, 260px);
  width: var(--chat-width, 260px);
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--border-soft, #8a7a62);
  background: var(--panel, #ebe1d0);
  min-height: 0;
}

.guild-chat__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  padding: 8px 10px;
  border-bottom: 1px solid var(--border-soft, #8a7a62);
  font-size: 0.9rem;
}

.guild-chat__speaker {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 4px;
}

.guild-chat__speaker-art {
  flex: 0 0 28px;
  width: 28px;
  height: 28px;
  border: 2px solid var(--border, #5a4a36);
  border-radius: 50%;
  background: var(--panel-soft, #f4ecde);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  font-size: 0.7rem;
}

.guild-chat__speaker-art img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.guild-chat__speaker-pick {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 6px;
  font-size: 0.7rem;
  opacity: 0.95;
}

.guild-chat__speaker-pick span {
  display: none;
}

.guild-chat__body {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.guild-chat__feed {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: 8px 10px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.guild-chat__empty,
.guild-chat__hint {
  margin: 0;
  font-size: 0.8rem;
  opacity: 0.75;
}

.guild-chat__msg {
  display: flex;
  gap: 8px;
  align-items: flex-start;
}

.guild-chat__avatar {
  flex: 0 0 32px;
  width: 32px;
  height: 32px;
  border: 1px solid var(--border, #5a4a36);
  background: var(--panel-soft, #f4ecde);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.7rem;
  overflow: hidden;
}

.guild-chat__avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.guild-chat__name {
  margin: 0;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--accent, #a16a38);
}

.guild-chat__stamp {
  font-weight: 500;
  opacity: 0.7;
  font-size: 0.7rem;
}

.guild-chat__text {
  margin: 2px 0 0;
  font-size: 0.85rem;
  white-space: pre-wrap;
  word-break: break-word;
}

.guild-chat__composer {
  border-top: 1px solid var(--border-soft, #8a7a62);
  padding: 8px 10px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.guild-chat__select,
.guild-chat__input {
  width: 100%;
  box-sizing: border-box;
  border: 1px solid var(--border, #5a4a36);
  background: var(--panel-soft, #f4ecde);
  color: var(--ink, #1a1510);
  font: inherit;
  font-size: 0.85rem;
  padding: 6px 8px;
}

.guild-chat__row {
  display: flex;
  gap: 6px;
}

.guild-chat__row .guild-chat__input {
  flex: 1 1 auto;
}

@media (max-width: 720px) {
  .app-body {
    flex-direction: column;
  }

  .guild-chat {
    flex: 0 0 auto;
    width: 100%;
    max-height: 40vh;
    border-right: 0;
    border-bottom: 1px solid var(--border-soft, #8a7a62);
  }
}

.map-room {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.map-room--bleed {
  position: relative;
}

.map-modes {
  flex: 0 0 auto;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 8px 12px;
  border-bottom: 0;
  background: transparent;
}

.map-modes--rail {
  position: relative;
  left: auto;
  top: auto;
  z-index: 8;
  flex-direction: column;
  flex-wrap: nowrap;
  align-items: stretch;
  width: min(148px, 30vw);
  flex: 0 0 auto;
  padding: 8px;
  border: 2px solid var(--border, #4a2c14);
  border-radius: 8px;
  border-bottom: 2px solid var(--border, #4a2c14);
  background:
    linear-gradient(180deg, rgba(250, 235, 200, 0.96), rgba(232, 188, 122, 0.94)),
    var(--theme-parchment, var(--parchment, #f5d1a0));
  background-size: auto, cover;
  box-shadow: var(--bevel-out), 0 6px 16px rgba(40, 24, 10, 0.35);
}

.map-chrome-left {
  position: absolute;
  left: 10px;
  top: 8px;
  z-index: 10;
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 8px;
  width: auto;
  max-width: min(420px, 58vw);
  pointer-events: none;
}

.map-chrome-left > * {
  pointer-events: auto;
}

.map-master-notes {
  flex: 1 1 168px;
  min-width: 150px;
  max-width: 220px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 8px;
  border: 2px solid var(--border, #4a2c14);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(250, 235, 200, 0.96), rgba(232, 188, 122, 0.94)),
    var(--theme-parchment, var(--parchment, #f5d1a0));
  background-size: auto, cover;
  box-shadow: var(--bevel-out), 0 6px 16px rgba(40, 24, 10, 0.35);
  color: var(--ink, #2b1a0e);
}

.map-master-notes[hidden] {
  display: none !important;
}

.map-master-notes__title {
  margin: 0;
  font-weight: 700;
  font-size: 0.82rem;
}

.map-master-notes__input {
  width: 100%;
  min-height: 110px;
  resize: vertical;
  box-sizing: border-box;
  font: inherit;
  font-size: 0.82rem;
  line-height: 1.35;
  padding: 6px 7px;
  border: 1px solid rgba(74, 44, 20, 0.45);
  border-radius: 4px;
  background: rgba(255, 250, 240, 0.92);
  color: inherit;
}

.map-master-notes__save {
  align-self: flex-start;
}

.map-chrome-top {
  position: absolute;
  left: 10px;
  right: 10px;
  top: 8px;
  z-index: 10;
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 8px 10px;
  pointer-events: none;
}

.map-chrome-top > * {
  pointer-events: auto;
}

.map-chrome-top .map-modes--rail {
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  gap: 6px;
  width: auto;
  max-width: none;
  padding: 6px;
}

.map-chrome-top .map-modes--rail .mode-btn {
  width: auto;
}

.map-chrome-top__next {
  flex: 1 1 200px;
  min-width: 160px;
  max-width: min(420px, 48%);
}

.map-chrome-top .schedule-strip-host {
  flex: 0 1 auto;
  max-width: min(280px, 40%);
}

.map-modes--rail .mode-btn {
  width: 100%;
  text-align: left;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.mode-btn__icon {
  flex: 0 0 auto;
  font-size: 0.95rem;
  line-height: 1;
}

.mode-btn__label {
  flex: 1 1 auto;
  min-width: 0;
}

.map-stage {
  flex: 1 1 auto;
  min-height: 0;
  display: block;
  position: relative;
  --region-panel-width: 260px;
  gap: 0;
  padding: 0;
  align-items: stretch;
  overflow: hidden;
  background: var(--parchment, #f5d1a0);
}

.map-canvas {
  position: absolute;
  inset: 0;
  flex: none;
  min-width: 0;
  min-height: 0;
  aspect-ratio: auto;
  max-height: none;
  width: 100%;
  height: 100%;
  margin: 0;
  display: flex;
  align-items: stretch;
  justify-content: center;
  padding: 0;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  background-color: var(--parchment, #f5d1a0);
  background-image: var(--theme-parchment);
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  overflow: hidden;
}

.map-root {
  flex: 1 1 auto;
  min-width: 0;
  min-height: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  padding: 0;
  background-color: var(--parchment, #f5d1a0);
  background-image: var(--theme-parchment);
  background-size: cover;
  background-position: center;
  display: flex;
  align-items: center;
  justify-content: center;
}

.map-root svg {
  display: block;
  width: 100%;
  height: 100%;
  max-height: none;
  overflow: hidden;
  object-fit: cover;
  background: transparent;
}

.map-root path.province {
  cursor: pointer;
  transition: stroke-width 0.12s ease, stroke 0.12s ease, fill-opacity 0.12s ease;
  stroke: #130f0a;
  stroke-width: 2;
}

.map-root path.province.is-hover {
  stroke: #fff6e0;
  stroke-width: 5;
  filter: none;
  paint-order: stroke fill;
}

.map-root path.province.is-duchy-on {
  stroke: rgba(255, 236, 190, 0.85);
  stroke-width: 2.5;
  paint-order: stroke fill;
}

.map-root path.province.is-selected {
  stroke: #ffe8a8;
  stroke-width: 6;
  filter: brightness(1.06);
  paint-order: stroke fill;
}

.map-root path.province.is-selected.is-hover {
  stroke: #fff6e0;
  stroke-width: 6;
}

.map-label {
  pointer-events: none;
  font-family: Georgia, "Times New Roman", serif;
  /* The halo is what makes map text readable: the fill is near-black and the
   * map behind it is dark brown, so without a light outline the names fade into
   * the terrain (measured 1.2:1 before). `paint-order: stroke fill` draws the
   * outline first, so the glyphs stay crisp inside it. */
  paint-order: stroke fill;
  stroke: rgba(255, 246, 220, 0.95);
  stroke-width: 3.5px;
  stroke-linejoin: round;
  stroke-linecap: round;
}

.map-label--duchy {
  fill: #2a1a0c;
  font-size: 11px;
  font-weight: 700;
  /* Full opacity: the previous 0.88 thinned the glyphs just enough that the
   * dark map showed through the strokes and the names looked faded. */
  opacity: 1;
  letter-spacing: 0.02em;
}

.map-label--capital {
  fill: #3a2412;
  font-size: 8px;
  font-weight: 600;
  opacity: 1;
}

.map-label--guild {
  stroke-width: 2.5px;
}

.map-capital-dot {
  fill: #f0e2c0;
  stroke: #3a2412;
  stroke-width: 1.2;
  pointer-events: none;
}

.wh-monument-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.wh-monument {
  margin: 0;
  padding: 8px 10px;
  border: 1px solid rgba(74, 44, 20, 0.35);
  border-radius: 6px;
  background: rgba(244, 236, 222, 0.55);
}

.wh-monument--on {
  border-color: rgba(74, 44, 20, 0.7);
  background: linear-gradient(180deg, rgba(250, 235, 200, 0.95), rgba(236, 210, 150, 0.9));
}

.wh-monument p {
  margin: 4px 0 0;
}

.wh-fold--on > summary {
  font-weight: 700;
}

.wh-howto summary {
  cursor: pointer;
  font-family: var(--font-pixel, monospace);
  font-size: 0.95rem;
  list-style: none;
}

.wh-howto summary::-webkit-details-marker {
  display: none;
}

.wh-howto__list {
  margin: 8px 0 4px;
  padding-left: 1.1rem;
  font-size: 0.9rem;
  line-height: 1.4;
}

.wh-howto__list li {
  margin-bottom: 0.35rem;
}

.wh-howto__lead {
  margin: 8px 0 6px;
}

.guild-guide-host:not([hidden]),
.guild-guide-host.is-open {
  display: block !important;
  position: fixed;
  inset: 0;
  z-index: 120;
  pointer-events: auto;
}

.guild-guide-modal {
  max-width: min(440px, 94vw);
  padding: 16px 18px 18px;
}

.guild-guide__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 4px;
}

.guild-guide__head h2 {
  margin: 0;
  font-size: 1.15rem;
}

.guild-guide__progress {
  margin: 0 0 8px;
  font-size: 0.85rem;
  opacity: 0.8;
  font-family: var(--font-pixel, monospace);
}

.guild-guide__step-title {
  margin: 0 0 8px;
  font-size: 1.05rem;
}

.guild-guide__body {
  margin: 0 0 16px;
  line-height: 1.45;
  font-size: 0.98rem;
}

.guild-guide__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

.region-panel {
  flex: 0 0 var(--region-panel-width);
  width: var(--region-panel-width);
  padding: 16px;
  border-left: 1px solid #8a7a62;
  background: #ebe1d0;
  overflow: auto;
}

.region-panel--overlay {
  position: absolute;
  top: 48px;
  right: 10px;
  bottom: auto;
  z-index: 8;
  flex: none;
  width: min(var(--region-panel-width, 260px), 42vw);
  max-height: calc(100% - 120px);
  padding: 12px;
  border: 2px solid var(--border, #4a2c14);
  border-left: 2px solid var(--border, #4a2c14);
  border-radius: 8px;
  background: linear-gradient(180deg, rgba(250, 235, 200, 0.95), rgba(243, 223, 184, 0.92));
  box-shadow: var(--bevel-out), 0 6px 16px rgba(40, 24, 10, 0.35);
  color: var(--ink, #2b1a0e);
  overflow: auto;
}

.region-panel h2 {
  margin: 0 0 8px;
  font-size: 1.2rem;
}

.region-panel p {
  margin: 0 0 8px;
  line-height: 1.35;
}

.region-panel__meta {
  font-size: 0.95rem;
}

.region-panel__empty,
.region-panel__error {
  margin: 0;
  opacity: 0.8;
}

.region-panel__error {
  color: #7a1f1f;
}

.region-panel__lore-label {
  display: block;
  margin: 8px 0;
  font-size: 0.9rem;
}

.region-panel__lore {
  display: block;
  width: 100%;
  margin-top: 4px;
  padding: 6px;
  border: 1px solid #8a7a62;
  background: #f4ecde;
  font: inherit;
  resize: vertical;
}

.room-stub {
  padding: 24px 16px;
}

.room-stub h2 {
  margin: 0 0 8px;
}

.room-stub__lead {
  margin: 0 0 10px;
  opacity: 0.85;
}

.room-stub__list {
  margin: 0;
  padding-left: 1.2rem;
  line-height: 1.45;
}

.characters-ot-host {
  flex: 1 1 auto;
  min-height: 0;
  height: 100%;
  display: flex;
  flex-direction: column;
}

.characters-ot-host .ot-hub {
  flex: 1 1 auto;
  min-height: 0;
  height: 100%;
}

.map-legend {
  position: absolute;
  right: calc(var(--region-panel-width, 280px) + 16px);
  bottom: 12px;
  z-index: 5;
  width: 210px;
  height: auto;
  max-height: none;
  box-sizing: border-box;
  padding: 10px;
  overflow: visible;
  background: #ebe1d0;
  border: 1px solid #5a4a36;
  box-shadow: 2px 2px 0 rgba(0, 0, 0, 0.2);
  pointer-events: auto;
  font-size: 0.78rem;
}

.map-legend--overlay {
  top: auto;
  right: auto;
  bottom: 12px;
  left: 10px;
  /* Above the map canvas, below mode rail clicks — but keep the legend clear of
   * the top-left chrome by sitting at the bottom and staying compact (2 cols). */
  z-index: 11;
  width: min(360px, 52vw);
  height: auto;
  max-height: min(38vh, calc(100% - 220px));
  overflow: auto;
  border: 2px solid var(--border, #4a2c14);
  border-radius: 8px;
  background: linear-gradient(180deg, rgba(250, 235, 200, 0.95), rgba(243, 223, 184, 0.92));
  box-shadow: var(--bevel-out), 0 6px 16px rgba(40, 24, 10, 0.35);
  color: var(--ink, #2b1a0e);
  pointer-events: auto;
}

.region-panel--overlay {
  top: 12px;
  bottom: 12px;
  right: 10px;
  left: auto;
  width: min(380px, 42%);
  max-height: none;
  height: auto;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  pointer-events: auto;
}

.region-panel--overlay .region-panel__scroll {
  flex: 1 1 auto;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.region-panel__details {
  margin: 4px 0;
  border: 1px solid rgba(74, 44, 20, 0.35);
  border-radius: 6px;
  padding: 4px 8px;
  background: rgba(244, 236, 222, 0.55);
}

.region-panel__details > summary {
  cursor: pointer;
  font-weight: 600;
  font-size: 0.9rem;
  list-style: none;
}

.region-panel__details > summary::-webkit-details-marker {
  display: none;
}

.hud-vault--map {
  position: absolute;
  top: 52px;
  right: 10px;
  z-index: 8;
  width: min(148px, 30vw);
  grid-template-columns: 1fr;
  gap: 6px;
  padding: 8px;
  border: 2px solid var(--border, #4a2c14);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(250, 235, 200, 0.96), rgba(232, 188, 122, 0.94)),
    var(--theme-parchment, var(--parchment, #f5d1a0));
  background-size: auto, cover;
  box-shadow: var(--bevel-out), 0 6px 16px rgba(40, 24, 10, 0.35);
  max-height: calc(100% - 120px - min(42%, 280px));
  overflow: auto;
  pointer-events: auto;
}

.hud-vault--map .hud-vault__item {
  padding: 5px 7px;
}

.schedule-strip-host--overlay {
  position: relative;
  top: auto;
  left: auto;
  transform: none;
  z-index: 10;
  width: 100%;
  max-width: none;
  pointer-events: auto;
}

.map-legend__title {
  margin: 0 0 6px;
  font-weight: 700;
  font-size: 0.88rem;
}

.map-legend__body {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.map-legend__body--cols {
  display: grid;
  grid-template-columns: 1fr 1fr;
  column-gap: 10px;
  row-gap: 4px;
  align-content: start;
}

.map-legend__row {
  display: flex;
  align-items: center;
  gap: 6px;
  line-height: 1.15;
}

.map-legend__swatch {
  flex: 0 0 14px;
  width: 14px;
  height: 14px;
  border: 1px solid #3a2a18;
}

.map-legend .res-icon {
  flex: 0 0 auto;
  display: block;
}

.map-legend__empty {
  margin: 0;
  opacity: 0.75;
}

.reports-list__item {
  margin-bottom: 10px;
  padding-bottom: 8px;
  border-bottom: 1px solid rgba(90, 74, 54, 0.25);
}

.reports-modal {
  position: relative;
  z-index: 1;
  width: min(520px, calc(100% - 32px));
  max-height: 80vh;
  overflow: auto;
  margin: 8vh auto 0;
  padding: 16px;
  background: #ebe1d0;
  border: 1px solid #5a4a36;
}

.reports-modal h2,
.reports-modal h3 {
  margin: 0 0 8px;
}

.reports-form {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 16px;
}

.reports-form label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 0.9rem;
}

.reports-form input,
.reports-form select,
.reports-form textarea {
  padding: 6px 8px;
  border: 1px solid #8a7a62;
  background: #f4ecde;
  font: inherit;
}

.reports-optional {
  font-size: 0.8rem;
  opacity: 0.7;
  font-weight: 400;
}

.reports-res {
  margin: 0;
  padding: 10px;
  border: 2px solid var(--border, #4a2c14);
  border-radius: 6px;
  background: #f7ecd8;
}

.reports-res legend {
  padding: 0 6px;
  font-family: var(--font-pixel, monospace);
  font-size: 0.95rem;
}

.reports-res__grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 8px;
}

.reports-res__field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 0.85rem;
}

.reports-advanced {
  font-size: 0.85rem;
}

.reports-advanced summary {
  cursor: pointer;
  margin-bottom: 6px;
}

.reports-narrative textarea {
  min-height: 88px;
}

.reports-list__note {
  margin: 4px 0 0;
  font-size: 0.85rem;
  color: var(--ink-soft, #4a3220);
  white-space: pre-wrap;
}

.reports-preview {
  margin: 0;
  padding: 8px;
  background: rgba(255, 255, 255, 0.35);
  border: 1px solid #8a7a62;
  font-size: 0.9rem;
  line-height: 1.35;
}

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

.reports-list {
  margin: 0;
  padding-left: 1.2rem;
  font-size: 0.9rem;
}

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

.app-footer {
  flex: 0 0 auto;
  padding: 6px 16px;
  border-top: 1px solid #8a7a62;
  background: #cfc0a6;
  font-size: 0.72rem;
  opacity: 0.65;
}

.app-status {
  flex: 0 0 auto;
  display: block;
  width: 100%;
  margin: 0;
  padding: 6px 12px 8px;
  border: 0;
  border-top: 1px solid rgba(90, 72, 48, 0.35);
  border-radius: 0;
  background: #b9ab92;
  font-family: var(--font-pixel, 'VT323', monospace);
  font-size: 0.95rem;
  letter-spacing: 0.02em;
  text-align: center;
  opacity: 0.95;
  color: #2a2218;
  cursor: pointer;
  box-sizing: border-box;
}

.app-status:hover,
.app-status:focus-visible {
  opacity: 1;
  background: #c4b69c;
  outline: 2px solid rgba(74, 44, 20, 0.45);
  outline-offset: -2px;
}

.app-footer__links {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 14px;
  justify-content: center;
}

.app-footer__links a {
  color: inherit;
  text-decoration: none;
  border-bottom: 1px solid transparent;
}

.app-footer__links a:hover {
  opacity: 1;
  border-bottom-color: currentColor;
}

/* —— NPC room —— */
.npc-room {
  padding: 12px 14px 24px;
  min-height: 0;
}

.npc-room__bar {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 14px;
}

.npc-room__title {
  margin: 0;
  font-size: 1.25rem;
}

.npc-room__lead {
  margin: 4px 0 0;
  font-size: 0.85rem;
  opacity: 0.75;
}

.npc-room__controls {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 8px;
}

.npc-room__filter {
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-size: 0.75rem;
  opacity: 0.9;
}

.npc-room__filter select {
  min-width: min(180px, 100%);
  padding: 6px 10px;
  border: 1px solid var(--border, #5a4a36);
  background: var(--panel-soft, #f4ecde);
  font: inherit;
}

.npc-room__search {
  width: 168px;
  min-width: 140px;
  max-width: 168px;
  flex: 0 0 auto;
  padding: 6px 10px;
  border: 1px solid var(--border, #5a4a36);
  background: var(--panel-soft, #f4ecde);
  font: inherit;
  box-sizing: border-box;
}

.npc-room__grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 16px;
  align-items: start;
}

.npc-room__filter--check {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.85rem;
  cursor: pointer;
}

.npc-stack {
  display: flex;
  flex-direction: column;
  gap: 0;
  min-width: 0;
}

.npc-stack--open .npc-rumors {
  animation: npc-rumors-in 0.22s ease-out;
}

@keyframes npc-rumors-in {
  from {
    opacity: 0;
    transform: translateY(-4px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

.npc-card {
  position: relative;
  border: 1px solid var(--border, #5a4a36);
  background: var(--panel-soft, #f4ecde);
  box-shadow: 2px 2px 0 rgba(0, 0, 0, 0.08);
  display: flex;
  flex-direction: column;
  min-height: 0;
  box-sizing: border-box;
  overflow: hidden;
}

.npc-card--open {
  border-color: var(--accent, #a16a38);
  box-shadow: none;
}

.npc-card__art {
  position: relative;
  width: min(100%, 160px);
  margin: 0 auto 10px;
  aspect-ratio: 1 / 1;
  max-height: none;
  border: 2px solid var(--border, #4a2c14);
  border-radius: 4px;
  background: var(--parchment, #d8cbb6);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

.npc-card__art img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 20%;
  display: block;
}

.npc-card__ph {
  font-size: 2.4rem;
  font-weight: 700;
  /* Accent orange sat at ~2.2:1 on the card's pale avatar tile. The initial is
   * decorative, but it is still text, so it uses ink at reduced weight. */
  color: var(--ink, #2b1a0e);
  opacity: 0.5;
}

.npc-card__body {
  padding: 10px 12px 6px;
  flex: 1 1 auto;
  min-width: 0;
}

.npc-card__name {
  margin: 0 0 6px;
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--accent, #a16a38);
  line-height: 1.25;
  word-break: break-word;
}

.npc-card__badges {
  margin: 0 0 6px;
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.npc-card__loc {
  margin: 0;
  font-size: 0.82rem;
  opacity: 0.8;
  line-height: 1.35;
  word-break: break-word;
}

.npc-card__details {
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px dashed rgba(90, 74, 54, 0.35);
  display: grid;
  gap: 4px;
}

.npc-card__line {
  margin: 0;
  font-size: 0.84rem;
  line-height: 1.4;
  color: var(--ink, #1a1510);
  opacity: 0.9;
  word-break: break-word;
  white-space: normal;
}

.npc-card__foot {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: auto;
  border-top: 1px solid var(--border-soft, #8a7a62);
  padding: 8px 10px 10px;
  background: rgba(255, 255, 255, 0.18);
  flex: 0 0 auto;
}

.npc-card__rumors-btn {
  flex: 1 1 auto;
  min-width: 0;
  padding: 7px 10px;
  border: 1px solid var(--border, #5a4a36);
  background: transparent;
  color: var(--ink, #1a1510);
  font: inherit;
  font-size: 0.86rem;
  cursor: pointer;
  text-align: left;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.npc-card__rumors-btn:hover,
.npc-card__rumors-btn.is-active {
  background: var(--accent, #a16a38);
  border-color: var(--accent, #a16a38);
  color: #fff8ec;
}

.npc-card__edit-btn {
  flex: 0 0 auto;
  padding: 4px 8px;
  font-size: 0.8rem;
}

.guild-npc-modal {
  width: min(520px, calc(100% - 32px));
  max-height: min(90vh, 720px);
  overflow: auto;
}

.master-guild-npc-list {
  list-style: none;
  margin: 10px 0 0;
  padding: 0;
  display: grid;
  gap: 6px;
}

.npc-rumors {
  border: 1px solid var(--accent, #a16a38);
  border-top: 0;
  background: rgba(255, 248, 236, 0.95);
  box-shadow: 2px 2px 0 rgba(0, 0, 0, 0.06);
  display: flex;
  flex-direction: column;
  padding: 10px 12px 12px;
}

.npc-rumors__compose {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--border-soft, #8a7a62);
}

.npc-rumors__thread-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 8px 0;
}

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

.npc-rumors__title-row .npc-comments__title {
  margin: 0;
}

.npc-rumors__clear {
  flex: 0 0 auto;
  font-size: 0.8rem;
  padding: 4px 8px;
}
