/*
 * Battle Tracker - Controls links (Combatant anlegen, Presets, Party),
 * Kampfliste rechts (Initiative-Reihen mit HP-Balken, Conditions, Death
 * Saves) plus Log. Farben und Basis-Bausteine aus wbt-shared.css (.wmg-app).
 */
.wm-wbt-app{ margin: 0 auto; max-width: 1200px; }

.wm-wbt-shell{
  display: grid;
  grid-template-columns: 300px 1fr;
  gap: 18px;
  align-items: start;
}
@media (max-width: 900px){
  .wm-wbt-shell{ grid-template-columns: 1fr; }
}

/* --- Controls --- */
.wm-wbt-brand{ margin-bottom: 12px; }
.wm-wbt-brand-top{ display:flex; align-items:center; justify-content:space-between; gap: 10px; }
.wm-wbt-title{ font-size: 22px; font-weight: 700; color: var(--wm-ink); }
.wm-wbt-sub{ font-size: 12.5px; color: var(--wm-muted); margin-top: 2px; }

.wm-wbt-card{
  background: var(--wm-surface);
  border: 1px solid var(--wm-divider);
  border-radius: var(--wm-radius);
  padding: 14px;
  margin-bottom: 12px;
}
.wm-wbt-card-h{
  font-size: 11px;
  font-weight: 700;
  color: var(--wm-muted);
  text-transform: uppercase;
  letter-spacing: .35px;
  margin-bottom: 10px;
}

.wm-wbt-grid{ display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.wm-wbt-field{ display: flex; flex-direction: column; gap: 4px; }
.wm-wbt-field-wide{ grid-column: 1 / -1; }
.wm-wbt-label{ font-size: 11px; font-weight: 700; color: var(--wm-muted2); text-transform: uppercase; letter-spacing: .03em; }
.wm-wbt-input,
.wm-wbt-select{
  border: 1px solid var(--wm-divider);
  border-radius: 4px;
  background: #fff;
  color: var(--wm-ink);
  padding: 8px;
  font-family: inherit;
  font-size: 13px;
  width: 100%;
  box-sizing: border-box;
}
.wm-wbt-input:focus,
.wm-wbt-select:focus{ outline: none; border-color: var(--wm-teal); box-shadow: 0 0 0 3px var(--wm-teal-tint); }

.wm-wbt-actions{ display: flex; gap: 8px; margin-top: 12px; }
.wm-wbt-actions .wm-btn{ flex: 1; }
.wm-wbt-mini-text{ font-size: 12px; color: var(--wm-muted); line-height: 1.5; margin-top: 8px; }

/* --- Monster-Bibliothek --- */
.wm-wbt-libfilters{ display: flex; gap: 6px; margin-top: 8px; }
.wm-wbt-libfilters .wm-wbt-select{ flex: 1; min-width: 0; }

.wm-wbt-monlist{
  margin-top: 8px;
  max-height: 260px;
  overflow-y: auto;
  border: 1px solid var(--wm-divider);
  border-radius: 6px;
  background: var(--wm-panel);
}
.wm-wbt-monrow{
  display: flex;
  align-items: stretch;
  border-bottom: 1px solid var(--wm-divider);
}
.wm-wbt-monrow:last-child{ border-bottom: none; }
.wm-wbt-monimg{
  flex: 0 0 auto;
  width: 26px;
  height: 26px;
  border-radius: 999px;
  object-fit: cover;
  box-shadow: inset 0 0 0 1px rgba(38,36,33,.08);
}
.wm-wbt-montxt{ display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.wm-wbt-monadd{
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 8px;
  text-align: left;
  border: none;
  background: transparent !important;
  color: var(--wm-ink) !important;
  padding: 7px 10px;
  cursor: pointer;
  font-family: inherit;
  transition: background .12s ease;
}
.wm-wbt-monadd:hover{ background: var(--wm-teal-tint) !important; }
.wm-wbt-moninfo{
  flex: 0 0 auto;
  border: none;
  border-left: 1px solid var(--wm-divider);
  background: transparent !important;
  color: var(--wm-muted2) !important;
  padding: 0 10px;
  cursor: pointer;
  font-family: inherit;
  font-size: 14px;
  transition: background .12s ease, color .12s ease;
}
.wm-wbt-moninfo:hover{ background: var(--wm-gold-tint) !important; color: var(--wm-teal) !important; }
.wm-wbt-monname{ font-size: 13px; font-weight: 700; color: var(--wm-ink); }
.wm-wbt-monadd:hover .wm-wbt-monname{ color: var(--wm-teal); }
.wm-wbt-monmeta{ font-size: 11px; color: var(--wm-muted2); font-weight: 700; }
.wm-wbt-monempty{
  padding: 10px;
  font-size: 12px;
  color: var(--wm-muted2);
  text-align: center;
}

/* --- Party-Manager --- */
.wm-wbt-partylist{ display: flex; flex-direction: column; gap: 6px; margin-bottom: 12px; }
.wm-wbt-partyrow{
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--wm-panel);
  border: 1px solid var(--wm-divider);
  border-radius: 6px;
  padding: 6px 8px;
}
.wm-wbt-partyinfo{ flex: 1; min-width: 0; }
.wm-wbt-partyname{ font-size: 13px; font-weight: 700; color: var(--wm-ink); }
.wm-wbt-partymeta{ font-size: 11px; color: var(--wm-muted2); font-weight: 700; }

/* Charakter-Untertitel in der Kampfzeile */
.wm-wbt-charsub{ font-size: 11.5px; color: var(--wm-muted2); font-weight: 700; margin-top: 2px; }

/* --- Topbar --- */
.wm-wbt-topbar{
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  background: var(--wm-surface);
  border: 1px solid var(--wm-divider);
  border-radius: var(--wm-radius);
  padding: 10px 14px;
  margin-bottom: 12px;
}
.wm-wbt-roundbox{
  display: flex;
  align-items: baseline;
  gap: 8px;
  padding-right: 12px;
  border-right: 1px solid var(--wm-divider);
}
.wm-wbt-round-k{ font-size: 11px; font-weight: 700; color: var(--wm-muted2); text-transform: uppercase; letter-spacing: .03em; }
.wm-wbt-round-v{ font-size: 22px; font-weight: 700; color: var(--wm-teal); min-width: 28px; }
.wm-wbt-xpbox .wm-wbt-round-v{ color: var(--wm-gold); font-size: 16px; align-self: center; }
.wm-wbt-topactions{ display: flex; flex-wrap: wrap; gap: 8px; }
.wm-wbt-status{ margin-left: auto; font-size: 12px; color: var(--wm-muted2); font-weight: 700; }

/* --- Kampfliste --- */
.wm-wbt-list{ display: flex; flex-direction: column; gap: 8px; }
.wm-wbt-empty{
  background: var(--wm-panel);
  border: 1px dashed var(--wm-divider);
  border-radius: var(--wm-radius);
  padding: 40px 20px;
  text-align: center;
  color: var(--wm-muted2);
  font-size: 13.5px;
  line-height: 1.6;
}

.wm-wbt-row{
  background: var(--wm-surface);
  border: 1px solid var(--wm-divider);
  border-left-width: 3px;
  border-radius: var(--wm-radius);
  padding: 10px 12px;
  display: grid;
  grid-template-columns: 52px 1fr auto;
  gap: 8px 12px;
  align-items: center;
}
.wm-wbt-row--pc{ border-left-color: var(--wm-teal); }
.wm-wbt-row--ally{ border-left-color: var(--wm-gold); }
.wm-wbt-row--monster{ border-left-color: #a33b3b; }
.wm-wbt-row--active{
  border-color: var(--wm-teal);
  box-shadow: 0 0 0 3px var(--wm-teal-tint);
}
.wm-wbt-row--down{ opacity: .75; }
.wm-wbt-row--dead{ opacity: .45; }
.wm-wbt-row--dead .wm-wbt-cname{ text-decoration: line-through; }

.wm-wbt-initbox{ display: flex; flex-direction: column; align-items: center; gap: 2px; }
/*
 * !important + Spinner-Unterdrueckung: WordPress-Themes stylen
 * input[type=number] gern global (min-width/padding) - das Feld kollabierte
 * auf der Live-Seite auf Spinner-Breite und der Wert war unsichtbar
 * (gleiche Theme-Problematik wie bei den Buttons, siehe wbt-shared.css).
 */
.wm-wbt-init{
  width: 44px !important;
  min-width: 44px !important;
  max-width: 44px;
  box-sizing: border-box !important;
  text-align: center;
  border: 1px solid var(--wm-divider) !important;
  border-radius: 4px;
  font-family: inherit;
  font-size: 16px !important;
  font-weight: 700;
  color: var(--wm-ink) !important;
  background: var(--wm-panel) !important;
  padding: 4px 2px !important;
  margin: 0 !important;
  -moz-appearance: textfield;
  appearance: textfield;
}
.wm-wbt-init::-webkit-outer-spin-button,
.wm-wbt-init::-webkit-inner-spin-button{ -webkit-appearance: none; margin: 0; }
.wm-wbt-init::placeholder{ color: var(--wm-muted2); opacity: 1; }
.wm-wbt-init:focus{ outline: none; border-color: var(--wm-teal) !important; }
.wm-wbt-init-k{ font-size: 9px; font-weight: 700; color: var(--wm-muted2); text-transform: uppercase; letter-spacing: .05em; }

.wm-wbt-mid{ min-width: 0; }
.wm-wbt-toprow{ display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.wm-wbt-cname{ font-size: 15px; font-weight: 700; color: var(--wm-ink); }
.wm-wbt-ac{ font-size: 11.5px; color: var(--wm-muted2); font-weight: 700; }
.wm-wbt-turnflag{
  font-size: 10px;
  font-weight: 700;
  color: var(--wm-on-teal);
  background: var(--wm-teal);
  border-radius: 999px;
  padding: 3px 9px;
  text-transform: uppercase;
  letter-spacing: .05em;
}

.wm-wbt-hprow{ display: flex; align-items: center; gap: 10px; margin-top: 6px; }
.wm-wbt-hpbar{
  flex: 1;
  height: 10px;
  border-radius: 999px;
  background: var(--wm-parchment-dark);
  overflow: hidden;
  min-width: 80px;
}
.wm-wbt-hpfill{ height: 100%; background: var(--wm-teal); transition: width .2s ease, background .2s ease; }
.wm-wbt-hpfill--warn{ background: var(--wm-gold); }
.wm-wbt-hpfill--crit{ background: #a33b3b; }
.wm-wbt-hptext{ font-size: 12.5px; font-weight: 700; color: var(--wm-ink); white-space: nowrap; }

.wm-wbt-conds{ display: flex; flex-wrap: wrap; gap: 5px; margin-top: 6px; }
.wm-wbt-cond{
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  font-weight: 700;
  background: var(--wm-gold-tint);
  color: #8a6a2f;
  border-radius: 999px;
  padding: 3px 9px;
}
.wm-wbt-cond button{
  border: none;
  background: none;
  color: inherit;
  cursor: pointer;
  font-size: 12px;
  padding: 0;
  line-height: 1;
  font-family: inherit;
}

/* Death Saves */
.wm-wbt-death{ display: flex; align-items: center; gap: 10px; margin-top: 6px; flex-wrap: wrap; }
.wm-wbt-death-k{ font-size: 11px; font-weight: 700; color: #a33b3b; text-transform: uppercase; letter-spacing: .03em; }
.wm-wbt-pips{ display: inline-flex; gap: 3px; }
.wm-wbt-pip{
  width: 10px; height: 10px; border-radius: 999px;
  border: 1px solid var(--wm-muted2);
  background: #fff;
}
.wm-wbt-pip--s{ background: var(--wm-teal); border-color: var(--wm-teal); }
.wm-wbt-pip--f{ background: #a33b3b; border-color: #a33b3b; }
.wm-wbt-stable{ font-size: 11px; font-weight: 700; color: var(--wm-teal); text-transform: uppercase; }

/* rechte Aktions-Spalte einer Reihe */
.wm-wbt-side{ display: flex; flex-direction: column; gap: 6px; align-items: flex-end; }
.wm-wbt-dmgrow{ display: flex; gap: 5px; }
.wm-wbt-dmg{
  width: 56px !important;
  min-width: 56px !important;
  box-sizing: border-box !important;
  border: 1px solid var(--wm-divider) !important;
  border-radius: 4px;
  padding: 4px 6px !important;
  margin: 0 !important;
  font-family: inherit;
  font-size: 12.5px !important;
  text-align: center;
  -moz-appearance: textfield;
  appearance: textfield;
}
.wm-wbt-dmg::-webkit-outer-spin-button,
.wm-wbt-dmg::-webkit-inner-spin-button{ -webkit-appearance: none; margin: 0; }
.wm-wbt-dmg:focus{ outline: none; border-color: var(--wm-teal) !important; }
.wm-wbt-condrow{ display: flex; gap: 5px; align-items: center; }
.wm-wbt-condsel{
  border: 1px solid var(--wm-divider);
  border-radius: 4px;
  padding: 4px 6px;
  font-family: inherit;
  font-size: 12px;
  max-width: 120px;
  background: #fff;
  color: var(--wm-ink);
}
.wm-wbt-condrounds{
  width: 44px !important;
  min-width: 44px !important;
  box-sizing: border-box !important;
  border: 1px solid var(--wm-divider) !important;
  border-radius: 4px;
  padding: 4px 6px !important;
  margin: 0 !important;
  font-family: inherit;
  font-size: 12px !important;
  text-align: center;
  -moz-appearance: textfield;
  appearance: textfield;
}
.wm-wbt-condrounds::-webkit-outer-spin-button,
.wm-wbt-condrounds::-webkit-inner-spin-button{ -webkit-appearance: none; margin: 0; }
.wm-wbt-rowbtns{ display: flex; gap: 5px; }

@media (max-width: 640px){
  .wm-wbt-row{ grid-template-columns: 52px 1fr; }
  .wm-wbt-side{ grid-column: 1 / -1; flex-direction: row; flex-wrap: wrap; align-items: center; justify-content: flex-start; }
}

/* --- Statblock-Modal --- */
.wm-wbt-modal{
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(38, 36, 33, .55);
  z-index: 99999;
  padding: 24px 12px;
}
.wm-wbt-modal.open{ display: flex; align-items: flex-start; justify-content: center; }
.wm-wbt-modal-card{
  background: var(--wm-panel, #faf7f0);
  border: 1px solid var(--wm-gold, #c9a35c);
  border-radius: 8px;
  max-width: 560px;
  width: 100%;
  max-height: calc(100vh - 48px);
  overflow-y: auto;
  padding: 16px 18px;
  font-family: Georgia, 'Times New Roman', serif;
  color: #262421;
}
.wm-wbt-modal-head{
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  border-bottom: 2px solid var(--wm-gold, #c9a35c);
  padding-bottom: 8px;
  margin-bottom: 10px;
}
.wm-wbt-modal-title{
  margin: 0;
  font-size: 20px;
  font-weight: 700;
  color: var(--wm-teal, #0c857b);
  font-family: inherit;
}

/* Statblock-Inhalt (generiert aus dem SRD 5.2.1) */
.wm-wbt-sb{ font-size: 13px; line-height: 1.5; }
.wm-wbt-sb p{ margin: 0 0 8px; }
.wm-wbt-sb > p:first-child{ font-style: italic; color: var(--wm-muted, #6b6558); }
.wm-wbt-sb h5{
  margin: 12px 0 6px;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .4px;
  color: var(--wm-gold, #8a6a2f);
  border-bottom: 1px solid var(--wm-parchment-dark, #e5e1d6);
  padding-bottom: 3px;
}
.wm-wbt-abl{
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 4px;
  margin: 8px 0 10px;
}
.wm-wbt-abl-cell{
  background: #fff;
  border: 1px solid var(--wm-parchment-dark, #e5e1d6);
  border-radius: 4px;
  padding: 4px 6px;
  font-size: 12px;
  text-align: center;
}
.wm-wbt-abl-cell b{ color: var(--wm-teal, #0c857b); }
.wm-wbt-abl-cell i{ color: var(--wm-muted2, #8a8474); font-style: normal; font-size: 11px; }
.wm-wbt-sb-tablewrap{ overflow-x: auto; margin: 8px 0; }
.wm-wbt-sb-tablewrap table{ border-collapse: collapse; font-size: 11.5px; }
.wm-wbt-sb-tablewrap td, .wm-wbt-sb-tablewrap th{ border: 1px solid var(--wm-parchment-dark, #e5e1d6); padding: 3px 6px; }

/* --- Log --- */
.wm-wbt-log-wrap{ margin-top: 14px; }
.wm-wbt-log{
  background: var(--wm-panel);
  border: 1px solid var(--wm-divider);
  border-radius: var(--wm-radius);
  padding: 10px 12px;
  max-height: 180px;
  overflow-y: auto;
  font-size: 12.5px;
  color: var(--wm-muted);
  line-height: 1.6;
}
.wm-wbt-log:empty{ display: none; }
.wm-wbt-log-round{ color: var(--wm-teal); font-weight: 700; }
