/**
 * 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;
  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;
}

.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: 6;
  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(28rem, 92vw);
}

.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.82rem;
  text-align: center;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.45);
  animation: toast-in 0.2s ease-out;
}

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

/* —— World Atlas overlay —— */
.atlas-overlay {
  position: absolute;
  inset: 0;
  z-index: 20;
  display: flex;
  flex-direction: column;
  background: #0a1420;
}

.atlas-overlay.hidden {
  display: none !important;
}

.atlas-toolbar {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.4rem 0.65rem;
  background: rgba(12, 16, 24, 0.96);
  border-bottom: 1px solid var(--hud-line);
  min-height: 2.5rem;
}

.atlas-toolbar .atlas-title {
  font-family: Georgia, "Times New Roman", serif;
  font-weight: 700;
  color: var(--tome-gold);
  font-size: 0.95rem;
  letter-spacing: 0.03em;
}

.atlas-toolbar .atlas-clock {
  font-variant-numeric: tabular-nums;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--accent);
  padding: 0.15rem 0.4rem;
  border: 1px solid var(--line);
  border-radius: 4px;
}

.atlas-toolbar .atlas-status {
  flex: 1;
  min-width: 0;
  color: var(--muted);
  font-size: 0.78rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.atlas-mode-group {
  display: flex;
  gap: 0.25rem;
}

.atlas-mode-group button {
  font-size: 0.75rem;
  padding: 0.25rem 0.45rem;
}

.atlas-stage {
  flex: 1 1 auto;
  min-height: 0;
  position: relative;
  overflow: hidden;
}

.atlas-stage svg {
  width: 100%;
  height: 100%;
  display: block;
}

/* Location card */
.atlas-location-card {
  position: absolute;
  right: 0.75rem;
  top: 0.75rem;
  width: min(17.5rem, 42vw);
  z-index: 2;
  padding: 0.75rem 0.85rem;
  background: linear-gradient(160deg, #e8dcc4 0%, #d4c4a8 100%);
  color: var(--tome-ink);
  border: 2px solid var(--tome-gold);
  border-radius: 8px;
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.5);
}

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

.atlas-location-card h3 {
  margin: 0 0 0.2rem;
  font-family: Georgia, serif;
  font-size: 1.05rem;
  color: var(--tome-banner);
}

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

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

.atlas-loc-path {
  margin: 0 0 0.55rem;
  font-size: 0.78rem;
  font-weight: 600;
  color: #3a3020;
  padding: 0.35rem 0.4rem;
  background: rgba(255, 255, 255, 0.35);
  border-radius: 4px;
}

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

.atlas-card-actions button {
  flex: 1;
  background: #2a2118;
  color: #f0e8d0;
  border: 1px solid var(--tome-gold);
  font-size: 0.8rem;
  padding: 0.35rem 0.5rem;
}

.atlas-card-actions button.primary {
  background: #5a3a10;
}

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

/* Confirm modal */
.atlas-confirm-modal {
  position: absolute;
  inset: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.55);
}

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

.atlas-confirm-box {
  width: min(22rem, 90vw);
  padding: 1rem 1.1rem;
  background: #e8dcc4;
  color: var(--tome-ink);
  border: 2px solid var(--tome-gold);
  border-radius: 10px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.55);
}

.atlas-confirm-box h3 {
  margin: 0 0 0.5rem;
  font-family: Georgia, serif;
  color: var(--tome-banner);
}

.atlas-confirm-box p {
  margin: 0 0 0.85rem;
  font-size: 0.88rem;
  line-height: 1.4;
}

.atlas-confirm-box .atlas-card-actions button {
  background: #2a2118;
  color: #f0e8d0;
}

/* When atlas open, hide local 3D clutter */
#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 {
  visibility: hidden;
  pointer-events: none;
}

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

/* Country inset (border-crossing refresh) */
.atlas-country-chip {
  flex: 0 0 auto;
  font-size: 0.72rem;
  font-weight: 600;
  color: #e8dcc4;
  padding: 0.15rem 0.4rem;
  border: 1px solid var(--hud-line);
  border-radius: 4px;
  max-width: 8rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.atlas-country-panel {
  position: absolute;
  left: 0.6rem;
  bottom: 0.6rem;
  width: min(22rem, 46vw);
  height: min(16rem, 38vh);
  z-index: 3;
  background: rgba(8, 12, 18, 0.92);
  border: 1px solid var(--tome-gold);
  border-radius: 8px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45);
}

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

.atlas-country-head {
  flex: 0 0 auto;
  padding: 0.35rem 0.55rem;
  border-bottom: 1px solid var(--hud-line);
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
}

.atlas-country-head strong {
  color: var(--tome-gold);
  font-family: Georgia, serif;
  font-size: 0.9rem;
}

.atlas-country-sub {
  font-size: 0.68rem;
  color: var(--muted);
}

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

/* 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);
}

/* —— 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;
}

/* 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(560px, 94vw);
  max-height: 88vh;
  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;
}
.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;
}
#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;
}

/* ==========================================================================
   Kingmaker-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 {
  font-size: 1.35rem;
  letter-spacing: 0;
  padding: 0.5rem 1rem;
  color: #a09080;
}

/* —— 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: 90;
  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;
}

.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 badge (replaces free-edit name on Class+) */
.km-name-badge-row {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  margin: 0.25rem 0 0.5rem;
}
.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);
}

.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 .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;
}
/* 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.88);
  border: 1px solid rgba(90, 70, 40, 0.22);
  color: #2a2018;
}
.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;
}
.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: 0.85rem;
}
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;
}
.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: flex-start;
  gap: 0.15rem;
  text-align: left;
  padding: 0.65rem 0.85rem;
  border: 1px solid #3a4550;
  border-radius: 4px;
  background: rgba(18, 22, 28, 0.85);
  color: #e0dcc8;
  cursor: pointer;
  font: inherit;
}
.save-list-item:hover,
.save-list-item:focus {
  border-color: #c9b878;
  outline: none;
}
.save-list-item.active-slot {
  border-color: #6a9a70;
}
.save-list-item .save-title {
  font-weight: 600;
  color: #f0e8c8;
}
.save-list-item .save-meta {
  font-size: 0.8rem;
  color: #8a9aaa;
}
.save-list-empty {
  margin: 0 0 1rem;
}

/* ═══ Seldorak combat shell — full viewport overlay, glass 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 surface (Seldorak gold rim + frosted panel) */
.km-glass {
  background: linear-gradient(
    165deg,
    rgba(22, 28, 36, 0.72),
    rgba(12, 14, 20, 0.8)
  );
  border: 1px solid rgba(201, 162, 39, 0.4);
  border-radius: 12px;
  box-shadow:
    0 8px 28px rgba(0, 0, 0, 0.42),
    inset 0 1px 0 rgba(255, 255, 255, 0.07);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

/* ── Initiative rail: pinned top-center of viewport ── */
.km-init-rail {
  position: absolute;
  top: 0.55rem;
  left: 50%;
  transform: translateX(-50%);
  z-index: 3;
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  gap: 0.5rem;
  justify-content: center;
  align-items: flex-end;
  width: min(94vw, 58rem);
  max-width: calc(100% - 1.5rem);
  padding: 0.4rem 0.55rem;
  pointer-events: auto;
  box-sizing: border-box;
}
.km-init-card {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  min-width: 4.6rem;
  max-width: 5.8rem;
  padding: 0;
  overflow: visible;
  text-align: center;
  font-size: 0.68rem;
  color: #e8edf4;
  transition: transform 0.15s ease, border-color 0.15s, box-shadow 0.15s;
  background: linear-gradient(165deg, rgba(22, 28, 36, 0.82), rgba(12, 14, 20, 0.88));
  border: 1px solid rgba(201, 162, 39, 0.42);
  border-radius: 12px;
  box-shadow:
    0 6px 18px rgba(0, 0, 0, 0.38),
    inset 0 1px 0 rgba(255, 255, 255, 0.07);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}
.km-init-card.is-active {
  min-width: 6.6rem;
  max-width: 8rem;
  transform: scale(1.08);
  border-color: rgba(232, 200, 106, 0.9);
  box-shadow:
    0 0 18px rgba(232, 200, 106, 0.38),
    0 8px 22px rgba(0, 0, 0, 0.42),
    inset 0 1px 0 rgba(255, 255, 255, 0.1);
  z-index: 2;
}
.km-init-card.foe {
  border-color: rgba(180, 80, 80, 0.58);
  cursor: pointer;
}
/* Pathfinder-style: mouse-over target in scene → brighten initiative card */
.km-init-card.is-target-hover {
  border-color: rgba(255, 180, 90, 0.95) !important;
  box-shadow:
    0 0 18px rgba(255, 150, 60, 0.55),
    0 6px 18px rgba(0, 0, 0, 0.4),
    inset 0 1px 0 rgba(255, 255, 255, 0.12);
  transform: scale(1.08);
  z-index: 3;
  filter: brightness(1.12);
}
.km-init-card.foe.is-target-hover {
  border-color: rgba(255, 120, 80, 0.95) !important;
}
/* HP bar — top of card */
.km-init-bar {
  height: 5px;
  background: rgba(0, 0, 0, 0.5);
  overflow: hidden;
  flex: 0 0 auto;
  border-radius: 12px 12px 0 0;
}
.km-init-bar > i {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, #5a3020, #c9a227);
}
.km-init-card.foe .km-init-bar > i {
  background: linear-gradient(90deg, #602020, #d06060);
}
.km-init-face {
  width: 2.1rem;
  height: 2.1rem;
  margin: 0.35rem auto 0.12rem;
  border-radius: 9px;
  background: linear-gradient(145deg, rgba(80, 70, 50, 0.6), rgba(30, 28, 24, 0.82));
  border: 1px solid rgba(201, 162, 39, 0.32);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  color: #e8d090;
  font-size: 0.95rem;
  overflow: hidden;
  flex: 0 0 auto;
}
.km-init-face img,
.km-face-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  border-radius: inherit;
}
.km-init-card.is-active .km-init-face {
  width: 2.55rem;
  height: 2.55rem;
  font-size: 1.12rem;
}
.km-init-name {
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  padding: 0 0.35rem;
}
.km-init-hp {
  font-size: 0.62rem;
  color: #b0a890;
  padding: 0 0.25rem 0.12rem;
}
/* Effects strip — bottom of card; overflow → hover pop */
.km-init-fx {
  position: relative;
  display: flex;
  flex-wrap: nowrap;
  justify-content: center;
  align-items: center;
  gap: 3px;
  min-height: 0.95rem;
  max-height: 1.1rem;
  overflow: hidden;
  padding: 0.22rem 0.35rem 0.32rem;
  border-top: 1px solid rgba(201, 162, 39, 0.16);
  border-radius: 0 0 12px 12px;
  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: pinned to viewport floor, full width ── */
.km-combat-main {
  position: absolute;
  left: 0.5rem;
  right: 0.5rem;
  bottom: 0.45rem;
  z-index: 3;
  display: flex !important;
  flex-direction: row;
  align-items: flex-end;
  justify-content: space-between;
  gap: 0.7rem;
  width: auto;
  max-width: none;
  margin: 0;
  padding: 0;
  pointer-events: none;
  box-sizing: border-box;
}
.km-combat-main > * {
  pointer-events: auto;
}

/* Center column grows into available width (no left util rail) */
.km-center {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.35rem;
  max-width: min(56rem, calc(100% - 14rem));
  margin: 0 auto;
}

.km-action-economy {
  display: flex;
  flex-direction: row;
  gap: 0;
  width: 100%;
  max-width: 44rem;
  padding: 0.32rem 0.5rem;
  border-radius: 12px;
  background: linear-gradient(165deg, rgba(22, 28, 36, 0.82), rgba(12, 14, 20, 0.88));
  border: 1px solid rgba(201, 162, 39, 0.44);
  box-shadow:
    0 6px 22px rgba(0, 0, 0, 0.42),
    inset 0 1px 0 rgba(255, 255, 255, 0.07);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  box-sizing: border-box;
}
.km-ae-slot {
  flex: 1 1 0;
  min-width: 0;
  text-align: center;
  padding: 0.22rem 0.3rem;
  border-right: 1px solid rgba(201, 162, 39, 0.18);
  font-size: 0.7rem;
  color: #b0a890;
}
.km-ae-slot:last-child { border-right: none; }
.km-ae-slot em {
  display: block;
  font-style: normal;
  letter-spacing: 0.07em;
  font-size: 0.58rem;
  color: #8a8070;
}
.km-ae-slot b.ae-ready { color: #90e0a0; font-weight: 600; }
.km-ae-slot b.ae-spent { color: #706858; font-weight: 500; }
.km-ae-primary {
  flex: 1.4 1 0;
  background: rgba(201, 162, 39, 0.12);
  border-radius: 8px;
}

.km-hotbar-row {
  display: flex;
  flex-direction: row;
  align-items: stretch;
  gap: 0.3rem;
  width: 100%;
  max-width: 48rem;
}
.km-drawer-tab {
  width: 2rem;
  border: 1px solid rgba(201, 162, 39, 0.5);
  background: linear-gradient(165deg, rgba(40, 36, 24, 0.88), rgba(20, 18, 12, 0.92));
  color: #e8d090;
  font-weight: 700;
  font-family: Cinzel, Georgia, serif;
  border-radius: 10px 0 0 10px;
  cursor: pointer;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}
.km-drawer-tab.active {
  background: linear-gradient(165deg, rgba(120, 95, 35, 0.92), rgba(70, 55, 20, 0.95));
  color: #fff4c8;
  box-shadow: inset 0 0 12px rgba(232, 200, 106, 0.25);
}
.km-hotbar {
  flex: 1;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.28rem;
  padding: 0.4rem 0.45rem;
  border-radius: 0 12px 12px 0;
  background: linear-gradient(165deg, rgba(22, 28, 36, 0.82), rgba(12, 14, 20, 0.9));
  border: 1px solid rgba(201, 162, 39, 0.42);
  box-shadow:
    0 6px 22px rgba(0, 0, 0, 0.42),
    inset 0 1px 0 rgba(255, 255, 255, 0.06);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  box-sizing: border-box;
}
.km-hot-slot {
  flex: 0 0 auto;
  width: 3.35rem;
  min-height: 3.35rem;
  padding: 0.15rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.05rem;
  border: 1px solid rgba(201, 162, 39, 0.35);
  border-radius: 10px;
  background: rgba(20, 24, 32, 0.68);
  color: #e8edf4;
  cursor: pointer;
  font-size: 0.58rem;
  backdrop-filter: blur(4px);
}
.km-hot-slot kbd { font-size: 0.55rem; opacity: 0.65; }
.km-hot-icon { font-size: 1.08rem; line-height: 1.1; }
.km-hot-slot em {
  font-style: normal;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.km-hot-slot.is-locked { opacity: 0.38; cursor: not-allowed; }
.km-hot-slot.is-on {
  border-color: #e8c86a;
  box-shadow: inset 0 0 10px rgba(232, 200, 106, 0.32);
}
.km-hot-slot:hover:not(.is-locked) {
  border-color: #e8c86a;
  background: rgba(40, 48, 60, 0.78);
}

/* Party dock — glass tray across center width */
.km-party-dock {
  display: flex;
  flex-direction: row;
  gap: 0.5rem;
  justify-content: center;
  flex-wrap: wrap;
  width: 100%;
  max-width: 50rem;
  padding: 0.5rem 0.6rem;
  border-radius: 14px;
  background: linear-gradient(165deg, rgba(22, 28, 36, 0.84), rgba(10, 12, 16, 0.9));
  border: 1px solid rgba(201, 162, 39, 0.48);
  box-shadow:
    0 10px 34px rgba(0, 0, 0, 0.48),
    inset 0 1px 0 rgba(255, 255, 255, 0.07);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  box-sizing: border-box;
}
.km-party-card {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  min-width: 8.5rem;
  max-width: 11rem;
  flex: 1 1 8.5rem;
  padding: 0;
  overflow: visible;
  border: 1px solid rgba(201, 162, 39, 0.38);
  border-radius: 12px;
  background: linear-gradient(165deg, rgba(24, 28, 36, 0.78), rgba(14, 16, 22, 0.82));
  box-shadow:
    0 4px 14px rgba(0, 0, 0, 0.3),
    inset 0 1px 0 rgba(255, 255, 255, 0.06);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}
.km-party-card.is-active {
  border-color: rgba(232, 200, 106, 0.9);
  box-shadow:
    0 0 14px rgba(232, 200, 106, 0.3),
    inset 0 1px 0 rgba(255, 255, 255, 0.1);
}
.km-party-caret {
  position: absolute;
  top: -0.55rem;
  left: 50%;
  transform: translateX(-50%);
  width: 0;
  height: 0;
  border-left: 7px solid transparent;
  border-right: 7px solid transparent;
  border-top: 9px solid #e8c86a;
  filter: drop-shadow(0 0 4px #e8c86a);
  z-index: 2;
}
/* HP bar — top edge of party card */
.km-party-bar {
  height: 6px;
  background: rgba(0, 0, 0, 0.5);
  overflow: hidden;
  flex: 0 0 auto;
  border-radius: 12px 12px 0 0;
}
.km-party-bar > i {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, #5a3020, #c9a227);
}
.km-party-mid {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 0.45rem;
  padding: 0.4rem 0.45rem 0.28rem;
}
.km-party-portrait {
  width: 2.45rem;
  height: 2.45rem;
  border-radius: 10px;
  background: linear-gradient(145deg, rgba(90, 80, 55, 0.55), rgba(28, 30, 36, 0.88));
  border: 1px solid rgba(201, 162, 39, 0.38);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  color: #e8d090;
  font-size: 1.08rem;
  flex: 0 0 auto;
  overflow: hidden;
}
.km-party-portrait img,
.km-party-portrait .km-face-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.km-party-meta {
  flex: 1;
  min-width: 0;
  font-size: 0.76rem;
  color: #e8edf4;
}
.km-party-meta strong {
  display: block;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.km-party-meta span {
  color: #b0a890;
  font-size: 0.7rem;
}
/* Effects — bottom of party card */
.km-party-fx {
  position: relative;
  display: flex;
  flex-wrap: nowrap;
  justify-content: center;
  align-items: center;
  gap: 3px;
  min-height: 0.95rem;
  max-height: 1.15rem;
  overflow: hidden;
  padding: 0.28rem 0.4rem 0.38rem;
  border-top: 1px solid rgba(201, 162, 39, 0.2);
  border-radius: 0 0 12px 12px;
  cursor: default;
}

.km-banner {
  font-size: 0.8rem;
  color: #e8edf4;
  display: flex;
  align-items: center;
  gap: 0.55rem;
  flex-wrap: wrap;
  justify-content: center;
  padding: 0.22rem 0.55rem;
  border-radius: 10px;
  background: linear-gradient(165deg, rgba(22, 28, 36, 0.6), rgba(12, 14, 20, 0.65));
  border: 1px solid rgba(201, 162, 39, 0.3);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  max-width: 100%;
}
.km-banner .chud-banner-end {
  border: 1px solid rgba(201, 162, 39, 0.5);
  background: linear-gradient(165deg, rgba(80, 60, 24, 0.9), rgba(40, 30, 12, 0.95));
  color: #f0e0b0;
  border-radius: 8px;
  padding: 0.15rem 0.55rem;
  cursor: pointer;
  font-size: 0.72rem;
}
.km-status {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
  justify-content: center;
  max-width: 44rem;
}

/* Journal — right side glass, taller for readability */
.km-log-panel {
  width: min(22rem, 24vw);
  min-width: 14rem;
  max-width: 26rem;
  min-height: 10rem;
  display: flex;
  flex-direction: column;
  border-radius: 12px;
  background: linear-gradient(165deg, rgba(18, 22, 30, 0.9), rgba(10, 12, 16, 0.94));
  border: 1px solid rgba(201, 162, 39, 0.48);
  box-shadow:
    0 10px 34px rgba(0, 0, 0, 0.52),
    inset 0 1px 0 rgba(255, 255, 255, 0.07);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  overflow: hidden;
  position: relative;
  flex: 0 0 auto;
  align-self: flex-end;
  box-sizing: border-box;
}
.km-log-resize {
  height: 7px;
  cursor: ns-resize;
  background: linear-gradient(180deg, rgba(201, 162, 39, 0.42), transparent);
  flex: 0 0 auto;
}
.km-log-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.38rem 0.55rem;
  border-bottom: 1px solid rgba(201, 162, 39, 0.28);
  font-size: 0.78rem;
  color: #e8d090;
}
.km-log-filters button {
  font-size: 0.65rem;
  margin-left: 0.2rem;
  padding: 0.12rem 0.4rem;
  border: 1px solid transparent;
  background: transparent;
  color: #a09070;
  cursor: pointer;
  border-radius: 6px;
}
.km-log-filters button.active {
  border-color: rgba(201, 162, 39, 0.45);
  color: #e8d090;
  background: rgba(201, 162, 39, 0.12);
}
.km-log {
  list-style: none;
  margin: 0;
  padding: 0.45rem 0.55rem;
  overflow-y: auto;
  flex: 1 1 auto;
  font-size: 0.74rem;
  line-height: 1.4;
  color: #e8edf4;
  background: rgba(6, 8, 12, 0.55);
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.65);
}
.km-log-line {
  margin: 0 0 0.28rem;
  padding-bottom: 0.22rem;
  border-bottom: 1px solid rgba(201, 162, 39, 0.12);
}
.km-log-line.km-log-hit,
.km-log-line.km-log-damage { color: #f0b8a8; }
.km-log-line.km-log-miss { color: #a8b0b8; }

.km-drawer {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  /* Sit well above hotbar so drag-drop onto slots is not blocked */
  bottom: max(16.5rem, 32vh);
  width: min(34rem, 90vw);
  max-height: min(36vh, 18rem);
  overflow: auto;
  border-radius: 12px;
  background: linear-gradient(165deg, rgba(18, 22, 30, 0.95), rgba(10, 12, 16, 0.97));
  border: 1px solid rgba(201, 162, 39, 0.52);
  box-shadow: 0 14px 40px rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  z-index: 40;
  padding: 0.55rem 0.7rem 0.8rem;
  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: 0.35;
  border-style: dashed;
}
.km-hot-trash-hint {
  position: absolute;
  left: 50%;
  bottom: 12rem;
  transform: translateX(-50%);
  z-index: 47;
  padding: 0.35rem 0.85rem;
  border-radius: 10px;
  background: rgba(80, 24, 24, 0.92);
  border: 1px solid rgba(220, 100, 80, 0.7);
  color: #f0d0c0;
  font-size: 0.78rem;
  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.45rem; }
.km-drawer-head h3 {
  margin: 0;
  font-size: 0.95rem;
  color: #e8d090;
  font-family: Cinzel, Georgia, serif;
}
.km-drawer-close {
  position: absolute;
  right: 0;
  top: 0;
  border: none;
  background: transparent;
  color: #c0b090;
  font-size: 1.2rem;
  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.4rem;
  padding: 0.35rem;
  border: 1px solid rgba(201, 162, 39, 0.35);
  border-radius: 10px;
  background: rgba(24, 28, 36, 0.78);
  color: #e8edf4;
  cursor: pointer;
  font-size: 0.68rem;
}
.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.5rem;
  z-index: 36;
  padding: 0.35rem 0.8rem;
  border-radius: 10px;
  background: linear-gradient(165deg, rgba(18, 22, 30, 0.9), rgba(12, 14, 20, 0.92));
  border: 1px solid rgba(201, 162, 39, 0.48);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  color: #e8dcc4;
  font-size: 0.78rem;
  pointer-events: none;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.4);
}
.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(16rem, 28vw);
    min-width: 11rem;
  }
  .km-center {
    max-width: min(100%, calc(100% - 12rem));
  }
}
@media (max-width: 800px) {
  .km-combat-main {
    flex-wrap: wrap;
    justify-content: center;
  }
  .km-log-panel {
    width: min(100%, 22rem);
    order: 3;
  }
  .km-center {
    max-width: 100%;
    order: 2;
  }
}
