:root {
  --bg: #0d2f33;
  --bg2: #14565a;
  --gold: #f2c94c;
  --ink: #e8fff8;
  --panel: #7dff6a;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: "Trebuchet MS", Verdana, sans-serif;
  color: var(--ink);
  background:
    linear-gradient(#081c1f66, #081c1f66),
    url("../assets/fondo.png") center / cover fixed no-repeat,
    #081c1f;
  padding: 16px;
  position: relative;
}

h1 { font-size: 20px; margin: 0 0 4px; }

.bar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  margin: 10px 0 14px;
}

.bar label { font-size: 13px; }

select, input, button {
  font: inherit;
  font-size: 13px;
  border-radius: 6px;
  border: 1px solid #2f7a7f;
  background: #0b2427;
  color: var(--ink);
  padding: 4px 6px;
}

button {
  cursor: pointer;
  background: var(--gold);
  color: #241a00;
  border: 0;
  font-weight: 700;
  padding: 7px 14px;
}

button.alt { background: #1d5f64; color: var(--ink); }

.bar button {
  transition: background-color .15s ease, color .15s ease, border-color .15s ease,
    box-shadow .15s ease, transform .08s ease;
}

.bar button:hover:not(:disabled) { background: #ffd968; }
.bar button.alt:hover:not(:disabled) { background: #2a7d83; }
.bar button:active:not(:disabled) { transform: translateY(1px); }
.bar button:focus-visible { outline: 2px solid #fff8; outline-offset: 2px; }

.bar button.active {
  background: var(--gold);
  color: #241a00;
  box-shadow: 0 0 0 2px #f2c94c55, 0 0 14px #f2c94c55;
}

.bar button.alt.active {
  background: var(--gold);
  color: #241a00;
}

.bar button.active:hover:not(:disabled) { background: #ffe28a; }
#btnClean.active::after { content: " ✓"; }

#board {
  background: transparent;
  padding: 14px;
  border-radius: 10px;
  display: flex;
  gap: 18px;
  overflow-x: auto;
}

body::before {
  content: "";
  position: fixed;
  top: 12px;
  right: 24px;
  width: 250px;
  height: 145px;
  background: url("../assets/logo.png") center / contain no-repeat;
  opacity: .96;
  pointer-events: none;
  z-index: 0;
}

body > * {
  position: relative;
  z-index: 1;
}

.rows { display: flex; flex-direction: column; gap: 12px; }

.row {
  display: flex;
  align-items: center;
  gap: 6px;
  padding-bottom: 8px;
  border-bottom: 3px solid var(--gold);
}

.row.v { border-bottom: 0; padding-left: 6px; }

.row.dragging { opacity: .45; }
.row.drop-before { box-shadow: 0 -3px 0 var(--gold); }
.row.drop-after { box-shadow: 0 3px 0 var(--gold); }

.drag-handle {
  cursor: grab;
  user-select: none;
  opacity: .5;
  font-size: 13px;
  line-height: 1;
  letter-spacing: -2px;
  padding: 0 2px;
}

.drag-handle:active { cursor: grabbing; }

.row.new-build {
  border-radius: 8px;
  animation: newBuild 2.2s ease;
}

@keyframes newBuild {
  0% { background: #f2c94c66; box-shadow: 0 0 0 3px #f2c94c; }
  60% { background: #f2c94c22; box-shadow: 0 0 0 3px #f2c94c88; }
  100% { background: transparent; box-shadow: none; }
}

.add-row {
  width: 100%;
  padding: 10px 12px;
  border: 2px dashed #2f7a7f;
  border-radius: 8px;
  background: #081c1f;
  color: var(--gold);
  font-weight: 700;
  cursor: pointer;
}

.add-row:hover {
  border-color: var(--gold);
  background: #0d2f33;
}

.badge {
  min-width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--gold);
  color: #241a00;
  font-weight: 800;
  font-size: 12px;
  display: grid;
  place-items: center;
}

.slot {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  width: 68px;
}

.slot-tier {
  position: absolute;
  top: 0;
  left: 6px;
  background: #000a;
  color: var(--gold);
  font-size: 9px;
  font-weight: 700;
  padding: 0 3px;
  border-radius: 3px;
  pointer-events: none;
}

.slot img {
  width: 60px;
  height: 60px;
  background: #0007;
  border-radius: 6px;
  object-fit: contain;
  cursor: pointer;
}

.slot img:hover { outline: 2px solid var(--gold); }
.slot img.err { outline: 2px solid #ff6b6b; }

.slot img.empty-img {
  border: 2px dashed #2f7a7f;
  background: #0007;
  opacity: .85;
}

.slot img.empty-img:hover {
  border-color: var(--gold);
  opacity: 1;
}

.slot-disabled {
  opacity: .58;
  cursor: not-allowed;
  filter: grayscale(.8);
}

.slot-disabled img {
  cursor: not-allowed;
  border-color: #68777a;
}

.slot-disabled-label {
  position: absolute;
  top: 24px;
  left: 3px;
  width: 62px;
  padding: 3px 1px;
  border-radius: 3px;
  background: #10191dcc;
  color: #e8f6f7;
  font-size: 8px;
  font-weight: 800;
  text-align: center;
  letter-spacing: .3px;
  pointer-events: none;
  z-index: 3;
}

.slot-placeholder {
  position: absolute;
  top: 0;
  left: 4px;
  width: 60px;
  height: 60px;
  display: grid;
  place-items: center;
  font-size: 26px;
  font-weight: 800;
  color: var(--gold);
  pointer-events: none;
  z-index: 1;
}

.slot input { width: 68px; font-size: 9px; padding: 2px; }
.slot select { width: 68px; font-size: 10px; padding: 1px; }

.info {
  background: linear-gradient(135deg, #081d26ee, #154148e8);
  color: var(--ink);
  border: 1px solid var(--gold);
  border-radius: 12px;
  padding: 12px 16px;
  min-width: 230px;
  align-self: flex-start;
  font-size: 13px;
  box-shadow: 0 8px 22px #0008;
}

.info h2 {
  margin: 0 0 8px;
  text-align: center;
  color: var(--gold);
  font-size: 18px;
  letter-spacing: 1px;
}

.info p { margin: 6px 0; }
.info p b { color: var(--gold); }
.info .ref-note { font-size: 12px; opacity: .92; }
.info .ref-adjust {
  margin-top: 8px;
  padding-top: 7px;
  border-top: 1px solid #f2c94c55;
}

.clean .slot input,
.clean .slot select,
.clean .vs { display: none; }

.hint {
  font-size: 12px;
  opacity: .8;
  max-width: 860px;
  line-height: 1.5;
}

a { color: var(--gold); }

#picker {
  position: fixed;
  inset: 0;
  background: #031114cc;
  display: grid;
  place-items: center;
  padding: 20px;
  z-index: 100;
}

#picker[hidden] { display: none; }

.picker-box {
  width: min(960px, 100%);
  max-height: 90vh;
  background: #0b2427;
  border: 1px solid #2f7a7f;
  border-radius: 12px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 20px 60px #000a;
}

.picker-head {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 12px;
  border-bottom: 1px solid #2f7a7f;
  background: #0d2f33;
}

#pickerSearch { flex: 1; min-width: 200px; }
#pickerCat { min-width: 160px; }

.picker-tier {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
}

.picker-tier select { width: auto; }

#picker .hint { padding: 0 14px; margin: 8px 0; }

#pickerGrid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 8px;
  padding: 0 14px 14px;
  overflow-y: auto;
}

.pick-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px;
  border-radius: 8px;
  border: 1px solid #1d5f64;
  background: #081c1f;
  color: var(--ink);
  cursor: pointer;
  text-align: left;
}

.pick-item:hover,
.pick-item.sel { border-color: var(--gold); background: #123f43; }

.pick-item img {
  width: 42px;
  height: 42px;
  object-fit: contain;
  background: #0007;
  border-radius: 6px;
  flex: 0 0 auto;
}

.pick-item span { display: block; font-size: 11px; line-height: 1.25; }
.pick-item b { display: block; font-size: 12px; color: var(--gold); word-break: break-word; }
.pick-item small { display: block; font-size: 10px; opacity: .7; }

#pickerMat { min-width: 140px; }

.tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 0 0 12px;
}

.tab {
  background: #1d5f64;
  color: var(--ink);
  border: 1px solid #2f7a7f;
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 13px;
  font-weight: 600;
}

.tab:hover { background: #2a7d83; }

.tab.active {
  background: var(--gold);
  color: #241a00;
  border-color: var(--gold);
}

.tab span {
  margin-left: 5px;
  font-size: 11px;
  opacity: .75;
}

.tab.add {
  background: transparent;
  border-style: dashed;
  color: var(--gold);
}

.row-tools {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-left: 6px;
}

.row-tools select {
  width: 98px;
  font-size: 11px;
  padding: 2px;
}

.row-tools .del {
  background: #7a1f1f;
  color: #fff;
  padding: 3px 6px;
  font-size: 10px;
}

.row-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 3px;
}

.mini-action {
  padding: 2px 5px;
  font-size: 10px;
  line-height: 1.3;
  border-radius: 4px;
  background: #1d5f64;
  color: var(--ink);
  font-weight: 700;
}

.mini-action:hover:not(:disabled) { background: #2a7d83; }

.mini-action.up,
.mini-action.down {
  min-width: 22px;
  text-align: center;
}

button:disabled {
  opacity: .45;
  cursor: not-allowed;
}

.empty {
  font-size: 13px;
  opacity: .85;
  padding: 12px;
  min-width: 260px;
}

#pickerGrid {
  flex: 1;
  min-height: 0;
}

.pager {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  justify-content: center;
  padding: 10px 14px;
  border-top: 1px solid #2f7a7f;
  background: #0d2f33;
}

.pager[hidden] { display: none; }

.pager-btn {
  background: #1d5f64;
  color: var(--ink);
  border: 1px solid #2f7a7f;
  border-radius: 6px;
  padding: 4px 9px;
  font-size: 12px;
  font-weight: 600;
}

.pager-btn:hover:not(:disabled) { background: #2a7d83; }

.pager-btn.active {
  background: var(--gold);
  color: #241a00;
  border-color: var(--gold);
}

.pager-btn:disabled { opacity: .4; cursor: default; }

.pager-gap { opacity: .6; padding: 0 4px; }

.pager-info {
  font-size: 11px;
  opacity: .75;
  margin-left: 6px;
}

.tab-x {
  display: inline-block;
  margin-left: 7px;
  padding: 0 3px;
  border-radius: 50%;
  opacity: .65;
  font-weight: 700;
}

.tab-x:hover {
  background: #0004;
  opacity: 1;
}

#sectionModal {
  position: fixed;
  inset: 0;
  background: #031114cc;
  display: grid;
  place-items: center;
  padding: 20px;
  z-index: 60;
}

#sectionModal[hidden] { display: none; }

.section-box {
  width: min(940px, 100%);
  max-height: 90vh;
  background: #0b2427;
  border: 1px solid #2f7a7f;
  border-radius: 12px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 20px 60px #000a;
}

.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px 14px;
  border-bottom: 1px solid #2f7a7f;
  background: #0d2f33;
}

.section-head h2 { margin: 0; font-size: 18px; }

.section-name {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 14px 0;
  font-size: 13px;
}

.section-name input { flex: 1; max-width: 420px; }

.section-toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  padding: 12px 14px;
}

.section-toolbar .hint { margin: 0; max-width: none; }

#sectionBuilds {
  flex: 1;
  min-height: 120px;
  overflow-y: auto;
  padding: 0 14px 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.section-build {
  border: 1px solid #1d5f64;
  border-radius: 8px;
  background: #081c1f;
  padding: 8px;
}

.section-build-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
  font-size: 12px;
}

.section-build-head .del {
  background: #7a1f1f;
  color: #fff;
  padding: 3px 8px;
  font-size: 10px;
}

.section-slots {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.mini-slot {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  width: 58px;
  padding: 4px 2px;
  border: 1px solid #1d5f64;
  border-radius: 6px;
  background: #0006;
  color: var(--ink);
}

.mini-tier {
  position: absolute;
  top: 2px;
  right: 2px;
  background: #000a;
  color: var(--gold);
  font-size: 8px;
  font-weight: 700;
  padding: 0 2px;
  border-radius: 3px;
  pointer-events: none;
}

.mini-slot:hover { border-color: var(--gold); }

.mini-slot.slot-disabled {
  opacity: .58;
  cursor: not-allowed;
  filter: grayscale(.8);
}

.mini-slot.slot-disabled img {
  cursor: not-allowed;
  border-color: #68777a;
}

.mini-slot .slot-disabled-label {
  top: 20px;
  width: 52px;
  font-size: 7px;
}

.mini-slot img {
  width: 44px;
  height: 44px;
  object-fit: contain;
  border-radius: 4px;
}

.mini-slot img.err { outline: 2px solid #ff6b6b; }

.mini-slot img.empty-img {
  border: 2px dashed #2f7a7f;
  background: #0007;
  opacity: .85;
}

.mini-slot img.empty-img:hover {
  border-color: var(--gold);
  opacity: 1;
}

.mini-placeholder {
  position: absolute;
  top: 4px;
  left: 50%;
  transform: translateX(-50%);
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  font-size: 22px;
  font-weight: 800;
  color: var(--gold);
  pointer-events: none;
  z-index: 1;
}

.mini-slot small {
  font-size: 8px;
  opacity: .75;
  text-align: center;
  line-height: 1.1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  width: 100%;
}

.section-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  padding: 12px 14px;
  border-top: 1px solid #2f7a7f;
  background: #0d2f33;
}

.section-actions .danger { margin-left: auto; background: #7a1f1f; color: #fff; }

.section-actions .danger:hover { background: #9b2b2b; }


.swal2-popup {
  font-family: inherit;
}

.swal2-confirm {
  color: #241a00 !important;
  font-weight: 800;
}

.swal2-confirm.swal-danger {
  color: #fff !important;
}

.swal2-cancel {
  color: #fff !important;
}

.role-badge {
  font-size: 9px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .4px;
  padding: 3px 5px;
  border-radius: 4px;
  background: #1d5f64;
  color: #fff;
  white-space: nowrap;
}

.role-badge.role-tank { background: #2f6d9e; }
.role-badge.role-healer { background: #2f8f4e; }
.role-badge.role-dps { background: #9e4b2f; }
.role-badge.role-shadowcaller { background: #6b3f9e; }

.slot-add {
  position: absolute;
  top: 30px;
  left: 0;
  width: 32px;
  height: 32px;
  padding: 0;
  border-radius: 4px;
  background: var(--gold);
  color: #241a00;
  font-size: 15px;
  line-height: 1;
  display: grid;
  place-items: center;
  z-index: 2;
  overflow: visible;
}

.slot-add img {
  width: 29px;
  height: 29px;
  object-fit: contain;
  border-radius: 3px;
}

.slot-add.filled {
  background: #0b2a2e;
  border: 1px solid var(--gold);
}

.slot-add:hover { background: #ffe28a; }

.slot-add.filled:hover { background: #123c40; }

.featured-picker {
  pointer-events: auto;
}

.mini-add {
  position: absolute;
  top: 20px;
  left: 0;
  width: 30px;
  height: 30px;
  padding: 0;
  border-radius: 4px;
  background: var(--gold);
  color: #241a00;
  font-size: 13px;
  line-height: 1;
  display: grid;
  place-items: center;
  z-index: 2;
  cursor: pointer;
  overflow: visible;
}

.mini-add img {
  width: 27px;
  height: 27px;
  object-fit: contain;
  border-radius: 3px;
}

.mini-add.filled {
  background: #0b2a2e;
  border: 1px solid var(--gold);
}

.mini-add:hover { background: #ffe28a; }

.mini-add.filled:hover { background: #123c40; }

.featured-picker.mini-add {
  pointer-events: auto;
}

.mini-del {
  position: absolute;
  top: -6px;
  right: -6px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #7a1f1f;
  color: #fff;
  font-size: 10px;
  line-height: 1;
  display: grid;
  place-items: center;
  z-index: 3;
  cursor: pointer;
}

.extras {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-left: 8px;
  padding-left: 8px;
  border-left: 1px dashed #2f7a7f;
}

.extras-label {
  display: none;
  font-size: 9px;
  opacity: .65;
  text-transform: uppercase;
  letter-spacing: .4px;
}

.extra-slot {
  position: relative;
  width: 46px;
  height: 46px;
  flex: 0 0 46px;
  border: 1px solid #1d5f64;
  border-radius: 6px;
  background: #0006;
  display: grid;
  place-items: center;
  cursor: pointer;
}

.extra-slot:hover { border-color: var(--gold); }

.extra-slot img {
  width: 40px;
  height: 40px;
  object-fit: contain;
  border-radius: 4px;
}

.extra-slot img.err { outline: 2px solid #ff6b6b; }

.extra-slot.empty {
  border-style: dashed;
  color: var(--gold);
  font-size: 18px;
  font-weight: 800;
  line-height: 1;
}

.extra-slot.empty small {
  font-size: 7px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .3px;
  max-width: 40px;
  text-align: center;
  line-height: 1;
}

.extra-tier {
  position: absolute;
  top: 0;
  left: 0;
  background: #000a;
  color: var(--gold);
  font-size: 8px;
  font-weight: 700;
  padding: 0 2px;
  border-radius: 3px;
  pointer-events: none;
}

.extra-del {
  position: absolute;
  top: -7px;
  right: -7px;
  width: 18px;
  height: 18px;
  padding: 0;
  border-radius: 50%;
  background: #7a1f1f;
  color: #fff;
  font-size: 12px;
  line-height: 1;
  display: grid;
  place-items: center;
  z-index: 2;
}

.extra-add {
  font-size: 10px;
  padding: 4px 7px;
  background: #1d5f64;
  color: var(--ink);
  border: 1px solid #2f7a7f;
  font-weight: 700;
  white-space: nowrap;
}

.ref-add {
  align-self: center;
  width: 24px;
  height: 24px;
  padding: 0;
  border-radius: 4px;
  background: var(--gold);
  color: #241a00;
  font-size: 16px;
  line-height: 1;
  display: grid;
  place-items: center;
  margin-left: 4px;
}

.ref-add:hover { background: #ffe28a; }

.ref-del {
  position: absolute;
  top: -6px;
  right: -6px;
  width: 16px;
  height: 16px;
  padding: 0;
  border-radius: 50%;
  background: #7a1f1f;
  color: #fff;
  font-size: 11px;
  line-height: 1;
  display: grid;
  place-items: center;
  z-index: 3;
  cursor: pointer;
}

.extra-add:hover { border-color: var(--gold); }

.section-build-head {
  gap: 8px;
  flex-wrap: wrap;
}

.section-build-head .role-select {
  width: 110px;
  font-size: 11px;
  padding: 2px;
}

.section-build .extras {
  margin: 8px 0 0;
  padding: 8px 0 0;
  border-left: 0;
  border-top: 1px dashed #2f7a7f;
  flex-wrap: wrap;
}

.clean .slot-placeholder,
.clean .mini-placeholder,
.clean .slot-add:not(.filled),
.clean .mini-add:not(.filled),
.clean .extra-add,
.clean .extra-del,
.clean .mini-del,
.clean .ref-add,
.clean .ref-del,
.clean .row-tools { display: none; }
