/* SAGE Legend - Mysticaria Editor styles. Phase 3 (Rome 2026-05-15).
   Matches the gear-UI visual language (dark surfaces, gold/cream
   accents on the mundane axis, violet/lavender on the magic axis). */

.me-root {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 14px;
  background: rgba(0, 0, 0, 0.30);
  border: 1px solid rgba(180, 160, 240, 0.35);
  border-radius: 8px;
  color: rgba(232, 220, 200, 0.95);
  font-size: 0.9rem;
}
.me-mode-modal {
  /* Used when mounted inside a modal — no outer border (modal provides it). */
  border: none;
  background: transparent;
  padding: 0;
}

/* --- Header --- */
.me-header {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding-bottom: 8px;
  border-bottom: 1px dashed rgba(180, 160, 240, 0.25);
}
.me-header-title {
  font-size: 1.05rem;
  font-weight: 600;
  color: rgba(232, 220, 250, 0.98);
}
.me-header-class {
  display: inline-block;
  margin-left: 8px;
  padding: 1px 7px;
  background: rgba(180, 160, 240, 0.15);
  border: 1px solid rgba(180, 160, 240, 0.40);
  border-radius: 10px;
  font-size: 0.7rem;
  font-weight: 500;
  color: rgba(220, 210, 250, 0.85);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  vertical-align: middle;
}
.me-header-base {
  font-size: 0.78rem;
  color: rgba(200, 190, 170, 0.65);
  font-family: var(--font-mono, ui-monospace, monospace);
}

/* --- Live readout --- */
.me-readout {
  padding: 10px 12px;
  background: rgba(0, 0, 0, 0.30);
  border-radius: 6px;
  border-left: 3px solid rgba(180, 160, 240, 0.55);
}
.me-readout.band-trivial       { border-left-color: rgba(140, 200, 200, 0.65); }
.me-readout.band-bind-or-spend { border-left-color: rgba(212, 175, 55,  0.75); }
.me-readout.band-bind-or-relic { border-left-color: rgba(220, 100, 120, 0.75); }
.me-readout.band-empty         { border-left-color: rgba(160, 160, 160, 0.35); }

.me-readout-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 18px;
  align-items: baseline;
  margin-bottom: 8px;
}
.me-stat {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
}
.me-stat-label {
  font-size: 0.68rem;
  color: rgba(200, 190, 170, 0.65);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.me-stat-val {
  font-size: 1.1rem;
  font-weight: 600;
  color: rgba(232, 220, 250, 0.98);
  font-family: var(--font-mono, ui-monospace, monospace);
}

.me-band-badge {
  margin-left: auto;
  padding: 3px 10px;
  border-radius: 12px;
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}
.me-band-badge.band-trivial       { background: rgba(140, 200, 200, 0.18); color: #b8e0e0; border: 1px solid rgba(140, 200, 200, 0.5); }
.me-band-badge.band-bind-or-spend { background: rgba(212, 175, 55,  0.20); color: #e8c878; border: 1px solid rgba(212, 175, 55,  0.55); }
.me-band-badge.band-bind-or-relic { background: rgba(220, 100, 120, 0.20); color: #f0b8c0; border: 1px solid rgba(220, 100, 120, 0.55); }
.me-band-badge.band-empty         { background: rgba(160, 160, 160, 0.15); color: rgba(200, 190, 170, 0.6); border: 1px solid rgba(160, 160, 160, 0.35); }

.me-readout-activation {
  margin-top: 6px;
  padding: 6px 0 2px 0;
  font-family: var(--font-mono, ui-monospace, monospace);
  font-size: 0.82rem;
  color: rgba(220, 220, 220, 0.88);
  border-top: 1px dashed rgba(255, 255, 255, 0.08);
}

/* --- Sections --- */
.me-section {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.me-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.me-section-head h4 {
  margin: 0;
  font-size: 0.92rem;
  font-weight: 600;
  color: rgba(232, 220, 250, 0.95);
}
.me-section-head .me-count {
  font-weight: 400;
  color: rgba(200, 190, 170, 0.65);
  font-size: 0.78rem;
  margin-left: 4px;
}

.me-empty {
  padding: 12px;
  background: rgba(0, 0, 0, 0.20);
  border: 1px dashed rgba(180, 160, 240, 0.25);
  border-radius: 4px;
  color: rgba(200, 190, 170, 0.70);
  font-size: 0.85rem;
  font-style: italic;
}

/* --- Power rows --- */
.me-rows {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.me-row {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 8px;
  padding: 6px 10px;
  background: rgba(180, 160, 240, 0.06);
  border: 1px solid rgba(180, 160, 240, 0.22);
  border-radius: 4px;
}
.me-row-main { flex: 1 1 auto; min-width: 220px; }
.me-row-side {
  display: flex;
  gap: 8px;
  align-items: baseline;
}
.me-row-name {
  font-weight: 600;
  color: rgba(232, 220, 250, 0.95);
  font-size: 0.92rem;
}
.me-row-amount {
  color: rgba(200, 190, 170, 0.75);
  font-weight: 400;
}
.me-row-meta {
  display: block;
  margin-top: 2px;
  font-size: 0.75rem;
  color: rgba(200, 190, 170, 0.65);
}
.me-row-q {
  font-family: var(--font-mono, ui-monospace, monospace);
  font-size: 0.8rem;
  font-weight: 600;
  color: rgba(220, 200, 250, 0.85);
}
.me-row-amount-edit {
  flex-basis: 100%;
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 4px;
  padding-top: 6px;
  border-top: 1px dashed rgba(180, 160, 240, 0.18);
}
.me-row-amount-edit label {
  font-size: 0.75rem;
  color: rgba(200, 190, 170, 0.75);
  white-space: nowrap;
}
.me-row-amount-edit input,
.me-row-amount-edit select,
.me-amount-input {
  flex: 1 1 auto;
  background: rgba(0, 0, 0, 0.30);
  border: 1px solid rgba(180, 160, 240, 0.32);
  border-radius: 3px;
  color: rgba(232, 220, 200, 0.95);
  font-size: 0.82rem;
  padding: 3px 7px;
  font-family: inherit;
  color-scheme: dark;
}
.me-row-amount-edit select option,
.me-amount-input option {
  background: #1a1a2e;
  color: rgba(232, 220, 200, 0.95);
  padding: 4px;
}

/* Phase 7 W3 follow-up (Rome 2026-05-15) — multi-select damage-type picker
   for G32 / G33 / G36 Fortifications. Players pick exactly N damage types
   via checkboxes; selections beyond the cap disable the remaining options. */
.me-multi-pick {
  flex: 1 1 100%;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 4px 8px;
  margin-top: 4px;
  padding: 6px 8px;
  background: rgba(0, 0, 0, 0.18);
  border: 1px solid rgba(180, 160, 240, 0.24);
  border-radius: 4px;
}
.me-multi-meta {
  grid-column: 1 / -1;
  font-size: 0.74rem;
  color: rgba(200, 190, 170, 0.7);
  padding-bottom: 4px;
  border-bottom: 1px dashed rgba(180, 160, 240, 0.14);
  margin-bottom: 2px;
}
.me-multi-count {
  color: rgba(180, 160, 240, 0.9);
  font-weight: 600;
}
.me-multi-row {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.78rem;
  color: rgba(232, 220, 200, 0.85);
  cursor: pointer;
  padding: 2px 4px;
  border-radius: 3px;
}
.me-multi-row:hover { background: rgba(180, 160, 240, 0.08); }
.me-multi-row.selected {
  background: rgba(180, 160, 240, 0.16);
  color: rgba(232, 220, 200, 1);
}
.me-multi-row.disabled {
  opacity: 0.4;
  cursor: not-allowed;
}
.me-multi-row.disabled:hover { background: transparent; }
.me-multi-row input[type="checkbox"] {
  cursor: inherit;
  accent-color: rgba(180, 160, 240, 0.85);
}

/* --- Modifier slots --- */
.me-slots {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 8px;
}
.me-slot {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 8px 10px;
  background: rgba(140, 200, 200, 0.06);
  border: 1px solid rgba(140, 200, 200, 0.22);
  border-radius: 4px;
}
.me-slot-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
}
.me-slot-label {
  font-weight: 600;
  font-size: 0.85rem;
  color: rgba(220, 230, 230, 0.95);
}
.me-slot-q {
  font-family: var(--font-mono, ui-monospace, monospace);
  font-size: 0.75rem;
  font-weight: 600;
}
.me-slot-q.pos  { color: rgba(232, 200, 120, 0.95); }
.me-slot-q.neg  { color: rgba(180, 220, 180, 0.85); }
.me-slot-q.zero { color: rgba(200, 190, 170, 0.55); }
.me-slot-select {
  background: rgba(0, 0, 0, 0.30);
  border: 1px solid rgba(140, 200, 200, 0.32);
  border-radius: 3px;
  color: rgba(232, 220, 200, 0.95);
  font-size: 0.82rem;
  padding: 4px 6px;
  width: 100%;
  font-family: inherit;
  color-scheme: dark;        /* hint native widget to use dark popup */
}
.me-slot-select:focus {
  border-color: rgba(180, 230, 230, 0.65);
  outline: none;
}
/* Explicit option styling so the popup list reads correctly in
   browsers that don't honor color-scheme on <select>. */
.me-slot-select option {
  background: #1a1a2e;
  color: rgba(232, 220, 200, 0.95);
  padding: 4px;
}
.me-slot-current {
  font-size: 0.82rem;
  color: rgba(232, 220, 200, 0.85);
  padding: 4px 6px;
  background: rgba(0, 0, 0, 0.20);
  border-radius: 3px;
}
.me-slot-hint {
  font-size: 0.68rem;
  color: rgba(200, 190, 170, 0.55);
  font-style: italic;
}

/* --- Buttons --- */
.me-btn {
  display: inline-block;
  padding: 5px 11px;
  background: rgba(0, 0, 0, 0.30);
  border: 1px solid rgba(232, 220, 200, 0.30);
  border-radius: 3px;
  color: rgba(232, 220, 200, 0.90);
  font-size: 0.82rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s ease;
  font-family: inherit;
}
.me-btn:hover { background: rgba(232, 220, 200, 0.10); border-color: rgba(232, 220, 200, 0.55); }
.me-btn-primary {
  background: rgba(180, 160, 240, 0.18);
  border-color: rgba(180, 160, 240, 0.55);
  color: rgba(232, 220, 250, 0.95);
}
.me-btn-primary:hover {
  background: rgba(180, 160, 240, 0.32);
  border-color: rgba(200, 180, 255, 0.85);
}
.me-btn-secondary {
  color: rgba(200, 190, 170, 0.75);
}
.me-btn-tiny {
  padding: 1px 7px;
  font-size: 0.78rem;
}

/* --- Actions footer --- */
.me-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding-top: 8px;
  border-top: 1px dashed rgba(180, 160, 240, 0.25);
}

/* --- Add Power picker --- */
.me-picker {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.me-picker-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding-bottom: 6px;
  border-bottom: 1px dashed rgba(180, 160, 240, 0.25);
}
.me-picker-head h4 {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 600;
  color: rgba(232, 220, 250, 0.95);
}
.me-picker-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 8px;
}
.me-picker-cat {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  padding: 10px 12px;
  background: rgba(180, 160, 240, 0.08);
  border: 1px solid rgba(180, 160, 240, 0.30);
  border-radius: 4px;
  color: rgba(232, 220, 250, 0.95);
  cursor: pointer;
  text-align: left;
  transition: all 0.15s ease;
  font-family: inherit;
}
.me-picker-cat:hover {
  background: rgba(180, 160, 240, 0.18);
  border-color: rgba(200, 180, 255, 0.65);
}
.me-picker-cat-name {
  font-weight: 600;
  font-size: 0.92rem;
}
.me-picker-cat-count {
  font-size: 0.72rem;
  color: rgba(200, 190, 170, 0.65);
}

.me-picker-group {
  background: rgba(0, 0, 0, 0.18);
  border: 1px solid rgba(180, 160, 240, 0.20);
  border-radius: 4px;
  padding: 8px 10px;
}
.me-picker-group-name {
  font-weight: 600;
  font-size: 0.92rem;
  color: rgba(232, 220, 250, 0.95);
  margin-bottom: 4px;
}
.me-picker-group-g {
  font-family: var(--font-mono, ui-monospace, monospace);
  font-size: 0.72rem;
  font-weight: 400;
  color: rgba(200, 190, 170, 0.55);
  margin-left: 6px;
}
.me-picker-group-tiers {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}
.me-picker-tier {
  display: flex;
  align-items: baseline;
  gap: 7px;
  padding: 4px 10px;
  background: rgba(180, 160, 240, 0.08);
  border: 1px solid rgba(180, 160, 240, 0.30);
  border-radius: 3px;
  color: rgba(232, 220, 250, 0.95);
  cursor: pointer;
  font-size: 0.82rem;
  font-family: inherit;
  transition: all 0.15s ease;
}
.me-picker-tier:hover {
  background: rgba(180, 160, 240, 0.22);
  border-color: rgba(200, 180, 255, 0.75);
}
.me-picker-tier-lvl { font-weight: 600; }
.me-picker-tier-amt { color: rgba(200, 190, 170, 0.75); }
.me-picker-tier-q   {
  font-family: var(--font-mono, ui-monospace, monospace);
  color: rgba(220, 200, 250, 0.85);
  font-weight: 600;
}
.me-picker-tier-c   {
  font-family: var(--font-mono, ui-monospace, monospace);
  color: rgba(200, 190, 170, 0.55);
  font-size: 0.72rem;
}

.me-picker-amount {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.me-picker-amount-body {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 12px;
  background: rgba(0, 0, 0, 0.18);
  border: 1px solid rgba(180, 160, 240, 0.25);
  border-radius: 4px;
}
.me-picker-amount-body label {
  font-size: 0.85rem;
  font-weight: 600;
  color: rgba(220, 210, 250, 0.92);
}
.me-picker-amount-body input,
.me-picker-amount-body select {
  background: rgba(0, 0, 0, 0.30);
  border: 1px solid rgba(180, 160, 240, 0.40);
  border-radius: 3px;
  color: rgba(232, 220, 200, 0.95);
  font-size: 0.9rem;
  padding: 6px 10px;
  width: 100%;
  font-family: inherit;
  color-scheme: dark;
}
.me-picker-amount-body select option {
  background: #1a1a2e;
  color: rgba(232, 220, 200, 0.95);
  padding: 4px;
}
.me-picker-rule {
  padding: 8px 10px;
  background: rgba(0, 0, 0, 0.25);
  border-left: 2px solid rgba(180, 160, 240, 0.45);
  border-radius: 0 3px 3px 0;
  font-size: 0.8rem;
  color: rgba(220, 210, 180, 0.85);
  font-style: italic;
  line-height: 1.4;
}
.me-picker-amount-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding-top: 4px;
}
