:root {
  /* Scene photos under images/ — your art order: 1=end, 2–3=travel, 4=start */
  --scene-end: url("images/scene-end.jpg");
  --scene-gustaf: url("images/Gustaf.jpeg");
  --scene-hollow-banks: url("images/Hollow Banks.jpeg");
  --scene-solem: url("images/Solem.jpeg");
  --scene-field: url("images/scene-field.jpg");
  --scene-field-alt: url("images/scene-field2.jpg");
  --scene-town: url("images/scene-town.jpg");

  --bg: #1a1510;
  --panel: #2a2218;
  --border: #4a3d2a;
  --text: #e8dcc8;
  --muted: #9a8b78;
  --accent: #c9a227;
  --danger: #c44;
  --ok: #6a8;
  --font: "Segoe UI", system-ui, sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: radial-gradient(ellipse at top, #2d261c 0%, var(--bg) 55%);
  color: var(--text);
  font-family: var(--font);
  line-height: 1.45;
}

.shell {
  max-width: 52rem;
  margin: 0 auto;
  padding: 1.25rem 1rem 2rem;
}

.header h1 {
  margin: 0 0 0.25rem;
  font-size: 1.65rem;
  font-weight: 650;
  letter-spacing: 0.02em;
}

.header .sub {
  font-weight: 400;
  color: var(--muted);
  font-size: 0.95rem;
}

.tagline {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.app {
  position: relative;
  margin-top: 1.25rem;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1.1rem 1.15rem 1.25rem;
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.35);
}

.panel-title {
  margin: 0 0 0.65rem;
  font-size: 1.05rem;
  color: var(--accent);
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(11rem, 1fr));
  gap: 0.5rem 0.75rem;
  margin: 0.75rem 0 1rem;
  font-size: 0.9rem;
}

.stat {
  padding: 0.35rem 0.5rem;
  background: rgba(0, 0, 0, 0.2);
  border-radius: 6px;
  border: 1px solid var(--border);
}

.stat-hint {
  display: block;
  margin-top: 0.15rem;
  font-size: 0.68rem;
  font-weight: 400;
  color: var(--muted);
}

.party-list {
  list-style: none;
  margin: 0.5rem 0 0;
  padding: 0;
}

.party-list li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.35rem 0.45rem;
  border-bottom: 1px solid var(--border);
  font-size: 0.88rem;
}

.party-list li:last-child {
  border-bottom: none;
}

/* Compact header: Party & resources (no HP bars in list) */
.party-panel {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 0.5rem 0.85rem;
  align-items: start;
  margin-bottom: 0.5rem;
}

.panel-title-party {
  grid-column: 1 / -1;
  margin-bottom: 0.2rem;
  font-size: 0.92rem;
}

/* Roster left, resource stats right (stacks on narrow viewports) */
.party-list-compact {
  grid-column: 1;
  grid-row: 2;
  margin-top: 0;
}

.party-panel .stats-grid-compact {
  grid-column: 2;
  grid-row: 2;
  grid-template-columns: 1fr;
  gap: 0.28rem;
  margin: 0;
  padding-left: 0.65rem;
  border-left: 1px solid var(--border);
  font-size: 0.76rem;
}

.party-panel .stats-grid-compact .stat {
  padding: 0.2rem 0.32rem;
  font-size: 0.76rem;
}

.party-panel .stats-grid-compact .stat-hint {
  font-size: 0.62rem;
}

@media (max-width: 34rem) {
  .party-panel {
    grid-template-columns: 1fr;
  }

  .party-list-compact {
    grid-column: 1;
    grid-row: 2;
  }

  .party-panel .stats-grid-compact {
    grid-column: 1;
    grid-row: 3;
    padding-left: 0;
    border-left: none;
    grid-template-columns: repeat(auto-fill, minmax(8.25rem, 1fr));
  }
}

.party-list-compact li {
  padding: 0.18rem 0.3rem;
  font-size: 0.74rem;
  gap: 0.35rem;
}

.party-list-compact .avatar.sm {
  width: 1rem;
  height: 1rem;
  font-size: 0.58rem;
}

.party-hp-text {
  margin-left: auto;
  flex-shrink: 0;
  font-size: 0.7rem;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.role-soldier {
  color: #e8b4b4;
}
.role-priest {
  color: #b4c8ff;
}
.role-mercenary {
  color: #c9d6a8;
}
.role-guest {
  color: #ddb4ff;
}

.hpbar {
  flex: 1;
  max-width: 9rem;
  height: 0.45rem;
  background: #111;
  border-radius: 4px;
  overflow: hidden;
  border: 1px solid var(--border);
}

.hpbar > span {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, #5a8, #8c8);
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin-top: 0.85rem;
}

button {
  font: inherit;
  cursor: pointer;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: #3a3024;
  color: var(--text);
  padding: 0.45rem 0.75rem;
}

button:hover:not(:disabled) {
  border-color: var(--accent);
  color: #fff;
}

button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

button.primary {
  background: #4a3b1a;
  border-color: var(--accent);
  color: #fff8e8;
}

.log {
  margin-top: 1rem;
  max-height: 14rem;
  overflow-y: auto;
  padding: 0.5rem 0.55rem;
  background: #120f0c;
  border-radius: 6px;
  border: 1px solid var(--border);
  font-size: 0.82rem;
  color: var(--muted);
}

.log p {
  margin: 0.2rem 0;
}

.log .hi {
  color: var(--text);
}

.log .bad {
  color: #f99;
}

.log .good {
  color: #9d9;
}

.shop-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.35rem 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.9rem;
}

.shop-row:last-child {
  border-bottom: none;
}

/* Cantebury town: Church | Inn | Shop | Tavern | Depart */
.illiri-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
  margin: 0 0 0.75rem;
  padding: 0.2rem;
  background: rgba(0, 0, 0, 0.22);
  border: 1px solid var(--border);
  border-radius: 8px;
}

.illiri-tab {
  flex: 1 1 auto;
  min-width: 3.75rem;
  padding: 0.35rem 0.4rem;
  font-size: 0.74rem;
  font-weight: 600;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: rgba(0, 0, 0, 0.2);
  color: var(--muted);
  cursor: pointer;
}

.illiri-tab:hover {
  color: var(--text);
  border-color: var(--accent);
}

.illiri-tab-active {
  color: var(--text);
  border-color: var(--accent);
  background: rgba(201, 162, 39, 0.12);
  box-shadow: inset 0 0 0 1px rgba(201, 162, 39, 0.25);
}

.keep-subtabs {
  margin-top: 0.5rem;
  margin-bottom: 1rem;
  background: rgba(0, 0, 0, 0.12);
}

.keep-subtabs .illiri-tab {
  font-size: 0.7rem;
  min-width: 4.5rem;
}

.town-lead {
  margin: 0 0 0.65rem;
  font-size: 0.88rem;
  color: var(--muted);
  line-height: 1.45;
}

.shopkeeper-lead {
  margin: 0 0 0.5rem;
  font-size: 0.88rem;
  color: var(--muted);
  line-height: 1.45;
}

.shop-gold-line {
  margin: 0 0 0.5rem;
  font-size: 0.9rem;
}

.shop-block {
  margin-bottom: 0.5rem;
  padding: 0.15rem 0.35rem 0.35rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.12);
}

.footer {
  margin-top: 1rem;
  font-size: 0.78rem;
  color: var(--muted);
}

code {
  font-size: 0.85em;
  color: #dcb;
}

/* --- visuals: scenes, travel map, battle --- */

.scene {
  min-height: 7.5rem;
  border-radius: 10px;
  border: 1px solid var(--border);
  margin-bottom: 0.85rem;
  background-size: cover;
  background-position: center;
  position: relative;
  overflow: hidden;
}

.scene-splash {
  min-height: 12.5rem;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: 0.65rem 0.85rem 0.75rem;
  box-shadow: inset 0 -70px 90px rgba(8, 6, 4, 0.75);
}

.scene::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, transparent 0%, rgba(10, 8, 6, 0.55) 100%);
  pointer-events: none;
}

.splash-badge {
  position: relative;
  z-index: 2;
  align-self: flex-start;
  font-size: 0.62rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: rgba(255, 248, 232, 0.85);
  border: 1px solid rgba(201, 162, 39, 0.45);
  padding: 0.15rem 0.4rem;
  border-radius: 4px;
  background: rgba(0, 0, 0, 0.35);
  margin-bottom: 0.35rem;
}

.splash-title {
  position: relative;
  z-index: 2;
  margin: 0;
  font-size: 1.45rem;
  font-weight: 750;
  letter-spacing: 0.03em;
  text-shadow: 0 2px 12px rgba(0, 0, 0, 0.85);
}

.splash-sub {
  position: relative;
  z-index: 2;
  margin: 0.2rem 0 0;
  font-size: 0.78rem;
  color: rgba(232, 220, 200, 0.88);
  max-width: 26rem;
  line-height: 1.35;
}

/* Start town: photo + read overlay (fallback color if image missing) */
.scene-start-city {
  background-color: #1a1510;
  background-image:
    linear-gradient(180deg, rgba(10, 8, 6, 0.45) 0%, rgba(10, 8, 6, 0.78) 100%),
    var(--scene-town);
  background-size: cover;
  background-position: center;
}

/* Travel: second travel art D1–D3, third travel art D4–D5; tint shifts by day */
.scene-travel {
  background-color: #151210;
}

.scene-travel-d1 {
  background-image:
    radial-gradient(circle at 18% 22%, rgba(255, 230, 180, 0.35) 0%, transparent 42%),
    linear-gradient(185deg, rgba(42, 58, 88, 0.55) 0%, rgba(138, 106, 80, 0.45) 55%, rgba(31, 26, 20, 0.65) 100%),
    var(--scene-field);
  background-size: cover;
  background-position: center;
}

.scene-travel-d2 {
  background-image:
    radial-gradient(circle at 22% 18%, rgba(255, 200, 140, 0.45) 0%, transparent 38%),
    linear-gradient(185deg, rgba(74, 96, 136, 0.5) 0%, rgba(201, 160, 96, 0.4) 48%, rgba(42, 34, 24, 0.62) 100%),
    var(--scene-field);
  background-size: cover;
  background-position: center;
}

.scene-travel-d3 {
  background-image:
    radial-gradient(circle at 50% 12%, rgba(255, 255, 220, 0.25) 0%, transparent 35%),
    linear-gradient(185deg, rgba(106, 138, 184, 0.48) 0%, rgba(216, 200, 152, 0.42) 52%, rgba(42, 38, 24, 0.6) 100%),
    var(--scene-field);
  background-size: cover;
  background-position: center;
}

.scene-travel-d4 {
  background-image:
    radial-gradient(circle at 78% 20%, rgba(255, 180, 120, 0.35) 0%, transparent 40%),
    linear-gradient(185deg, rgba(74, 80, 128, 0.52) 0%, rgba(192, 128, 80, 0.42) 45%, rgba(58, 40, 24, 0.62) 100%),
    var(--scene-field-alt);
  background-size: cover;
  background-position: center;
}

.scene-travel-d5 {
  background-image:
    radial-gradient(ellipse 80% 50% at 50% 0%, rgba(120, 100, 160, 0.35) 0%, transparent 50%),
    linear-gradient(185deg, rgba(42, 40, 72, 0.55) 0%, rgba(106, 80, 64, 0.48) 50%, rgba(26, 18, 16, 0.68) 100%),
    var(--scene-field-alt);
  background-size: cover;
  background-position: center;
}

.scene-travel .splash-title {
  color: #fff8ec;
}

.scene-ruins {
  background-image: radial-gradient(ellipse at 50% 120%, #2a3540 0%, transparent 55%),
    linear-gradient(160deg, #1f1c18 0%, #2a2620 100%);
}

.scene-splash.scene-ruins::before,
.scene-splash.scene-battle::before {
  content: none;
}

.scene-ruins::before {
  content: "Ruins";
  position: absolute;
  left: 0.75rem;
  bottom: 0.45rem;
  font-size: 0.72rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #9ab;
  z-index: 1;
}

.scene-battle {
  background-image: radial-gradient(circle at 70% 0%, rgba(200, 80, 60, 0.25) 0%, transparent 45%),
    linear-gradient(185deg, #241a18 0%, #1a1510 100%);
}

.scene-battle::before {
  content: "Skirmish";
  position: absolute;
  left: 0.75rem;
  bottom: 0.45rem;
  font-size: 0.72rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #f99;
  z-index: 1;
}

.scene-end-city {
  background-color: #121a16;
  background-image:
    linear-gradient(185deg, rgba(58, 90, 104, 0.4) 0%, rgba(74, 96, 72, 0.55) 45%, rgba(26, 34, 24, 0.75) 100%),
    var(--scene-end);
  background-size: cover;
  background-position: center;
}

.scene-end-city .splash-title {
  color: #e8fff0;
}

.scene-end-city--gustaf {
  background-image:
    linear-gradient(185deg, rgba(50, 80, 98, 0.45) 0%, rgba(66, 92, 118, 0.58) 45%, rgba(18, 28, 36, 0.78) 100%),
    var(--scene-gustaf);
}

.scene-end-city--hollow_banks {
  background-image:
    linear-gradient(185deg, rgba(66, 80, 70, 0.45) 0%, rgba(76, 92, 88, 0.58) 45%, rgba(20, 28, 25, 0.78) 100%),
    var(--scene-hollow-banks);
}

.scene-end-city--solem {
  background-image:
    linear-gradient(185deg, rgba(70, 74, 92, 0.45) 0%, rgba(86, 84, 108, 0.58) 45%, rgba(24, 22, 34, 0.78) 100%),
    var(--scene-solem);
}

.scene-end-city--brookside {
  background-image:
    linear-gradient(185deg, rgba(58, 72, 52, 0.45) 0%, rgba(72, 88, 68, 0.58) 45%, rgba(18, 26, 20, 0.78) 100%),
    var(--scene-hollow-banks);
}

.scene-end-city--glennhardt {
  background-image:
    linear-gradient(185deg, rgba(62, 58, 78, 0.45) 0%, rgba(78, 72, 98, 0.58) 45%, rgba(22, 20, 32, 0.78) 100%),
    var(--scene-solem);
}

.travel-visual {
  margin: 0 0 0.75rem;
  padding: 0.5rem 0.35rem 0.35rem;
  background: rgba(0, 0, 0, 0.18);
  border: 1px solid var(--border);
  border-radius: 8px;
}

.map-row {
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.map-node {
  flex: 0 0 auto;
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 0.35rem 0.45rem;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: #2c241c;
  color: var(--muted);
}

.map-node.start {
  color: var(--accent);
}

.map-node.end {
  color: #9d9;
}

.map-track {
  flex: 1;
  display: flex;
  gap: 0.2rem;
  align-items: stretch;
}

.map-seg {
  flex: 1;
  min-height: 2.25rem;
  border-radius: 4px;
  border: 1px dashed var(--border);
  background: #1c1610;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.15rem;
  font-size: 0.65rem;
  color: var(--muted);
}

.map-seg.done {
  border-style: solid;
  background: #2a3828;
  color: #9d9;
}

.map-seg.current {
  outline: 2px solid var(--accent);
  color: var(--text);
}

.map-day {
  font-weight: 700;
}

.map-ruin {
  display: inline-block;
  padding: 0.05rem 0.25rem;
  border-radius: 3px;
  background: #3a3050;
  color: #ddb4ff;
  font-size: 0.6rem;
}

.map-caption {
  margin: 0.35rem 0 0;
  font-size: 0.72rem;
  color: var(--muted);
}

/* Travel phase transitions (blackout, map intro, march dot, encounter cutaways, overlays) */
.transition-root {
  border-radius: 8px;
  margin-bottom: 0.75rem;
  min-height: 12rem;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 1.25rem 1rem;
}

.transition-root--blackout {
  background: radial-gradient(circle at 50% 35%, #3a3020 0%, #120f0c 50%, #000 100%);
  border: 1px solid #1a1814;
  animation: fade-in-black 0.45s ease-out;
}

@keyframes fade-in-black {
  from {
    opacity: 0;
    filter: brightness(2);
  }

  to {
    opacity: 1;
    filter: brightness(1);
  }
}

.transition-blackout-inner {
  max-width: 22rem;
}

.transition-blackout-title {
  margin: 0 0 0.5rem;
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--accent);
  letter-spacing: 0.04em;
}

.transition-blackout-line {
  margin: 0;
  font-size: 0.9rem;
  color: var(--muted);
  line-height: 1.5;
}

.transition-root--cut {
  background: radial-gradient(ellipse at center, rgba(60, 40, 30, 0.92) 0%, #0d0a08 78%);
  border: 1px solid var(--border);
  animation: cut-flash 0.35s ease-out;
}

@keyframes cut-flash {
  from {
    filter: brightness(1.55) contrast(0.95);
  }

  to {
    filter: none;
  }
}

.cut-card {
  max-width: 24rem;
  padding: 1rem 1.15rem 1.1rem;
  border-radius: 10px;
  border: 1px solid rgba(201, 162, 39, 0.45);
  background: rgba(0, 0, 0, 0.55);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.5);
}

.cut-kicker {
  font-size: 0.62rem;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  color: var(--accent);
  margin-bottom: 0.35rem;
}

.cut-title {
  margin: 0 0 0.35rem;
  font-size: 1.05rem;
  color: var(--text);
}

.cut-sub {
  margin: 0;
  font-size: 0.82rem;
  color: var(--muted);
}

.transition-sheet {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  padding: 1.5rem 1rem 2.5rem;
  pointer-events: none;
  border-radius: 10px;
  z-index: 8;
}

.transition-sheet--dim {
  background: linear-gradient(180deg, transparent 0%, transparent 42%, rgba(0, 0, 0, 0.55) 100%);
}

.transition-sheet--gold {
  background: radial-gradient(circle at 50% 120%, rgba(201, 162, 39, 0.28) 0%, transparent 45%),
    linear-gradient(180deg, transparent 0%, rgba(10, 8, 6, 0.65) 100%);
}

.transition-sheet-title {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--accent);
  text-shadow: 0 1px 8px rgba(0, 0, 0, 0.8);
}

.transition-sheet-sub {
  margin: 0.35rem 0 0;
  font-size: 0.78rem;
  color: var(--muted);
}

.travel-map-intro {
  margin-bottom: 0.85rem;
}

.map-intro-lead {
  margin: 0 0 0.65rem;
  font-size: 0.88rem;
  color: var(--muted);
}

.map-track--rel {
  position: relative;
  overflow: visible;
}

.map-seg-marching {
  background: #353018 !important;
  border-style: solid !important;
  border-color: var(--accent) !important;
  outline: 1px solid rgba(201, 162, 39, 0.35);
  animation: seg-pulse 1.35s ease-in-out infinite;
}

@keyframes seg-pulse {
  0%,
  100% {
    box-shadow: inset 0 0 0 rgba(201, 162, 39, 0);
  }

  50% {
    box-shadow: inset 0 0 14px rgba(201, 162, 39, 0.28);
  }
}

.map-caravan {
  position: absolute;
  top: 50%;
  width: 0.55rem;
  height: 0.55rem;
  margin-top: -0.275rem;
  z-index: 3;
  filter: drop-shadow(0 0 6px rgba(201, 162, 39, 0.9));
  left: var(--from-left, 0%);
  animation: map-caravan-march 1.35s ease-in-out forwards;
}

.map-caravan-dot {
  display: block;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background: radial-gradient(circle at 30% 30%, #fff8e0, var(--accent) 55%, #7a6020 100%);
  border: 1px solid #4a3a12;
}

@keyframes map-caravan-march {
  from {
    left: var(--from-left, 0%);
  }

  to {
    left: var(--to-left, 0%);
  }
}

@media (prefers-reduced-motion: reduce) {
  .transition-root--blackout,
  .transition-root--cut,
  .map-seg-marching,
  .map-caravan {
    animation: none !important;
  }

  .map-caravan {
    left: var(--to-left, var(--from-left, 0%));
  }
}

.avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.85rem;
  height: 1.85rem;
  border-radius: 50%;
  font-weight: 800;
  font-size: 0.85rem;
  border: 2px solid var(--border);
  flex-shrink: 0;
}

.avatar.sm {
  width: 1.35rem;
  height: 1.35rem;
  font-size: 0.72rem;
}

.avatar-soldier {
  background: #4a2a2a;
  color: #fcc;
}

.avatar-priest {
  background: #2a3550;
  color: #cdf;
}

.avatar-mercenary {
  background: #35402a;
  color: #dfa;
}

.party-list li {
  gap: 0.45rem;
}

.battle-lead {
  margin: 0 0 0.65rem;
  color: var(--muted);
  font-size: 0.9rem;
}

/* Tactical fight: separate enemy band from party cards (avoids crowding/overlap) */
.combat-stage {
  display: flex;
  flex-direction: column;
  gap: 0;
  margin-top: 0.25rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--border);
  position: relative;
  isolation: isolate;
}

.combat-enemy-band {
  flex: 0 0 auto;
  margin-bottom: 1rem;
  padding: 0.65rem 0.55rem 0.75rem;
  border-radius: 8px;
  border: 1px solid #5a3030;
  background: linear-gradient(180deg, rgba(58, 34, 32, 0.55) 0%, rgba(18, 13, 12, 0.35) 100%);
}

.combat-enemy-band-title {
  margin: 0 0 0.45rem;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #e8b4b4;
}

.combat-stage .foe-row {
  margin-bottom: 0;
}

.combat-party-band {
  flex: 0 0 auto;
  padding-top: 0.15rem;
  border-top: 1px dashed var(--border);
}

.combat-party-band-title {
  margin: 0.55rem 0 0.45rem;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
}

.combat-stage .battle-grid {
  gap: 0.55rem;
}

.party-panel--combat {
  margin-bottom: 0.35rem;
  gap: 0.35rem 0.55rem;
}

.party-panel--combat .panel-title-party {
  font-size: 0.82rem;
  margin-bottom: 0.1rem;
}

.party-panel--combat .stats-grid-compact {
  gap: 0.18rem;
  padding-left: 0.45rem;
}

.party-panel--combat .stats-grid-compact .stat {
  padding: 0.12rem 0.22rem;
  font-size: 0.67rem;
}

.party-panel--combat .party-list-compact li {
  padding: 0.1rem 0.2rem;
  font-size: 0.67rem;
}

.party-panel--combat .party-list-compact .avatar.sm {
  width: 0.88rem;
  height: 0.88rem;
  font-size: 0.5rem;
}

.party-panel--combat .party-hp-text {
  font-size: 0.62rem;
}

.foe-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin-bottom: 0.85rem;
}

.foe-card {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0.2rem;
  flex: 1 1 7.5rem;
  max-width: 10rem;
  min-height: 0;
  padding: 0.45rem 0.5rem;
  border-radius: 8px;
  border: 1px solid #5a3030;
  background: linear-gradient(160deg, #3a2220 0%, #221510 100%);
}

.foe-card .hpbar {
  flex: none;
  display: block;
  width: 100%;
  max-width: none;
  margin: 0.1rem 0 0.05rem;
}

.foe-name {
  font-weight: 700;
  font-size: 0.82rem;
  color: #fbb;
}

.foe-portrait {
  width: 100%;
  max-width: 5.2rem;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  border-radius: 6px;
  border: 1px solid #5a3030;
  margin-bottom: 0.3rem;
  background: #120d0c;
}

.foe-meta {
  margin-top: 0.25rem;
  font-size: 0.72rem;
  color: var(--muted);
}

.battle-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(7.25rem, 1fr));
  gap: 0.45rem;
  align-items: start;
}

.battle-card {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.35rem 0.45rem 0.45rem;
  background: rgba(0, 0, 0, 0.2);
}

/* Compact paper-doll strip; command grid stays full size below */
.battle-doll {
  margin-bottom: 0.35rem;
}

.battle-doll .battle-card-head {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  margin-bottom: 0.1rem;
}

.battle-doll .battle-avatar {
  width: 1.15rem;
  height: 1.15rem;
  font-size: 0.58rem;
  border-width: 1px;
}

.battle-doll .hpbar {
  max-width: 100%;
  height: 0.32rem;
}

.battle-doll .battle-name {
  font-size: 0.66rem;
  font-weight: 600;
  max-width: 6.25rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.battle-doll .battle-hp {
  font-size: 0.62rem;
  color: var(--muted);
  margin-bottom: 0;
}

.battle-card-head {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  margin-bottom: 0.25rem;
}

.battle-name {
  font-size: 0.78rem;
  font-weight: 600;
}

.battle-hp {
  font-size: 0.72rem;
  color: var(--muted);
  margin-bottom: 0.35rem;
}

.battle-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.25rem;
}

.act-btn {
  font-size: 0.68rem;
  padding: 0.28rem 0.2rem;
  border-radius: 5px;
}

.act-btn.selected {
  border-color: var(--accent);
  color: #fff;
  background: #4a3b1a;
}

.battle-actions-row {
  margin-top: 0.65rem;
}

.hint {
  margin: 0.35rem 0 0;
  font-size: 0.78rem;
  color: var(--muted);
}

/* Party roster editor (Cantebury prep) */
.roster-heading {
  margin: 0.75rem 0 0.25rem;
  font-size: 0.95rem;
  color: var(--accent);
}

.roster-note {
  margin: 0 0 0.5rem;
  font-size: 0.8rem;
  color: var(--muted);
}

.roster-edit {
  list-style: none;
  margin: 0 0 0.5rem;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.15);
}

.roster-row {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.35rem 0.45rem;
  border-bottom: 1px solid var(--border);
  font-size: 0.85rem;
}

.roster-row:last-child {
  border-bottom: none;
}

.roster-name {
  flex: 1;
  min-width: 0;
}

.roster-meta {
  font-size: 0.72rem;
  color: var(--muted);
  white-space: nowrap;
}

.roster-remove {
  font-size: 0.68rem;
  padding: 0.2rem 0.4rem;
}

.roster-add {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-bottom: 0.65rem;
}

.roster-add button {
  font-size: 0.75rem;
}

.tavern-lead {
  margin: 0 0 0.75rem;
  font-size: 0.88rem;
  color: var(--muted);
  line-height: 1.45;
}

.tavern-choice-row {
  margin-bottom: 1rem;
}

.tavern-guest-actions {
  margin-top: 0.5rem;
}


/* Inventory character sheet (figma-inspired paper doll card) */
.sheet-wrap {
  margin: 0.5rem 0 0.7rem;
  display: grid;
  grid-template-columns: 12rem minmax(0, 1fr);
  gap: 0.65rem;
}

.sheet-roster {
  border: 1px solid var(--border);
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.18);
  padding: 0.45rem;
}

.inv-member-list {
  display: grid;
  gap: 0.35rem;
}

.inv-member-row {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  justify-content: flex-start;
  font-size: 0.78rem;
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: rgba(0, 0, 0, 0.12);
  padding: 0.2rem 0.3rem;
}

.inv-member-row.selected {
  border-color: var(--accent);
  background: rgba(201, 162, 39, 0.13);
}

.inv-member-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.inv-member-style {
  margin-left: auto;
  font-size: 0.62rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}


.sheet-card {
  border: 1px solid var(--border);
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.2);
  padding: 0.65rem;
}

.sheet-top {
  display: grid;
  grid-template-columns: 7.5rem minmax(0, 1fr);
  gap: 0.7rem;
}

.sheet-portrait {
  border: 1px solid var(--border);
  border-radius: 8px;
  min-height: 7rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: #16120d;
  gap: 0.35rem;
}

.sheet-style-chip {
  font-size: 0.62rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.sheet-doll {
  width: 4rem;
  height: 4rem;
  font-size: 1.5rem;
  border-width: 3px;
}

.doll-soldier-classic { background: linear-gradient(135deg, #5f2b2b 0%, #3f1f1f 100%); color: #ffd8d8; }
.doll-soldier-veteran { background: linear-gradient(135deg, #6a3d1f 0%, #3d2311 100%); color: #ffe2bf; }
.doll-soldier-warden { background: linear-gradient(135deg, #24425f 0%, #162a3f 100%); color: #d5ecff; }
.doll-priest-classic { background: linear-gradient(135deg, #2b355f 0%, #1b2340 100%); color: #dce3ff; }
.doll-priest-scribe { background: linear-gradient(135deg, #46306a 0%, #2a1d40 100%); color: #eadbff; }
.doll-priest-oracle { background: linear-gradient(135deg, #21536f 0%, #153446 100%); color: #cff1ff; }
.doll-mercenary-classic { background: linear-gradient(135deg, #35572f 0%, #243b20 100%); color: #def6d3; }
.doll-mercenary-raider { background: linear-gradient(135deg, #6a4622 0%, #3f2a14 100%); color: #ffe5bf; }
.doll-mercenary-ranger { background: linear-gradient(135deg, #1f5c46 0%, #13392c 100%); color: #d6ffe8; }

.sheet-meta p {
  margin: 0 0 0.25rem;
  font-size: 0.78rem;
  color: var(--text);
}

.sheet-meta b {
  color: var(--muted);
  text-transform: lowercase;
  margin-right: 0.25rem;
}

.sheet-meta select {
  font: inherit;
  background: #2a2218;
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 5px;
  padding: 0.15rem 0.35rem;
}

.sheet-divider {
  margin: 0.55rem 0;
  border-top: 2px solid #2a2016;
}

.sheet-sections h4 {
  margin: 0.5rem 0 0.2rem;
  font-size: 0.78rem;
  color: var(--muted);
}

.sheet-sections p {
  margin: 0.12rem 0;
  font-size: 0.76rem;
}

@media (max-width: 42rem) {
  .sheet-wrap {
    grid-template-columns: 1fr;
  }

  .sheet-top {
    grid-template-columns: 1fr;
  }
}


.inv-style-btn-row {
  margin-left: auto;
  display: inline-flex;
  gap: 0.2rem;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.inv-style-btn {
  font: inherit;
  font-size: 0.62rem;
  padding: 0.1rem 0.28rem;
  border-radius: 4px;
  border: 1px solid var(--border);
  background: #2a2218;
  color: var(--muted);
}

.inv-style-btn.selected {
  border-color: var(--accent);
  background: #4a3b1a;
  color: #fff;
}


.sheet-wrap--single {
  grid-template-columns: 1fr;
}

.inv-open-list {
  display: grid;
  gap: 0.45rem;
  margin-top: 0.45rem;
}

.inv-open-char {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  width: 100%;
  text-align: left;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.35rem 0.45rem;
  background: rgba(0, 0, 0, 0.16);
}

.inv-open-char:hover {
  border-color: var(--accent);
  background: rgba(201, 162, 39, 0.12);
}

.inv-open-meta {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.inv-open-name {
  font-size: 0.84rem;
  font-weight: 600;
  color: var(--text);
}

.inv-open-sub {
  font-size: 0.7rem;
  color: var(--muted);
}


.party-openable {
  cursor: pointer;
}
.party-openable:hover {
  background: rgba(201,162,39,0.12);
}


.char-form {
  display: grid;
  gap: 0.45rem;
  margin: 0.6rem 0 0.3rem;
}

.char-form label {
  display: grid;
  gap: 0.2rem;
  font-size: 0.78rem;
  color: var(--muted);
}

.char-form input,
.char-form select,
.char-form textarea {
  font: inherit;
  color: var(--text);
  background: #1b1611;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.35rem 0.45rem;
}

.char-headshot-wrap {
  margin-top: 0.2rem;
}

.char-headshot-head {
  margin: 0 0 0.35rem;
  font-size: 0.78rem;
  color: var(--muted);
}

.char-headshot-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(6.2rem, 1fr));
  gap: 0.35rem;
  max-height: 17rem;
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.4rem;
  background: rgba(0, 0, 0, 0.12);
}

.char-headshot-option {
  display: grid;
  gap: 0.22rem;
  justify-items: center;
  align-content: start;
  text-align: center;
  padding: 0.25rem;
  min-height: 6.9rem;
}

.char-headshot-option img {
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: #0f0c09;
}

.char-headshot-option span {
  font-size: 0.62rem;
  line-height: 1.2;
  color: var(--muted);
  word-break: break-word;
}

.char-headshot-option.selected {
  border-color: var(--accent);
  background: rgba(201, 162, 39, 0.14);
}

.char-headshot-option.selected span {
  color: var(--text);
}

.char-headshot-option-none {
  min-height: 2.4rem;
  align-content: center;
}

.sheet-headshot {
  width: 100%;
  max-width: 6.4rem;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #0f0c09;
}


.caravan-followers {
  margin: 1rem 0;
  padding: 0.75rem 0.85rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.14);
}

.caravan-followers-list {
  margin: 0.5rem 0 0;
  padding-left: 1.2rem;
  color: var(--muted);
  font-size: 0.92rem;
}

.caravan-followers-list li {
  margin-bottom: 0.35rem;
}

.char-stat-wrap {
  margin-top: 0.35rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.45rem;
  background: rgba(0, 0, 0, 0.12);
}

.char-stat-head {
  margin: 0 0 0.35rem;
  font-size: 0.78rem;
}

.char-stat-row {
  display: grid;
  grid-template-columns: 6.5rem 4.5rem 1.8rem 2.2rem 1.8rem minmax(0, 1fr);
  align-items: center;
  gap: 0.25rem;
  margin-bottom: 0.2rem;
}

.char-stat-name,
.char-stat-base,
.char-stat-bonus,
.char-stat-total {
  font-size: 0.72rem;
}

.char-stat-base,
.char-stat-total {
  color: var(--muted);
}

.char-stat-btn {
  padding: 0.12rem 0.2rem;
  font-size: 0.75rem;
}

@media (max-width: 42rem) {
  .char-stat-row {
    grid-template-columns: 1fr 1fr 1.8rem 2.2rem 1.8rem 1fr;
  }
}


.data-panel {
  margin-top: 0.5rem;
}

.data-table-wrap {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: rgba(0, 0, 0, 0.2);
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.82rem;
}

.data-table th,
.data-table td {
  border-bottom: 1px solid var(--border);
  padding: 0.4rem 0.45rem;
  text-align: left;
  white-space: nowrap;
}

.data-table th {
  color: var(--accent);
  font-weight: 600;
}

.data-details {
  margin-top: 0.65rem;
}

.data-details summary {
  cursor: pointer;
  color: var(--text);
}

.data-pre {
  margin: 0.45rem 0 0;
  padding: 0.55rem;
  max-height: 12rem;
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: #120f0c;
  font-size: 0.74rem;
}


.battle-card-active {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px rgba(201, 162, 39, 0.45);
  background: rgba(74, 59, 26, 0.2);
}

.foe-card {
  text-align: left;
}

button.foe-card {
  width: 100%;
  cursor: default;
}

button.foe-card.foe-card-targetable {
  cursor: pointer;
}
button.foe-card:disabled {
  opacity: 1;
  cursor: default;
}


.foe-card.foe-card-targetable {
  border-color: #7a4a4a;
}

.foe-card.foe-card-targetable:hover {
  border-color: var(--accent);
}

.foe-card.foe-card-selected {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px rgba(201, 162, 39, 0.4);
}


.campaign-save-bar {
  margin-top: 0.85rem;
  padding: 0.75rem 0.95rem;
  background: #241c14;
  border: 1px solid #4a3d2a;
  border-radius: 10px;
}

.campaign-save-summary {
  margin: 0 0 0.55rem;
  font-size: 0.92rem;
  color: #c9baa3;
}

.campaign-save-actions {
  margin: 0;
  gap: 0.45rem;
  flex-wrap: wrap;
}
