
/* Catálogo maestro, apartado de Herramientas. No altera las pantallas existentes. */
.stb-main-nav{align-items:flex-end;gap:16px;margin-top:8px}
.stb-nav-group{display:flex;flex-direction:column;gap:6px;min-width:0}
.stb-nav-label{font-size:12px;line-height:1.2;letter-spacing:.1em;text-transform:uppercase;color:var(--muted);font-weight:700;padding:0 5px}
.stb-nav-buttons{display:flex;flex-wrap:wrap;gap:7px}
.stb-main-nav .stb-nav-buttons button{font-size:16px;padding:10px 14px}
.stb-nav-actions{margin-left:auto}
.troop-catalogue{display:flex;flex-direction:column;gap:17px;padding:8px 0 30px}
.troop-catalogue-intro h1{margin:0 0 5px}
.troop-catalogue-intro .eyebrow{margin:0 0 6px}
.troop-catalogue-intro .muted{margin:0}
.troop-categories{display:grid;grid-template-columns:repeat(auto-fit,minmax(160px,1fr));gap:10px}
.troop-category{border:1px solid var(--line);border-radius:12px;padding:14px;background:var(--panel);display:flex;flex-direction:column;gap:5px}
.troop-category.is-active{border-color:var(--gold);background:#272737}
.troop-category.is-pending{opacity:.57}
.troop-category-top{display:flex;align-items:center;justify-content:space-between;gap:10px}
.troop-category strong{font-size:16px}
.troop-category small{font-size:12px;color:var(--muted)}
.troop-count{font-weight:700;font-size:14px;color:var(--gold)}
.troop-catalogue-controls{display:grid;grid-template-columns:minmax(220px,2fr) minmax(110px,1fr) minmax(150px,1fr);gap:12px;align-items:end}
.troop-catalogue-controls label{font-size:13px;color:var(--muted)}
.troop-catalogue-controls input,.troop-catalogue-controls select{min-width:0;max-width:100%;width:100%;font-size:16px;padding:12px}
#catalogo-status{font-size:13px;min-height:18px}
#catalogo-status button{font-size:13px;padding:4px 10px;margin-left:8px}
.troop-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(255px,1fr));gap:12px}
.troop-card{width:100%;height:100%;background:var(--panel);border:1px solid var(--line);padding:12px;border-radius:13px;display:flex;gap:12px;align-items:center;text-align:left;min-width:0}
.troop-card:hover,.troop-card.selected{background:#202b45;border-color:var(--gold)}
.troop-portrait{width:76px;height:76px;flex:0 0 76px;border-radius:10px;background:#101728;border:1px solid #3e4b64;display:flex;align-items:center;justify-content:center;overflow:hidden}
.troop-card-image{width:72px;height:72px;object-fit:contain}
.troop-image-missing{font-size:27px}
.troop-card-content{display:flex;min-width:0;flex:1;flex-direction:column;gap:2px}
.troop-card-top{display:flex;gap:6px;align-items:center;flex-wrap:wrap}
.troop-tier{background:#725b31;color:#ffefc8;border-radius:6px;padding:2px 7px;font-size:12px;font-weight:800}
.troop-class{font-size:12px;color:var(--muted)}
.troop-card-name{font-size:17px;overflow-wrap:anywhere;line-height:1.3}
.troop-card-original{font-size:12px;color:var(--muted)}
.troop-card-stats{display:flex;gap:14px;margin-top:3px;font-size:12px;color:#d7dce5}
.troop-detail{border:1px solid var(--gold);border-radius:18px;padding:20px;background:var(--panel)}
.troop-detail-head{display:flex;align-items:center;gap:18px;flex-wrap:wrap}
.troop-detail-image{width:100px;height:100px;object-fit:contain;border-radius:12px;background:#101728}
.troop-detail-title{display:flex;flex-direction:column;min-width:0;flex:1}
.troop-detail-title h2{margin:1px 0;font-size:clamp(21px,3vw,30px)}
.troop-tier-line{color:var(--gold)}
.troop-close{padding:9px 12px;font-size:14px}
.troop-validation{padding:10px 14px;border:1px dashed #897247;border-radius:10px;color:#efd59d;font-size:13px;background:#2e2930}
.troop-detail-section{margin:15px 0}
.troop-detail-section h3{margin:10px 0;font-size:18px}
.troop-stats{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:7px 20px}
.troop-stats dt{color:var(--muted);font-size:13px}
.troop-stats dd{font-size:15px;font-weight:700;margin:0 0 6px;overflow-wrap:anywhere}
.troop-bonus-list{list-style:none;display:grid;gap:9px;padding:0;margin:0}
.troop-bonus-list li{display:flex;justify-content:space-between;gap:12px;background:#11192b;border:1px solid var(--line);border-radius:9px;padding:10px 14px}
.troop-bonus-list strong{color:var(--gold)}
@media(max-width:720px){
  .stb-main-nav{align-items:stretch;gap:10px}
  .stb-nav-group{width:100%}
  .stb-nav-actions{margin:0}
  .troop-categories{grid-template-columns:repeat(2,minmax(0,1fr))}
  .troop-catalogue-controls{grid-template-columns:repeat(2,minmax(0,1fr))}
  .troop-search{grid-column:1/-1}
  .troop-grid{grid-template-columns:repeat(2,minmax(0,1fr))}
  .troop-card{flex-direction:column;align-items:stretch;padding:10px;gap:7px}
  .troop-portrait{width:100%;height:84px;flex:none}
  .troop-detail-head{gap:10px}
  .troop-detail-image{width:70px;height:70px}
  .troop-stats{grid-template-columns:repeat(2,minmax(0,1fr))}
}
@media(max-width:410px){.troop-card-name{font-size:15px}.troop-card-original{font-size:11px}.troop-categories{gap:7px}.troop-detail{padding:14px}}

.troop-classification{font-size:15px;font-weight:600;color:var(--text);margin:8px 0 14px}.troop-bonus-phrase{justify-content:flex-start!important}.troop-bonus-list li span{overflow-wrap:anywhere}.troop-detail-section .troop-bonus-list{margin-top:10px}

/* Fichas: toda característica usa la misma tipografía y estructura de dos columnas. */
.troop-detail-section .troop-stats{grid-template-columns:minmax(0,1fr) minmax(90px,auto);gap:0 14px;align-items:baseline}
.troop-detail-section .troop-stats dt,.troop-detail-section .troop-stats dd{padding:9px 0;border-bottom:1px solid var(--line);margin:0;font-size:15px;line-height:1.4}
.troop-detail-section .troop-stats dd{text-align:right;font-weight:650;color:var(--text)}
.troop-detail-section .troop-bonus-list{list-style:none;padding:0;margin:0;display:block}
.troop-detail-section .troop-bonus-list li{padding:9px 0;border:0;border-bottom:1px solid var(--line);border-radius:0;background:transparent;font-size:15px;align-items:baseline}
.troop-detail-section .troop-bonus-list strong{color:var(--text);font-weight:650;white-space:normal;text-align:right}
.troop-bonuses-header{display:flex;align-items:center;justify-content:space-between;gap:10px;flex-wrap:wrap}
.troop-bonuses-header h3{margin:0}
.troop-edit-btn{font-size:13px;padding:7px 12px}
.troop-editor{border:1px solid var(--line);border-radius:12px;padding:17px;display:flex;flex-direction:column;gap:12px}
.troop-editor-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:9px}
.troop-editor-label{min-width:0;font-size:13px;color:var(--muted)}
.troop-editor-label input,.troop-editor-label textarea{width:100%;font-size:15px;padding:10px}
.troop-editor-rows{display:grid;gap:8px}
.troop-editor-row{display:grid;grid-template-columns:1fr 1fr auto;gap:8px;align-items:end}
.troop-editor-row:has(.troop-editor-label:nth-child(3)){grid-template-columns:1fr 1fr 110px auto}
.troop-remove{padding:8px 12px;font-size:23px;line-height:1}
.troop-editor-actions{display:flex;justify-content:flex-end;gap:10px}
.troop-editor-actions button{font-size:15px}
.troop-editor-error{color:#ffb8ae}
@media(max-width:650px){.troop-editor-grid{grid-template-columns:1fr}.troop-editor-row,.troop-editor-row:has(.troop-editor-label:nth-child(3)){grid-template-columns:1fr 1fr}.troop-editor-row .troop-remove{grid-column:1/-1;justify-self:end}}

.troop-preset-rows{display:grid;gap:1px;background:var(--line);border:1px solid var(--line);border-radius:10px;overflow:hidden}.troop-preset-row{display:grid;grid-template-columns:22px minmax(0,1fr) 100px 20px;align-items:center;gap:10px;background:var(--panel);padding:10px 12px}.troop-preset-row input[type=checkbox]{width:18px;height:18px;min-width:18px;accent-color:var(--gold);padding:0}.troop-preset-row input[type=number]{width:100%;min-width:0;padding:8px;font-size:15px}.troop-preset-name{font-size:14px;line-height:1.3}.troop-preset-unit{font-weight:600;color:var(--muted)}.troop-bonus-value.is-inactive{color:var(--muted);font-weight:400}.troop-bonus-value.is-active{color:var(--gold)}.troop-legacy{margin-top:12px;border-top:1px solid var(--line);padding-top:10px}.troop-legacy summary{cursor:pointer;font-size:13px;color:var(--muted)}@media(max-width:480px){.troop-preset-row{grid-template-columns:20px minmax(0,1fr) 70px 16px;gap:6px;padding:9px 7px}.troop-preset-name{font-size:12px}}

/* Modelo visual único para todas las fichas de Guardias. */
.troop-detail-section .troop-stats{grid-template-columns:minmax(0,1fr) minmax(72px,max-content);column-gap:14px}
.troop-detail-section .troop-stats dt,.troop-detail-section .troop-stats dd{border-bottom:1px solid var(--line);padding:9px 0;margin:0;font-size:15px;line-height:1.4}
.troop-detail-section .troop-stats dt{color:var(--muted)}
.troop-detail-section .troop-stats dd{text-align:right;color:var(--text);font-weight:650}
.troop-editor input,.troop-editor textarea{user-select:text;-webkit-user-select:text;pointer-events:auto}
.troop-editor input:focus,.troop-editor textarea:focus{outline:2px solid var(--gold);outline-offset:1px}

/* Vinculación visual de imágenes del banco maestro, disponible solo para administración. */
.troop-monster-bank-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(130px,1fr));gap:12px;margin:16px 0;max-height:55vh;overflow:auto}
.troop-monster-bank-item{display:flex;flex-direction:column;gap:7px;align-items:center;justify-content:flex-start;background:var(--surface,#172238);border:1px solid var(--line,#445);border-radius:9px;padding:8px;cursor:pointer;min-height:170px}
.troop-monster-bank-item:hover,.troop-monster-bank-item:focus-visible{outline:2px solid #d7b96e;outline-offset:2px}
.troop-monster-bank-item img{width:100%;height:140px;object-fit:contain}
.troop-monster-bank-item small{overflow-wrap:anywhere;text-align:center;font-size:11px}

/*
 * Fichas de tropas: una fila = una característica y su cifra.
 * La columna numérica conserva el valor completo, incluidos miles y unidades.
 * Solo las etiquetas muy largas se recortan visualmente en pantallas estrechas;
 * su texto completo está en el atributo title del término (accesibilidad).
 */
.troop-detail-section .troop-stats{
  display:grid;
  grid-template-columns:minmax(0,1fr) max-content;
  column-gap:clamp(7px,2vw,14px);
  width:100%;
  align-items:center;
}
.troop-detail-section .troop-stats dt,
.troop-detail-section .troop-stats dd{
  min-width:0;
  white-space:nowrap;
  word-break:normal;
  overflow-wrap:normal;
}
.troop-detail-section .troop-stats dt{
  overflow:hidden;
  text-overflow:ellipsis;
}
.troop-detail-section .troop-stats dd{
  overflow:visible;
  text-overflow:clip;
  font-variant-numeric:tabular-nums;
  font-feature-settings:"tnum";
  word-spacing:normal;
}
.troop-detail-section .troop-bonus-list li{
  display:grid;
  grid-template-columns:minmax(0,1fr) max-content;
  column-gap:clamp(7px,2vw,14px);
  align-items:center;
}
.troop-detail-section .troop-bonus-list li span{
  min-width:0;
  overflow:hidden;
  text-overflow:ellipsis;
  white-space:nowrap;
  overflow-wrap:normal;
  word-break:normal;
}
.troop-detail-section .troop-bonus-list strong{
  white-space:nowrap;
  word-break:normal;
  overflow-wrap:normal;
  font-variant-numeric:tabular-nums;
}
@media(max-width:480px){
  .troop-detail-section .troop-stats dt,
  .troop-detail-section .troop-stats dd,
  .troop-detail-section .troop-bonus-list li{
    font-size:clamp(12px,3.5vw,14px);
  }
}



/* Modal del catálogo: la imagen permanece quieta, las estadísticas tienen su propio scroll. */
.troop-modal{position:fixed;inset:0;margin:auto;padding:0;box-sizing:border-box;width:min(1040px,calc(100vw - 32px));max-width:1040px;height:min(88dvh,880px);max-height:calc(100dvh - 24px);border:1px solid var(--gold);border-radius:18px;background:var(--panel);color:var(--text);box-shadow:0 24px 75px #000a;overflow:hidden;overscroll-behavior:contain}
.troop-modal::backdrop{background:rgba(5,10,22,.77);backdrop-filter:blur(3px)}
.troop-modal .troop-detail{display:grid;grid-template-columns:minmax(0,39%) minmax(0,61%);grid-template-rows:minmax(0,1fr);gap:0;box-sizing:border-box;width:100%;height:100%;min-height:0;padding:0;overflow:hidden;border:0;border-radius:0;background:transparent}
.troop-modal .troop-detail-head{display:flex;flex-direction:column;align-items:stretch;gap:16px;box-sizing:border-box;min-height:0;overflow:hidden;padding:28px 20px 24px;border-right:1px solid var(--line)}
.troop-modal .troop-detail-title{flex:none;min-width:0}
.troop-modal .troop-detail-title h2{margin:0;font-size:clamp(20px,2.5vw,29px);line-height:1.25;overflow-wrap:anywhere}
.troop-modal .troop-detail-art{display:flex;flex-direction:column;justify-content:flex-start;align-items:center;gap:12px;flex:1;min-height:0;margin:0;padding:0;background:transparent}
.troop-modal .troop-detail-art .troop-detail-image{display:block;width:auto;height:auto;max-width:100%;max-height:min(55dvh,530px);min-height:0;object-fit:contain;border:0;border-radius:0;background:transparent}
.troop-modal .troop-detail-art .troop-edit-btn{flex:none;max-width:100%}
.troop-modal .troop-detail-content{box-sizing:border-box;min-width:0;min-height:0;padding:58px 30px 30px;overflow-y:auto;overflow-x:hidden;overscroll-behavior:contain;scrollbar-gutter:stable}
.troop-modal .troop-detail-content .troop-detail-section{margin:0 0 22px}
.troop-modal .troop-detail-content .troop-detail-section h3{margin:0 0 9px}
.troop-modal .troop-section-heading{display:flex;align-items:center;justify-content:space-between;flex-wrap:wrap;gap:10px;margin-bottom:10px}
.troop-modal .troop-section-heading h3{margin:0}
.troop-modal .troop-detail-content .troop-stats dt,.troop-modal .troop-detail-content .troop-stats dd{padding:7px 0}
.troop-modal-close{position:absolute;top:13px;right:13px;z-index:5;display:flex;align-items:center;justify-content:center;width:38px;height:38px;min-width:38px;padding:0;border:1px solid var(--line);border-radius:10px;background:var(--panel);color:var(--text);cursor:pointer;font-size:28px;font-weight:400;line-height:1}
.troop-modal-close:hover,.troop-modal-close:focus-visible{color:var(--gold);border-color:var(--gold)}
.troop-modal .troop-detail.is-editing{display:block;box-sizing:border-box;height:100%;padding:60px 24px 24px;overflow-y:auto;overscroll-behavior:contain}
.troop-modal .troop-detail.is-editing .troop-editor,.troop-modal .troop-detail.is-editing .troop-monster-image-editor{width:100%;max-width:100%;box-sizing:border-box}
@media(max-width:720px){
 .troop-modal{width:100vw;height:100dvh;max-height:100dvh;border-radius:0;border:0}
 .troop-modal .troop-detail{grid-template-columns:minmax(0,1fr);grid-template-rows:auto minmax(0,1fr)}
 .troop-modal .troop-detail-head{gap:8px;padding:16px 52px 10px 14px;border-right:0;border-bottom:1px solid var(--line)}
 .troop-modal .troop-detail-title h2{font-size:clamp(18px,5vw,24px)}
 .troop-modal .troop-detail-art{flex:initial;flex-direction:row;flex-wrap:wrap;justify-content:center;gap:10px}
 .troop-modal .troop-detail-art .troop-detail-image{max-width:min(48vw,190px);max-height:min(24dvh,190px)}
 .troop-modal .troop-detail-content{padding:16px 15px 30px}
 .troop-modal .troop-detail-content .troop-detail-section{margin-bottom:18px}
 .troop-modal-close{top:10px;right:10px}
 .troop-modal .troop-detail.is-editing{padding:62px 14px 22px}
}
@media(max-height:540px) and (min-width:721px){.troop-modal{height:calc(100dvh - 16px);max-height:calc(100dvh - 16px)}.troop-modal .troop-detail-head{padding:16px}.troop-modal .troop-detail-art .troop-detail-image{max-height:calc(100dvh - 140px)}}
