:root {
  --parchment: #f4e4c1;
  --parchment-dark: #e8d4a8;
  --parchment-deep: #d9c498;
  --ink: #2c1810;
  --ink-light: #5c4030;
  --ink-faint: #8a7565;
  --accent: #c61515;
  --accent-light: #a52a2a;
  --gold: #c9a227;
  --gold-dark: #9a7b1a;
  --gold-shine: #f4d976;
  --wax-deep: #6b1818;
  --wax-mid: #8b2020;
  --wax-light: #a73030;
  --wax-shine: #c24545;
  --arcane: #5b2d8e;
  --rule-color: rgba(92, 64, 48, 0.2);
  --rule-heavy: rgba(44, 24, 16, 0.25);

  /* Semantic surface tokens (light defaults) */
  --ui-bg: var(--parchment);
  --ui-bg-alt: transparent;
  --ui-bg-elev: rgba(255, 255, 255, 0.82);
  --ui-fg: var(--ink);
  --ui-fg-muted: var(--ink-faint);
  --ui-fg-strong: var(--ink);
  --ui-border: var(--rule-color);
  --ui-border-strong: var(--rule-heavy);
  --ui-input-bg: rgba(255, 255, 255, 0.55);
  --ui-input-fg: var(--ink);
  --ui-placeholder: rgba(44, 24, 16, 0.55);
  --ui-accent: var(--gold);
  --ui-danger: var(--accent);
  --ui-success: #4a7d5a;
  --ui-warning: #f9a825;
}

[data-surface="light"] {
  --ui-bg: var(--parchment);
  --ui-bg-alt: transparent;
  --ui-bg-elev: rgba(255, 255, 255, 0.82);
  --ui-fg: var(--ink);
  --ui-fg-muted: var(--ink-faint);
  --ui-fg-strong: var(--ink);
  --ui-border: var(--rule-color);
  --ui-border-strong: var(--rule-heavy);
  --ui-input-bg: rgba(255, 255, 255, 0.55);
  --ui-input-fg: var(--ink);
  --ui-placeholder: rgba(44, 24, 16, 0.55);
  --ui-accent: var(--gold-dark);
  --ui-danger: var(--accent);
  --ui-success: #4a7d5a;
  --ui-warning: #f9a825;
}

[data-surface="dark"] {
  --ui-bg: rgb(31, 16, 6);
  --ui-bg-alt: rgba(31, 16, 6, 0.041);
  --ui-bg-elev: rgba(0, 0, 0, 0.30);
  --ui-fg: var(--parchment-dark);
  --ui-fg-muted: #d0bb8f;
  --ui-fg-strong: var(--parchment);
  --ui-border: rgba(201, 162, 39, 0.18);
  --ui-border-strong: rgba(201, 162, 39, 0.30);
  --ui-input-bg: rgba(0, 0, 0, 0.34);
  --ui-input-fg: #f6ead1;
  --ui-placeholder: rgba(246, 234, 209, 0.82);
  --ui-accent: var(--gold);
  --ui-danger: #ef4444;
  --ui-success: #8ec47a;
  --ui-warning: #f0cd72;
}

[data-surface="dark-elevated"] {
  --ui-bg: rgba(20, 12, 8, 0.95);
  --ui-bg-alt: rgba(255, 255, 255, 0.10);
  --ui-bg-elev: rgba(0, 0, 0, 0.44);
  --ui-fg: #f3ead8;
  --ui-fg-muted: #d9c8ac;
  --ui-fg-strong: #f6ead1;
  --ui-border: rgba(215, 188, 135, 0.80);
  --ui-border-strong: rgba(244, 228, 193, 0.42);
  --ui-input-bg: rgba(0, 0, 0, 0.38);
  --ui-input-fg: #f6ead1;
  --ui-placeholder: rgba(246, 234, 209, 0.78);
  --ui-accent: var(--gold-shine);
  --ui-danger: #f87171;
  --ui-success: #9ad79f;
  --ui-warning: #f5deac;
}

.ui-text {
  color: var(--ui-fg);
}

.ui-text-muted {
  color: var(--ui-fg-muted);
}

.ui-label {
  color: var(--ui-accent);
}

body {
  font-family: 'MedievalSharp', Georgia, serif;
  margin: 0;
  padding: 24px 20px;
  background:
    repeating-linear-gradient(
      90deg,
      transparent,
      transparent 98%,
      rgba(201, 162, 39, 0.03) 98%,
      rgba(201, 162, 39, 0.03) 100%
    ),
    repeating-linear-gradient(
      0deg,
      transparent,
      transparent 98%,
      rgba(139, 0, 0, 0.02) 98%,
      rgba(139, 0, 0, 0.02) 100%
    ),
    linear-gradient(135deg, rgba(139, 0, 0, 0.02) 0%, transparent 50%),
    linear-gradient(225deg, rgba(201, 162, 39, 0.04) 0%, transparent 50%),
    var(--parchment);
  background-size: 60px 60px, 60px 60px, 100% 100%, 100% 100%, 100% 100%;
  color: var(--ink);
  min-height: 100vh;
  overflow-x: hidden;
  max-width: 1400px;
  margin-left: auto;
  margin-right: auto;
  position: relative;
}


*, *::before, *::after {
  box-sizing: border-box;
}

h1, h2 {
  font-family: 'Cinzel Decorative', 'Cinzel', serif;
  font-weight: 600;
  color: var(--ink);
}

h3 {
  font-family: 'Uncial Antiqua', 'Cinzel', serif;
  font-weight: 600;
  color: var(--ink);
}

h1 {
  text-align: center;
  margin: 0 0 28px;
  font-size: 2.2rem;
  letter-spacing: 0.08em;
  text-shadow: 1px 1px 2px rgba(0,0,0,0.08);
  border-bottom: none;
  padding-bottom: 16px;
  position: relative;
  font-weight: 700;
}


/* Decorative double-rule beneath title with flourished endings */
h1::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 15%;
  right: 15%;
  height: 0;
  border-top: 2px solid var(--gold-dark);
  border-bottom: 1px solid var(--gold);
  padding-top: 3px;
}


h2 {
  font-size: 1.3rem;
  margin: 0 0 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--rule-heavy);
  display: flex;
  align-items: center;
  gap: 0;
  letter-spacing: 0.06em;
  font-weight: 700;
  position: relative;
}

/* Section headers without decorative icons */
h2::before {
  content: none;
}

/* Pools Section */
#pools {
  background: transparent;
  border: none;
  border-bottom: 2px solid var(--rule-heavy);
  border-radius: 0;
  padding: 16px 8px 20px;
  margin-bottom: 16px;
  box-shadow: none;
}

#pools label {
  font-family: 'Cinzel Decorative', 'Cinzel', serif;
  font-size: 1rem;
  letter-spacing: 0.04em;
  position: relative;
}


#pools .pool-input {
  background: transparent;
  border: none;
  border-bottom: 2px solid var(--gold-dark);
  border-radius: 0;
  color: var(--accent);
  font-family: 'UnifrakturMaguntia', 'MedievalSharp', 'Cinzel', serif;
  font-weight: 700;
  font-size: 1.8rem;
  padding: 4px 8px;
}

#pools .pool-input:focus {
  outline: none;
  border-bottom-color: var(--gold);
  box-shadow: none;
  background: rgba(201, 162, 39, 0.06);
}

/* Pool spent/remaining totals - grey, italic, normal font */
#statSpent, #statRemaining,
#skillSpent, #skillRemaining {
  color: #8a7565;
  font-family: 'MedievalSharp', serif;
  font-style: italic;
  font-weight: 400;
}

/* Character name label with illuminated drop cap */
#characterName {
  font-family: 'Eagle Lake', 'Uncial Antiqua', serif !important;
  font-size: 1.5rem !important;
  font-weight: 400 !important;
  text-align: center;
  letter-spacing: 0.02em;
  background: rgba(244, 228, 193, 0.35) !important;
  border: none !important;
  border-bottom: 2px solid var(--gold-dark) !important;
  border-radius: 4px 4px 0 0;
  padding: 10px 16px !important;
  min-width: 12ch;
}


/* Controls — dark brown background with circular seals */
#controls {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  margin-bottom: 16px;
  padding: 8px 12px;
  background: #2a1b0f;
  border-radius: 4px;
  border: 1px solid var(--rule-color);
}

/* === WAX SEAL BUTTONS (oval SVG) === */
.btn {
  --seal-w: 102px;
  --seal-h: 53px;
  position: relative;
  border: none;
  padding: 0 8px 0 0;
  cursor: pointer;
  font-family: 'Cinzel', serif;
  font-weight: 700;
  font-size: .9rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  line-height: 1.15;
  background: none;
  background-color: transparent;
  width: auto;
  min-height: var(--seal-h);
  display: inline-flex;
  align-items: center;
  justify-content: flex-start;
  gap: 0px;
  text-align: left;
  white-space: nowrap;
  color: #f7db7f;
  -webkit-text-stroke: 5px rgba(0, 0, 0, 0.85);
  paint-order: stroke fill;
  text-shadow:
    0 1px 0 rgba(183, 158, 89, .3),
    0 -1px 3px rgba(0, 0, 0, 0.7),
    0 0 8px rgba(212, 175, 55, 0.15),
    1px 2px 3px rgba(0, 0, 0, 0.5);
  box-shadow: none;
  clip-path: none;
  filter: none;
  border-radius: 0;
  transition: transform 0.15s ease, filter 0.15s ease;
  overflow: visible;
}

.btn:not(.inline-btn):not(.transaction-btn)::before {
  content: '';
  width: var(--seal-w);
  height: var(--seal-h);
  flex: 0 0 var(--seal-w);
  margin-right: -6px;
  background: url('character-wax%20button.svg') center / contain no-repeat;
  pointer-events: none;
}

.btn:hover {
  transform: translateY(-3px);
  filter: brightness(1.05);
}

.btn:active {
  transform: translateY(1px) scale(0.98);
}

/* --- Wax Seal Crack Effect --- */
.btn-cracks {
  position: absolute;
  top: 0;
  left: 0;
  width: var(--seal-w);
  height: var(--seal-h);
  opacity: 0;
  pointer-events: none;
  z-index: 2;
}

/* Shattered state - cracks appear instantly */
.btn.shattered {
  transform: translateY(2px) scale(0.98) !important;
  filter: brightness(1) !important;
}

.btn.shattered .btn-cracks {
  opacity: 1;
}

/* Healing state - button stays pressed, cracks fade */
.btn.healing {
  transform: translateY(2px) scale(0.98) !important;
  filter: brightness(1) !important;
}

#controls input[type="file"] {
  color: var(--ink);
  font-family: 'MedievalSharp', serif;
  font-size: 0.85rem;
}

/* ============================================
   CHARACTER DASHBOARD - Combat Command Strip
   ============================================ */

.character-dashboard {
  background:
    repeating-linear-gradient(
      180deg, transparent, transparent 3px,
      rgba(255,255,255,0.02) 3px, rgba(255,255,255,0.02) 4px
    ),
    linear-gradient(180deg, #1f1006 0%, var(--ink) 100%);
  color: var(--ui-fg);
  border: 1px solid var(--ui-border);
  border-top: 3px solid var(--ui-border-strong);
  border-radius: 2px;
  padding: 16px 20px;
  margin-bottom: 20px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
}

.dashboard-grid {
  display: grid;
  grid-template-columns: minmax(320px, 1fr) minmax(390px, 460px);
  grid-template-areas:
    "resources map";
  gap: 16px;
  align-items: start;
  margin-bottom: 12px;
}

.dashboard-resource-stack {
  grid-area: resources;
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-width: 0;
}

.dashboard-resource-stack .dashboard-resource {
  width: 100%;
  box-sizing: border-box;
}

/* Hero Resources (HP, SP) */
.dashboard-resource {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 10px 16px;
  border-radius: 2px;
  border: 1px solid var(--ui-border);
  background: var(--ui-bg-alt);
}

.dashboard-resource-label {
  font-family: 'Cinzel', serif;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ui-accent);
  margin-bottom: 4px;
}

.dashboard-resource-controls {
  display: flex;
  align-items: center;
  gap: 6px;
}

.dashboard-resource-collapsible {
  padding-top: 8px;
}

.dashboard-resource-summary {
  list-style: none;
  cursor: pointer;
  user-select: none;
  display: flex;
  justify-content: center;
  align-items: center;
  width: 100%;
}

.dashboard-resource-summary::-webkit-details-marker {
  display: none;
}

.dashboard-resource-summary::after {
  content: '+';
  margin-left: 8px;
  color: var(--ui-accent);
  font-family: 'Cinzel', serif;
  font-size: 0.8rem;
  line-height: 1;
}

.dashboard-resource-collapsible[open] .dashboard-resource-summary::after {
  content: '-';
}

.dashboard-resource-collapsible .dashboard-resource-controls {
  margin-top: 4px;
}

.dashboard-value-unit {
  display: flex;
  align-items: flex-end;
  gap: 1px;
}

.dashboard-input {
  border: none;
  border-bottom: 2px solid var(--ui-accent);
  border-radius: 0;
  background: var(--ui-input-bg);
  font-family: 'MedievalSharp', serif;
  
  font-weight: 700;
  color: var(--ui-input-fg);
  text-align: right;
  box-sizing: border-box;
}

.dashboard-hp .dashboard-input {
  color: var(--ui-danger);
}

.dashboard-hp .dashboard-slash-max {
  color: var(--ui-danger);
}

.dashboard-sp .dashboard-input {
  background: linear-gradient(270deg, #c5a3ec, #a855f7, #6d28d9, #c084fc, #7b3fbf);
  background-size: 300% 100%;
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  animation: arcane-shimmer 6s ease infinite;
}

.dashboard-move .dashboard-input {
  color: var(--ui-success);
}

.dashboard-input-move {
  width: 3em;
  min-width: 3em;
  font-size: 1.6rem;
}

.dashboard-move .dashboard-slash-max {
  color: var(--ui-success);
}

.dashboard-input:focus {
  outline: none;
  border-bottom-color: var(--ui-accent);
  background: var(--ui-bg-alt);
}

/* Hide native number spinners in dashboard (we use custom +/- controls) */
.character-dashboard .dashboard-input[type="number"] {
  appearance: textfield;
  -moz-appearance: textfield;
}

.character-dashboard .dashboard-input[type="number"]::-webkit-outer-spin-button,
.character-dashboard .dashboard-input[type="number"]::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.dashboard-btn {
  background: transparent;
  color: var(--ui-accent);
  border: 1px solid var(--ui-border-strong);
  border-radius: 2px;
  padding: 4px 12px;
  font-family: 'Uncial Antiqua', 'Cinzel', serif;
  font-weight: 700;
  font-size: 0.85rem;
  cursor: pointer;
  transition: all 0.2s ease;
  min-width: 40px;
}

.dashboard-btn-small {
  padding: 3px 8px;
  font-size: 0.75rem;
  min-width: 32px;
}

.dashboard-btn:hover {
  background: var(--ui-bg-alt);
  color: var(--ui-fg-strong);
  border-color: var(--ui-accent);
}

.dashboard-btn:active {
  opacity: 0.8;
}

.dashboard-slash-max {
  font-family: 'MedievalSharp', serif;
  font-size: 0.85rem;
  font-weight: 400;
  color: var(--ui-fg-muted);
  opacity: 0.9;
  margin: 0 1px;
  align-self: flex-end;
  padding-bottom: 4px;
  white-space: nowrap;
}

.dashboard-sp .dashboard-slash-max {
  background: linear-gradient(270deg, #7b3fbf, #a855f7, #6d28d9, #c084fc, #7b3fbf);
  background-size: 300% 100%;
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  animation: arcane-shimmer 6s ease infinite;
  opacity: 0.6;
}

.dashboard-spell-list {
  width: 100%;
  margin-top: 4px;
  border-top: 1px solid rgba(197, 163, 236, 0.28);
  padding-top: 4px;
}

.dashboard-spell-list-summary {
  list-style: none;
  cursor: pointer;
  user-select: none;
  font-family: 'Cinzel', serif;
  font-size: 0.66rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ui-accent);
  text-align: center;
}

.dashboard-spell-list-summary::-webkit-details-marker {
  display: none;
}

.dashboard-spell-list-summary::after {
  content: '+';
  margin-left: 6px;
}

.dashboard-spell-list[open] .dashboard-spell-list-summary::after {
  content: '-';
}

.dashboard-spell-list-body {
  margin-top: 6px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.dashboard-spell-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
  border: 1px solid rgba(197, 163, 236, 0.22);
  border-radius: 2px;
  padding: 4px 6px;
  background: rgba(18, 10, 29, 0.36);
}

.dashboard-spell-name {
  font-family: 'MedievalSharp', serif;
  font-size: 0.78rem;
  color: #f2e6ff;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dashboard-spell-cost {
  font-family: 'Cinzel', serif;
  font-size: 0.66rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: #d9b6ff;
  white-space: nowrap;
}

.dashboard-spell-list-empty {
  text-align: center;
  font-family: 'Cinzel', serif;
  font-size: 0.66rem;
  letter-spacing: 0.05em;
  color: var(--ui-fg-muted);
}

.spell-recharge-info {
  font-family: 'Cinzel', serif;
  font-size: 0.65rem;
  color: var(--ui-fg-muted);
  opacity: 0.75;
  letter-spacing: 0.04em;
  margin-top: 4px;
  line-height: 1.6;
}

.deep-rest-toggle {
  display: flex;
  align-items: center;
  gap: 4px;
  font-family: 'Cinzel', serif;
  font-size: 0.6rem;
  color: var(--ui-fg-muted);
  opacity: 0.7;
  cursor: pointer;
  margin-top: 4px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.deep-rest-toggle input[type="checkbox"] {
  width: auto;
  margin: 0;
  cursor: pointer;
  accent-color: var(--gold);
}

.recovery-advance {
  display: flex;
  align-items: center;
  gap: 3px;
  margin-top: 4px;
  flex-wrap: wrap;
}

.recovery-advance .dashboard-btn {
  font-family: 'Cinzel', serif;
  font-size: 0.6rem;
  letter-spacing: 0.04em;
  color: var(--ui-fg);
  border-color: var(--ui-border-strong);
  opacity: 0.75;
}

.recovery-advance .dashboard-btn:hover {
  background: var(--ui-bg-alt);
  color: var(--ui-fg-strong);
  border-color: var(--ui-accent);
  opacity: 1;
}

/* Secondary Stat Medallions */
.dashboard-stats {
  display: flex;
  gap: 8px;
  justify-content: center;
}

.dashboard-stat {
  text-align: center;
  padding: 6px 10px;
  border-top: 2px solid var(--ui-border-strong);
  background: var(--ui-bg-alt);
  border-radius: 0 0 2px 2px;
  min-width: 68px;
}

.dashboard-stat-label {
  font-family: 'Cinzel', serif;
  font-size: 0.6rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  color: var(--parchment-dark);
  opacity: 0.8;
  display: block;
  margin-bottom: 2px;
}

.dashboard-stat-value {
  font-family: 'MedievalSharp', serif;
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--ui-accent);
}

.dashboard-side-stack {
  grid-area: map;
  display: flex;
  flex-direction: column;
  gap: 10px;
  align-self: start;
  justify-self: stretch;
  width: 100%;
  min-width: 0;
  max-width: none;
  margin-left: 0;
  margin-right: 0;
}

.dashboard-awareness-panel {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 10px;
  border: 1px solid var(--ui-border);
  border-radius: 2px;
  background: var(--ui-bg-alt);
}

.dashboard-awareness-heading {
  font-family: 'Cinzel', serif;
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--gold);
  opacity: 0.85;
  text-align: center;
}

.dashboard-awareness-base {
  display: block;
  text-align: center;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--ui-border);
}

.dashboard-awareness-base-value {
  font-family: 'Uncial Antiqua', 'Cinzel', serif;
  font-size: 1.24rem;
  color: var(--ui-accent);
  line-height: 1;
}

.dashboard-awareness-specialties {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(74px, 1fr));
  gap: 6px;
}

.dashboard-awareness-cell {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  min-height: 56px;
  padding: 4px 2px;
  border: 1px solid rgba(212, 175, 55, 0.12);
  border-radius: 2px;
  background: rgba(0, 0, 0, 0.14);
}

.dashboard-awareness-name {
  font-family: 'Cinzel', serif;
  font-size: 0.66rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--ui-fg);
  text-align: center;
  line-height: 1.15;
}

.dashboard-awareness-value {
  font-family: 'Uncial Antiqua', 'Cinzel', serif;
  font-size: 1.05rem;
  color: var(--ui-accent);
  text-align: center;
  line-height: 1;
}

.dashboard-mini-dr {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 6px 8px;
  border: 1px solid var(--ui-border);
  border-radius: 2px;
  background: var(--ui-bg-alt);
  width: 70%;
  align-self: center;
  box-sizing: border-box;
}

.dashboard-mini-dr .armor-dr-chart-wrap {
  width: 100%;
  max-width: none;
  margin: 0;
}

@media (max-width: 960px) {
  .dashboard-grid {
    grid-template-columns: 1fr;
    grid-template-areas:
      "resources"
      "map";
  }

  .dashboard-resource-stack {
    width: 100%;
  }

  .dashboard-side-stack {
    justify-self: center;
  }
}

.dashboard-mini-dr-label {
  font-family: 'Cinzel', serif;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--gold);
  opacity: 0.8;
}

.armor-dr-chart-mini {
  width: 100%;
  margin: 0;
}

.dashboard-mini-dr .armor-dr-overlay {
  pointer-events: auto;
}

.dashboard-mini-dr .armor-dr-hotspot {
  pointer-events: auto;
  cursor: pointer;
}

.dashboard-mini-dr .armor-dr-base {
  opacity: 0.72;
}

.dashboard-mini-dr .armor-dr-hotspot.is-covered {
  fill: rgba(64, 156, 86, 0.52);
  stroke: rgba(38, 110, 62, 0.9);
}

.dashboard-mini-dr-summary {
  font-family: 'Cinzel', serif;
  font-size: 1rem;
  letter-spacing: 0.04em;
  color: var(--ui-fg-muted);
  opacity: 0.75;
  text-transform: uppercase;
  width: 100%;
  min-height: 1.4em;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Defenses Panel */
.defenses-panel {
  border-top: 1px solid var(--ui-border-strong);
  padding: 8px 4px 4px;
  margin-top: 4px;
}

/* Grappling collapsible panel */
.grapple-panel {
  cursor: default;
}

.grapple-summary {
  cursor: pointer;
  list-style: none;
  user-select: none;
}

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

.grapple-summary::after {
  content: ' ▸';
  font-size: 0.5rem;
  opacity: 0.6;
}

details[open] .grapple-summary::after {
  content: ' ▾';
}

.defenses-title {
  font-family: 'Cinzel', serif;
  font-size: 0.58rem;
  letter-spacing: 0.14em;
  color: var(--gold);
  text-align: center;
  opacity: 0.75;
  margin-bottom: 6px;
}

.defenses-grid {
  display: flex;
  gap: 4px;
  justify-content: space-around;
}

.defense-stat {
  text-align: center;
  flex: 1;
  padding: 4px 6px;
}

.defense-stat-label {
  font-family: 'Cinzel', serif;
  font-size: 0.58rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  color: var(--gold);
  text-transform: uppercase;
  display: block;
  margin-bottom: 2px;
}

.defense-stat-value {
  font-family: 'MedievalSharp', serif;
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--ui-success);
  display: block;
  line-height: 1.1;
}

.defense-stat-notes {
  font-family: 'Cinzel', serif;
  font-size: 0.7rem;
  color: var(--ui-fg-muted);
  opacity: 0.6;
  margin-top: 3px;
  line-height: 1.5;
  display: block;
}

.defense-danger {
  color: var(--ui-danger);
  opacity: 1;
  font-style: italic;
}

/* Status Toggles — full-width row below the resource bars */
.dashboard-toggles {
  grid-column: 1 / -1;
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  gap: 10px 20px;
  border-top: 1px solid var(--ui-border);
  padding-top: 10px;
}

.status-buttons {
  width: 100%;
  align-items: center;
  gap: 6px 8px;
}

.status-effects-summary {
  width: 100%;
  font-family: 'Crimson Pro', serif;
  font-size: 0.86rem;
  color: var(--ui-fg-muted);
  line-height: 1.4;
  padding: 2px 2px 0;
  text-align: left;
}

.status-btn {
  font-family: 'Cinzel', serif;
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 5px 10px;
  border: 1px solid var(--ui-border-strong);
  border-radius: 3px;
  background: transparent;
  color: var(--ui-fg-muted);
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s, box-shadow 0.15s;
  white-space: nowrap;
}

.status-btn:hover {
  background: var(--ui-bg-alt);
  color: var(--ui-fg-strong);
}

.status-btn.status-active {
  background: var(--ui-danger);
  border-color: var(--ui-danger);
  color: var(--ui-fg-strong);
  box-shadow: 0 0 8px rgba(139, 0, 0, 0.5);
}

.dashboard-toggle {
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 2px;
  transition: background 0.2s ease;
}

/* Retreat button */
.dashboard-retreat-btn {
  font-family: 'Cinzel', serif;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 4px 12px;
  border: 1px solid var(--ui-border-strong);
  border-radius: 3px;
  background: transparent;
  color: var(--ui-fg);
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
  align-self: center;
}

.dashboard-retreat-btn:hover {
  background: var(--ui-bg-alt);
}

.dashboard-retreat-btn.retreat-active {
  background: var(--ui-danger);
  border-color: var(--ui-danger);
  color: var(--ui-fg-strong);
  box-shadow: 0 0 8px rgba(139, 0, 0, 0.6);
}

.dashboard-retreat-btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.dashboard-aggressive-parry {
  display: flex;
  flex-direction: column;
  gap: 6px;
  width: min(640px, 100%);
}

.dashboard-aggressive-parry-btn {
  font-family: 'Cinzel', serif;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 4px 12px;
  border: 1px solid var(--ui-border-strong);
  border-radius: 3px;
  background: transparent;
  color: var(--ui-fg);
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}

.dashboard-aggressive-parry-btn:hover {
  background: var(--ui-bg-alt);
}

.dashboard-aggressive-parry-btn.is-pending {
  border-color: rgba(242, 212, 139, 0.85);
  color: #f2d48b;
  background: rgba(87, 63, 18, 0.35);
}

.dashboard-aggressive-parry-btn.is-active {
  border-color: rgba(79, 141, 218, 0.82);
  color: #d4e7ff;
  background: rgba(20, 53, 97, 0.38);
}

.dashboard-aggressive-parry-note {
  border: 1px solid rgba(201, 162, 39, 0.35);
  border-radius: 4px;
  padding: 8px 10px;
  background: rgba(0, 0, 0, 0.2);
  color: var(--ui-fg-muted);
  font-family: 'Crimson Pro', serif;
  font-size: 0.82rem;
  line-height: 1.35;
}

/* Stances section */
.dashboard-stances {
  align-items: flex-start;
  gap: 12px 16px;
}

.stances-panel {
  cursor: default;
}

.stances-row {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 10px;
}

.stances-inline-label {
  margin: 0;
  text-align: left;
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  white-space: nowrap;
}

.stances-panel .dashboard-stances {
  border-top: none;
  padding-top: 0;
  justify-content: flex-start;
  margin-left: 0;
}

.stances-note {
  margin-top: 8px;
  font-family: 'Crimson Pro', serif;
  font-size: 0.82rem;
  color: var(--ui-fg-muted);
  text-align: left;
  line-height: 1.3;
}

.position-panel {
  cursor: default;
}

.position-row {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 10px;
}

.position-buttons {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  flex-wrap: wrap;
  gap: 8px;
}

.position-btn {
  font-size: 0.72rem;
}

.position-note {
  margin-top: 6px;
}

.dashboard-toggles-label {
  font-family: 'Cinzel', serif;
  font-size: 0.6rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ui-fg-muted);
  white-space: nowrap;
}

@media (max-width: 600px) {
  .status-buttons {
    gap: 6px;
  }

  .status-btn {
    flex: 1 1 calc(50% - 6px);
    text-align: center;
  }

  .status-effects-summary {
    font-size: 0.8rem;
  }
}

/* Stance button group — mutually exclusive */
.stance-btn-group {
  display: flex;
  border: 1px solid var(--ui-border-strong);
  border-radius: 3px;
  overflow: hidden;
}

.stance-btn {
  font-family: 'Cinzel', serif;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  padding: 4px 14px;
  border: none;
  background: transparent;
  color: var(--ui-fg-muted);
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
  position: relative;
}

.stance-btn + .stance-btn {
  border-left: 1px solid var(--ui-border);
}

.stance-btn:hover {
  background: var(--ui-bg-alt);
  color: var(--ui-fg-strong);
}

#offensivestance-btn.stance-active {
  background: rgba(239, 68, 68, 0.32);
  color: var(--ui-fg-strong);
}

#neutralstance-btn.stance-active {
  background: rgba(201, 162, 39, 0.26);
  color: var(--ui-fg-strong);
}

#defensivestance-btn.stance-active {
  background: rgba(142, 196, 122, 0.26);
  color: var(--ui-fg-strong);
}

/* Vertical divider between condition groups */
.toggle-divider {
  width: 1px;
  align-self: stretch;
  background: var(--ui-border-strong);
  margin: 0 4px;
}

.dashboard-toggle:hover {
  background: var(--ui-bg-alt);
}

.dashboard-toggle input[type="checkbox"] {
  width: auto;
  cursor: pointer;
}

.dashboard-toggle-label {
  font-family: 'Cinzel', serif;
  font-size: 0.75rem;
  color: var(--ui-fg);
}

.dashboard-toggle-warning {
  font-family: 'MedievalSharp', serif;
  font-size: 0.65rem;
  color: var(--ui-danger);
  font-weight: 600;
  visibility: hidden;
}

.dashboard-toggle input[type="checkbox"]:checked ~ .dashboard-toggle-warning {
  visibility: visible;
}

/* Weapon Summary */
.dashboard-weapons {
  margin-top: 6px;
  padding-top: 12px;
  border-top: 1px solid var(--ui-border);
}

.dashboard-weapons-label {
  font-family: 'Cinzel', serif;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ui-fg-strong);
  margin-bottom: 6px;
}

.dashboard-weapons-table {
  width: 100%;
  border-collapse: collapse;
}

.dashboard-weapons-table th {
  background: var(--ui-bg-alt);
  color: var(--ui-fg);
  font-family: 'Cinzel', serif;
  font-weight: 600;
  font-size: 0.7rem;
  letter-spacing: 0.06em;
  text-align: left;
  padding: 4px 8px;
  border-bottom: 1px solid var(--ui-border);
}

.dashboard-weapons-table td {
  color: var(--ui-fg);
  font-family: 'MedievalSharp', serif;
  font-size: 0.85rem;
  padding: 4px 8px;
  border-bottom: 1px solid var(--ui-border);
}

.dashboard-weapons-table tbody tr:hover td {
  background: var(--ui-bg-alt);
}

/* Two independent desktop columns */
.sheet-container {
  display: grid;
  grid-template-columns: minmax(320px, 620px) 1fr;
  align-items: start;
  gap: 20px;
}

.sheet-column {
  display: flex;
  flex-direction: column;
  gap: 20px;
  min-width: 0;
}

.stats-section-header,
.skills-section-header,
.equipment-section-header {
  margin-top: 0;
  margin-bottom: 0;
}

/* Pull the top Skills header closer to the Status panel */
.sheet-column-right .skills-section-header {
  margin-top: -8px;
}

/* Full-width sections spanning both grid columns */
.equipment-section-header,
.coin-purse-panel,
.equipment-grid,
#weaponsCatalogDetails {
  grid-column: 1 / -1;
}

.panel {
  background:
    linear-gradient(180deg, rgba(255,255,255,0.15) 0%, transparent 40%),
    var(--ui-bg);
  border: 1px solid var(--ui-border-strong);
  border-top: 3px solid var(--ui-border-strong);
  border-radius: 2px;
  padding: 20px;
  box-shadow:
    0 1px 3px rgba(0,0,0,0.06),
    inset 0 1px 0 rgba(255,255,255,0.4);
  position: relative;
}


/* Tables - flexible sizing */
.table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.table-wrap table {
  min-width: 0;
  width: 100%;
}

.sheet-container table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 16px;
  border: none;
}

.sheet-container th,
.sheet-container td {
  border: none;
  border-bottom: 1px solid var(--rule-color);
  padding: 9px 10px;
  vertical-align: middle;
}

/* Subtle vertical separators — faint, like pencil-ruled columns */
.sheet-container td + td,
.sheet-container th + th {
  border-left: 1px solid rgba(92, 64, 48, 0.1);
}

.sheet-container th {
  background: var(--ink);
  color: var(--parchment-dark);
  font-family: 'Uncial Antiqua', 'Cinzel', serif;
  font-weight: 600;
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  white-space: nowrap;
  border-bottom: 2px solid var(--ink);
  position: relative;
}


/* Column header dividers are slightly more visible */
.sheet-container th + th {
  border-left: 1px solid rgba(244, 228, 193, 0.15);
}

.sheet-container td {
  background: transparent;
}

/* Alternating row tint for readability — like faint ledger ruling */
.sheet-container tr:nth-child(even) td {
  background: rgba(232, 212, 168, 0.18);
}

.sheet-container tr:hover td {
  background: rgba(201, 162, 39, 0.12);
}

/* Heavier bottom rule on the last row */
.sheet-container tbody tr:last-child td {
  border-bottom: 2px solid var(--rule-heavy);
}

/* Skills Table */
.skills-category-table td:nth-child(1),
.skills-category-table th:nth-child(1) {
  /* Skill name - constrained via max-width */
  max-width: 20ch;
  white-space: normal;
  text-align: right;
}

.skills-category-table td:nth-child(2) {
  /* Stat column - optimized to minimum needed */
  width: 1px;
  white-space: nowrap;
  text-align: center;
  padding: 4px 2px;
}

.skills-category-table td:nth-child(2) .input-stat {
  font-size: 0.75rem;
  text-align: center;
  color: var(--ink-faint);
  min-width: 0;
  width: 5ch;
  padding: 4px 2px;
}

.skills-category-table td:nth-child(3),
.skills-category-table td:nth-child(4),
.skills-category-table td:nth-child(6) {
  /* Level, Total, Actions - shrink to fit */
  white-space: nowrap;
  text-align: center;
  width: 1px;
}

/* Skills Table Headers - match td widths */
.skills-category-table th:nth-child(2),
.skills-category-table th:nth-child(3),
.skills-category-table th:nth-child(4),
.skills-category-table th:nth-child(5),
.skills-category-table th:nth-child(6) {
  white-space: nowrap;
  text-align: center;
  width: 1px;
  padding: 9px 2px;
}

/* Skills Total — bold crimson accent */
.skills-category-table td:nth-child(4) strong {
  font-family: 'MedievalSharp', serif;
  font-size: 1.1rem;
  color: var(--accent);
  font-weight: 700;
}

/* Spell Energy / Spell Points — animated arcane shimmer */
@keyframes arcane-shimmer {
  0%   { background-position: 0% 50%; }
  50%  { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

.skills-category-table td:nth-child(4) strong.spell-energy-total {
  font-size: 1.3rem;
}

.skills-category-table td:nth-child(4) strong.spell-energy-total,
#current-spell-points,
#derived-spell-points-table {
  background: linear-gradient(270deg, #bfa7ff, #8d73f1, #6c4cfd, #624ec9, #9072e2);
  background-size: 300% 100%;
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  animation: arcane-shimmer 6s ease infinite;
  text-shadow:
    0 1px 1px rgba(0, 0, 0, 0.25),
    0 -1px 0 rgba(255, 255, 255, 0.2);
}

#current-spell-points {
  font-family: 'MedievalSharp', serif;
  font-size: 1.5rem;
  font-weight: 700;
  width: 3em;
  text-align: right;
  padding-right: 4px;
  min-width: 0;
  padding-left: 0;
}

.skills-category-table td:nth-child(5) {
  /* Pts column - as narrow as possible */
  white-space: nowrap;
  text-align: center;
  width: 1px;
  padding: 4px 2px;
}

.skills-category-table td:nth-child(5) .cost-input {
  width: 2.2em;
  min-width: 2.2em;
  font-size: 0.85rem;
  padding: 2px;
}

/* Stats Table */
#statsTable {
  table-layout: fixed;
}

#statsTable td:nth-child(1),
#statsTable th:nth-child(1) {
  /* Stat name */
  width: 14ch;
  text-align: right;
}

#statsTable td:nth-child(2),
#statsTable td:nth-child(3),
#statsTable td:nth-child(4),
#statsTable td:nth-child(5) {
  /* Base, Total, Cost, Actions - shrink to fit */
  white-space: nowrap;
  text-align: center;
  width: 3ch;
}

/* Stats Table Headers - match td widths */
#statsTable th:nth-child(2),
#statsTable th:nth-child(3),
#statsTable th:nth-child(4),
#statsTable th:nth-child(5) {
  white-space: nowrap;
  text-align: center;
  width: 3ch;
}

/* Actions column (5th) — collapse to minimum */
#statsTable th:nth-child(5),
#statsTable td:nth-child(5),
.skills-category-table th:nth-child(6),
.skills-category-table td:nth-child(6) {
  width: 1px;
  padding: 2px 2px;
  max-width: 30px;
}

#statsTable input[data-field="value"] {
  font-style: normal;
}

/* +/- Mod input — black ink */
#statsTable input[data-field="mod"] {
  color: var(--ink);
}

/* Total display with illuminated manuscript decorative dots */
.stat-total {
  font-family: 'MedievalSharp', serif;
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--accent);
  position: relative;
}

.stat-total::before {
  content: '·';
  color: var(--gold-dark);
  margin-right: 4px;
  font-size: 0.8em;
  opacity: 0.5;
}

.stat-total::after {
  content: '·';
  color: var(--gold-dark);
  margin-left: 4px;
  font-size: 0.8em;
  opacity: 0.5;
}

/* Drop cap images - extracting from inline styles */
.drop-cap-img {
  display: inline;
  vertical-align: text-bottom;
  margin-right: 0.1em;
  position: relative;
}

.drop-cap-img.drop-cap-large {
  height: 10em;
  top: 0.35em;
}

.drop-cap-img.drop-cap-medium {
  height: 7em;
  vertical-align: text-top;
  top: -0.5em;
  left: 0;
}

.drop-cap-img.drop-cap-small {
  height: 4em;
  top: 0.8em;
  margin-bottom: 1em;
}

/* Tablet layout (768px - 1024px) */
@media (max-width: 1024px) {
  .sheet-container {
    grid-template-columns: 1fr 1fr;
    gap: 12px;
  }

  .panel {
    padding: 14px;
  }

  .table-wrap table {
    min-width: 0;
  }

  /* Dashboard adjustments for tablets */
  .dashboard-grid {
    gap: 10px;
  }

  .dashboard-resource {
    padding: 8px 12px;
  }

  .dashboard-stat {
    min-width: 44px;
    padding: 4px 6px;
  }

  .dashboard-stat-label {
    font-size: 0.52rem;
  }

  .dashboard-stat-value {
    font-size: 0.95rem;
  }

  .dashboard-btn {
    padding: 3px 8px;
    font-size: 0.75rem;
    min-width: 36px;
  }

  .dashboard-btn-small {
    padding: 2px 6px;
    font-size: 0.7rem;
    min-width: 28px;
  }
}

/* Mobile layout (<768px) */
@media (max-width: 768px) {
  body {
    padding: 10px 8px;
    background-image: none;
    background-color: var(--parchment);
    font-size: 17px;
    line-height: 1.45;
  }

  /* Panel safety net */
  .panel,
  .character-dashboard,
  .coin-purse-panel {
    max-width: 100%;
  }

  /* Drop cap mobile sizes */
  .drop-cap-img.drop-cap-large {
    height: 5em;
    top: 0.2em;
  }

  .drop-cap-img.drop-cap-medium {
    height: 4em;
    top: -0.3em;
  }

  .drop-cap-img.drop-cap-small {
    height: 3em;
    top: 0.5em;
    margin-bottom: 0.5em;
  }

  /* Dashboard mobile layout */
  .character-dashboard {
    padding: 12px 10px;
  }

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

  .dashboard-grid {
    display: flex;
    flex-direction: column;
    gap: 12px;
  }

  .dashboard-resource-stack {
    display: flex;
    flex-direction: column;
    gap: 12px;
    width: 100%;
  }

  /* Reorder dashboard sections for small screens */
  .clock-panel { order: 1; }
  .status-buttons { order: 2; }
  .stances-panel { order: 3; }
  .dashboard-weapons { order: 4; width: 100%; }
  .grapple-panel { order: 5; }

  .dashboard-resource {
    width: 100%;
    padding: 8px 12px;
  }

  .dashboard-resource-controls {
    flex-wrap: wrap;
    justify-content: center;
  }

  .dashboard-input {
    font-size: 1.6rem;
    width: 4em;
  }

  .dashboard-btn {
    padding: 3px 10px;
    font-size: 0.86rem;
  }

  /* Tighten SP buttons on mobile */
  .dashboard-sp .dashboard-resource-controls {
    gap: 4px;
  }

  .dashboard-sp .dashboard-btn-small {
    padding: 3px 6px;
    font-size: 0.8rem;
    min-width: 28px;
  }

  .dashboard-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 6px;
    width: 100%;
  }

  .dashboard-stat {
    min-width: auto;
  }

  .dashboard-toggles {
    flex-direction: row;
    flex-wrap: wrap;
    justify-content: center;
    gap: 12px;
  }

  .status-buttons {
    width: 100%;
  }

  .status-btn {
    flex: 1 1 calc(50% - 6px);
    text-align: center;
    font-size: 0.82rem;
    padding: 6px 8px;
  }

  .clock-panel {
    flex-direction: row;
    align-items: flex-start;
    gap: 10px;
  }

  .clock-face-img {
    width: 170px;
    height: 170px;
  }

  .clock-controls {
    min-width: 0;
  }

  .clock-buttons {
    flex-direction: column;
    flex-wrap: nowrap;
    align-items: stretch;
    width: min(190px, 100%);
  }

  .clock-buttons .dashboard-btn {
    width: 100%;
    text-align: center;
  }

  .dashboard-stances {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
  }

  .stances-row {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
  }

  .stances-inline-label {
    text-align: left;
  }

  .stances-note {
    text-align: left;
  }

  .position-row {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
  }

  .position-buttons {
    width: 100%;
  }

  .stance-btn-group {
    width: 100%;
    justify-content: center;
  }

  .stance-btn {
    flex: 1 1 33%;
    text-align: center;
    font-size: 0.8rem;
  }

  .dashboard-retreat-btn {
    width: 100%;
    text-align: center;
    font-size: 0.8rem;
  }

  .dashboard-aggressive-parry-btn {
    width: 100%;
    text-align: center;
    font-size: 0.8rem;
  }

  .dashboard-resource-label {
    font-size: 0.82rem;
  }

  .hp-injury-controls {
    justify-content: flex-start;
  }

  .hp-injury-label {
    font-size: 0.84rem;
  }

  .hp-injury-controls .weapon-detail-input {
    font-size: 1rem;
  }

  .hp-injury-reason {
    flex: 1 1 9.5em;
    width: auto;
  }

  .active-wound-summary {
    padding-right: 22px;
  }

  .wound-history-main {
    flex-direction: column;
    align-items: flex-start;
    gap: 2px;
  }

  .wound-history-meta {
    font-size: 0.78rem;
  }

  .wound-history-effects {
    font-size: 0.9rem;
  }

  .dashboard-mini-dr-label {
    font-size: 0.78rem;
  }

  .dashboard-mini-dr-summary {
    font-size: 0.74rem;
  }

  .dashboard-side-stack {
    width: min(380px, 100%);
  }

  .dashboard-awareness-heading {
    font-size: 0.82rem;
  }

  .dashboard-awareness-base-value {
    font-size: 1.34rem;
  }

  .dashboard-awareness-name {
    font-size: 0.72rem;
  }

  .dashboard-awareness-value {
    font-size: 1.12rem;
  }

  .defense-stat-label {
    font-size: 0.68rem;
  }

  .defense-stat-value {
    font-size: 1.18rem;
  }

  .defense-stat-notes {
    font-size: 0.8rem;
  }

  .clock-section-label {
    font-size: 0.66rem;
  }

  .clock-recovery-label {
    font-size: 0.72rem;
  }

  .clock-recovery-value {
    font-size: 1rem;
  }

  input,
  select,
  textarea,
  button {
    font-size: 16px;
  }

  .dashboard-weapons {
    overflow-x: auto;
  }

  /* Equipment / weapons single column on mobile */
  .equipment-grid {
    grid-template-columns: 1fr;
    justify-items: center;
    gap: 16px;
  }

  #weaponsCatalog {
    grid-template-columns: 1fr;
    justify-items: center;
    gap: 16px;
  }

  .dashboard-weapons-table {
    font-size: 0.75rem;
    min-width: 0;
    width: 100%;
  }

  h1 {
    font-size: 1.3rem;
    margin-bottom: 16px;
    letter-spacing: 0.06em;
  }

  h1::after {
    left: 10%;
    right: 10%;
  }

  h2 {
    font-size: 0.9rem;
  }

  #pools {
    padding: 10px 4px;
  }

  #pools .flex-wrap {
    gap: 16px;
  }

  #pools label {
    font-size: 0.9rem;
  }

  #pools .pool-input {
    width: 70px;
    font-size: 1.4rem;
  }

  #controls {
    padding: 8px;
    gap: 4px;
  }

  .btn {
    --seal-w: 72px;
    --seal-h: 54px;
    width: auto;
    min-height: var(--seal-h);
    font-size: 0.72rem;
    letter-spacing: 0.6px;
    padding: 0 2px 0 0;
    gap: 0;
  }

  .btn:not(.inline-btn):not(.transaction-btn)::before {
    margin-right: -4px;
  }

  #controls input[type="file"] {
    font-size: 0.75rem;
    max-width: 120px;
  }

  .sheet-container {
    display: flex;
    flex-direction: column;
    gap: 12px;
  }

  .sheet-column {
    display: contents;
  }

  .stats-section-header { order: 1; }
  .stats-panel { order: 2; }
  .skills-section-header { order: 3; }
  .skills-grid { order: 4; }
  .wizard-skills-panel { order: 5; }
  .additional-skills-panel { order: 6; }
  .equipment-section-header { order: 7; }
  .coin-purse-panel { order: 8; }
  .equipment-grid { order: 9; }
  #weaponsCatalogDetails { order: 10; }

  .panel {
    padding: 12px 10px;
  }

  /* Table min-width override */
  .table-wrap table {
    min-width: 0;
  }

  .sheet-container th,
  .sheet-container td {
    padding: 7px 4px;
    font-size: 0.85rem;
  }

  .sheet-container th {
    font-size: 0.65rem;
    padding: 5px 3px;
  }

  .sheet-container input[type="text"],
  .sheet-container select {
    padding: 4px 6px;
    font-size: 0.9rem;
  }

  .sheet-container input[type="number"] {
    width: 2.8em;
    min-width: 2.8em;
    padding: 4px 2px;
    font-size: 0.9rem;
  }

  .sheet-container input[readonly][type="number"],
  .sheet-container .cost-input {
    width: 2.8em;
    min-width: 2.8em;
  }

  /* Weapons table scroll horizontally */
  .weapons-panel {
    overflow-x: auto;
  }

  .weapon-selector {
    flex-direction: column;
    align-items: center;
  }

  .weapon-selector select {
    min-width: 100%;
    max-width: 100%;
  }

  /* Skills grid: single column */
  .skills-grid {
    grid-template-columns: 1fr;
  }

  /* Equipment grid: single column */
  .equipment-grid {
    grid-template-columns: 1fr;
  }

  /* Center narrow card-style blocks on mobile */
  .panel,
  .coin-purse-panel,
  #weaponsCatalogDetails,
  .dashboard-side-stack,
  .dashboard-mini-dr,
  .armor-dr-panel,
  .dashboard-weapons,
  .defenses-panel {
    margin-left: auto;
    margin-right: auto;
  }

  .dashboard-mini-dr {
    align-self: center;
  }

  .weapon-cards-container {
    align-items: center;
  }

  .weapon-cards-container > .weapon-card,
  #weaponsCatalog > .weapon-card {
    width: min(680px, 100%);
    margin-left: auto;
    margin-right: auto;
  }

  /* Purses grid: single column */
  .purses-grid {
    grid-template-columns: 1fr;
  }

  .coin-purse-panel {
    margin-bottom: 0;
  }

  /* Weapons catalog: single column */
  #weaponsCatalog {
    grid-template-columns: 1fr;
  }

  /* Weapon card mobile adjustments */
  .weapon-combat-stats {
    grid-template-columns: 1fr 1fr 1fr;
    gap: 6px;
    padding: 10px;
  }

  .weapon-name-section {
    grid-column: 1 / -1;
    margin-bottom: 8px;
  }

  .combat-stat-label {
    font-size: 0.6rem;
  }

  .combat-stat-value {
    font-size: 1.1rem;
  }

  .weapon-details {
    grid-template-columns: repeat(2, 1fr);
  }

  .class-legend {
    flex-direction: column;
    gap: 8px;
  }

  .balance-layout {
    flex-direction: column;
    align-items: center;
    gap: 8px;
  }

  .balance-left {
    align-items: center;
    text-align: center;
  }

  .balance-right {
    align-items: center;
    text-align: center;
  }

  .balance-amount {
    font-size: 2.5rem;
  }

  .equiv-label-text {
    font-size: 0.7rem;
  }

  .balance-gold-suns {
    font-size: 1rem;
  }

  .transaction-controls {
    flex-direction: column;
    align-items: stretch;
  }

  .transaction-row {
    flex-direction: column;
    width: 100%;
  }

  .amount-input-group,
  .reason-input-group {
    min-width: 100%;
    width: 100%;
  }

  .transaction-btn {
    width: 100%;
  }

  /* Inline transaction inputs - wrap reason input */
  .inline-reason-input {
    min-width: 0;
    width: 100%;
    flex-basis: 100%;
  }

  .history-entry {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .history-date,
  .history-amount {
    font-size: 0.85rem;
  }
}

/* Inputs — quill-on-parchment feel */
.sheet-container input[type="text"],
.sheet-container select {
  width: 100%;
  min-width: 30px;
  padding: 6px 8px;
  border: none;
  border-bottom: 1px solid var(--rule-heavy);
  border-radius: 0;
  background: transparent;
  font-family: 'MedievalSharp', serif;
  font-size: 1rem;
  color: var(--ink);
  box-sizing: border-box;
  transition: border-color 0.2s ease, background 0.2s ease;
}

/* Skill name inputs - allow wrapping instead of clipping */
textarea.input-skill {
  min-width: 0;
  width: 100%;
  max-width: 20ch;
  font-family: 'Metamorphous', 'MedievalSharp', serif;
  font-size: 0.84rem;
  text-align: right;
  font-weight: 400;
  line-height: 1.2;
  min-height: calc(1.2em + 8px);
  padding: 4px 6px;
  border: none;
  border-bottom: 1px solid var(--rule-heavy);
  border-radius: 0;
  background: transparent;
  color: var(--ink);
  box-sizing: border-box;
  resize: none;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  overflow: hidden;
}

textarea[readonly].input-skill {
  background: transparent;
  border-bottom-color: transparent;
  color: var(--ink);
}

/* Stat / skill name display spans */
.stat-name, .skill-name {
  font-family: 'Metamorphous', 'MedievalSharp', serif;
  font-size: 0.84rem;
  font-weight: 400;
  text-align: right;
  display: inline-block;
}

.skill-stat {
  font-family: 'Metamorphous', 'MedievalSharp', serif;
  font-size: 0.75rem;
  color: var(--ink-faint);
  text-align: center;
  display: inline-block;
}

/* Inline modifier badge — appears next to stat name when mod != 0 */
.stat-mod-badge {
  display: inline-block;
  margin-left: 4px;
  padding: 1px 4px;
  border-radius: 2px;
  font-family: 'MedievalSharp', serif;
  font-size: 0.75rem;
  font-weight: 600;
  vertical-align: middle;
}

.stat-mod-badge.mod-positive {
  background: rgba(70, 120, 80, 0.25);
  color: #3a6b44;
}

.stat-mod-badge.mod-negative {
  background: rgba(140, 50, 50, 0.2);
  color: #8b2a2a;
}

/* Stat name inputs - narrower, 20% larger */
input.input-stat {
  min-width: 10px;
  font-family: 'Metamorphous', 'MedievalSharp', serif;
  font-size: 0.84rem;
  font-weight: 400;
  text-align: right;
}

.sheet-container input[type="number"] {
  width: 2.8em;
  min-width: 2.8em;
  padding: 6px 2px;
  border: none;
  border-bottom: 1px solid var(--rule-heavy);
  border-radius: 0;
  background: transparent;
  font-family: 'MedievalSharp', 'MedievalSharp', serif;
  font-size: 1rem;
  color: var(--ink);
  text-align: center;
  box-sizing: border-box;
  transition: border-color 0.2s ease, background 0.2s ease;
}

.sheet-container input:focus,
.sheet-container select:focus {
  outline: none;
  border-bottom-color: var(--gold);
  box-shadow: none;
  background: rgba(201, 162, 39, 0.06);
}

.sheet-container input[readonly] {
  background: transparent;
  border-bottom-color: transparent;
  color: var(--ink);
}

.sheet-container input[readonly][type="text"] {
  min-width: 30px;
}

.sheet-container input[readonly][type="number"],
.sheet-container .cost-input {
  width: 3.5em;
  min-width: 3.5em;
  text-align: center;
  font-family: 'MedievalSharp', serif;
  font-size: 0.85rem;
  font-weight: 400;
  color: #8a7565;
}

/* Section divider rows within tables — like an illuminated chapter heading */
.section-row td {
  background: rgba(44, 24, 16, 0.08) !important;
  color: var(--ink);
  font-family: 'Uncial Antiqua', 'Cinzel', serif;
  font-weight: 700;
  letter-spacing: 0.08em;
  font-size: 0.8rem;
  white-space: normal;
  overflow: visible;
  text-overflow: unset;
  border-bottom: 2px solid var(--rule-heavy);
  border-top: 2px solid var(--rule-heavy);
  position: relative;
  padding: 6px 10px;
}

/* Section row first cell gets a gold accent marker */
.section-row td:first-child {
  border-left: 3px solid var(--gold-dark);
}



/* Skills Grid - single column; overall page remains 2-column */
.skills-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 20px;
}

/* Equipment Grid - two column layout */
.equipment-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

/* Stack equipment on narrower viewports */
@media (max-width: 1100px) {
  .equipment-grid {
    grid-template-columns: 1fr;
    justify-items: center;
    gap: 16px;
  }

  .equipment-grid > * {
    width: min(720px, 100%);
  }

  #weaponsCatalog {
    grid-template-columns: 1fr;
    justify-items: center;
    gap: 16px;
  }
}

/* Skills panels inside grid don't span full width */
.skills-grid .skills-panel {
  grid-column: auto;
}

/* Weapons Section */
.weapons-panel {
  grid-column: 1 / -1;
}

/* Equipment sections inside grid don't span full width */
.equipment-grid .weapons-panel {
  grid-column: auto;
}

.weapon-selector {
  display: flex;
  gap: 12px;
  align-items: center;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.weapon-selector select {
  flex: 1;
  min-width: 200px;
  max-width: 350px;
  padding: 8px 10px;
  font-size: 0.95rem;
  border: 1px solid var(--rule-heavy);
  border-radius: 2px;
  background: var(--parchment);
}

.armor-dr-panel {
  margin: 12px 0 16px;
  border-top: 1px solid var(--rule-color);
  padding-top: 10px;
}

.armor-dr-panel .collapsible-summary {
  padding: 8px 0;
  font-size: 0.78rem;
}

.armor-dr-panel .collapsible-icon {
  font-family: 'Uncial Antiqua', 'Cinzel', serif;
  letter-spacing: 0.04em;
}

.armor-dr-chart-wrap {
  position: relative;
  width: min(360px, 100%);
  margin: 8px auto 10px;
  aspect-ratio: 2 / 3;
  border: 1px solid var(--rule-heavy);
  border-radius: 3px;
  background: linear-gradient(180deg, rgba(255, 250, 236, 0.9), rgba(235, 220, 190, 0.7));
  overflow: hidden;
}

.armor-dr-base {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  opacity: 0.82;
  filter: contrast(0.97) saturate(0.9);
}

.armor-dr-overlay {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.armor-dr-hotspot {
  cursor: pointer;
  fill: rgba(44, 24, 16, 0.08);
  stroke: rgba(44, 24, 16, 0.28);
  stroke-width: 4;
  transition: fill 0.16s ease, stroke 0.16s ease, stroke-width 0.16s ease;
}

.armor-dr-hotspot.is-covered {
  fill: rgba(38, 120, 70, 0.34);
  stroke: rgba(28, 92, 54, 0.78);
}

.armor-dr-hotspot.is-uncovered {
  fill: rgba(44, 24, 16, 0.07);
  stroke: rgba(44, 24, 16, 0.24);
}

.armor-dr-hotspot:hover {
  stroke-width: 5;
}

.armor-dr-hotspot[data-region$="_foot"] {
  stroke-width: 5;
  fill: rgba(44, 24, 16, 0.11);
}

.armor-dr-hotspot:focus {
  outline: none;
  stroke: var(--gold);
  stroke-width: 6;
}

.armor-dr-tooltip {
  position: absolute;
  z-index: 6;
  min-width: 170px;
  max-width: min(80vw, 320px);
  background: var(--ui-bg);
  color: var(--ui-fg);
  border: 1px solid var(--ui-border);
  border-radius: 4px;
  padding: 8px 10px;
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.35);
  pointer-events: none;
  font-family: 'Metamorphous', 'MedievalSharp', serif;
  font-size: 0.74rem;
  line-height: 1.35;
}

.armor-dr-tooltip[hidden] {
  display: none;
}

.armor-dr-tooltip-title {
  font-family: 'Uncial Antiqua', 'Cinzel', serif;
  font-size: 0.78rem;
  letter-spacing: 0.04em;
  color: var(--ui-accent);
  margin-bottom: 2px;
}

.armor-dr-tooltip-total {
  font-size: 0.76rem;
  margin-bottom: 4px;
  color: var(--ui-warning);
}

.armor-dr-tooltip-source {
  font-size: 0.7rem;
  color: var(--ui-fg);
}

.armor-dr-tooltip-empty {
  font-size: 0.7rem;
  color: var(--ui-fg-muted);
}

.armor-dr-legend {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 6px;
}

.armor-dr-legend-swatch {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 0.66rem;
  letter-spacing: 0.04em;
  font-family: 'Uncial Antiqua', 'Cinzel', serif;
  border: 1px solid transparent;
}

.armor-dr-legend-swatch.is-covered {
  background: rgba(38, 120, 70, 0.2);
  border-color: rgba(28, 92, 54, 0.45);
}

.armor-dr-legend-swatch.is-uncovered {
  background: rgba(44, 24, 16, 0.08);
  border-color: rgba(44, 24, 16, 0.25);
}

.armor-dr-unmapped-note {
  margin-top: 10px;
  padding: 8px 10px;
  border-left: 2px solid rgba(145, 50, 24, 0.78);
  background: rgba(145, 50, 24, 0.08);
  color: #6a2b15;
  font-size: 0.72rem;
  line-height: 1.35;
}

/* Weapon Cards Container */
.weapon-cards-container {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

@media (max-width: 600px) {
  .armor-dr-chart-wrap {
    width: min(320px, 100%);
  }

  .armor-dr-chart-mini {
    width: 100%;
  }

  .dashboard-mini-dr-summary {
    font-size: 0.74rem;
    white-space: nowrap;
  }

  .dashboard-mini-dr {
    width: 70%;
  }

  .dashboard-side-stack {
    width: min(340px, 94vw);
  }

  .armor-dr-tooltip {
    left: 8px !important;
    right: 8px !important;
    bottom: 8px !important;
    top: auto !important;
    max-width: none;
    min-width: 0;
  }
}

/* Full Table catalog can show 2 columns since it's full width */
#weaponsCatalog {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
}

.catalog-silver-value {
  color: #56c47b;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.catalog-price-grid-wrap {
  margin: 14px 0 18px;
  padding: 14px;
  border: 1px solid rgba(130, 100, 64, 0.5);
  border-top: 2px solid rgba(76, 165, 110, 0.65);
  border-radius: 4px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.16) 0%, rgba(255, 255, 255, 0) 46%),
    rgba(34, 24, 18, 0.8);
}

.catalog-price-grid-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.catalog-price-grid-title {
  color: #f3ddaf;
  font-family: 'Uncial Antiqua', 'Cinzel', serif;
  font-size: 0.84rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.catalog-price-grid-sub {
  color: #c2d6bc;
  font-size: 0.76rem;
}

.catalog-price-grid-table {
  display: grid;
  gap: 12px;
}

.catalog-price-grid-section {
  border: 1px solid rgba(151, 117, 74, 0.38);
  border-radius: 4px;
  background: rgba(0, 0, 0, 0.18);
  overflow: hidden;
}

.catalog-price-grid-section-title {
  margin: 0;
  padding: 8px 12px;
  color: #f5e6bf;
  background: rgba(170, 130, 64, 0.2);
  border-bottom: 1px solid rgba(151, 117, 74, 0.45);
  font-family: 'Uncial Antiqua', 'Cinzel', serif;
  font-size: 0.76rem;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

.catalog-price-grid-head-row,
.catalog-price-grid-row {
  display: grid;
  grid-template-columns: minmax(170px, 2fr) minmax(140px, 1.5fr) minmax(90px, 0.8fr) minmax(110px, 1fr);
  gap: 10px;
  align-items: center;
}

.catalog-price-grid-head-row {
  padding: 8px 12px 6px;
  border-bottom: 1px solid rgba(151, 117, 74, 0.35);
}

.catalog-price-grid-head-cell {
  color: #d4c6a1;
  font-size: 0.66rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.catalog-price-grid-head-cell:nth-child(3),
.catalog-price-grid-head-cell:nth-child(4) {
  text-align: right;
}

.catalog-price-grid-row {
  padding: 8px 12px;
  border-bottom: 1px solid rgba(151, 117, 74, 0.22);
}

.catalog-price-grid-row:last-child {
  border-bottom: none;
}

.catalog-price-grid-row:nth-child(odd) {
  background: rgba(255, 255, 255, 0.03);
}

.catalog-price-grid-cell {
  min-width: 0;
}

.catalog-price-grid-cell.name {
  color: #f6eddb;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.catalog-price-grid-cell.profile {
  color: #cdbd9c;
  font-size: 0.8rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.catalog-price-grid-cell.silver,
.catalog-price-grid-cell.euro {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.catalog-price-grid-cell.silver {
  color: #63d08b;
  font-weight: 700;
}

.catalog-price-grid-cell.euro {
  color: #ddd1b5;
}

@media (max-width: 760px) {
  .catalog-price-grid-head-row {
    display: none;
  }

  .catalog-price-grid-row {
    grid-template-columns: 1fr;
    gap: 4px;
    padding: 10px 12px;
  }

  .catalog-price-grid-cell {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 10px;
    white-space: normal;
  }

  .catalog-price-grid-cell::before {
    content: attr(data-label);
    color: #ccb992;
    font-size: 0.66rem;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    flex-shrink: 0;
  }

  .catalog-price-grid-cell.name::before,
  .catalog-price-grid-cell.profile::before {
    color: #d9c79f;
  }

  .catalog-price-grid-cell.name,
  .catalog-price-grid-cell.profile {
    white-space: normal;
    overflow: visible;
    text-overflow: clip;
  }

  .catalog-price-grid-cell.silver,
  .catalog-price-grid-cell.euro {
    text-align: left;
  }
}

.catalog-section-title {
  grid-column: 1 / -1;
  margin: 2px 0 -2px;
  padding: 6px 10px;
  border-top: 1px solid var(--rule-heavy);
  color: var(--ink);
  font-family: 'Uncial Antiqua', 'Cinzel', serif;
  font-size: 0.9rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.weapon-card {
  background: var(--ui-bg);
  border: 1px solid var(--ui-border-strong);
  border-top: 2px solid var(--ui-border-strong);
  border-radius: 2px;
  overflow: hidden;
}

/* Combat Stats - Top Section (most visible) */
.weapon-combat-stats {
  --ui-bg-elev: rgba(20, 12, 8, 0.92);
  --ui-fg-strong: var(--parchment);
  --ui-accent: var(--gold);
  --ui-success: #4ade80;
  --ui-danger: #f87171;
  display: grid;
  grid-template-columns: 2fr repeat(4, 1fr);
  gap: 8px;
  padding: 12px;
  background: var(--ui-bg-elev);
  color: var(--ui-fg-strong);
  align-items: center;
}

.weapon-name-section {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.weapon-combat-stats input.weapon-name-input {
  font-family: 'Metamorphous', 'Cinzel', serif;
  font-size: 0.77rem;
  font-weight: 400;
  background: transparent;
  border: 1px solid transparent;
  color: var(--parchment);
  padding: 4px 8px;
  border-radius: 4px;
  width: 100%;
}

.weapon-combat-stats input.weapon-name-input:hover,
.weapon-combat-stats input.weapon-name-input:focus {
  border-color: var(--gold);
  background: rgba(255,255,255,0.1);
  outline: none;
}

.weapon-combat-stats select.weapon-skill-select {
  font-size: 0.8rem;
  padding: 4px;
  background: rgba(255,255,255,0.1);
  border: 1px solid var(--gold-dark);
  color: var(--parchment);
  border-radius: 4px;
  width: 100%;
  border-bottom: 1px solid var(--gold-dark);
}

.weapon-combat-stats select.weapon-skill-select option {
  background: #2b1b12;
  color: var(--parchment);
}

.combat-stat {
  text-align: center;
}

.combat-stat-label {
  font-size: 0.65rem;
  opacity: 0.8;
  display: block;
}

.combat-stat-value {
  font-family: 'MedievalSharp', 'Cinzel', serif;
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--ui-accent);
}

.combat-stat-value.attack-score {
  color: var(--ui-success);
}

.combat-stat-value.damage {
  color: var(--ui-danger);
}

/* Weapon Details - Bottom Section (expandable) */
.weapon-details {
  padding: 12px;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 8px;
}

.weapon-detail {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.weapon-detail-label {
  font-size: 0.75rem;
  color: var(--ui-fg-muted);
}

.weapon-detail-input {
  padding: 4px 8px;
  font-size: 0.63rem;
  border: 1px solid var(--ui-border-strong);
  border-radius: 2px;
  background: var(--ui-input-bg);
  width: 100%;
  font-family: 'Metamorphous', 'MedievalSharp', serif;
  font-weight: 400;
  color: var(--ui-input-fg);
}

.weapon-detail-input:focus {
  border-color: var(--ui-accent);
  outline: none;
  background: var(--ui-bg-elev);
}

.weapon-detail-select {
  padding: 4px 8px;
  font-size: 0.9rem;
  border: 1px solid var(--ui-border-strong);
  border-radius: 2px;
  background: var(--ui-input-bg);
  color: var(--ui-input-fg);
}

/* Weapon Notes */
.weapon-notes {
  padding: 8px 12px;
  background: transparent;
  border-top: 1px solid var(--rule-color);
  font-size: 0.8rem;
  font-style: italic;
  color: var(--ink-faint);
}

/* Weapon Actions */
.weapon-actions {
  padding: 6px 12px;
  border-top: 1px solid var(--rule-color);
  display: flex;
  justify-content: flex-end;
}

.remove-btn {
  background: transparent;
  color: var(--accent);
  border: 1px solid var(--accent);
  border-radius: 2px;
  padding: 4px 10px;
  cursor: pointer;
  font-family: 'Uncial Antiqua', 'Cinzel', serif;
  font-size: 0.7rem;
  font-weight: 600;
  transition: all 0.2s;
  letter-spacing: 0.04em;
}

.remove-btn:hover {
  background: var(--accent);
  color: var(--parchment);
}

.no-weapons-message {
  text-align: center;
  padding: 24px;
  font-style: italic;
  color: var(--ink-light);
}

/* Weapon class badges */
.weapon-class {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 3px;
  font-size: 0.75rem;
  font-weight: 600;
}

.class-heavy {
  background: var(--accent);
  color: var(--parchment);
}

.class-balanced {
  background: var(--gold-dark);
  color: var(--parchment);
}

.class-nimble {
  background: #2e7d32;
  color: var(--parchment);
}

.class-special {
  background: #5c4030;
  color: var(--parchment);
}

/* Weapon Reference */
.weapon-reference {
  margin-top: 20px;
  border-top: 1px solid var(--rule-color);
  padding-top: 16px;
}

.weapon-reference summary {
  cursor: pointer;
  font-family: 'Uncial Antiqua', 'Cinzel', serif;
  font-weight: 600;
  font-size: 0.85rem;
  color: var(--ink-light);
  padding: 8px 0;
  letter-spacing: 0.04em;
  position: relative;
}

.weapon-reference summary:hover {
  color: var(--ink);
}


.class-legend {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  margin: 12px 0;
  padding: 10px 12px;
  background: rgba(44, 24, 16, 0.04);
  border-radius: 2px;
  border-left: 2px solid var(--ink-faint);
}

.class-legend div {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.9rem;
}

.notes-section {
  margin-top: 12px;
  padding: 0;
  background: transparent;
  border-left: 2px solid var(--ink-faint);
  font-size: 0.85rem;
  color: var(--ink-light);
  font-style: italic;
}

.notes-section summary {
  padding: 8px 12px;
  cursor: pointer;
  list-style: none;
  font-style: normal;
}

.notes-section summary::-webkit-details-marker {
  display: none;
}

.notes-section summary::before {
  content: '▸ ';
  color: var(--ink-faint);
  font-size: 0.8rem;
}

.notes-section[open] summary::before {
  content: '▾ ';
}

.notes-section h4 {
  margin: 0;
  font-family: 'Uncial Antiqua', 'Cinzel', serif;
  color: var(--accent);
}

.notes-section p,
.notes-section ol {
  padding-left: 12px;
  padding-right: 12px;
}

.notes-section ol {
  margin: 0 0 8px;
  padding-left: 32px;
}

.notes-section li {
  margin-bottom: 4px;
}

/* Derived Stats styling */
#derivedStatsTable td:first-child {
  font-weight: 600;
  text-align: right;
}

#derivedStatsTable span {
  font-family: 'MedievalSharp', serif;
  font-size: 1.1rem;
  color: var(--accent);
  font-weight: 600;
  position: relative;
}

/* Keep dots around derived stats */
#derivedStatsTable span::before {
  content: '·';
  color: var(--gold-dark);
  margin-right: 4px;
  opacity: 0.5;
}

#derivedStatsTable span::after {
  content: '·';
  color: var(--gold-dark);
  margin-left: 4px;
  opacity: 0.5;
}

#statusTable td:first-child {
  font-weight: 600;
}

#statusTable .status-value {
  font-family: 'MedievalSharp', serif;
  font-size: 1.1rem;
  color: var(--accent);
  font-weight: 600;
  position: relative;
}

/* Keep dots around status values */
#statusTable .status-value::before {
  content: '·';
  color: var(--gold-dark);
  margin-right: 4px;
  opacity: 0.5;
}

#statusTable .status-value::after {
  content: '·';
  color: var(--gold-dark);
  margin-left: 4px;
  opacity: 0.5;
}

#derivedStatsTable .hp-status,
#derivedStatsTable .hp-flag,
#statusTable .hp-status,
#statusTable .hp-flag {
  color: #ffffff;
}

/* Status Grid - 2 column layout for derived stats */
.status-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0;
  margin-top: 8px;
  margin-bottom: 16px;
  border: 1px solid var(--rule-color);
  border-radius: 2px;
}

.status-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 12px;
  border-bottom: 1px solid var(--rule-color);
  border-right: 1px solid var(--rule-color);
}

.status-item:nth-child(even) {
  border-right: none;
}

.status-item:nth-last-child(-n+2) {
  border-bottom: none;
}

/* If odd number of items, last one spans or has no right border */
.status-item:last-child:nth-child(odd) {
  border-right: none;
}

.status-label {
  font-family: 'Metamorphous', 'MedievalSharp', serif;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--ink);
}

.status-grid .status-value {
  font-family: 'MedievalSharp', serif;
  font-size: 1.1rem;
  color: var(--accent);
  font-weight: 600;
}

.status-grid .status-value::before {
  content: '·';
  color: var(--gold-dark);
  margin-right: 4px;
  opacity: 0.5;
}

.status-grid .status-value::after {
  content: '·';
  color: var(--gold-dark);
  margin-left: 4px;
  opacity: 0.5;
}

.status-toggle {
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
}

.status-toggle input[type="checkbox"] {
  width: auto;
  cursor: pointer;
}

#stunned-message,
#offbalance-message {
  display: inline-block;
  visibility: hidden;
  color: var(--accent);
}

/* Current HP */
.current-resource-row td:nth-child(2) {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: px;
}

#current-hp {
  width: 1em;
  font-family: 'MedievalSharp', serif;
  color: #fc5959;
  font-size: 1.5rem;
  font-weight: 700;
  text-align: right;
  padding-right: 4px;
  min-width: 2em;
  padding-left: 0;
}

#derived-hp {
  font-size: 1.35rem;
  font-weight: 800;
}

.resource-max-label {
  font-family: 'MedievalSharp', serif;
  font-size: 0.78rem;
  color: var(--ink-light);
  white-space: nowrap;
}

/* Quick adjustment buttons for HP/Mental Energy */
.resource-quick-btn {
  background: transparent;
  color: var(--ink);
  border: 1px solid var(--rule-heavy);
  border-radius: 2px;
  padding: 3px 10px;
  font-family: 'Uncial Antiqua', 'Cinzel', serif;
  font-weight: 700;
  font-size: 0.85rem;
  cursor: pointer;
  transition: all 0.2s ease;
  min-width: 32px;
}

.resource-quick-btn:hover {
  background: var(--ink);
  color: var(--parchment);
  border-color: var(--ink);
}

.resource-quick-btn:active {
  opacity: 0.8;
}

.hp-status {
  font-size: 0.95rem;
  padding: 2px 8px;
  border-radius: 4px;
  font-weight: 700;
  letter-spacing: 0.04em;
}

.hp-status.healthy {
  background: #5a7d66;
  color: white;
}

.hp-status.wounded {
  background: #f9a825;
  color: var(--ink);
}

.hp-status.critical {
  background: var(--accent);
  color: white;
}

.hp-status.down {
  background: #1a1a1a;
  color: white;
}

.hp-flag {
  font-size: 0.75rem;
  padding: 2px 6px;
  border-radius: 4px;
  font-weight: 700;
  letter-spacing: 0.03em;
  background: var(--ui-bg-elev);
  color: var(--ui-fg-strong);
  display: inline-block;
  visibility: hidden;
}

.hp-injury-controls {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 6px;
  flex-wrap: wrap;
  width: 100%;
  margin-top: 2px;
}

.hp-injury-label {
  font-family: 'Cinzel', serif;
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--ui-danger);
  opacity: 1;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.6);
}

.hp-injury-unit {
  font-family: 'Cinzel', serif;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ui-fg-muted);
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.45);
}

.hp-injury-controls .weapon-detail-input {
  font-size: 0.95rem;
  color: var(--ui-input-fg);
  -webkit-text-fill-color: var(--ui-input-fg);
  background: var(--ui-input-bg);
  border-color: var(--ui-border-strong);
  text-shadow: 0 1px 1px rgba(0, 0, 0, 0.35);
  caret-color: var(--ui-input-fg);
}

.hp-injury-controls .weapon-detail-select {
  color: var(--ui-input-fg);
  -webkit-text-fill-color: var(--ui-input-fg);
  background: var(--ui-input-bg);
  border-color: var(--ui-border-strong);
}

.hp-injury-controls .weapon-detail-input::placeholder {
  color: var(--ui-placeholder);
}

#hpInjuryAmount,
#hpInjuryReason {
  color: var(--ui-input-fg);
  -webkit-text-fill-color: var(--ui-input-fg);
  background: var(--ui-input-bg);
}

.hp-active-wounds-summary,
.hp-history-summary {
  color: var(--ui-warning);
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.45);
}

.hp-injury-amount {
  width: 4.4em;
  min-width: 4.4em;
  text-align: center;
  font-weight: 700;
}

.hp-injury-reason {
  width: auto;
  flex: 1 1 9.5em;
  min-width: 7.5em;
  font-weight: 600;
}

.hp-injury-controls #applyHpInjury {
  flex: 0 0 auto;
  white-space: nowrap;
}

.hp-history-details {
  width: 100%;
  margin-top: 4px;
  border-top: var(--ui-border);
  padding-top: 5px;
}

.hp-history-summary {
  list-style: none;
  cursor: pointer;
  font-family: 'Cinzel', serif;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ui-accent);
  opacity: 0.85;
  user-select: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.hp-history-summary::-webkit-details-marker {
  display: none;
}

.hp-history-summary::after {
  content: '▸';
  font-size: 0.75rem;
  color: var(--ui-accent);
}

.hp-history-details[open] .hp-history-summary::after {
  content: '▾';
}

.hp-history-entries {
  display: flex;
  flex-direction: column;
  gap: 5px;
  max-height: 170px;
  overflow-y: auto;
  margin-top: 6px;
  padding-right: 2px;
}

.hp-no-history {
  text-align: center;
  padding: 8px 4px;
  color: var(--ui-fg-muted);
  font-style: italic;
  font-family: 'Crimson Pro', serif;
  font-size: 0.9rem;
  opacity: 0.85;
}

.hp-history-entry {
  border-left:  2px solid var(--ui-danger);
  border-bottom:  1px solid var(--ui-border);
  background: var(--ui-bg-alt);
  padding: 5px 6px;
  display: grid;
  grid-template-columns: auto 1fr auto auto;
  gap: 6px;
  align-items: center;
}

.hp-history-date {
  font-family: 'Cinzel', serif;
  font-size: 0.74rem;
  color: var(--ui-fg);
  opacity: 0.9;
  white-space: nowrap;
}

.hp-history-reason input {
  width: 100%;
  background: transparent;
  border: none;
  border-bottom:  1px dashed var(--ui-border-strong);
  padding: 2px 4px;
  font-family: 'Crimson Pro', serif;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--ui-fg);
}

.hp-history-reason input:focus {
  outline: none;
  border-bottom-color: var(--ui-accent);
  background: var(--ui-bg-alt);
}

.hp-history-amount {
  font-family: 'Cinzel', serif;
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--ui-danger);
  white-space: nowrap;
}

.hp-history-remove {
  background: transparent;
  border:  1px solid var(--ui-border-strong);
  color: var(--ui-fg-muted);
  border-radius: 2px;
  padding: 2px 5px;
  cursor: pointer;
  font-size: 0.72rem;
  font-family: 'Uncial Antiqua', 'Cinzel', serif;
}

.hp-history-remove:hover {
  background: var(--ui-danger);
  color: var(--ui-fg-strong);
  border-color: var(--ui-danger);
}



/* Wounds UI */
.hp-active-wounds-details {
  width: 100%;
  margin-top: 4px;
  border-top: 1px solid var(--ui-border);
  padding-top: 5px;
}

.hp-active-wounds-summary {
  list-style: none;
  cursor: pointer;
  font-family: 'Cinzel', serif;
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ui-accent);
  user-select: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.hp-active-wounds-summary::-webkit-details-marker {
  display: none;
}

.hp-active-wounds-summary::after {
  content: '+';
  font-size: 0.78rem;
  color: var(--ui-accent);
}

.hp-active-wounds-details[open] .hp-active-wounds-summary::after {
  content: '-';
}

.hp-active-wounds-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: none;
  overflow: visible;
  margin-top: 6px;
  padding-right: 2px;
}

.active-wound-item {
  border: 1px solid var(--ui-border);
  background: var(--ui-bg-alt);
  border-radius: 3px;
  position: relative;
}

/* Improve readability for active wounds on the dark dashboard background */
.hp-active-wounds-list .hp-no-history {
  color: var(--ui-fg-muted);
  text-shadow: 0 1px 1px rgba(0, 0, 0, 0.45);
}

.active-wound-summary {
  padding: 6px 8px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  background: var(--ui-bg-elev);
  border-bottom: 1px solid var(--ui-border);
}

.active-wound-name {
  font-family: 'MedievalSharp', serif;
  font-size: 1.05rem;
  color: var(--ui-fg-strong);
}

.active-wound-meta {
  font-family: 'Cinzel', serif;
  font-size: 0.72rem;
  color: var(--ui-fg-muted);
  text-shadow: 0 1px 1px rgba(0, 0, 0, 0.45);
}

.active-wound-body {
  border-top: 1px solid var(--ui-border);
  padding: 8px;
  background: var(--ui-bg-elev);
}

.wound-duration-row {
  display: grid;
  grid-template-columns: auto 4.4em minmax(6.6em, auto);
  align-items: center;
  gap: 6px;
  margin-bottom: 8px;
}

.wound-duration-row .weapon-detail-label {
  margin: 0;
  white-space: nowrap;
}

.wound-duration-value {
  width: 4.4em;
  min-width: 4.4em;
  text-align: center;
  font-weight: 700;
}

.wound-duration-unit {
  min-width: 6.6em;
}

.active-wound-actions {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 8px;
}

.wound-penalties-header {
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 6px;
}

.wound-penalties-header .weapon-detail-label {
  margin-right: auto;
}

.wound-penalty-actions {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.wound-penalty-actions .wound-healed-btn {
  white-space: nowrap;
  padding: 4px 10px;
  font-size: 0.78rem;
}

.wound-modifiers-section {
  margin: 0;
  border-top-color: var(--ui-border-strong);
}

.wound-no-penalties-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 6px 0 2px;
}

.wound-no-penalties-row .equip-no-mods {
  margin: 0;
}

.wound-penalties-footer {
  display: flex;
  justify-content: center;
  margin-top: 6px;
}

.wound-add-mod-row {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.wound-add-mod-label {
  font-family: 'Cinzel', serif;
  font-size: 0.78rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--ui-fg-muted);
  text-shadow: 0 1px 1px rgba(0, 0, 0, 0.45);
  white-space: nowrap;
}

.active-wound-item .weapon-detail-label {
  color: var(--ui-fg);
  font-size: 0.82rem;
  letter-spacing: 0.03em;
  text-shadow: 0 1px 1px rgba(0, 0, 0, 0.5);
}

.active-wound-item .equip-no-mods {
  color: var(--ui-fg-muted);
  font-size: 0.9rem;
  opacity: 0.95;
}

.active-wound-item .wound-mod-target {
  color: var(--ui-input-fg);
  background: var(--ui-input-bg);
  border-color: var(--ui-border-strong);
  font-size: 0.9rem;
}

.active-wound-item .wound-mod-value {
  color: var(--ui-input-fg);
  background: var(--ui-input-bg);
  border-color: var(--ui-border-strong);
  font-size: 0.95rem;
  font-weight: 700;
  text-shadow: 0 1px 1px rgba(0, 0, 0, 0.35);
}

.active-wound-item .remove-wound-mod-btn {
  color: var(--ui-danger);
  border-color: var(--ui-danger);
}

.wound-mod-row .wound-mod-value {
  width: 3.5em;
  min-width: 3.5em;
  text-align: center;
}

.wound-mod-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 3.6em 2.2em;
  grid-auto-flow: column;
  gap: 6px;
  align-items: center;
  width: 100%;
}

.wound-mod-row .wound-mod-target {
  min-width: 0;
  width: 40ch;
  max-width: 40ch;
}

.wound-mod-row .wound-mod-value {
  min-width: 0;
}

.wound-mod-row .remove-wound-mod-btn {
  justify-self: end;
}

.wound-history-panel {
  margin-top: 16px;
}

.wound-history-entries {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 12px;
}

.wound-history-entry {
  border-left: 3px solid var(--ui-border-strong);
  border-bottom: 1px solid var(--ui-border);
  background: var(--ui-bg-alt);
  padding: 8px 10px;
}

.wound-history-entry.is-active {
  border-left-color: var(--ui-danger);
}

.wound-history-entry.is-healed {
  border-left-color: var(--ui-success);
  opacity: 0.88;
}

.wound-history-main {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 10px;
}

.wound-history-reason {
  font-family: 'MedievalSharp', serif;
  font-size: 1rem;
  color: var(--ui-fg);
}

.wound-history-amount {
  font-family: 'Cinzel', serif;
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--ui-danger);
  white-space: nowrap;
}

.wound-history-meta {
  margin-top: 2px;
  font-family: 'Cinzel', serif;
  font-size: 0.74rem;
  color: var(--ui-fg-muted);
}

.wound-history-effects {
  margin-top: 4px;
  font-family: 'Crimson Pro', serif;
  font-size: 0.95rem;
  color: var(--ui-fg);
}

.hp-active-wounds-details.wounds-alert .hp-active-wounds-summary,
#woundHistoryPanel.wounds-alert .collapsible-summary h2 {
  color: var(--ui-danger);
  text-shadow: 0 0 8px rgba(185, 28, 28, 0.35);
  animation: woundsPulse 1.2s ease-in-out infinite;
}

@keyframes woundsPulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.52; }
}

/* Collapsible summary */
.collapsible-summary {
  list-style: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

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

.collapsible-icon {
  font-family: 'Uncial Antiqua', 'Cinzel', serif;
  font-weight: 700;
  color: var(--ink-faint);
  font-size: 1rem;
  line-height: 1;
}

.collapsible-icon::after {
  content: '+';
}

details[open] .collapsible-icon::after {
  content: '-';
}

/* ============================================
   COIN PURSE - Merchant Ledger Aesthetic
   ============================================ */

.coin-purse-panel {
  margin-bottom: 0;
  background:
    linear-gradient(135deg, rgba(201, 162, 39, 0.06) 0%, transparent 40%),
    var(--parchment);
  border: 1px solid var(--rule-heavy);
  border-top: 3px solid var(--gold-dark);
  box-shadow:
    0 1px 3px rgba(0, 0, 0, 0.06),
    inset 0 1px 0 rgba(255, 255, 255, 0.4);
  position: relative;
}

.coin-purse-panel::before {
  content: '';
  position: absolute;
  top: 6px;
  left: 6px;
  right: 6px;
  bottom: 6px;
  border: 1px solid var(--gold);
  opacity: 0.15;
  pointer-events: none;
  border-radius: 1px;
}

.coin-purse-panel h2 {
  font-family: 'UnifrakturCook', 'UnifrakturMaguntia', 'Cinzel', serif;
  color: var(--gold-dark);
  text-shadow: 0 2px 4px rgba(201, 162, 39, 0.3);
  border-bottom: 1px solid var(--gold-dark);
  padding-bottom: 12px;
  margin-bottom: 20px;
  font-size: 1.8rem;
  letter-spacing: 0.02em;
  position: relative;
}


/* Purses Grid - Side by Side Layout */
.purses-grid {
  display: grid;
  grid-template-columns: 2fr 1fr;
  align-items: start;
  gap: 16px;
  margin-bottom: 16px;
}

/* Purse Container */
.purse-container {
  background: rgba(255, 255, 255, 0.15);
  border: 1px solid var(--rule-heavy);
  border-top: 2px solid var(--gold-dark);
  border-radius: 2px;
  padding: 16px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

.secondary-purse {
  background: rgba(232, 212, 168, 0.15);
  border-style: dashed;
  border-top-style: dashed;
  padding: 12px;
}

.purse-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.purse-label {
  font-family: 'UnifrakturCook', 'Cinzel', serif;
  font-size: 1rem;
  font-weight: 700;
  color: var(--ink-light);
  letter-spacing: 0.1em;
  position: relative;
}


/* Summon Creature — flat pill, arcane purple accent, no wax seal */
.btn-summon {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 16px;
  background: rgba(91, 45, 142, 0.18);
  border: 1px solid rgba(168, 85, 247, 0.4);
  border-radius: 4px;
  color: #c084fc;
  font-family: 'Cinzel', serif;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}

.btn-summon:hover {
  background: rgba(91, 45, 142, 0.32);
  border-color: rgba(168, 85, 247, 0.7);
  box-shadow: 0 0 10px rgba(168, 85, 247, 0.2);
}

.btn-summon:active {
  opacity: 0.85;
  transform: translateY(1px);
}

.btn-wizard-toggle {
  background: rgba(30, 80, 134, 0.18);
  border-color: rgba(96, 165, 250, 0.45);
  color: #bfdbfe;
}

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

.btn-wizard-toggle:hover {
  background: rgba(30, 80, 134, 0.32);
  border-color: rgba(147, 197, 253, 0.72);
  box-shadow: 0 0 10px rgba(96, 165, 250, 0.24);
}

@keyframes wizard-button-shimmer {
  0% { background-position: 0% 50%; }
  100% { background-position: 200% 50%; }
}

.btn-wizard-toggle.wizard-active {
  background: linear-gradient(
    115deg,
    rgba(32, 84, 171, 0.9) 0%,
    rgba(122, 73, 189, 0.9) 35%,
    rgba(44, 161, 121, 0.92) 55%,
    rgba(122, 73, 189, 0.9) 75%,
    rgba(32, 84, 171, 0.9) 100%
  );
  background-size: 220% 100%;
  animation: wizard-button-shimmer 2.3s linear infinite;
  border-color: rgba(167, 243, 208, 0.85);
  color: #e9fff8;
  box-shadow:
    0 0 12px rgba(45, 212, 191, 0.25),
    0 0 16px rgba(129, 140, 248, 0.2);
}

.wizard-skills-panel.wizard-hidden,
.wizard-only-panel.wizard-hidden {
  display: none !important;
}

/* Save to Server — compact inline style for the sync bar */
.sync-save-btn {
  background: rgba(201, 162, 39, 0.12);
  color: var(--gold) !important;
  border: 1px solid var(--gold-dark);
  border-radius: 4px;
  padding: 6px 14px !important;
  font-size: 0.8rem !important;
  letter-spacing: 0.06em;
  text-shadow: none;
  -webkit-text-stroke: 0;
  paint-order: normal;
  white-space: nowrap;
  cursor: pointer;
  user-select: none;
}

.sync-save-btn:hover {
  background: rgba(201, 162, 39, 0.22) !important;
  border-color: var(--gold);
}

/* Refresh roundel — circular button, no wax seal */
.btn-roundel {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: transparent;
  border: 2px solid var(--gold-dark);
  color: var(--gold);
  font-size: 1.3rem;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.2s ease, border-color 0.2s ease, transform 0.2s ease;
  box-shadow: 0 0 0 1px rgba(201, 162, 39, 0.12);
  flex-shrink: 0;
}

.btn-roundel:hover {
  background: rgba(201, 162, 39, 0.15);
  border-color: var(--gold);
  transform: rotate(30deg);
}

.btn-roundel:active {
  transform: rotate(180deg);
  transition: transform 0.15s ease;
}

.btn-icon {
  background: transparent;
  color: var(--ink);
  border: 1px solid var(--rule-heavy);
  border-radius: 2px;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 0.9rem;
  transition: all 0.2s ease;
  box-shadow: none;
}

.btn-icon:hover {
  background: var(--ink);
  color: var(--parchment);
  border-color: var(--ink);
}

.btn-icon:active {
  opacity: 0.8;
}

/* Balance Display */
.balance-display {
  padding: 16px 20px;
  background: transparent;
  border-radius: 2px;
  margin-bottom: 0;
  border: 1px solid transparent;
  border-bottom: 1px solid var(--rule-color);
  cursor: pointer;
  transition: all 0.2s ease;
}

.balance-display:hover {
  background: rgba(201, 162, 39, 0.06);
  border-color: var(--rule-color);
}

.balance-display:active {
  opacity: 0.9;
}

.balance-display.compact {
  padding: 12px;
  margin-bottom: 12px;
}

.balance-layout {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
}

.balance-left {
  display: flex;
  flex-direction: column;
  gap: 4px;
  align-items: flex-start;
}

.equiv-label-text {
  font-family: 'UnifrakturCook', 'MedievalSharp', serif;
  font-size: 0.75rem;
  font-style: italic;
  color: var(--ink-light);
  opacity: 0.6;
}

.balance-gold-suns {
  font-family: 'UnifrakturCook', 'MedievalSharp', serif;
  font-size: 1.1rem;
  color: var(--gold-dark);
  font-weight: 600;
}

.balance-right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
}

.balance-amount {
  font-family: 'MedievalSharp', 'Cinzel', serif;
  font-size: 3.5rem;
  font-weight: 700;
  background: linear-gradient(
    180deg,
    #a8a8a8 0%,
    #707070 25%,
    #888888 50%,
    #606060 75%,
    #999999 100%
  );
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  text-shadow:
    0 1px 0 rgba(255, 255, 255, 0.3),
    0 -1px 0 rgba(0, 0, 0, 0.4),
    1px 2px 3px rgba(0, 0, 0, 0.3),
    0 0 8px rgba(136, 136, 136, 0.2);
  line-height: 1;
  letter-spacing: -0.02em;
  filter: drop-shadow(0 2px 2px rgba(0, 0, 0, 0.2));
}

.compact .balance-amount {
  font-size: 2rem;
}

.currency-label {
  font-family: 'UnifrakturCook', 'MedievalSharp', serif;
  font-size: 1rem;
  font-weight: 600;
  color: var(--ink-light);
  letter-spacing: 0.1em;
  position: relative;
}


.compact .currency-label {
  font-size: 0.85rem;
}

.coin-purse-details {
  margin-top: 12px;
}

.primary-transaction-controls {
  margin-top: 12px;
  padding: 10px 0 2px;
  border-top: 1px solid rgba(0, 0, 0, 0.12);
}

.coin-purse-details[hidden] {
  display: none !important;
}

/* Currency Equivalents */
.currency-equivalents {
  overflow: visible;
  margin-top: 0;
  padding: 0 20px;
  margin-bottom: 16px;
  border-top: 1px solid rgba(0, 0, 0, 0.12);
  padding-top: 10px;
}

.currency-equivalents .transaction-controls {
  margin-top: 10px;
}

.equiv-single-line {
  font-family: 'MedievalSharp', serif;
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--ink);
  line-height: 1.6;
  padding: 10px 0;
  text-align: left;
}

/* Transaction Controls */
.transaction-controls {
  display: flex;
  gap: 12px;
  align-items: flex-end;
  flex-wrap: wrap;
}

.transaction-controls.compact {
  gap: 8px;
  flex-direction: column;
}

/* Transaction Line (Deposit/Withdraw sentence format) */
.transaction-line {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.transaction-label {
  font-family: 'UnifrakturCook', 'MedievalSharp', serif;
  font-size: 1rem;
  color: var(--ink-faint);
  letter-spacing: 0.02em;
  white-space: nowrap;
  text-shadow: none;
  font-weight: 400;
  font-style: italic;
}

.inline-amount-input {
  width: 70px;
  padding: 6px 8px;
  border: none;
  border-bottom: 2px solid var(--gold-dark);
  border-radius: 0;
  background: transparent;
  font-family: 'MedievalSharp', 'Cinzel', serif;
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--ink);
  text-align: center;
  transition: all 0.2s ease;
}

.inline-amount-input:focus {
  outline: none;
  border-bottom-color: var(--gold);
  box-shadow: none;
  background: rgba(201, 162, 39, 0.06);
}

.inline-reason-input {
  flex: 1;
  min-width: 120px;
  padding: 6px 8px;
  border: none;
  border-bottom: 1px solid var(--rule-heavy);
  border-radius: 0;
  background: transparent;
  font-family: 'UnifrakturCook', 'MedievalSharp', serif;
  font-size: 0.95rem;
  color: var(--ink);
  font-style: italic;
  transition: all 0.2s ease;
}

.inline-reason-input:focus {
  outline: none;
  border-bottom-color: var(--gold);
  box-shadow: none;
  background: rgba(201, 162, 39, 0.06);
  font-style: normal;
}

.inline-reason-input::placeholder {
  color: var(--ink-faint);
  opacity: 0.6;
}

/* Inline buttons override wax seal to be small rectangular pills */
.inline-btn {
  padding: 7px 14px;
  border-radius: 4px;
  font-family: 'Uncial Antiqua', 'Cinzel', serif;
  font-size: 0.8rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
  min-width: 50px;
  line-height: 1;
  letter-spacing: 0.04em;
  /* Override wax seal circle styles */
  background-image: none;
  width: auto;
  height: auto;
  white-space: nowrap;
  text-shadow: none;
  -webkit-text-stroke: 0;
  paint-order: normal;
}

.deposit-btn {
  background:
    linear-gradient(138deg, #6aad7a 0%, transparent 22%),
    linear-gradient(228deg, #2a5a3a 0%, transparent 22%),
    linear-gradient(175deg, #4a7d5a 0%, #2a5a3a 100%);
  color: #e8f0e6;
  text-shadow:
    0 1px 2px rgba(0, 0, 0, 0.6),
    0 0 6px rgba(90, 143, 106, 0.2);
  border: none;
}

.deposit-btn:hover {
  filter: brightness(1.15);
}

.withdraw-btn {
  background:
    linear-gradient(138deg, var(--wax-shine) 0%, transparent 22%),
    linear-gradient(228deg, #5a0000 0%, transparent 22%),
    linear-gradient(175deg, var(--accent) 0%, #5a0000 100%);
  color: #f0e0e0;
  text-shadow:
    0 1px 2px rgba(0, 0, 0, 0.6),
    0 0 6px rgba(139, 0, 0, 0.2);
  border: none;
}

.withdraw-btn:hover {
  filter: brightness(1.15);
}

.inline-btn:active {
  opacity: 0.9;
}

/* Small wax-seal circle button — used for "+" add-modifier in equipment */
.btn-seal-sm {
  width: 26px;
  min-height: 26px;
  height: 26px;
  border-radius: 50%;
  background: radial-gradient(circle at 38% 35%, var(--wax-shine) 0%, var(--wax-light) 25%, var(--wax-mid) 55%, var(--wax-deep) 100%) !important;
  color: var(--parchment);
  font-size: 1.05rem;
  font-weight: 700;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--wax-deep);
  padding: 0;
  box-shadow: 0 1px 3px rgba(0,0,0,0.3), inset 0 1px 0 rgba(255,255,255,0.15);
  text-shadow: 0 1px 2px rgba(0,0,0,0.5);
}

.btn.btn-seal-sm::before {
  display: none;
}

.btn-seal-sm:hover {
  filter: brightness(1.2);
  transform: translateY(-1px);
  box-shadow: 0 2px 5px rgba(0,0,0,0.35), inset 0 1px 0 rgba(255,255,255,0.2);
}

.transaction-row {
  display: flex;
  gap: 12px;
  flex: 1;
  align-items: flex-end;
  flex-wrap: wrap;
}

.transaction-row.compact {
  gap: 8px;
  width: 100%;
}

.amount-input-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 140px;
  flex: 0 1 auto;
}

.amount-input-group.compact {
  min-width: 100px;
  flex: 0 1 auto;
}

.reason-input-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 1;
  min-width: 200px;
}

.amount-label {
  font-family: 'UnifrakturCook', 'Cinzel', serif;
  font-size: 0.85rem;
  color: var(--ink-light);
  font-weight: 700;
  letter-spacing: 0.06em;
}

.amount-controls {
  display: flex;
  gap: 8px;
  align-items: stretch;
}

.amount-input {
  flex: 1;
  padding: 8px;
  border: none;
  border-bottom: 2px solid var(--gold-dark);
  border-radius: 0;
  background: transparent;
  font-family: 'MedievalSharp', 'Cinzel', serif;
  font-size: 1.3rem;
  font-weight: 600;
  color: var(--ink);
  text-align: center;
  transition: all 0.2s ease;
}

.amount-input.compact {
  padding: 6px;
  font-size: 1.1rem;
}

.amount-input:focus {
  outline: none;
  border-bottom-color: var(--gold);
  box-shadow: none;
  background: rgba(201, 162, 39, 0.06);
}

.reason-input {
  padding: 8px;
  border: none;
  border-bottom: 1px solid var(--rule-heavy);
  border-radius: 0;
  background: transparent;
  font-family: 'UnifrakturCook', 'MedievalSharp', serif;
  font-size: 1rem;
  color: var(--ink);
  transition: all 0.2s ease;
  font-style: italic;
}

.reason-input.compact {
  padding: 6px;
  font-size: 0.9rem;
}

.reason-input:focus {
  outline: none;
  border-bottom-color: var(--gold);
  box-shadow: none;
  background: rgba(201, 162, 39, 0.06);
  font-style: normal;
}

.reason-input::placeholder {
  color: var(--ink-faint);
  opacity: 0.6;
}

.amount-buttons {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.amount-btn {
  padding: 8px 16px;
  font-size: 1.5rem;
  line-height: 1;
  border-width: 2px;
  min-width: auto;
  font-weight: 700;
}

.amount-btn.small {
  padding: 6px 12px;
  font-size: 1.2rem;
}

.transaction-btn {
  /* Override wax seal circular styles */
  background-image: none;
  width: auto;
  height: auto;
  white-space: nowrap;
  text-shadow: none;
  -webkit-text-stroke: 0;
  paint-order: normal;
  min-width: 80px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 14px;
  font-size: 0.8rem;
  border-width: 1px;
  transition: all 0.2s ease;
}

.transaction-btn .btn-icon {
  font-size: 1rem;
  display: inline;
  background: none;
  border: none;
  width: auto;
  height: auto;
  box-shadow: none;
}

.history-btn {
  background: var(--gold-dark);
  border-color: var(--ink-light);
  color: var(--parchment);
}

.history-btn:hover {
  background: var(--ink-light);
  color: var(--parchment);
}

.transfer-btn {
  background: transparent;
  color: var(--ink);
  font-size: 1rem;
  border-color: var(--rule-heavy);
}

.transfer-btn:hover {
  background: var(--ink);
  color: var(--parchment);
}

/* Equipment Value Section */
.equipment-value-section {
  margin-top: 16px;
  padding: 12px 0;
  background: transparent;
  border-radius: 0;
  border: none;
  border-top: 1px solid var(--rule-color);
}

.equipment-value-btn:hover {
  filter: brightness(1.1);
}

.equipment-value-result {
  margin-top: 12px;
  padding: 10px 12px;
  background: rgba(201, 162, 39, 0.08);
  border-radius: 2px;
  border: 1px solid var(--gold-dark);
  border-left: 3px solid var(--gold);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  min-width: 0;
  animation: slideDown 0.3s ease;
}

@keyframes slideDown {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}


.value-label {
  font-family: 'UnifrakturCook', 'Cinzel', serif;
  font-size: 0.9rem;
  color: var(--ink);
  font-weight: 600;
  min-width: 0;
}

.value-amount {
  font-family: 'MedievalSharp', 'Cinzel', serif;
  font-size: clamp(1.05rem, 3.6vw, 1.5rem);
  font-weight: 700;
  color: var(--accent);
  min-width: 0;
  text-align: right;
  overflow-wrap: anywhere;
}

.shield-combat-stats .combat-stat {
  min-width: 0;
}

.shield-combat-stats .combat-stat-value {
  display: inline-block;
  min-width: 4ch;
  font-size: clamp(1rem, 3vw, 1.3rem);
}

.shield-combat-stats .shield-stat-value {
  min-width: 4ch;
}

.weapon-detail-input.shield-number-input {
  min-width: 4ch;
}

.weapon-detail-input.shield-cost-input {
  min-width: 6ch;
}

@media (max-width: 700px) {
  .equipment-value-result {
    flex-wrap: wrap;
  }

  .value-amount {
    width: 100%;
    text-align: left;
  }
}

/* Transaction History */
.transaction-history {
  margin-top: 20px;
  border-top: 2px solid var(--rule-heavy);
  padding-top: 16px;
  animation: slideDown 0.4s ease;
}

.history-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.history-header h3 {
  font-family: 'UnifrakturCook', 'Cinzel', serif;
  font-size: 1.1rem;
  color: var(--ink);
  margin: 0;
  letter-spacing: 0.08em;
  font-weight: 700;
  position: relative;
}


.close-history {
  background: transparent;
  color: var(--accent);
  border-color: var(--accent);
}

.close-history:hover {
  background: var(--accent);
  color: white;
}

.history-scroll {
  max-height: 400px;
  overflow-y: auto;
  padding-right: 8px;
  background: transparent;
  border-radius: 0;
}

.history-scroll::-webkit-scrollbar {
  width: 8px;
}

.history-scroll::-webkit-scrollbar-track {
  background: transparent;
}

.history-scroll::-webkit-scrollbar-thumb {
  background: var(--ink-faint);
  border-radius: 1px;
}

.history-scroll::-webkit-scrollbar-thumb:hover {
  background: var(--ink-light);
}

.history-entries {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.no-history {
  text-align: center;
  padding: 40px 20px;
  color: var(--ink-light);
  font-style: italic;
  font-family: 'MedievalSharp', serif;
}

.history-entry {
  background: transparent;
  border: none;
  border-bottom: 1px solid var(--rule-color);
  border-left: 3px solid var(--gold-dark);
  padding: 10px 12px;
  border-radius: 0;
  display: grid;
  grid-template-columns: auto 1fr auto auto;
  gap: 12px;
  align-items: center;
  transition: all 0.2s ease;
  box-shadow: none;
}

.history-entry:hover {
  background: rgba(201, 162, 39, 0.06);
  box-shadow: none;
  transform: none;
}

.history-entry.deposit {
  border-left-color: #4a7d5a;
}

.history-entry.withdraw {
  border-left-color: var(--accent);
}

.history-entry.transfer {
  border-left-color: var(--ink-faint);
}

.history-date {
  font-family: 'UnifrakturCook', 'MedievalSharp', serif;
  font-size: 0.75rem;
  color: var(--ink-light);
  white-space: nowrap;
}

.history-reason {
  font-family: 'UnifrakturCook', 'MedievalSharp', serif;
  font-size: 0.9rem;
  color: var(--ink);
}

.history-reason input {
  width: 100%;
  background: transparent;
  border: none;
  border-bottom: 1px dashed var(--ink-light);
  padding: 2px 4px;
  font-family: 'UnifrakturCook', 'MedievalSharp', serif;
  font-size: 0.9rem;
  color: var(--ink);
}

.history-reason input:focus {
  outline: none;
  border-bottom-color: var(--gold);
  background: rgba(201, 162, 39, 0.1);
}

.history-amount {
  font-family: 'MedievalSharp', 'Cinzel', serif;
  font-size: 1rem;
  font-weight: 600;
  white-space: nowrap;
}

.history-amount.positive {
  color: #22c55e;
}

.history-amount.negative {
  color: #ef4444;
}

.history-remove {
  background: transparent;
  border: 1px solid var(--rule-heavy);
  color: var(--ink-faint);
  border-radius: 2px;
  padding: 3px 6px;
  cursor: pointer;
  font-size: 0.7rem;
  transition: all 0.2s ease;
  font-family: 'Uncial Antiqua', 'Cinzel', serif;
  letter-spacing: 0.04em;
}

.history-remove:hover {
  background: var(--accent);
  color: white;
  border-color: var(--accent);
}

/* =====================================================
   WANDERING CREATURE EFFECT
   ===================================================== */

/* Creature container - fixed positioning for viewport coverage */
.creature-container {
  position: fixed;
  top: 50%;
  left: -800px;
  z-index: 9999;
  pointer-events: none;
  transform: translateY(-50%);
  transition: none;
}

.creature-container.creature-hidden {
  display: none;
}

/* Creature image styling */
.creature {
  width: 800px;
  height: auto;
  filter: drop-shadow(2px 2px 4px rgba(0, 0, 0, 0.3));
  transform: scaleX(-1); /* Flip to face right when entering from left */
}

/* Creature walking across screen */
.creature-container.walking {
  animation: walkAcross 8s linear forwards;
}

/* Creature fleeing when disturbed */
.creature-container.fleeing {
  animation: flee 0.35s ease-in forwards;
}

/* Animation: Walk from left to right across viewport */
@keyframes walkAcross {
  0% {
    left: -800px;
  }
  100% {
    left: 0;
  }
}

/* Animation: Flee quickly back to the left */
@keyframes flee {
  0% {
    transform: translateY(-50%) translateX(0) scale(1);
    opacity: 1;
  }
  100% {
    transform: translateY(-50%) translateX(-800px) scale(0.9);
    opacity: 0;
  }
}

/* =====================================================
   NOTABLE EQUIPMENT — MULTI-MODIFIER SYSTEM
   ===================================================== */

/* Active label in the dark header bar */
.equip-active-label {
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  white-space: nowrap;
  padding: 0 4px;
}

.equip-active-text {
  font-family: 'Cinzel', serif;
  font-size: 0.65rem;
  color: var(--parchment);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  opacity: 0.85;
}

/* Larger description textarea — auto-grows on input */
.equip-description {
  min-height: auto !important;
  font-size: 0.9rem !important;
  font-family: 'Crimson Pro', serif !important;
  overflow: hidden !important;
  resize: none !important;
}

/* Modifiers section */
.equip-modifiers-section {
  border-top: 1px solid var(--rule-heavy);
  padding-top: 10px;
  margin-top: 4px;
}

.equip-modifiers-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}

.equip-no-mods {
  font-family: 'Crimson Pro', serif;
  font-style: italic;
  color: var(--ui-fg-muted);
  font-size: 0.85rem;
}

/* Individual modifier row */
.equip-mod-row {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 6px;
  flex-wrap: wrap;
}

.equip-mod-row .equip-mod-target {
  flex: 1;
  min-width: 100px;
  font-size: 0.85rem;
}

.equip-mod-row .equip-mod-value {
  flex-shrink: 0;
}

.equip-mod-row .remove-equip-mod-btn {
  flex-shrink: 0;
  font-size: 0.7rem;
  padding: 2px 6px;
}

/* Powers panel */
.power-details {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.power-meta-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(120px, 1fr));
  gap: 8px;
}

.power-description {
  min-height: auto;
  font-size: 0.9rem;
  font-family: 'Crimson Pro', serif;
  overflow: hidden;
  resize: none;
}

@media (max-width: 700px) {
  .power-meta-row {
    grid-template-columns: 1fr;
  }
}

/* Dashboard section heading */
.dashboard-heading {
  font-family: 'MedievalSharp', serif;
  font-size: 1.05rem;
  font-weight: 400;
  color: var(--ui-fg);
  opacity: 0.88;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.45);
  letter-spacing: 0.12em;
  text-transform: none;
  border-bottom: none;
  margin: 0 0 12px;
  padding-bottom: 0;
}

/* ============================================
   CLOCK PANEL — Time Tracker
   ============================================ */

.clock-panel {
  display: flex;
  align-items: center;
  gap: 20px;
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--ui-border);
  grid-column: 1 / -1;
}

/* SVG clock face container */
.clock-face-wrap {
  flex-shrink: 0;
  position: relative;
  filter: drop-shadow(0 0 6px rgba(201, 162, 39, 0.15));
  transform: rotate(var(--clock-angle, 0deg));
  transform-origin: 50% 50%;
  will-change: transform;
  cursor: grab;
  touch-action: none;
}

.clock-face-wrap.clock-dragging {
  cursor: grabbing;
}

.clock-face-img {
  width: 180px;
  height: 180px;
  display: block;
  object-fit: contain;
  transition: filter 0.3s ease;
}

.clock-face-wrap:hover .clock-face-img {
  filter: brightness(1.1);
}

.clock-panel.clock-gm-owned .clock-face-wrap {
  filter: drop-shadow(0 0 10px rgba(79, 141, 218, 0.35));
}

/* Controls area to the right of the clock */
.clock-controls {
  display: flex;
  flex-direction: column;
  gap: 7px;
  flex: 1;
  min-width: 0;
}

/* "— Advance Time —" label */
.clock-section-label {
  font-family: 'Cinzel', serif;
  font-size: 0.58rem;
  letter-spacing: 0.14em;
  color: var(--ui-accent);
  opacity: 0.75;
  text-transform: uppercase;
}

/* Button row */
.clock-buttons {
  display: flex;
  align-items: center;
  gap: 5px;
  flex-wrap: wrap;
}

.clock-panel.clock-hide-advance .clock-section-label,
.clock-panel.clock-hide-advance .clock-buttons {
  display: none;
}

.clock-panel.clock-hide-advance .clock-controls {
  gap: 4px;
}

/* New Round — primary action, elevated gold border */
.clock-new-round-btn {
  border-color: var(--ui-accent);
  color: var(--ui-accent);
  font-size: 0.82rem;
  padding: 5px 14px;
  letter-spacing: 0.06em;
  position: relative;
}

.clock-new-round-btn::after {
  content: '';
  position: absolute;
  inset: -2px;
  border: 1px solid var(--ui-border);
  border-radius: 3px;
  pointer-events: none;
}

.clock-new-round-btn:hover {
  background: var(--ui-bg-alt);
  box-shadow: 0 0 8px rgba(201, 162, 39, 0.15);
}

/* Time increment buttons — muted parchment tone */
.clock-time-btn {
  color: var(--ui-fg) !important;
  border-color: var(--ui-border-strong) !important;
  opacity: 0.85;
  font-family: 'Cinzel', serif;
  font-size: 0.62rem;
  letter-spacing: 0.05em;
}

.clock-time-btn:hover {
  background: var(--ui-bg-alt);
  color: var(--ui-fg-strong) !important;
  border-color: var(--ui-accent) !important;
  opacity: 1;
  box-shadow: none;
}

.clock-world-row {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 7px;
  border-top: 1px solid var(--ui-border);
  padding-top: 6px;
  margin-top: 2px;
}

.clock-world-label {
  font-family: 'Cinzel', serif;
  font-size: 0.62rem;
  letter-spacing: 0.06em;
  color: var(--ui-fg-muted);
  opacity: 0.75;
  text-transform: uppercase;
}

.clock-world-time {
  font-family: 'Cinzel', serif;
  font-size: 0.74rem;
  letter-spacing: 0.03em;
  color: #e7dcc6;
  line-height: 1.35;
  white-space: normal;
}

.clock-world-time-emphasis {
  font-family: 'Uncial Antiqua', 'Cinzel', serif;
  font-size: 0.8rem;
  letter-spacing: 0.04em;
  color: #f4d878;
  text-shadow: 0 0 6px rgba(244, 216, 120, 0.28);
}

.clock-turn-complete-btn {
  font-family: 'Cinzel', serif;
  font-size: 0.64rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  border-color: rgba(79, 141, 218, 0.72);
  color: #d6e7ff;
  padding: 4px 8px;
}

.clock-turn-complete-btn.is-complete {
  border-color: rgba(142, 196, 122, 0.88);
  color: #e6ffd9;
  background: rgba(48, 92, 41, 0.25);
}

.clock-turn-complete-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.clock-turn-status {
  font-family: 'Crimson Pro', serif;
  font-size: 0.76rem;
  color: var(--ui-fg-muted);
  line-height: 1.2;
}

.clock-turn-status.is-complete {
  color: #a3d58a;
}

/* Recovery info line */
.clock-recovery-line {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 2px;
  padding-top: 6px;
  border-top: 1px solid var(--ui-border);
}

.clock-recovery-label {
  font-family: 'Cinzel', serif;
  font-size: 0.62rem;
  letter-spacing: 0.06em;
  color: var(--ui-fg-muted);
  opacity: 0.6;
  font-style: italic;
  white-space: nowrap;
}

.clock-panel.clock-gm-owned .clock-recovery-label::after {
  content: '  GM controls time';
  font-style: normal;
  letter-spacing: 0.05em;
  opacity: 0.9;
}

.clock-recovery-value {
  font-family: 'MedievalSharp', serif;
  font-size: 0.9rem;
  color: var(--ui-accent);
  opacity: 0.75;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.clock-recovery-status {
  font-family: 'MedievalSharp', serif;
  font-size: 0.9rem;
  color: var(--ui-accent);
  opacity: 0.85;
}

.clock-recovery-sub {
  font-family: 'Cinzel', serif;
  font-size: 0.6rem;
  letter-spacing: 0.06em;
  color: var(--ui-fg-muted);
  opacity: 0.6;
  text-transform: uppercase;
}

.clock-recovery-list {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  font-family: 'MedievalSharp', serif;
  font-size: 0.8rem;
  color: var(--ui-fg);
  opacity: 0.85;
}

@media (max-width: 600px) {
  .wound-mod-row {
    grid-template-columns: minmax(120px, 1fr) 4.2em auto;
  }

  .wound-duration-row {
    grid-template-columns: 1fr 4.2em minmax(6em, auto);
  }

  .wound-penalty-actions {
    width: 100%;
    justify-content: flex-end;
  }

  .primary-transaction-controls {
    padding: 10px 0 2px;
  }
}

/* Responsive: compact on narrow screens */
@media (max-width: 600px) {
  .clock-panel {
    gap: 12px;
  }

  .clock-face-img {
    width: 150px;
    height: 150px;
  }

  .clock-buttons {
    gap: 4px;
    width: min(170px, 100%);
  }
}

.sync-role-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 3px 8px;
  border: 1px solid rgba(201, 162, 39, 0.55);
  border-radius: 12px;
  font-family: 'Cinzel', serif;
  font-size: 0.7rem;
  letter-spacing: 0.04em;
  color: var(--parchment);
  background: rgba(0, 0, 0, 0.22);
  text-transform: uppercase;
}

.sync-connect-modal {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(20, 12, 8, 0.82);
  z-index: 2500;
  padding: 16px;
}

.sync-connect-modal.is-open {
  display: flex;
}

.sync-connect-card {
  width: min(420px, 100%);
  background: linear-gradient(180deg, rgba(45, 28, 16, 0.96), rgba(25, 14, 8, 0.96));
  border: 1px solid rgba(201, 162, 39, 0.45);
  border-radius: 8px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.45);
  color: var(--parchment);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.sync-connect-card h3 {
  margin: 0;
  color: var(--gold-shine);
  border-bottom: 1px solid rgba(201, 162, 39, 0.25);
  padding-bottom: 6px;
}

.sync-connect-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-family: 'Cinzel', serif;
  font-size: 0.8rem;
  letter-spacing: 0.03em;
}

.sync-connect-field input {
  width: 100%;
  border: 1px solid rgba(201, 162, 39, 0.4);
  border-radius: 4px;
  background: rgba(0, 0, 0, 0.34);
  color: var(--parchment);
  font-family: 'MedievalSharp', serif;
  font-size: 0.95rem;
  padding: 7px 8px;
}

.sync-connect-field input:focus {
  outline: none;
  border-color: var(--gold-shine);
}

.sync-connect-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.sync-connect-message {
  min-height: 1.2em;
  font-family: 'MedievalSharp', serif;
  font-size: 0.85rem;
  color: #f2dbc6;
}

.sync-connect-hint {
  font-family: 'MedievalSharp', serif;
  font-size: 0.78rem;
  color: #d7c29d;
  opacity: 0.9;
}

.gm-lock-overlay {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(10, 8, 6, 0.66);
  z-index: 1500;
  pointer-events: none;
}

.gm-lock-overlay.is-visible {
  display: flex;
}

.gm-lock-overlay-card {
  max-width: 460px;
  border: 1px solid rgba(206, 104, 104, 0.75);
  border-radius: 10px;
  background: rgba(37, 14, 14, 0.94);
  box-shadow: 0 16px 34px rgba(0, 0, 0, 0.45);
  color: #ffe3e3;
  text-align: center;
  padding: 18px 20px;
}

.gm-lock-overlay-card h2 {
  margin: 0 0 8px 0;
  font-family: 'Cinzel', serif;
  font-size: 1rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: #ffd8d8;
}

.gm-lock-overlay-card p {
  margin: 0;
  font-family: 'MedievalSharp', serif;
  font-size: 0.9rem;
  line-height: 1.35;
}

/* Player lock-state visuals: lighten locked controls without dimming whole panels */
[data-sync-lock-disabled="1"]:not(.sync-lock-toggle-visible):not(.sync-lock-hidden),
.sync-lock-disabled {
  color: rgba(217, 217, 217, 0.9) !important;
  border-color: rgba(170, 170, 170, 0.58) !important;
  background: rgba(95, 95, 95, 0.2) !important;
  text-shadow: none !important;
  opacity: 0.78 !important;
}

[data-sync-lock-disabled="1"]:not(.sync-lock-toggle-visible)::placeholder,
.sync-lock-disabled::placeholder {
  color: rgba(186, 186, 186, 0.75) !important;
}

.sync-lock-hidden {
  display: none !important;
}

.sync-lock-toggle-visible:disabled {
  opacity: 1 !important;
  cursor: default !important;
}

.dashboard-sp .dashboard-input[data-sync-lock-disabled="1"] {
  background: none !important;
  animation: none !important;
  -webkit-text-fill-color: rgba(196, 196, 196, 0.9) !important;
}

#current-hp[data-sync-lock-disabled="1"],
.dashboard-hp .dashboard-input.sync-lock-disabled {
  background: var(--ui-input-bg) !important;
  color: var(--ui-danger) !important;
  -webkit-text-fill-color: var(--ui-danger) !important;
  border-bottom-color: var(--ui-accent) !important;
  opacity: 1 !important;
}

.status-btn[data-sync-lock-disabled="1"]:not(.status-active):not(.sync-lock-toggle-visible),
.status-btn.sync-lock-disabled:not(.status-active) {
  background: rgba(90, 90, 90, 0.22) !important;
  border-color: rgba(174, 174, 174, 0.48) !important;
  color: rgba(214, 214, 214, 0.9) !important;
}

.status-btn.status-active[data-sync-lock-disabled="1"]:not(.sync-lock-toggle-visible),
.status-btn.status-active.sync-lock-disabled {
  opacity: 1 !important;
}

.sync-mode-player-in-game .hp-injury-controls {
  display: none !important;
}

.sync-lock-dimmed {
  filter: none;
}

/* ============================================
   YE OLDE MARKET STYLES
   ============================================ */

/* Mode toggle - hide character sheet when market is open */
body.market-mode #pools,
body.market-mode #controls,
body.market-mode .panel,
body.market-mode #file-controls,
body.market-mode #equipment-grid {
  display: none !important;
}

body.market-mode .market-panel {
  display: block !important;
}

/* Market Panel */
.market-panel {
  display: none;
  background: var(--ui-bg);
  border: 3px solid var(--ui-border-strong);
  border-top: 6px solid var(--gold);
  border-radius: 8px;
  padding: 20px;
  margin: 0 auto 20px auto;
  max-width: 1800px;
}

.market-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  padding-bottom: 16px;
  border-bottom: 2px solid var(--rule-heavy);
}

.market-header h1 {
  font-family: 'UnifrakturMaguntia', 'Cinzel', serif;
  font-size: 2.5rem;
  color: var(--gold);
  margin: 0;
  text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
}

/* Shop Status Notice */
.market-status-notice {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 20px;
  margin-bottom: 20px;
  background: var(--ui-bg-alt);
  border: 2px solid var(--ui-warning);
  border-left: 6px solid var(--ui-warning);
  border-radius: 6px;
}

.market-status-notice .status-icon {
  font-size: 1.5rem;
}

.market-status-notice .status-message {
  font-family: 'Crimson Pro', serif;
  font-size: 1rem;
  color: var(--ui-fg);
  flex: 1;
}

.market-status-notice.closed {
  border-color: var(--ui-danger);
  border-left-color: var(--ui-danger);
  background: rgba(239, 68, 68, 0.1);
}

.market-status-notice.purchases-disabled {
  border-color: var(--ui-warning);
  border-left-color: var(--ui-warning);
  background: rgba(249, 168, 37, 0.1);
}

/* Three-column layout */
.market-layout {
  display: grid;
  grid-template-columns: 1fr 1.2fr 400px;
  gap: 20px;
}

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

  .market-purchase-column {
    grid-column: 1 / -1;
  }
}

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

/* LEFT COLUMN: Catalog */
.market-catalog-column {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* Tabs */
.market-tabs {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  padding: 12px;
  background: var(--ui-bg-alt);
  border-radius: 6px;
  border: 1px solid var(--ui-border);
}

.market-tab {
  font-family: 'Cinzel', serif;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 8px 16px;
  border: 1px solid var(--ui-border);
  border-radius: 4px;
  background: transparent;
  color: var(--ui-fg-muted);
  cursor: pointer;
  transition: all 0.2s ease;
}

.market-tab:hover {
  color: var(--ui-fg);
  border-color: var(--gold-dark);
}

.market-tab.is-active {
  background: var(--gold);
  color: var(--ink);
  border-color: var(--gold);
  font-weight: 600;
}

.market-tab-panel {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.market-tab-panel[hidden] {
  display: none;
}

/* Filter bar */
.market-filter-bar {
  display: flex;
  gap: 12px;
  padding: 12px;
  background: var(--ui-bg-alt);
  border: 1px solid var(--ui-border);
  border-radius: 6px;
}

.market-filter-bar input[type="text"],
.market-filter-bar select {
  flex: 1;
  padding: 8px 12px;
  background: var(--ui-input-bg);
  border: none;
  border-bottom: 2px solid var(--ui-border);
  color: var(--ui-fg);
  font-family: 'Crimson Pro', serif;
  font-size: 0.95rem;
}

.market-filter-bar input[type="text"]:focus,
.market-filter-bar select:focus {
  outline: none;
  border-bottom-color: var(--gold);
}

/* Category headers */
.market-category-header {
  font-family: 'Cinzel', serif;
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--gold);
  margin-top: 16px;
  margin-bottom: 8px;
  padding-bottom: 6px;
  border-bottom: 2px solid var(--rule-color);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

/* Item grid */
.market-items-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
  max-height: 70vh;
  overflow-y: auto;
  padding: 12px;
  background: var(--ui-bg-alt);
  border-radius: 6px;
}

/* Equipment Set Card (Prominent) */
.market-set-card {
  background: linear-gradient(135deg, var(--ui-bg) 0%, var(--ui-bg-alt) 100%);
  border: 3px solid var(--gold-dark);
  border-top: 5px solid var(--gold);
  border-radius: 8px;
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  transition: all 0.3s ease;
  cursor: pointer;
  box-shadow: 0 4px 16px rgba(201, 162, 39, 0.15);
}

.market-set-card:hover {
  border-color: var(--gold);
  box-shadow: 0 8px 24px rgba(201, 162, 39, 0.35);
  transform: translateY(-3px);
}

.market-set-card .set-badge {
  position: absolute;
  top: -8px;
  right: 12px;
  background: var(--gold);
  color: var(--ink);
  padding: 4px 12px;
  border-radius: 12px;
  font-family: 'Cinzel', serif;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.market-set-card .set-description {
  font-family: 'Crimson Pro', serif;
  font-size: 0.9rem;
  color: var(--ui-fg-muted);
  font-style: italic;
  line-height: 1.4;
  padding: 8px 0;
  border-top: 1px solid var(--ui-border);
  border-bottom: 1px solid var(--ui-border);
}

.market-set-card .set-items-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 8px 12px;
  background: var(--ui-bg-alt);
  border-radius: 4px;
  max-height: 180px;
  overflow-y: auto;
}

.market-set-card .set-item-entry {
  font-family: 'Crimson Pro', serif;
  font-size: 0.85rem;
  color: var(--ui-fg);
  display: flex;
  align-items: center;
  gap: 8px;
}

.market-set-card .set-item-entry::before {
  content: '•';
  color: var(--gold);
  font-weight: bold;
}

.market-set-card .set-discount {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  background: var(--ui-success);
  color: white;
  border-radius: 4px;
  font-family: 'Cinzel', serif;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
}

.market-set-card .set-item-count {
  font-family: 'Cinzel', serif;
  font-size: 0.75rem;
  color: var(--ui-fg-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* Item card (Less prominent than sets) */
.market-item-card {
  background: var(--ui-bg);
  border: 2px solid var(--ui-border);
  border-top: 3px solid var(--ui-border-strong);
  border-radius: 4px;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  transition: all 0.2s ease;
  cursor: pointer;
}

.market-item-card:hover {
  border-color: var(--gold-dark);
  box-shadow: 0 4px 12px rgba(201, 162, 39, 0.2);
  transform: translateY(-2px);
}

.market-item-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 8px;
}

.market-item-name {
  font-family: 'Cinzel', serif;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--ui-fg-strong);
  margin: 0;
  flex: 1;
}

.weapon-class, .shield-size {
  font-family: 'Cinzel', serif;
  font-size: 0.7rem;
  text-transform: uppercase;
  padding: 3px 8px;
  border-radius: 3px;
  background: var(--ui-bg-alt);
  color: var(--ui-fg-muted);
  white-space: nowrap;
}

/* Weapon class colors */
.weapon-class.class-nimble {
  background: rgba(34, 197, 94, 0.2);
  color: #4ade80;
}

.weapon-class.class-balanced {
  background: rgba(59, 130, 246, 0.2);
  color: #60a5fa;
}

.weapon-class.class-heavy {
  background: rgba(239, 68, 68, 0.2);
  color: #f87171;
}

.weapon-class.class-special {
  background: rgba(168, 85, 247, 0.2);
  color: #c084fc;
}

/* Item stats */
.market-item-stats {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  padding: 8px 0;
  border-top: 1px solid var(--ui-border);
  border-bottom: 1px solid var(--ui-border);
}

.market-item-stats .stat {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.market-item-stats .stat .label {
  font-family: 'Cinzel', serif;
  font-size: 0.65rem;
  text-transform: uppercase;
  color: var(--ui-fg-muted);
  letter-spacing: 0.05em;
}

.market-item-stats .stat span:not(.label) {
  font-family: 'Crimson Pro', serif;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--ui-fg);
}

/* Item price */
.market-item-price {
  display: flex;
  flex-direction: column;
  gap: 2px;
  text-align: center;
  padding: 6px 0;
}

.market-item-price .price-silver {
  font-family: 'Cinzel', serif;
  font-size: 1rem;
  font-weight: 700;
  color: var(--gold);
}

.market-item-price .price-euro {
  font-family: 'Crimson Pro', serif;
  font-size: 0.75rem;
  color: var(--ui-fg-muted);
}

/* Select button */
.market-item-card .btn-select {
  font-family: 'Cinzel', serif;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 8px 12px;
  background: var(--gold-dark);
  color: var(--ink);
  border: none;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.2s ease;
  font-weight: 600;
}

.market-item-card .btn-select:hover {
  background: var(--gold);
  box-shadow: 0 2px 8px rgba(201, 162, 39, 0.4);
}

/* CENTER COLUMN: Dressing Room */
.market-dressing-room-column {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.dressing-room-header {
  text-align: center;
  padding: 16px;
  background: var(--ui-bg-alt);
  border: 2px solid var(--gold-dark);
  border-top: 4px solid var(--gold);
  border-radius: 6px;
}

.dressing-room-header h2 {
  font-family: 'Cinzel', serif;
  font-size: 1.5rem;
  color: var(--gold);
  margin: 0 0 6px 0;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.dressing-room-subtitle {
  font-family: 'Crimson Pro', serif;
  font-size: 0.9rem;
  color: var(--ui-fg-muted);
  margin: 0;
  font-style: italic;
}

.dressing-room-empty {
  text-align: center;
  padding: 60px 20px;
  background: var(--ui-bg-alt);
  border: 2px dashed var(--ui-border);
  border-radius: 6px;
}

.dressing-room-empty p {
  font-family: 'Crimson Pro', serif;
  font-size: 1rem;
  color: var(--ui-fg-muted);
  margin: 0;
  font-style: italic;
}

.dressing-room-card {
  background: var(--ui-bg);
  border: 2px solid var(--ui-border-strong);
  border-top: 3px solid var(--gold-dark);
  border-radius: 6px;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.dressing-room-card h3 {
  font-family: 'Cinzel', serif;
  font-size: 1.3rem;
  font-weight: 600;
  color: var(--ui-fg-strong);
  margin: 0;
  text-align: center;
  padding-bottom: 12px;
  border-bottom: 2px solid var(--ui-border);
}

.dressing-room-stats {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  padding: 12px 0;
}

.dressing-room-stats .stat-row {
  display: flex;
  justify-content: space-between;
  padding: 6px 8px;
  background: var(--ui-bg-alt);
  border-radius: 4px;
}

.dressing-room-stats .stat-row span:first-child {
  font-family: 'Cinzel', serif;
  font-size: 0.75rem;
  text-transform: uppercase;
  color: var(--ui-fg-muted);
  letter-spacing: 0.05em;
}

.dressing-room-stats .stat-row span:last-child {
  font-family: 'Crimson Pro', serif;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--ui-fg);
}

.dressing-room-actions {
  display: flex;
  gap: 12px;
  padding: 12px 0;
}

.dressing-room-actions button {
  flex: 1;
  font-family: 'Cinzel', serif;
  font-size: 0.9rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 12px 16px;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.2s ease;
  font-weight: 600;
  border: 2px solid;
}

.btn-try-on {
  background: var(--gold);
  color: var(--ink);
  border-color: var(--gold);
}

.btn-try-on:hover {
  background: var(--gold-shine);
  box-shadow: 0 4px 12px rgba(201, 162, 39, 0.4);
}

.btn-remove {
  background: transparent;
  color: var(--accent);
  border-color: var(--accent);
}

.btn-remove:hover {
  background: var(--accent);
  color: var(--parchment);
}

/* Damage preview */
.dressing-room-preview {
  padding: 16px;
  background: var(--ui-bg-alt);
  border: 2px solid var(--ui-border-strong);
  border-top: 3px solid var(--accent);
  border-radius: 6px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.dressing-room-preview h4 {
  font-family: 'Cinzel', serif;
  font-size: 1rem;
  text-transform: uppercase;
  color: var(--accent);
  margin: 0;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--ui-border);
  letter-spacing: 0.08em;
}

.damage-test-input label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-family: 'Cinzel', serif;
  font-size: 0.75rem;
  text-transform: uppercase;
  color: var(--ui-fg-muted);
}

.damage-test-input input {
  padding: 8px;
  background: var(--ui-input-bg);
  border: none;
  border-bottom: 2px solid var(--ui-border);
  color: var(--ui-fg);
  font-family: 'Crimson Pro', serif;
  font-size: 1rem;
}

.damage-test-input input:focus {
  outline: none;
  border-bottom-color: var(--gold);
}

.damage-calculation-result {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 12px;
  background: var(--ui-bg);
  border-radius: 4px;
}

.damage-calc-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 0;
}

.damage-calc-row.final {
  border-top: 2px solid var(--ui-border-strong);
  margin-top: 4px;
  padding-top: 10px;
  font-weight: 700;
}

.damage-calc-row span:first-child {
  font-family: 'Cinzel', serif;
  font-size: 0.8rem;
  color: var(--ui-fg-muted);
  text-transform: uppercase;
}

.damage-calc-row span:last-child {
  font-family: 'Crimson Pro', serif;
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--ui-fg);
}

.damage-calc-row.final span:last-child {
  color: var(--accent);
  font-size: 1.3rem;
}

.armor-coverage-display {
  padding: 12px;
  background: var(--ui-bg);
  border-radius: 4px;
  text-align: center;
}

.coverage-summary {
  font-family: 'Crimson Pro', serif;
  font-size: 0.9rem;
  color: var(--ui-fg-muted);
  font-style: italic;
}

/* RIGHT COLUMN: Purchase */
.market-purchase-column {
  display: flex;
  flex-direction: column;
  gap: 16px;
  position: sticky;
  top: 20px;
  align-self: flex-start;
  max-height: calc(100vh - 40px);
  overflow-y: auto;
}

.market-purse-summary {
  background: var(--ui-bg-alt);
  border: 2px solid var(--gold-dark);
  border-top: 4px solid var(--gold);
  border-radius: 6px;
  padding: 16px;
  text-align: center;
}

.market-purse-summary h3 {
  font-family: 'Cinzel', serif;
  font-size: 0.85rem;
  text-transform: uppercase;
  color: var(--ui-fg-muted);
  margin: 0 0 8px 0;
  letter-spacing: 0.08em;
}

.market-purse-display {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.purse-amount {
  font-family: 'UnifrakturMaguntia', 'Cinzel', serif;
  font-size: 2rem;
  font-weight: 700;
  color: var(--gold);
  text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.2);
}

.purse-label {
  font-family: 'Crimson Pro', serif;
  font-size: 0.85rem;
  color: var(--ui-fg-muted);
}

.market-purchase-card {
  background: var(--ui-bg);
  border: 2px solid var(--ui-border-strong);
  border-top: 3px solid var(--gold-dark);
  border-radius: 6px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.market-purchase-card h3 {
  font-family: 'Cinzel', serif;
  font-size: 1rem;
  text-transform: uppercase;
  color: var(--gold);
  margin: 0;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--ui-border);
  letter-spacing: 0.08em;
}

.purchase-item-name {
  font-family: 'Cinzel', serif;
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--ui-fg-strong);
  text-align: center;
  padding: 8px 0;
}

.purchase-price-display {
  text-align: center;
  padding: 12px;
  background: var(--ui-bg-alt);
  border-radius: 4px;
}

.purchase-price-display .price-silver {
  font-family: 'Cinzel', serif;
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--gold);
}

.purchase-price-display .price-euro {
  font-family: 'Crimson Pro', serif;
  font-size: 0.85rem;
  color: var(--ui-fg-muted);
  margin-top: 4px;
}

.btn-buy {
  font-family: 'Cinzel', serif;
  font-size: 0.95rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 14px 20px;
  background: var(--gold);
  color: var(--ink);
  border: 2px solid var(--gold);
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.2s ease;
  font-weight: 600;
}

.btn-buy:hover:not(:disabled) {
  background: var(--gold-shine);
  box-shadow: 0 4px 12px rgba(201, 162, 39, 0.4);
}

.btn-buy:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.market-tips {
  padding: 16px;
  background: var(--ui-bg-alt);
  border: 1px solid var(--ui-border);
  border-radius: 6px;
}

.market-tips h4 {
  font-family: 'Cinzel', serif;
  font-size: 0.85rem;
  text-transform: uppercase;
  color: var(--ui-fg-muted);
  margin: 0 0 10px 0;
  letter-spacing: 0.08em;
}

.market-tips ul {
  margin: 0;
  padding-left: 20px;
}

.market-tips li {
  font-family: 'Crimson Pro', serif;
  font-size: 0.85rem;
  color: var(--ui-fg-muted);
  line-height: 1.5;
  margin-bottom: 6px;
}

/* Equipment section market links */
.equipment-market-link {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 12px;
  margin: 12px 0;
  flex-wrap: wrap;
}

.btn-market-link {
  font-family: 'Cinzel', serif;
  font-size: 0.9rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 12px 24px;
  background: linear-gradient(135deg, var(--gold-dark) 0%, var(--gold) 100%);
  color: var(--ink);
  border: 2px solid var(--gold);
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.3s ease;
  font-weight: 600;
  box-shadow: 0 4px 12px rgba(201, 162, 39, 0.3);
}

.btn-market-link:hover {
  background: linear-gradient(135deg, var(--gold) 0%, var(--gold-shine) 100%);
  box-shadow: 0 6px 20px rgba(201, 162, 39, 0.5);
  transform: translateY(-2px);
}

/* Scrollbar styling for market */
.market-items-grid::-webkit-scrollbar,
.market-purchase-column::-webkit-scrollbar {
  width: 8px;
}

.market-items-grid::-webkit-scrollbar-track,
.market-purchase-column::-webkit-scrollbar-track {
  background: var(--ui-bg-alt);
  border-radius: 4px;
}

.market-items-grid::-webkit-scrollbar-thumb,
.market-purchase-column::-webkit-scrollbar-thumb {
  background: var(--gold-dark);
  border-radius: 4px;
}

.market-items-grid::-webkit-scrollbar-thumb:hover,
.market-purchase-column::-webkit-scrollbar-thumb:hover {
  background: var(--gold);
}

.market-simple-layout {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.market-simple-topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 12px;
  background: var(--ui-bg-alt);
  border: 1px solid var(--ui-border);
  border-radius: 6px;
}

.market-simple-purse {
  font-family: 'Cinzel', serif;
  font-size: 0.92rem;
  color: var(--ui-fg);
}

.market-simple-purse strong {
  color: var(--gold);
}

.market-action-feedback {
  min-height: 1.2em;
  font-family: 'Crimson Pro', serif;
  font-size: 0.92rem;
  color: var(--ui-success);
}

.market-action-feedback.is-error {
  color: var(--ui-danger);
}

.market-collapsible {
  border: 1px solid var(--ui-border);
  border-radius: 6px;
  background: var(--ui-bg-alt);
  overflow: hidden;
}

.market-collapsible > summary {
  cursor: pointer;
  list-style: none;
  padding: 10px 14px;
  font-family: 'Cinzel', serif;
  font-size: 0.92rem;
  color: var(--gold);
  text-transform: uppercase;
  letter-spacing: 0.07em;
  background: rgba(0, 0, 0, 0.12);
}

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

.market-section-controls {
  padding: 10px 12px 0 12px;
}

.market-section-controls input[type="text"] {
  width: 100%;
  padding: 8px 10px;
  background: var(--ui-input-bg);
  border: none;
  border-bottom: 2px solid var(--ui-border);
  color: var(--ui-fg);
  font-family: 'Crimson Pro', serif;
  font-size: 0.92rem;
}

.market-section-controls input[type="text"]:focus {
  outline: none;
  border-bottom-color: var(--gold);
}

.market-table-wrap {
  padding: 10px 12px 12px 12px;
  overflow-x: auto;
}

.market-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 680px;
  background: var(--ui-bg);
  border: 1px solid var(--ui-border);
}

.market-table th,
.market-table td {
  padding: 8px 10px;
  border-bottom: 1px solid var(--ui-border);
  vertical-align: top;
  text-align: left;
}

.market-table th {
  font-family: 'Cinzel', serif;
  font-size: 0.72rem;
  color: var(--ui-fg-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  background: rgba(0, 0, 0, 0.14);
}

.market-table td {
  font-family: 'Crimson Pro', serif;
  font-size: 0.92rem;
  color: var(--ui-fg);
}

.market-table .market-equip-btn {
  padding: 6px 10px;
  font-size: 0.74rem;
  letter-spacing: 0.06em;
}

.weapon-wound-type-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 6px;
}

.weapon-wound-type-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid rgba(201, 162, 39, 0.28);
  border-radius: 6px;
  padding: 4px 6px;
  background: rgba(0, 0, 0, 0.1);
  font-size: 0.78rem;
}

.armor-type-multiplier-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 8px;
}

.armor-type-multiplier-chip {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 8px;
  border: 1px solid rgba(201, 162, 39, 0.25);
  border-radius: 6px;
  padding: 6px 8px;
  background: rgba(0, 0, 0, 0.1);
  font-size: 0.78rem;
}

.armor-type-multiplier-input {
  min-width: 70px;
  text-align: right;
}


