/* Layer: 08-polish.css
 * UX overhaul, polish passes, chrome v3, density
 *
 * 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.
 */
/* —— UX overhaul: news paper, stardew chat, muted HUD —— */
.news-room--paper {
  padding: 12px 14px 28px;
  color: var(--ink, #2b1a0e);
}

.news-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.6fr) minmax(240px, 0.85fr);
  gap: 14px;
  align-items: start;
}

.news-paper {
  padding: 16px 18px;
  border: 3px solid var(--border, #4a2c14);
  background:
    linear-gradient(180deg, #f7efd8, #efe0c0),
    var(--theme-parchment, #f5d1a0);
  box-shadow: var(--bevel-out);
}

.news-paper__masthead {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  justify-content: space-between;
  border-bottom: 3px double var(--border, #4a2c14);
  padding-bottom: 10px;
  margin-bottom: 12px;
}

.news-paper__eyebrow {
  margin: 0;
  width: 100%;
  font-family: var(--font-clerk, monospace);
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.news-paper__title {
  margin: 0;
  font-family: var(--font-pixel, monospace);
  font-size: 1.8rem;
  color: var(--ink, #2b1a0e);
}

.news-column {
  padding: 10px 0;
  border-bottom: 1px solid rgba(74, 44, 20, 0.25);
}

.news-rail {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.news-rail__card {
  padding: 12px;
  border: 2px solid var(--border, #4a2c14);
  border-radius: 8px;
  background: linear-gradient(180deg, #faebc8, #f0d8a0);
  box-shadow: var(--bevel-out);
  color: var(--ink, #2b1a0e);
}

.news-rail__card h3 {
  margin: 0 0 8px;
  color: var(--ink, #2b1a0e);
}

@media (max-width: 900px) {
  .news-layout {
    grid-template-columns: 1fr;
  }
}

.guild-chat__bubble {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin: 0 4px 6px;
  padding: 6px 8px;
  border: 2px solid #3a2818;
  border-radius: 10px 10px 10px 4px;
  background: linear-gradient(180deg, #fff4d8, #f0d8a8);
  box-shadow: 1px 1px 0 #1a1008;
  color: var(--ink, #2b1a0e);
}

.guild-chat__bubble--system {
  border-style: dashed;
  background: linear-gradient(180deg, #efe8d8, #e2d4bc);
  border-radius: 6px;
}

.guild-chat__bubble--npc {
  border-color: #5a3a28;
  background: linear-gradient(180deg, #f7ecd8, #e8d4b0);
}

.guild-chat__name--system {
  font-size: 0.85rem;
  opacity: 0.9;
  margin: 0 0 4px;
}

.guild-chat__nameplate {
  display: flex;
  align-items: center;
  gap: 8px;
}

.guild-chat__bubble .guild-chat__avatar {
  width: 28px;
  height: 28px;
  border: 2px solid #3a2818;
  border-radius: 2px;
  overflow: hidden;
  background: #d8c4a0;
  flex: 0 0 auto;
}

.guild-chat__bubble .guild-chat__name {
  margin: 0;
  font-family: var(--font-pixel, monospace);
  font-size: 1.05rem;
}

.guild-chat__bubble .guild-chat__text {
  margin: 0;
  padding-left: 36px;
  line-height: 1.35;
}

.map-hud__board--threats {
  background: linear-gradient(180deg, rgba(232, 200, 140, 0.92), rgba(200, 160, 100, 0.9));
  border-color: var(--border, #4a2c14);
}

.hud-vault--compact {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin-top: 8px;
}

.hud-vault--compact .hud-vault__item {
  padding: 4px 6px;
}

.master-search {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 10px;
  font-family: var(--font-pixel, monospace);
  color: var(--ink, #2b1a0e);
}

.master-search input {
  padding: 6px 8px;
  border: 2px solid var(--border, #4a2c14);
  border-radius: 4px;
  background: #fff8e8;
  color: var(--ink, #2b1a0e);
}

.lib-editor input[type='file'] {
  padding: 6px;
  border: 2px dashed var(--border, #4a2c14);
  background: #fff8e8;
}

.map-hud__board {
  max-width: min(960px, 100%);
}

/* —— UX overhaul: shared modal language (work / tickets / invest) —— */
.work-modal,
.tickets-modal,
.reports-modal.invest-modal,
.reports-modal--wide {
  width: min(720px, calc(100% - 24px));
  max-height: 88vh;
  padding: 16px 18px 20px;
  border: 3px solid var(--border, #4a2c14);
  border-radius: 6px;
  background:
    linear-gradient(180deg, #f7efd8, #efe0c0),
    var(--theme-parchment, #f5d1a0);
  box-shadow: var(--bevel-out, 3px 3px 0 #2b1a0e);
  color: var(--ink, #2b1a0e);
  font-family: var(--font-pixel, 'VT323', monospace);
}

.work-modal {
  width: min(960px, calc(100% - 24px));
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.work-modal__chrome {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
  flex-shrink: 0;
}

.work-modal__tabs {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.work-modal__tab {
  border: 2px solid var(--border, #4a2c14);
  background: #efe0c0;
  color: var(--ink, #2b1a0e);
  font: inherit;
  padding: 4px 12px;
  cursor: pointer;
  border-radius: 4px;
}

.work-modal__tab--on {
  background: #fff8e8;
  box-shadow: inset 0 0 0 1px #8b5a2b;
  font-weight: 600;
}

.work-modal__close,
.tickets-modal__close {
  float: right;
  margin-bottom: 8px;
}

.work-modal__chrome .work-modal__close {
  float: none;
  margin-bottom: 0;
  flex-shrink: 0;
}

.work-modal__body {
  overflow: auto;
  flex: 1;
  min-height: 0;
}

.work-modal__body .work-room,
.tickets-modal__body .tickets-room {
  color: var(--ink, #2b1a0e);
}

.work-modal select,
.work-modal input,
.work-modal textarea,
.tickets-modal select,
.tickets-modal input,
.tickets-modal textarea,
.news-rail__card select,
.news-rail__card input,
.news-rail__card textarea {
  border: 2px solid var(--border, #4a2c14);
  border-radius: 4px;
  background: #fff8e8;
  color: var(--ink, #2b1a0e);
  padding: 6px 8px;
}

.work-modal select:focus,
.work-modal input:focus,
.work-modal textarea:focus,
.tickets-modal select:focus,
.tickets-modal input:focus,
.tickets-modal textarea:focus {
  outline: 2px solid #8b5a2b;
  outline-offset: 1px;
}

/* —— Polish pass 2 —— */
.master-toc--chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 10px 12px;
  margin: 0 0 12px;
  border: 2px solid var(--border, #4a2c14);
  border-radius: 8px;
  background:
    linear-gradient(180deg, #f7efd8, #efe0c0),
    var(--theme-parchment, #f5d1a0);
}

.master-toc__chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 6px 10px;
  border: 2px solid var(--border, #4a2c14);
  border-radius: 6px;
  background: #fff8e8;
  color: var(--ink, #2b1a0e) !important;
  text-decoration: none;
  font-family: var(--font-pixel, monospace);
  font-size: 0.95rem;
  box-shadow: var(--bevel-out);
  cursor: pointer;
}

button.master-toc__chip {
  font: inherit;
}

.master-toc__chip.is-active {
  background: #ffe6b8;
  box-shadow: inset 0 0 0 1px rgba(74, 44, 20, 0.35);
  font-weight: 700;
}

.master-room {
  display: flex;
  flex-direction: column;
  min-height: 0;
  height: 100%;
  gap: 8px;
}

.master-room__bar {
  flex: 0 0 auto;
}

.master-toc--rail {
  position: sticky;
  top: 0;
  z-index: 6;
  flex: 0 0 auto;
  margin: 0;
  align-self: stretch;
}

.master-room__stage {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
  display: flex;
  flex-direction: column;
}

.master-room__stage .master-section[hidden] {
  display: none !important;
}

.master-room__stage .master-section.is-active {
  margin-bottom: 0;
  /* Natural height: stretching a five-row panel to fill the stage left a wide
     blank area of bare parchment below its last row. */
  flex: 0 0 auto;
}

.master-room,
.master-room .master-lead,
.master-room .master-muted,
.master-room .master-status,
.master-room h2,
.master-room h3,
.master-room label {
  color: var(--ink, #2b1a0e);
}

.master-section {
  background:
    linear-gradient(180deg, rgba(250, 235, 200, 0.96), rgba(232, 188, 122, 0.9)),
    var(--theme-parchment, #f5d1a0);
  border: 2px solid var(--border, #4a2c14);
  border-radius: 8px;
  padding: 8px 10px;
  margin-bottom: 8px;
  color: var(--ink, #2b1a0e);
}

.master-details > summary {
  cursor: pointer;
  list-style: none;
}

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

.master-details > summary h3 {
  display: inline;
  margin: 0;
}

.master-toc--chips {
  position: sticky;
  top: 0;
  z-index: 5;
  background: rgba(245, 209, 160, 0.92);
  padding: 6px 0;
}

.master-section h3,
.master-section .master-muted,
.master-section label {
  color: var(--ink, #2b1a0e);
  opacity: 1;
}

.reports-modal__actions--pair {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 10px;
}

.reports-players {
  max-height: 180px;
  overflow: auto;
  border: 1px solid rgba(74, 44, 20, 0.35);
  padding: 8px;
  margin: 8px 0 12px;
  background: rgba(255, 248, 230, 0.55);
}

.reports-players__row {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin: 4px 0;
  font-size: 0.92rem;
}

.master-legend-row,
.master-games-row {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) repeat(3, minmax(64px, 0.6fr)) auto;
  gap: 6px 8px;
  align-items: center;
  margin: 6px 0;
  font-size: 0.85rem;
}

.master-games-row {
  grid-template-columns: minmax(0, 1.6fr) minmax(72px, 0.5fr) minmax(56px, 0.4fr) auto auto;
}

@media (max-width: 900px) {
  .master-legend-row,
  .master-games-row {
    grid-template-columns: 1fr 1fr;
  }
}

.reports-attention {
  margin: 16px 0;
  padding: 12px;
  border: 2px dashed var(--border, #4a2c14);
  border-radius: 8px;
  background: #fff4e0;
  color: var(--ink, #2b1a0e);
}

.reports-attention--focus {
  outline: 3px solid #a16a38;
}

.news-paper__masthead--charm {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 12px;
  align-items: center;
}

.news-paper__velma {
  width: 88px;
  height: 88px;
  object-fit: cover;
  border: 3px solid var(--border, #4a2c14);
  border-radius: 8px;
  box-shadow: var(--bevel-out);
}

.gossip-feed__list--cards {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 10px;
}

.news-card,
.gossip-sheet.news-card {
  margin: 0;
  padding: 12px 14px;
  border: 2px solid var(--border, #4a2c14);
  border-radius: 4px;
  background: #fffaf0;
  box-shadow: 2px 2px 0 rgba(40, 24, 10, 0.2);
}

.news-card--stub {
  opacity: 0.85;
  font-style: italic;
}

.next-step--compact {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 10px;
  padding: 6px 8px;
  font-size: 0.85rem;
}

.next-step--compact .next-step__text {
  flex: 1 1 140px;
  min-width: 0;
}

.next-step--guest {
  border-color: var(--accent, #c4893a);
  box-shadow: 0 0 0 1px rgba(196, 137, 58, 0.35);
}

.next-step--guest .next-step__cta {
  font-weight: 700;
  text-decoration: underline;
}

.news-paper-sheet--empty {
  padding: 18px 16px;
  min-height: 120px;
}

.news-empty__lead {
  margin: 0 0 8px;
  font-size: 1.05rem;
  font-weight: 600;
}

/* —— chrome v3 —— */
.map-root svg {
  object-fit: contain;
}

.map-stage {
  max-height: none;
}

.map-chrome-left {
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: min(148px, 30vw);
}

.map-chrome-left .map-modes--rail {
  flex-direction: column;
  flex-wrap: nowrap;
  align-items: stretch;
}

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

.map-legend--overlay {
  top: auto;
  right: auto;
  bottom: 12px;
  left: 10px;
  height: auto;
  max-height: min(38vh, calc(100% - 220px));
  overflow: auto;
  width: min(360px, 52vw);
  z-index: 11;
}

.map-chrome-left {
  bottom: auto;
  max-height: calc(100% - 12px - min(48%, 280px) - 16px);
  overflow: auto;
  width: auto;
  max-width: min(420px, 58vw);
}

.map-hud__board--v3 {
  display: grid;
  grid-template-columns: 1fr;
  grid-template-rows: auto auto;
  align-items: stretch;
  gap: 8px 10px;
  padding: 8px 10px;
  width: 100%;
  max-width: none;
  box-sizing: border-box;
}

.map-hud__board--v3 .hud-mid {
  min-width: 0;
  display: grid;
  grid-template-columns: minmax(110px, 148px) minmax(0, 1.05fr) minmax(240px, 1.55fr) minmax(0, 1.05fr) minmax(110px, 148px);
  gap: 8px 10px;
  align-items: stretch;
}

.map-hud__board--v3 .hud-mid__aside {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: none;
  overflow: hidden;
}

.map-hud__board--v3 .map-hud__row--footer {
  display: none;
}

.map-hud__board--v3 .map-hud__next,
.map-hud__board--v3 .schedule-strip-host {
  min-width: 0;
}

.map-hud__next {
  display: block;
}

.hud-nav {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(96px, 1fr));
  gap: 6px;
  align-content: start;
  width: 100%;
}

.hud-nav__btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  width: 100%;
  min-height: 36px;
  padding: 6px 8px;
  border: 2px solid var(--border, #4a2c14);
  border-radius: 6px;
  background: linear-gradient(180deg, #faebc8, #e8bc7a);
  box-shadow: var(--bevel-out);
  color: var(--ink, #2b1a0e);
  font-family: var(--font-pixel, monospace);
  font-size: 0.9rem;
  line-height: 1.15;
  white-space: normal;
  text-align: center;
  box-sizing: border-box;
}

.hud-nav__btn.nav-btn--active {
  filter: brightness(1.12) saturate(1.08);
  box-shadow: var(--bevel-in);
  outline: 2px solid rgba(90, 50, 18, 0.55);
  outline-offset: -2px;
  background: linear-gradient(180deg, #f8e4b8, #d4a05a);
  font-weight: 700;
}

.map-hud__board--v3 .hud-threats--inline,
.map-hud__board--v3 .hud-vault--row {
  display: grid;
  gap: 6px;
  align-items: stretch;
}

.map-hud__board--v3 .hud-threats--inline {
  grid-template-columns: 1fr;
}

.map-hud__board--v3 .hud-vault--row,
.map-hud__board--v3 .hud-vault--grid23,
.map-hud__board--v3 .hud-vault--row6,
.map-hud__board--v3 .hud-vault--wing {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  grid-template-rows: minmax(0, 1fr);
  width: 100%;
  height: 100%;
  max-width: none;
  max-height: none;
  justify-self: stretch;
  align-self: stretch;
  min-width: 0;
  min-height: 0;
  gap: 6px;
  display: grid;
  align-items: stretch;
}

.map-hud__board--v3 .hud-vault--wing .hud-vault__item,
.map-hud__board--v3 .hud-vault--row6 .hud-vault__item,
html:not([data-layout='mobile']) .map-hud__board--v3 .hud-vault--wing .hud-vault__item {
  min-width: 0;
  min-height: 0 !important;
  max-height: none !important;
  height: 100%;
  padding: 5px 6px;
  justify-content: center;
  text-align: center;
  align-self: stretch;
}

.map-hud__board--v3 .hud-vault--wing .hud-vault__k,
.map-hud__board--v3 .hud-vault--row6 .hud-vault__k {
  font-size: 0.8rem;
  line-height: 1.15;
  white-space: normal;
  overflow-wrap: anywhere;
}

.map-hud__board--v3 .hud-vault--wing .hud-vault__v,
.map-hud__board--v3 .hud-vault--row6 .hud-vault__v {
  font-size: 1.08rem;
}

.map-hud__board--v3 .hud-mid--winged > .hud-threat {
  min-width: 0;
  width: 100%;
  height: 100%;
}

.map-hud__board--v3 .hud-vault__item,
.map-hud__board--v3 .hud-threat {
  min-height: 52px;
  padding: 8px 10px;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 4px;
  border: 2px solid var(--border, #4a2c14);
  border-radius: 6px;
  background: linear-gradient(180deg, rgba(250, 235, 200, 0.95), rgba(232, 188, 122, 0.88));
  box-shadow: var(--bevel-out);
}

.map-hud__board--v3 .hud-vault__k,
.map-hud__board--v3 .hud-threat__label {
  font-size: 0.88rem;
  line-height: 1.2;
  white-space: normal;
  word-break: break-word;
  font-weight: 600;
}

.map-hud__board--v3 .hud-vault__v {
  font-size: 1.15rem;
  font-weight: 700;
  white-space: normal;
}

.news-layout--velma {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  align-items: start;
}

.news-col--velma {
  display: flex;
  flex-direction: column;
  gap: 10px;
  align-items: stretch;
}

.news-col--velma .news-paper__velma {
  align-self: center;
}

.news-col--velma .news-paper__title {
  margin: 0;
}

.news-col--paper {
  min-width: 0;
}

.news-paper__velma {
  width: 200px;
  height: 200px;
  max-width: 220px;
  object-fit: cover;
  border: 3px solid var(--border, #4a2c14);
  border-radius: 8px;
  box-shadow: var(--bevel-out);
}

.guild-chat__speaker--compact {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
}

.guild-chat__speaker--compact .guild-chat__speaker-art {
  flex: 0 0 36px;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  overflow: hidden;
  border: 2px solid var(--border, #4a2c14);
  background: var(--panel-soft, #f4ecde);
}

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

.guild-chat__speaker--compact .guild-chat__speaker-pick {
  flex: 1 1 auto;
  min-width: 0;
}

.guild-chat__speaker--compact .guild-chat__select {
  width: 100%;
}

@media (max-width: 900px) {
  .news-layout--velma {
    grid-template-columns: 1fr;
  }

  .map-hud__board--v3 .hud-mid,
  .map-hud__board--v3 .hud-mid--winged {
    grid-template-columns: 1fr;
  }

  .map-hud__board--v3 .hud-vault--row,
  .map-hud__board--v3 .hud-vault--grid23,
  .map-hud__board--v3 .hud-vault--row6,
  .map-hud__board--v3 .hud-vault--wing {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    grid-template-rows: auto;
  }
}

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

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

html[data-layout='mobile'] .map-stage {
  min-height: 0;
  max-height: none;
}

html[data-layout='mobile'] .map-hud__board--v3 {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 8px;
  padding: 8px;
  max-width: 100%;
}

html[data-layout='mobile'] .map-hud__board--v3 .hud-mid,
html[data-layout='mobile'] .map-hud__board--v3 .hud-mid--winged {
  display: flex;
  flex-direction: column;
  grid-template-columns: none;
  gap: 8px;
}

html[data-layout='mobile'] .map-hud__board--v3 .hud-vault--wing {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

html[data-layout='mobile'] .hud-nav:not(#room-nav) {
  grid-template-columns: 1fr 1fr;
}

html[data-layout='mobile'] .guild-chat.guild-chat--collapsed {
  max-height: 2.75rem;
  overflow: hidden;
}

html[data-layout='mobile'] .guild-chat:not(.guild-chat--collapsed) {
  max-height: 36vh;
  max-height: 36dvh;
}

html[data-layout='mobile'] .map-chrome-left {
  position: relative;
  left: auto;
  top: auto;
  width: auto;
  margin: 8px;
  flex-direction: row;
  flex-wrap: wrap;
  order: -1;
}

html[data-layout='mobile'] .map-stage {
  display: flex;
  flex-direction: column;
  overflow: visible;
}

html[data-layout='mobile'] .map-canvas {
  order: 0;
}

html[data-layout='mobile'] .map-modes--rail {
  position: relative;
  left: auto;
  top: auto;
  flex-direction: row;
  flex-wrap: wrap;
  width: auto;
}

html[data-layout='mobile'] .map-modes--rail .mode-btn__label {
  display: none;
}

html[data-layout='mobile'] .map-modes--rail .mode-btn {
  width: auto;
  min-width: 44px;
  min-height: 44px;
  justify-content: center;
  padding: 8px 10px;
}

html[data-layout='mobile'] .region-panel,
html[data-layout='mobile'] .region-panel--overlay,
html[data-layout='mobile'] .map-legend,
html[data-layout='mobile'] .map-legend--overlay {
  position: relative !important;
  inset: auto !important;
  top: auto !important;
  right: auto !important;
  bottom: auto !important;
  left: auto !important;
  width: auto !important;
  max-width: none !important;
  max-height: none !important;
  margin: 8px;
  flex: none;
}

html[data-layout='mobile'] .auth-modal-host .auth-modal,
html[data-layout='mobile'] .auth-modal-host [role='dialog'],
html[data-layout='mobile'] .auth-modal-host form.auth-form {
  width: min(100vw - 16px, 420px);
  max-width: calc(100vw - 16px);
  max-height: min(90vh, 90dvh);
  overflow: auto;
  box-sizing: border-box;
}

html[data-layout='mobile'] .app-header__brand h1 {
  font-size: clamp(0.95rem, 4.2vw, 1.2rem);
}

html[data-layout='mobile'] .app-header {
  position: static;
  top: auto;
  z-index: auto;
  padding-left: max(10px, env(safe-area-inset-left));
  padding-right: max(10px, env(safe-area-inset-right));
}

html[data-layout='mobile'] .map-hud,
html[data-layout='mobile'] #map-hud {
  position: static;
}

html[data-layout='mobile'] .app-body {
  padding-bottom: env(safe-area-inset-bottom);
}

/* —— Desktop density pass —— */
html:not([data-layout='mobile']) {
  height: 100%;
}

html:not([data-layout='mobile']) .map-room,
html:not([data-layout='mobile']) .map-room--bleed {
  flex: 1 1 auto;
  min-height: 0;
  max-height: none;
  height: 100%;
  display: flex;
  flex-direction: column;
}

html:not([data-layout='mobile']) .map-stage {
  flex: 1 1 auto;
  min-height: 0;
  max-height: none;
  height: 100%;
  position: relative;
}

html:not([data-layout='mobile']) .map-root {
  background-color: #3a2a1a;
  background-image:
    radial-gradient(ellipse at center, transparent 55%, rgba(20, 12, 6, 0.55) 100%),
    var(--theme-parchment);
  background-size: auto, cover;
}

html:not([data-layout='mobile']) .map-canvas {
  background-color: #3a2a1a;
}

html:not([data-layout='mobile']) .app-header {
  padding: 6px 14px 4px;
}

html:not([data-layout='mobile']) .app-header__brand--sign h1 {
  font-size: clamp(1.35rem, 2vw, 1.85rem) !important;
  font-family: var(--font-lore, Georgia, 'Times New Roman', serif) !important;
  font-weight: 700 !important;
  color: #f7edd8 !important;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.75);
}

html:not([data-layout='mobile']) .app-header__brand h1 {
  font-size: clamp(1.15rem, 1.8vw, 1.45rem);
}

html:not([data-layout='mobile']) .hud-nav__btn {
  min-height: 30px;
  padding: 4px 6px;
  font-size: 0.88rem;
}

html:not([data-layout='mobile']) .map-hud__board--v3 {
  gap: 6px;
  padding: 6px 8px;
}

html:not([data-layout='mobile']) .map-hud__board--v3 .hud-mid {
  grid-template-columns: minmax(110px, 148px) minmax(0, 1.05fr) minmax(240px, 1.55fr) minmax(0, 1.05fr) minmax(110px, 148px);
  gap: 6px 10px;
  align-items: stretch;
}

html:not([data-layout='mobile']) .map-hud__board--v3 .hud-threats--inline {
  grid-template-columns: 1fr 1fr;
  gap: 4px;
}

html:not([data-layout='mobile']) .map-hud__board--v3 .hud-vault__item,
html:not([data-layout='mobile']) .map-hud__board--v3 .hud-threat {
  min-height: 0;
  padding: 4px 6px;
  gap: 2px;
}

html:not([data-layout='mobile']) .map-hud__board--v3 .hud-vault__k,
html:not([data-layout='mobile']) .map-hud__board--v3 .hud-threat__label {
  font-family: var(--font-pixel, monospace);
  font-size: var(--type-chrome-sm, 0.95rem);
  font-weight: 400;
}

html:not([data-layout='mobile']) .map-hud__board--v3 .hud-vault__v,
html:not([data-layout='mobile']) .map-hud__board--v3 .hud-threat__pct {
  font-family: var(--font-clerk, monospace);
  font-size: 0.82rem;
  font-weight: 700;
  white-space: nowrap;
}

html:not([data-layout='mobile']) .hud-threat__band {
  display: none;
}

html:not([data-layout='mobile']) .hud-threat__track {
  height: 8px;
}

html:not([data-layout='mobile']) .region-panel--overlay.region-panel--empty {
  top: 10px;
  bottom: auto;
  right: 10px;
  width: auto;
  max-width: min(280px, 40%);
  height: auto;
  padding: 6px 10px;
  overflow: visible;
}

html:not([data-layout='mobile']) .region-panel--overlay.region-panel--filled {
  top: 10px;
  bottom: 10px;
  max-height: none;
  overflow: hidden;
}

html:not([data-layout='mobile']) .region-panel__empty--chip {
  margin: 0;
  font-family: var(--font-pixel, monospace);
  font-size: var(--type-chrome-sm, 0.95rem);
  opacity: 0.9;
  white-space: nowrap;
}

html[data-room='map'] .app-footer,
html[data-room='map'] .app-header__tagline {
  display: none !important;
}

html:not([data-layout='mobile']) .news-layout--velma {
  grid-template-columns: minmax(260px, 320px) minmax(0, 1fr);
}

html:not([data-layout='mobile']) .news-room,
html:not([data-layout='mobile']) .news-room--paper {
  max-width: none;
  width: 100%;
  box-sizing: border-box;
}

html:not([data-layout='mobile']) .gossip-sheet.news-card,
html:not([data-layout='mobile']) .news-card {
  width: 100%;
  max-width: none;
}

html:not([data-layout='mobile']) .npc-room__grid--selected {
  grid-template-columns: 1fr;
}

html:not([data-layout='mobile']) .npc-room__grid--selected .npc-card--open {
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  gap: 14px 18px;
  align-items: start;
  width: 100%;
}

html:not([data-layout='mobile']) .npc-room__grid--selected .npc-card__art {
  flex: 0 0 min(240px, 28%);
  width: min(240px, 28%);
  max-width: none;
  margin: 0;
}

html:not([data-layout='mobile']) .npc-room__grid--selected .npc-card__body {
  flex: 1 1 280px;
  min-width: 0;
}

html:not([data-layout='mobile']) .wh-room--split {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(260px, 0.75fr);
  gap: 14px 18px;
  align-items: start;
  padding: 10px 14px 20px;
}

/* The left column stacks its sections; without this the plan and the branch
   list collided. */
.wh-split__plan {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-width: 0;
}

html:not([data-layout='mobile']) .wh-split__side {
  display: flex;
  flex-direction: column;
  gap: 12px;
  position: sticky;
  top: 8px;
}

/* Collapsible sub-panels inside a warehouse section: keeps reference material
   (garrison roster, module palette) out of the way until it is asked for. */
.wh-fold {
  margin: 8px 0 0;
  border: 1px solid rgba(74, 44, 20, 0.28);
  border-radius: 6px;
  background: rgba(255, 252, 245, 0.72);
}

.wh-fold > summary {
  padding: 7px 10px;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--ink, #2b1a0e);
  cursor: pointer;
}

.wh-fold[open] > summary {
  border-bottom: 1px solid rgba(74, 44, 20, 0.2);
}

.wh-fold > *:not(summary) {
  margin: 8px 10px;
}

.wh-fold--master {
  margin-top: 12px;
  border-color: var(--accent, #a16a38);
}

.wh-garrison {
  margin: 0;
  font-size: 0.88rem;
  color: var(--ink, #2b1a0e);
}

.wh-res-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
  gap: 8px 12px;
}

.wh-res-field {
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-size: 0.78rem;
  color: var(--ink, #2b1a0e);
}

.wh-res-field input {
  padding: 5px 8px;
  border: 1px solid var(--border, #5a4a36);
  border-radius: 4px;
  background: #fff8ec;
  color: var(--ink, #2b1a0e);
  font: inherit;
}

html:not([data-layout='mobile']) .master-toc--sticky,
html:not([data-layout='mobile']) .master-toc--chips,
html:not([data-layout='mobile']) .master-toc--rail {
  position: sticky;
  top: 0;
  z-index: 6;
}

html:not([data-layout='mobile']) .master-room {
  display: flex;
  flex-direction: column;
  gap: 10px;
  align-items: stretch;
  height: 100%;
  min-height: 0;
}

html:not([data-layout='mobile']) .master-room__bar,
html:not([data-layout='mobile']) .master-toc,
html:not([data-layout='mobile']) .master-room__stage {
  grid-column: unset;
  width: 100%;
}

html:not([data-layout='mobile']) .ach-card__desc {
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  font-size: var(--type-lore-sm, 0.85rem);
  line-height: 1.35;
}

html:not([data-layout='mobile']) .ach-recent {
  list-style: none;
  margin: 0 0 12px;
  padding: 8px 10px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
  border: 2px solid var(--border, #4a2c14);
  border-radius: 8px;
  background: rgba(255, 248, 232, 0.65);
}

html:not([data-layout='mobile']) .ach-recent__item {
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-size: var(--type-lore-sm, 0.85rem);
}

html:not([data-layout='mobile']) .gloss-card:has(.gloss-card__details[open]) {
  grid-column: auto;
}

html:not([data-layout='mobile']) .guild-chat__empty {
  margin: 24px 12px;
  padding: 16px 12px;
  text-align: center;
  font-family: var(--font-lore, Georgia, serif);
  font-size: var(--type-lore, 0.88rem);
  font-style: italic;
  color: var(--ink-soft, #4a3220);
  opacity: 0.9;
  border: 1px dashed rgba(74, 44, 20, 0.35);
  border-radius: 8px;
  background: rgba(255, 248, 232, 0.45);
}

@media (max-width: 900px) {
  html:not([data-layout='mobile']) .wh-room--split {
    display: block;
  }

  html:not([data-layout='mobile']) .master-room {
    display: block;
  }

  html:not([data-layout='mobile']) .npc-room__grid--selected .npc-card--open {
    display: block;
  }
}

/* —— File polish: HUD / chrome / news / glossary —— */
#invest-btn[hidden] {
  display: none !important;
}

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

.room-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  width: 100%;
  margin-top: 6px;
  align-content: start;
}

.room-nav .hud-nav__btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  flex: 1 1 auto;
  min-width: 88px;
  width: auto;
  min-height: 30px;
  padding: 4px 8px;
  border: 2px solid var(--border, #4a2c14);
  border-radius: 6px;
  background: linear-gradient(180deg, #faebc8, #e8bc7a);
  box-shadow: var(--bevel-out);
  color: var(--ink, #2b1a0e);
  font-family: var(--font-pixel, monospace);
  font-size: 0.9rem;
  line-height: 1.1;
  white-space: nowrap;
  text-align: center;
  box-sizing: border-box;
  cursor: pointer;
}

.room-nav .hud-nav__btn.nav-btn--active {
  filter: brightness(1.12) saturate(1.08);
  box-shadow: var(--bevel-in);
  outline: 2px solid rgba(90, 50, 18, 0.65);
  outline-offset: -2px;
  background: linear-gradient(180deg, #f8e4b8, #d4a05a);
  color: #1a1008;
  font-weight: 700;
}

.room-nav .hud-nav__btn:hover {
  filter: brightness(1.04);
}

.map-hud__board--mid-only {
  grid-template-rows: auto;
}

html:not([data-layout='mobile']) .app-header {
  flex: 0 0 auto;
}

html:not([data-layout='mobile']) .map-hud__board--v3 .hud-vault__item,
html:not([data-layout='mobile']) .map-hud__board--v3 .hud-threat,
html:not([data-layout='mobile']) .map-hud__board--v3 .hud-mid__aside .next-step,
html:not([data-layout='mobile']) .map-hud__board--v3 .hud-mid__aside .schedule-compact {
  min-height: 44px;
  padding: 5px 7px;
}

html:not([data-layout='mobile']) .map-hud__board--v3 .hud-vault__v {
  font-size: 1.15rem;
}

html:not([data-layout='mobile']) .room-nav .hud-nav__btn {
  min-height: 28px;
  padding: 3px 6px;
  font-size: 0.88rem;
  min-width: 80px;
}

.map-legend--overlay {
  width: min(360px, 52vw) !important;
  max-height: min(38vh, calc(100% - 220px));
  font-size: 0.95rem;
  padding: 12px 14px;
  overflow: auto;
  z-index: 11;
}

.map-legend--overlay .map-legend__title {
  font-size: 1.05rem;
  margin-bottom: 8px;
}

.map-legend--overlay .map-legend__row {
  gap: 8px;
  margin: 4px 0;
  font-size: 0.92rem;
}

.map-legend--overlay .map-legend__swatch {
  width: 18px;
  height: 18px;
  flex: 0 0 18px;
}

.map-hud__board--v3 .hud-vault__item,
.map-hud__board--v3 .hud-threat,
.map-hud__board--v3 .hud-mid__aside .next-step,
.map-hud__board--v3 .hud-mid__aside .schedule-compact {
  min-width: 0;
  overflow: hidden;
  word-break: break-word;
  box-sizing: border-box;
}

.map-hud__board--v3 .hud-vault__item {
  align-items: center;
  text-align: center;
  justify-content: center;
  min-height: 52px;
  padding: 8px 10px;
}

.map-hud__board--v3 .hud-vault__k {
  display: block;
  width: 100%;
  text-align: center;
  font-size: 0.95rem;
  line-height: 1.2;
  white-space: normal;
}

.map-hud__board--v3 .hud-vault__v {
  display: block;
  width: 100%;
  text-align: center;
  font-family: var(--font-clerk, monospace);
  font-size: 1.25rem;
  font-weight: 700;
  line-height: 1.15;
}

.map-hud__board--v3 .hud-threat {
  min-height: 52px;
  padding: 8px 10px;
  justify-content: center;
}

.map-hud__board--v3 .hud-threat__head {
  font-size: 1.05rem;
  gap: 6px;
}

.map-hud__board--v3 .hud-threat__label {
  font-family: var(--font-pixel, monospace);
  font-size: 1.05rem;
  font-weight: 400;
}

.map-hud__board--v3 .hud-threat__pct {
  font-family: var(--font-clerk, monospace);
  font-size: 1.05rem;
  font-weight: 700;
}

.map-hud__board--v3 .hud-threat__track {
  height: 11px;
}

.map-hud__board--v3 .hud-mid__aside {
  gap: 6px;
  justify-content: flex-start;
  max-height: none;
  overflow: hidden;
}

.map-hud__board--v3 .hud-mid__aside .next-step,
.map-hud__board--v3 .hud-mid__aside .schedule-compact {
  flex: 0 0 auto;
  min-height: 44px;
  max-height: 56px;
  overflow: hidden;
  padding: 6px 8px;
  border: 2px solid var(--border, #4a2c14);
  border-radius: 6px;
  background: linear-gradient(180deg, rgba(250, 235, 200, 0.95), rgba(232, 188, 122, 0.88));
  box-shadow: var(--bevel-out);
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 2px;
  box-sizing: border-box;
}

.map-hud__board--v3 .hud-vault,
.map-hud__board--v3 .hud-threats {
  align-self: stretch;
}

.map-hud__board--v3 .hud-mid--winged .hud-vault--wing,
.map-hud__board--v3 .hud-mid--winged .hud-vault {
  align-self: stretch;
  height: 100%;
  min-height: 0;
  max-height: none;
}

.map-hud__board--v3 .hud-vault__item {
  min-height: 44px !important;
  max-height: 56px;
  overflow: hidden;
}

.map-hud__board--v3 .hud-mid--winged .hud-vault--wing .hud-vault__item {
  min-height: 0 !important;
  max-height: none !important;
  height: 100%;
  overflow: hidden;
}

html:not([data-layout='mobile']) .map-hud__board--v3 .hud-vault__item,
html:not([data-layout='mobile']) .map-hud__board--v3 .hud-threat {
  min-height: 52px;
  padding: 8px 10px;
  gap: 4px;
}

html:not([data-layout='mobile']) .map-hud__board--v3 .hud-mid--winged .hud-vault--wing .hud-vault__item {
  min-height: 0 !important;
  max-height: none !important;
  height: 100%;
  padding: 5px 6px;
}

html:not([data-layout='mobile']) .map-hud__board--v3 .hud-vault__k {
  font-size: 0.95rem;
  text-align: center;
}

html:not([data-layout='mobile']) .map-hud__board--v3 .hud-vault__v {
  font-size: 1.22rem;
  text-align: center;
}

html:not([data-layout='mobile']) .map-hud__board--v3 .hud-threat__label,
html:not([data-layout='mobile']) .map-hud__board--v3 .hud-threat__pct {
  font-size: 1.02rem;
}

html:not([data-layout='mobile']) .room-nav .hud-nav__btn {
  min-height: 34px;
  padding: 5px 6px;
  font-size: 0.92rem;
}

.news-layout--velma {
  grid-template-columns: minmax(240px, 300px) minmax(0, 1fr) minmax(0, 1fr);
  gap: 14px;
  align-items: stretch;
}

html:not([data-layout='mobile']) .news-layout--velma {
  grid-template-columns: minmax(260px, 300px) minmax(0, 1fr) minmax(0, 1fr);
}

.news-col--paper-scroll {
  min-width: 0;
  padding: 12px 10px;
  border: 3px solid var(--border, #4a2c14);
  border-radius: 4px;
  background:
    linear-gradient(90deg, rgba(247, 239, 216, 0.96), rgba(239, 224, 192, 0.94)),
    var(--theme-parchment, #f5d1a0);
  box-shadow: var(--bevel-out);
  transform: rotate(var(--col-tilt, 0deg));
}

.news-col--paper-scroll:nth-of-type(2) {
  --col-tilt: -0.6deg;
}

.news-col--paper-scroll:nth-of-type(3) {
  --col-tilt: 0.7deg;
}

.news-col--paper-scroll .gossip-feed__title {
  margin: 0 0 10px;
  text-align: center;
  font-family: var(--font-pixel, monospace);
  font-size: 1.05rem;
}

.gossip-feed__list--cards .gossip-sheet.news-card {
  width: 100%;
  max-width: none;
  background:
    linear-gradient(180deg, rgba(244, 236, 222, 0.96), rgba(228, 212, 184, 0.96)),
    var(--theme-parchment) center / cover;
  transform: rotate(var(--tilt, 0deg));
}

.gossip-feed__list--cards .gossip-sheet.news-card:nth-child(odd) {
  --tilt: -2deg;
}

.gossip-feed__list--cards .gossip-sheet.news-card:nth-child(even) {
  --tilt: 1.8deg;
}

.news-col--velma {
  height: auto;
  align-self: start;
}

@media (max-width: 900px) {
  .news-layout--velma,
  html:not([data-layout='mobile']) .news-layout--velma {
    grid-template-columns: 1fr;
  }

  .news-col--paper-scroll {
    transform: none;
  }
}

@media (max-width: 1100px) {
  html:not([data-layout='mobile']) .map-hud__board--v3 .hud-vault__v {
    font-size: 1.1rem;
  }

  html:not([data-layout='mobile']) .map-hud__board--v3 .hud-vault__item,
  html:not([data-layout='mobile']) .map-hud__board--v3 .hud-threat {
    padding: 6px 7px;
  }
}

.gloss-card {
  cursor: pointer;
}

.gloss-modal .reports-modal__head,
.gloss-modal-host .reports-modal__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
}
