/**
 * Sprint 7+ in-run chrome (atlas / adventure HUD).
 * Arcade landing stays on arcade.css — these tokens only under #screen-game.
 */

#screen-game {
  --tome-parchment: #e8dcc4;
  --tome-ink: #2a2118;
  --tome-gold: #c9a227;
  --tome-iron: #3d3a36;
  --tome-banner: #7a2e24;
  --hud-glass: rgba(15, 18, 24, 0.88);
  --hud-line: rgba(201, 162, 39, 0.35);
}

/* —— Utility cluster (left of adventure) —— */
.utility-cluster {
  position: absolute;
  left: 0.65rem;
  bottom: 5.5rem;
  z-index: 4;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  pointer-events: auto;
}

.utility-cluster button {
  min-width: 2.6rem;
  padding: 0.4rem 0.5rem;
  background: var(--hud-glass);
  border: 1px solid var(--hud-line);
  color: var(--tome-gold);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  border-radius: 6px;
  text-shadow: 0 1px 2px #000;
}

.utility-cluster button:hover {
  border-color: var(--tome-gold);
  background: rgba(30, 36, 48, 0.95);
}

.utility-cluster button.active {
  background: rgba(60, 70, 40, 0.95);
  border-color: var(--tome-gold);
}

/* —— Quest dock (K0 intro) —— */
.quest-dock {
  position: absolute;
  right: 0.75rem;
  top: 4.5rem;
  z-index: 5;
  width: min(20rem, 42vw);
  max-width: 92%;
  padding: 0.7rem 0.85rem 0.8rem;
  /* Opaque panel — backdrop-filter blurs UI text over the pixel canvas */
  background: rgba(14, 16, 20, 0.94);
  border: 1px solid var(--hud-line);
  border-radius: 8px;
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.45);
  color: #e8e0d0;
  pointer-events: auto;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  -webkit-font-smoothing: antialiased;
  text-rendering: geometricPrecision;
}

.quest-dock.hidden {
  display: none;
}

.quest-dock-head {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  margin-bottom: 0.4rem;
}

.quest-kicker {
  font-size: 0.65rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--tome-gold);
}

.quest-dock-head strong {
  font-size: 1rem;
  color: #f0e6c8;
}

.quest-step-title {
  margin: 0 0 0.25rem;
  font-size: 0.88rem;
  font-weight: 700;
  color: #c9a227;
}

.quest-prompt {
  margin: 0 0 0.55rem;
  font-size: 0.8rem;
  line-height: 1.4;
  color: #b8c0c8;
  max-height: 7.5rem;
  overflow-y: auto;
}

.quest-action {
  width: 100%;
  font-size: 0.85rem !important;
  padding: 0.45rem 0.6rem !important;
}

/* —— Talk dock (G2) —— */
.talk-dock {
  position: absolute;
  left: 0.75rem;
  bottom: 5.5rem;
  z-index: 24;
  width: min(22rem, 90vw);
  padding: 0.65rem 0.75rem 0.75rem;
  background: var(--hud-glass);
  border: 1px solid var(--hud-line);
  border-radius: 8px;
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.45);
  color: #e8e0d0;
  pointer-events: auto;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}
.talk-dock.hidden {
  display: none;
}
.talk-dock-head {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.talk-kicker {
  font-size: 0.65rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--tome-gold);
  flex: 1;
}
.talk-toggle {
  font-size: 0.72rem;
  color: #b8c0c8;
  display: flex;
  align-items: center;
  gap: 0.25rem;
  cursor: pointer;
}
.talk-close {
  background: transparent;
  border: none;
  color: #c9a227;
  font-size: 1.2rem;
  line-height: 1;
  cursor: pointer;
  padding: 0 0.2rem;
}
.talk-field {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.75rem;
  color: #b8c0c8;
}
.talk-field span {
  min-width: 2.4rem;
}
.talk-field select {
  flex: 1;
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid var(--hud-line);
  color: #e8e0d0;
  border-radius: 4px;
  padding: 0.25rem 0.35rem;
  font-size: 0.8rem;
}
.talk-text {
  width: 100%;
  resize: vertical;
  min-height: 2.4rem;
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid var(--hud-line);
  color: #e8e0d0;
  border-radius: 4px;
  padding: 0.35rem 0.45rem;
  font: inherit;
  font-size: 0.82rem;
}
.talk-actions {
  display: flex;
  gap: 0.4rem;
}
.talk-actions .btn-arcade {
  flex: 1;
  font-size: 0.8rem !important;
  padding: 0.4rem 0.5rem !important;
}
.talk-hint {
  margin: 0;
  font-size: 0.7rem;
  color: #8a9098;
  line-height: 1.35;
}

/* —— Party strip —— */
.party-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  max-width: 100%;
}

.party-chip {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.25rem 0.5rem;
  background: var(--hud-glass);
  border: 1px solid var(--line);
  border-radius: 6px;
  font-size: 0.78rem;
  color: #dce4f0;
  text-shadow: 0 1px 2px #000;
}

.party-chip .chip-name {
  font-weight: 600;
  color: var(--accent);
}

.party-chip .chip-hp {
  font-variant-numeric: tabular-nums;
  color: #9aa6b8;
}

.party-chip.down {
  opacity: 0.55;
  border-color: #5a3030;
}

.party-chip.pc {
  border-color: rgba(110, 198, 255, 0.5);
}

/* —— Toast host (above shop / HUD overlays — was z-index 6 under shop z-40) —— */
.toast-host {
  position: fixed;
  left: 50%;
  top: 4.5rem;
  transform: translateX(-50%);
  z-index: 120;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  pointer-events: none;
  max-width: min(40rem, 94vw);
}
/* Combat toasts sit by the journal (lower-right), not center screen */
.toast-host:has(.toast-combat) {
  left: auto;
  right: 1.1rem;
  top: auto;
  bottom: 7.5rem;
  transform: none;
  max-width: min(22rem, 28vw);
  align-items: flex-end;
}
.toast.toast-combat {
  text-align: left;
  font-size: 0.88rem;
  max-width: min(22rem, 28vw);
}

.toast {
  padding: 0.45rem 0.75rem;
  background: rgba(20, 24, 32, 0.94);
  border: 1px solid var(--tome-gold);
  border-radius: 6px;
  color: #f0e8d0;
  font-size: 0.95rem;
  line-height: 1.35;
  text-align: center;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.45);
  animation: toast-in 0.2s ease-out;
}

/* NPC / quest dialogue: larger, multi-line, readable */
.toast.toast-dialogue {
  font-size: 1.12rem;
  line-height: 1.45;
  padding: 0.75rem 1.1rem;
  text-align: left;
  max-width: min(42rem, 94vw);
  white-space: pre-wrap;
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateY(-6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* —— World Atlas overlay —— */
/* Static baked Mornvex continent plate — first unhide is already land, not gold paper. */
.atlas-overlay {
  position: absolute;
  inset: 0;
  z-index: 20;
  display: flex;
  flex-direction: column;
  background:
    url("/static/maps/export/parchment/continents/mornvex.png") center / contain no-repeat,
    #c4a060;
}

.atlas-overlay.hidden,
.atlas-overlay.hidden * {
  /* Keep layout so a prefetched plate can decode; never display:none (void). */
  pointer-events: none !important;
}
.atlas-overlay.hidden {
  visibility: hidden !important;
}
#screen-game.combat-open #atlas-overlay.hidden {
  visibility: hidden !important;
}

.atlas-vignette {
  position: absolute;
  inset: 0;
  z-index: 4;
  pointer-events: none;
  background:
    radial-gradient(ellipse at 50% 42%, transparent 42%, rgba(28, 18, 8, 0.28) 78%, rgba(12, 8, 4, 0.62) 100%);
}

.atlas-banner {
  position: relative;
  z-index: 6;
  flex: 0 0 auto;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: end;
  min-height: 3.4rem;
  padding: 0 0.7rem 0.28rem;
  background:
    linear-gradient(180deg, #3a2014 0%, #5a2c18 55%, #3d2214 100%);
  border-bottom: 2px solid #c9a227;
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.45);
}

.atlas-banner-left,
.atlas-banner-right {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  min-width: 0;
  padding-bottom: 0.35rem;
}

.atlas-banner-right {
  justify-content: flex-end;
}

.atlas-banner-name {
  font-family: Cinzel, Georgia, serif;
  font-weight: 700;
  color: #f3e2b0;
  font-size: 1.05rem;
  letter-spacing: 0.04em;
  text-shadow: 0 1px 2px #000;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.atlas-sr-status {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
}

.atlas-icon-btn {
  width: 1.7rem;
  height: 1.7rem;
  padding: 0;
  border-radius: 50%;
  border: 1px solid #c9a227;
  background: #2a1a10;
  color: #f0e0b0;
  font-size: 0.85rem;
  cursor: pointer;
}

.atlas-sun-wrap {
  width: 6.4rem;
  height: 3.35rem;
  display: flex;
  justify-content: center;
  overflow: hidden;
}

.atlas-sun-disk {
  width: 6.2rem;
  height: 6.2rem;
  border-radius: 50%;
  border: 3px solid #d4b056;
  box-shadow:
    0 0 0 2px #3a2410,
    0 6px 16px rgba(0, 0, 0, 0.45);
  background: radial-gradient(circle at 50% 40%, #f6e08a 0%, #d8a030 55%, #8a4a10 100%);
  position: relative;
}

.atlas-sun-disk[data-phase="dawn"] {
  background: radial-gradient(circle at 50% 40%, #ffe0a0 0%, #e08040 58%, #5a2030 100%);
}
.atlas-sun-disk[data-phase="dusk"] {
  background: radial-gradient(circle at 50% 42%, #ffb060 0%, #c04028 55%, #2a1028 100%);
}
.atlas-sun-disk[data-phase="night"] {
  background: radial-gradient(circle at 46% 38%, #d8e4f0 0%, #6a7a98 40%, #141828 100%);
}

.atlas-sun-face {
  position: absolute;
  inset: 18% 18% 38% 18%;
  border-radius: 50%;
  background:
    radial-gradient(circle at 35% 30%, #fff6c8, #f0c040 55%, #c07010);
  box-shadow: 0 0 12px rgba(255, 210, 80, 0.55);
}

.atlas-sun-disk[data-phase="night"] .atlas-sun-face {
  inset: 22% 28% 42% 22%;
  background: radial-gradient(circle at 30% 30%, #f4f0e0, #c8c8d8 70%);
  box-shadow: none;
}

.atlas-clock-block {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  line-height: 1.15;
  color: #f4e4b4;
  text-shadow: 0 1px 2px #000;
}

.atlas-clock-time {
  font-family: Cinzel, Georgia, serif;
  font-size: 1.05rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.atlas-clock {
  font-size: 0.72rem;
  letter-spacing: 0.03em;
  color: #e8d090;
}

.atlas-names-toggle {
  display: flex;
  align-items: center;
  gap: 0.28rem;
  font-size: 0.7rem;
  color: #e8d8b0;
  white-space: nowrap;
}

.atlas-mode-group {
  display: none;
}

.atlas-mode-group button {
  font-size: 0.72rem;
  padding: 0.2rem 0.4rem;
  background: #2a1a10;
  color: #e8d8b0;
  border: 1px solid #8a7348;
}

.atlas-mode-group button.active {
  background: #5a3a10;
  border-color: #c9a227;
  color: #fff4c8;
}

.atlas-stage {
  flex: 1 1 auto;
  min-height: 0;
  position: relative;
  overflow: hidden;
  background:
    url("/static/maps/export/parchment/continents/mornvex.png") center / contain no-repeat,
    #c4a060;
}

.atlas-ready-plate {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center;
  pointer-events: none;
  z-index: 0;
  background:
    url("/static/maps/export/parchment/continents/mornvex.png") center / contain no-repeat,
    #c4a060;
}

.atlas-stage svg {
  position: relative;
  z-index: 1;
  width: 100%;
  height: 100%;
  display: block;
  background: transparent;
}

.atlas-overlay .cmap-spinner,
.atlas-overlay .cmap-spinner.atlas-spinner-corner {
  inset: auto;
  top: 0.55rem;
  right: 0.55rem;
  left: auto;
  bottom: auto;
  z-index: 7;
  width: auto;
  height: auto;
  padding: 0.32rem;
  gap: 0;
  background: rgba(196, 160, 96, 0.28);
  color: #3a2410;
  border-radius: 50%;
  box-shadow: 0 1px 4px rgba(40, 24, 8, 0.25);
}

.atlas-overlay .cmap-spinner-ring {
  width: 1.15rem;
  height: 1.15rem;
  border-width: 2px;
  border-color: rgba(90, 58, 16, 0.22);
  border-top-color: #5a3a10;
}

.atlas-overlay .cmap-spinner-label {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
}

.atlas-location-card {
  position: absolute;
  left: 0.85rem;
  top: 0.7rem;
  width: min(18.5rem, 44vw);
  z-index: 5;
  padding: 0.85rem 1rem 0.9rem;
  background:
    linear-gradient(180deg, #f3e6c8 0%, #e4d2aa 70%, #d7c198 100%);
  color: #3a2a18;
  border: 1px solid #c4a46a;
  border-radius: 2px 10px 4px 2px;
  box-shadow:
    0 10px 28px rgba(20, 10, 0, 0.45),
    inset 0 0 0 1px rgba(255, 248, 220, 0.45);
}

.atlas-location-card.hidden {
  display: none;
}

.atlas-location-card h3 {
  margin: 0;
  font-family: Cinzel, Georgia, serif;
  font-size: 1.12rem;
  letter-spacing: 0.04em;
  color: #7a2e24;
}

.atlas-loc-type {
  margin: 0.12rem 0 0.45rem;
  font-size: 0.68rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: #7a5a30;
  border-bottom: 1px solid rgba(122, 74, 32, 0.28);
  padding-bottom: 0.35rem;
}

.atlas-loc-meta {
  margin: 0 0 0.3rem;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #5a4a38;
}

.atlas-loc-visit {
  margin: 0 0 0.4rem;
  font-size: 0.8rem;
  line-height: 1.35;
  color: #3a2a18;
}

.atlas-loc-blurb {
  margin: 0 0 0.35rem;
  font-size: 0.8rem;
  line-height: 1.35;
}

.atlas-loc-path {
  margin: 0 0 0.5rem;
  font-size: 0.76rem;
  font-weight: 600;
  color: #3a3020;
  padding: 0.3rem 0.4rem;
  background: rgba(255, 248, 230, 0.45);
  border-radius: 3px;
}

.atlas-card-actions {
  display: flex;
  gap: 0.45rem;
}

.atlas-card-actions button {
  flex: 1;
  background: linear-gradient(180deg, #6a4a20, #3a2810);
  color: #f4e8c8;
  border: 1px solid #c9a227;
  font-family: Cinzel, Georgia, serif;
  font-size: 0.78rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 0.38rem 0.5rem;
}

.atlas-card-actions button.primary {
  background: linear-gradient(180deg, #8a5a20, #5a3a10);
}

.atlas-card-actions button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.atlas-confirm-modal {
  position: absolute;
  inset: 0;
  z-index: 8;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  pointer-events: none;
}

.atlas-confirm-modal.hidden {
  display: none;
}

.atlas-confirm-box {
  pointer-events: auto;
  width: min(24rem, 88vw);
  padding: 1.05rem 1.2rem 1.1rem;
  background:
    linear-gradient(180deg, #f4e8cc 0%, #e2d0a8 100%);
  color: #3a2a18;
  border: 1px solid #c4a46a;
  border-radius: 4px;
  box-shadow:
    0 16px 48px rgba(0, 0, 0, 0.5),
    inset 0 0 0 1px rgba(255, 248, 220, 0.5);
}

.atlas-confirm-box h3 {
  margin: 0 0 0.45rem;
  font-family: Cinzel, Georgia, serif;
  color: #7a2e24;
  text-align: center;
  letter-spacing: 0.03em;
}

.atlas-confirm-box p {
  margin: 0 0 0.85rem;
  font-size: 0.9rem;
  line-height: 1.4;
  text-align: center;
}

.atlas-confirm-box .atlas-card-actions button {
  background: linear-gradient(180deg, #6a4a20, #3a2810);
  color: #f0e8d0;
}

/* Road-fight scrap — torn note on the still-visible atlas (not dest-card, not confirm). */
.atlas-encounter-modal {
  position: absolute;
  inset: 0;
  z-index: 8;
  background: transparent;
  pointer-events: auto;
}

.atlas-encounter-modal.hidden {
  display: none;
}

.atlas-encounter-scrap {
  position: absolute;
  left: 50%;
  top: 46%;
  width: min(15.75rem, 34vw);
  transform: translate(-50%, -42%) rotate(-0.55deg);
  filter:
    drop-shadow(0 2px 3px rgba(18, 8, 2, 0.16))
    drop-shadow(0 1px 1px rgba(40, 22, 8, 0.22));
  pointer-events: none;
}

.atlas-encounter-leaf {
  pointer-events: auto;
  position: relative;
  padding: 1.2rem 1.5rem 1.05rem;
  color: #2c2014;
  /* Quiet paper-scale umber tooth — r10 Perlin+ribs was a period. */
  background: url("/static/art/hub/ui/encounter-scrap-tooth.svg") center / 100% 100%;
  /* Corner-nick lip (mask file). clip-path url(#) from this sheet misses HTML SVG. */
  -webkit-mask-image: url("/static/art/hub/ui/encounter-scrap-mask.svg");
  -webkit-mask-size: 100% 100%;
  -webkit-mask-repeat: no-repeat;
  mask-image: url("/static/art/hub/ui/encounter-scrap-mask.svg");
  mask-size: 100% 100%;
  mask-repeat: no-repeat;
  mask-mode: alpha;
}

.atlas-encounter-scrap h3 {
  position: relative;
  margin: 0;
  font-family: Cinzel, Georgia, serif;
  font-size: 0.96rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  color: #2a1c10;
  text-align: center;
}

.atlas-encounter-filigree {
  position: relative;
  display: block;
  width: 10.6rem;
  height: 1.05rem;
  margin: 0.14rem auto 0.42rem;
  background: url("/static/art/hub/ui/ink-flourish.jpg") center / contain no-repeat;
  mix-blend-mode: multiply;
  opacity: 0.86;
}

.atlas-encounter-scrap p {
  position: relative;
  margin: 0 0 0.7rem;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 0.78rem;
  line-height: 1.35;
  color: #3a2a18;
  text-align: center;
}

.atlas-encounter-scrap button {
  position: relative;
  display: block;
  margin: 0.08rem auto 0.08rem;
  min-width: 5.4rem;
  padding: 0.16rem 0.88rem 0.14rem;
  background: #2a2218;
  color: #efe6d0;
  border: 0;
  font-family: Cinzel, Georgia, serif;
  font-size: 0.58rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  cursor: pointer;
}

.atlas-encounter-scrap button:hover,
.atlas-encounter-scrap button:focus-visible {
  color: #fff6d8;
  outline: none;
}

.atlas-party-strip {
  position: absolute;
  left: 50%;
  bottom: 0.55rem;
  transform: translateX(-50%);
  z-index: 6;
  display: flex;
  gap: 0.28rem;
  pointer-events: none;
}

.atlas-party-slot {
  width: 4.15rem;
  height: 4.35rem;
  border: 2px solid #1a140c;
  box-shadow:
    0 0 0 1px #c9a227,
    0 6px 16px rgba(0, 0, 0, 0.45);
  background: #16120e;
  overflow: hidden;
  position: relative;
}

.atlas-party-slot img,
.atlas-party-slot .atlas-party-fallback {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.atlas-party-slot .atlas-party-fallback {
  display: block;
  color: transparent;
  font-size: 0;
  line-height: 0;
  background:
    linear-gradient(180deg, rgba(201, 162, 39, 0.16) 0%, rgba(12, 8, 4, 0.52) 100%),
    url("art/hub/ui/wood.jpg") center / cover;
  box-shadow:
    inset 0 0 0 1px rgba(201, 162, 39, 0.32),
    inset 0 0 14px rgba(0, 0, 0, 0.5);
}

.atlas-party-slot.is-empty {
  /* Living portraits only — no black holes in the strip. */
  display: none;
}

.atlas-party-slot::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 4px;
  background: #2a4a20;
}

.atlas-party-slot.is-down::before {
  background: #6a2020;
}

#screen-game.atlas-open .viewport-wrap,
#screen-game:has(#atlas-overlay:not(.hidden)) .viewport-wrap {
  background:
    url("/static/maps/export/parchment/continents/mornvex.png") center / contain no-repeat,
    #c4a060 !important;
}

#screen-game.atlas-open .viewport-wrap > canvas,
#screen-game.atlas-open .hud-top,
#screen-game.atlas-open .hud-bottom,
#screen-game.atlas-open .utility-cluster,
#screen-game.atlas-open .map-panel,
#screen-game.atlas-open .u7-chrome,
#screen-game.atlas-open #quest-dock,
#screen-game:has(#atlas-overlay:not(.hidden)) .viewport-wrap > canvas,
#screen-game:has(#atlas-overlay:not(.hidden)) .u7-chrome {
  visibility: hidden;
  pointer-events: none;
}

#screen-game.atlas-open .layout {
  grid-template-columns: 1fr;
}

.atlas-country-chip {
  display: none;
}

.atlas-country-panel {
  display: none;
}

.atlas-country-panel.hidden {
  display: none;
}

.atlas-country-head {
  flex: 0 0 auto;
  padding: 0.28rem 0.45rem;
  border-bottom: 1px solid rgba(90, 58, 16, 0.25);
  display: flex;
  flex-direction: column;
  gap: 0.05rem;
}

.atlas-country-head strong {
  color: #5a3a10;
  font-family: Cinzel, Georgia, serif;
  font-size: 0.78rem;
}

.atlas-country-sub {
  font-size: 0.62rem;
  color: #6a5a40;
}

.atlas-country-panel svg {
  flex: 1 1 auto;
  min-height: 0;
  width: 100%;
}

/* Place Hub (N2) — painted place; chrome is a frame */
.place-hub {
  position: absolute;
  inset: 0;
  z-index: 18;
  display: block;
  overflow: hidden;
}
.place-hub.hidden {
  display: none !important;
}
.hub-still {
  position: absolute;
  inset: 0;
  background:
    #c4a060
    url("/static/art/hub/travel_road.png")
    center/cover no-repeat;
  filter: saturate(0.94) contrast(1.02) brightness(1);
  transition: opacity 0.32s ease;
}
.hub-veil {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(ellipse 78% 58% at 50% 34%, transparent 46%, rgba(8, 6, 4, 0.28) 100%),
    linear-gradient(180deg, rgba(8, 6, 4, 0.18) 0%, transparent 14%, transparent 54%, rgba(8, 6, 4, 0.5) 100%);
}
.hub-book {
  --hub-book-h: min(42%, 22rem);
  position: absolute;
  z-index: 2;
  left: 3.4%;
  right: 3.4%;
  bottom: 1.7%;
  height: var(--hub-book-h);
  color: #2a2118;
  pointer-events: auto;
}
#place-hub.is-places-open .hub-book {
  --hub-book-h: min(52%, 28rem);
}
.hub-book-wood {
  height: 100%;
  padding: 10px 12px 12px;
  background:
    linear-gradient(180deg, rgba(48, 32, 14, 0.28), rgba(10, 7, 4, 0.18)),
    url("/static/art/hub/ui/wood.jpg") center/cover;
  box-shadow:
    0 22px 48px rgba(0, 0, 0, 0.56),
    0 2px 0 #0a0604,
    inset 0 1px 0 rgba(212, 180, 90, 0.3);
}
.hub-book-gold {
  position: relative;
  height: 100%;
  padding: 4px;
  border: 1px solid #c4a04a;
  box-shadow:
    inset 0 0 0 1px #4a3414,
    inset 0 0 0 3px #1a1008,
    inset 0 0 0 4px #d4b24a;
}
.hub-corner {
  position: absolute;
  width: 1.55rem;
  height: 1.55rem;
  pointer-events: none;
  z-index: 3;
  background:
    linear-gradient(#c9a227, #c9a227) no-repeat,
    linear-gradient(#c9a227, #c9a227) no-repeat,
    linear-gradient(#8a6a28, #8a6a28) no-repeat,
    linear-gradient(#8a6a28, #8a6a28) no-repeat;
}
.hub-corner.c-tl {
  top: 2px;
  left: 2px;
  background-size: 1.15rem 1.5px, 1.5px 1.15rem, 0.85rem 1px, 1px 0.85rem;
  background-position: left 4px top 4px, left 4px top 4px, left 7px top 7px, left 7px top 7px;
}
.hub-corner.c-tr {
  top: 2px;
  right: 2px;
  background-size: 1.15rem 1.5px, 1.5px 1.15rem, 0.85rem 1px, 1px 0.85rem;
  background-position: right 4px top 4px, right 4px top 4px, right 7px top 7px, right 7px top 7px;
}
.hub-corner.c-bl {
  bottom: 2px;
  left: 2px;
  background-size: 1.15rem 1.5px, 1.5px 1.15rem, 0.85rem 1px, 1px 0.85rem;
  background-position: left 4px bottom 4px, left 4px bottom 4px, left 7px bottom 7px, left 7px bottom 7px;
}
.hub-corner.c-br {
  bottom: 2px;
  right: 2px;
  background-size: 1.15rem 1.5px, 1.5px 1.15rem, 0.85rem 1px, 1px 0.85rem;
  background-position: right 4px bottom 4px, right 4px bottom 4px, right 7px bottom 7px, right 7px bottom 7px;
}
.hub-book-paper {
  height: 100%;
  display: grid;
  grid-template-columns: 15rem 10px minmax(0, 1fr);
  background:
    linear-gradient(180deg, rgba(248, 236, 208, 0.5), rgba(226, 206, 162, 0.38)),
    url("/static/art/hub/ui/parchment.jpg") center/cover;
  overflow: hidden;
}
.hub-book-paper.is-alone {
  grid-template-columns: minmax(0, 1fr);
}
.hub-book-paper.is-alone .hub-spine,
.hub-book-paper.is-alone .hub-rule {
  display: none;
}
.hub-spine {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  justify-content: flex-start;
  padding: 0.28rem 0.38rem 0.22rem;
  min-width: 0;
  min-height: 0;
}
.hub-herald {
  appearance: none;
  position: relative;
  width: 100%;
  height: auto;
  flex: 1 1 auto;
  min-height: 0;
  padding: 0;
  border: none;
  overflow: hidden;
  isolation: isolate;
  background-color: #1a120c;
  background-repeat: no-repeat;
  background-position: 50% 16%;
  background-size: cover;
  cursor: pointer;
  box-shadow:
    inset 0 0 0 2px #d4b24a,
    inset 0 0 0 4px #7a1c18,
    inset 0 0 0 5px #243860,
    inset 0 0 0 6px #c4a04a;
}
.hub-herald[disabled] {
  cursor: default;
}
.hub-herald.is-empty,
.hub-herald[hidden] {
  display: none !important;
}
.hub-herald-face {
  position: absolute;
  z-index: 0;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 50% 16%;
  background: #2a1c10;
}
.hub-herald-face[hidden] {
  display: none;
}
.hub-herald-fallback {
  position: absolute;
  z-index: 0;
  inset: 0;
  width: 100%;
  height: 100%;
  display: none;
  align-items: center;
  justify-content: center;
  font: 700 1.15rem/1 Cinzel, serif;
  letter-spacing: 0.08em;
  color: #e8d48a;
  background:
    radial-gradient(circle at 38% 32%, #fff4c8, #c9a227 58%, #5a3810);
}
.hub-herald.is-initials .hub-herald-fallback {
  display: flex;
}
.hub-herald-frame {
  display: none;
}
.hub-herald.is-empty .hub-herald-frame,
.hub-herald[hidden] .hub-herald-frame {
  display: none;
}
.hub-speaker {
  flex: 0 0 auto;
  margin: 0.22rem 0 0;
  max-width: 100%;
  overflow: visible;
  font: 700 0.78rem/1.15 Cinzel, Georgia, serif;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: #6a4814;
  text-align: center;
}
.hub-speaker:empty {
  display: none;
}
.hub-rule {
  position: relative;
  width: 2px;
  margin: 0.7rem 0 0.75rem;
  background: linear-gradient(180deg, transparent, #c4a04a 10%, #8a6a28 50%, #c4a04a 90%, transparent);
}
.hub-rule::before,
.hub-rule::after {
  content: "";
  position: absolute;
  left: 50%;
  width: 7px;
  height: 7px;
  margin-left: -3.5px;
  transform: rotate(45deg);
  background: #c9a227;
  box-shadow: 0 0 0 1px #5a4014;
}
.hub-rule::before {
  top: 0.15rem;
}
.hub-rule::after {
  bottom: 0.15rem;
}
.hub-leaf {
  position: relative;
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  padding: 0.72rem 1.5rem 0.38rem 0.95rem;
}
.hub-book-paper.is-alone .hub-leaf {
  padding: 0.7rem 1.6rem 0.4rem 1.4rem;
}
.hub-leaf h2 {
  margin: 0;
  flex-shrink: 0;
  font-family: Cinzel, Georgia, serif;
  font-size: 0.98rem;
  font-weight: 700;
  color: #6a4814;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  line-height: 1.15;
}
.hub-book-paper:not(.is-places) .hub-leaf h2,
.hub-leaf h2:empty,
.hub-leaf h2[hidden] {
  display: none;
}
.hub-blurb {
  margin: 0 0 0.7rem;
  flex: 0 1 auto;
  max-width: none;
  font-family: Georgia, "Palatino Linotype", serif;
  font-size: 1.06rem;
  line-height: 1.52;
  color: #2c2014;
  white-space: pre-wrap;
}
#place-hub .hub-book-paper.is-spoken .hub-blurb {
  margin: 0 0 0.55rem;
}
#place-hub .hub-book-paper.is-spoken.is-quiet .hub-blurb {
  margin: 0;
  flex: 0 1 auto;
  font-size: 1rem;
  line-height: 1.42;
}
#place-hub .hub-book-paper.is-spoken.is-quiet .hub-locs {
  flex: 1 1 auto;
  min-height: 1.2rem;
  overflow: hidden;
}
#place-hub .hub-book-paper.is-spoken.is-quiet .hub-foot {
  padding-top: 0.35rem;
}
.hub-book-paper:not(.is-places):not(.is-spoken) .hub-leaf::after,
#place-hub .hub-book-paper.is-spoken.is-quiet .hub-leaf::after {
  content: "";
  position: absolute;
  right: 9%;
  top: auto;
  bottom: 4.6rem;
  width: 26%;
  height: 1px;
  background: linear-gradient(90deg, transparent, #6a4814 18%, #3a2810 50%, #6a4814 82%, transparent);
  opacity: 0.4;
  pointer-events: none;
}
#place-hub .hub-book-paper.is-spoken.is-quiet .hub-leaf::after {
  top: auto;
  bottom: 3.15rem;
  right: 8%;
  width: 22%;
  opacity: 0.36;
}
.hub-blurb:empty {
  display: none;
}
.hub-locs {
  display: flex;
  flex-direction: column;
  align-content: start;
  flex: 1;
  min-height: 0;
  overflow: auto;
}
#place-hub .hub-book-paper.is-places .hub-locs {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  pointer-events: auto;
}
.hub-book-paper:not(.is-places) .hub-locs {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding-bottom: 0.15rem;
}
.hub-ink {
  appearance: none;
  display: grid;
  grid-template-columns: 0.85rem 1.4rem minmax(0, 1fr);
  align-items: baseline;
  gap: 0.08rem;
  width: 100%;
  margin: 0;
  padding: 0.05rem 0.1rem;
  border: none;
  border-radius: 0;
  background: transparent;
  color: #2a2118;
  cursor: pointer;
  font-family: Georgia, "Palatino Linotype", serif;
  font-size: 0.86rem;
  line-height: 1.3;
  text-align: left;
}
#place-hub .hub-book-paper.is-spoken .hub-ink {
  grid-template-columns: 1.45rem minmax(0, 1fr);
  gap: 0.28rem;
  padding: 0.08rem 0.12rem;
  font-size: 0.98rem;
  line-height: 1.38;
  color: #2c2014;
}
#place-hub .hub-book-paper.is-spoken .hub-ink-caret {
  display: none;
}
.hub-ink-caret {
  color: transparent;
  font-size: 0.68rem;
  line-height: 1.3;
}
.hub-ink-num {
  color: #6a4e1c;
  font-size: 0.78rem;
}
#place-hub .hub-book-paper.is-spoken .hub-ink-num {
  font-weight: 700;
  font-size: 0.98rem;
  color: #6a4814;
}
.hub-ink.is-act .hub-ink-text {
  font-style: italic;
}
#place-hub .hub-book-paper.is-spoken .hub-ink.is-act .hub-ink-text {
  font-style: normal;
}
.hub-ink.is-here .hub-ink-text {
  color: #6a4814;
}
.hub-ink:hover .hub-ink-caret,
.hub-ink:focus-visible .hub-ink-caret {
  color: #8a6020;
}
.hub-ink:hover,
.hub-ink:focus-visible {
  color: #4a3010;
  outline: none;
}
#place-hub .hub-book-paper.is-spoken .hub-ink:hover,
#place-hub .hub-book-paper.is-spoken .hub-ink:focus-visible {
  color: #5a3810;
  background: rgba(196, 160, 74, 0.12);
}
.hub-foot {
  display: flex;
  flex-direction: column;
  align-items: center;
  flex-shrink: 0;
  margin-top: auto;
  padding-top: 0.55rem;
  gap: 0;
}
.hub-verbs {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}
#hub-btn-export {
  min-width: 6.2rem;
}
#place-hub .hub-party {
  display: none !important;
}
.hub-act {
  appearance: none;
  text-align: center;
  border: none;
  min-width: 10.4rem;
  padding: 0.42rem 1.15rem 0.38rem;
  background:
    linear-gradient(180deg, rgba(255, 236, 180, 0.08), rgba(40, 24, 8, 0.18)),
    url("/static/art/hub/ui/gold-plate.jpg") center/100% 100% no-repeat;
  color: #2a1808;
  cursor: pointer;
  font: 700 0.68rem/1 Cinzel, Georgia, serif;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  text-shadow: 0 1px 0 rgba(255, 230, 160, 0.35);
  white-space: nowrap;
}
.hub-act:hover,
.hub-act:focus-visible {
  filter: brightness(1.12);
  outline: none;
}
.hub-party {
  display: flex;
  justify-content: center;
  gap: 0.16rem;
  pointer-events: none;
}
.hub-party-face {
  width: 1.32rem;
  height: 1.32rem;
  border: 1px solid rgba(201, 162, 39, 0.75);
  box-shadow: 0 0 0 1px #3a2a10;
  background: #1a140e center/cover no-repeat;
  position: relative;
}
.hub-party-face.is-pc {
  border-color: #e0c060;
}
.hub-party-face i {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 2px;
  background: #2a1810;
}
.hub-party-face i::after {
  content: "";
  display: block;
  height: 100%;
  width: var(--hp, 100%);
  background: linear-gradient(180deg, #8cbc58, #3a6828);
}
.hub-party-face.is-down {
  filter: grayscale(0.7);
  opacity: 0.65;
}
#screen-game.hub-open .viewport-wrap > canvas,
#screen-game.hub-open .hud-top,
#screen-game.hub-open .hud-bottom,
#screen-game.hub-open .u7-chrome,
#screen-game.hub-open #quest-dock,
#screen-game.hub-open .game-top-actions,
#screen-game.atlas-open .game-top-actions,
#screen-game.talk-open .game-top-actions {
  visibility: hidden !important;
  pointer-events: none !important;
}
#screen-game.hub-open .u7-chrome,
#screen-game.hub-open #quest-dock {
  display: none !important;
}
#screen-game.hub-open:not(.combat-open) #combat-dock {
  display: none !important;
  visibility: hidden !important;
  pointer-events: none !important;
}
#screen-game.combat-open #combat-dock {
  display: block !important;
  visibility: visible !important;
  pointer-events: auto !important;
}
/* Atlas/hub hide the 3D canvas — combat must show the dirt plate (kick 32 void). */
#screen-game.combat-open .viewport-wrap > canvas {
  visibility: visible !important;
  pointer-events: auto !important;
  background: #c4a070 !important;
}
#screen-game.combat-open .viewport-wrap,
#screen-game.combat-open.atlas-open .viewport-wrap,
#screen-game.combat-open:has(#atlas-overlay:not(.hidden)) .viewport-wrap,
#screen-game.combat-open.hub-open .viewport-wrap {
  background: #c4a070 !important;
}
.ie-mode {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  margin-left: 0.6rem;
  pointer-events: auto;
}
.ie-mode.hidden {
  display: none !important;
}
.ie-mode-btn {
  background: #2a2118;
  color: #e8dcc4;
  border: 1px solid #8a7348;
  border-radius: 6px;
  padding: 0.18rem 0.55rem;
  font: 600 0.78rem/1.2 Cinzel, serif;
  cursor: pointer;
}
.ie-mode-btn.on {
  background: #5a3a10;
  color: #f4e8c8;
  border-color: #c9a227;
}
.ie-pause-flag {
  display: none;
  color: #f0d48a;
  font: 600 0.75rem/1 Cinzel, serif;
  letter-spacing: 0.04em;
}
.ie-pause-flag.show {
  display: inline;
}
#screen-game.painted-explore .u7-chrome {
  visibility: hidden;
}
#screen-game.ie-paused .viewport-wrap::after {
  content: "Paused";
  position: absolute;
  top: 4.2rem;
  left: 50%;
  transform: translateX(-50%);
  z-index: 12;
  padding: 0.2rem 0.7rem;
  background: rgba(12, 10, 8, 0.72);
  color: #f0d48a;
  border: 1px solid #c9a227;
  border-radius: 6px;
  font: 600 0.85rem Cinzel, serif;
  pointer-events: none;
}
#screen-game.hub-open .hud-bottom #talk-dock:not(.hidden) {
  visibility: visible;
  pointer-events: auto;
  z-index: 40;
  left: 6%;
  right: 6%;
  width: auto;
  bottom: 23.2rem;
}
@media (max-width: 1100px) {
  .hub-book {
    --hub-book-h: min(28%, 16rem);
    left: 2.4%;
    right: 2.4%;
  }
  .hub-book-paper {
    grid-template-columns: 12.4rem 8px minmax(0, 1fr);
  }
  .hub-book-paper.is-alone {
    grid-template-columns: minmax(0, 1fr);
  }
}
@media (max-height: 820px) {
  .hub-book {
    --hub-book-h: min(30%, 14.8rem);
  }
  .hub-book-paper {
    grid-template-columns: 11.6rem 8px minmax(0, 1fr);
  }
  .hub-book-paper.is-alone {
    grid-template-columns: minmax(0, 1fr);
  }
  .hub-leaf h2 {
    font-size: 0.9rem;
  }
  .hub-blurb {
    font-size: 0.96rem;
    line-height: 1.5;
  }
  #place-hub .hub-book-paper.is-spoken .hub-blurb {
    font-size: 0.92rem;
    line-height: 1.42;
    margin: 0 0 0.4rem;
  }
  #place-hub .hub-book-paper.is-spoken.is-quiet .hub-blurb {
    margin: 0;
  }
  .hub-ink {
    font-size: 0.8rem;
  }
  #place-hub .hub-book-paper.is-spoken .hub-ink {
    font-size: 0.9rem;
    padding: 0.04rem 0.1rem;
  }
}

#rest-veil {
  position: fixed;
  inset: 0;
  z-index: 90;
  background: #070605;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.45s ease;
}
#rest-veil.on {
  opacity: 1;
  pointer-events: auto;
}

/* Land travel scene — parchment chip over the atlas, map stays the hero */
.travel-scene {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  position: absolute;
  left: 8%;
  right: 8%;
  bottom: 11%;
  z-index: 12;
  pointer-events: none;
}
.travel-scene.hidden {
  display: none !important;
}

.travel-scene-inner {
  min-width: 12rem;
  padding: 0.35rem 0.7rem 0.4rem;
  background: linear-gradient(180deg, #f0e4c4, #d8c49a);
  color: #2a2118;
  border: 1px solid #c9a227;
  border-radius: 3px;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.35);
  pointer-events: none;
  text-align: center;
}

.travel-scene-inner h2 {
  margin: 0;
  font-family: Cinzel, Georgia, serif;
  font-size: 0.78rem;
  color: #5a3a10;
  letter-spacing: 0.05em;
}

.travel-scene .voyage-route,
.travel-scene .voyage-weather {
  display: block;
  margin: 0.15rem 0 0;
  font-size: 0.78rem;
}
.travel-scene .voyage-log {
  display: block;
  max-height: 5.2rem;
  overflow: auto;
  margin: 0.28rem 0 0;
  padding: 0 0 0 1.15rem;
  text-align: left;
  font-size: 0.78rem;
  line-height: 1.35;
}

.travel-scene .voyage-day-counter {
  background: transparent;
  padding: 0.1rem 0 0;
  margin: 0;
  justify-content: center;
  font-size: 0.72rem;
}

/* At-sea voyage zone */
.voyage-panel {
  position: absolute;
  inset: 0;
  z-index: 8;
  display: flex;
  align-items: center;
  justify-content: center;
  background:
    radial-gradient(ellipse at 50% 30%, rgba(40, 90, 140, 0.55), transparent 55%),
    linear-gradient(180deg, #0a2848 0%, #061820 100%);
}

.voyage-panel.hidden {
  display: none;
}

.voyage-inner {
  width: min(26rem, 92vw);
  padding: 1.1rem 1.25rem;
  background: linear-gradient(160deg, #d8e4f0 0%, #b8c8d8 100%);
  color: #1a2430;
  border: 2px solid #c9a227;
  border-radius: 12px;
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.5);
}

.voyage-inner h2 {
  margin: 0 0 0.35rem;
  font-family: Georgia, serif;
  color: #1a4060;
  letter-spacing: 0.04em;
}

.voyage-route {
  margin: 0 0 0.65rem;
  font-weight: 600;
  font-size: 0.95rem;
}

.voyage-day-counter {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 0.5rem;
  padding: 0.5rem 0.6rem;
  background: rgba(255, 255, 255, 0.4);
  border-radius: 6px;
  margin-bottom: 0.45rem;
}

.voyage-day-counter strong {
  color: #7a2e24;
  font-size: 0.95rem;
}

.voyage-weather {
  margin: 0 0 0.5rem;
  font-size: 0.85rem;
  font-style: italic;
}

.voyage-log {
  list-style: none;
  margin: 0 0 0.75rem;
  padding: 0;
  max-height: 8rem;
  overflow: auto;
  font-size: 0.8rem;
  line-height: 1.35;
}

.voyage-log li {
  padding: 0.25rem 0;
  border-bottom: 1px solid rgba(30, 40, 50, 0.12);
}

.voyage-inner .atlas-card-actions button {
  background: #1a4060;
  color: #f0f6fc;
  border-color: #c9a227;
}

/* Layout: game main fills under header */
.game-screen {
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 0;
}

.game-screen .layout {
  flex: 1 1 auto;
  min-height: 0;
}

.game-screen .top .actions button#btn-atlas.active {
  background: #3a4a28;
  border-color: var(--accent);
  box-shadow: 0 0 10px rgba(201, 162, 39, 0.35);
}

/* —— Sprint 8: Character / Inventory tome —— */
.tome-overlay {
  position: absolute;
  inset: 0;
  z-index: 20;
  display: flex;
  align-items: stretch;
  justify-content: center;
  background: rgba(8, 10, 14, 0.72);
  backdrop-filter: blur(2px);
  pointer-events: auto;
}

.tome-overlay.hidden {
  display: none;
}

.tome-shell {
  flex: 1 1 auto;
  margin: 0.5rem;
  max-width: 1100px;
  display: flex;
  flex-direction: column;
  background: linear-gradient(165deg, #f0e6d0 0%, var(--tome-parchment) 40%, #d9cbb0 100%);
  color: var(--tome-ink);
  border: 2px solid var(--tome-gold);
  border-radius: 8px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.55), inset 0 0 0 1px rgba(255, 255, 255, 0.25);
  overflow: hidden;
}

.tome-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.45rem 0.75rem;
  background: linear-gradient(90deg, #5c241c, var(--tome-banner) 40%, #3d2a18);
  color: #f5ecd8;
  border-bottom: 2px solid var(--tome-gold);
}

.tome-tabs {
  display: flex;
  gap: 0.25rem;
}

.tome-tabs button {
  background: transparent;
  border: 1px solid transparent;
  color: #e8dcc4;
  padding: 0.35rem 0.85rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  border-radius: 4px 4px 0 0;
  cursor: pointer;
}

.tome-tabs button.active {
  background: var(--tome-parchment);
  color: var(--tome-ink);
  border-color: var(--tome-gold);
}

.tome-status {
  flex: 1;
  font-size: 0.78rem;
  opacity: 0.85;
}

.tome-close {
  background: transparent;
  border: 1px solid rgba(201, 162, 39, 0.5);
  color: #f5ecd8;
  width: 2rem;
  height: 2rem;
  border-radius: 4px;
  cursor: pointer;
  font-size: 1rem;
}

.tome-close:hover {
  border-color: var(--tome-gold);
  background: rgba(0, 0, 0, 0.2);
}

.tome-party {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  padding: 0.5rem 0.75rem;
  background: rgba(42, 33, 24, 0.08);
  border-bottom: 1px solid rgba(61, 58, 54, 0.2);
}

.tome-party-chip {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.3rem 0.65rem;
  background: rgba(255, 255, 255, 0.35);
  border: 1px solid rgba(61, 58, 54, 0.25);
  border-radius: 6px;
  cursor: pointer;
  color: var(--tome-ink);
  font-size: 0.8rem;
}

.tome-party-chip.active {
  border-color: var(--tome-gold);
  background: rgba(201, 162, 39, 0.25);
  box-shadow: 0 0 0 1px var(--tome-gold);
}

.tome-party-chip .chip-hp {
  font-variant-numeric: tabular-nums;
  opacity: 0.75;
}

.tome-body {
  flex: 1 1 auto;
  min-height: 0;
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 0;
  overflow: hidden;
}

.tome-identity {
  padding: 0.85rem;
  border-right: 1px solid rgba(61, 58, 54, 0.2);
  background: rgba(42, 33, 24, 0.06);
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  overflow: auto;
}

.tome-portrait {
  width: 4.5rem;
  height: 4.5rem;
  border-radius: 6px;
  background: linear-gradient(145deg, #4a3a28, #2a2118);
  color: var(--tome-gold);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.8rem;
  font-weight: 700;
  border: 2px solid var(--tome-gold);
  overflow: hidden;
  flex-shrink: 0;
}
.tome-portrait-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.tome-id-text {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  font-size: 0.85rem;
}

.tome-id-sub {
  opacity: 0.75;
  font-size: 0.78rem;
}

.tome-id-stats {
  font-variant-numeric: tabular-nums;
  font-weight: 600;
}

.tome-id-attrs {
  font-size: 0.72rem;
  opacity: 0.8;
  line-height: 1.35;
}

.tome-panel {
  padding: 0.75rem;
  overflow: auto;
  min-height: 0;
}

.tome-panel.hidden {
  display: none;
}

.tome-panel-inv {
  display: grid;
  grid-template-columns: minmax(220px, 280px) 1fr;
  gap: 0.85rem;
  align-items: start;
}

@media (max-width: 900px) {
  .tome-panel-inv {
    grid-template-columns: 1fr;
  }
}

/* Paper doll */
.tome-equip {
  margin: 0;
}

.paper-doll {
  position: relative;
  min-height: 280px;
  background: radial-gradient(ellipse at 50% 40%, rgba(255, 255, 255, 0.45), rgba(42, 33, 24, 0.06));
  border: 1px solid rgba(61, 58, 54, 0.2);
  border-radius: 8px;
  padding: 0.5rem;
  overflow: hidden;
}

.doll-silhouette {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -52%);
  width: 100px;
  height: 170px;
  opacity: 0.22;
  pointer-events: none;
}

.doll-silhouette .doll-head,
.doll-silhouette .doll-torso,
.doll-silhouette .doll-arm {
  fill: #3d2a18;
  stroke: #c9a227;
  stroke-width: 1.2;
}

.doll-slots {
  position: relative;
  min-height: 260px;
}

.tome-slot {
  text-align: left;
  padding: 0.4rem 0.5rem;
  background: rgba(255, 255, 255, 0.55);
  border: 1px dashed rgba(61, 58, 54, 0.35);
  border-radius: 6px;
  color: var(--tome-ink);
  cursor: default;
  min-height: 3.2rem;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

.doll-slot {
  position: absolute;
  width: calc(50% - 0.35rem);
  max-width: 9.5rem;
}

.doll-slot.hand-l {
  left: 0.15rem;
  top: 38%;
}

.doll-slot.hand-r {
  right: 0.15rem;
  top: 38%;
}

.doll-slot.body {
  left: 50%;
  top: 18%;
  transform: translateX(-50%);
  width: 58%;
  max-width: 11rem;
}

.doll-slot.shield {
  right: 0.15rem;
  top: 62%;
}

.tome-slot.filled {
  border-style: solid;
  border-color: var(--tome-gold);
  cursor: pointer;
  background: rgba(201, 162, 39, 0.18);
}

.tome-slot.drop-target {
  box-shadow: 0 0 0 2px rgba(122, 46, 36, 0.45);
}

.tome-slot .slot-icon {
  display: block;
  font-size: 0.85rem;
  line-height: 1;
  margin-bottom: 0.1rem;
  opacity: 0.75;
}

.tome-slot .slot-label {
  display: block;
  font-size: 0.62rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  opacity: 0.65;
}

.tome-slot .slot-item {
  font-weight: 600;
  font-size: 0.8rem;
  display: block;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.tome-slot .slot-empty {
  opacity: 0.4;
  font-size: 0.78rem;
  font-style: italic;
}

.tome-id-weight {
  font-size: 0.75rem;
  opacity: 0.75;
  font-variant-numeric: tabular-nums;
}

.tome-portrait[data-role="comp"] {
  background: linear-gradient(145deg, #2a3a48, #1a242e);
}

.tome-bag-toolbar,
.km-list-toolbar {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 0.65rem;
  margin-bottom: 0.35rem;
  font-size: 0.78rem;
  align-items: center;
}

.tome-bag-toolbar select,
.km-list-toolbar select {
  margin-left: 0.35rem;
  background: rgba(255, 255, 255, 0.6);
  border: 1px solid rgba(61, 58, 54, 0.3);
  border-radius: 4px;
  color: var(--tome-ink, #2a2620);
  padding: 0.15rem 0.35rem;
  min-width: 7.5rem;
}

.km-merchant-panel .km-list-toolbar,
.km-gear-panel .km-list-toolbar {
  justify-content: flex-start;
  margin-top: 0.15rem;
}

.shop-bag-toolbar,
.shop-stock-toolbar {
  justify-content: flex-start;
  margin: 0.15rem 0 0.35rem;
}

.tome-bag {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.tome-bag-item {
  display: grid;
  grid-template-columns: 2.2rem minmax(0, 1fr) auto;
  grid-template-areas:
    "qty name actions"
    "qty meta actions";
  gap: 0.15rem 0.45rem;
  align-items: center;
  padding: 0.4rem 0.5rem;
  background: rgba(255, 255, 255, 0.35);
  border: 1px solid transparent;
  border-radius: 5px;
  cursor: pointer;
  font-size: 0.85rem;
}

.tome-bag-item:hover,
.tome-bag-item.selected {
  border-color: var(--tome-gold);
  background: rgba(201, 162, 39, 0.15);
}

.tome-bag-item .bag-qty {
  grid-area: qty;
  font-variant-numeric: tabular-nums;
  opacity: 0.7;
}

.tome-bag-item .bag-name {
  grid-area: name;
  font-weight: 600;
}

.tome-bag-item .bag-meta {
  grid-area: meta;
  font-size: 0.72rem;
  opacity: 0.7;
}

.tome-bag-item .bag-actions {
  grid-area: actions;
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
  justify-content: flex-end;
  align-items: center;
}

.tome-bag-item .bag-equip,
.tome-bag-item .bag-give-btn {
  background: var(--tome-banner);
  color: #f5ecd8;
  border: 1px solid var(--tome-gold);
  border-radius: 4px;
  padding: 0.2rem 0.45rem;
  font-size: 0.72rem;
  cursor: pointer;
}

.tome-bag-item .bag-give {
  display: inline-flex;
  align-items: center;
  gap: 0.2rem;
}

.tome-bag-item .bag-give-to {
  max-width: 5.5rem;
  font-size: 0.7rem;
  background: rgba(255, 255, 255, 0.7);
  border: 1px solid rgba(61, 58, 54, 0.3);
  border-radius: 3px;
  color: var(--tome-ink);
  padding: 0.15rem;
}

.tome-bag-empty {
  opacity: 0.6;
  padding: 0.75rem;
  font-style: italic;
}

.tome-worn-list {
  list-style: none;
  margin: 0 0 0.75rem;
  padding: 0;
  font-size: 0.85rem;
}

.tome-worn-list li {
  display: flex;
  gap: 0.65rem;
  padding: 0.2rem 0;
  border-bottom: 1px solid rgba(61, 58, 54, 0.12);
}

.tome-worn-list .worn-slot {
  min-width: 5.5rem;
  font-weight: 600;
  opacity: 0.7;
}

.tip-delta {
  margin-top: 0.4rem;
  padding-top: 0.35rem;
  border-top: 1px solid rgba(61, 58, 54, 0.2);
  font-size: 0.78rem;
  font-weight: 600;
}

.delta-up {
  color: #2d6a3e;
}

.delta-down {
  color: #8b2e24;
}

.tip-delta-same {
  opacity: 0.7;
  font-weight: 500;
}

.tome-sheet h3 {
  margin: 0.5rem 0 0.35rem;
  color: var(--tome-banner);
  font-size: 0.95rem;
  letter-spacing: 0.04em;
}

.tome-sheet-dl {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.35rem 1rem;
  margin: 0;
  font-size: 0.85rem;
}

.tome-sheet-dl div {
  display: flex;
  gap: 0.5rem;
}

.tome-sheet-dl dt {
  font-weight: 600;
  opacity: 0.7;
  min-width: 5.5rem;
}

.tome-sheet-dl dd {
  margin: 0;
}

.tome-attr-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
  font-variant-numeric: tabular-nums;
}

.tome-attr-table th,
.tome-attr-table td {
  padding: 0.25rem 0.4rem;
  border-bottom: 1px solid rgba(61, 58, 54, 0.15);
  text-align: left;
}

.tome-attr-table th {
  width: 3rem;
}

/* —— Class picker (all classes; locked greyscale; hover title = prereqs) —— */
.tome-class-picker {
  margin: 0.25rem 0 0.85rem;
}
.class-picker-filter {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
  margin: 0.35rem 0 0.5rem;
}
.cp-filter {
  appearance: none;
  font: inherit;
  font-size: 0.72rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 0.25rem 0.5rem;
  border-radius: 3px;
  border: 1px solid rgba(180, 150, 90, 0.4);
  background: rgba(40, 32, 20, 0.4);
  color: #c4a574;
  cursor: pointer;
}
.cp-filter:hover {
  border-color: var(--tome-gold, #c9a227);
  color: #f0e6c8;
}
.cp-filter.active {
  background: rgba(90, 70, 30, 0.55);
  border-color: var(--tome-gold, #c9a227);
  color: #f5ecd0;
}
.class-picker-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(8.5rem, 1fr));
  gap: 0.4rem;
  max-height: 16rem;
  overflow-y: auto;
  padding: 0.15rem;
}
.class-pick {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.15rem;
  text-align: left;
  padding: 0.45rem 0.5rem;
  border-radius: 5px;
  border: 1px solid rgba(201, 162, 39, 0.4);
  background: linear-gradient(165deg, rgba(55, 46, 32, 0.95), rgba(28, 24, 18, 0.98));
  color: #f0e6c8;
  cursor: pointer;
  font: inherit;
  min-height: 3.1rem;
  transition: filter 0.12s ease, opacity 0.12s ease, border-color 0.12s ease;
}
.class-pick .cp-name {
  font-weight: 700;
  font-size: 0.82rem;
  letter-spacing: 0.02em;
}
.class-pick .cp-meta {
  font-size: 0.65rem;
  color: #a89878;
}
.class-pick .cp-kind {
  font-style: normal;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #c9a227;
}
.class-pick.is-open:hover {
  border-color: var(--tome-gold, #c9a227);
  box-shadow: 0 0 0 1px rgba(201, 162, 39, 0.25);
}
.class-pick.is-open:active {
  transform: translateY(1px);
}
/* Locked / unmet prereqs — greyscale, still hoverable for title tooltip */
.class-pick.is-locked {
  filter: grayscale(1) brightness(0.72);
  opacity: 0.72;
  cursor: help;
  border-color: rgba(120, 110, 95, 0.45);
  background: linear-gradient(165deg, rgba(40, 38, 36, 0.95), rgba(22, 20, 18, 0.98));
}
.class-pick.is-locked:hover {
  filter: grayscale(0.85) brightness(0.8);
  opacity: 0.88;
}
.class-pick.is-owned {
  border-color: rgba(120, 160, 100, 0.45);
}
.class-pick.is-owned .cp-meta {
  color: #8aaa78;
}
.class-pick.prestige .cp-kind {
  color: #c080a0;
}

.tome-modules {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  margin: 0.35rem 0 0.75rem;
  padding: 0.55rem 0.65rem;
  border: 1px solid rgba(180, 150, 90, 0.35);
  border-radius: 4px;
  background: rgba(40, 32, 20, 0.35);
}
.tome-modules .mod-row {
  display: flex;
  align-items: flex-start;
  gap: 0.45rem;
  font-size: 0.9rem;
  cursor: pointer;
}
.tome-modules .mod-row input {
  margin-top: 0.15rem;
}
.tome-features {
  font-size: 0.85rem;
  opacity: 0.9;
}

.tome-tooltip {
  position: fixed;
  z-index: 30;
  display: flex;
  gap: 0.5rem;
  pointer-events: none;
  max-width: min(520px, 90vw);
}

.tome-tooltip.hidden {
  display: none;
}

.tip-card {
  background: #f5ecd8;
  color: var(--tome-ink);
  border: 1px solid var(--tome-gold);
  border-radius: 6px;
  padding: 0.55rem 0.7rem;
  font-size: 0.8rem;
  line-height: 1.35;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
  min-width: 160px;
}

.tip-card.compare {
  background: #e8e0d0;
}

.tip-compare-label {
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  opacity: 0.65;
  margin-bottom: 0.2rem;
}

.tip-rarity {
  text-transform: capitalize;
  opacity: 0.75;
}

.map-hint {
  font-size: 0.72rem;
  margin: 0.25rem 0 0.5rem;
  opacity: 0.7;
}

.map-hint kbd {
  font-size: 0.7rem;
  padding: 0.05rem 0.3rem;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 3px;
}

@media (max-width: 800px) {
  .tome-body {
    grid-template-columns: 1fr;
  }
  .tome-identity {
    border-right: none;
    border-bottom: 1px solid rgba(61, 58, 54, 0.2);
    flex-direction: row;
    align-items: center;
  }
}

/* —— Sprint 9: Combat dock —— */
.combat-dock {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  width: min(36rem, 100%);
  max-height: min(62vh, 560px);
  padding: 0.5rem 0.55rem 0.55rem;
  background: linear-gradient(180deg, rgba(28, 14, 16, 0.96), rgba(12, 14, 20, 0.96));
  border: 1px solid rgba(201, 162, 39, 0.45);
  border-radius: 10px;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.45);
  pointer-events: auto;
  color: #e8edf4;
  font-size: 0.82rem;
  z-index: 40;
  position: relative;
}

.combat-dock.hidden {
  display: none;
}

/* Combat journal: dedicated scroll box */
.combat-dock .chud-log-wrap {
  flex: 1 1 auto;
  min-height: 7.5rem;
  max-height: 14rem;
  display: flex;
  flex-direction: column;
  border: 1px solid rgba(201, 162, 39, 0.35);
  border-radius: 8px;
  background: rgba(8, 10, 14, 0.92);
  padding: 0.35rem 0.4rem 0.45rem;
}
.combat-dock .chud-log {
  flex: 1 1 auto;
  overflow-y: auto;
  max-height: 12rem;
  margin: 0;
  padding: 0.25rem 0.35rem;
  list-style: none;
  font-size: 0.78rem;
  line-height: 1.4;
  scrollbar-width: thin;
}
.combat-dock .chud-log .chud-line {
  padding: 0.15rem 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  word-break: break-word;
}

/* Party / foe initiative cards strip */
.chud-cards-foe,
.chud-cards-party {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  align-items: stretch;
  justify-content: center;
}
.chud-card {
  min-width: 5.5rem;
  max-width: 8rem;
  padding: 0.3rem 0.4rem;
  border-radius: 8px;
  border: 1px solid rgba(180, 180, 190, 0.35);
  background: rgba(20, 24, 32, 0.9);
  font-size: 0.72rem;
}
.chud-card.active {
  border-color: rgba(201, 162, 39, 0.85);
  box-shadow: 0 0 0 1px rgba(201, 162, 39, 0.4);
  transform: scale(1.06);
  z-index: 1;
}
.chud-card.foe {
  border-color: rgba(200, 90, 90, 0.45);
}
.chud-card.down {
  opacity: 0.45;
  filter: grayscale(0.6);
}
.chud-card-name {
  font-weight: 700;
  display: block;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.chud-card-bar {
  display: block;
  height: 0.35rem;
  margin: 0.2rem 0;
  border-radius: 99px;
  background: rgba(0, 0, 0, 0.45);
  overflow: hidden;
}
.chud-card-bar > i {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, #3a8f5a, #6dca7a);
}
.chud-card.foe .chud-card-bar > i {
  background: linear-gradient(90deg, #8f3a3a, #ca6d6d);
}
.chud-card-hp {
  opacity: 0.85;
  font-variant-numeric: tabular-nums;
}

/* Hide settlement chrome while combat is open (party strip, Camp/Talk/HUD, legacy docks) */
#screen-game.combat-open .dock-row-legacy,
#screen-game.combat-open .exit-list,
#screen-game.combat-open .hud-bottom,
#screen-game.combat-open .party-strip,
#screen-game.combat-open .party-row,
#screen-game.combat-open #party-line {
  display: none !important;
  visibility: hidden !important;
  pointer-events: none !important;
}
/* Talk slab is z-index 38 over the combat plate (35). Keep NPC talk off the HUD. */
#screen-game:has(#combat-dock.km-combat-root:not(.hidden):not(.km-explore)) #talk-banner,
#screen-game:has(#combat-dock.km-combat-root:not(.hidden):not(.km-explore)) #talk-dock {
  display: none !important;
  pointer-events: none !important;
}

/* C0 legal action strip */
.chud-legal {
  display: flex;
  flex-wrap: wrap;
  gap: 0.28rem;
  max-height: 4.5rem;
  overflow-y: auto;
}
.chud-legal-btn {
  appearance: none;
  border: 1px solid rgba(201, 162, 39, 0.4);
  background: rgba(40, 32, 20, 0.9);
  color: #e8edf4;
  border-radius: 6px;
  padding: 0.2rem 0.4rem;
  font-size: 0.68rem;
  cursor: pointer;
  display: inline-flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.05rem;
}
.chud-legal-btn em {
  font-style: normal;
  opacity: 0.65;
  font-size: 0.58rem;
  text-transform: uppercase;
}
.chud-legal-btn:hover:not(:disabled):not(.is-locked) {
  border-color: rgba(201, 162, 39, 0.85);
  background: rgba(60, 48, 28, 0.95);
}
.chud-legal-btn.is-locked,
.chud-legal-btn:disabled {
  opacity: 0.55;
  cursor: help;
  border-style: dashed;
}
.chud-legal-btn.is-locked .why {
  display: block;
  font-style: normal;
  opacity: 0.9;
  font-size: 0.55rem;
  color: #e0b060;
  max-width: 7.5rem;
  white-space: normal;
  line-height: 1.15;
  text-transform: none;
}
.chud-legal-btn:not(.is-locked) .why {
  display: none;
}
.chud-legal-hint {
  font-size: 0.72rem;
  opacity: 0.85;
}

/* Companion initiative command strip */
.chud-companion-cmd {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.28rem;
  margin: 0.25rem 0 0.15rem;
  padding: 0.28rem 0.35rem;
  border: 1px solid rgba(120, 180, 140, 0.45);
  border-radius: 6px;
  background: rgba(18, 28, 22, 0.92);
}
.chud-companion-cmd[hidden] {
  display: none !important;
}
.chud-companion-cmd-label {
  font-size: 0.72rem;
  margin-right: 0.25rem;
  color: #b8d4c0;
}
.chud-companion-cmd-btn {
  appearance: none;
  border: 1px solid rgba(140, 190, 150, 0.45);
  background: rgba(32, 48, 38, 0.95);
  color: #e8f0ea;
  border-radius: 5px;
  padding: 0.18rem 0.4rem;
  font-size: 0.68rem;
  cursor: pointer;
}
.chud-companion-cmd-btn:hover {
  border-color: rgba(160, 220, 170, 0.85);
  background: rgba(42, 62, 48, 0.98);
}
.chud-companion-cmd-btn.end {
  border-color: rgba(180, 160, 90, 0.55);
  margin-left: auto;
}

/* Item icon emoji fallback when art missing */
.shop-icon-ph,
.km-doll-slot-icon.shop-icon-ph {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.6rem;
  height: 1.6rem;
  font-size: 1.05rem;
  line-height: 1;
  flex-shrink: 0;
}

/* C5: minimap float damage / heal numbers */
.chud-minimap-wrap {
  position: relative;
  display: inline-block;
  flex-shrink: 0;
}
.chud-float-stage,
.chud-float-layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: visible;
  z-index: 4;
}
.chud-float {
  position: absolute;
  font-weight: 700;
  font-size: 0.95rem;
  text-shadow: 0 1px 2px #000, 0 0 6px rgba(0, 0, 0, 0.7);
  animation: chud-float-up 0.9s ease-out forwards;
  white-space: nowrap;
}
.chud-float.dmg {
  color: #ff6b5a;
}
.chud-float.crit {
  color: #ffd060;
  font-size: 1.1rem;
}
.chud-float.heal {
  color: #6dffa0;
}
.chud-float.miss {
  color: #aab4c0;
  font-size: 0.8rem;
}
.chud-float.save {
  color: #8ec8ff;
  font-size: 0.75rem;
}
@keyframes chud-float-up {
  0% {
    opacity: 1;
    transform: translate(-50%, 0) scale(1);
  }
  70% {
    opacity: 1;
    transform: translate(-50%, -28px) scale(1.08);
  }
  100% {
    opacity: 0;
    transform: translate(-50%, -48px) scale(0.95);
  }
}
.chud-key.chud-end {
  border-color: rgba(120, 180, 140, 0.55);
  background: rgba(40, 90, 55, 0.55);
  font-weight: 600;
}
.chud-banner.chud-banner-end-ready {
  border-color: rgba(140, 200, 120, 0.65);
  background: rgba(28, 48, 32, 0.92);
}
.chud-banner-end {
  margin-left: 0.55rem;
  padding: 0.2rem 0.55rem;
  border-radius: 6px;
  border: 1px solid rgba(160, 220, 140, 0.7);
  background: rgba(50, 110, 60, 0.85);
  color: #e8ffe0;
  font: inherit;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  pointer-events: auto;
}
.chud-banner-end:hover {
  background: rgba(70, 140, 80, 0.95);
}

/* —— E19: Settlement streets dock —— */
.settlement-dock {
  margin: 0.2rem 0 0.35rem;
  padding: 0.35rem 0.45rem;
  max-width: min(36rem, 100%);
  background: rgba(18, 28, 24, 0.88);
  border: 1px solid rgba(120, 160, 130, 0.4);
  border-radius: 8px;
  pointer-events: auto;
}
.settlement-dock.hidden {
  display: none;
}
.settlement-head {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 0.6rem;
  align-items: baseline;
  margin-bottom: 0.3rem;
  font-size: 0.82rem;
}
.settlement-kicker {
  font-size: 0.65rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #9dcea8;
  font-weight: 700;
}
.settlement-pose {
  font-variant-numeric: tabular-nums;
  font-size: 0.72rem;
}
.settlement-map {
  display: block;
  width: min(100%, 280px);
  height: auto;
  margin: 0.15rem 0 0.35rem;
  border-radius: 6px;
  border: 1px solid rgba(120, 150, 130, 0.4);
  background: #121a16;
  cursor: crosshair;
  image-rendering: pixelated;
}
.settlement-hint {
  margin: 0.15rem 0 0;
  font-size: 0.68rem;
}
.settlement-waypoints {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
}
.settlement-wp.outer {
  border-color: rgba(180, 120, 150, 0.55);
  color: #e8c8d8;
  font-size: 0.72rem;
}
.settlement-wp.outer:hover:not(:disabled) {
  border-color: rgba(220, 160, 190, 0.85);
}
.settlement-wp {
  font-size: 0.72rem;
  padding: 0.18rem 0.45rem;
  border-radius: 999px;
  border: 1px solid rgba(140, 170, 150, 0.45);
  background: rgba(40, 55, 48, 0.9);
  color: #e4f0e8;
  cursor: pointer;
}
.settlement-wp:hover:not(:disabled) {
  background: rgba(55, 80, 65, 0.95);
  border-color: rgba(180, 210, 180, 0.6);
}
.settlement-wp.here,
.settlement-wp:disabled {
  opacity: 0.65;
  cursor: default;
  border-color: rgba(201, 162, 39, 0.5);
  background: rgba(60, 50, 30, 0.75);
}

/* —— E53: Conditions / buffs bar —— */
.status-effects {
  display: flex;
  flex-wrap: wrap;
  gap: 0.28rem;
  align-items: center;
  max-width: min(36rem, 100%);
  pointer-events: auto;
}

.status-effects.hidden {
  display: none;
}

.hud-top .status-effects {
  margin: 0.15rem 0 0.25rem;
}

.chud-status {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
  min-height: 1.35rem;
  padding: 0.15rem 0.1rem;
  border-bottom: 1px solid rgba(201, 162, 39, 0.18);
}

.chud-status.empty {
  opacity: 0.75;
}

.status-empty {
  font-size: 0.68rem;
  opacity: 0.65;
}

.status-chip {
  display: inline-flex;
  align-items: baseline;
  gap: 0.28rem;
  padding: 0.12rem 0.4rem 0.14rem;
  border-radius: 999px;
  font-size: 0.68rem;
  font-weight: 650;
  letter-spacing: 0.02em;
  line-height: 1.2;
  border: 1px solid transparent;
  cursor: default;
  white-space: nowrap;
  max-width: 12rem;
  overflow: hidden;
  text-overflow: ellipsis;
}

.status-chip .status-label {
  text-transform: capitalize;
}

.status-chip .status-dur {
  font-style: normal;
  font-weight: 500;
  opacity: 0.85;
  font-variant-numeric: tabular-nums;
  font-size: 0.62rem;
}

.status-chip.status-bad {
  background: rgba(110, 28, 32, 0.78);
  border-color: rgba(220, 100, 90, 0.55);
  color: #ffd8d4;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.2);
}

.status-chip.status-good {
  background: rgba(28, 72, 48, 0.78);
  border-color: rgba(120, 190, 130, 0.5);
  color: #d8f5de;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.15);
}

.status-chip.status-neutral {
  background: rgba(48, 52, 68, 0.82);
  border-color: rgba(160, 170, 200, 0.4);
  color: #e4e8f2;
}

.tome-status-bar {
  margin: 0.25rem 0 0.65rem;
}

.tome-inline-status {
  max-width: 100%;
}

.chud-banner {
  text-align: center;
  font-weight: 700;
  letter-spacing: 0.04em;
  padding: 0.3rem 0.45rem;
  border-radius: 6px;
  background: rgba(60, 90, 40, 0.55);
  border: 1px solid rgba(201, 162, 39, 0.4);
  color: #f5ecd8;
}

.chud-banner.foe {
  background: rgba(90, 30, 30, 0.65);
  border-color: #c07070;
}

.chud-zone {
  text-align: center;
  font-size: 0.7rem;
  opacity: 0.85;
  font-variant-numeric: tabular-nums;
  color: #c5d0dc;
}

.chud-path-note {
  font-size: 0.78rem;
  color: #b8d4f0;
  padding: 0.2rem 0.45rem;
  margin: 0.15rem 0;
  border-left: 2px solid rgba(120, 180, 240, 0.6);
}
.chud-path-note.provoke {
  color: #f0b090;
  border-left-color: rgba(240, 120, 80, 0.75);
}
.chud-key.chud-loadout.active {
  border-color: rgba(220, 190, 100, 0.75);
  color: #fff4d0;
}
.chud-minimap {
  display: block;
  width: 160px;
  height: 160px;
  margin: 0.35rem auto;
  border: 1px solid #3a4550;
  border-radius: 4px;
  background: #1a1e24;
  image-rendering: pixelated;
}

/* E21 skills pane (character tome) */
.tome-skills {
  margin-top: 0.5rem;
  max-height: 280px;
  overflow: auto;
}
.tome-skill-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8rem;
  font-variant-numeric: tabular-nums;
}
.tome-skill-table th,
.tome-skill-table td {
  padding: 0.2rem 0.35rem;
  border-bottom: 1px solid #3a3530;
  text-align: left;
}
.tome-skill-table tr.class-skill td:first-child {
  color: #e8dcc8;
}
.tome-skill-table tr.cross-skill {
  opacity: 0.75;
}
.skill-check-btn {
  font-size: 0.7rem;
  padding: 0.1rem 0.4rem;
  cursor: pointer;
  background: #3a342c;
  border: 1px solid #6a5a40;
  color: #e8dcc8;
  border-radius: 3px;
}
.skill-check-btn:hover {
  background: #4a4030;
}
.tome-skill-table td.syn-on {
  color: #9dcea8;
  font-weight: 650;
}
.heal-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  align-items: center;
  margin: 0.45rem 0 0.25rem;
}
.heal-actions .heal-btn {
  background: #2a4038;
  border-color: #5a8a70;
}
.tome-skills-hint {
  font-size: 0.75rem;
  margin-bottom: 0.35rem;
}

.tome-feats {
  margin-top: 0.5rem;
  max-height: 260px;
  overflow: auto;
}
/* E33 spellbook */
.spellbook-scroll {
  max-height: 280px;
}
.spell-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
  margin: 0.35rem 0;
}
.spell-filter-btn {
  font-size: 0.7rem;
  padding: 0.15rem 0.4rem;
  background: #2a2824;
  border: 1px solid #4a4540;
  border-radius: 4px;
  color: #c8c0b4;
  cursor: pointer;
}
.spell-filter-btn.active {
  background: #3a4830;
  border-color: #7a9a60;
  color: #d8e8c0;
}
.spell-quickbar-edit {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.3rem;
  margin: 0.35rem 0;
  font-size: 0.75rem;
}
.qb-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.2rem;
  padding: 0.15rem 0.4rem;
  background: #2a3040;
  border: 1px solid #506080;
  border-radius: 4px;
  color: #c8d4e8;
}
.qb-chip.empty {
  opacity: 0.45;
  border-style: dashed;
}
.qb-chip kbd {
  font-size: 0.65rem;
  opacity: 0.75;
}
.spell-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.2rem;
  margin-top: 0.25rem;
}
.chud-spellbar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
  margin-top: 0.35rem;
  min-height: 1.5rem;
}
.chud-spellbar .chud-spell {
  background: #283848;
  border-color: #6080a0;
  flex: 1 1 5rem;
  min-width: 4.5rem;
}
.chud-spellbar .muted.small {
  font-size: 0.7rem;
  opacity: 0.7;
}
/* C3 maneuver page */
.chud-maneuver-page {
  margin-top: 0.35rem;
  padding: 0.35rem 0.4rem 0.45rem;
  border: 1px solid rgba(140, 110, 70, 0.45);
  border-radius: 6px;
  background: rgba(28, 22, 18, 0.92);
}
.chud-maneuver-head {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.35rem;
  font-size: 0.78rem;
}
.chud-maneuver-head strong {
  letter-spacing: 0.04em;
  text-transform: uppercase;
  opacity: 0.9;
}
.chud-maneuver-close {
  margin-left: auto;
  background: transparent;
  border: none;
  color: inherit;
  font-size: 1.1rem;
  line-height: 1;
  cursor: pointer;
  opacity: 0.7;
  padding: 0 0.25rem;
}
.chud-maneuver-close:hover {
  opacity: 1;
}
.chud-maneuver-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 0.28rem;
}
.chud-maneuver-grid .chud-maneuver-slot {
  background: #2a2818;
  border-color: #a08848;
  flex: 1 1 5.5rem;
  min-width: 5rem;
  max-width: 8rem;
}
.chud-maneuver-grid .chud-maneuver-slot .cost {
  font-size: 0.62rem;
  opacity: 0.85;
}
.chud-key#chud-maneuver.active {
  box-shadow: 0 0 0 1px #d4a84a, inset 0 0 8px rgba(212, 168, 74, 0.25);
}
.chud-key#chud-cast.active {
  box-shadow: 0 0 0 1px #6a9ad4, inset 0 0 8px rgba(106, 154, 212, 0.25);
}
/* C4 ability page */
.chud-ability-page {
  margin-top: 0.35rem;
  padding: 0.35rem 0.4rem 0.45rem;
  border: 1px solid rgba(90, 120, 170, 0.5);
  border-radius: 6px;
  background: rgba(18, 22, 32, 0.94);
}
.chud-ability-sec {
  margin-top: 0.3rem;
}
.chud-ability-sec > em {
  display: block;
  margin-bottom: 0.2rem;
}
.chud-ability-slot.kind-spell {
  border-color: #5a7ab0;
  background: #1a2438;
}
.chud-ability-slot.kind-special {
  border-color: #a07040;
  background: #2a2218;
}
.chud-ability-slot.ground {
  border-style: dashed;
}
.chud-ability-slot.pending {
  box-shadow: 0 0 0 1px #d4c04a;
}
.chud-conc {
  color: #c8b060;
  font-size: 0.72rem;
}

/* C2 item belt */
.chud-belt {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.28rem;
  margin-top: 0.3rem;
  padding: 0.2rem 0;
  border-top: 1px solid rgba(120, 100, 60, 0.25);
}
.chud-belt-label {
  font-size: 0.68rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  opacity: 0.65;
  margin-right: 0.2rem;
}
.chud-belt .chud-belt-slot {
  background: #2a2430;
  border-color: #8a7048;
  flex: 1 1 4.5rem;
  min-width: 4rem;
  max-width: 7rem;
}
.chud-belt .chud-belt-slot.kind-potion {
  border-color: #6a9a6a;
}
.chud-belt .chud-belt-slot.kind-scroll {
  border-color: #6a8aba;
}
.chud-belt .chud-belt-slot.kind-wand {
  border-color: #9a6aba;
}
.chud-belt .chud-belt-slot.empty {
  opacity: 0.45;
}
.tome-feat-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.78rem;
}
.tome-feat-table th,
.tome-feat-table td {
  padding: 0.25rem 0.35rem;
  border-bottom: 1px solid #3a3530;
  vertical-align: top;
}
.feat-badge {
  text-transform: uppercase;
  font-size: 0.65rem;
  letter-spacing: 0.04em;
  white-space: nowrap;
}
.feat-owned .feat-badge { color: #8fd48f; }
.feat-open .feat-badge { color: #d4c48a; }
.feat-locked .feat-badge { color: #888; }
.feat-locked { opacity: 0.7; }
.feat-prereq, .feat-lock {
  font-size: 0.7rem;
  margin-top: 0.15rem;
}
.feat-lock { color: #c07070; }
.feat-picks-hot {
  color: #e8c86a !important;
}
.feat-take-btn {
  font-size: 0.7rem;
  padding: 0.15rem 0.45rem;
  cursor: pointer;
  background: #3a5030;
  border: 1px solid #6a9050;
  color: #e8f0d8;
  border-radius: 3px;
}
.feat-take-btn:hover {
  background: #4a6840;
}
.feat-take-btn:disabled {
  opacity: 0.5;
  cursor: wait;
}

/* E26 level-up wizard */
.levelup-overlay {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(8, 6, 4, 0.72);
}
.levelup-overlay.hidden {
  display: none;
}
.levelup-shell {
  width: min(640px, 96vw);
  max-height: 90vh;
  overflow: auto;
  background: linear-gradient(160deg, #2a241c, #1a1612);
  border: 1px solid #6a5a40;
  border-radius: 8px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.5);
  color: #e8dcc8;
}
.lu-steps {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.25rem;
  margin-bottom: 0.75rem;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.lu-step {
  padding: 0.2rem 0.45rem;
  border-radius: 3px;
  background: #2a2520;
  color: #9a8a70;
}
.lu-step.is-on {
  background: #3a5030;
  color: #e8dcc8;
}
.lu-step.is-need {
  background: #5a3a20;
  color: #f0d090;
  box-shadow: 0 0 0 1px #c9a22766;
}
.lu-step-sep {
  color: #5a5040;
  margin: 0 0.1rem;
}
.lu-sk-name {
  display: block;
  font-weight: 600;
}
.lu-sk-meta {
  font-size: 0.7rem;
}
.lu-skill-table tr.lu-cross {
  opacity: 0.92;
}
.lu-ability {
  margin-top: 0.75rem;
  padding: 0.55rem 0.6rem;
  border: 1px solid #4a4030;
  border-radius: 6px;
  background: rgba(201, 162, 39, 0.06);
}
.lu-ability-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-top: 0.4rem;
}
.lu-ab-chip {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 3.4rem;
  padding: 0.35rem 0.45rem;
  cursor: pointer;
  background: #3a342c;
  border: 1px solid #6a5a40;
  color: #e8dcc8;
  border-radius: 4px;
  font: inherit;
  font-size: 0.75rem;
}
.lu-ab-chip strong {
  font-size: 0.8rem;
  letter-spacing: 0.04em;
}
.lu-ab-chip.is-on {
  background: #3a5030;
  border-color: #8ab060;
  box-shadow: 0 0 0 1px #8ab06055;
}
.lu-feat-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.4rem;
  max-height: 280px;
  overflow: auto;
  margin: 0.4rem 0;
}
.lu-feat-card {
  display: grid;
  grid-template-columns: 1fr auto;
  grid-template-rows: auto auto;
  gap: 0.1rem 0.5rem;
  text-align: left;
  padding: 0.45rem 0.55rem;
  cursor: pointer;
  background: #2a2520;
  border: 1px solid #4a4030;
  color: #e8dcc8;
  border-radius: 4px;
  font: inherit;
}
.lu-feat-card:hover {
  border-color: #8ab060;
  background: #323028;
}
.lu-feat-card strong {
  grid-column: 1;
}
.lu-feat-type {
  grid-column: 2;
  font-size: 0.68rem;
  text-transform: uppercase;
  color: #c9a227;
  align-self: start;
}
.lu-feat-sum {
  grid-column: 1 / -1;
  font-size: 0.75rem;
  line-height: 1.3;
}
.lu-feat-locked {
  margin-top: 0.5rem;
  font-size: 0.78rem;
}
.lu-feat-locked-list {
  margin: 0.3rem 0 0;
  padding-left: 1.1rem;
  color: #9a8a70;
}
.levelup-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid #3a3530;
}
.levelup-header h2 {
  margin: 0;
  font-size: 1.15rem;
  font-weight: 600;
}
.levelup-body {
  padding: 0.75rem 1rem 1rem;
}
.lu-preview ul {
  margin: 0.35rem 0 0.75rem;
  padding-left: 1.2rem;
}
.lu-pts {
  float: right;
  font-size: 0.85rem;
  color: #e8c86a;
}
.lu-skill-scroll {
  max-height: 280px;
  overflow: auto;
  margin: 0.5rem 0;
  border: 1px solid #3a3530;
  border-radius: 4px;
}
.lu-skill-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8rem;
  font-variant-numeric: tabular-nums;
}
.lu-skill-table th,
.lu-skill-table td {
  padding: 0.25rem 0.4rem;
  border-bottom: 1px solid #2a2520;
  text-align: left;
}
.lu-pending {
  color: #8fd48f;
}
.lu-actions button {
  margin-right: 0.2rem;
  min-width: 1.6rem;
  cursor: pointer;
  background: #3a342c;
  border: 1px solid #6a5a40;
  color: #e8dcc8;
  border-radius: 3px;
}
.lu-actions button:disabled {
  opacity: 0.4;
  cursor: default;
}
.lu-footer {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
  margin-top: 0.75rem;
  padding-top: 0.75rem;
  border-top: 1px solid #3a3530;
}
.lu-btn {
  padding: 0.4rem 0.9rem;
  cursor: pointer;
  background: #3a342c;
  border: 1px solid #6a5a40;
  color: #e8dcc8;
  border-radius: 4px;
}
.lu-btn.primary {
  background: #3a5030;
  border-color: #6a9050;
}
.lu-btn:hover {
  filter: brightness(1.1);
}
#btn-level-up {
  color: #e8c86a;
}
#btn-level-up.lu-ready {
  box-shadow: 0 0 0 1px #e8c86a66;
  display: inline-flex;
}
#btn-level-up.hidden {
  display: none;
}
.party-row #btn-level-up {
  margin-left: 0.4rem;
  align-self: center;
}
.lu-footer {
  flex-wrap: wrap;
}
#btn-level-up:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}
.tome-multiclass {
  margin-top: 0.5rem;
  padding: 0.5rem;
  border: 1px solid #3a3530;
  border-radius: 4px;
}
.mc-row {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  margin: 0.4rem 0;
}
.mc-row select {
  flex: 1;
  background: #1a1612;
  color: #e8dcc8;
  border: 1px solid #6a5a40;
  padding: 0.3rem;
  border-radius: 3px;
}

.chud-saves {
  font-size: 0.72rem;
  opacity: 0.85;
  font-variant-numeric: tabular-nums;
  color: #b8c8a8;
}

.chud-line.kind-save,
.chud-line.save {
  color: #d4c48a;
}

.chud-injury {
  color: #e07070;
  font-weight: 600;
  text-transform: uppercase;
  font-size: 0.85em;
}

.chud-line.kind-injury,
.chud-line.injury {
  color: #e09070;
}

.chud-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
  justify-content: center;
}

.act-chip {
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 0.15rem 0.4rem;
  border-radius: 4px;
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.act-chip.ok {
  color: #c8f0c8;
  border-color: rgba(100, 180, 100, 0.55);
  background: rgba(40, 80, 40, 0.45);
}

.act-chip.used {
  color: #8a9098;
  opacity: 0.55;
  text-decoration: line-through;
}

.chud-key.chud-feat.active {
  background: rgba(90, 70, 30, 0.85);
  border-color: rgba(220, 180, 80, 0.75);
  box-shadow: 0 0 0 1px rgba(201, 162, 39, 0.45);
}
.chud-key.hidden {
  display: none;
}
.chud-key em.cost {
  font-size: 0.58rem;
  opacity: 0.65;
  font-style: normal;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.chud-init {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
}

.chud-chip {
  flex: 1 1 4.5rem;
  min-width: 4.2rem;
  padding: 0.25rem 0.35rem;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
}

.chud-chip.active {
  border-color: var(--tome-gold, #c9a227);
  box-shadow: 0 0 0 1px rgba(201, 162, 39, 0.35);
}

.chud-chip.foe {
  background: rgba(120, 30, 30, 0.35);
}

.chud-chip.down {
  opacity: 0.45;
}

.chud-chip-name {
  display: block;
  font-weight: 600;
  font-size: 0.72rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.chud-chip-bar {
  display: block;
  height: 4px;
  margin: 0.2rem 0;
  background: rgba(0, 0, 0, 0.35);
  border-radius: 2px;
  overflow: hidden;
}

.chud-chip-bar i {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, #3d8f5a, #7dca6a);
}

.chud-chip.foe .chud-chip-bar i {
  background: linear-gradient(90deg, #a03030, #e07070);
}

.chud-chip-hp {
  font-size: 0.68rem;
  font-variant-numeric: tabular-nums;
  opacity: 0.8;
}

.chud-main {
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: 0.45rem;
}

.chud-foe-name {
  font-weight: 700;
  color: #ffb4b4;
  margin-bottom: 0.2rem;
}

.chud-hp-bar {
  height: 10px;
  background: rgba(0, 0, 0, 0.4);
  border-radius: 4px;
  overflow: hidden;
  border: 1px solid rgba(160, 80, 80, 0.5);
}

.chud-hp-fill {
  display: block;
  height: 100%;
  width: 100%;
  background: linear-gradient(90deg, #8b2020, #d05050);
  transition: width 0.2s ease;
}

.chud-hp-fill.low {
  background: linear-gradient(90deg, #5a1010, #c03030);
}

.chud-hp-label {
  font-size: 0.72rem;
  margin-top: 0.15rem;
  opacity: 0.85;
  font-variant-numeric: tabular-nums;
}

.chud-party-v {
  font-size: 0.72rem;
  line-height: 1.35;
  opacity: 0.9;
}

.chud-party-v .down {
  opacity: 0.45;
  text-decoration: line-through;
}

.chud-log-wrap {
  display: flex;
  flex-direction: column;
  min-height: 0;
  flex: 1 1 auto;
}

.chud-log-filters {
  display: flex;
  gap: 0.25rem;
  margin-bottom: 0.2rem;
}

.chud-log-filters button {
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: #c8d0dc;
  font-size: 0.68rem;
  padding: 0.15rem 0.45rem;
  border-radius: 4px;
  cursor: pointer;
}

.chud-log-filters button.active {
  border-color: var(--tome-gold, #c9a227);
  color: #f5ecd8;
  background: rgba(201, 162, 39, 0.15);
}

.chud-log {
  list-style: none;
  margin: 0;
  padding: 0.25rem 0.35rem;
  max-height: 7.5rem;
  overflow: auto;
  background: rgba(0, 0, 0, 0.28);
  border-radius: 6px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  font-size: 0.72rem;
  line-height: 1.35;
}

.chud-line {
  padding: 0.12rem 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.chud-line.dmg {
  color: #ffb0a0;
}

.chud-line.heal {
  color: #8fd49a;
}

.chud-line.ok {
  color: #d4c07a;
  font-weight: 600;
}

.chud-line.bad {
  color: #ff8080;
  font-weight: 600;
}

.chud-hotbar {
  display: flex;
  gap: 0.35rem;
  flex-wrap: wrap;
}

.chud-key {
  flex: 1 1 4.5rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.1rem;
  padding: 0.4rem 0.35rem;
  background: #5a2828;
  border: 1px solid #c07070;
  border-radius: 8px;
  color: #f0e6e0;
  cursor: pointer;
  font-weight: 600;
  min-width: 4.2rem;
}

.chud-key:hover:not(:disabled) {
  background: #6e3232;
  border-color: #e09090;
}

.chud-key:disabled,
.chud-key.disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.chud-key kbd {
  font-size: 0.65rem;
  opacity: 0.7;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 3px;
  padding: 0 0.25rem;
  font-family: inherit;
}

.chud-key em {
  font-style: normal;
  font-size: 0.65rem;
  opacity: 0.75;
}

.chud-key.chud-flee {
  background: #2a3040;
  border-color: #7080a0;
}

@media (max-width: 700px) {
  .chud-main {
    grid-template-columns: 1fr;
  }
  .combat-dock {
    max-height: 60vh;
  }
}

/* ═══════════════════════════════════════════════════════════════════════════
   S24 — Look & feel (E54 / Sprint 10 E1–E4)
   Parchment/gold/iron game chrome · enter splash · utility icons · party frames
   ═══════════════════════════════════════════════════════════════════════════ */

#screen-game {
  --tome-shadow: 0 8px 28px rgba(0, 0, 0, 0.5);
  --frame-ornament: linear-gradient(
    135deg,
    rgba(201, 162, 39, 0.55) 0%,
    rgba(90, 70, 30, 0.2) 40%,
    rgba(201, 162, 39, 0.45) 100%
  );
}

/* —— Game header: iron + gold rail —— */
#screen-game .game-top,
#screen-game > .top {
  background:
    linear-gradient(180deg, #2a2218 0%, #1a1612 55%, #12100e 100%);
  border-bottom: 2px solid var(--tome-gold);
  box-shadow:
    0 2px 0 rgba(232, 220, 196, 0.08),
    0 6px 18px rgba(0, 0, 0, 0.45);
}

#screen-game .brand {
  color: var(--tome-gold);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  font-size: 0.82rem;
  text-shadow: 0 1px 0 #000, 0 0 12px rgba(201, 162, 39, 0.35);
}

#screen-game .game-clock {
  border-color: rgba(201, 162, 39, 0.45);
  background: rgba(201, 162, 39, 0.1);
  color: #e8d48a;
  border-radius: 3px;
  font-family: "Palatino Linotype", "Book Antiqua", Palatino, Georgia, serif;
}

#screen-game .status {
  color: #b8a88a;
}

#screen-game .top .actions button {
  background: linear-gradient(180deg, #3a3228, #241e18);
  border: 1px solid rgba(201, 162, 39, 0.45);
  color: #e8dcc4;
  border-radius: 4px;
  letter-spacing: 0.04em;
  font-size: 0.78rem;
}

#screen-game .top .actions button:hover {
  border-color: var(--tome-gold);
  background: linear-gradient(180deg, #4a3e2e, #2e261c);
}

#screen-game .top .actions button.active {
  background: linear-gradient(180deg, #4a5030, #2a3018);
  border-color: var(--tome-gold);
  color: #f0e6c8;
  box-shadow: inset 0 0 0 1px rgba(201, 162, 39, 0.25);
}

/* —— Area title plate —— */
#screen-game .hud-top h1#area-title {
  font-family: "Palatino Linotype", "Book Antiqua", Palatino, Georgia, serif;
  color: #f0e6c8;
  text-shadow: 0 2px 8px #000, 0 0 1px #000;
  letter-spacing: 0.03em;
  border-bottom: 1px solid rgba(201, 162, 39, 0.35);
  padding-bottom: 0.15rem;
  display: inline-block;
}

/* —— Enter splash (S24 E2) —— */
.area-splash {
  position: absolute;
  inset: 0;
  z-index: 12;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: auto;
  cursor: pointer;
  background: radial-gradient(
    ellipse at center,
    rgba(12, 10, 8, 0.55) 0%,
    rgba(8, 6, 4, 0.72) 70%
  );
  animation: splash-fade-in 0.35s ease-out;
}

.area-splash.hidden {
  display: none !important;
}

.area-splash-frame {
  max-width: min(28rem, 88vw);
  padding: 1.35rem 1.75rem 1.45rem;
  text-align: center;
  background:
    linear-gradient(165deg, #f2e8d4 0%, var(--tome-parchment) 45%, #d4c4a4 100%);
  color: var(--tome-ink);
  border: 2px solid var(--tome-gold);
  border-radius: 6px;
  box-shadow:
    var(--tome-shadow),
    inset 0 0 0 1px rgba(255, 255, 255, 0.35),
    inset 0 0 40px rgba(90, 60, 20, 0.08);
  animation: splash-rise 0.45s ease-out;
}

.area-splash-kicker {
  display: block;
  font-size: 0.68rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--tome-banner);
  margin-bottom: 0.35rem;
}

.area-splash-title {
  margin: 0 0 0.45rem;
  font-family: "Palatino Linotype", "Book Antiqua", Palatino, Georgia, serif;
  font-size: clamp(1.35rem, 3.5vw, 1.85rem);
  font-weight: 700;
  color: #2a1810;
  letter-spacing: 0.02em;
}

.area-splash-summary {
  margin: 0;
  font-size: 0.88rem;
  line-height: 1.45;
  color: #4a3c2c;
  max-height: 4.5rem;
  overflow: hidden;
}

.area-splash-summary.hidden {
  display: none;
}

@keyframes splash-fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes splash-rise {
  from {
    opacity: 0;
    transform: translateY(12px) scale(0.97);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* —— Utility cluster icons —— */
.utility-cluster .util-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.1rem;
  min-width: 3rem;
  padding: 0.35rem 0.4rem 0.3rem;
  background: linear-gradient(180deg, rgba(40, 34, 26, 0.94), rgba(18, 16, 14, 0.96));
  border: 1px solid rgba(201, 162, 39, 0.4);
  border-radius: 6px;
  color: var(--tome-gold);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
}

.utility-cluster .util-btn:hover {
  border-color: var(--tome-gold);
  background: linear-gradient(180deg, rgba(55, 46, 32, 0.98), rgba(28, 24, 18, 0.98));
}

.utility-cluster .util-btn.active {
  background: linear-gradient(180deg, rgba(70, 80, 40, 0.95), rgba(35, 42, 20, 0.98));
  box-shadow: inset 0 0 0 1px rgba(201, 162, 39, 0.35);
}

.utility-cluster .util-ico {
  font-size: 1rem;
  line-height: 1.1;
  filter: drop-shadow(0 1px 1px #000);
}

.utility-cluster .util-lbl {
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #e0d4b8;
}

.utility-cluster .util-btn.lu-ready {
  border-color: #e0c060;
  box-shadow: 0 0 10px rgba(201, 162, 39, 0.45);
}

/* —— Party strip portrait frames —— */
.party-strip .party-chip {
  gap: 0.4rem;
  padding: 0.28rem 0.55rem 0.28rem 0.28rem;
  background: linear-gradient(180deg, rgba(36, 30, 22, 0.94), rgba(16, 14, 12, 0.96));
  border: 1px solid rgba(201, 162, 39, 0.4);
  border-radius: 8px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.35);
}

.party-strip .party-chip.pc {
  border-color: rgba(201, 162, 39, 0.7);
  box-shadow: 0 0 0 1px rgba(201, 162, 39, 0.15), 0 2px 12px rgba(0, 0, 0, 0.4);
}

.party-strip .chip-portrait {
  width: 2rem;
  height: 2rem;
  border-radius: 4px;
  border: 1px solid var(--tome-gold);
  object-fit: cover;
  flex-shrink: 0;
  background: #2a2218;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.35);
}

.party-strip .chip-initials {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: #e8d48a;
  background: linear-gradient(160deg, #4a3a28, #2a2018);
}

.party-strip .chip-meta {
  display: flex;
  flex-direction: column;
  gap: 0.05rem;
  min-width: 0;
}

.party-strip .chip-name {
  color: #f0e6c8;
  font-size: 0.78rem;
}

.party-strip .chip-hp {
  font-size: 0.7rem;
  color: #9aaa8a;
}

/* —— Quest / talk / settlement docks: gold frames —— */
.quest-dock,
.talk-dock,
.settlement-dock {
  border-color: rgba(201, 162, 39, 0.45) !important;
  box-shadow: var(--tome-shadow), inset 0 0 0 1px rgba(201, 162, 39, 0.08);
}

.quest-kicker,
.talk-kicker,
.settlement-kicker {
  color: var(--tome-gold) !important;
}

/* —— Exit buttons —— */
#screen-game .exit-list button {
  background: linear-gradient(180deg, rgba(40, 36, 28, 0.92), rgba(22, 20, 16, 0.95));
  border: 1px solid rgba(201, 162, 39, 0.35);
  color: #e8dcc4;
  border-radius: 4px;
}

#screen-game .exit-list button:hover {
  border-color: var(--tome-gold);
  color: #fff4d8;
}

#screen-game .btn-talk {
  background: linear-gradient(180deg, #4a3428, #2a1c14);
  border: 1px solid rgba(201, 162, 39, 0.5);
  color: #f0e6c8;
}

/* —— Toast parchment tint —— */
#screen-game .toast {
  background: linear-gradient(180deg, rgba(40, 32, 22, 0.96), rgba(20, 16, 12, 0.97));
  border-color: var(--tome-gold);
  color: #f0e8d0;
  font-family: "Palatino Linotype", "Book Antiqua", Palatino, Georgia, serif;
}

/* —— Combat dock frame polish —— */
#screen-game .combat-dock {
  border: 1px solid rgba(201, 162, 39, 0.4);
  box-shadow: 0 -4px 24px rgba(0, 0, 0, 0.5), inset 0 1px 0 rgba(201, 162, 39, 0.12);
}

/* —— Dead panel —— */
#screen-game .dead-panel {
  background: rgba(40, 16, 16, 0.92);
  border: 1px solid #a04040;
  border-radius: 8px;
  padding: 0.75rem 1rem;
}

/* ==========================================================================
   tome-style character creation (#screen-char)
   Comps: vaults/seldorak/comps/pathfinder · race/class/abilities stills
   ========================================================================== */

#screen-char {
  --tome-parchment: #e8dcc4;
  --tome-parchment-deep: #d4c4a8;
  --tome-ink: #2a2118;
  --tome-ink-soft: #4a3f32;
  --tome-gold: #c9a227;
  --tome-gold-bright: #e8c84a;
  --tome-iron: #3d3a36;
  --tome-banner: #7a2e24;
  --tome-banner-edge: #5a2218;
  --tome-frame: #8a7040;
  --km-shadow: rgba(40, 28, 12, 0.45);
  display: flex;
  flex-direction: column;
  min-height: 0;
  height: 100%;
  background:
    radial-gradient(ellipse at 50% 0%, rgba(60, 48, 28, 0.35) 0%, transparent 55%),
    linear-gradient(180deg, #1a1612 0%, #0c0a08 100%);
  font-family: "Palatino Linotype", "Book Antiqua", Palatino, Georgia, serif;
  color: var(--tome-ink);
}

#screen-char.hidden {
  display: none;
}

.km-chargen {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  max-width: none;
  width: 100%;
  height: 100%;
  margin: 0;
  padding: 0;
  overflow: hidden;
  text-align: left;
  box-sizing: border-box;
}

/* —— Top tab rail —— */
.km-tabs {
  display: flex;
  align-items: stretch;
  flex-shrink: 0;
  gap: 0;
  background: linear-gradient(180deg, #2a241c 0%, #1a1610 100%);
  border-bottom: 2px solid var(--tome-gold);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.5);
  z-index: 2;
}

.km-tab {
  appearance: none;
  border: none;
  background: transparent;
  color: #8a8070;
  font-family: Cinzel, "Palatino Linotype", Georgia, serif;
  font-size: clamp(0.72rem, 1.4vw, 0.92rem);
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  padding: 0.75rem 1.1rem;
  cursor: pointer;
  position: relative;
  transition: color 0.15s, background 0.15s;
}

.km-tab:hover:not(:disabled) {
  color: #d8c8a0;
  background: rgba(201, 162, 39, 0.08);
}

.km-tab.active {
  color: var(--tome-gold-bright);
  background: linear-gradient(180deg, rgba(201, 162, 39, 0.18), transparent);
  text-shadow: 0 0 12px rgba(201, 162, 39, 0.35);
}

.km-tab.active::after {
  content: "";
  position: absolute;
  left: 12%;
  right: 12%;
  bottom: 0;
  height: 3px;
  background: linear-gradient(90deg, transparent, var(--tome-gold), transparent);
}

.km-tab:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.km-tabs-spacer {
  flex: 1;
}

.km-tab-close,
.km-choice-dismiss {
  font-size: 1.35rem;
  letter-spacing: 0;
  padding: 0.5rem 1rem;
  color: #a09080;
  background: transparent;
  border: 0;
  cursor: pointer;
}

/* —— Chargen readability (CRT overlay): +1 size, min 12px —— */
.km-chargen {
  font-size: max(12px, 1.1rem);
  line-height: 1.45;
}
.km-chargen .km-pb-note,
.km-chargen .km-choice-hint,
.km-chargen .km-skill-meta,
.km-chargen .km-feat-prereq,
.km-chargen .km-feat-type,
.km-chargen .km-detail-kicker,
.km-chargen .km-appear-label,
.km-chargen .km-prereq-hint,
.km-chargen .km-exemplar-caption,
.km-chargen .points-tray-hint,
.km-chargen .km-spell-school {
  font-size: max(12px, 0.9rem) !important;
  line-height: 1.4;
}
.km-chargen .km-blurb,
.km-chargen .km-long-desc,
.km-chargen .km-align-description {
  font-size: max(12px, 1.05rem);
  line-height: 1.5;
}
.km-chargen .km-skill-name,
.km-chargen .km-feat-name,
.km-chargen .km-spell-name {
  font-size: max(12px, 1rem) !important;
}
.km-chargen .km-chip {
  font-size: max(12px, 0.82rem) !important;
  padding: 0.38rem 0.65rem !important;
}
.km-chargen .km-pick {
  font-size: max(12px, 1.08rem);
}
.km-chargen .km-stat-chip,
.km-chargen .km-stat-val,
.km-chargen .km-banner,
.km-chargen .km-detail-title,
.km-chargen .km-subhead {
  font-size: max(12px, 1rem);
}
.km-chargen .km-btn {
  font-size: max(12px, 0.95rem);
}
.km-chargen table.km-prog-table {
  font-size: max(12px, 0.92rem);
}
.km-align-description {
  margin: 0.65rem 0 0;
  padding: 0.55rem 0.65rem;
  border: 1px solid rgba(90, 70, 40, 0.28);
  border-radius: 4px;
  background: rgba(255, 252, 245, 0.55);
  color: var(--tome-ink);
  white-space: pre-wrap;
}
.km-skills-layout,
.km-feats-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(14rem, 0.75fr);
  gap: 0;
  min-height: 0;
  height: 100%;
  overflow: hidden;
}
.km-detail-side {
  border-left: 1px solid rgba(90, 70, 40, 0.28);
  padding: 0.75rem 0.85rem 1rem;
  overflow-y: auto;
  background: linear-gradient(180deg, rgba(255, 250, 240, 0.65), rgba(220, 205, 175, 0.35));
  min-height: 0;
}
.km-long-desc {
  margin: 0.35rem 0 0;
  white-space: pre-wrap;
  color: var(--tome-ink);
}
.km-skill-row.is-selected,
.km-feat-row.is-selected {
  outline: 2px solid var(--tome-gold);
  outline-offset: -1px;
  background: rgba(201, 162, 39, 0.12);
}
.km-step-skills,
.km-step-feats {
  display: block;
  min-height: 0;
  overflow: hidden;
  height: 100%;
}

/* —— Body: rail + main —— */
.km-body {
  display: grid;
  /* Left rail: portrait + race/class pickers */
  grid-template-columns: minmax(13.5rem, 16rem) 1fr;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

/* Rail step panels (race list / class list) */
.km-rail-step {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  gap: 0.35rem;
}
.km-rail-step.hidden,
.km-rail-step[hidden] {
  display: none !important;
}
.km-banner-rail {
  font-size: 0.72rem;
  padding: 0.4rem 0.5rem;
  border-radius: 2px;
}
.km-rail-step .km-pick-list {
  flex: 1 1 auto;
  max-height: none;
  min-height: 6rem;
}
.km-rail-race-detail {
  flex: 0 1 auto;
  overflow-y: auto;
  max-height: 28vh;
  padding: 0.25rem 0.15rem;
  border-top: 1px solid rgba(90, 70, 40, 0.25);
}
.km-rail-race-detail .km-detail-title {
  font-size: 1rem;
  margin: 0.2rem 0 0.15rem;
}
.km-rail-race-detail .km-blurb {
  font-size: 0.78rem;
  line-height: 1.35;
}
.km-rail .km-age-note {
  margin-top: auto;
  flex-shrink: 0;
  font-size: 0.68rem;
  line-height: 1.3;
  padding: 0.45rem 0.2rem 0.15rem;
  border-top: 1px solid rgba(90, 70, 40, 0.28);
  color: var(--tome-ink-soft);
}
.km-col-appear {
  overflow-y: auto;
  padding: 0.85rem 1.15rem 1.15rem;
  display: flex;
  flex-direction: column;
  min-height: 0;
  height: 100%;
}
.km-col-appear .km-appearance {
  max-width: none;
  width: 100%;
  flex: 1 1 auto;
  gap: 0.45rem;
}
.km-col-appear .km-avatar-gen {
  font-size: max(12px, 1rem);
  padding: 0.55rem 0.75rem;
}
.km-col-appear .km-swatch-row,
.km-col-appear .km-hair-layout {
  justify-content: flex-start;
}
.km-col-appear .km-chip {
  min-width: 3.2rem;
  flex: 1 1 4.5rem;
}
.km-col-appear .km-avatar-notes {
  min-height: 4.5rem;
  flex: 1 1 auto;
  max-height: none;
  font-size: max(12px, 0.95rem);
}
.km-col-class-wide {
  overflow-y: auto;
  padding: 0.75rem 1rem 1.25rem;
  min-height: 0;
}
.km-col-art-top {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  justify-content: flex-start;
  padding-top: 0.5rem;
  overflow-y: auto;
  min-height: 0;
}
.km-col-art-top .km-art-frame {
  align-self: center;
  margin-top: 0;
  max-height: 16rem;
  width: min(100%, 16rem);
}
.km-spell-side {
  border-left: none;
  border-top: 1px solid rgba(90, 70, 40, 0.28);
  margin-top: 0.5rem;
  flex: 1 1 auto;
  min-height: 8rem;
}
/* Blank until a spell / divinity / path is selected */
.km-detail-side.is-empty,
.km-spell-side.is-empty {
  opacity: 0.55;
}
.km-detail-side.is-empty .km-subhead:empty,
.km-spell-side.is-empty .km-subhead:empty {
  display: none;
}
.km-detail-side.is-empty::after,
.km-spell-side.is-empty::after {
  content: "";
  display: block;
  min-height: 4rem;
}
.km-prog-scroll {
  max-height: min(42vh, 22rem);
  overflow: auto;
  border: 1px solid rgba(90, 70, 40, 0.25);
  border-radius: 4px;
  background: rgba(255, 252, 245, 0.45);
}
.km-spell-level-row {
  margin: 0.35rem 0 0.5rem;
}
.km-spell-list-pick {
  list-style: none;
  margin: 0;
  padding: 0.25rem;
  max-height: min(28vh, 14rem);
  overflow-y: auto;
  border: 1px solid rgba(90, 70, 40, 0.25);
  border-radius: 4px;
  background: rgba(255, 252, 245, 0.5);
}
.km-spell-item {
  display: flex;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.35rem 0.5rem;
  border-radius: 3px;
  cursor: pointer;
}
.km-spell-item:hover,
.km-spell-item.is-selected {
  background: rgba(201, 162, 39, 0.14);
  outline: 1px solid var(--tome-gold);
}
.km-spell-name {
  font-weight: 700;
}
.km-spell-school {
  opacity: 0.8;
  text-transform: capitalize;
}
.km-race-art-top {
  align-self: start;
}

/* —— Gear step: paper doll + pack + Initial Buy —— */
/* Full-bleed main (no identity rail) — same pattern as World globe */
.km-chargen.char-gear-mode .km-rail {
  display: none;
}
.km-chargen.char-gear-mode .km-body {
  grid-template-columns: 1fr;
}

/* —— Starting companion (Party) step —— */
.km-step-companion {
  display: block;
  min-height: 0;
  height: 100%;
  overflow: auto;
  padding: 0.75rem 1rem 1.25rem;
}
.km-companion-layout {
  max-width: 72rem;
  margin: 0 auto;
}
.km-companion-head {
  margin-bottom: 0.75rem;
}
.km-companion-head .km-subhead {
  margin: 0 0 0.35rem;
  font-family: Cinzel, Georgia, serif;
  color: #e8d090;
}
.km-companion-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(15.5rem, 1fr));
  gap: 0.65rem;
}
.km-comp-card {
  text-align: left;
  padding: 0.65rem 0.7rem 0.75rem;
  border-radius: 12px;
  border: 1px solid rgba(201, 162, 39, 0.35);
  background: linear-gradient(165deg, rgba(28, 24, 18, 0.92), rgba(14, 12, 10, 0.95));
  color: #e8edf4;
  cursor: pointer;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.35);
  transition: border-color 0.15s, box-shadow 0.15s, transform 0.12s;
}
.km-comp-card:hover {
  border-color: rgba(232, 200, 106, 0.65);
}
.km-comp-card.is-active {
  border-color: rgba(232, 200, 106, 0.95);
  box-shadow:
    0 0 16px rgba(232, 200, 106, 0.35),
    0 8px 22px rgba(0, 0, 0, 0.4);
  transform: translateY(-1px);
}
.km-comp-top {
  display: flex;
  gap: 0.55rem;
  align-items: flex-start;
  margin-bottom: 0.4rem;
}
.km-comp-face {
  width: 3rem;
  height: 3rem;
  border-radius: 10px;
  object-fit: cover;
  flex: 0 0 auto;
  border: 1px solid rgba(201, 162, 39, 0.4);
  background: rgba(40, 32, 24, 0.9);
}
.km-comp-initial {
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 1.25rem;
  color: #e8d090;
  font-family: Cinzel, Georgia, serif;
}
.km-comp-meta {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.08rem;
}
.km-comp-meta strong {
  font-size: 0.95rem;
  color: #f0e8d0;
}
.km-comp-title {
  font-size: 0.72rem;
  color: #c9a227;
}
.km-comp-line {
  font-size: 0.68rem;
  color: #a09070;
}
.km-comp-sum {
  margin: 0;
  font-size: 0.74rem;
  line-height: 1.4;
  color: #c8c0b0;
}
.km-companion-pick {
  margin: 0.85rem 0 0;
  font-size: 0.85rem;
  color: #e8d090;
}

.km-step-gear {
  display: block;
  min-height: 0;
  height: 100%;
  overflow: hidden;
}
.km-gear-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr);
  gap: 0;
  height: 100%;
  min-height: 0;
}
/* Doll column wider now that the left rail is gone */
.km-gear-layout-3 {
  grid-template-columns: minmax(22rem, 1.55fr) minmax(12rem, 0.85fr) minmax(12rem, 0.95fr);
}
.km-gear-panel {
  padding: 0.55rem 0.85rem 0.85rem;
  overflow-y: auto;
  min-height: 0;
  border-right: 1px solid rgba(90, 70, 40, 0.25);
}
.km-merchant-panel {
  border-right: none;
}
.km-gear-doll-panel {
  display: flex;
  flex-direction: column;
  min-height: 0;
  /* Horizontal room so ring / hand slots on the figure rim aren't clipped */
  padding-left: 1.25rem;
  padding-right: 1.25rem;
}
.km-gear-doll-panel > .km-pb-note {
  margin: 0 0 0.3rem;
  font-size: max(12px, 0.8rem);
}
.km-gear-doll-panel > .points-tray {
  margin-bottom: 0.35rem;
  flex: 0 0 auto;
}

/* —— Encumbrance meter (Pathfinder inventory style) —— */
.km-encumbrance {
  flex: 0 0 auto;
  margin: 0 0 0.45rem;
  padding: 0.4rem 0.5rem 0.35rem;
  border: 1px solid rgba(90, 70, 40, 0.28);
  border-radius: 5px;
  background: rgba(255, 252, 245, 0.55);
}
.km-enc-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.3rem;
  font-size: max(12px, 0.78rem);
}
.km-enc-band {
  font-weight: 700;
  color: var(--tome-banner, #7a2e24);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-size: 0.72rem;
}
.km-encumbrance[data-band="light"] .km-enc-band {
  color: #2f6b3a;
}
.km-encumbrance[data-band="medium"] .km-enc-band {
  color: #8a6a12;
}
.km-encumbrance[data-band="heavy"] .km-enc-band {
  color: #9a4a12;
}
.km-encumbrance[data-band="overloaded"] .km-enc-band {
  color: #8b1e1e;
}
.km-enc-weight {
  font-weight: 600;
  flex: 1;
  text-align: center;
  color: var(--tome-ink, #2a2018);
}
.km-enc-pct {
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  min-width: 2.75rem;
  text-align: right;
}
.km-enc-bar {
  position: relative;
  height: 0.85rem;
  border-radius: 3px;
  border: 1px solid rgba(90, 70, 40, 0.4);
  overflow: hidden;
  background: rgba(40, 30, 18, 0.08);
}
.km-enc-zones {
  position: absolute;
  inset: 0;
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  pointer-events: none;
}
.km-enc-zone.light {
  background: rgba(70, 140, 80, 0.12);
}
.km-enc-zone.medium {
  background: rgba(200, 160, 40, 0.14);
}
.km-enc-zone.heavy {
  background: rgba(180, 80, 40, 0.12);
}
.km-enc-fill {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 0%;
  border-radius: 2px 0 0 2px;
  transition: width 0.18s ease, background 0.15s ease;
  background: linear-gradient(90deg, #4a9a55, #3d8548);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.15);
  z-index: 1;
}
.km-enc-fill[data-band="medium"] {
  background: linear-gradient(90deg, #c9a227, #a88820);
}
.km-enc-fill[data-band="heavy"] {
  background: linear-gradient(90deg, #c46a28, #a05018);
}
.km-enc-fill[data-band="overloaded"] {
  background: linear-gradient(90deg, #b83838, #8b1e1e);
  width: 100% !important;
}
.km-enc-ticks {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 2;
}
.km-enc-tick {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 1px;
  background: rgba(40, 28, 12, 0.45);
  transform: translateX(-0.5px);
}
.km-enc-scale {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr 1fr;
  margin-top: 0.2rem;
  font-size: 0.65rem;
  opacity: 0.75;
  font-variant-numeric: tabular-nums;
}
.km-enc-scale span:nth-child(1) {
  text-align: left;
}
.km-enc-scale span:nth-child(2),
.km-enc-scale span:nth-child(3) {
  text-align: center;
}
.km-enc-scale span:nth-child(4) {
  text-align: right;
}
.km-enc-note {
  margin: 0.25rem 0 0;
  font-size: max(11px, 0.7rem);
  opacity: 0.8;
  line-height: 1.3;
}

/* —— Party paper-doll switcher + purse —— */
.km-party-select {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem 0.55rem;
  width: min(100%, 36rem);
  margin-bottom: 0.35rem;
}
.km-rename-row {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  width: 100%;
  margin-top: 0.15rem;
}
.km-rename-row[hidden] {
  display: none !important;
}
.km-rename-input {
  flex: 1 1 auto;
  min-width: 8rem;
  max-width: 16rem;
  padding: 0.28rem 0.45rem;
  border: 1px solid rgba(90, 70, 40, 0.35);
  border-radius: 4px;
  background: rgba(255, 252, 245, 0.9);
  color: var(--tome-ink, #2a2018);
  font: inherit;
  font-size: max(12px, 0.82rem);
}
.km-rename-input:focus {
  outline: 2px solid rgba(201, 162, 39, 0.45);
  border-color: var(--tome-gold, #c9a227);
}
/* Stage: figure in the center, equip rails outside the Vitruvian circle */
.km-doll-stage {
  position: relative;
  display: grid;
  grid-template-columns: 4.2rem minmax(0, 1fr) 4.2rem;
  grid-template-rows: auto;
  align-items: stretch;
  width: min(100%, 36rem);
  margin: 0 auto;
  gap: 0.15rem 0.35rem;
}
.km-doll-stage > .km-doll-figure {
  grid-column: 2;
  grid-row: 1;
  width: 100%;
  max-width: 26rem;
  margin: 0 auto;
}
.km-slot-layer.km-slot-rails {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 3;
}
.km-slot-layer.km-slot-rails .km-doll-slot {
  pointer-events: auto;
  position: absolute;
  top: var(--ry, 50%);
  transform: translateY(-50%);
  left: auto;
  right: auto;
}
.km-slot-layer.km-slot-rails .km-doll-slot[data-rail="L"] {
  left: 0.1rem;
  right: auto;
  transform: translate(0, -50%);
}
.km-slot-layer.km-slot-rails .km-doll-slot[data-rail="R"] {
  right: 0.1rem;
  left: auto;
  transform: translate(0, -50%);
}
.km-slot-layer.km-slot-rails .km-doll-slot {
  width: 3.9rem;
  min-height: 2.7rem;
}
.km-slot-layer.hidden {
  display: none !important;
}
/* Kill the grey silhouette blob forever when a figure is present */
.km-doll-ph[hidden],
.km-doll-figure.has-art .km-doll-ph {
  display: none !important;
  visibility: hidden !important;
  opacity: 0 !important;
}
.km-doll-figure {
  /* Flat parchment only — no radial “blob” ellipse behind the art */
  background: linear-gradient(180deg, #f3ead4, #e2d4b4) !important;
  position: relative;
}
/* Imagine outfit redraw spinner */
.km-doll-spinner {
  position: absolute;
  inset: 0;
  z-index: 5;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.55rem;
  background: rgba(40, 30, 18, 0.38);
  border-radius: 6px;
  color: #f8f0dc;
  font-size: max(12px, 0.8rem);
  font-weight: 600;
  letter-spacing: 0.04em;
  pointer-events: none;
}
.km-doll-spinner.hidden {
  display: none !important;
}
.km-doll-spinner-ring {
  width: 2.4rem;
  height: 2.4rem;
  border-radius: 50%;
  border: 3px solid rgba(255, 250, 235, 0.25);
  border-top-color: #c9a227;
  animation: km-doll-spin 0.75s linear infinite;
}
.km-doll-spinner-label {
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.45);
  max-width: 90%;
  text-align: center;
}
@keyframes km-doll-spin {
  to {
    transform: rotate(360deg);
  }
}
.km-doll-figure.km-mount-figure {
  aspect-ratio: 3 / 4;
  max-height: min(56vh, 34rem);
}
.km-doll-figure.km-familiar-figure {
  aspect-ratio: 1 / 1;
  max-height: min(40vh, 22rem);
}
.km-purse {
  flex: 0 0 auto;
  margin: 0 0 0.45rem;
  padding: 0.4rem 0.5rem 0.35rem;
  border: 1px solid rgba(90, 70, 40, 0.28);
  border-radius: 5px;
  background: rgba(255, 252, 245, 0.55);
}
.km-purse-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 0.5rem;
  margin-bottom: 0.3rem;
}
.km-purse-total {
  font-weight: 700;
  color: var(--tome-banner, #7a2e24);
  font-variant-numeric: tabular-nums;
}
.km-purse-coins {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}
.km-coin {
  display: inline-flex;
  align-items: baseline;
  gap: 0.2rem;
  padding: 0.15rem 0.4rem;
  border-radius: 4px;
  border: 1px solid rgba(90, 70, 40, 0.25);
  background: rgba(255, 250, 235, 0.75);
  font-size: max(11px, 0.72rem);
  font-variant-numeric: tabular-nums;
}
.km-coin[data-metal="pp"] {
  border-color: rgba(180, 180, 200, 0.7);
  background: rgba(220, 220, 235, 0.55);
}
.km-coin[data-metal="gp"] {
  border-color: rgba(201, 162, 39, 0.55);
  background: rgba(201, 162, 39, 0.18);
}
.km-coin[data-metal="ep"] {
  border-color: rgba(160, 140, 90, 0.55);
}
.km-coin[data-metal="sp"] {
  border-color: rgba(150, 150, 160, 0.55);
  background: rgba(200, 200, 210, 0.35);
}
.km-coin[data-metal="cp"] {
  border-color: rgba(160, 100, 60, 0.45);
  background: rgba(180, 110, 70, 0.15);
}
.km-purse-hint {
  margin: 0.35rem 0 0;
  font-size: max(11px, 0.68rem);
  opacity: 0.78;
  line-height: 1.35;
}
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}
.km-doll {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.4rem;
  min-height: 0;
  overflow: visible;
}
/*
 * Figure frame matches vitruvian-figure.jpg (3:4). With object-fit:contain
 * filling the frame, slot --sx/--sy percentages map to image landmarks.
 */
.km-doll-figure {
  position: relative;
  flex: 0 1 auto;
  aspect-ratio: 3 / 4;
  width: min(100%, 34rem);
  max-height: min(72vh, 44rem);
  min-height: 0;
  height: auto;
  margin: 0 auto;
  border: 1px solid rgba(90, 70, 40, 0.35);
  border-radius: 6px;
  background:
    radial-gradient(ellipse at 50% 42%, rgba(255, 252, 240, 0.9), rgba(210, 195, 160, 0.4)),
    linear-gradient(180deg, #ebe2cc, #d4c6a4);
  box-shadow: inset 0 0 0 1px rgba(201, 162, 39, 0.15);
  /* Allow edge slots (rings / hands) to sit on the rim without clipping */
  overflow: visible;
}
.km-doll-img {
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  /* Cover fills the figure box (operator: avatars don't fill the box) */
  object-fit: cover;
  object-position: center top;
  opacity: 0.96;
  pointer-events: none;
}
.shop-doll-chargen .km-doll-img {
  object-fit: cover;
  object-position: center top;
}
/* Option A: bust soft-blended onto template head (must read as one figure, not a sticker) */
.km-doll-face {
  position: absolute;
  left: 50%;
  /* Head sits on neck of Vitruvian full-body (3:4); nudge until continuous */
  top: 7.2%;
  width: 24%;
  aspect-ratio: 0.88;
  transform: translateX(-50%);
  object-fit: cover;
  /* Prefer eyes/mid-face; crop shoulders out of the bust */
  object-position: center 18%;
  pointer-events: none;
  z-index: 2;
  /* Soft oval — no hard circle rim / drop shadow (those read as a pasted coin) */
  border-radius: 48% 48% 46% 46%;
  border: none;
  box-shadow: none;
  background: transparent;
  -webkit-mask-image: radial-gradient(
    ellipse 52% 58% at 50% 42%,
    #000 0%,
    #000 48%,
    rgba(0, 0, 0, 0.55) 68%,
    transparent 86%
  );
  mask-image: radial-gradient(
    ellipse 52% 58% at 50% 42%,
    #000 0%,
    #000 48%,
    rgba(0, 0, 0, 0.55) 68%,
    transparent 86%
  );
  -webkit-mask-repeat: no-repeat;
  mask-repeat: no-repeat;
  -webkit-mask-size: 100% 100%;
  mask-size: 100% 100%;
  /* Slight warm grade so bust oil paint matches parchment body art */
  filter: saturate(0.92) contrast(0.98) brightness(1.02);
  opacity: 0.98;
}
.km-doll-figure.km-mount-figure .km-doll-face,
.km-doll-figure.km-familiar-figure .km-doll-face {
  display: none !important;
}
.km-doll-ph {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}
.km-doll-ph .km-silhouette {
  width: 42%;
  height: 78%;
  border-radius: 42% 42% 28% 28%;
  background: linear-gradient(180deg, rgba(90, 70, 40, 0.22), rgba(60, 45, 25, 0.35));
  border: 1px dashed rgba(90, 70, 40, 0.35);
  position: relative;
}
.km-doll-ph .km-silhouette::before {
  content: "";
  position: absolute;
  left: 50%;
  top: -8%;
  transform: translateX(-50%);
  width: 36%;
  height: 18%;
  border-radius: 50%;
  background: inherit;
  border: inherit;
}
.km-doll-ph .km-silhouette-q {
  position: absolute;
  font-size: 2.5rem;
  font-weight: 700;
  color: rgba(90, 70, 40, 0.35);
}
.km-doll-slot {
  appearance: none;
  position: absolute;
  /* Default center positioning; rail slots override left/right */
  left: var(--sx, auto);
  top: var(--sy, var(--ry, 50%));
  transform: translate(-50%, -50%);
  width: 3.55rem;
  min-height: 2.75rem;
  padding: 0.15rem 0.2rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.05rem;
  border: 1px dashed rgba(90, 70, 40, 0.5);
  border-radius: 5px;
  background: rgba(255, 252, 245, 0.88);
  color: var(--tome-ink);
  font: inherit;
  font-size: max(10px, 0.62rem);
  cursor: pointer;
  z-index: 2;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.12);
  transition: border-color 0.12s, background 0.12s, box-shadow 0.12s;
  backdrop-filter: blur(1px);
}
.km-doll-slot:hover {
  border-color: var(--tome-gold);
  background: rgba(255, 250, 235, 0.97);
  z-index: 3;
}
.km-doll-slot.is-filled {
  border-style: solid;
  border-color: var(--tome-gold);
  background: rgba(201, 162, 39, 0.22);
}
.km-doll-slot.is-target {
  box-shadow: 0 0 0 2px rgba(122, 46, 36, 0.45);
  border-color: #7a2e24;
}
.km-doll-slot.is-locked {
  opacity: 0.55;
  cursor: not-allowed;
  border-style: dotted;
}
.km-doll-slot-weapon {
  width: 4.1rem;
  min-height: 3.1rem;
}
.km-doll-slot-label {
  font-size: 0.58rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  opacity: 0.65;
  line-height: 1;
}
.km-doll-slot-icon {
  width: 1.55rem;
  height: 1.55rem;
  object-fit: contain;
  border-radius: 3px;
  background: rgba(255, 255, 255, 0.4);
}
.km-doll-slot-item {
  font-weight: 600;
  font-size: 0.58rem;
  max-width: 100%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.1;
}
.km-doll-slot-empty {
  opacity: 0.4;
  font-style: italic;
  font-size: 0.58rem;
}
.km-weapon-loadouts {
  width: min(100%, 34rem);
  align-self: center;
  padding: 0.35rem 0 0.15rem;
}
.km-weapon-loadouts .km-appear-label {
  display: block;
  font-size: max(12px, 0.78rem);
  font-weight: 700;
  margin-bottom: 0.25rem;
  color: var(--tome-banner);
}
.km-loadout-key {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.15rem;
  height: 1.15rem;
  margin-right: 0.15rem;
  border-radius: 3px;
  background: rgba(90, 70, 40, 0.12);
  font-weight: 800;
  font-size: 0.72rem;
}
.km-gear-inv {
  list-style: none;
  margin: 0.35rem 0 0.75rem;
  padding: 0;
  border: 1px solid rgba(90, 70, 40, 0.28);
  border-radius: 4px;
  background: rgba(255, 252, 245, 0.55);
}
.km-gear-inv-row {
  display: grid;
  grid-template-columns: 2.4rem minmax(0, 1fr) auto;
  align-items: center;
  gap: 0.45rem;
  padding: 0.4rem 0.55rem;
  border-bottom: 1px solid rgba(90, 70, 40, 0.12);
  font-size: max(12px, 0.95rem);
  cursor: default;
}
.km-gear-inv-row.is-equippable {
  cursor: pointer;
}
.km-gear-inv-row.is-selected {
  outline: 2px solid var(--tome-gold);
  outline-offset: -2px;
  background: rgba(201, 162, 39, 0.14);
}
.km-gear-inv-row:last-child {
  border-bottom: none;
}
.km-gear-item-icon {
  width: 2.25rem;
  height: 2.25rem;
  object-fit: contain;
  border-radius: 4px;
  border: 1px solid rgba(90, 70, 40, 0.22);
  background: rgba(255, 255, 255, 0.45);
}
.km-gear-inv-info {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.05rem;
}
.km-gear-inv-name {
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.km-gear-inv-meta {
  font-size: max(11px, 0.72rem);
  opacity: 0.75;
}
.km-gear-inv-actions {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}
.km-gear-inv-row .km-btn {
  font-size: max(11px, 0.72rem);
  padding: 0.15rem 0.4rem;
  white-space: nowrap;
}
.km-merchant-list {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}
.km-merchant-row {
  appearance: none;
  display: grid;
  grid-template-columns: 2.4rem 1fr auto;
  grid-template-rows: auto auto;
  gap: 0.1rem 0.55rem;
  text-align: left;
  padding: 0.4rem 0.5rem;
  border: 1px solid rgba(90, 70, 40, 0.28);
  border-radius: 4px;
  background: linear-gradient(180deg, #f4ecda, #e0d4b8);
  color: var(--tome-ink);
  font: inherit;
  font-size: max(12px, 0.95rem);
  cursor: pointer;
  align-items: center;
}
.km-merchant-row:hover:not(:disabled) {
  border-color: var(--tome-gold);
}
.km-merchant-row.locked,
.km-merchant-row:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}
.km-merchant-icon {
  grid-column: 1;
  grid-row: 1 / span 2;
  width: 2.25rem;
  height: 2.25rem;
  object-fit: contain;
  border-radius: 4px;
  border: 1px solid rgba(90, 70, 40, 0.2);
  background: rgba(255, 255, 255, 0.4);
}
.km-merchant-name {
  font-weight: 700;
  grid-column: 2;
  grid-row: 1;
}
.km-merchant-meta {
  grid-column: 2;
  grid-row: 2;
  font-size: max(12px, 0.82rem);
  opacity: 0.8;
}
.km-merchant-cost {
  grid-column: 3;
  grid-row: 1 / span 2;
  align-self: center;
  font-weight: 700;
  color: var(--tome-banner);
  white-space: nowrap;
}
@media (max-width: 1100px) {
  .km-gear-layout-3 {
    grid-template-columns: 1fr 1fr;
    grid-template-rows: auto auto;
  }
  .km-gear-doll-panel {
    grid-column: 1 / -1;
  }
  .km-doll-figure {
    width: min(100%, 26rem);
    max-height: min(58vh, 34rem);
  }
}
@media (max-width: 720px) {
  .km-doll-slot {
    width: 3.1rem;
    min-height: 2.4rem;
    font-size: 0.58rem;
  }
  .km-doll-slot-weapon {
    width: 3.5rem;
    min-height: 2.7rem;
  }
}
.km-class-choices {
  margin: 0.65rem 0 0.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  flex-shrink: 0;
}
.km-class-top-row {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(12rem, 0.85fr);
  gap: 0.75rem 1rem;
  align-items: start;
  flex-shrink: 0;
}
.km-class-base-col {
  min-width: 0;
}
.km-class-divinity-col {
  min-width: 0;
}
.km-class-divinity-col:empty {
  display: none;
}
.km-choice-pair-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 0.65rem;
  align-items: stretch;
}
.km-choice-side-slot {
  min-width: 0;
  display: flex;
  flex-direction: column;
}
.km-choice-side-slot > .km-choice-block {
  flex: 1 1 auto;
}
.km-wizard-extra {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}
@media (max-width: 900px) {
  .km-class-top-row,
  .km-choice-pair-row {
    grid-template-columns: 1fr;
  }
}
.km-choice-block {
  padding: 0.5rem 0.55rem;
  border: 1px solid rgba(90, 70, 40, 0.28);
  border-radius: 4px;
  background: rgba(255, 252, 245, 0.45);
}
.km-choice-hint {
  margin: 0.15rem 0 0.4rem;
  font-size: 0.72rem;
  color: var(--tome-ink-soft);
  line-height: 1.35;
}
.km-choice-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
}
.km-choice-chips .km-chip {
  flex: 0 1 auto;
  min-width: auto;
  padding: 0.28rem 0.55rem;
  font-size: 0.68rem;
}
.km-prereq-hint {
  margin: 0.25rem 0 0;
  font-size: 0.72rem;
  color: var(--tome-ink-soft);
  font-style: italic;
}
.km-choice-modal {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(10, 8, 6, 0.72);
  padding: 1rem;
}
.km-choice-card {
  width: min(36rem, 100%);
  max-height: min(80vh, 32rem);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  background: linear-gradient(165deg, #f0e6d0, #d8c8a8);
  border: 2px solid var(--tome-frame, #7a4a28);
  border-radius: 6px;
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.45);
  color: var(--tome-ink, #2a2018);
  padding: 0.75rem 1rem 1rem;
}
.km-choice-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}
.km-choice-head h3 {
  margin: 0;
  font-family: Cinzel, Georgia, serif;
}
.km-weapon-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(7.5rem, 1fr));
  gap: 0.35rem;
  overflow-y: auto;
  max-height: 22rem;
  padding: 0.35rem 0;
}
.km-weapon-grid .km-chip {
  flex: none;
  width: 100%;
}

/* Globe step: hide rail, full bleed main */
.km-chargen.char-globe-mode .km-rail {
  display: none;
}
.km-chargen.char-globe-mode .km-body {
  grid-template-columns: 1fr;
}
.km-chargen.char-globe-mode .km-footer-title {
  opacity: 0.85;
}

/* —— Identity rail —— */
.km-rail {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  padding: 0.85rem 0.75rem 0.75rem;
  background:
    linear-gradient(165deg, #f0e6d0 0%, var(--tome-parchment) 40%, var(--tome-parchment-deep) 100%);
  border-right: 2px solid var(--tome-frame);
  box-shadow: inset -8px 0 20px rgba(80, 60, 30, 0.12);
  overflow-y: auto;
  min-height: 0;
  color: var(--tome-ink);
}

.km-portrait-frame {
  position: relative;
  width: 100%;
  /* ~200% larger than prior ~14.5rem cap — portrait fills rail */
  aspect-ratio: 1;
  max-height: min(42vh, 28rem);
  min-height: 16rem;
  margin: 0 auto;
  border: 3px solid var(--tome-gold);
  border-radius: 4px;
  box-shadow:
    0 0 0 1px #5a4828,
    0 6px 18px var(--km-shadow),
    inset 0 0 0 2px rgba(255, 240, 200, 0.25);
  background: #1a1510;
  overflow: hidden;
  flex-shrink: 0;
}

.km-portrait-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.km-portrait-img[hidden] {
  display: none !important;
}

.km-portrait-ph {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: Cinzel, Georgia, serif;
  font-size: 2.5rem;
  color: var(--tome-gold);
  background: radial-gradient(circle at 40% 30%, #3a3028, #12100c);
}

.km-portrait-ph[hidden] {
  display: none !important;
}

/* S3 silhouette placeholder */
.km-silhouette {
  position: absolute;
  width: 48%;
  height: 62%;
  bottom: 8%;
  left: 50%;
  transform: translateX(-50%);
  background: radial-gradient(ellipse at 50% 20%, #2a2420 0%, #1a1612 55%, #0c0a08 100%);
  border-radius: 50% 50% 42% 42% / 38% 38% 55% 55%;
  opacity: 0.85;
  box-shadow: inset 0 0 12px rgba(0, 0, 0, 0.5);
}
.km-silhouette::before {
  content: "";
  position: absolute;
  width: 58%;
  height: 48%;
  top: -28%;
  left: 21%;
  border-radius: 50%;
  background: #1e1a16;
  box-shadow: inset 0 0 8px rgba(0, 0, 0, 0.45);
}
.km-silhouette-q {
  position: relative;
  z-index: 1;
  font-size: 2rem;
  color: var(--tome-gold-bright, #e8c86a);
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.6);
  line-height: 1;
}

.km-avatar-gen {
  width: 100%;
  margin-top: 0.15rem;
  font-size: 0.82rem;
  padding: 0.4rem 0.5rem;
}
.km-avatar-err {
  margin: 0;
  min-height: 0.9rem;
  font-size: 0.68rem;
  color: #8a3028;
  line-height: 1.25;
}
.km-appearance {
  display: flex;
  flex-direction: column;
  gap: 0.28rem;
  margin: 0.1rem 0 0.25rem;
}
.km-appear-label {
  font-size: 0.62rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--tome-ink-soft);
  margin-top: 0.1rem;
}
.km-appear-row {
  display: flex;
  gap: 0.35rem;
  justify-content: center;
}
.km-sex-btn {
  appearance: none;
  width: 2.4rem;
  height: 2.1rem;
  border: 1px solid rgba(90, 70, 40, 0.45);
  border-radius: 3px;
  background: linear-gradient(180deg, #f4ecda, #e0d4b8);
  color: var(--tome-ink);
  font-size: 1.15rem;
  line-height: 1;
  cursor: pointer;
}
.km-sex-btn.active {
  background: linear-gradient(180deg, #3a342c, #2a241c);
  color: var(--tome-gold-bright, #e8c86a);
  border-color: var(--tome-gold);
}
.km-swatch-row {
  display: flex;
  gap: 0.28rem;
  flex-wrap: wrap;
  justify-content: center;
}
.km-swatch {
  appearance: none;
  width: 1.45rem;
  height: 1.45rem;
  border-radius: 3px;
  border: 2px solid rgba(40, 30, 20, 0.45);
  background: var(--sw, #ccc);
  background-color: var(--sw, #ccc);
  cursor: pointer;
  padding: 0;
  /* keep tone visible — no dark fill on active */
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.12);
}
.km-swatch.active {
  border-color: var(--tome-gold);
  /* Ring only — do not darken the swatch face */
  background: var(--sw, #ccc);
  background-color: var(--sw, #ccc);
  box-shadow:
    0 0 0 2px #5a4828,
    0 0 0 4px rgba(201, 162, 39, 0.55),
    inset 0 0 0 1px rgba(255, 255, 255, 0.2);
  filter: none;
  opacity: 1;
}
.km-chip {
  appearance: none;
  flex: 1 1 auto;
  min-width: 2.4rem;
  padding: 0.22rem 0.2rem;
  border: 1px solid rgba(90, 70, 40, 0.4);
  border-radius: 2px;
  background: linear-gradient(180deg, #f4ecda, #e0d4b8);
  color: var(--tome-ink);
  font: inherit;
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  cursor: pointer;
}
.km-chip.active {
  background: linear-gradient(180deg, #3a342c, #2a241c);
  color: var(--tome-gold-bright, #e8c86a);
  border-color: var(--tome-gold);
}
.km-avatar-notes {
  width: 100%;
  box-sizing: border-box;
  resize: vertical;
  min-height: 2.4rem;
  max-height: 5rem;
  padding: 0.35rem 0.4rem;
  border: 1px solid rgba(90, 70, 40, 0.45);
  border-radius: 3px;
  background: rgba(255, 250, 240, 0.65);
  color: var(--tome-ink);
  font: inherit;
  font-size: 0.75rem;
  line-height: 1.3;
}
.km-avatar-vault-btn {
  width: 100%;
  font-size: 0.72rem;
  padding: 0.32rem 0.4rem;
}

/* Larger avatar through the full chargen flow */
.km-rail .km-portrait-frame {
  max-height: 14.5rem;
  width: min(100%, 14.5rem);
}

/* Vault modal */
.km-vault-modal {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(10, 8, 6, 0.72);
  padding: 1rem;
}
.km-vault-modal.hidden {
  display: none !important;
}
.km-vault-card {
  width: min(42rem, 100%);
  max-height: min(80vh, 36rem);
  display: flex;
  flex-direction: column;
  background: linear-gradient(165deg, #f0e6d0, #d8c8a8);
  border: 2px solid var(--tome-frame, #7a4a28);
  border-radius: 6px;
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.45);
  color: var(--tome-ink, #2a2018);
  overflow: hidden;
}
.km-vault-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.65rem 0.85rem;
  border-bottom: 1px solid rgba(90, 70, 40, 0.3);
  background: linear-gradient(180deg, #c4a84b, #a88830);
  color: #1a1410;
}
.km-vault-head h2 {
  margin: 0;
  font-family: Cinzel, Georgia, serif;
  font-size: 1rem;
  letter-spacing: 0.06em;
}
.km-vault-sub {
  margin: 0.5rem 0.85rem 0.35rem;
  font-size: 0.78rem;
  color: var(--tome-ink-soft, #5a4a38);
}
.km-vault-grid {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(5.5rem, 1fr));
  gap: 0.5rem;
  padding: 0.65rem 0.85rem 1rem;
}
.km-vault-tile {
  appearance: none;
  position: relative;
  border: 2px solid rgba(90, 70, 40, 0.4);
  border-radius: 4px;
  padding: 0;
  background: #1a1510;
  cursor: pointer;
  overflow: hidden;
  aspect-ratio: 1;
}
.km-vault-tile:hover {
  border-color: var(--tome-gold, #c9a227);
}
.km-vault-tile img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.km-vault-tile.is-exact {
  border-color: var(--tome-gold, #c9a227);
  box-shadow: 0 0 0 2px rgba(201, 162, 39, 0.45);
}
.km-vault-tile.is-close {
  border-color: rgba(201, 162, 39, 0.75);
}
.km-vault-match {
  position: absolute;
  left: 0.25rem;
  top: 0.25rem;
  padding: 0.1rem 0.3rem;
  border-radius: 2px;
  background: rgba(20, 16, 10, 0.78);
  color: var(--tome-gold-bright, #e8c86a);
  font-size: 0.55rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.km-vault-empty {
  margin: 0.5rem 0.85rem 1rem;
  font-size: 0.85rem;
  color: var(--tome-ink-soft);
}

.km-name-label {
  font-size: 0.68rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--tome-ink-soft);
  margin-top: 0.15rem;
}

.km-name-input {
  width: 100%;
  box-sizing: border-box;
  padding: 0.4rem 0.5rem;
  border: 1px solid rgba(90, 70, 40, 0.45);
  border-radius: 3px;
  background: rgba(255, 250, 240, 0.65);
  color: var(--tome-ink);
  font: inherit;
  font-size: 0.95rem;
  font-weight: 600;
}

.km-name-input:focus {
  outline: 2px solid rgba(201, 162, 39, 0.55);
  outline-offset: 1px;
}

/* Encounters lab — start level 1–20 (THREE-TRACK-POLICY) */
.encounter-level-wrap {
  margin: 0.45rem 0 0.35rem;
  padding: 0.4rem 0.45rem;
  border: 1px solid rgba(90, 70, 40, 0.35);
  border-radius: 4px;
  background: rgba(201, 162, 39, 0.08);
}
.encounter-level-row {
  display: flex;
  gap: 0.4rem;
  align-items: center;
  margin-top: 0.2rem;
}
.encounter-level-row input[type="range"] {
  flex: 1;
  min-width: 0;
}
.encounter-level-row select {
  flex: 0 0 auto;
  max-width: 6.5rem;
  font: inherit;
  font-size: 0.8rem;
  padding: 0.2rem 0.25rem;
  border: 1px solid rgba(90, 70, 40, 0.4);
  border-radius: 3px;
  background: rgba(255, 250, 240, 0.8);
}
.encounter-level-hint {
  margin: 0.3rem 0 0;
  font-size: 0.68rem;
  line-height: 1.35;
  color: var(--tome-ink-soft, #5a4a38);
}

.km-attr-list {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  margin-top: 0.35rem;
}

.km-attr-row {
  display: grid;
  grid-template-columns: 2.6rem 1fr auto auto;
  align-items: center;
  gap: 0.25rem;
  padding: 0.18rem 0.3rem;
  border-bottom: 1px solid rgba(90, 70, 40, 0.18);
  font-size: 0.78rem;
}

.km-attr-key {
  font-weight: 700;
  letter-spacing: 0.06em;
  color: var(--tome-banner);
  font-size: 0.72rem;
}

.km-attr-full {
  font-size: 0.62rem;
  color: #6a5a48;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.km-attr-score {
  font-weight: 700;
  min-width: 1.4rem;
  text-align: right;
  color: var(--tome-ink);
}

.km-attr-mod {
  min-width: 1.8rem;
  text-align: right;
  color: #3a6040;
  font-weight: 600;
}

.km-attr-mod.is-neg {
  color: #8a3030;
}

.km-combat-sum {
  margin-top: 0.45rem;
  padding: 0.45rem 0.5rem;
  border: 1px solid rgba(122, 46, 36, 0.35);
  border-radius: 4px;
  background: rgba(255, 248, 230, 0.45);
  font-size: 0.72rem;
  line-height: 1.4;
  color: var(--tome-ink-soft);
}

.km-combat-sum strong {
  color: var(--tome-banner);
  font-weight: 700;
}

/* —— Main book panel —— */
.km-main {
  position: relative;
  min-height: 0;
  overflow: hidden;
  background:
    linear-gradient(145deg, #f4ecda 0%, var(--tome-parchment) 35%, #ddd0b4 100%);
  box-shadow: inset 0 0 60px rgba(80, 55, 25, 0.12);
}

.km-main > .char-step {
  position: absolute;
  inset: 0;
  display: grid;
  min-height: 0;
  overflow: hidden;
}

.km-main > .char-step.hidden {
  display: none;
}

.km-step-race,
.km-step-class {
  /* Picker lives in left rail; main is detail + art */
  grid-template-columns: minmax(16rem, 1.15fr) minmax(12rem, 0.95fr);
  gap: 0;
  display: grid;
  min-height: 0;
  overflow: hidden;
}

.km-col-list {
  display: flex;
  flex-direction: column;
  min-height: 0;
  border-right: 1px solid rgba(90, 70, 40, 0.28);
  background: linear-gradient(180deg, rgba(255, 250, 240, 0.55), rgba(220, 205, 175, 0.4));
}

.km-banner {
  margin: 0;
  padding: 0.55rem 0.75rem;
  font-family: Cinzel, Georgia, serif;
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  text-align: center;
  color: #f5e8c8;
  background: linear-gradient(180deg, #9a3a2c 0%, var(--tome-banner) 50%, var(--tome-banner-edge) 100%);
  border-bottom: 2px solid var(--tome-gold);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
  flex-shrink: 0;
}

.km-banner-center {
  max-width: 22rem;
  margin: 0 auto 0.75rem;
  border-radius: 2px;
}

.km-pick-list {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 0.35rem 0.4rem 0.6rem;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.km-pick {
  appearance: none;
  display: block;
  width: 100%;
  text-align: left;
  padding: 0.48rem 0.65rem;
  border: 1px solid transparent;
  border-radius: 2px;
  background: linear-gradient(180deg, #f0e6d0, #e0d4b8);
  color: var(--tome-ink);
  font: inherit;
  font-size: 0.92rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  cursor: pointer;
  box-shadow: inset 0 0 0 1px rgba(140, 110, 60, 0.25);
  transition: border-color 0.12s, background 0.12s, color 0.12s;
}

.km-pick:hover {
  border-color: rgba(201, 162, 39, 0.55);
  background: linear-gradient(180deg, #f8f0dc, #eadcba);
}

.km-pick.active {
  background: linear-gradient(180deg, #3a342c 0%, #2a241c 100%);
  color: var(--tome-gold-bright);
  border-color: var(--tome-gold);
  box-shadow:
    inset 0 0 0 1px rgba(201, 162, 39, 0.4),
    0 2px 8px rgba(0, 0, 0, 0.25);
}

.km-pick-section {
  margin: 0.45rem 0 0.2rem;
  padding: 0.2rem 0.35rem;
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--tome-banner);
  opacity: 0.9;
}

.km-pick-locked {
  opacity: 0.48;
  filter: grayscale(0.35);
  cursor: help;
  background: linear-gradient(180deg, #d8d0c0, #c8c0b0) !important;
  color: #5a5048 !important;
}

.km-pick-locked:hover {
  opacity: 0.72;
  border-color: rgba(90, 70, 40, 0.45);
}

.km-subhead {
  margin: 0.75rem 0 0.35rem;
  font-family: Cinzel, Georgia, serif;
  font-size: 0.78rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--tome-banner);
}

/* base .km-class-prog sizing overridden in Class tab flex section below */

.km-prog-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.68rem;
}

.km-prog-table th,
.km-prog-table td {
  padding: 0.22rem 0.35rem;
  border-bottom: 1px solid rgba(90, 70, 40, 0.12);
  text-align: left;
  vertical-align: top;
}

.km-prog-table th {
  position: sticky;
  top: 0;
  background: linear-gradient(180deg, #c4a84b, #a88830);
  color: #1a1410;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  font-size: 0.6rem;
}

.km-prog-table tr:nth-child(even) td {
  background: rgba(200, 180, 140, 0.12);
}

.km-prog-feats {
  color: var(--tome-ink-soft);
  max-width: 12rem;
}

.km-spell-list {
  margin: 0.2rem 0 0.5rem;
  padding-left: 1.1rem;
  font-size: 0.78rem;
  color: var(--tome-ink-soft);
  columns: 2;
  column-gap: 0.75rem;
}

.km-spell-list li {
  margin: 0.1rem 0;
  break-inside: avoid;
}

.km-col-detail {
  min-height: 0;
  overflow-y: auto;
  padding: 1rem 1.1rem 1.25rem;
  border-right: 1px solid rgba(90, 70, 40, 0.2);
}

.km-detail-title {
  margin: 0 0 0.2rem;
  font-family: Cinzel Decorative, Cinzel, Georgia, serif;
  font-size: clamp(1.35rem, 2.4vw, 1.85rem);
  font-weight: 700;
  color: var(--tome-banner);
  letter-spacing: 0.04em;
}

.km-detail-kicker {
  margin: 0 0 0.75rem;
  font-size: 0.78rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #6a5a48;
}

.km-traits {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-bottom: 0.75rem;
}

.km-trait {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.22rem 0.5rem;
  border: 1px solid rgba(122, 46, 36, 0.35);
  border-radius: 3px;
  background: rgba(255, 248, 230, 0.55);
  font-size: 0.75rem;
  color: var(--tome-ink);
}

.km-trait::before {
  content: "◆";
  font-size: 0.55rem;
  color: var(--tome-banner);
}

.km-class-stats {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(5.5rem, 1fr));
  gap: 0.4rem;
  margin-bottom: 0.75rem;
}

.km-stat-chip {
  padding: 0.35rem 0.45rem;
  border: 1px solid rgba(90, 70, 40, 0.28);
  border-radius: 3px;
  background: rgba(255, 252, 245, 0.5);
  text-align: center;
}

.km-stat-chip .km-stat-label {
  display: block;
  font-size: 0.62rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #7a6a58;
}

.km-stat-chip .km-stat-val {
  display: block;
  margin-top: 0.15rem;
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--tome-ink);
}

.km-blurb {
  margin: 0;
  font-size: 0.92rem;
  line-height: 1.5;
  color: var(--tome-ink-soft);
  max-width: 36rem;
}

.km-col-art {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 0;
  padding: 1rem 1.25rem;
  background:
    radial-gradient(ellipse at 50% 45%, rgba(255, 250, 235, 0.5) 0%, transparent 65%),
    linear-gradient(180deg, rgba(220, 200, 160, 0.25), rgba(180, 160, 120, 0.15));
}

.km-exemplar-caption {
  margin: 0.45rem 0 0;
  text-align: center;
  font-size: 0.78rem;
  font-style: italic;
  color: var(--tome-ink-soft);
  line-height: 1.35;
  max-width: 16rem;
}

.km-age-note {
  margin: 0.85rem 0 0;
  padding: 0.55rem 0.65rem;
  border: 1px solid rgba(90, 70, 40, 0.28);
  border-radius: 4px;
  background: rgba(255, 250, 240, 0.55);
  font-size: 0.78rem;
  line-height: 1.4;
  color: var(--tome-ink-soft);
}

.km-age-note strong {
  color: var(--tome-banner);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  font-size: 0.68rem;
  margin-right: 0.25rem;
}

.km-art-frame {
  position: relative;
  /* ~200% larger exemplar (was ~22rem / 28rem) */
  width: min(100%, 44rem);
  aspect-ratio: 3 / 4;
  max-height: min(88vh, 56rem);
  border: 4px solid var(--tome-gold);
  border-radius: 3px;
  box-shadow:
    0 0 0 2px #5a4820,
    0 0 0 5px rgba(201, 162, 39, 0.35),
    0 12px 36px var(--km-shadow),
    inset 0 0 0 3px rgba(40, 30, 15, 0.35);
  background: #1a1510;
  overflow: hidden;
}

.km-art-frame::before,
.km-art-frame::after {
  content: "";
  position: absolute;
  width: 1.1rem;
  height: 1.1rem;
  border: 2px solid var(--tome-gold);
  z-index: 1;
  pointer-events: none;
  opacity: 0.85;
}

.km-art-frame::before {
  top: 0.35rem;
  left: 0.35rem;
  border-right: none;
  border-bottom: none;
}

.km-art-frame::after {
  bottom: 0.35rem;
  right: 0.35rem;
  border-left: none;
  border-top: none;
}

.km-art-frame img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* —— Abilities step —— */
.km-step-stats {
  grid-template-columns: 1fr;
  place-items: start center;
  justify-items: center;
  overflow-y: auto;
  padding: 1.25rem 1.5rem 2rem;
}

.km-stats-panel {
  width: min(40rem, 100%);
  margin-inline: auto;
}
.km-stats-panel-wide {
  /* Σ9: wider so allocate box is not clipped */
  width: min(68rem, 100%);
  max-width: 100%;
}
.km-stats-two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.25rem 1.5rem;
  align-items: start;
}
@media (max-width: 900px) {
  .km-stats-two-col {
    grid-template-columns: 1fr;
  }
}

/* Name: editable field + random roll (operator 2026-08-03) */
.km-name-badge-row {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  margin: 0.25rem 0 0.5rem;
  flex-wrap: wrap;
}
.km-name-field-label {
  flex: 0 0 100%;
  font-size: 0.65rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--tome-ink-soft);
  margin: 0;
}
.km-name-badge-row .km-name-edit {
  flex: 1 1 auto;
  min-width: 0;
  font-family: Cinzel, Georgia, serif;
  font-weight: 700;
  font-size: 1.05rem;
  letter-spacing: 0.04em;
  color: var(--tome-ink);
  background: linear-gradient(180deg, #f8f0dc, #e8dcc0);
  border: 2px solid var(--tome-gold);
  border-radius: 4px;
  padding: 0.35rem 0.55rem;
  text-align: center;
  box-shadow: inset 0 0 0 1px rgba(90, 70, 40, 0.2);
}
.km-name-badge-row .km-name-edit:focus {
  outline: 2px solid rgba(201, 162, 39, 0.65);
  outline-offset: 1px;
  background: #fffef8;
}
.km-name-badge-row .km-name-edit::placeholder {
  color: rgba(90, 70, 40, 0.45);
  font-weight: 500;
  letter-spacing: 0.02em;
}
/* Legacy badge styles (mirror hidden) */
.km-name-badge {
  flex: 1 1 auto;
  font-family: Cinzel, Georgia, serif;
  font-weight: 700;
  font-size: 1.05rem;
  letter-spacing: 0.04em;
  color: var(--tome-ink);
  background: linear-gradient(180deg, #f8f0dc, #e8dcc0);
  border: 2px solid var(--tome-gold);
  border-radius: 4px;
  padding: 0.35rem 0.55rem;
  text-align: center;
  box-shadow: inset 0 0 0 1px rgba(90, 70, 40, 0.2);
  cursor: default;
  user-select: none;
}
.km-name-input-hidden {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  opacity: 0 !important;
  pointer-events: none !important;
  overflow: hidden !important;
}

/* Class tab: full-width prose, no exemplar */
.km-step-class {
  grid-template-columns: minmax(0, 1.6fr) minmax(12rem, 0.7fr) !important;
}
.km-col-class-full {
  min-width: 0;
  min-height: 0;
  overflow-y: auto;
  padding: 0.75rem 1rem 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}
.km-col-class-side {
  min-width: 0;
  min-height: 0;
  overflow-y: auto;
  padding: 0.75rem 0.65rem 1rem;
  border-left: 1px solid rgba(90, 70, 40, 0.25);
  display: flex;
  flex-direction: column;
}
.km-class-prog-prose {
  margin: 0.35rem 0 0.75rem;
}
/* Fill remaining viewport under class content with progression table */
.km-class-prog {
  flex: 1 1 auto;
  min-height: 14rem;
  max-height: none;
  margin-top: 0.35rem;
  overflow: auto;
  border: 1px solid rgba(90, 70, 40, 0.25);
  border-radius: 3px;
  background: rgba(255, 252, 245, 0.5);
  display: flex;
  flex-direction: column;
}
.km-class-prog .km-prog-scroll {
  flex: 1 1 auto;
  max-height: none;
  overflow: auto;
  min-height: 10rem;
}
.km-class-spells {
  flex-shrink: 0;
}
.km-class-prog-side {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  max-height: none;
}

/* Skills / feats three columns */
.km-skills-list,
.km-feats-list {
  display: grid !important;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.35rem 0.55rem;
  align-content: start;
}
@media (max-width: 1100px) {
  .km-skills-list,
  .km-feats-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
.km-rail-textarea {
  min-height: 9rem;
  font-size: 0.78rem;
  line-height: 1.4;
}
.km-rail-help {
  font-size: 0.72rem !important;
  line-height: 1.45;
  margin: 0 0 0.55rem;
}
/* Σ10: left-aligned, no tab indent */
.km-help-flush {
  text-align: left !important;
  text-indent: 0 !important;
  padding-left: 0 !important;
  margin-left: 0 !important;
  white-space: normal;
}
.km-rail-extra {
  margin-top: 0.45rem;
}
.km-class-prog-side {
  max-height: 100%;
  overflow-y: auto;
}
.km-feature-list {
  margin: 0.2rem 0 0.65rem 1rem;
  padding: 0;
  text-align: left;
  font-size: 0.78rem;
  line-height: 1.4;
}
.km-feature-level-head {
  margin-bottom: 0.15rem !important;
  font-weight: 700;
}
.km-choice-desc {
  margin: 0.45rem 0 0;
  font-size: 0.8rem;
  line-height: 1.4;
  color: var(--tome-ink, #2a2010);
  text-align: left;
}
.km-divinity-desc,
.km-subclass-desc {
  padding: 0.35rem 0.45rem;
  border-radius: 4px;
  background: rgba(255, 252, 245, 0.45);
  border: 1px solid rgba(90, 70, 40, 0.18);
}

.km-ab-table-wrap {
  margin: 0.5rem 0 1rem;
  border: 1px solid rgba(90, 70, 40, 0.3);
  border-radius: 4px;
  background: rgba(255, 252, 245, 0.55);
  overflow-x: auto;
  overflow-y: hidden;
  min-width: 0;
  width: 100%;
}

.km-ab-head {
  display: grid;
  grid-template-columns: minmax(7rem, 1.4fr) 3.2rem minmax(5.5rem, 1fr) 3rem 2.75rem 5.5rem;
  gap: 0.35rem;
  padding: 0.4rem 0.65rem;
  background: linear-gradient(180deg, #c4a84b, #a88830);
  color: #1a1410;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  text-align: center;
  align-items: center;
}

.km-ab-head span:first-child {
  text-align: left;
}

.km-step-stats .ability-row {
  display: flex;
  flex-direction: column;
  gap: 0;
  max-width: none;
  margin: 0;
}

.km-step-stats .ability-cell {
  display: grid;
  /* Σ9: match wider allocate box */
  grid-template-columns: minmax(7rem, 1.4fr) 3.2rem minmax(5.5rem, 1fr) 3rem 2.75rem 5.5rem;
  gap: 0.35rem;
  align-items: center;
  padding: 0.45rem 0.65rem;
  border-bottom: 1px solid rgba(90, 70, 40, 0.15);
  background: transparent;
  border-radius: 0;
  text-align: center;
}

.km-step-stats .ability-cell:nth-child(even) {
  background: rgba(200, 180, 140, 0.12);
}

.km-step-stats .ability-cell .ab-key-block {
  text-align: left;
  min-width: 0;
}

.km-step-stats .ability-cell .ab-key {
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--tome-banner);
  font-size: 0.88rem;
  text-align: left;
  text-transform: none;
}

.km-step-stats .ability-cell .ab-blurb {
  font-size: 0.65rem;
  line-height: 1.25;
  color: var(--tome-ink-soft);
  margin-top: 0.1rem;
}

.km-step-stats .ability-cell .ab-racial {
  font-size: 0.85rem;
  color: #3a6040;
  font-weight: 600;
}

.km-step-stats .ability-cell .ab-val {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--tome-ink);
}

.km-step-stats .ability-cell .ab-final {
  font-size: 0.9rem;
  color: var(--tome-ink-soft);
}

.km-step-stats .ability-cell .ab-cost {
  font-size: 0.78rem;
  font-weight: 700;
  color: #6a4a28;
}

.km-step-stats .ability-cell .ab-btns {
  display: flex;
  justify-content: center;
  gap: 0.35rem;
}

.km-step-stats .ability-cell button {
  width: 1.85rem;
  height: 1.85rem;
  border: 1px solid var(--tome-gold);
  border-radius: 3px;
  background: linear-gradient(180deg, #3a342c, #221e18);
  color: var(--tome-gold-bright);
  font-size: 1.1rem;
  line-height: 1;
  cursor: pointer;
}

.km-step-stats .ability-cell button:hover:not(:disabled) {
  background: linear-gradient(180deg, #4a4034, #2a241c);
}

.km-step-stats .ability-cell button:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.km-pb-note {
  margin: 0.45rem 0 0.25rem;
  font-size: 0.72rem;
  color: var(--tome-ink-soft);
  line-height: 1.35;
}

.km-align-field {
  margin: 0.85rem auto 0.5rem;
  width: min(22rem, 100%);
}

.km-align-field .char-field-label {
  color: var(--tome-ink-soft);
  display: block;
  margin-bottom: 0.25rem;
  font-size: 0.72rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.km-align-hint {
  margin: 0 0 0.4rem;
  font-size: 0.75rem;
  color: var(--tome-banner);
  min-height: 1rem;
}

.km-align-wheel {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.35rem;
  max-width: 22rem;
}

.km-align-cell {
  appearance: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.1rem;
  min-height: 3.1rem;
  padding: 0.35rem 0.25rem;
  border: 1px solid rgba(90, 70, 40, 0.4);
  border-radius: 4px;
  background: linear-gradient(180deg, #f4ecda, #e0d4b8);
  color: var(--tome-ink);
  font: inherit;
  cursor: pointer;
  transition: border-color 0.12s, background 0.12s, opacity 0.12s;
}

.km-align-cell:hover:not(:disabled) {
  border-color: var(--tome-gold);
}

.km-align-cell.active {
  background: linear-gradient(180deg, #3a342c, #2a241c);
  color: var(--tome-gold-bright);
  border-color: var(--tome-gold);
  box-shadow: 0 0 0 1px rgba(201, 162, 39, 0.35);
}

.km-align-cell.disabled,
.km-align-cell:disabled {
  opacity: 0.32;
  filter: grayscale(0.4);
  cursor: not-allowed;
  background: #d0c8b8;
  color: #5a5048;
}

.km-align-code {
  font-weight: 800;
  letter-spacing: 0.06em;
  font-size: 0.95rem;
}

.km-align-name {
  font-size: 0.58rem;
  letter-spacing: 0.02em;
  opacity: 0.9;
  text-align: center;
  line-height: 1.15;
}

.km-align-cell.active .km-align-name {
  color: rgba(232, 200, 106, 0.85);
}

.km-step-stats .points-tray {
  background: linear-gradient(180deg, #f8f0dc, #e8dcc0);
  border: 1px solid var(--tome-gold);
  color: var(--tome-ink-soft);
  gap: 0.35rem 0.85rem;
}

.km-step-stats .points-tray .points-tray-label {
  margin: 0;
}

/* Explicit gap before budget number (operator: space before 25) */
.km-step-stats .points-tray .points-unused-num,
.km-step-stats .points-tray #points-unused {
  margin-left: 0.55rem;
  padding-left: 0.35rem;
  min-width: 1.75rem;
  display: inline-block;
  text-align: left;
  letter-spacing: 0.02em;
}

.km-step-stats .points-tray strong {
  color: var(--tome-banner);
  text-shadow: none;
}

.km-step-stats .points-tray.has-unused strong {
  color: #b05020;
}

.km-step-stats .ability-cell.is-core .ab-key {
  color: #8a6020;
}
.km-step-stats .ability-cell .ab-core-star {
  color: #c9a227;
  margin-right: 0.2em;
}

.km-step-stats .char-summary {
  text-align: center;
  color: var(--tome-ink-soft);
  font-size: 0.85rem;
}

/* —— Footer —— */
.km-footer {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.55rem 1.25rem;
  background: linear-gradient(180deg, #3a2a1c 0%, #1e1610 100%);
  border-top: 2px solid var(--tome-gold);
  box-shadow: 0 -4px 18px rgba(0, 0, 0, 0.4);
  z-index: 2;
}

.km-footer-title {
  font-family: Cinzel, Georgia, serif;
  font-size: clamp(0.95rem, 1.8vw, 1.25rem);
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--tome-gold-bright);
  text-shadow: 0 1px 4px #000;
}

.km-footer-nav {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

.km-btn {
  appearance: none;
  min-width: 6.5rem;
  padding: 0.5rem 1.15rem;
  border: 1px solid #6a5a40;
  border-radius: 2px;
  background: linear-gradient(180deg, #4a4034 0%, #2a241c 100%);
  color: #d8c8a8;
  font-family: Cinzel, Georgia, serif;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  cursor: pointer;
  box-shadow: inset 0 1px 0 rgba(255, 240, 200, 0.12);
}

.km-btn:hover:not(:disabled) {
  border-color: var(--tome-gold);
  color: #f0e6c8;
}

.km-btn-primary {
  background: linear-gradient(180deg, #5a4830 0%, #3a2c18 100%);
  border-color: var(--tome-gold);
  color: var(--tome-gold-bright);
}

.km-btn-primary:hover:not(:disabled) {
  background: linear-gradient(180deg, #6a5838 0%, #4a3818 100%);
}

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

.km-btn.hidden {
  display: none !important;
}

/* Globe still lives inside km-main on continent step */
#screen-char .char-step-globe {
  display: flex;
  flex-direction: column;
}

#screen-char .char-step-globe.hidden {
  display: none;
}

#screen-char .globe-layout {
  flex: 1;
  min-height: 0;
  height: 100%;
}

#screen-char .globe-panel {
  background: linear-gradient(180deg, #f0e6d0 0%, #d8c8a8 100%);
  border-left: 2px solid var(--tome-frame);
  color: var(--tome-ink);
  /* inherit overflow from arcade; ensure KM panel can scroll all 9 cards */
  overflow-x: hidden;
  overflow-y: auto;
  min-width: 0;
}

#screen-char .continent-grid-compact {
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  min-width: 0;
  width: 100%;
}

#screen-char .globe-panel-title {
  color: var(--tome-banner);
  font-family: Cinzel, Georgia, serif;
}

#screen-char .globe-panel-sub {
  color: var(--tome-ink-soft);
}

#screen-char .globe-selected {
  flex-shrink: 0;
  max-height: 11rem;
  overflow-y: auto;
  background: linear-gradient(160deg, #f8f0dc, #e8dcc0);
  border: 1px solid rgba(122, 46, 36, 0.35);
  box-shadow: none;
}

#screen-char .globe-sel-name {
  color: var(--tome-ink);
}

#screen-char .globe-sel-cap {
  color: var(--tome-banner);
}

#screen-char .globe-sel-blurb {
  color: var(--tome-ink-soft);
}

#screen-char .globe-sel-climate {
  color: #6a5a48;
}

#screen-char .continent-card {
  background: linear-gradient(180deg, #f4ecda, #e0d4b8);
  border: 1px solid rgba(90, 70, 40, 0.35);
  color: var(--tome-ink);
}

#screen-char .continent-card:hover {
  border-color: var(--tome-gold);
}

#screen-char .continent-card.active {
  border-color: var(--tome-banner);
  box-shadow: 0 0 0 1px rgba(122, 46, 36, 0.35);
  background: linear-gradient(180deg, #f8f0dc, #e8d0a8);
}

#screen-char .continent-cap {
  color: #6a5a48;
}

@media (max-width: 960px) {
  .km-body {
    grid-template-columns: minmax(12rem, 14.5rem) 1fr;
  }

  .km-step-race,
  .km-step-class {
    grid-template-columns: 1fr;
    grid-template-rows: auto 1fr;
  }

  .km-col-art {
    grid-column: 1 / -1;
    grid-row: 1;
    max-height: 28vh;
    padding: 0.5rem;
  }

  .km-art-frame {
    max-height: 24vh;
    aspect-ratio: 16 / 10;
    width: min(100%, 20rem);
  }

  .km-col-detail {
    grid-row: 2;
  }

  .km-skills-list.km-skills-grid,
  .km-feats-list {
    grid-template-columns: 1fr;
  }

  .km-skills-layout,
  .km-feats-layout {
    grid-template-columns: 1fr;
    grid-template-rows: 1fr auto;
  }

  .km-detail-side {
    border-left: none;
    border-top: 1px solid rgba(90, 70, 40, 0.28);
    max-height: 28vh;
  }

  .km-ab-head,
  .km-step-stats .ability-cell {
    grid-template-columns: 4rem 3.2rem 1fr 2.8rem 5rem;
  }
}

@media (max-width: 700px) {
  .km-body {
    grid-template-columns: 1fr;
  }

  .km-rail {
    display: none;
  }

  .km-step-race,
  .km-step-class {
    grid-template-columns: 1fr;
    grid-template-rows: auto auto 1fr;
    overflow-y: auto;
  }

  .km-col-art {
    grid-column: auto;
    grid-row: auto;
    max-height: 32vh;
  }

  .km-col-list {
    max-height: 28vh;
  }
}

/* —— S6 Skills / Feats steps —— */
.km-skills-panel,
.km-feats-panel {
  width: 100%;
  max-height: 100%;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  min-height: 0;
  padding: 0.55rem 0.65rem 0.75rem;
}

.km-skills-toolbar {
  display: flex;
  gap: 0.4rem;
  margin: 0.35rem 0 0.5rem;
  flex-shrink: 0;
}

/* Full catalogs: denser grid; panel scrolls if needed */
.km-skills-list,
.km-feats-list {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  border: 1px solid rgba(90, 70, 40, 0.25);
  border-radius: 4px;
  background: rgba(255, 252, 245, 0.55);
  padding: 0.3rem;
}

.km-skills-list.km-skills-grid {
  display: grid;
  /* Σ14: three columns of skills */
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.15rem 0.45rem;
  align-content: start;
}

.km-feats-list {
  display: grid;
  /* Σ17: three columns of feats */
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.22rem 0.45rem;
  align-content: start;
}

.km-skill-row {
  display: grid;
  grid-template-columns: 1fr 2.2rem 2.6rem 4.2rem;
  gap: 0.2rem;
  align-items: center;
  padding: 0.18rem 0.3rem;
  border-radius: 3px;
  background: transparent;
}

.km-skill-row.is-class {
  background: rgba(200, 180, 100, 0.12);
}

.km-skill-main {
  min-width: 0;
  text-align: left;
}

.km-skill-name {
  display: block;
  font-weight: 700;
  font-size: 0.72rem;
  color: var(--tome-ink);
  line-height: 1.15;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.km-skill-meta {
  font-size: 0.55rem;
  color: var(--tome-ink-soft);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.km-skill-total {
  font-weight: 700;
  font-size: 0.95rem;
  text-align: center;
  color: var(--tome-banner);
}

.km-skill-ranks {
  text-align: center;
  font-size: 0.8rem;
  font-weight: 600;
}

.km-skill-btns {
  display: flex;
  justify-content: center;
  gap: 0.3rem;
}

.km-skill-btns button {
  width: 1.75rem;
  height: 1.75rem;
  border: 1px solid var(--tome-gold);
  border-radius: 3px;
  background: linear-gradient(180deg, #3a342c, #221e18);
  color: var(--tome-gold-bright);
  font-size: 1rem;
  cursor: pointer;
}

.km-skill-btns button:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.km-feats-chosen {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  min-height: 1.8rem;
  margin: 0.35rem 0 0.5rem;
  font-size: 0.8rem;
  color: var(--tome-ink-soft);
}

.km-feat-chip {
  appearance: none;
  border: 1px solid var(--tome-gold);
  border-radius: 999px;
  padding: 0.25rem 0.55rem;
  background: linear-gradient(180deg, #3a342c, #2a241c);
  color: var(--tome-gold-bright);
  font: inherit;
  font-size: 0.72rem;
  font-weight: 700;
  cursor: pointer;
}

.km-feat-row {
  appearance: none;
  width: 100%;
  text-align: left;
  border: 1px solid rgba(90, 70, 40, 0.3);
  border-radius: 3px;
  padding: 0.45rem 0.55rem;
  background: linear-gradient(180deg, #f4ecda, #e8dcc0);
  color: var(--tome-ink);
  font: inherit;
  cursor: pointer;
}

.km-feat-row:hover:not(:disabled) {
  border-color: var(--tome-gold);
}

.km-feat-row.active {
  background: linear-gradient(180deg, #3a342c, #2a241c);
  color: var(--tome-gold-bright);
  border-color: var(--tome-gold);
}

.km-feat-row.locked {
  opacity: 0.45;
  cursor: not-allowed;
  filter: grayscale(0.25);
}

.km-feat-head {
  display: flex;
  justify-content: space-between;
  gap: 0.5rem;
  align-items: baseline;
}

.km-feat-name {
  font-weight: 700;
  font-size: 0.9rem;
}

.km-feat-type {
  font-size: 0.62rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  opacity: 0.8;
}

.km-feat-sum {
  margin-top: 0.2rem;
  font-size: 0.75rem;
  line-height: 1.3;
  opacity: 0.9;
}

.km-feat-prereq {
  margin-top: 0.2rem;
  font-size: 0.68rem;
  color: var(--tome-ink-soft);
}

.km-feat-row.active .km-feat-prereq,
.km-feat-row.active .km-feat-sum {
  color: rgba(232, 200, 106, 0.85);
}

.km-tabs .km-tab {
  font-size: 0.78rem;
  padding: 0.45rem 0.55rem;
}

/* —— Chargen revise: hair layout, name row, prereqs, rail sheet —— */
.km-name-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.35rem;
  margin-top: 0.15rem;
}
.km-name-row .km-name-label {
  margin: 0;
}
.km-name-rand {
  appearance: none;
  width: 1.85rem;
  height: 1.85rem;
  border: 1px solid rgba(90, 70, 40, 0.45);
  border-radius: 3px;
  background: linear-gradient(180deg, #f4ecda, #e0d4b8);
  cursor: pointer;
  font-size: 0.95rem;
  line-height: 1;
  padding: 0;
}
.km-name-rand:hover {
  border-color: var(--tome-gold);
  background: linear-gradient(180deg, #f8f0dc, #eadcba);
}

.km-hair-layout {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}
.km-chip-bald {
  width: 100%;
}
.km-hair-cols {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.35rem;
}
.km-hair-col {
  display: flex;
  flex-direction: column;
  gap: 0.22rem;
  padding: 0.3rem;
  border: 1px solid rgba(90, 70, 40, 0.25);
  border-radius: 3px;
  background: rgba(255, 250, 240, 0.4);
}
.km-hair-col-label {
  font-size: 0.6rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  text-align: center;
  color: var(--tome-banner);
  margin-bottom: 0.1rem;
}
.km-hair-col .km-chip {
  width: 100%;
  min-width: 0;
}

.km-prereq-box {
  margin: 0.55rem 0 0.35rem;
  padding: 0.5rem 0.6rem;
  border: 1px solid rgba(122, 46, 36, 0.45);
  border-radius: 4px;
  background: linear-gradient(180deg, #f8e8d8, #ead0b8);
  color: var(--tome-ink);
}
.km-prereq-box strong {
  display: block;
  font-size: 0.68rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--tome-banner);
  margin-bottom: 0.25rem;
}
.km-prereq-box p {
  margin: 0;
  font-size: 0.8rem;
  line-height: 1.35;
}

.km-rail-sheet.hidden,
.km-rail-sheet[hidden] {
  display: none !important;
}

/* —— Game HUD (tabbed Streets / Equipment / Character) —— */
.game-hud {
  position: absolute;
  top: 3.6rem;
  left: 0.65rem;
  z-index: 40;
  width: min(24rem, calc(100% - 1.2rem));
  max-height: min(78vh, 640px);
  display: flex;
  flex-direction: column;
  background: linear-gradient(165deg, rgba(18, 22, 28, 0.96), rgba(12, 14, 18, 0.94));
  border: 1px solid rgba(201, 162, 39, 0.45);
  border-radius: 10px;
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.55);
  overflow: hidden;
}
.game-hud.hidden {
  display: none !important;
}
.game-hud-head {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.4rem 0.45rem;
  border-bottom: 1px solid rgba(201, 162, 39, 0.25);
  background: rgba(0, 0, 0, 0.25);
}
.game-hud-tabs {
  display: flex;
  flex: 1;
  gap: 0.25rem;
  min-width: 0;
}
.game-hud-tab {
  flex: 1;
  appearance: none;
  border: 1px solid transparent;
  background: transparent;
  color: #a8b4c0;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  padding: 0.4rem 0.35rem;
  border-radius: 6px;
  cursor: pointer;
}
.game-hud-tab:hover {
  color: #e8eef4;
  background: rgba(255, 255, 255, 0.04);
}
.game-hud-tab.active {
  color: #1a1408;
  background: linear-gradient(180deg, #e0c060, #c9a227);
  border-color: #a88418;
}
.game-hud-close {
  appearance: none;
  border: none;
  background: transparent;
  color: #9aa8b4;
  font-size: 1.25rem;
  line-height: 1;
  cursor: pointer;
  padding: 0.2rem 0.45rem;
}
.game-hud-close:hover { color: #fff; }
.game-hud-body {
  overflow: auto;
  padding: 0.55rem 0.65rem 0.75rem;
  min-height: 0;
  flex: 1;
}
.hud-panel.hidden { display: none; }
.game-hud .settlement-dock {
  position: static;
  max-width: none;
  width: 100%;
  background: transparent;
  border: none !important;
  box-shadow: none !important;
  padding: 0;
  margin: 0;
}
.game-hud .settlement-map {
  width: 100%;
  height: auto;
  max-height: 280px;
}
.hud-streets-fallback { padding: 0.35rem 0; }
.hud-area-blurb {
  font-size: 0.85rem;
  color: #c8d0d8;
  line-height: 1.4;
}
.hud-char-summary {
  font-size: 0.88rem;
  color: #d8e0e8;
  line-height: 1.45;
}
.hud-char-summary h3 {
  margin: 0 0 0.35rem;
  color: #e0c060;
  font-size: 1rem;
}
.hud-char-summary .hud-stat-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.25rem 0.75rem;
  margin: 0.5rem 0;
  font-variant-numeric: tabular-nums;
}
.hud-char-actions .btn-arcade {
  min-width: auto;
  font-size: 0.8rem;
  padding: 0.5rem 0.85rem;
}
.game-screen .layout {
  grid-template-columns: 1fr !important;
}
.game-screen .map-panel[hidden],
.game-screen .map-panel.hidden {
  display: none !important;
}
input[type="file"][hidden],
input[type="file"].hidden {
  display: none !important;
  pointer-events: none !important;
  width: 0 !important;
  height: 0 !important;
}
/* Paper-doll figure (tome) — chargen-like body image */
.tome-equip .paper-doll-figure {
  position: relative;
  width: 140px;
  min-height: 200px;
  margin: 0 auto 0.5rem;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}
.tome-equip .paper-doll-figure img {
  max-width: 100%;
  max-height: 220px;
  object-fit: contain;
  border-radius: 6px;
  filter: drop-shadow(0 4px 12px rgba(0,0,0,0.35));
}
.tome-equip .paper-doll-figure .doll-ph {
  width: 90px;
  height: 160px;
  border-radius: 8px;
  background: linear-gradient(180deg, #3a3428, #1e1a14);
  border: 1px dashed rgba(201,162,39,0.35);
}

/* —— Full-screen pause HUD v2 —— */
.game-hud-fullscreen {
  position: absolute;
  inset: 0;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  width: 100%;
  max-width: none;
  max-height: none;
  z-index: 80;
  border-radius: 0;
  border: none;
  background: rgba(8, 10, 14, 0.94);
  backdrop-filter: blur(4px);
}
.game-hud-fullscreen .game-hud-body {
  flex: 1;
  min-height: 0;
  padding: 0.75rem 1rem 1.1rem;
  overflow: auto;
  display: flex;
  flex-direction: column;
}
.game-hud-fullscreen #hud-panel-equip:not(.hidden) {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.game-hud-fullscreen #hud-panel-equip .tome-gear-fill {
  flex: 1;
  min-height: 0;
}
.game-hud-fullscreen #hud-panel-map:not(.hidden) {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.game-hud-fullscreen #hud-panel-map .settlement-dock {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}
.game-hud-fullscreen .settlement-map-large {
  width: 100%;
  flex: 1;
  min-height: min(62vh, 640px);
  max-height: none;
  height: auto;
  background: #0a0c0e;
  border-radius: 8px;
  border: 1px solid rgba(201, 162, 39, 0.35);
  cursor: crosshair;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.35);
}
.game-hud-fullscreen .settlement-map-large.hidden {
  display: none !important;
}
.hud-country-svg {
  width: 100%;
  flex: 1;
  min-height: min(62vh, 640px);
  background: #0a0c0e;
  border-radius: 8px;
  border: 1px solid rgba(201, 162, 39, 0.35);
  display: block;
}
.hud-country-svg.hidden {
  display: none !important;
}
.hud-country-status {
  margin: 0.25rem 0 0;
  min-height: 1.1em;
}
.hud-country-status.hidden {
  display: none !important;
}
/* Π2 character sheet spacing */
.hud-char-body .hud-stat-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.45rem 0.85rem;
  margin: 0.35rem 0 0.15rem;
  font-variant-numeric: tabular-nums;
}
.hud-char-body .hud-stat-grid span {
  display: flex;
  align-items: baseline;
  gap: 0.35rem;
  white-space: nowrap;
}
.hud-char-body .hud-stat-grid em {
  font-style: normal;
  color: #9aa8b4;
  font-size: 0.72rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  min-width: 2.2rem;
}
.hud-skill-table .sk-mods {
  font-size: 0.72rem;
  color: #9aa8b4;
}
.hud-skill-table .sk-mod {
  margin-right: 0.35rem;
  white-space: nowrap;
}
@media (max-width: 800px) {
  .hud-char-body .hud-stat-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
.map-mode-bar {
  display: flex;
  gap: 0.35rem;
  margin-bottom: 0.55rem;
  flex-wrap: wrap;
  align-items: center;
}
.map-mode-btn {
  appearance: none;
  border: 1px solid rgba(201, 162, 39, 0.35);
  background: rgba(30, 28, 22, 0.9);
  color: #c8d0d8;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  padding: 0.4rem 0.85rem;
  border-radius: 6px;
  cursor: pointer;
}
.map-mode-btn.active {
  background: linear-gradient(180deg, #e0c060, #c9a227);
  color: #1a1408;
  border-color: #a88418;
}
.map-zoom-controls {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  margin-left: 0.35rem;
  padding-left: 0.55rem;
  border-left: 1px solid rgba(201, 162, 39, 0.28);
}
.map-zoom-controls.hidden {
  display: none;
}
.map-zoom-btn {
  min-width: 2rem;
  padding-left: 0.55rem;
  padding-right: 0.55rem;
  font-size: 1rem;
  line-height: 1;
}
.map-zoom-label {
  min-width: 4.5rem;
  text-align: center;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  color: #e8d48a;
  font-variant-numeric: tabular-nums;
}
.journal-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  min-height: 0;
  height: 100%;
  overflow: auto;
  padding: 0.25rem 0.15rem 0.75rem;
}
@media (max-width: 900px) {
  .journal-layout { grid-template-columns: 1fr; }
}
.journal-heading {
  margin: 0 0 0.35rem;
  font-size: 1rem;
  color: #e8d48a;
  letter-spacing: 0.04em;
}
.journal-subhead {
  margin: 0.75rem 0 0.35rem;
  font-size: 0.85rem;
  color: #b8c0c8;
}
.journal-field {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  margin: 0.45rem 0;
  font-size: 0.8rem;
  color: #9aa8b4;
}
.journal-field input,
.journal-field textarea {
  background: rgba(12, 16, 20, 0.9);
  border: 1px solid rgba(201, 162, 39, 0.28);
  color: #e8eef2;
  border-radius: 6px;
  padding: 0.45rem 0.55rem;
  font: inherit;
  resize: vertical;
}
.journal-actions {
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
  margin: 0.35rem 0 0.5rem;
}
.journal-note-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  max-height: 280px;
  overflow: auto;
}
.journal-note-list li {
  background: rgba(18, 22, 28, 0.85);
  border: 1px solid rgba(120, 140, 160, 0.22);
  border-radius: 6px;
  padding: 0.45rem 0.55rem;
  font-size: 0.82rem;
  color: #d0d8e0;
}
.journal-note-list li strong {
  display: block;
  color: #f0e6c8;
  margin-bottom: 0.15rem;
}
.journal-note-meta {
  display: flex;
  justify-content: space-between;
  gap: 0.5rem;
  font-size: 0.72rem;
  color: #8a96a2;
  margin-top: 0.25rem;
}
.journal-note-list button,
.address-book-list button {
  appearance: none;
  border: 1px solid rgba(201, 162, 39, 0.35);
  background: rgba(30, 28, 22, 0.85);
  color: #e8d48a;
  font-size: 0.72rem;
  font-weight: 700;
  padding: 0.2rem 0.45rem;
  border-radius: 4px;
  cursor: pointer;
}
.address-book-list {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  max-height: 320px;
  overflow: auto;
}
.address-group-title {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #9aa8b4;
  margin: 0.35rem 0 0.15rem;
}
.address-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.35rem 0.45rem;
  background: rgba(18, 22, 28, 0.85);
  border: 1px solid rgba(120, 140, 160, 0.2);
  border-radius: 6px;
  font-size: 0.82rem;
  color: #dce4ea;
}
.address-row .addr-kind {
  font-size: 0.68rem;
  color: #8a96a2;
  margin-left: 0.35rem;
}
.address-row-actions {
  display: flex;
  gap: 0.3rem;
  flex-shrink: 0;
}
.hud-embed.tome-embed {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  min-height: 0;
  height: 100%;
}
.hud-embed .tome-body {
  display: grid;
  grid-template-columns: minmax(140px, 200px) 1fr;
  gap: 0.75rem;
  min-height: 0;
}
/* Equipment tab: match chargen gear (doll + pack fill; no Initial Buy / identity rail) */
.hud-embed.tome-gear-fill {
  height: 100%;
  min-height: 0;
}
/* Π6: chargen parchment chrome on HUD Equipment */
.hud-embed.tome-gear-fill {
  background:
    linear-gradient(180deg, rgba(248, 240, 220, 0.97), rgba(232, 220, 190, 0.96));
  color: #2a2018;
  border-radius: 8px;
  border: 1px solid rgba(90, 70, 40, 0.28);
  padding: 0.45rem 0.55rem 0.65rem;
}
.hud-embed.tome-gear-fill .tome-party {
  margin-bottom: 0.35rem;
}
.hud-embed.tome-gear-fill .tome-party-chip {
  background: rgba(255, 252, 245, 0.9);
  border: 1px solid rgba(90, 70, 40, 0.35);
  color: #3a2a18;
}
.hud-embed.tome-gear-fill .tome-party-chip.active {
  background: linear-gradient(180deg, #e0c060, #c9a227);
  color: #1a1408;
  border-color: #a88418;
}
.hud-embed.tome-gear-fill .tome-doll-col,
.hud-embed.tome-gear-fill .tome-pack-col {
  background: transparent;
  border-right: 1px solid rgba(90, 70, 40, 0.22);
}
.hud-embed.tome-gear-fill .tome-pack-col {
  border-right: none;
}
.hud-embed.tome-gear-fill .tome-pack-banner {
  color: #7a2e24;
  font-family: Georgia, "Times New Roman", serif;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  border-bottom: 2px solid rgba(122, 46, 36, 0.35);
  padding-bottom: 0.25rem;
}
.hud-embed.tome-gear-fill .tome-gear-hint {
  color: #5a4a38;
}
.hud-embed.tome-gear-fill .tome-bag-item {
  background: rgba(255, 252, 245, 0.85);
  border: 1px solid rgba(90, 70, 40, 0.22);
  color: #2a2018;
}
.hud-embed.tome-gear-fill .tome-bag-item.selected {
  border-color: #c9a227;
  box-shadow: 0 0 0 1px rgba(201, 162, 39, 0.45);
}
.hud-embed.tome-gear-fill .bag-actions button {
  background: rgba(60, 48, 32, 0.9);
  color: #f0e6c8;
  border: 1px solid rgba(90, 70, 40, 0.45);
}
.hud-embed.tome-gear-fill .km-purse-runtime,
.hud-embed.tome-gear-fill .km-enc-runtime {
  border-color: rgba(90, 70, 40, 0.28);
  background: rgba(255, 252, 245, 0.7);
  color: #2a2018;
}
.hud-embed.tome-gear-fill .km-purse-runtime .km-appear-label,
.hud-embed.tome-gear-fill .km-enc-runtime .km-enc-band {
  color: #7a2e24;
}
/* Runtime doll on parchment: use chargen slot look */
.hud-embed.tome-gear-fill .km-doll-runtime .km-doll-figure {
  background: linear-gradient(180deg, #f3ead4, #e2d4b4) !important;
  border: 1px solid rgba(90, 70, 40, 0.3);
}
.hud-embed.tome-gear-fill .km-doll-runtime .km-doll-slot {
  background: rgba(255, 252, 245, 0.92);
  border-color: rgba(90, 70, 40, 0.5);
  color: #2a2018;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.12);
}
.hud-embed.tome-gear-fill .km-doll-runtime .km-doll-slot.is-filled {
  background: rgba(201, 162, 39, 0.22);
  border-color: var(--tome-gold, #c9a227);
}
.hud-embed.tome-gear-fill .km-doll-runtime .km-doll-slot-label {
  color: rgba(42, 32, 24, 0.65);
}
.hud-embed.tome-gear-fill .km-doll-runtime .km-doll-slot-item {
  color: #2a2018;
}
/* Shop left column: same parchment language */
.shop-party-gear {
  background:
    linear-gradient(180deg, rgba(248, 240, 220, 0.96), rgba(228, 214, 184, 0.94));
  color: #2a2018;
}
.shop-party-gear .shop-subhead {
  color: #7a2e24;
}
.shop-party-gear .shop-party-chip {
  background: rgba(255, 252, 245, 0.9);
  border-color: rgba(90, 70, 40, 0.35);
  color: #3a2a18;
}
.shop-party-gear .shop-party-chip.active {
  background: linear-gradient(180deg, #e0c060, #c9a227);
  color: #1a1408;
}
.shop-party-gear .shop-bag li,
.shop-party-gear .shop-bag .shop-bag-item {
  background: rgba(255, 252, 245, 0.92);
  border: 1px solid rgba(90, 70, 40, 0.28);
  color: #1a140c;
  font-size: 0.92rem;
  line-height: 1.35;
}
.shop-party-gear .shop-bag .shop-bi-name {
  font-weight: 650;
  color: #1a1208;
}
.shop-party-gear .shop-bag .shop-bi-meta {
  color: #4a3a28;
  font-size: 0.82rem;
}
.shop-party-gear .shop-bag .shop-bag-item.selected,
.shop-party-gear .shop-bag .shop-bag-item.multi-selected {
  outline: 2px solid #c9a227;
  background: rgba(201, 162, 39, 0.22);
}
.shop-party-gear .shop-bag-section {
  background: transparent !important;
  border: none !important;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #6a4028 !important;
  margin-top: 0.35rem;
}
.shop-party-gear .shop-bag-hint {
  margin: 0 0 0.25rem;
  color: #5a4a38;
}
.shop-party-gear .shop-party-chips.km-actor-tabs,
.shop-party-gear .shop-party-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-bottom: 0.45rem;
}
.shop-party-gear .shop-party-chip.kind-mount,
.shop-party-gear .shop-party-chip.kind-familiar {
  border-style: dashed;
}
.shop-face-badge-slim[hidden],
.shop-face-badge[hidden] {
  display: none !important;
}
.shop-body-merchant-left {
  /* grid order already in HTML: merchant | talk | party */
}
.shop-party-gear .km-doll-runtime .km-doll-figure {
  background: linear-gradient(180deg, #f3ead4, #e2d4b4) !important;
}
.shop-party-gear .km-doll-runtime .km-doll-slot {
  background: rgba(255, 252, 245, 0.92);
  border-color: rgba(90, 70, 40, 0.5);
  color: #2a2018;
}
.shop-party-gear .km-doll-runtime .km-doll-slot.is-filled {
  background: rgba(201, 162, 39, 0.22);
}
.shop-party-gear .btn-arcade {
  border-color: rgba(90, 70, 40, 0.4);
}
/* Π6 merchant: avatar clearly above shelf */
.shop-body-stage .shop-merchant {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}
.shop-merchant-card-stack {
  order: 0;
  flex-shrink: 0;
}
.shop-merchant .shop-subhead {
  order: 1;
  margin-top: 0.25rem;
}
.shop-merchant .shop-stock-list {
  order: 2;
  flex: 1;
  min-height: 0;
  overflow-y: auto;
}
.shop-merchant-card-stack .shop-stage {
  margin: 0 auto 0.35rem;
}
.shop-merchant-card-stack .shop-merchant-id {
  text-align: center;
}
/* Languages step */
.km-langs-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(12rem, 0.75fr);
  gap: 0;
  height: 100%;
  min-height: 0;
}
.km-langs-panel {
  padding: 0.65rem 0.9rem;
  overflow-y: auto;
  border-right: 1px solid rgba(90, 70, 40, 0.25);
}
.km-langs-auto,
.km-langs-known {
  margin: 0.25rem 0 0.75rem;
  padding-left: 1.1rem;
}
.km-langs-pool {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-bottom: 0.75rem;
}
.km-lang-chip {
  appearance: none;
  border: 1px solid rgba(90, 70, 40, 0.4);
  background: rgba(255, 252, 245, 0.9);
  color: #2a2018;
  font: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  padding: 0.4rem 0.75rem;
  border-radius: 6px;
  cursor: pointer;
}
.km-lang-chip:hover:not(:disabled) {
  border-color: #c9a227;
}
.km-lang-chip.active {
  background: linear-gradient(180deg, #e0c060, #c9a227);
  color: #1a1408;
  border-color: #a88418;
}
.km-lang-chip:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}
.hud-embed .tome-body-gear {
  display: block;
  min-height: 0;
  flex: 1;
  overflow: hidden;
}
.hud-embed .tome-panel-inv {
  display: grid;
  grid-template-columns: minmax(160px, 220px) 1fr;
  gap: 0.75rem;
  min-height: 280px;
}
.hud-embed .tome-panel-gear {
  display: grid;
  grid-template-columns: minmax(22rem, 1.45fr) minmax(16rem, 1fr);
  gap: 0;
  height: 100%;
  min-height: 0;
  overflow: hidden;
}
.hud-embed .tome-doll-col,
.hud-embed .tome-pack-col {
  min-height: 0;
  overflow-y: auto;
  border-right: 1px solid rgba(201, 162, 39, 0.18);
  background: rgba(10, 12, 16, 0.35);
}
.hud-embed .tome-pack-col {
  border-right: none;
  display: flex;
  flex-direction: column;
}
.hud-embed .tome-pack-col .tome-bag-wrap {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}
.hud-embed .tome-pack-col .tome-bag {
  flex: 1;
  overflow-y: auto;
  max-height: none;
}
.hud-embed .tome-pack-banner {
  margin: 0.35rem 0 0.5rem;
  color: #e0c060;
  font-size: 0.95rem;
  letter-spacing: 0.06em;
  text-align: center;
}
.hud-embed .tome-gear-hint {
  margin: 0.45rem 0 0.25rem;
  padding: 0 0.15rem;
  line-height: 1.35;
}
.hud-embed .tome-party {
  flex: 0 0 auto;
  margin-bottom: 0.25rem;
}
/* Dark-theme paper doll (runtime HUD + shop) — layout matches chargen */
.km-doll-runtime {
  width: 100%;
}
.km-doll-runtime .km-doll-stage {
  width: min(100%, 40rem);
  max-width: 100%;
}
.km-doll-runtime .km-doll-figure {
  max-height: min(58vh, 36rem);
  background: linear-gradient(180deg, #1c1810, #12100c) !important;
  border: 1px solid rgba(201, 162, 39, 0.28);
  border-radius: 8px;
}
.km-doll-runtime .km-doll-img {
  max-height: min(56vh, 34rem);
  filter: drop-shadow(0 6px 18px rgba(0, 0, 0, 0.55));
}
.km-doll-runtime .km-doll-slot {
  background: rgba(22, 20, 16, 0.92);
  border-color: rgba(201, 162, 39, 0.4);
  color: #d8d0c0;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.35);
}
.km-doll-runtime .km-doll-slot:hover:not(:disabled) {
  border-color: rgba(240, 210, 120, 0.75);
  background: rgba(40, 34, 22, 0.96);
}
.km-doll-runtime .km-doll-slot.is-filled {
  background: rgba(201, 162, 39, 0.18);
  border-color: rgba(201, 162, 39, 0.7);
}
.km-doll-runtime .km-doll-slot.is-selected,
.km-doll-runtime .km-doll-slot.is-target {
  box-shadow: 0 0 0 2px rgba(201, 162, 39, 0.55);
}
.km-doll-runtime .km-doll-slot.is-locked {
  opacity: 0.4;
  border-color: rgba(120, 110, 90, 0.35);
}
.km-doll-runtime .km-doll-slot-label {
  color: #9a9080;
}
.km-doll-runtime .km-doll-slot-item {
  color: #f0e6c8;
}
.km-doll-runtime .km-doll-slot-empty {
  color: #6a6558;
}
.km-purse-runtime,
.km-enc-runtime {
  border-color: rgba(201, 162, 39, 0.28);
  background: rgba(12, 14, 18, 0.75);
  color: #d0d8e0;
}
.km-purse-runtime .km-appear-label,
.km-enc-runtime .km-enc-band {
  color: #e0c060;
}
.km-purse-runtime .km-purse-total {
  color: #f0e6c8;
  font-weight: 700;
}
.km-purse-runtime .km-coin {
  display: inline-flex;
  gap: 0.25rem;
  margin-right: 0.55rem;
  font-size: 0.78rem;
  color: #b8c0c8;
}
.km-purse-runtime .km-coin em {
  font-style: normal;
  text-transform: uppercase;
  color: #9a9080;
  font-size: 0.68rem;
}
@media (max-width: 960px) {
  .hud-embed .tome-panel-gear {
    grid-template-columns: 1fr;
  }
}
/* Character sheet — single scrollable view + party selector */
.hud-char-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem 0.75rem;
  margin-bottom: 0.65rem;
}
.hud-char-party {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}
.hud-char-party-chip {
  appearance: none;
  border: 1px solid rgba(201, 162, 39, 0.3);
  background: rgba(24, 22, 18, 0.9);
  color: #b0b8c0;
  font-size: 0.8rem;
  font-weight: 700;
  padding: 0.4rem 0.75rem;
  border-radius: 6px;
  cursor: pointer;
}
.hud-char-party-chip:hover {
  border-color: rgba(201, 162, 39, 0.55);
  color: #e8eef2;
}
.hud-char-party-chip.active {
  background: linear-gradient(180deg, #e0c060, #c9a227);
  color: #1a1408;
  border-color: #a88418;
}
.hud-char-body {
  color: #d8e0e8;
  font-size: 0.92rem;
  line-height: 1.45;
}
.hud-char-sheet {
  overflow-y: auto;
  max-height: min(72vh, 820px);
  padding-right: 0.35rem;
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}
.hud-char-head {
  margin-bottom: 0.35rem;
}
.hud-char-name {
  color: #e0c060;
  margin: 0 0 0.25rem;
  font-size: 1.25rem;
}
.hud-char-blurb {
  margin: 0.35rem 0 0;
  max-width: 52rem;
}
.hud-char-section {
  margin: 0.35rem 0 0.55rem;
  padding: 0.55rem 0.65rem 0.65rem;
  border: 1px solid rgba(201, 162, 39, 0.16);
  border-radius: 8px;
  background: rgba(12, 14, 18, 0.45);
}
.hud-char-body h3 { color: #e0c060; margin: 0 0 0.4rem; }
.hud-char-body h4 {
  color: #c9a227;
  margin: 0 0 0.4rem;
  font-size: 0.78rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.hud-char-body h5 {
  color: #b8a060;
  margin: 0.25rem 0 0.3rem;
  font-size: 0.72rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.hud-char-two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem 1.25rem;
}
@media (max-width: 700px) {
  .hud-char-two-col { grid-template-columns: 1fr; }
}
.hud-skill-table { width: 100%; border-collapse: collapse; }
.hud-skill-table th, .hud-skill-table td {
  text-align: left;
  padding: 0.25rem 0.4rem;
  border-bottom: 1px solid rgba(255,255,255,0.06);
}
.hud-feat-list {
  margin: 0;
  padding-left: 1.1rem;
  columns: 2;
  column-gap: 1.5rem;
}
@media (max-width: 700px) {
  .hud-feat-list { columns: 1; }
}
.hud-char-actions {
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
}
.game-hud-fullscreen #hud-panel-character:not(.hidden) {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.game-hud-fullscreen #hud-panel-character .hud-char-sheet {
  flex: 1;
  max-height: none;
}
.party-row {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  flex-wrap: wrap;
  pointer-events: auto;
}
.party-row-actions {
  display: flex;
  gap: 0.35rem;
  margin-left: auto;
}
/* Operator: streetview must not show HUD/Talk/Camp/Look/Market chrome */
.party-row-actions-hidden,
.party-row-actions[hidden],
.dock-row-legacy,
.dock-row-legacy[hidden],
#screen-game .dock-row-legacy,
#screen-game .party-row-actions-hidden {
  display: none !important;
  visibility: hidden !important;
  pointer-events: none !important;
}
.util-btn-inline {
  min-width: auto;
  padding: 0.35rem 0.55rem;
}
.game-top-meta {
  flex: 1;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.25rem 0.4rem;
  font-size: 0.82rem;
  color: #d0d8e0;
  min-width: 0;
  justify-content: center;
}
.top-pc-name { font-weight: 700; color: #e8dcc4; }
.top-sep { opacity: 0.45; }
.btn-header-menu {
  appearance: none;
  border: 1px solid rgba(201, 162, 39, 0.45);
  background: linear-gradient(180deg, #3a3420, #1e1a10);
  color: #e0c060;
  font-weight: 700;
  font-size: 0.8rem;
  letter-spacing: 0.06em;
  padding: 0.4rem 0.75rem;
  border-radius: 6px;
  cursor: pointer;
}
.btn-header-menu:hover {
  border-color: #c9a227;
  box-shadow: 0 0 10px rgba(201, 162, 39, 0.25);
}
.cabinet.on-game .cabinet-base {
  min-height: 0.5rem;
  padding: 0.15rem 0.5rem;
}
.cabinet.on-game #footer-tagline,
.cabinet.on-game .footer-slot {
  display: none;
}
.hud-top-slim {
  max-width: min(40rem, 92%);
}
.hud-top-slim .message {
  font-size: 1.05rem;
  line-height: 1.4;
}
.hud-top-slim .message.message-dialogue {
  font-size: 1.15rem;
  max-width: min(48rem, 96%);
  white-space: pre-wrap;
}
body.game-paused #viewport {
  filter: brightness(0.55);
}

/* β2 / Λ4 door interact prompt — clickable as well as [E] */
.door-prompt {
  position: absolute;
  left: 50%;
  bottom: 5.5rem;
  transform: translateX(-50%);
  z-index: 40;
  padding: 0.5rem 1.15rem;
  border-radius: 6px;
  border: 1px solid rgba(201, 162, 39, 0.65);
  background: linear-gradient(180deg, rgba(28, 24, 18, 0.92), rgba(18, 15, 12, 0.94));
  color: #f0e0b0;
  font: 600 0.92rem/1.3 "Cinzel", "Palatino Linotype", serif;
  letter-spacing: 0.03em;
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.45), inset 0 1px 0 rgba(255, 230, 160, 0.12);
  pointer-events: auto;
  cursor: pointer;
  white-space: nowrap;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.6);
  user-select: none;
}
.door-prompt:hover,
.door-prompt:focus-visible {
  border-color: rgba(240, 210, 120, 0.9);
  color: #fff4d0;
  outline: none;
}
.door-prompt.hidden {
  display: none;
}
.door-prompt.arena-prompt {
  border-color: rgba(160, 190, 255, 0.7);
  color: #d8e8ff;
  background: linear-gradient(180deg, rgba(22, 28, 42, 0.94), rgba(12, 16, 28, 0.96));
}
.npc-interact-prompt {
  bottom: 5.5rem;
}

/* Wish Arena foe picker */
.arena-picker-modal {
  position: fixed;
  inset: 0;
  z-index: 120;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(6, 8, 14, 0.72);
  padding: 1rem;
}
.arena-picker-modal.hidden {
  display: none;
}
.arena-picker-panel {
  width: min(36rem, 100%);
  max-height: min(88vh, 42rem);
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  padding: 1rem 1.1rem 0.9rem;
  border-radius: 10px;
  border: 1px solid rgba(180, 200, 255, 0.35);
  background: linear-gradient(180deg, #1a2030 0%, #12161f 100%);
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.55);
  color: #e8eef8;
}
.arena-picker-head {
  position: relative;
  padding-right: 2rem;
}
.arena-picker-head h2 {
  margin: 0;
  font: 600 1.15rem/1.25 "Cinzel", serif;
  color: #f0e6c8;
}
.arena-picker-sub {
  margin: 0.25rem 0 0;
  font-size: 0.82rem;
  opacity: 0.8;
}
.arena-picker-close {
  position: absolute;
  top: -0.2rem;
  right: -0.15rem;
  border: none;
  background: transparent;
  color: #c8d0e0;
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
}
.arena-picker-label {
  display: block;
  font-size: 0.72rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  opacity: 0.7;
  margin-bottom: 0.3rem;
  width: 100%;
}
.arena-picker-tiers,
.arena-picker-packs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  align-items: center;
}
.arena-chip {
  border: 1px solid rgba(160, 180, 220, 0.4);
  background: rgba(30, 38, 55, 0.9);
  color: #dce6f8;
  border-radius: 999px;
  padding: 0.28rem 0.7rem;
  font-size: 0.8rem;
  cursor: pointer;
}
.arena-chip:hover,
.arena-chip.active {
  border-color: rgba(220, 190, 100, 0.75);
  color: #fff4d0;
  background: rgba(48, 42, 28, 0.95);
}
.arena-picker-filter {
  width: 100%;
  box-sizing: border-box;
  margin-bottom: 0.4rem;
  padding: 0.4rem 0.55rem;
  border-radius: 6px;
  border: 1px solid rgba(120, 140, 180, 0.4);
  background: rgba(10, 14, 22, 0.85);
  color: #e8eef8;
}
.arena-picker-foes {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.4rem;
  max-height: 14rem;
  overflow-y: auto;
  padding-right: 0.15rem;
}
.arena-foe-card {
  display: grid;
  grid-template-columns: 1fr auto;
  grid-template-rows: auto auto;
  gap: 0.1rem 0.4rem;
  text-align: left;
  padding: 0.45rem 0.55rem;
  border-radius: 6px;
  border: 1px solid rgba(100, 120, 160, 0.35);
  background: rgba(22, 28, 40, 0.95);
  color: inherit;
  cursor: pointer;
}
.arena-foe-card:hover {
  border-color: rgba(230, 200, 120, 0.7);
  background: rgba(40, 36, 24, 0.95);
}
.arena-foe-name {
  font-weight: 600;
  font-size: 0.88rem;
}
.arena-foe-cr {
  font-size: 0.72rem;
  opacity: 0.75;
  justify-self: end;
}
.arena-foe-sum {
  grid-column: 1 / -1;
  font-size: 0.72rem;
  opacity: 0.65;
  line-height: 1.25;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.arena-picker-empty {
  grid-column: 1 / -1;
  opacity: 0.7;
  font-size: 0.85rem;
}
.arena-picker-foot {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
  margin-top: 0.2rem;
}
.arena-picker-btn {
  border-radius: 6px;
  padding: 0.45rem 0.9rem;
  font: 600 0.88rem/1.2 "Cinzel", serif;
  cursor: pointer;
  border: 1px solid rgba(180, 160, 100, 0.5);
}
.arena-picker-btn.primary {
  background: linear-gradient(180deg, #3a3420, #2a2414);
  color: #f5e8c0;
}
.arena-picker-btn.secondary {
  background: transparent;
  color: #c8d0e0;
  border-color: rgba(140, 150, 180, 0.45);
}
@media (max-width: 520px) {
  .arena-picker-foes {
    grid-template-columns: 1fr;
  }
}

/* γ1 opportunity bus dock */
.opportunity-dock {
  position: absolute;
  top: 4.5rem;
  right: 0.75rem;
  z-index: 38;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  max-width: 16rem;
  pointer-events: auto;
}
.opportunity-dock.hidden {
  display: none;
}
.opp-card {
  padding: 0.5rem 0.65rem;
  border-radius: 6px;
  border: 1px solid rgba(180, 150, 80, 0.45);
  background: linear-gradient(165deg, rgba(32, 28, 22, 0.94), rgba(18, 16, 12, 0.96));
  box-shadow: 0 3px 14px rgba(0, 0, 0, 0.4);
  color: #e8dfc8;
  font-size: 0.78rem;
  line-height: 1.35;
}
.opp-kind {
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-size: 0.65rem;
  color: #c9a227;
  margin-bottom: 0.15rem;
}
.opp-title {
  font-family: "Cinzel", "Palatino Linotype", serif;
  font-weight: 600;
  font-size: 0.88rem;
  color: #f2e6c4;
  margin-bottom: 0.2rem;
}
.opp-sum {
  color: #b8b0a0;
  margin-bottom: 0.35rem;
}
.opp-dismiss {
  appearance: none;
  border: 1px solid rgba(160, 140, 90, 0.5);
  background: rgba(40, 34, 24, 0.9);
  color: #d8c890;
  font-size: 0.7rem;
  padding: 0.15rem 0.45rem;
  border-radius: 3px;
  cursor: pointer;
}
.opp-dismiss:hover {
  border-color: #c9a227;
  color: #ffe8a0;
}

.opp-actions {
  display: flex;
  gap: 0.35rem;
  flex-wrap: wrap;
}
.opp-act {
  appearance: none;
  border: 1px solid rgba(180, 160, 90, 0.65);
  background: rgba(60, 48, 24, 0.95);
  color: #ffe8a0;
  font-size: 0.7rem;
  padding: 0.15rem 0.5rem;
  border-radius: 3px;
  cursor: pointer;
}
.opp-act:hover {
  border-color: #e8c040;
  background: rgba(80, 60, 28, 0.98);
}

/* ═══ Shop / Market panel (Citywright U1–U3 UI) ═══ */
.shop-overlay {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: flex;
  align-items: stretch;
  justify-content: stretch;
  padding: 0;
  background: rgba(6, 5, 4, 0.88);
  backdrop-filter: blur(4px);
  pointer-events: auto;
}
.shop-overlay.hidden,
.shop-overlay[hidden] {
  display: none !important;
}

/* ── Wave 2 shop: wooden deal table over a still-visible place ── */
#shop-overlay.shop-overlay-table {
  align-items: flex-end;
  justify-content: center;
  padding: 0 2.4vw 1.15rem;
  background: transparent;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  pointer-events: none;
}
#shop-overlay.shop-overlay-table .shop-frame-table {
  pointer-events: auto;
  width: min(1180px, 94.5vw);
  height: min(44vh, 26.6rem);
  max-height: 46vh;
  max-width: none;
  border-radius: 3px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  color: #e6dcc4;
  background:
    linear-gradient(180deg, rgba(28, 18, 10, 0.28), rgba(8, 5, 3, 0.38)),
    url("/static/art/hub/ui/wood.jpg") center / cover;
  border: 1px solid rgba(201, 162, 39, 0.48);
  box-shadow:
    0 20px 44px rgba(0, 0, 0, 0.58),
    0 0 0 3px rgba(18, 10, 5, 0.62),
    inset 0 1px 0 rgba(220, 188, 96, 0.3);
}
#shop-overlay.shop-overlay-table .shop-head {
  flex: 0 0 auto;
  min-height: 2.05rem;
  padding: 0.28rem 0.55rem 0.28rem 0.7rem;
  gap: 0.55rem;
  border-bottom: 1px solid rgba(201, 162, 39, 0.28);
  background:
    linear-gradient(180deg, rgba(18, 12, 7, 0.55), rgba(10, 7, 4, 0.35));
}
#shop-overlay.shop-overlay-table .shop-kicker {
  font-size: 0.56rem;
  letter-spacing: 0.18em;
}
#shop-overlay.shop-overlay-table .shop-head-titles h2 {
  font-family: Cinzel, "Palatino Linotype", serif;
  font-size: 0.88rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: #f3e6c4;
}
#shop-overlay.shop-overlay-table .shop-merchant-id {
  flex-direction: row;
  align-items: baseline;
  gap: 0.45rem;
  min-width: 0;
  flex: 1;
}
#shop-overlay.shop-overlay-table .shop-merchant-id strong {
  font-family: Cinzel, serif;
  font-size: 0.82rem;
  color: #f0e2b8;
  white-space: nowrap;
}
#shop-overlay.shop-overlay-table .shop-close {
  margin-left: auto;
  color: #d4b45a;
}
#shop-overlay.shop-overlay-table .shop-body-table {
  display: grid;
  grid-template-columns: minmax(15.5rem, 0.92fr) minmax(16.5rem, 1.12fr) minmax(13.2rem, 0.82fr);
  gap: 0;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}
#shop-overlay.shop-overlay-table .shop-col {
  padding: 0.4rem 0.45rem 0.45rem;
  border-right: 1px solid rgba(12, 8, 4, 0.55);
  overflow: hidden;
}
#shop-overlay.shop-overlay-table .shop-col:last-child {
  border-right: none;
}
#shop-overlay.shop-overlay-table .shop-merchant {
  background: linear-gradient(90deg, rgba(8, 5, 3, 0.42), rgba(14, 9, 5, 0.18));
}
#shop-overlay.shop-overlay-table .shop-merchant-card-rail {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  margin: 0 0 0.28rem;
}
#shop-overlay.shop-overlay-table .shop-stage {
  width: 2.55rem;
  height: 2.55rem;
  flex-shrink: 0;
}
#shop-overlay.shop-overlay-table .shop-avatar-sm,
#shop-overlay.shop-overlay-table .shop-merchant-video-sm {
  width: 2.55rem !important;
  height: 2.55rem !important;
  border-radius: 2px;
}
#shop-overlay.shop-overlay-table .shop-avatar {
  width: 2.55rem;
  height: 2.55rem;
  border-radius: 2px;
  border: 1px solid rgba(201, 162, 39, 0.5);
  background: #120c08;
}
#shop-overlay.shop-overlay-table .shop-merchant-video {
  width: 2.55rem;
  height: 2.55rem;
  border-radius: 2px;
}
#shop-overlay.shop-overlay-table .shop-summary {
  margin: 0;
  font-size: 0.66rem;
  line-height: 1.25;
  color: #b8aa90;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
#shop-overlay.shop-overlay-table .shop-stock-toolbar,
#shop-overlay.shop-overlay-table .shop-bag-toolbar {
  margin: 0 0 0.22rem;
  font-size: 0.62rem;
}
#shop-overlay.shop-overlay-table .shop-stock-toolbar select,
#shop-overlay.shop-overlay-table .shop-bag-toolbar select {
  font-size: 0.62rem;
  padding: 0.08rem 0.2rem;
  background: rgba(8, 5, 3, 0.55);
  color: #d8ccb0;
  border: 1px solid rgba(201, 162, 39, 0.28);
}
#shop-overlay.shop-overlay-table .shop-stock-list {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  gap: 0;
  padding-right: 0.15rem;
}
#shop-overlay.shop-overlay-table .shop-stock-item {
  display: grid;
  grid-template-columns: 1.15rem minmax(0, 1fr) auto;
  grid-template-areas: "ico name price";
  gap: 0.28rem 0.32rem;
  align-items: center;
  padding: 0.18rem 0.32rem;
  margin: 0;
  border-radius: 0;
  border: none;
  border-bottom: 1px solid rgba(0, 0, 0, 0.42);
  background:
    linear-gradient(180deg, rgba(62, 44, 26, 0.82), rgba(36, 24, 14, 0.9));
  box-shadow: inset 0 1px 0 rgba(180, 140, 70, 0.08);
  font-size: 0.72rem;
}
#shop-overlay.shop-overlay-table .shop-stock-item:nth-child(even) {
  background:
    linear-gradient(180deg, rgba(52, 36, 22, 0.86), rgba(28, 18, 10, 0.92));
}
#shop-overlay.shop-overlay-table .shop-stock-item.selected,
#shop-overlay.shop-overlay-table .shop-stock-item.shop-stock-on-table {
  outline: none;
  border-bottom-color: rgba(201, 162, 39, 0.35);
  background:
    linear-gradient(180deg, rgba(88, 62, 28, 0.88), rgba(50, 34, 16, 0.94));
}
#shop-overlay.shop-overlay-table .shop-st-icon {
  grid-area: ico;
  width: 1.1rem;
  height: 1.1rem;
  border-radius: 1px;
  background: rgba(0, 0, 0, 0.35);
}
#shop-overlay.shop-overlay-table .shop-st-name {
  grid-area: name;
  font-size: 0.72rem;
  color: #efe4c8;
}
#shop-overlay.shop-overlay-table .shop-st-meta {
  grid-area: price;
  font-variant-numeric: tabular-nums;
  color: #c9b070;
  font-size: 0.68rem;
}
#shop-overlay.shop-overlay-table .shop-st-buy {
  display: none;
}
#shop-overlay.shop-overlay-table .shop-st-inspect {
  display: none;
  grid-area: price;
  justify-self: start;
  margin-right: 2.6rem;
  min-width: 1.05rem;
  padding: 0;
  border: none;
  background: transparent;
  color: #b89858;
  font-size: 0.62rem;
}
#shop-overlay.shop-overlay-table .shop-stock-item:hover .shop-st-inspect,
#shop-overlay.shop-overlay-table .shop-stock-item:focus-within .shop-st-inspect {
  display: inline-flex;
}
#shop-overlay.shop-overlay-table .shop-item-detail {
  position: absolute;
  left: 0.4rem;
  right: 0.4rem;
  bottom: 0.4rem;
  z-index: 4;
  max-height: 46%;
  margin: 0;
  padding: 0.4rem 0.5rem;
  border-radius: 2px;
  background: rgba(16, 11, 7, 0.94);
  border: 1px solid rgba(201, 162, 39, 0.4);
}
#shop-overlay.shop-overlay-table .shop-merchant {
  position: relative;
}
#shop-overlay.shop-overlay-table .shop-item-detail-head h4 {
  font-size: 0.82rem;
}
#shop-overlay.shop-overlay-table .shop-item-detail-body {
  font-size: 0.72rem;
  margin-bottom: 0.35rem;
}
#shop-overlay.shop-overlay-table .shop-tabletop {
  padding: 0.35rem 0.5rem 0.4rem;
  overflow: hidden;
}
#shop-overlay.shop-overlay-table .shop-plank {
  height: 100%;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 0.28rem;
  padding: 0.4rem 0.45rem 0.35rem;
  background:
    repeating-linear-gradient(
      90deg,
      rgba(48, 32, 18, 0.18) 0 18px,
      rgba(22, 14, 8, 0.22) 18px 20px
    ),
    linear-gradient(180deg, rgba(70, 48, 28, 0.22), rgba(18, 12, 7, 0.12)),
    url("/static/art/hub/ui/wood.jpg") center / 140% auto;
  box-shadow:
    inset 0 0 0 1px rgba(12, 8, 4, 0.45),
    inset 0 8px 16px rgba(0, 0, 0, 0.18);
}
#shop-overlay.shop-overlay-table .shop-tray-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.45rem;
  flex: 1;
  min-height: 0;
}
#shop-overlay.shop-overlay-table .shop-tray {
  display: flex;
  flex-direction: column;
  min-height: 0;
  min-width: 0;
}
#shop-overlay.shop-overlay-table .shop-tray-lab {
  font-size: 0.56rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: #c9a227;
  margin-bottom: 0.16rem;
}
#shop-overlay.shop-overlay-table .shop-icon-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, 2.15rem);
  grid-auto-rows: 2.15rem;
  gap: 3px;
  align-content: start;
  list-style: none;
  margin: 0;
  padding: 0;
}
#shop-overlay.shop-overlay-table .shop-icon-grid-sm {
  flex: 1;
  min-height: 4.6rem;
  overflow: hidden;
  background: rgba(8, 5, 3, 0.28);
  border: 1px solid rgba(12, 8, 4, 0.55);
  padding: 3px;
}
#shop-overlay.shop-overlay-table .shop-icon-cell,
#shop-overlay.shop-overlay-table .shop-bag-item.shop-icon-cell {
  position: relative;
  width: 2.15rem;
  height: 2.15rem;
  padding: 0;
  margin: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 1px;
  border: 1px solid rgba(70, 48, 24, 0.95);
  background: #14100b;
  cursor: pointer;
  overflow: hidden;
}
#shop-overlay.shop-overlay-table .shop-icon-cell img,
#shop-overlay.shop-overlay-table .shop-bag-item.shop-icon-cell .shop-bi-icon {
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: transparent;
  border: none;
}
#shop-overlay.shop-overlay-table .shop-icon-cell.selected,
#shop-overlay.shop-overlay-table .shop-bag-item.shop-icon-cell.selected,
#shop-overlay.shop-overlay-table .shop-bag-item.shop-icon-cell.multi-selected {
  outline: 1px solid #e0c060;
  border-color: #c9a227;
  background: #2a2010;
}
#shop-overlay.shop-overlay-table .shop-icon-qty {
  position: absolute;
  right: 1px;
  bottom: 0;
  font-size: 0.55rem;
  line-height: 1;
  color: #f4ead0;
  text-shadow: 0 0 3px #000;
}
#shop-overlay.shop-overlay-table .shop-icon-ph {
  width: 1.4rem;
  height: 1.4rem;
  font-size: 0.85rem;
}
#shop-overlay.shop-overlay-table .shop-ledger {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem 0.55rem;
  flex-shrink: 0;
}
#shop-overlay.shop-overlay-table .shop-delta {
  font-family: Cinzel, serif;
  font-weight: 700;
  font-size: 1.05rem;
  letter-spacing: 0.02em;
}
#shop-overlay.shop-overlay-table .shop-delta.is-gain {
  color: #7dce6a;
}
#shop-overlay.shop-overlay-table .shop-delta.is-loss {
  color: #d07058;
}
#shop-overlay.shop-overlay-table .shop-chip {
  font-size: 0.68rem;
  padding: 0.08rem 0.35rem;
  border-radius: 1px;
  background: rgba(8, 5, 3, 0.45);
  border: 1px solid rgba(201, 162, 39, 0.28);
}
#shop-overlay.shop-overlay-table .shop-deal {
  min-height: 0;
  font-size: 0.7rem;
  flex-shrink: 0;
}
#shop-overlay.shop-overlay-table .shop-deal-idle {
  margin: 0;
  font-size: 0.66rem;
  color: #9a8c74;
}
#shop-overlay.shop-overlay-table .shop-deal-card {
  padding: 0.22rem 0.35rem;
  border-radius: 2px;
  background: rgba(8, 5, 3, 0.4);
  border: 1px solid rgba(201, 162, 39, 0.28);
}
#shop-overlay.shop-overlay-table .shop-offer-gp {
  font-size: 0.92rem;
  color: #7dce6a;
}
#shop-overlay.shop-overlay-table .shop-deal-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: stretch;
  gap: 0.28rem;
  margin: 0;
  position: relative;
  z-index: 2;
}
#shop-overlay.shop-overlay-table .shop-stamp,
#shop-overlay.shop-overlay-table .shop-party-actions .shop-stamp {
  appearance: none;
  font-family: Cinzel, serif;
  font-size: 0.58rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #ead8a0;
  padding: 0.28rem 0.4rem;
  border-radius: 1px;
  border: 1px solid rgba(201, 162, 39, 0.42);
  background:
    linear-gradient(180deg, rgba(62, 44, 22, 0.92), rgba(28, 18, 10, 0.95));
  cursor: pointer;
}
#shop-overlay.shop-overlay-table .shop-stamp:disabled {
  opacity: 0.38;
  cursor: not-allowed;
}
#shop-overlay.shop-overlay-table .shop-stamp:not(:disabled):hover {
  border-color: rgba(240, 210, 120, 0.75);
  color: #fff4d0;
}
#shop-overlay.shop-overlay-table .shop-deal-plate {
  appearance: none;
  flex: 1 1 7.5rem;
  min-height: 1.85rem;
  font-family: Cinzel, serif;
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: #2a1c08;
  border: 1px solid rgba(90, 62, 18, 0.7);
  border-radius: 1px;
  background:
    linear-gradient(180deg, rgba(255, 236, 170, 0.18), rgba(40, 26, 8, 0.18)),
    url("/static/art/hub/ui/gold-plate.jpg") center / cover;
  cursor: pointer;
  box-shadow: inset 0 1px 0 rgba(255, 240, 190, 0.35);
}
#shop-overlay.shop-overlay-table .shop-deal-plate:disabled {
  opacity: 0.42;
  cursor: not-allowed;
  filter: grayscale(0.25);
}
#shop-overlay.shop-overlay-table .shop-deal-plate:not(:disabled):hover {
  filter: brightness(1.08);
}
#shop-overlay.shop-overlay-table .shop-dialogue-whisper {
  max-height: 2.35rem;
  min-height: 0;
  overflow: hidden;
  padding: 0.12rem 0.2rem;
  margin: 0;
  background: transparent;
  border: none;
  border-radius: 0;
  font-size: 0.64rem;
  line-height: 1.25;
  color: #c8ba9a;
}
#shop-overlay.shop-overlay-table .shop-dialogue-whisper .shop-dlg-line {
  margin: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
#shop-overlay.shop-overlay-table .shop-dialogue-whisper .shop-dlg-line:not(:last-child) {
  display: none;
}
#shop-overlay.shop-overlay-table .shop-talk-hidden,
#shop-overlay.shop-overlay-table .shop-talk-hidden[hidden],
#shop-overlay.shop-overlay-table .shop-doll-hidden,
#shop-overlay.shop-overlay-table .shop-doll-hidden[hidden] {
  display: none !important;
}
#shop-overlay.shop-overlay-table .shop-party {
  background: linear-gradient(270deg, rgba(8, 5, 3, 0.42), rgba(14, 9, 5, 0.16));
}
#shop-overlay.shop-overlay-table .shop-party-heads {
  display: flex;
  flex-wrap: nowrap;
  gap: 0.22rem;
  margin: 0 0 0.3rem;
  justify-content: flex-start;
}
#shop-overlay.shop-overlay-table .shop-party-chip {
  width: 2.35rem;
  height: 2.35rem;
  padding: 0;
  border-radius: 2px;
  overflow: hidden;
  border: 1px solid rgba(80, 55, 24, 0.9);
  background: #120c08;
  font-size: 0;
  color: transparent;
  min-height: 0;
}
#shop-overlay.shop-overlay-table .shop-party-chip img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 50% 18%;
}
#shop-overlay.shop-overlay-table .shop-party-chip .shop-party-ph {
  display: flex;
  width: 100%;
  height: 100%;
  align-items: center;
  justify-content: center;
  font-size: 0.78rem;
  font-family: Cinzel, serif;
  color: #e8d8a8;
}
#shop-overlay.shop-overlay-table .shop-party-chip.active {
  border-color: #c9a227;
  box-shadow: 0 0 0 1px rgba(201, 162, 39, 0.45);
  background: #1a140c;
}
#shop-overlay.shop-overlay-table .shop-party-chip.is-face {
  outline: 1px solid rgba(180, 210, 230, 0.45);
}
#shop-overlay.shop-overlay-table .shop-worn-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 3px;
  margin: 0 0 0.28rem;
  min-height: 1.35rem;
}
#shop-overlay.shop-overlay-table .shop-worn-slot {
  width: 1.55rem;
  height: 1.55rem;
  padding: 0;
  border-radius: 1px;
  border: 1px solid rgba(70, 48, 24, 0.85);
  background: #14100b;
  cursor: pointer;
  overflow: hidden;
}
#shop-overlay.shop-overlay-table .shop-worn-slot img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}
#shop-overlay.shop-overlay-table .shop-worn-slot.selected {
  border-color: #c9a227;
}
#shop-overlay.shop-overlay-table .shop-pack-col {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
#shop-overlay.shop-overlay-table .shop-bag.shop-icon-grid {
  flex: 1;
  min-height: 4rem;
  overflow-y: auto;
  background: rgba(8, 5, 3, 0.32);
  border: 1px solid rgba(12, 8, 4, 0.5);
  padding: 3px;
}
#shop-overlay.shop-overlay-table .shop-bag-section {
  grid-column: 1 / -1;
  height: auto;
  min-height: 0;
  padding: 0.12rem 0.1rem 0;
  margin: 0;
  background: transparent !important;
  border: none !important;
  font-size: 0.56rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #b89858 !important;
}
#shop-overlay.shop-overlay-table .shop-bag-item .shop-bi-name,
#shop-overlay.shop-overlay-table .shop-bag-item .shop-bi-meta,
#shop-overlay.shop-overlay-table .shop-bag-item .shop-bi-qty {
  display: none;
}
#shop-overlay.shop-overlay-table .shop-party-actions {
  margin-top: 0.28rem;
  gap: 0.22rem;
}
#shop-overlay.shop-overlay-table .shop-empty {
  grid-column: 1 / -1;
  font-size: 0.68rem;
  color: #8a8070;
  padding: 0.25rem;
}
@media (max-width: 960px) {
  #shop-overlay.shop-overlay-table {
    padding: 0 1.2vw 0.6rem;
  }
  #shop-overlay.shop-overlay-table .shop-frame-table {
    width: 97vw;
    height: min(72vh, 34rem);
    max-height: 78vh;
  }
  #shop-overlay.shop-overlay-table .shop-body-table {
    grid-template-columns: 1fr;
    overflow-y: auto;
  }
}
.shop-frame {
  width: min(1100px, 98vw);
  max-height: min(92vh, 900px);
  display: flex;
  flex-direction: column;
  background: linear-gradient(165deg, #2a2418 0%, #16120e 55%, #1a1510 100%);
  border: 1px solid rgba(201, 162, 39, 0.5);
  border-radius: 10px;
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.55), inset 0 0 0 1px rgba(201, 162, 39, 0.08);
  color: #e8e0d0;
  overflow: hidden;
}
/* Λ7: full viewing area — Mode A stage, not a floating box */
.shop-frame.shop-frame-stage {
  width: 100%;
  max-width: none;
  height: 100%;
  max-height: none;
  border-radius: 0;
  border-left: none;
  border-right: none;
}
.shop-facility-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
  overflow: hidden;
}
.shop-head {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.65rem 0.9rem;
  border-bottom: 1px solid rgba(201, 162, 39, 0.25);
  background: rgba(0, 0, 0, 0.25);
}
.shop-kicker {
  font-size: 0.62rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--tome-gold, #c9a227);
}
.shop-head-titles h2 {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 600;
  color: #f0e6c8;
}
.shop-head-meta {
  margin-left: auto;
  display: flex;
  gap: 0.4rem;
  align-items: center;
}
.shop-chip {
  font-size: 0.78rem;
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid rgba(201, 162, 39, 0.3);
}
.shop-close {
  background: transparent;
  border: none;
  color: #c9a227;
  font-size: 1.25rem;
  cursor: pointer;
  line-height: 1;
  padding: 0.15rem 0.35rem;
}
.shop-body {
  display: grid;
  grid-template-columns: minmax(200px, 1fr) minmax(240px, 1.15fr) minmax(220px, 1fr);
  gap: 0;
  min-height: 0;
  flex: 1;
  overflow: hidden;
}
/* Λ7 columns: PC gear (doll+pack) | dialogue | NPC — doll column a bit wider */
.shop-body.shop-body-stage {
  grid-template-columns: minmax(340px, 1.2fr) minmax(280px, 1.05fr) minmax(240px, 0.85fr);
  flex: 1;
  min-height: 0;
}
.shop-col {
  padding: 0.75rem;
  overflow-y: auto;
  min-height: 0;
  border-right: 1px solid rgba(201, 162, 39, 0.15);
  display: flex;
  flex-direction: column;
}
.shop-col:last-child {
  border-right: none;
}
/* Side columns: avoid scroll when possible; center may scroll dialogue only */
.shop-body-stage .shop-party,
.shop-body-stage .shop-merchant {
  overflow-y: auto;
}
.shop-body-stage .shop-comms {
  overflow: hidden;
}
.shop-body-stage .shop-dialogue-log {
  flex: 1;
  min-height: 8rem;
  max-height: none;
  overflow-y: auto;
}
.shop-talk-compose {
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  padding-top: 0.45rem;
  border-top: 1px solid rgba(201, 162, 39, 0.15);
  margin-top: 0.35rem;
}
.shop-deal-actions {
  position: relative;
  z-index: 2;
  flex-shrink: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-bottom: 0.35rem;
}
.shop-deal-actions .btn-arcade {
  pointer-events: auto;
  cursor: pointer;
}
.shop-deal-actions .btn-arcade:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}
.shop-pc-avatar {
  width: 96px;
  height: 96px;
  margin: 0 auto 0.45rem;
  align-self: center;
}
.shop-avatar-lg,
.shop-merchant-video-lg {
  width: 168px !important;
  height: 168px !important;
}
.shop-merchant-card-stack {
  flex-direction: column;
  align-items: center;
  text-align: center;
}
.shop-merchant-card-stack .shop-stage {
  width: 168px;
}
.shop-merchant-card-stack .shop-merchant-id {
  align-items: center;
}
.shop-subhead {
  margin: 0.6rem 0 0.35rem;
  font-size: 0.68rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--tome-gold, #c9a227);
}
.shop-merchant-card {
  display: flex;
  gap: 0.65rem;
  align-items: flex-start;
  margin-bottom: 0.55rem;
}
.shop-stage {
  position: relative;
  width: 140px;
  flex-shrink: 0;
}
.shop-avatar {
  width: 140px;
  height: 140px;
  border-radius: 10px;
  overflow: hidden;
  background: rgba(0, 0, 0, 0.45);
  border: 1px solid rgba(201, 162, 39, 0.45);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}
.shop-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
/* Waiting on Grok / talk-clip after Speak or open greet */
.shop-avatar.shop-avatar-busy::after {
  content: "";
  position: absolute;
  inset: 0;
  margin: auto;
  width: 36px;
  height: 36px;
  border: 3px solid rgba(201, 162, 39, 0.25);
  border-top-color: #c9a227;
  border-radius: 50%;
  animation: shop-avatar-spin 0.7s linear infinite;
  z-index: 3;
  box-shadow: 0 0 0 999px rgba(0, 0, 0, 0.35);
}
@keyframes shop-avatar-spin {
  to {
    transform: rotate(360deg);
  }
}
.shop-merchant-video {
  position: absolute;
  inset: 0;
  width: 140px;
  height: 140px;
  border-radius: 10px;
  object-fit: cover;
  background: #0a0c10;
  border: 1px solid rgba(201, 162, 39, 0.55);
  z-index: 2;
}
.shop-merchant-video.hidden {
  display: none;
}
.shop-clip-status {
  display: block;
  margin-top: 0.25rem;
  font-size: 0.65rem;
  color: #a89878;
}
.shop-avatar-ph {
  font-size: 1.6rem;
  color: #c9a227;
  font-weight: 700;
}
.shop-merchant-id {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  min-width: 0;
}
.shop-merchant-id strong {
  font-size: 0.95rem;
  color: #f4ead0;
}
.shop-summary {
  margin: 0.25rem 0 0;
  font-size: 0.75rem;
  color: #b8b0a0;
  line-height: 1.35;
}
.shop-field {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.75rem;
  color: #b8c0c8;
  margin-bottom: 0.35rem;
}
.shop-field span {
  min-width: 2.5rem;
}
.shop-field select,
.shop-talk-text {
  flex: 1;
  width: 100%;
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid rgba(201, 162, 39, 0.3);
  color: #e8e0d0;
  border-radius: 4px;
  padding: 0.3rem 0.4rem;
  font: inherit;
}
.shop-stock-list,
.shop-bag {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}
.shop-stock-item,
.shop-bag-item {
  display: grid;
  grid-template-columns: 1.6rem 1fr auto auto;
  gap: 0.35rem;
  align-items: center;
  padding: 0.35rem 0.4rem;
  border-radius: 4px;
  background: rgba(0, 0, 0, 0.22);
  border: 1px solid transparent;
  font-size: 0.8rem;
  cursor: pointer;
}
.shop-st-icon,
.shop-bi-icon {
  width: 1.45rem;
  height: 1.45rem;
  object-fit: contain;
  border-radius: 3px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(201, 162, 39, 0.2);
}
.shop-bag-item.selected,
.shop-doll-slot.selected {
  border-color: rgba(201, 162, 39, 0.7);
  background: rgba(80, 60, 20, 0.35);
}
.shop-st-name,
.shop-bi-name {
  color: #f0e6c8;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.shop-st-meta,
.shop-bi-meta,
.shop-bi-qty {
  font-size: 0.72rem;
  color: #9aaa8a;
}
.shop-st-buy {
  appearance: none;
  font-size: 0.72rem;
  padding: 0.15rem 0.4rem;
  border-radius: 3px;
  border: 1px solid rgba(201, 162, 39, 0.45);
  background: rgba(50, 40, 20, 0.9);
  color: #f0e6c8;
  cursor: pointer;
}
.shop-empty {
  font-size: 0.78rem;
  color: #8a8478;
  padding: 0.4rem;
}
.shop-face-badge {
  font-size: 0.78rem;
  color: #d8d0c0;
  margin-bottom: 0.4rem;
  padding: 0.3rem 0.45rem;
  border-radius: 4px;
  background: rgba(40, 50, 70, 0.35);
  border: 1px solid rgba(120, 160, 200, 0.35);
}
.shop-face-badge strong {
  color: #e8f0ff;
}
.shop-face-lab {
  color: #8aa0b8;
  font-size: 0.65rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-right: 0.35rem;
}
.shop-party-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-bottom: 0.55rem;
  justify-content: center;
}
.shop-party-chip {
  appearance: none;
  border: 1px solid rgba(201, 162, 39, 0.4);
  background: rgba(30, 26, 20, 0.95);
  color: #d8d0c0;
  font-size: 0.78rem;
  padding: 0.35rem 0.65rem;
  border-radius: 999px;
  cursor: pointer;
  min-height: 2rem;
}
.shop-party-chip:hover {
  border-color: rgba(240, 210, 120, 0.75);
  color: #fff4d8;
}
.shop-party-chip.active {
  border-color: #c9a227;
  color: #fff4d8;
  background: rgba(70, 55, 25, 0.95);
  box-shadow: 0 0 0 1px rgba(201, 162, 39, 0.35);
}
.shop-party-chip.is-face {
  outline: 1px solid rgba(120, 180, 220, 0.55);
}
}
.shop-party-chip.is-face {
  box-shadow: 0 0 0 1px rgba(120, 170, 220, 0.55);
}
/* Market party column: chargen-style doll + pack side by side */
.shop-party-gear {
  padding-top: 0.55rem;
}
.shop-gear-split {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(0, 0.95fr);
  gap: 0.55rem;
  min-height: 0;
  flex: 1;
  align-items: stretch;
}
.shop-doll-col {
  min-width: 0;
  min-height: 0;
  overflow-y: auto;
}
.shop-pack-col {
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.shop-pack-col .shop-bag {
  flex: 1;
  min-height: 8rem;
  overflow-y: auto;
}
.shop-doll.shop-doll-chargen {
  position: relative;
  min-height: 0;
  border: none;
  background: transparent;
  margin: 0;
  display: block;
  padding: 0;
}
.shop-doll.shop-doll-chargen .km-doll-runtime .km-doll-stage {
  width: 100%;
  max-width: 100%;
}
.shop-doll.shop-doll-chargen .km-doll-runtime .km-doll-figure {
  max-height: min(48vh, 28rem);
  /* Match chargen gear step parchment (not dark runtime default) */
  background: linear-gradient(180deg, #f3ead4, #e2d4b4) !important;
  border-color: rgba(90, 70, 40, 0.28);
}
.shop-doll.shop-doll-chargen .km-doll-runtime .km-doll-img {
  max-height: min(46vh, 26rem);
  filter: none;
}
/* Mount / familiar proportions match chargen paper-doll actors */
.shop-doll.shop-doll-chargen .km-doll-runtime .km-mount-figure {
  aspect-ratio: 3 / 4;
  max-height: min(48vh, 28rem);
}
.shop-doll.shop-doll-chargen .km-doll-runtime .km-familiar-figure {
  aspect-ratio: 1 / 1;
  max-height: min(36vh, 20rem);
  width: min(100%, 16rem);
  margin-inline: auto;
}
@media (max-width: 1100px) {
  .shop-gear-split {
    grid-template-columns: 1fr;
  }
}
/* Legacy compact shop doll (unused when chargen stage is active) */
.shop-doll {
  position: relative;
  min-height: 160px;
  border-radius: 8px;
  border: 1px solid rgba(201, 162, 39, 0.25);
  background: rgba(0, 0, 0, 0.28);
  margin-bottom: 0.45rem;
  display: flex;
  align-items: stretch;
  gap: 0.35rem;
  padding: 0.4rem;
}
.shop-doll-figure {
  flex: 0 0 42%;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 140px;
}
.shop-doll-figure img {
  max-width: 100%;
  max-height: 180px;
  object-fit: contain;
  border-radius: 4px;
}
.shop-doll-ph {
  width: 72px;
  height: 96px;
  border-radius: 8px;
  background: rgba(40, 36, 28, 0.9);
  border: 1px dashed rgba(201, 162, 39, 0.35);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
  color: #c9a227;
}
.shop-doll-slots {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  justify-content: center;
}
.shop-doll-slot {
  appearance: none;
  text-align: left;
  border: 1px solid rgba(201, 162, 39, 0.35);
  background: rgba(20, 18, 14, 0.9);
  color: #d8d0c0;
  border-radius: 5px;
  padding: 0.35rem 0.45rem;
  font-size: 0.74rem;
  cursor: pointer;
  display: grid;
  grid-template-columns: auto 1fr;
  grid-template-rows: auto auto;
  column-gap: 0.35rem;
  min-height: 2.1rem;
}
.shop-doll-slot:hover {
  border-color: rgba(240, 210, 120, 0.65);
  background: rgba(40, 34, 24, 0.95);
}
.shop-doll-slot.filled {
  border-color: rgba(201, 162, 39, 0.6);
}
.shop-doll-slot.selected {
  box-shadow: 0 0 0 1px rgba(201, 162, 39, 0.55);
}
.shop-doll-slot .sds-ico {
  grid-row: 1 / span 2;
  align-self: center;
}
.shop-doll-slot .sds-lab {
  color: #9a9080;
  font-size: 0.65rem;
}
.shop-doll-slot .sds-item {
  color: #f0e6c8;
}
.shop-doll-slot .sds-empty {
  color: #6a6558;
  font-style: italic;
}
.shop-party-actions,
.shop-deal-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-top: 0.5rem;
}
.shop-deal {
  min-height: 4rem;
  font-size: 0.82rem;
}
.shop-deal-card {
  padding: 0.5rem 0.55rem;
  border-radius: 6px;
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid rgba(201, 162, 39, 0.3);
}
.shop-offer-gp {
  color: #e8c040;
  font-style: normal;
  font-weight: 700;
  font-size: 1.05rem;
}
.shop-deal-meta {
  font-size: 0.72rem;
  color: #9aaa8a;
  margin-top: 0.25rem;
}
.shop-eager {
  color: #e8a060;
}
.shop-tell {
  margin: 0.3rem 0 0;
  font-size: 0.78rem;
  color: #c8d8e8;
  font-style: italic;
}
.shop-deal-msg {
  margin: 0.35rem 0 0;
  font-size: 0.78rem;
  color: #c8c0b0;
}
.shop-dialogue-log {
  max-height: 10rem;
  overflow-y: auto;
  padding: 0.4rem 0.45rem;
  margin-bottom: 0.4rem;
  background: rgba(0, 0, 0, 0.28);
  border: 1px solid rgba(201, 162, 39, 0.2);
  border-radius: 4px;
  font-size: 0.78rem;
  line-height: 1.4;
}
.shop-dlg-line {
  margin-bottom: 0.3rem;
}
.shop-dlg-who {
  color: #c9a227;
  font-weight: 600;
  margin-right: 0.25rem;
}
.shop-talk-text {
  resize: vertical;
  min-height: 2.4rem;
  margin-bottom: 0.35rem;
}
.shop-voice-panel.hidden,
.shop-voice-panel[hidden] {
  display: none !important;
}

/* —— Craft commissions (soft vendor) —— */
.shop-craft-hint {
  margin: 0 0 0.4rem;
  line-height: 1.35;
}
.shop-subhead-sm {
  margin-top: 0.55rem;
  font-size: 0.62rem;
}
.shop-craft-casters {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  margin-bottom: 0.45rem;
  max-height: 8rem;
  overflow-y: auto;
}
.shop-craft-card {
  padding: 0.4rem 0.45rem;
  border-radius: 5px;
  border: 1px solid rgba(120, 160, 200, 0.28);
  background: rgba(20, 28, 40, 0.45);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 0.12rem;
  font-size: 0.78rem;
}
.shop-craft-card:hover,
.shop-craft-card.active {
  border-color: rgba(140, 180, 220, 0.65);
  background: rgba(40, 55, 75, 0.5);
}
.shop-craft-caps {
  font-size: 0.68rem;
  color: #a8c8e0;
}
.shop-craft-sum {
  margin: 0.15rem 0 0;
  font-size: 0.7rem;
  color: #9a9080;
  line-height: 1.3;
}
.shop-craft-orders {
  list-style: none;
  margin: 0 0 0.5rem;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}
.shop-craft-order {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.2rem 0.4rem;
  padding: 0.35rem 0.4rem;
  border-radius: 4px;
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid transparent;
  font-size: 0.78rem;
}
.shop-craft-order.ready {
  border-color: rgba(120, 200, 120, 0.45);
}
.shop-co-name {
  color: #f0e6c8;
  grid-column: 1;
}
.shop-co-meta {
  grid-column: 1;
  font-size: 0.68rem;
  color: #9aaa8a;
}
.shop-co-claim {
  grid-column: 2;
  grid-row: 1 / span 2;
  align-self: center;
  font-size: 0.72rem !important;
  padding: 0.2rem 0.45rem !important;
}

@media (max-width: 960px) {
  .shop-body,
  .shop-body.shop-body-stage {
    grid-template-columns: 1fr;
    overflow-y: auto;
  }
  .shop-body-stage .shop-comms {
    overflow: visible;
  }
  .shop-body-stage .shop-dialogue-log {
    max-height: 12rem;
  }
  .shop-col {
    border-right: none;
    border-bottom: 1px solid rgba(201, 162, 39, 0.15);
    max-height: none;
  }
  /* Mobile order: NPC → dialogue → party goods */
  .shop-body-stage .shop-merchant {
    order: 1;
  }
  .shop-body-stage .shop-comms {
    order: 2;
  }
  .shop-body-stage .shop-party {
    order: 3;
  }
}

/* —— W1–W2 phrase wallet —— */
.wallet-create-lead {
  margin: 0 auto 0.65rem;
  max-width: min(28rem, 100%);
  font-size: 0.9rem;
  text-align: center;
}
.wallet-footnote {
  margin: 1.25rem auto 0;
  padding-top: 0.85rem;
  border-top: 1px solid rgba(100, 90, 70, 0.45);
  max-width: min(28rem, 100%);
  width: 100%;
  text-align: left;
  font-size: 0.72rem;
  line-height: 1.4;
  color: #7a8490;
  box-sizing: border-box;
}
.wallet-footnote p {
  margin: 0 0 0.55rem;
}
.wallet-footnote p:last-child {
  margin-bottom: 0;
}
.wallet-footnote strong {
  color: #9a8a70;
  font-weight: 600;
}
.wallet-status {
  margin: 0.35rem auto 0.75rem;
  font-size: 0.92rem;
  color: #c9b878;
  line-height: 1.35;
  max-width: min(28rem, 100%);
  text-align: center;
}
.wallet-status.inactive {
  color: #8a9aaa;
}
.wallet-lead {
  margin: 0 auto 1rem;
  max-width: min(28rem, 100%);
  line-height: 1.45;
  text-align: center;
}
.wallet-inner {
  max-width: min(32rem, 100%);
  width: 100%;
}
.wallet-panel {
  margin: 0.75rem auto 1rem;
  width: 100%;
  max-width: min(28rem, 100%);
  display: flex;
  flex-direction: column;
  align-items: center;
}
.wallet-identity-prompt {
  text-align: center;
  max-width: min(28rem, 100%);
  margin-left: auto;
  margin-right: auto;
}
.wallet-actions.hub-actions,
.wallet-panel .hub-actions {
  margin-inline: auto;
  align-items: stretch;
}
.wallet-warn {
  color: #e8a070;
  font-size: 0.9rem;
  line-height: 1.4;
  margin: 0 0 0.75rem;
  border-left: 3px solid #c07040;
  padding-left: 0.65rem;
}
.wallet-phrase {
  background: #12161c;
  border: 1px solid #3a4550;
  color: #e8e0c8;
  padding: 0.85rem 1rem;
  border-radius: 4px;
  white-space: pre-wrap;
  word-break: break-word;
  font-family: ui-monospace, "Cascadia Code", monospace;
  font-size: 0.95rem;
  line-height: 1.5;
  user-select: all;
}
.wallet-phrase-input {
  width: 100%;
  box-sizing: border-box;
  background: #12161c;
  border: 1px solid #3a4550;
  color: #e8e0c8;
  padding: 0.65rem 0.75rem;
  border-radius: 4px;
  font-family: ui-monospace, "Cascadia Code", monospace;
  font-size: 0.9rem;
  resize: vertical;
  margin: 0.35rem 0 0.75rem;
}
.wallet-label {
  display: block;
  font-size: 0.85rem;
  color: #a8b0b8;
  margin-top: 0.5rem;
}
.wallet-check {
  display: flex;
  gap: 0.5rem;
  align-items: flex-start;
  font-size: 0.9rem;
  color: #d0c8b0;
  margin: 0.75rem 0;
  cursor: pointer;
}
.wallet-check input {
  margin-top: 0.2rem;
}
.wallet-actions {
  margin-top: 0.5rem;
}
.wallet-bound-line {
  color: #c9e8a0;
  line-height: 1.4;
}
#wallet-error.wallet-ok {
  color: #9dca7a;
}

.wallet-sldk {
  margin: 0.75rem 0 1rem;
  padding: 0.75rem 0.85rem;
  border: 1px solid #3a5040;
  border-radius: 4px;
  background: rgba(20, 40, 28, 0.45);
  max-width: 36rem;
}
.wallet-sldk-title {
  margin: 0 0 0.35rem;
  font-size: 0.95rem;
  color: #a8d8b0;
  font-weight: 600;
}
.wallet-sldk-display {
  margin: 0;
  font-size: 1.15rem;
  color: #e8f0c8;
  font-variant-numeric: tabular-nums;
}
.wallet-sldk-meta {
  margin: 0.25rem 0 0.5rem;
  font-size: 0.8rem;
}
.wallet-sldk-metals {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem 0.85rem;
  font-size: 0.88rem;
  color: #c0c8b0;
}
.wallet-sldk-metals .metal-id {
  text-transform: uppercase;
  color: #8ab090;
  margin-right: 0.25rem;
}
.wallet-sldk-metals .metal-n {
  font-variant-numeric: tabular-nums;
  color: #e0e8d0;
}

/* Identity / save lists */
.wallet-identity-prompt {
  margin: 0 auto 0.85rem;
  font-size: 0.92rem;
  line-height: 1.4;
  color: #c8c0a8;
  max-width: min(28rem, 100%);
}
.save-list-inner {
  max-width: min(36rem, 100%);
  width: 100%;
}
.save-list-lead {
  margin: 0 auto 0.85rem;
  line-height: 1.4;
  max-width: min(32rem, 100%);
  text-align: center;
}
.save-list-sub {
  margin: 1.1rem 0 0.5rem;
  font-size: 0.95rem;
  color: #c9b878;
}
.save-list {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  margin: 0 auto 1rem;
  max-height: 50vh;
  overflow-y: auto;
  width: 100%;
  max-width: min(32rem, 100%);
}
.save-list-item {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0.45rem;
  text-align: left;
  padding: 0.65rem 0.85rem;
  border: 1px solid #3a4550;
  border-radius: 4px;
  background: rgba(18, 22, 28, 0.85);
  color: #e0dcc8;
  font: inherit;
}
.save-list-row {
  cursor: default;
}
.save-list-item:hover,
.save-list-item:focus-within {
  border-color: #c9b878;
  outline: none;
}
.save-list-item.active-slot {
  border-color: #6a9a70;
}
.save-list-info {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  min-width: 0;
}
.save-list-item .save-title {
  font-weight: 600;
  color: #f0e8c8;
}
.save-list-item .save-meta {
  font-size: 0.8rem;
  color: #8a9aaa;
}
.save-list-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  justify-content: flex-end;
}
.save-list-actions .btn-arcade {
  font-size: 0.78rem;
  padding: 0.35rem 0.65rem;
  min-width: 0;
}
.save-list-actions .save-act-delete {
  opacity: 0.9;
  border-color: #6a4040;
  color: #e8c0c0;
}
.save-list-actions .save-act-delete:hover {
  border-color: #c06060;
  color: #fff0f0;
}
.save-list-empty {
  margin: 0 0 1rem;
}

/* ═══ Ζ / U7 explore chrome (Ultima VII Trinsic reference) ═══ */
#viewport.u7-pixel {
  image-rendering: pixelated;
  image-rendering: crisp-edges;
}
.u7-chrome {
  position: absolute;
  inset: 0;
  z-index: 4;
  pointer-events: none;
  font-family: "Segoe UI", Tahoma, sans-serif;
}
.u7-chrome.hidden {
  display: none !important;
}
.u7-minimap-wrap {
  position: absolute;
  top: 0.55rem;
  right: 0.55rem;
  width: 9.5rem;
  padding: 0.28rem;
  background: linear-gradient(165deg, #0a1830, #061018);
  border: 2px solid #2a4a8a;
  box-shadow: 0 0 0 1px #102040, 0 6px 18px rgba(0, 0, 0, 0.55);
}
#u7-minimap {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 1;
  background: #041428;
  image-rendering: pixelated;
  border: 1px solid #1a3060;
}
.u7-minimap-meta {
  margin-top: 0.2rem;
  font-size: 0.62rem;
  line-height: 1.25;
  color: #9ab0d0;
  font-variant-numeric: tabular-nums;
  white-space: pre-line;
}
/* Sheet under minimap retired — party dock + Character HUD (2026-08-06 chrome) */
.u7-sheet,
#u7-sheet {
  display: none !important;
}
.u7-sheet-legacy {
  position: absolute;
  top: 11rem;
  right: 0.55rem;
  width: 9.5rem;
  padding: 0.45rem 0.5rem 0.4rem;
  background: linear-gradient(180deg, #1a2218 0%, #101610 100%);
  border: 2px solid #6a5a28;
  box-shadow: 0 0 0 1px #2a2010, 0 8px 20px rgba(0, 0, 0, 0.5);
  color: #e8e0c8;
}
.u7-sheet-head {
  display: flex;
  gap: 0.4rem;
  align-items: center;
  margin-bottom: 0.35rem;
  border-bottom: 1px solid #3a3420;
  padding-bottom: 0.35rem;
}
.u7-sheet-portrait {
  width: 2.4rem;
  height: 2.4rem;
  object-fit: cover;
  border: 1px solid #8a7840;
  background: #0a1008;
  image-rendering: auto;
}
.u7-sheet-name {
  font-size: 0.82rem;
  font-weight: 700;
  color: #f0e8a8;
  line-height: 1.15;
}
.u7-sheet-class {
  font-size: 0.65rem;
  color: #a89868;
  margin-top: 0.1rem;
}
.u7-sheet-stats {
  margin: 0;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.08rem 0.35rem;
  font-size: 0.68rem;
  line-height: 1.25;
}
.u7-sheet-stats dt {
  margin: 0;
  color: #9a9070;
  font-weight: 600;
}
.u7-sheet-stats dd {
  margin: 0;
  text-align: right;
  font-variant-numeric: tabular-nums;
  color: #f0ece0;
}
.u7-sheet-foot {
  display: flex;
  justify-content: space-between;
  margin-top: 0.4rem;
  padding-top: 0.3rem;
  border-top: 1px solid #3a3420;
  font-size: 0.68rem;
  font-weight: 700;
  color: #e0d090;
}
.u7-sheet-hint {
  margin: 0.35rem 0 0;
  font-size: 0.58rem;
  line-height: 1.3;
  color: #6a7060;
}

/* ═══ Seldorak combat shell — full viewport overlay, thin painted chrome ═══ */
/* Parent: .viewport-wrap (positioned). Never a left-column box. */
#screen-game .viewport-wrap,
.viewport-wrap {
  position: relative !important;
}

/* Kill legacy .combat-dock box when KM shell is active */
#screen-game #combat-dock.km-combat-root,
#combat-dock.km-combat-root,
.combat-dock.km-combat-root,
.km-combat-root {
  position: absolute !important;
  inset: 0 !important;
  left: 0 !important;
  right: 0 !important;
  top: 0 !important;
  bottom: 0 !important;
  width: auto !important;
  max-width: none !important;
  max-height: none !important;
  min-width: 0 !important;
  min-height: 0 !important;
  height: auto !important;
  z-index: 35 !important;
  pointer-events: none !important;
  display: block !important;
  padding: 0 !important;
  margin: 0 !important;
  gap: 0 !important;
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
  border-radius: 0 !important;
  overflow: visible !important;
  color: #e8edf4;
  font-size: 0.82rem;
}
#screen-game #combat-dock.km-combat-root.hidden,
#combat-dock.km-combat-root.hidden,
.combat-dock.km-combat-root.hidden {
  display: none !important;
}

/* Shared glass (legacy drawers / non-combat). Combat chrome is painted metal. */
.km-glass {
  background: linear-gradient(180deg, #2a2418, #16120c);
  border: 1px solid rgba(201, 162, 39, 0.45);
  border-radius: 2px;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.4);
}

/* ── Initiative rail: small framed faces, top-center ── */
.km-init-rail {
  position: absolute;
  top: 0.28rem;
  left: 50%;
  transform: translateX(-50%);
  z-index: 3;
  display: flex;
  flex-direction: row;
  flex-wrap: nowrap;
  gap: 0.18rem;
  justify-content: center;
  align-items: flex-end;
  width: auto;
  max-width: calc(100% - 1.2rem);
  padding: 0;
  pointer-events: auto;
  box-sizing: border-box;
}
.km-init-card {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  position: relative;
  min-width: 2.35rem;
  max-width: 2.55rem;
  width: 2.45rem;
  padding: 0;
  overflow: visible;
  text-align: center;
  font-size: 0.58rem;
  color: #f0e6c8;
  transition: border-color 0.12s, box-shadow 0.12s;
  background: #1a140c;
  border: 1px solid #a88840;
  border-radius: 2px;
  box-shadow: 0 0 0 1px #2a1c0c, 0 4px 10px rgba(0, 0, 0, 0.4);
}
.km-init-card.is-active {
  min-width: 3.15rem;
  max-width: 3.35rem;
  width: 3.25rem;
  transform: none;
  border-color: #d4b24a;
  box-shadow:
    0 0 0 1px #3a2a10,
    0 0 10px rgba(212, 178, 74, 0.35);
  z-index: 2;
}
.km-init-card.foe {
  border-color: #8a4040;
  cursor: pointer;
}
/* Pathfinder-style: mouse-over target in scene → brighten initiative card */
.km-init-card.is-target-hover {
  border-color: #e8a050 !important;
  box-shadow:
    0 0 0 1px #3a2410,
    0 0 12px rgba(232, 160, 80, 0.45);
  z-index: 3;
  filter: brightness(1.1);
}
.km-init-card.foe.is-target-hover {
  border-color: #e07050 !important;
}
/* HP bar — top of portrait */
.km-init-bar {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  z-index: 2;
  height: 3px;
  background: rgba(0, 0, 0, 0.62);
  overflow: hidden;
  flex: 0 0 auto;
  border-radius: 0;
}
.km-init-bar > i {
  display: block;
  height: 100%;
  background: linear-gradient(180deg, #8cbc58, #3a6828);
}
.km-init-card.foe .km-init-bar > i {
  background: linear-gradient(180deg, #d06060, #602020);
}
.km-init-face {
  width: 100%;
  height: 2.35rem;
  margin: 0;
  border-radius: 0;
  background: #1a140c;
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  color: #e8d090;
  font-size: 0.9rem;
  overflow: hidden;
  flex: 0 0 auto;
}
.km-init-face img,
.km-face-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 50% 18%;
  display: block;
  border-radius: 0;
}
.km-face-empty {
  display: block;
  width: 100%;
  height: 100%;
  background:
    linear-gradient(180deg, rgba(201, 162, 39, 0.18) 0%, rgba(12, 8, 4, 0.55) 100%),
    url("art/hub/ui/wood.jpg") center / cover;
  box-shadow:
    inset 0 0 0 1px rgba(201, 162, 39, 0.34),
    inset 0 0 16px rgba(0, 0, 0, 0.5);
}
.km-init-card.is-faceless,
.km-party-card.is-faceless {
  background: #1a140c;
}
.km-init-card.is-active .km-init-face {
  width: 100%;
  height: 3.05rem;
  font-size: 1.05rem;
}
.km-init-name {
  display: none;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  padding: 0 0.15rem 0.08rem;
  font-size: 0.52rem;
  letter-spacing: 0.02em;
  text-shadow: 0 1px 2px #000;
}
.km-init-card.is-active .km-init-name,
.km-init-card.foe .km-init-name {
  display: block;
}
.km-init-hp {
  display: none;
}
/* Effects — tiny dots on the frame */
.km-init-fx {
  position: absolute;
  right: 2px;
  bottom: 2px;
  z-index: 2;
  display: flex;
  flex-wrap: nowrap;
  justify-content: flex-end;
  align-items: center;
  gap: 2px;
  min-height: 0;
  max-height: 0.7rem;
  overflow: hidden;
  padding: 0;
  border: none;
  border-radius: 0;
  cursor: default;
}
.km-fx-chip {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #888;
  display: inline-block;
  flex: 0 0 auto;
}
.km-fx-chip.status-good { background: #60c070; }
.km-fx-chip.status-bad { background: #c05050; }
.km-fx-chip.status-neutral { background: #a09060; }
.km-fx-more {
  font-size: 0.55rem;
  color: #c0b090;
  flex: 0 0 auto;
  line-height: 1;
}
.km-fx-pop {
  display: none;
  position: absolute;
  bottom: calc(100% + 6px);
  left: 50%;
  transform: translateX(-50%);
  min-width: 9rem;
  max-width: 16rem;
  max-height: 12rem;
  overflow-y: auto;
  padding: 0.45rem 0.55rem;
  background: linear-gradient(165deg, rgba(18, 22, 30, 0.96), rgba(10, 12, 16, 0.97));
  border: 1px solid rgba(201, 162, 39, 0.55);
  border-radius: 10px;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  font-size: 0.7rem;
  color: #e8dcc4;
  text-align: left;
  z-index: 60;
  pointer-events: none;
  white-space: normal;
  line-height: 1.35;
}
.km-fx-pop div {
  padding: 0.1rem 0;
  border-bottom: 1px solid rgba(201, 162, 39, 0.12);
}
.km-fx-pop div:last-child { border-bottom: none; }
.km-init-fx:hover .km-fx-pop,
.km-party-fx:hover .km-fx-pop,
.km-init-fx:focus-within .km-fx-pop,
.km-party-fx:focus-within .km-fx-pop {
  display: block;
}

/* ── Bottom chrome: hugs the floor, plate stays most of the frame ── */
.km-combat-main {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0.28rem;
  z-index: 3;
  display: flex !important;
  flex-direction: row;
  align-items: flex-end;
  justify-content: center;
  gap: 0;
  width: auto;
  max-width: none;
  margin: 0;
  padding: 0;
  pointer-events: none;
  box-sizing: border-box;
}
.km-combat-main > * {
  pointer-events: auto;
}

/* Center column — one metal plate sitting on large portrait frames */
.km-center {
  flex: 0 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0;
  width: max-content;
  max-width: min(46rem, 72vw);
  margin: 0 auto;
  position: relative;
}

.km-plate {
  position: relative;
  z-index: 5;
  width: 100%;
  box-sizing: border-box;
  margin: 0 0 -2.75rem;
  padding: 0.95rem 0.45rem 0.38rem;
  border-radius: 2px;
  /* Live lintel — trough covers AE + hotbar so empty wells are this metal, not the gold rail. */
  background-color: #2a2014;
  background-image:
    linear-gradient(180deg, rgba(232, 196, 120, 0.18) 0%, transparent 14%, rgba(12, 8, 4, 0.22) 100%),
    url("art/hub/ui/metal-lintel.jpg");
  background-size: auto, 100% 200%;
  background-position: center, center 35%;
  border: 1px solid #6a5430;
  border-top-color: #d4b06a;
  border-bottom-color: #1a1208;
  box-shadow:
    inset 0 1px 0 rgba(232, 204, 140, 0.38),
    inset 0 -1px 0 rgba(0, 0, 0, 0.72),
    inset 0 0 0 1px rgba(40, 28, 12, 0.45),
    inset 0 -16px 22px rgba(0, 0, 0, 0.45),
    0 10px 22px rgba(0, 0, 0, 0.55);
}
.km-plate::before,
.km-plate::after {
  content: "";
  position: absolute;
  top: 0.34rem;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #e8d0a0, #8a6a38 46%, #3a2a14 70%, #1a1208);
  box-shadow:
    0 0 0 1px #1a1208,
    inset 0 1px 0 rgba(255, 230, 180, 0.4);
  pointer-events: none;
}
.km-plate::before { left: 0.38rem; }
.km-plate::after { right: 0.38rem; }
.km-combat-root .hidden {
  display: none !important;
}

.km-crest-rail {
  position: absolute;
  top: -1.08rem;
  left: 16%;
  right: 16%;
  display: flex;
  justify-content: space-between;
  z-index: 6;
  pointer-events: none;
}

.km-action-economy {
  display: flex;
  flex-direction: row;
  align-items: stretch;
  gap: 0;
  width: 100%;
  max-width: none;
  padding: 0.04rem 0.12rem 0.1rem;
  border: none;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  box-sizing: border-box;
}
.km-ae-slot {
  flex: 1 1 0;
  min-width: 0;
  text-align: center;
  padding: 0.16rem 0.2rem 0.1rem;
  border-right: 1px solid rgba(120, 92, 48, 0.4);
  font-size: 0.58rem;
  color: #d8c8a0;
  text-shadow: 0 1px 0 #000;
}
.km-ae-slot:last-child { border-right: none; }
.km-ae-slot em {
  display: block;
  font-style: normal;
  letter-spacing: 0.12em;
  font-size: 0.48rem;
  color: #b09060;
  text-transform: uppercase;
}
.km-ae-slot span { display: none; }
.km-ae-slot.is-spent { opacity: 0.38; }
.km-ae-slot b.ae-ready,
.km-ae-slot b.ae-spent { display: none; }
.km-ae-primary,
.km-ae-jewel {
  flex: 2.1 1 0;
  background:
    linear-gradient(180deg, rgba(255, 230, 180, 0.22) 0%, transparent 40%, rgba(20, 12, 4, 0.35) 100%),
    repeating-linear-gradient(90deg, rgba(255, 240, 200, 0.08) 0 1px, transparent 1px 3px),
    linear-gradient(180deg, #c4a060 0%, #8a6a32 48%, #4a3818 100%);
  border-radius: 1px;
  border: 1px solid #c4a050;
  color: #2a1c08;
  box-shadow:
    inset 0 1px 0 rgba(255, 236, 180, 0.4),
    inset 0 0 0 1px rgba(40, 28, 8, 0.35),
    0 0 0 1px #0c0e12;
  padding: 0.1rem 0.35rem 0.14rem;
}
.km-ae-jewel em {
  color: #3a2810;
  font-size: 0.44rem;
  letter-spacing: 0.12em;
}
.km-ae-slot[data-ae="std"],
.km-ae-slot[data-ae="step"],
.km-ae-slot[data-ae="move"] {
  cursor: pointer;
}
.km-ae-jewel span,
.km-ae-jewel .ae-jewel-face {
  display: block;
  font-family: Cinzel, Georgia, serif;
  font-size: 0.82rem;
  font-weight: 700;
  color: #2a1c08;
  letter-spacing: 0.03em;
  text-shadow: 0 1px 0 rgba(255, 230, 160, 0.35);
  line-height: 1.15;
}
.km-ae-jewel.is-spent {
  opacity: 0.55;
  filter: saturate(0.6);
}

.km-hotbar-row {
  display: flex;
  flex-direction: row;
  align-items: stretch;
  gap: 0;
  width: 100%;
  max-width: none;
}
.km-loadout-row {
  position: absolute;
  top: 0.18rem;
  right: 0.38rem;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 0.12rem;
  width: auto;
  max-width: 7.5rem;
  margin: 0;
  z-index: 6;
}
.km-loadout-label {
  font-size: 0.52rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: rgba(232, 208, 144, 0.65);
  font-weight: 700;
  margin-right: 0.08rem;
}
.km-loadout-hint {
  display: none;
}
.km-loadout-row:has(.km-loadout-hint) {
  display: none;
}
.km-drawer .muted,
.km-drawer .muted.small {
  color: #5a4a38;
}
.km-loadout-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.16rem;
  padding: 0.04rem 0.32rem;
  border-radius: 2px;
  border: 1px solid #6a5a38;
  background: #1c1810;
  color: #e8d8b0;
  font-size: 0.6rem;
  cursor: pointer;
}
.km-loadout-chip kbd {
  font-size: 0.55rem;
  opacity: 0.7;
  font-family: inherit;
}
.km-loadout-chip.is-active {
  border-color: #d4b24a;
  background: linear-gradient(180deg, #6a5420, #3a2e10);
  box-shadow: none;
  color: #fff4c8;
}
.km-loadout-chip.is-empty,
.km-loadout-chip:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}
.km-loadout-chip:not(:disabled):hover {
  border-color: #d4b24a;
}
.km-init-card.is-out-of-range {
  outline: none;
  opacity: 0.55;
  filter: saturate(0.45);
}
.km-init-card.is-out-of-range::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  box-shadow: inset 0 0 0 1px rgba(80, 110, 180, 0.55);
}
.shop-bag-section,
.tome-bag-section {
  list-style: none;
  margin: 0.55rem 0 0.2rem;
  padding: 0.2rem 0.1rem;
  font-size: 0.72rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: rgba(200, 175, 110, 0.9);
  border-bottom: 1px solid rgba(201, 162, 39, 0.25);
}
.shop-bag-section strong,
.tome-bag-section strong {
  color: #f0e4c0;
  font-weight: 700;
  text-transform: none;
  letter-spacing: 0;
  font-size: 0.85rem;
}
.km-drawer-tab,
.km-drawer-tab.km-crest {
  pointer-events: auto;
  width: 2.25rem;
  height: 2.25rem;
  border-radius: 50%;
  border: 2px solid #8a6a38;
  background:
    radial-gradient(circle at 34% 28%, #8a6e42, #3a2a16 55%, #1a1208);
  color: #f0e0b8;
  font-weight: 700;
  font-family: Cinzel, Georgia, serif;
  font-size: 0.92rem;
  text-shadow: 0 1px 2px #000;
  box-shadow:
    0 0 0 2px #1a1208,
    0 5px 10px rgba(0, 0, 0, 0.6),
    inset 0 1px 0 rgba(232, 208, 150, 0.35),
    inset 0 -6px 8px rgba(0, 0, 0, 0.5);
  cursor: pointer;
  line-height: 1;
}
.km-drawer-tab.active,
.km-drawer-tab.km-crest.active {
  border-color: #c4a050;
  background: radial-gradient(circle at 34% 28%, #6a6254, #2a2820 55%, #101214);
  box-shadow:
    0 0 0 2px #0c0e12,
    0 0 10px rgba(196, 160, 80, 0.28),
    inset 0 1px 0 rgba(230, 220, 190, 0.4);
  color: #f4ead0;
}
.km-hotbar {
  flex: 1;
  display: flex;
  flex-wrap: nowrap;
  justify-content: center;
  gap: 0;
  padding: 0.08rem 0.1rem 0.12rem;
  border: none;
  border-radius: 0;
  background: transparent;
  /* One recessed gallery carved into the lintel — not a row of pins. */
  box-shadow:
    inset 0 2px 4px rgba(0, 0, 0, 0.55),
    inset 0 -1px 0 rgba(232, 204, 140, 0.10);
  box-sizing: border-box;
}
.km-hot-slot {
  flex: 1 1 0;
  width: auto;
  min-width: 2.15rem;
  max-width: 2.85rem;
  min-height: 3.05rem;
  height: 3.05rem;
  padding: 0;
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0;
  /* One lintel — no per-slot inset (that stamped a second plate). */
  border: none;
  border-radius: 0;
  background: transparent;
  color: #d8c8a0;
  cursor: pointer;
  font-size: 0.5rem;
  overflow: hidden;
  box-shadow: none;
}
.km-hot-slot:last-child {
  box-shadow: none;
}
.km-hot-slot kbd {
  position: absolute;
  left: 2px;
  top: 1px;
  z-index: 3;
  font-family: Cinzel, Georgia, serif;
  font-size: 0.5rem;
  font-weight: 700;
  opacity: 0.92;
  line-height: 1;
  color: #e8c060;
  text-shadow: 0 1px 1px #000, 0 0 4px rgba(200, 150, 40, 0.4);
  pointer-events: none;
}
.km-hot-icon,
.km-hot-glyph {
  display: none !important;
}
/* Catalog / shop photos never win the first read */
.km-hot-art,
.km-hot-slot img {
  display: none !important;
}
/* Slice of one gallery strip — grain continues; empty slots emit no paint. */
.km-hot-paint {
  display: block;
  width: 100%;
  height: 100%;
  background-repeat: no-repeat;
  background-position: center;
  background-size: 100% 100%;
  pointer-events: none;
  position: relative;
  z-index: 2;
}
/* Shared lintel top-light over painted figures and empty plate alike */
.km-hot-slot::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 3;
  background: linear-gradient(180deg, rgba(232, 196, 120, 0.10) 0%, transparent 36%);
  mix-blend-mode: overlay;
}
/* One combat beam — 12 equal windows of gallery_combat.jpg (grain does not restart). */
.km-hot-paint-attack,
.km-hot-paint-full_attack,
.km-hot-paint-trip,
.km-hot-paint-bull_rush,
.km-hot-paint-disarm,
.km-hot-paint-defend,
.km-hot-paint-shield_bash,
.km-hot-paint-def_atk,
.km-hot-paint-power_attack,
.km-hot-paint-rage,
.km-hot-paint-end_turn {
  background-image: url("art/hud/tiles/gallery_combat.jpg");
  background-size: 1200% 100%;
}
.km-hot-paint-attack { background-position: 0% 50%; }
.km-hot-paint-full_attack { background-position: 9.0909% 50%; }
.km-hot-paint-trip { background-position: 18.1818% 50%; }
.km-hot-paint-bull_rush { background-position: 27.2727% 50%; }
.km-hot-paint-disarm { background-position: 36.3636% 50%; }
.km-hot-paint-defend,
.km-hot-paint-shield_bash { background-position: 45.4545% 50%; }
.km-hot-paint-def_atk { background-position: 54.5455% 50%; }
.km-hot-paint-power_attack,
.km-hot-paint-rage { background-position: 63.6364% 50%; }
.km-hot-paint-end_turn { background-position: 100% 50%; }
/* Off-bar: one lintel trough, eight windows. */
.km-hot-paint-step,
.km-hot-paint-overrun,
.km-hot-paint-move,
.km-hot-paint-potion,
.km-hot-paint-cast,
.km-hot-paint-flee,
.km-hot-paint-sunder,
.km-hot-paint-grapple,
.km-hot-paint-dirty_trick,
.km-hot-paint-smite,
.km-hot-paint-expertise,
.km-hot-paint-feint,
.km-hot-paint-speak,
.km-hot-paint-attempt {
  background-image: url("art/hud/tiles/gallery_off.jpg");
  background-size: 800% 100%;
}
.km-hot-paint-step,
.km-hot-paint-overrun { background-position: 0% 50%; }
.km-hot-paint-move { background-position: 14.2857% 50%; }
.km-hot-paint-potion { background-position: 28.5714% 50%; }
.km-hot-paint-cast { background-position: 42.8571% 50%; }
.km-hot-paint-flee { background-position: 57.1429% 50%; }
.km-hot-paint-sunder,
.km-hot-paint-grapple,
.km-hot-paint-dirty_trick { background-position: 71.4286% 50%; }
.km-hot-paint-smite { background-position: 85.7143% 50%; }
.km-hot-paint-expertise,
.km-hot-paint-feint,
.km-hot-paint-speak { background-position: 100% 50%; }
.km-hot-paint-attempt {
  background-image: url("art/hud/tiles/gallery_off.jpg");
  background-size: 800% 100%;
  background-position: 71.4286% 50%;
}
.km-hot-paint-empty { background-image: none; }
.km-hot-slot em {
  display: block;
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 4;
  padding: 0.04rem 0.04rem 0.12rem;
  font-size: 0.46rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  line-height: 1;
  color: #f4ead0;
  text-shadow: 0 1px 1px #000, 0 0 4px rgba(0, 0, 0, 0.8);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  pointer-events: none;
}
.km-hot-slot.is-locked { opacity: 0.38; cursor: not-allowed; }
.km-hot-slot.is-on {
  box-shadow:
    inset 0 0 0 1px rgba(232, 196, 120, 0.40),
    inset 0 0 10px rgba(212, 176, 96, 0.16);
}
.km-hot-slot:hover:not(.is-locked) {
  filter: brightness(1.08);
}
.km-cat-slot .km-hot-art,
.km-cat-slot .km-hot-glyph,
.km-cat-slot .km-hot-paint {
  width: 1.85rem;
  height: 1.85rem;
}

/* Free-move unified chrome: same shell as combat, combat widgets hidden */
#combat-dock.km-combat-root.km-explore {
  pointer-events: none;
}
#combat-dock.km-combat-root.km-explore .km-party-dock {
  pointer-events: auto;
}
#combat-dock.km-combat-root.km-explore .km-init-rail,
#combat-dock.km-combat-root.km-explore .km-plate,
#combat-dock.km-combat-root.km-explore .km-action-economy,
#combat-dock.km-combat-root.km-explore .km-loadout-row,
#combat-dock.km-combat-root.km-explore .km-hotbar-row,
#combat-dock.km-combat-root.km-explore .km-banner,
#combat-dock.km-combat-root.km-explore .km-status,
#combat-dock.km-combat-root.km-explore .km-drawer {
  display: none !important;
}
#combat-dock.km-combat-root.km-explore .km-combat-main {
  align-items: stretch;
  justify-content: center;
  padding-bottom: 0.2rem;
  pointer-events: none;
}
#combat-dock.km-combat-root.km-explore .km-center {
  flex: 0 0 auto;
  max-width: none;
  width: auto;
  align-items: center;
  position: absolute;
  left: 50%;
  bottom: 0.28rem;
  transform: translateX(-50%);
  pointer-events: none;
  z-index: 4;
}
#combat-dock.km-combat-root.km-explore .km-party-dock {
  pointer-events: auto;
  margin: 0 auto;
}
#combat-dock.km-combat-root.km-explore .km-log-panel {
  display: none !important;
}
/* Upper-left free-move strip retired (Medium Load + journal notes → party/journal) */
#screen-game.combat-open .hud-top-slim,
#screen-game.combat-open #status-effects,
#screen-game.combat-open #message {
  display: none !important;
}

/* Party dock — large painted frames; plate sits on their heads */
.km-party-dock {
  display: flex;
  flex-direction: row;
  gap: 0.28rem;
  justify-content: center;
  flex-wrap: nowrap;
  position: relative;
  z-index: 2;
  width: auto;
  max-width: 46rem;
  padding: 0;
  border-radius: 0;
  background: transparent;
  border: none;
  box-shadow: none;
  box-sizing: border-box;
}
.km-party-card {
  position: relative;
  display: block;
  width: 8rem;
  min-width: 8rem;
  max-width: 8rem;
  height: 8.85rem;
  flex: 0 0 8rem;
  padding: 0;
  overflow: visible;
  border: 3px solid #c9a227;
  border-radius: 2px;
  background: #1a140c;
  box-shadow: 0 0 0 1px #2a1c0c, 0 8px 16px rgba(0, 0, 0, 0.5);
  appearance: none;
  -webkit-appearance: none;
  color: inherit;
  cursor: pointer;
}
.km-party-card.is-pc {
  border-color: #d4b24a;
}
.km-party-card.is-active {
  border-color: #8cbc58;
  box-shadow:
    0 0 0 1px #2a3a14,
    0 0 10px rgba(140, 188, 88, 0.32);
}
.km-party-caret {
  display: none;
}
/* HP bar — top edge of portrait */
.km-party-bar {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  z-index: 2;
  height: 4px;
  background: rgba(0, 0, 0, 0.62);
  overflow: hidden;
  flex: 0 0 auto;
  border-radius: 0;
}
.km-party-bar > i {
  display: block;
  height: 100%;
  background: linear-gradient(180deg, #8cbc58, #3a6828);
}
.km-party-mid {
  position: absolute;
  inset: 0;
  display: block;
  padding: 0;
}
.km-party-portrait {
  position: absolute;
  inset: 0;
  width: auto;
  height: auto;
  border-radius: 0;
  background: #1a140c;
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  color: #e8d090;
  font-size: 1.4rem;
  overflow: hidden;
}
.km-party-portrait img,
.km-party-portrait .km-face-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 50% 16%;
  display: block;
}
.km-party-meta {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 2;
  padding: 0.85rem 0.2rem 0.12rem;
  background: linear-gradient(180deg, transparent 0%, rgba(10, 8, 4, 0.82) 70%);
  font-size: 0.58rem;
  color: #f0e6c8;
  text-shadow: 0 1px 2px #000;
  pointer-events: none;
}
.km-party-meta strong {
  display: block;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-weight: 600;
  letter-spacing: 0.02em;
}
.km-party-meta span {
  display: none;
}
/* Effects — corner dots on the frame */
.km-party-fx {
  position: absolute;
  top: 6px;
  right: 3px;
  z-index: 2;
  display: flex;
  flex-wrap: nowrap;
  justify-content: flex-end;
  align-items: center;
  gap: 2px;
  min-height: 0;
  max-height: 0.75rem;
  overflow: hidden;
  padding: 0;
  border: none;
  border-radius: 0;
  cursor: default;
}

.km-combat-root .km-banner,
.km-combat-root .km-banner:empty {
  display: none;
}
.km-combat-root .km-banner.is-outcome {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  flex-wrap: wrap;
  justify-content: center;
  order: -1;
  font-size: 0.64rem;
  color: #e8d090;
  padding: 0 0 0.2rem;
  border: none;
  background: none;
  max-width: 100%;
  text-shadow: 0 1px 2px #000;
}
.km-combat-root .km-banner .chud-banner-end {
  display: none;
}
.km-turn-gate {
  position: fixed;
  left: 50%;
  bottom: 5.6rem;
  transform: translateX(-50%);
  z-index: 72;
  pointer-events: auto;
}
.km-turn-gate.hidden {
  display: none !important;
}
.km-turn-gate button {
  appearance: none;
  min-width: 9rem;
  min-height: 2.4rem;
  padding: 0.4rem 1.1rem;
  border: 1px solid #c4a04a;
  background: #2a1810;
  color: #f4e6c4;
  font: 700 0.92rem/1 Cinzel, Georgia, serif;
  letter-spacing: 0.06em;
  cursor: pointer;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.45);
}
.km-turn-gate button:hover,
.km-turn-gate button:focus-visible {
  background: #3a6828;
  border-color: #8cbc58;
}
.km-loot-gate {
  position: fixed;
  inset: 0;
  z-index: 400;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(8, 6, 4, 0.55);
  pointer-events: auto !important;
}
.km-loot-gate.hidden {
  display: none !important;
}
.km-loot-card {
  min-width: min(22rem, 92vw);
  max-width: 28rem;
  padding: 1.1rem 1.25rem 1.15rem;
  border: 1px solid #c4a04a;
  background:
    linear-gradient(180deg, rgba(248, 236, 208, 0.96), rgba(226, 206, 162, 0.94));
  color: #2a2118;
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.55);
  text-align: center;
}
.km-loot-card p {
  margin: 0 0 0.85rem;
  font-family: Georgia, "Palatino Linotype", serif;
  font-size: 1.05rem;
  line-height: 1.4;
}
.km-loot-acts {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  justify-content: center;
}
.km-loot-acts button {
  appearance: none;
  min-height: 2.2rem;
  padding: 0.35rem 0.9rem;
  border: 1px solid #8a6a28;
  background: #f4e6c4;
  color: #2a2118;
  font: 700 0.86rem/1 Cinzel, Georgia, serif;
  letter-spacing: 0.04em;
  cursor: pointer;
}
.km-loot-acts button.primary {
  background: #3a6828;
  border-color: #1a3410;
  color: #f4e6c4;
}
.km-improv-gate {
  position: fixed;
  inset: 0;
  z-index: 410;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(8, 6, 4, 0.55);
  pointer-events: auto !important;
}
.km-improv-gate.hidden {
  display: none !important;
}
.km-improv-card {
  min-width: min(24rem, 92vw);
  max-width: 30rem;
  padding: 1.05rem 1.2rem 1.1rem;
  border: 1px solid #c4a04a;
  background:
    linear-gradient(180deg, rgba(248, 236, 208, 0.97), rgba(226, 206, 162, 0.95));
  color: #2a2118;
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.55);
  text-align: left;
}
.km-improv-card h3 {
  margin: 0 0 0.35rem;
  font: 700 1.05rem/1.2 Cinzel, Georgia, serif;
  letter-spacing: 0.04em;
}
.km-improv-card p {
  margin: 0 0 0.65rem;
  font-family: Georgia, "Palatino Linotype", serif;
  font-size: 0.88rem;
  line-height: 1.4;
}
.km-improv-card textarea {
  display: block;
  width: 100%;
  min-height: 4.6rem;
  margin: 0 0 0.7rem;
  padding: 0.45rem 0.5rem;
  border: 1px solid #8a6a28;
  background: #fbf3dc;
  color: #2a2118;
  font: 400 0.95rem/1.35 Georgia, "Palatino Linotype", serif;
  resize: vertical;
}
.km-improv-targets {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
  margin: 0 0 0.55rem;
}
.km-improv-tgt {
  appearance: none;
  padding: 0.2rem 0.55rem;
  border: 1px solid #8a6a28;
  background: #f4e6c4;
  color: #2a2118;
  font: 700 0.72rem/1 Cinzel, Georgia, serif;
  letter-spacing: 0.04em;
  cursor: pointer;
}
.km-improv-tgt.is-on {
  background: #3a6828;
  border-color: #1a3410;
  color: #f4e6c4;
}
.km-improv-acts {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  justify-content: flex-end;
}
.km-improv-acts button {
  appearance: none;
  min-height: 2.2rem;
  padding: 0.35rem 0.9rem;
  border: 1px solid #8a6a28;
  background: #f4e6c4;
  color: #2a2118;
  font: 700 0.86rem/1 Cinzel, Georgia, serif;
  letter-spacing: 0.04em;
  cursor: pointer;
}
.km-improv-acts button.primary {
  background: #3a6828;
  border-color: #1a3410;
  color: #f4e6c4;
}
.km-combat-root:not(.km-explore) .km-party-meta {
  display: none;
}
.km-status {
  position: absolute;
  left: 50%;
  bottom: calc(100% + 0.15rem);
  transform: translateX(-50%);
  z-index: 6;
  display: flex;
  flex-wrap: wrap;
  gap: 0.16rem;
  justify-content: center;
  max-width: 36rem;
}
.km-status .status-chip {
  font-size: 0.58rem;
  padding: 0.04rem 0.28rem;
  border-radius: 2px;
}

/* Journal — parchment, lower-right, never a glass slab */
.km-log-panel {
  position: absolute;
  right: 0.4rem;
  bottom: 0.28rem;
  width: min(17.5rem, 22vw);
  min-width: 13rem;
  max-width: 19rem;
  min-height: 7.5rem;
  display: flex;
  flex-direction: column;
  border-radius: 2px 8px 2px 2px;
  background:
    linear-gradient(180deg, rgba(246, 234, 204, 0.94) 0%, rgba(226, 204, 158, 0.95) 100%),
    url("/static/art/hub/ui/parchment.jpg") center/cover;
  color: #2a2118;
  border: 1px solid #8a6a38;
  box-shadow:
    0 8px 22px rgba(20, 10, 0, 0.42),
    inset 0 0 0 1px rgba(255, 244, 214, 0.35);
  overflow: hidden;
  flex: 0 0 auto;
  align-self: flex-end;
  box-sizing: border-box;
  z-index: 4;
}
.km-log-resize {
  order: 1;
  height: 5px;
  cursor: ns-resize;
  background: linear-gradient(180deg, rgba(138, 106, 56, 0.35), transparent);
  flex: 0 0 auto;
}
.km-log-head {
  order: 3;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding: 0.12rem 0.28rem 0.16rem;
  border-top: 1px solid rgba(90, 62, 28, 0.28);
  border-bottom: none;
  font-size: 0.68rem;
  color: #5a3a18;
}
.km-log-head strong {
  display: none;
}
.km-log-filters {
  display: flex;
  gap: 0.12rem;
}
.km-log-filters button {
  font-size: 0.55rem;
  margin: 0;
  padding: 0.1rem 0.38rem 0.12rem;
  border: 1px solid #8a6a38;
  background: linear-gradient(180deg, #5a3e1c, #3a2810);
  color: #e8d090;
  cursor: pointer;
  border-radius: 2px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  font-weight: 700;
}
.km-log-filters button.active {
  border-color: #c9a227;
  color: #fff4c8;
  background: linear-gradient(180deg, #8a6820, #5a4214);
}
.km-log {
  order: 2;
  list-style: none;
  margin: 0;
  padding: 0.32rem 0.45rem 0.2rem;
  overflow-y: auto;
  flex: 1 1 auto;
  font-size: 0.68rem;
  line-height: 1.35;
  color: #2a2118;
  background: transparent;
  text-shadow: none;
}
.km-log-line {
  margin: 0 0 0.2rem;
  padding-bottom: 0.12rem;
  border-bottom: 1px solid rgba(90, 62, 28, 0.12);
}
.km-log-line.km-log-hit,
.km-log-line.km-log-damage { color: #7a2418; }
.km-log-line.km-log-miss { color: #5a5048; }

.km-drawer {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  /* Sit well above the plate so drag-drop onto slots is not blocked */
  bottom: max(14.5rem, 28vh);
  width: min(32rem, 88vw);
  max-height: min(32vh, 15rem);
  overflow: auto;
  border-radius: 2px;
  background:
    linear-gradient(180deg, rgba(246, 234, 204, 0.96), rgba(226, 204, 158, 0.97)),
    url("/static/art/hub/ui/parchment.jpg") center/cover;
  color: #2a2118;
  border: 1px solid #8a6a38;
  box-shadow: 0 10px 28px rgba(20, 10, 0, 0.45);
  z-index: 40;
  padding: 0.4rem 0.55rem 0.6rem;
  pointer-events: auto;
}
/* Hotbar stays above the drawer for drag targets */
.km-hotbar-row,
.km-hotbar {
  position: relative;
  z-index: 46;
}
.km-combat-root.is-dragging-hot .km-drawer {
  pointer-events: none;
  opacity: 0.55;
}
.km-hot-slot.is-empty {
  opacity: 1;
  border: none;
  background: transparent;
  box-shadow: none;
}
.km-hot-slot.is-empty:last-child {
  box-shadow: none;
}
.km-hot-trash-hint {
  position: absolute;
  left: 50%;
  bottom: 12.6rem;
  transform: translateX(-50%);
  z-index: 47;
  padding: 0.2rem 0.65rem;
  border-radius: 2px;
  background: #4a1818;
  border: 1px solid #a05040;
  color: #f0d0c0;
  font-size: 0.68rem;
  pointer-events: none;
  display: none;
}
.km-combat-root.is-dragging-hot .km-hot-trash-hint {
  display: block;
}
.km-drawer.hidden { display: none; }
.km-drawer-head { position: relative; margin-bottom: 0.35rem; }
.km-drawer-head h3 {
  margin: 0;
  font-size: 0.88rem;
  color: #5a2a18;
  font-family: Cinzel, Georgia, serif;
}
.km-drawer-close {
  position: absolute;
  right: 0;
  top: 0;
  border: none;
  background: transparent;
  color: #5a3a18;
  font-size: 1.15rem;
  cursor: pointer;
}
.km-drawer-grid,
.km-belt-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}
.km-cat-slot,
.km-belt-slot {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 4.1rem;
  padding: 0.28rem;
  border: 1px solid #8a6a38;
  border-radius: 2px;
  background: rgba(255, 248, 228, 0.45);
  color: #2a2118;
  cursor: pointer;
  font-size: 0.64rem;
}
.km-cat-slot:hover,
.km-belt-slot:hover:not(:disabled) {
  border-color: #e8c86a;
}
.km-belt-slot:disabled,
.km-belt-slot.empty {
  opacity: 0.4;
  cursor: not-allowed;
}
.km-legacy-hidden { display: none !important; }
.km-combat-root .chud-minimap-wrap,
.km-combat-root .chud-hotbar:not(.km-hotbar),
.km-combat-root .chud-main {
  display: none !important;
}
.km-combat-root .chud-float-layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 40;
}

/* Path note floating above bottom chrome */
.km-combat-root .chud-path-note {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  bottom: 12.8rem;
  z-index: 36;
  padding: 0.16rem 0.55rem;
  border-radius: 2px;
  background: rgba(18, 14, 8, 0.72);
  border: 1px solid #8a7348;
  color: #e8dcc4;
  font-size: 0.68rem;
  pointer-events: none;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.35);
  text-shadow: 0 1px 2px #000;
}
.km-combat-root .chud-path-note.provoke {
  border-color: rgba(240, 120, 80, 0.72);
  color: #f0c0a0;
}

@media (max-width: 1100px) {
  .km-log-panel {
    width: min(15rem, 26vw);
    min-width: 11rem;
  }
  .km-center {
    max-width: min(40rem, 70vw);
  }
  .km-party-card {
    width: 6.6rem;
    min-width: 6.6rem;
    max-width: 6.6rem;
    height: 7.35rem;
    flex-basis: 6.6rem;
  }
  .km-plate {
    margin-bottom: -2.3rem;
  }
}
@media (max-width: 800px) {
  .km-combat-main {
    flex-wrap: wrap;
    justify-content: center;
  }
  .km-log-panel {
    width: min(100%, 18rem);
    right: 0.25rem;
  }
  .km-center {
    max-width: 100%;
  }
}

/* ── Craft stage (#9) + Money changer ─────────────────────────────────── */
.craft-overlay .craft-body,
.changer-overlay .changer-body {
  display: grid;
  grid-template-columns: 1fr 1.2fr 1fr;
  gap: 1rem;
  padding: 0.75rem 1rem 1.25rem;
  min-height: 0;
  overflow: auto;
}
.changer-overlay .changer-body {
  grid-template-columns: 1fr 1.4fr;
}
.craft-field {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  margin-bottom: 0.65rem;
  font-size: 0.85rem;
}
.craft-field select,
.changer-body select {
  padding: 0.35rem 0.5rem;
  border-radius: 4px;
  border: 1px solid rgba(200, 180, 140, 0.35);
  background: rgba(20, 16, 12, 0.65);
  color: inherit;
}
.craft-card,
.changer-wallet-card,
.craft-order {
  border: 1px solid rgba(200, 180, 140, 0.25);
  border-radius: 6px;
  padding: 0.5rem 0.65rem;
  margin-bottom: 0.45rem;
  background: rgba(30, 24, 18, 0.45);
  cursor: pointer;
}
.craft-card:hover,
.changer-wallet-card {
  cursor: default;
}
.craft-caps {
  display: block;
  font-size: 0.75rem;
  opacity: 0.8;
  margin-top: 0.15rem;
}
.changer-metals {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 0.75rem;
  margin: 0.5rem 0 0.75rem;
}
.changer-metals label {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.85rem;
}
.changer-metals input[type="number"] {
  width: 4rem;
  padding: 0.25rem;
  border-radius: 4px;
  border: 1px solid rgba(200, 180, 140, 0.35);
  background: rgba(20, 16, 12, 0.65);
  color: inherit;
}
.changer-all {
  flex-direction: row;
  align-items: center;
  gap: 0.5rem;
}
@media (max-width: 900px) {
  .craft-overlay .craft-body,
  .changer-overlay .changer-body {
    grid-template-columns: 1fr;
  }
}

/* G3 money-changer stage still */
.changer-overlay .shop-frame-stage {
  background:
    linear-gradient(180deg, rgba(12, 10, 8, 0.82), rgba(18, 14, 10, 0.88)),
    url("/static/art/stages/money-changer.jpg") center / cover no-repeat;
}

/* Journal · bug report (below notepad) */
.journal-bug-report {
  margin-top: 1.1rem;
  padding-top: 0.85rem;
  border-top: 1px solid rgba(200, 180, 140, 0.22);
}
.journal-bug-report .journal-subhead {
  margin-bottom: 0.25rem;
}
#bug-report-status:not(:empty) {
  margin-top: 0.4rem;
  color: #c8b896;
}

/* Arena victory triumph */
.arena-victory-panel #arena-victory-text {
  white-space: pre-wrap;
  max-height: 40vh;
  overflow: auto;
  line-height: 1.45;
}
.arena-victory-panel h2 {
  color: #e8c87a;
}

/* Arena multi-count picker */
.arena-picker-count-row {
  margin: 0.5rem 0 0.75rem;
  padding: 0 0.25rem;
}
.arena-count-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-top: 0.35rem;
}
.arena-count-hint {
  margin: 0.4rem 0 0;
}
.arena-foe-pack {
  display: block;
  font-size: 0.85rem;
  color: #e8c87a;
  font-weight: 600;
}
.arena-foe-solo {
  display: block;
  font-size: 0.75rem;
  opacity: 0.75;
}

/* Phase B mixed party slate */
.arena-picker-slate {
  margin: 0.35rem 0.25rem 0.75rem;
  padding: 0.55rem 0.65rem;
  border: 1px solid rgba(200, 170, 90, 0.35);
  border-radius: 8px;
  background: rgba(18, 16, 12, 0.75);
}
.arena-slate-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 0.5rem;
  margin-bottom: 0.4rem;
}
.arena-slate-tray {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  min-height: 2rem;
  align-items: center;
}
.arena-slate-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.25rem 0.5rem;
  border-radius: 999px;
  border: 1px solid rgba(230, 200, 120, 0.45);
  background: rgba(40, 34, 20, 0.95);
  color: #f0e6c8;
  font-size: 0.8rem;
  cursor: pointer;
}
.arena-slate-chip:hover {
  border-color: rgba(255, 120, 100, 0.7);
  background: rgba(60, 30, 24, 0.95);
}
.arena-slate-x {
  opacity: 0.7;
  font-weight: 700;
}
.arena-slate-presets {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin: 0.35rem 0 0.15rem;
}
.arena-slate-presets .arena-slate-preset {
  max-width: 100%;
}
.arena-slate-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-top: 0.5rem;
}
.arena-picker-btn.small {
  padding: 0.3rem 0.55rem;
  font-size: 0.78rem;
}
.arena-foe-card-wrap {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}
.arena-foe-add-slate {
  align-self: stretch;
  padding: 0.2rem 0.4rem;
  font-size: 0.72rem;
  border-radius: 4px;
  border: 1px dashed rgba(200, 170, 90, 0.45);
  background: transparent;
  color: #c8b878;
  cursor: pointer;
}
.arena-foe-add-slate:hover {
  border-style: solid;
  border-color: rgba(230, 200, 120, 0.75);
  background: rgba(40, 36, 24, 0.85);
  color: #f0e6c8;
}

/* ── Global merchant item card (Club + all shops) ─────────────────────── */
.shop-item-detail {
  margin-top: 0.65rem;
  padding: 0.75rem 0.85rem;
  border: 1px solid rgba(200, 170, 90, 0.45);
  border-radius: 6px;
  background: rgba(20, 18, 14, 0.92);
  max-height: 42vh;
  overflow: auto;
}
.shop-item-detail.hidden {
  display: none !important;
}
.shop-item-detail-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.35rem;
}
.shop-item-detail-head h4 {
  margin: 0;
  font-size: 1.05rem;
  color: #f0d78c;
}
.shop-item-detail-x {
  border: none;
  background: transparent;
  color: #c8b88a;
  cursor: pointer;
  font-size: 1rem;
  line-height: 1;
}
.shop-item-detail-meta {
  margin: 0 0 0.4rem;
}
.shop-item-detail-stats {
  margin: 0 0 0.5rem;
  padding-left: 1.1rem;
  color: #d8c8a0;
  font-size: 0.85rem;
}
.shop-item-detail-body {
  margin: 0 0 0.65rem;
  font-size: 0.9rem;
  line-height: 1.45;
  color: #e8e0d0;
  white-space: pre-wrap;
}
.shop-item-detail-actions {
  display: flex;
  gap: 0.5rem;
}
.shop-stock-item.selected {
  outline: 1px solid rgba(240, 215, 140, 0.7);
  background: rgba(80, 60, 20, 0.35);
}
.shop-stock-item.shop-stock-pricey .shop-st-meta {
  color: #c09070;
}
.shop-st-inspect {
  border: 1px solid rgba(200, 170, 90, 0.4);
  background: rgba(40, 32, 20, 0.8);
  color: #f0d78c;
  border-radius: 4px;
  cursor: pointer;
  min-width: 1.6rem;
  padding: 0.15rem 0.35rem;
}
.shop-stock-item {
  cursor: pointer;
}

/* Club undercroft free-move hint */
.arena-ladder-body {
  max-height: 50vh;
  overflow: auto;
  padding: 0.25rem 0.15rem;
}
.arena-ladder-next {
  padding: 0.5rem 0.65rem;
  border: 1px solid rgba(180, 150, 80, 0.35);
  border-radius: 6px;
  background: rgba(30, 24, 14, 0.75);
}
.arena-ladder-list {
  padding-left: 1.1rem;
  margin: 0.5rem 0;
}
.arena-ladder-list li {
  margin: 0.35rem 0;
}
.arena-path-grid {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  margin: 0.5rem 0 0.75rem;
}
.arena-path-grid.compact {
  gap: 0.45rem;
}
.arena-path-card {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.25rem;
  text-align: left;
  width: 100%;
  padding: 0.7rem 0.85rem;
  border-radius: 8px;
  border: 1px solid rgba(201, 162, 39, 0.45);
  background: linear-gradient(165deg, rgba(48, 38, 22, 0.95), rgba(22, 18, 12, 0.96));
  color: #f0e6c8;
  cursor: pointer;
  font: inherit;
}
.arena-path-card:hover {
  border-color: rgba(230, 190, 80, 0.75);
  background: linear-gradient(165deg, rgba(58, 46, 26, 0.98), rgba(28, 22, 14, 0.98));
}
.arena-path-card strong {
  font-size: 1.05rem;
  color: #f5e6b8;
}
.arena-path-card p {
  margin: 0.2rem 0 0.15rem;
  font-size: 0.92rem;
  line-height: 1.4;
  color: #d8ccb0;
}
.arena-path-cta {
  margin-top: 0.25rem;
  font-size: 0.82rem;
  font-weight: 600;
  color: #e0b84a;
  letter-spacing: 0.02em;
}
.arena-path-more {
  margin: 0.85rem 0 0.35rem;
  font-size: 0.95rem;
  color: #e8d8a8;
}

/* talk-banner
   Talk-slab verb: carved wood-and-gold slab on a still-visible scene.
   First-read is a tall painted card (~0.55, crown to bodice) + a written
   column that is the page (slim 14.6rem coda + hairline) + one verb.
   Herald.png stays on the hub book. */
#talk-banner {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 38;
  pointer-events: none;
  background: transparent;
}
#talk-banner.hidden {
  display: none !important;
}
#talk-banner .talk-banner-slab {
  pointer-events: auto;
  margin: 0 1.6% 6px;
  height: min(29.2vh, 20.4rem);
  filter: drop-shadow(0 10px 22px rgba(0, 0, 0, 0.45));
}
#talk-banner.is-compose .talk-banner-slab {
  height: min(36vh, 21.2rem);
}
.talk-banner-wood {
  height: 100%;
  padding: 9px 11px 10px;
  background:
    linear-gradient(180deg, rgba(42, 28, 12, 0.28), rgba(8, 6, 4, 0.22)),
    url("/static/art/hub/ui/wood.jpg") center / cover;
  box-shadow:
    0 2px 0 #0a0604,
    inset 0 1px 0 rgba(212, 180, 90, 0.28);
}
.talk-banner-gold {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  height: 100%;
  min-height: 0;
  padding: 5px 8px 6px 5px;
  border: 1px solid #c4a04a;
  box-shadow:
    inset 0 0 0 1px #4a3414,
    inset 0 0 0 3px #1a1008,
    inset 0 0 0 4px #d4b24a;
  background:
    linear-gradient(180deg, rgba(232, 214, 176, 0.12), transparent 18%),
    url("/static/art/hub/ui/parchment.jpg") center / cover;
}
#talk-banner.is-alone .talk-banner-gold {
  grid-template-columns: minmax(0, 1fr);
}
.talk-banner-spine {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  min-width: 0;
  min-height: 0;
  padding: 0.12rem 0.42rem 0.06rem 0.22rem;
}
#talk-banner.is-alone .talk-banner-spine {
  display: none;
}
.talk-banner-jewel {
  appearance: none;
  position: relative;
  width: auto;
  height: calc(100% - 1.2rem);
  aspect-ratio: 11 / 20;
  flex: 0 0 auto;
  padding: 0;
  border: none;
  overflow: hidden;
  isolation: isolate;
  background-color: #1a120c;
  background-repeat: no-repeat;
  background-position: 50% 46%;
  background-size: cover;
  cursor: pointer;
}
.talk-banner-jewel[disabled] {
  cursor: default;
}
.talk-banner-jewel.is-empty,
.talk-banner-jewel[hidden] {
  display: none !important;
}
.talk-banner-face {
  position: absolute;
  z-index: 0;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 50% 46%;
  background: #2a1c10;
}
.talk-banner-face[hidden] {
  display: none;
}
.talk-banner-fallback {
  position: absolute;
  z-index: 0;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  font: 700 1.35rem/1 Cinzel, serif;
  letter-spacing: 0.1em;
  color: #e8d48a;
  background: radial-gradient(circle at 38% 32%, #fff4c8, #c9a227 58%, #5a3810);
}
.talk-banner-jewel.is-initials .talk-banner-fallback {
  display: flex;
}
.talk-banner-frame {
  position: absolute;
  z-index: 1;
  inset: 0;
  pointer-events: none;
  background: none;
  box-shadow:
    inset 0 0 0 1px #f0d478,
    inset 0 0 0 2px #6a4814,
    inset 0 0 0 3px #2a1808,
    inset 0 0 0 4px #d4b24a,
    inset 0 0 10px rgba(20, 12, 4, 0.18);
}
.talk-banner-frame::before,
.talk-banner-frame::after {
  content: "";
  position: absolute;
  top: 6px;
  bottom: 6px;
  width: 3px;
  background: repeating-linear-gradient(
    180deg,
    #8e1e22 0 3px,
    #d4b24a 3px 4px,
    #1c3a6e 4px 7px,
    #d4b24a 7px 8px
  );
  box-shadow:
    0 0 0 1px rgba(42, 24, 8, 0.55),
    inset 0 0 0 1px rgba(232, 200, 110, 0.28);
}
.talk-banner-frame::before {
  left: 3px;
}
.talk-banner-frame::after {
  right: 3px;
}
.talk-banner-name {
  margin: 0.14rem 0 0;
  flex: 0 0 auto;
  font: 700 0.72rem/1.15 Cinzel, Georgia, serif;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: #8a6418;
  text-align: center;
  text-shadow: 0 1px 0 rgba(255, 236, 180, 0.35);
}
.talk-banner-name:empty {
  display: none;
}
.talk-banner-page {
  --talk-coda: 14.6rem;
  position: relative;
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  margin-left: 0.15rem;
  padding: 0.5rem 1.05rem 0.38rem 1.05rem;
  border-left: 1px solid rgba(140, 96, 32, 0.28);
  box-shadow: inset 1px 0 0 rgba(232, 196, 96, 0.22);
}
.talk-banner-page::before,
.talk-banner-page::after {
  content: "";
  position: absolute;
  top: 12%;
  bottom: 12%;
  width: 3px;
  background: linear-gradient(
    180deg,
    transparent,
    #c4a04a 12%,
    #8a6a28 50%,
    #c4a04a 88%,
    transparent
  );
}
.talk-banner-page::before {
  left: -1px;
}
.talk-banner-page::after {
  left: auto;
  right: var(--talk-coda);
}
.talk-banner-copy {
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
  width: calc(100% - var(--talk-coda));
  max-width: calc(100% - var(--talk-coda));
  overflow: hidden;
  scrollbar-width: none;
}
.talk-banner-copy::-webkit-scrollbar {
  display: none;
}
#talk-banner.is-long .talk-banner-copy,
#talk-banner.is-compose .talk-banner-copy {
  overflow-y: auto;
}
.talk-banner-prose {
  margin: 0;
  font: 400 0.98rem/1.48 Georgia, "Times New Roman", serif;
  color: #2c2014;
  white-space: pre-wrap;
}
.talk-banner-prose:empty,
.talk-banner-prose[hidden] {
  display: none;
}
.talk-banner-inks {
  list-style: none;
  margin: 0.38rem 0 0;
  padding: 0;
}
.talk-banner-inks[hidden] {
  display: none;
}
.talk-banner-inks li {
  margin: 0.02rem 0;
}
.talk-banner-inks button {
  display: flex;
  gap: 0.4rem;
  width: 100%;
  margin: 0;
  padding: 0.05rem 0.15rem;
  border: 0;
  background: transparent;
  color: #2c2014;
  font: 400 0.9rem/1.32 Georgia, "Times New Roman", serif;
  text-align: left;
  cursor: pointer;
}
.talk-banner-inks button:hover,
.talk-banner-inks button:focus-visible {
  color: #5a3810;
  background: rgba(196, 160, 74, 0.12);
  outline: none;
}
.talk-banner-ink-n {
  flex: 0 0 1.4rem;
  font-weight: 700;
  color: #6a4814;
}
.talk-banner-hairline {
  display: none;
  position: absolute;
  left: auto;
  right: 5.1rem;
  top: 46%;
  width: 5.4rem;
  height: 1px;
  background: linear-gradient(90deg, transparent, #6a4814 18%, #3a2810 50%, #6a4814 82%, transparent);
  opacity: 0.55;
}
.talk-banner-hairline.is-on {
  display: block;
}
#talk-banner.is-compose .talk-banner-hairline {
  display: none;
}
.talk-banner-continue {
  display: block;
  align-self: flex-start;
  margin: 0.32rem 0 0.1rem calc((100% - var(--talk-coda) - 8.4rem) / 2);
  min-width: 8.4rem;
  padding: 0.28rem 1.35rem 0.24rem;
  border: 1px solid #8a6a28;
  background:
    linear-gradient(180deg, rgba(255, 236, 180, 0.18), rgba(40, 24, 8, 0.12)),
    url("/static/art/hub/ui/gold-plate.jpg") center / cover;
  color: #2a1c0c;
  font: 700 0.68rem/1 Cinzel, Georgia, serif;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  text-shadow: 0 1px 0 rgba(255, 236, 180, 0.35);
  box-shadow:
    inset 0 0 0 1px rgba(255, 220, 140, 0.28),
    0 1px 0 #3a2810;
  cursor: pointer;
}
.talk-banner-continue:hover,
.talk-banner-continue:focus-visible {
  color: #140c04;
  filter: brightness(1.06);
  outline: none;
}
#talk-banner.has-inks .talk-banner-continue,
#talk-banner.is-compose .talk-banner-continue,
.talk-banner-continue[hidden] {
  display: none;
}
.talk-banner-fold {
  display: none;
  flex: 0 0 auto;
  min-height: 0;
  margin-top: 0.2rem;
}
#talk-banner.is-compose .talk-banner-fold {
  display: block;
}

/* Glass dock is no longer the first-read object. */
#talk-banner .talk-dock,
#talk-banner #talk-dock {
  position: static !important;
  left: auto !important;
  right: auto !important;
  bottom: auto !important;
  width: auto !important;
  max-width: none !important;
  padding: 0.15rem 0 0 !important;
  background: transparent !important;
  border: 0 !important;
  border-radius: 0 !important;
  box-shadow: none !important;
  color: #2c2014 !important;
  display: flex;
  flex-direction: column;
  gap: 0.28rem;
  z-index: auto !important;
}
#talk-banner .talk-dock-head {
  min-height: 0;
}
#talk-banner .talk-kicker,
#talk-banner .talk-close {
  display: none;
}
#talk-banner .talk-toggle {
  font-size: 0.68rem;
  color: #5a4018;
}
#talk-banner .talk-field {
  color: #4a3418;
}
#talk-banner .talk-field select,
#talk-banner .talk-text {
  background: rgba(255, 248, 228, 0.45);
  border: 1px solid rgba(106, 72, 20, 0.35);
  color: #2c2014;
  border-radius: 2px;
}
#talk-banner .talk-actions .btn-arcade {
  background:
    linear-gradient(180deg, rgba(255, 236, 180, 0.16), rgba(40, 24, 8, 0.1)),
    url("/static/art/hub/ui/gold-plate.jpg") center / cover;
  border: 1px solid #8a6a28;
  color: #2a1c0c;
  border-radius: 1px;
}
#talk-banner .talk-hint {
  color: #6a5430;
}

/* Scene stays the game. No dimmer. Gazetteer recedes while the slab is up. */
#screen-game.talk-open.hub-open .hub-book {
  visibility: hidden;
  pointer-events: none;
}
#screen-game.talk-open .toast.toast-dialogue {
  display: none !important;
}
#screen-game.hub-open .hud-bottom #talk-dock:not(.hidden) {
  visibility: hidden !important;
  pointer-events: none !important;
}

@media (max-width: 1100px) {
  .talk-banner-gold {
    grid-template-columns: auto minmax(0, 1fr);
  }
  .talk-banner-page {
    --talk-coda: 8.5rem;
  }
  .talk-banner-hairline {
    right: 2.6rem;
    width: 3.8rem;
  }
}
