* { box-sizing: border-box; }
:root {
  color-scheme: dark;
  --bg: #0b0e13;
  --panel: #141923;
  --panel2: #1a202c;
  --line: #2a3242;
  --text: #eef2f7;
  --muted: #9ca8ba;
  --accent: #6ea8fe;
  --accent2: #4d8df7;
  --good: #65d69a;
  --warn: #f0c36a;
  --bad: #f27d86;
}
body {
  margin: 0; background: var(--bg); color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
button, input, select { font: inherit; }
button { color: inherit; }
.hero {
  padding: 42px 24px 30px; text-align: center;
  border-bottom: 1px solid var(--line);
  background: radial-gradient(circle at 50% -30%, #24304a, transparent 58%);
}
.eyebrow { margin: 0 0 8px; color: var(--accent); font-size: 12px; font-weight: 800; letter-spacing: .18em; }
h1 { margin: 0; font-size: clamp(28px, 5vw, 46px); }
.subtitle { margin: 10px auto 0; color: var(--muted); max-width: 720px; }
.account-bar {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 10px;
  margin: 12px auto 0;
}
#accountStatus {
  color: var(--muted);
  font-size: 13px;
}
#accountStatus.is-authenticated {
  color: var(--good);
}
.account-bar .secondary-button {
  min-height: 36px;
  padding: 7px 12px;
}
@media (max-width: 480px) {
  .account-bar {
    flex-direction: column;
  }
  .account-bar .secondary-button {
    width: 100%;
    max-width: 220px;
  }
}

.db-status {
  display: inline-block; margin-top: 18px; padding: 7px 12px; border: 1px solid var(--line);
  border-radius: 999px; color: var(--muted); background: rgba(20,25,35,.75); font-size: 12px;
}
.container { width: min(1400px, calc(100% - 32px)); margin: 28px auto 70px; }
.import-panel, .controls, .update-summary {
  background: var(--panel); border: 1px solid var(--line); border-radius: 18px; padding: 20px;
}
.import-panel { margin-bottom: 18px; }
.import-actions { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }
.primary-button, .secondary-button {
  min-height: 44px; padding: 10px 17px; border-radius: 11px; border: 1px solid var(--line);
  cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  transition: .18s ease;
}
.primary-button { background: var(--accent2); border-color: var(--accent2); font-weight: 750; }
.primary-button:hover { filter: brightness(1.08); transform: translateY(-1px); }
.secondary-button { background: var(--panel2); }
.secondary-button:hover { border-color: #46536b; }

.account-mode-switch {
  margin: 14px 0 0;
}

.text-button {
  appearance: none;
  background: transparent;
  border: 0;
  box-shadow: none;
  color: var(--accent2);
  padding: 4px 0;
  font: inherit;
  font-size: 13px;
  font-weight: 650;
  cursor: pointer;
  transition: color .18s ease;
}

.text-button:hover {
  background: transparent;
  color: var(--accent);
  text-decoration: underline;
}

.text-button:focus-visible {
  outline: 2px solid var(--accent2);
  outline-offset: 3px;
}
button:disabled { opacity: .45; cursor: not-allowed; transform: none; }
.file-button input, .primary-button input { display: none; }
.progress-wrap { margin-top: 18px; }
.progress-head { display: flex; justify-content: space-between; gap: 12px; color: var(--muted); font-size: 13px; margin-bottom: 8px; }
progress { width: 100%; height: 10px; accent-color: var(--accent); }
.controls { display: grid; grid-template-columns: minmax(260px, 1fr) minmax(180px, 260px) auto; gap: 14px; margin-bottom: 18px; }
.control-group { display: flex; flex-direction: column; gap: 7px; }
.control-group label { color: var(--muted); font-size: 12px; font-weight: 700; }
input, select {
  width: 100%; min-height: 44px; padding: 9px 12px; border-radius: 10px;
  border: 1px solid var(--line); background: #0f131b; color: var(--text); outline: none;
}

/* V5.8.3.1 — Flecha de dropdown consistente y centrada verticalmente. */
select {
  appearance: none;
  -webkit-appearance: none;
  padding-right: 34px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath d='M3 4.5 6 7.5 9 4.5' fill='none' stroke='%23a9b4c7' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 11px center;
  background-size: 12px 12px;
}
input:focus, select:focus { border-color: var(--accent); }
.reset-button { align-self: end; }
.stats-grid { display: grid; grid-template-columns: repeat(8, 1fr); gap: 10px; margin-bottom: 28px; }
.stat-card {
  min-height: 88px; border: 1px solid var(--line); border-radius: 14px; background: var(--panel);
  padding: 14px; text-align: left; cursor: pointer; transition: .18s ease;
}
.stat-card:hover { border-color: #46536b; transform: translateY(-1px); }
.stat-card.active { border-color: var(--accent); box-shadow: 0 0 0 1px rgba(110,168,254,.2) inset; }
.stat-card span { display: block; color: var(--muted); font-size: 12px; }
.stat-card strong { display: block; margin-top: 7px; font-size: 25px; }
.collection-header { display: flex; align-items: end; justify-content: space-between; gap: 20px; margin: 10px 0 14px; }
.collection-header h2 { margin: 0; }
.collection-header p { margin: 5px 0 0; color: var(--muted); font-size: 13px; }
.sync-meta { color: var(--muted); font-size: 12px; }
.cards-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(165px, 1fr)); gap: 18px; }
.card {
  overflow: hidden; border: 1px solid var(--line); border-radius: 14px; background: var(--panel);
  position: relative;
}
.card img { width: 100%; aspect-ratio: 0.715; display: block; object-fit: cover; background: #202632; }

/* V5.7.4 — cartas completamente asignadas a mazos */
.card img.card-image-allocated {
  filter: grayscale(80%);
}

.card-body { padding: 11px 12px 13px; }
.card-name { margin: 0; font-size: 14px; font-weight: 750; line-height: 1.25; }
.card-type { margin: 5px 0 0; color: var(--muted); font-size: 11px; line-height: 1.35; }
.badge {
  position: absolute; top: 8px; right: 8px; padding: 4px 7px; border-radius: 999px;
  background: rgba(0,0,0,.78); border: 1px solid rgba(255,255,255,.15); font-size: 11px; font-weight: 800;
}
.badge-unavailable {
  background: rgba(170, 34, 45, .92);
  border-color: rgba(255, 130, 140, .65);
  color: #fff;
}
.commander-badge { left: 8px; right: auto; background: rgba(76,126,218,.92); }
.empty-state {
  padding: 70px 20px; text-align: center; border: 1px dashed var(--line); border-radius: 18px;
  color: var(--muted);
}
.empty-state h3 { color: var(--text); margin-top: 0; }
.hidden { display: none !important; }
.update-summary { margin-bottom: 18px; }
.update-summary h3 { margin: 0 0 14px; }
.diff-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.diff-item { padding: 13px; border-radius: 12px; background: var(--panel2); }
.diff-item strong { display: block; font-size: 23px; }
.diff-item span { color: var(--muted); font-size: 12px; }
.diff-item.added strong { color: var(--good); }
.diff-item.changed strong { color: var(--warn); }
.diff-item.removed strong { color: var(--bad); }
.modal {
  position: fixed; inset: 0; background: rgba(0,0,0,.7); display: grid; place-items: center;
  padding: 20px; z-index: 20;
}
.modal-card {
  width: min(760px, 100%); max-height: 85vh; overflow: auto; background: var(--panel);
  border: 1px solid var(--line); border-radius: 18px; padding: 22px;
}
.modal-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.modal-head h2 { margin: 0; }
.icon-button { background: transparent; border: 0; font-size: 28px; cursor: pointer; color: var(--muted); }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 20px; }
.change-list { max-height: 330px; overflow: auto; margin-top: 15px; border-top: 1px solid var(--line); }
.change-row { display: flex; justify-content: space-between; gap: 15px; padding: 9px 0; border-bottom: 1px solid var(--line); font-size: 13px; }
.change-row small { color: var(--muted); }
@media (max-width: 1100px) { .stats-grid { grid-template-columns: repeat(4, 1fr); } }
@media (max-width: 760px) {
  .container { width: min(100% - 20px, 1400px); }
  .controls { grid-template-columns: 1fr; }
  .reset-button { width: 100%; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .diff-grid { grid-template-columns: repeat(2, 1fr); }
  .collection-header { align-items: start; flex-direction: column; }
}


.color-filter-panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 18px 20px;
  margin: -10px 0 28px;
}
.color-filter-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin-bottom: 14px;
}
.color-filter-header h2 {
  margin: 0;
  font-size: 18px;
}
.color-filter-header p {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 12px;
}
.small-button {
  min-height: 36px;
  padding: 7px 12px;
  font-size: 12px;
}
.color-options {
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
}
.color-option {
  min-height: 40px;
  padding: 8px 13px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--panel2);
  cursor: pointer;
  transition: .18s ease;
}
.color-option:hover {
  border-color: #46536b;
  transform: translateY(-1px);
}
.color-option.selected {
  border-color: var(--accent);
  background: rgba(78, 141, 247, .16);
  box-shadow: 0 0 0 1px rgba(110,168,254,.15) inset;
}
.colorless-option.selected {
  border-color: #d7dce5;
  background: rgba(215,220,229,.1);
}
.color-filter-summary {
  margin-top: 10px;
  color: var(--muted);
  font-size: 12px;
}
@media (max-width: 760px) {
  .color-filter-header { align-items: flex-start; flex-direction: column; }
}


.import-meta {
  display: flex;
  justify-content: flex-end;
  margin-top: 12px;
  color: var(--muted);
  font-size: 12px;
}
.color-filter-panel {
  margin: 0 0 14px;
}


/* V5.2 — interacción y vista ampliada de cartas */
.card {
  cursor: pointer;
  transition: transform .18s ease, border-color .18s ease, box-shadow .18s ease;
}
.card:hover {
  transform: translateY(-5px) scale(1.015);
  border-color: #4b5971;
  box-shadow: 0 12px 28px rgba(0,0,0,.28);
}
.card img {
  transition: filter .18s ease, transform .18s ease;
}
.card:hover img {
  filter: brightness(1.06);
}
.card:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}
.card-detail-modal {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 28px;
  background: rgba(4, 6, 10, .82);
  backdrop-filter: blur(5px);
}
.card-detail-shell {
  width: min(1120px, 100%);
  max-height: min(820px, 92vh);
  display: grid;
  grid-template-columns: minmax(300px, .95fr) minmax(300px, .8fr);
  gap: 28px;
  align-items: center;
  padding: 28px;
  background: #111620;
  border: 1px solid #354055;
  border-radius: 22px;
  box-shadow: 0 28px 80px rgba(0,0,0,.48);
  overflow: auto;
}
.card-detail-info {
  align-self: stretch;
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-width: 0;
}
.card-detail-name {
  margin: 0 0 8px;
  font-size: clamp(25px, 3vw, 38px);
  line-height: 1.08;
}
.card-detail-type {
  margin: 0 0 18px;
  color: var(--muted);
  font-size: 14px;
}
.card-detail-section {
  border-top: 1px solid var(--line);
  padding: 13px 0;
}
.card-detail-section:first-of-type {
  border-top: 0;
}
.card-detail-label {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .08em;
  margin-bottom: 6px;
}
.card-detail-value {
  line-height: 1.55;
  white-space: pre-line;
}
.card-detail-meta {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
}
.card-detail-meta > div {
  padding: 10px;
  border-radius: 10px;
  background: var(--panel2);
}
.card-detail-meta strong {
  display: block;
  margin-top: 3px;
}
.card-detail-preview {
  display: flex;
  justify-content: center;
  align-items: center;
  min-width: 0;
}
.card-face-flip {
  position: absolute;
  right: 12px;
  bottom: 12px;
  z-index: 3;
  width: 42px;
  height: 42px;
  border: 1px solid rgba(255,255,255,.35);
  border-radius: 50%;
  background: rgba(12,16,24,.88);
  color: #fff;
  font-size: 28px;
  line-height: 1;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(0,0,0,.35);
}
.card-face-flip:hover { background: rgba(50,65,90,.96); }

.card-detail-preview img {
  display: block;
  width: min(100%, 430px);
  max-height: 82vh;
  object-fit: contain;
  border-radius: 4.5%;
  box-shadow: 0 18px 45px rgba(0,0,0,.45);
}
.card-detail-no-image {
  width: min(100%, 430px);
  aspect-ratio: .715;
  display: grid;
  place-items: center;
  border: 1px dashed var(--line);
  border-radius: 18px;
  color: var(--muted);
}
@media (max-width: 820px) {
  .card-detail-modal {
    padding: 12px;
  }
  .card-detail-shell {
    grid-template-columns: 1fr;
    max-height: 94vh;
    padding: 18px;
    gap: 18px;
  }
  .card-detail-preview {
    order: -1;
  }
  .card-face-flip {
  position: absolute;
  right: 12px;
  bottom: 12px;
  z-index: 3;
  width: 42px;
  height: 42px;
  border: 1px solid rgba(255,255,255,.35);
  border-radius: 50%;
  background: rgba(12,16,24,.88);
  color: #fff;
  font-size: 28px;
  line-height: 1;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(0,0,0,.35);
}
.card-face-flip:hover { background: rgba(50,65,90,.96); }

.card-detail-preview img {
    width: min(72vw, 350px);
    max-height: 58vh;
  }
}

/* V5.3 */
.color-filter-panel { padding: 10px 14px; margin: 0 0 14px; }
.color-filter-header, .color-filter-summary { display: none; }
.color-filter-controls { display: flex; align-items: center; justify-content: space-between; gap: 14px; }
.color-options { display: flex; gap: 6px; align-items: center; }
.color-option { width: 38px; height: 34px; min-height: 34px; padding: 3px; display: grid; place-items: center; border-radius: 9px; font-size: 18px; }
.toggle-control { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; color: var(--muted); font-size: 12px; user-select: none; }
.toggle-control input { position: absolute; opacity: 0; pointer-events: none; }
.toggle-slider { position: relative; width: 34px; height: 20px; border-radius: 999px; background: #303849; border: 1px solid var(--line); transition: .18s ease; }
.toggle-slider::after { content: ""; position: absolute; top: 3px; left: 3px; width: 12px; height: 12px; border-radius: 50%; background: #aeb7c6; transition: .18s ease; }
.toggle-control input:checked + .toggle-slider { background: var(--accent2); border-color: var(--accent2); }
.toggle-control input:checked + .toggle-slider::after { left: 17px; background: white; }
.import-meta { display: flex; justify-content: space-between; gap: 18px; }
.search-row { display: flex; align-items: center; gap: 10px; }
.search-row input { min-width: 0; flex: 1; }
.selected-commander { flex: 0 0 auto; min-height: 44px; max-width: 290px; padding: 6px 8px 6px 11px; display: flex; align-items: center; gap: 8px; border: 1px solid var(--accent); border-radius: 10px; background: rgba(78, 141, 247, .12); }
.selected-commander img { width: 31px; height: 31px; object-fit: cover; border-radius: 4px; }
.selected-commander-name { font-size: 12px; font-weight: 750; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.selected-commander-clear { border: 0; background: transparent; color: var(--muted); cursor: pointer; font-size: 18px; padding: 1px 4px; }
.commander-build-button { margin-top: 12px; width: 100%; min-height: 46px; }
@media (max-width: 760px) {
  .import-meta { flex-direction: column; gap: 5px; }
  .search-row { align-items: stretch; flex-direction: column; }
  .selected-commander { max-width: none; }
}

/* V5.4 */
.search-controls {
  grid-template-columns: minmax(300px, 1fr) minmax(170px, 220px) auto;
}
.stat-filter-row {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: repeat(4, minmax(120px, 1fr));
  gap: 10px;
  padding-top: 4px;
  border-top: 1px solid var(--line);
}
.numeric-filter {
  display: flex;
  flex-direction: column;
  gap: 7px;
}
.numeric-filter label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}
.color-filter-controls {
  flex-wrap: wrap;
  justify-content: flex-start;
}
@media (max-width: 900px) {
  .search-controls {
    grid-template-columns: 1fr 1fr;
  }
  .search-controls .search-group {
    grid-column: 1 / -1;
  }
  .stat-filter-row {
    grid-template-columns: repeat(2, 1fr);
  }
}
@media (max-width: 600px) {
  .search-controls {
    grid-template-columns: 1fr;
  }
  .stat-filter-row {
    grid-template-columns: 1fr 1fr;
  }
}

/* V5.5 — commander lateral y rendimiento del grid */
.commander-layout {
  display: grid;
  grid-template-columns: 190px minmax(0, 1fr);
  gap: 22px;
  align-items: start;
}
/* Sin comandante, conservar exactamente el flujo de una sola columna de V5.4. */
.commander-layout.no-commander {
  display: block;
}
.commander-layout.no-commander .commander-main {
  width: 100%;
}
.commander-main { min-width: 0; }
.commander-panel {
  position: sticky;
  top: 18px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 12px;
  background: var(--panel);
  border: 1px solid var(--accent);
  border-radius: 18px;
  box-shadow: 0 14px 34px rgba(0,0,0,.22);
}
.commander-preview-button {
  width: 100%;
  border: 0;
  padding: 0;
  background: transparent;
  color: inherit;
  text-align: left;
  cursor: pointer;
}
.commander-panel-image {
  width: 100%;
  aspect-ratio: .715;
  overflow: hidden;
  border-radius: 7%;
  background: var(--panel2);
}
.commander-panel-image img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: contain;
}
.commander-panel-no-image {
  width: 100%;
  height: 100%;
  display: grid;
  place-items: center;
  color: var(--muted);
  font-size: 12px;
}
.commander-panel-name {
  margin-top: 9px;
  font-size: 14px;
  font-weight: 800;
  line-height: 1.25;
}
.commander-panel-hint {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 11px;
}
.commander-panel-clear {
  width: 100%;
  min-height: 34px;
  padding: 7px 8px;
  font-size: 11px;
}
.search-row { display: block; }
.selected-commander { display: none !important; }
.card-detail-modal img { content-visibility: auto; }
.cards-grid .card img { contain: layout paint; }
@media (max-width: 900px) {
  .commander-layout { grid-template-columns: 150px minmax(0, 1fr); gap: 14px; }
}
@media (max-width: 760px) {
  .commander-layout { grid-template-columns: 1fr; }
  .commander-panel { position: relative; top: auto; width: min(210px, 100%); justify-self: center; }
}

/* V5.5.4 UI cleanup */
.filter-inline-control {
  min-width: 0;
}
.filter-controls-row,
.filters-row,
.search-filters-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}
.stats-grid,
.stats-row,
.collection-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  align-items: stretch;
  gap: 10px;
}
.stat-card,
.stat-box {
  min-height: 72px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}
.scroll-top-button {
  position: fixed;
  right: 24px;
  bottom: 24px;
  width: 46px;
  height: 46px;
  border: 0;
  border-radius: 50%;
  display: none;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 1000;
  font-size: 22px;
  box-shadow: 0 6px 20px rgba(0,0,0,.22);
}
.scroll-top-button.visible {
  display: flex;
}
@media (max-width: 900px) {
  .stats-grid,
  .stats-row,
  .collection-stats {
    grid-template-columns: repeat(4, minmax(100px, 1fr));
  }
}

/* V5.5.5 — Subtype + CMC are peers in the same filter row */
.filter-inline-control {
  height: 40px;
  box-sizing: border-box;
}
.filter-controls-row,
.filters-row,
.search-filters-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}

/* V5.5.6 — CMC immediately beside Subtipo */
.filter-inline-control {
  display: inline-block;
  vertical-align: middle;
}

/* V5.5.7 — Subtipo + CMC are structurally adjacent */
.subtype-cmc-row {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: flex-start;
  gap: 10px;
  width: 100%;
  margin: 0;
  padding: 0;
}
.subtype-cmc-row select {
  flex: 0 0 auto;
  width: auto;
  min-width: 150px;
  box-sizing: border-box;
}
.subtype-cmc-row #subtypeFilter {
  min-width: 180px;
}
.subtype-cmc-row #cmcFilter {
  min-width: 100px;
}
@media (max-width: 640px) {
  .subtype-cmc-row {
    flex-wrap: wrap;
  }
}
/* V5.5.8 — buscador + Subtipo + CMC en una sola fila */
.search-controls {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 180px 100px auto;
  align-items: end;
  gap: 12px;
}
.search-controls .search-group,
.search-controls .subtype-group,
.search-controls .cmc-group {
  min-width: 0;
}
.search-controls .filter-inline-control {
  width: 100%;
  min-width: 0;
}
.search-controls .reset-button {
  align-self: end;
  white-space: nowrap;
}
@media (max-width: 900px) {
  .search-controls {
    grid-template-columns: minmax(0, 1fr) 170px 100px;
  }
  .search-controls .reset-button {
    grid-column: 1 / -1;
    width: 100%;
  }
}
@media (max-width: 650px) {
  .search-controls {
    grid-template-columns: 1fr;
  }
  .search-controls .reset-button {
    grid-column: auto;
  }
}

/* V5.6 — card detail */
.card-detail-type {
  color: var(--text);
}
.card-detail-type strong {
  font-weight: 800;
}
.mana-cost-visual {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 30px;
}
.generic-mana {
  min-width: 30px;
  height: 30px;
  padding: 0 7px;
  box-sizing: border-box;
  border: 1px solid #8b93a5;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  background: #dfe3ea;
  color: #171a20;
}
.mana-circle {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(255,255,255,.38);
  box-shadow: inset 0 1px 2px rgba(255,255,255,.35), 0 1px 3px rgba(0,0,0,.28);
}
.mana-white { background: #eee8d2; }
.mana-blue { background: #4d8fce; }
.mana-black { background: #25252b; }
.mana-red { background: #d45a55; }
.mana-green { background: #55a85b; }
.mana-colorless { background: #9da4ad; }
.mana-hybrid {
  width: auto;
  min-width: 30px;
  padding: 0 5px;
  background: #8d8f98;
  color: #fff;
  font-size: 10px;
}
.mana-text {
  font-weight: 800;
}
.collection-printing-line {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  line-height: 1.3;
  font-weight: 700;
}
.collection-printing-line span + span::before {
  content: "·";
  margin-right: 12px;
  color: var(--muted);
}
.commander-check {
  color: #49c96b;
  font-weight: 900;
  margin-right: 7px;
}
.commander-status .card-detail-value {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px;
}

/* V5.6.1 — metadata includes Set */
.card-detail-meta {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}
@media (max-width: 700px) {
  .card-detail-meta {
    grid-template-columns: 1fr;
  }
}

/* V5.6.2 — collection printing metadata */
.collection-printing-line {
  gap: 10px;
}
.collection-printing-line span {
  white-space: nowrap;
}

/* V5.6.3 — Scryfall refresh button */
.scryfall-refresh-button {
  width: 44px;
  min-width: 44px;
  padding: 0;
  font-size: 23px;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.scryfall-refresh-button:hover:not(:disabled) {
  transform: rotate(-20deg);
}

/* V5.7 — gestión de mazos e inventario */
.app-nav {
  display: flex;
  justify-content: center;
  gap: 8px;
  padding: 12px 20px;
  border-bottom: 1px solid var(--line);
  background: #0e1219;
  position: sticky;
  top: 0;
  z-index: 15;
}
.nav-tab {
  min-height: 40px;
  padding: 8px 18px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel2);
  cursor: pointer;
  font-weight: 750;
}
.nav-tab.active { background: rgba(78,141,247,.18); border-color: var(--accent); }
.view-section { min-height: 50vh; }
.view-heading, .deck-builder-topbar, .deck-section-heading {
  display: flex; align-items: center; justify-content: space-between; gap: 18px;
}
.view-heading { margin: 10px 0 22px; }
.view-heading h2 { margin: 0; font-size: 30px; }
.view-heading p:not(.eyebrow) { color: var(--muted); margin: 7px 0 0; }
.decks-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 18px;
}
.deck-card { overflow: hidden; border: 1px solid var(--line); border-radius: 18px; background: var(--panel); display: flex; flex-direction: column; height: 100%; }
.deck-card-image { aspect-ratio: 1.55; background: #0d1118; display: grid; place-items: center; overflow: hidden; color: var(--muted); }
.deck-card-image img { width: 100%; height: 100%; object-fit: cover; }
.deck-card-body { padding: 12px; display: flex; flex-direction: column; flex: 1; min-width: 0; }
.deck-card-body h3 { margin: 0; font-size: 18px; line-height: 1.2; min-height: 2.4em; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; line-clamp: 2; overflow: hidden; overflow-wrap: anywhere; }
.deck-card-body p { color: var(--muted); margin: 4px 0 8px; line-height: 1.25; min-height: 2.5em; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; line-clamp: 2; overflow: hidden; overflow-wrap: anywhere; }
.deck-card-meta { display: flex; justify-content: space-between; align-items: center; gap: 10px; min-height: 20px; margin-top: auto; margin-bottom: 9px; color: var(--muted); font-size: 13px; }
.deck-card-meta span:last-child { text-align: right; white-space: nowrap; }
.deck-card .open-deck-button { margin-top: auto; }
.good { color: var(--good) !important; }
.warn { color: var(--warn) !important; }
.bad { color: var(--bad) !important; }
.deck-card .primary-button { width: 100%; }
.deck-builder-topbar { padding: 12px 0 20px; border-bottom: 1px solid var(--line); margin-bottom: 20px; }
.deck-title-block { flex: 1; }
.deck-title-block h2 { margin: 0 0 4px; }
.deck-title-block div { color: var(--muted); font-size: 13px; }
.deck-actions { display: flex; gap: 8px; }
.deck-builder-layout { display: grid; grid-template-columns: 270px minmax(0,1fr); gap: 20px; align-items: start; }
.deck-sidebar { position: sticky; top: 74px; display: grid; gap: 14px; }
.deck-builder-commander, .deck-builder-stats, .deck-notes, .deck-section-heading {
  background: var(--panel); border: 1px solid var(--line); border-radius: 16px; padding: 15px;
}
.deck-builder-commander-image { aspect-ratio: .716; overflow: hidden; border-radius: 12px; background: #0b0e13; display: grid; place-items: center; margin-bottom: 12px; }
.deck-builder-commander-image { cursor: pointer; position: relative; z-index: 1; transition: transform .18s ease, box-shadow .18s ease; transform-origin: center center; }
.deck-builder-commander-image img { width: 100%; height: 100%; object-fit: cover; }
.deck-builder-commander-image:hover, .deck-builder-commander-image:focus-within { transform: scale(1.16); z-index: 5; box-shadow: 0 20px 42px rgba(0,0,0,.44); }
.deck-commander-placeholder { color: var(--muted); text-align: center; padding: 20px; }
.deck-builder-commander h3 { margin: 0 0 12px; }
.deck-builder-commander label, .deck-notes label { display: block; color: var(--muted); font-size: 12px; font-weight: 750; margin-bottom: 7px; }
.deck-builder-stats { display: grid; gap: 7px; color: var(--muted); font-size: 13px; }
.deck-notes textarea { width: 100%; resize: vertical; min-height: 130px; border: 1px solid var(--line); border-radius: 10px; background: #0f131b; color: var(--text); padding: 10px; outline: none; margin-bottom: 8px; }
.deck-notes textarea:focus { border-color: var(--accent); }
.deck-section-heading { margin-bottom: 12px; }
.deck-section-heading h3 { margin: 0; }
.deck-section-heading p { margin: 4px 0 0; color: var(--muted); font-size: 12px; }
.deck-search-heading { margin-top: 22px; }
.deck-search-input { margin-bottom: 12px; }
.deck-current-cards { display: grid; gap: 8px; }
.deck-current-card, .deck-candidate {
  display: grid; grid-template-columns: 52px minmax(0,1fr) auto; gap: 12px; align-items: center;
  background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 7px;
}
.deck-current-card img, .deck-candidate img { width: 52px; height: 72px; object-fit: cover; border-radius: 7px; background: #0b0e13; }
.deck-current-card-body, .deck-candidate-info { min-width: 0; display: grid; gap: 4px; }
.deck-current-card-body strong, .deck-candidate-info strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.deck-current-card-body span, .deck-candidate-info span { color: var(--muted); font-size: 12px; }
.deck-current-card-no-image { width: 52px; height: 72px; display: grid; place-items: center; background: #0b0e13; border-radius: 7px; color: var(--muted); }
.remove-card-button, .add-card-button { width: 40px; min-width: 40px; padding: 7px; }
.deck-search-results { display: grid; gap: 8px; }
.deck-candidate.disabled { opacity: .48; }
.deck-candidate-actions { display: flex; align-items: center; gap: 8px; }
.deck-dashboard-modal { position: fixed; inset: 0; z-index: 40; background: rgba(0,0,0,.78); padding: 24px; overflow: auto; display: grid; place-items: center; }
.deck-dashboard-card { width: min(1050px,100%); max-height: 92vh; overflow: auto; padding: 24px; border: 1px solid var(--line); border-radius: 20px; background: var(--panel); }
.dashboard-hero { display: grid; grid-template-columns: 150px 1fr; gap: 20px; align-items: center; padding-bottom: 20px; border-bottom: 1px solid var(--line); }
.dashboard-hero h2 { margin: 0 0 5px; font-size: 30px; }
.dashboard-hero p:not(.eyebrow) { color: var(--muted); }
.dashboard-commander-image { width: 150px; aspect-ratio: .716; border-radius: 12px; overflow: hidden; background: #0b0e13; }
.dashboard-commander-image img { width: 100%; height: 100%; object-fit: cover; }
.dashboard-grid { display: grid; grid-template-columns: repeat(auto-fill,minmax(120px,1fr)); gap: 10px; margin: 18px 0; }
.dashboard-stat { padding: 14px; border: 1px solid var(--line); border-radius: 12px; background: var(--panel2); }
.dashboard-stat strong { display: block; font-size: 23px; }
.dashboard-stat span { color: var(--muted); font-size: 12px; }
.dashboard-section { margin-top: 18px; padding-top: 18px; border-top: 1px solid var(--line); }
.dashboard-section h3 { margin-top: 0; }
.dashboard-card-list { display: grid; grid-template-columns: repeat(auto-fill,minmax(245px,1fr)); gap: 8px 14px; }
.dashboard-card-item { display: flex; align-items: center; min-width: 0; gap: 10px; padding: 7px; border: 1px solid rgba(255,255,255,.07); border-radius: 9px; background: rgba(255,255,255,.025); color: inherit; text-align: left; font: inherit; }
.dashboard-card-clickable { cursor: pointer; transition: background .15s ease, border-color .15s ease, transform .15s ease; }
.dashboard-card-clickable:hover, .dashboard-card-clickable:focus-visible { background: rgba(255,255,255,.075); border-color: var(--accent, #7c9cff); outline: none; }
.dashboard-card-clickable:hover { transform: translateY(-1px); }
.dashboard-card-thumb { display: flex; align-items: center; justify-content: center; flex: 0 0 38px; width: 38px; height: 53px; overflow: hidden; border-radius: 4px; background: rgba(255,255,255,.06); color: var(--muted, #999); font-size: 12px; }
.dashboard-card-thumb img { display: block; width: 100%; height: 100%; object-fit: cover; }
.dashboard-card-item-name { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.dashboard-card-item > strong { flex: 0 0 auto; white-space: nowrap; }
.dashboard-card-item:disabled { opacity: .6; }
@media (max-width: 800px) {
  .deck-builder-layout { grid-template-columns: 1fr; }
  .deck-sidebar { position: static; }
  .deck-builder-topbar { align-items: flex-start; flex-wrap: wrap; }
  .dashboard-hero { grid-template-columns: 100px 1fr; }
  .dashboard-commander-image { width: 100px; }
}

/* V5.7.1 — filtros independientes del constructor */
.deck-builder-filters {
  margin: 10px 0 14px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--panel);
}
.deck-filter-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: end;
}
.deck-filter-row .control-group {
  min-width: 130px;
}
.deck-filter-row .reset-button {
  margin-left: auto;
}
.deck-color-filter-panel {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
}
.deck-color-filter-panel .color-options {
  display: flex;
  gap: 5px;
}
.deck-color-filter-panel .color-option {
  width: 34px;
  height: 34px;
  padding: 0;
}
.deck-candidate-info small {
  font-size: 11px;
}
.deck-candidate-info small.good {
  color: var(--success, #76d69a);
}
.deck-candidate-info small.bad {
  color: var(--danger, #ff7676);
}
.deck-candidate-actions button[disabled] {
  cursor: not-allowed;
}
@media (max-width: 700px) {
  .deck-filter-row .control-group {
    flex: 1 1 140px;
  }
  .deck-filter-row .reset-button {
    margin-left: 0;
  }
}

/* V5.7.2 — identidad de color fija y cartas del mazo en la barra lateral */
.deck-builder-sidebar-cards {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 15px;
}
.deck-sidebar-section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}
.deck-sidebar-section-heading h3 {
  margin: 0;
}
.deck-sidebar-section-heading span {
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
}
.deck-builder-sidebar-cards .deck-current-card {
  background: var(--panel2, var(--panel));
}
.deck-builder-sidebar-cards .empty-state {
  margin: 0;
  padding: 14px;
}
.deck-builder-color-identity {
  margin: -3px 0 13px;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel2, var(--panel));
}
.deck-color-identity-label {
  display: block;
  color: var(--muted);
  font-size: 11px;
  font-weight: 750;
  margin-bottom: 4px;
  text-transform: uppercase;
  letter-spacing: .04em;
}
.deck-color-identity-value {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-weight: 800;
}
.deck-color-identity-dots,
.deck-builder-identity-colors {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}
.deck-color-filter-panel {
  padding: 10px 12px;
}
.deck-builder-identity-filter {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 9px;
}
.deck-builder-identity-filter-label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
}
.deck-builder-identity-text {
  font-weight: 800;
}
.mana-color-dot {
  width: 16px;
  height: 16px;
  display: inline-block;
  border-radius: 50%;
  border: 1px solid rgba(255,255,255,.35);
  box-shadow: inset 0 0 0 1px rgba(0,0,0,.18);
  flex: 0 0 16px;
}
.mana-color-W { background: #f1f1df; border-color: #a8a89a; }
.mana-color-U { background: #4b9fe8; }
.mana-color-B { background: #30343b; }
.mana-color-R { background: #e15a4f; }
.mana-color-G { background: #59a968; }
.mana-color-C { background: #9da4ad; }

@media (max-width: 800px) {
  .deck-builder-sidebar-cards {
    order: 2;
  }
  .deck-builder-stats {
    order: 3;
  }
  .deck-notes {
    order: 4;
  }
}


/* V5.7.5 — filtros de disponibilidad */
.availability-toggle {
  white-space: nowrap;
}
@media (max-width: 760px) {
  .availability-toggle {
    white-space: normal;
  }
}


/* V5.7.6 — Agrupación de impresiones y selector de versiones */
.card-printings-section {
  padding-bottom: 4px;
}
.card-printings-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 9px;
  max-height: 230px;
  overflow: auto;
  padding-right: 2px;
}
.card-printing-option {
  display: grid;
  grid-template-columns: 54px minmax(0, 1fr);
  gap: 9px;
  align-items: center;
  min-width: 0;
  padding: 7px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel2);
  text-align: left;
  cursor: pointer;
  transition: border-color .16s ease, background .16s ease;
}
.card-printing-option:hover {
  border-color: #46536b;
}
.card-printing-option.selected {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px rgba(110,168,254,.18) inset;
}
.card-printing-option img,
.card-printing-no-image {
  width: 54px;
  aspect-ratio: .715;
  object-fit: cover;
  border-radius: 5px;
  background: #0d1118;
}
.card-printing-no-image {
  display: grid;
  place-items: center;
  color: var(--muted);
  font-size: 8px;
  text-align: center;
}
.card-printing-option-info {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
  font-size: 10px;
  line-height: 1.25;
  color: var(--muted);
}
.card-printing-option-info strong {
  color: var(--text);
  font-size: 11px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
@media (max-width: 700px) {
  .card-printings-grid {
    grid-template-columns: 1fr;
    max-height: 250px;
  }
}


/* V5.7.7 — asignaciones por mazo en el detalle */
.card-detail-decks-box {
  min-width: 0;
}
.card-detail-deck-list {
  display: flex;
  flex-direction: column;
  gap: 5px;
  margin-top: 4px;
}
.card-detail-deck-link {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--text);
  text-align: left;
  cursor: pointer;
  font: inherit;
}
.card-detail-deck-link span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  text-decoration: underline;
  text-decoration-color: rgba(110,168,254,.5);
  text-underline-offset: 2px;
}
.card-detail-deck-link small {
  flex: 0 0 auto;
  color: var(--muted);
  font-size: 10px;
}
.card-detail-deck-link:hover span,
.card-detail-deck-link:focus-visible span {
  color: var(--accent);
}
@media (max-width: 700px) {
  .card-detail-deck-list { max-height: 120px; overflow: auto; }
}


/* V5.7.8 — carrusel de impresiones, nombre editable y comandante fijo */
.deck-name-input {
  width: min(520px, 100%);
  border: 1px solid transparent;
  border-radius: 9px;
  background: transparent;
  color: var(--text);
  font: inherit;
  font-size: 28px;
  font-weight: 800;
  line-height: 1.15;
  padding: 2px 6px;
  margin: -2px 0 2px -6px;
  outline: none;
}
.deck-name-input:hover,
.deck-name-input:focus {
  border-color: var(--line);
  background: var(--panel2, var(--panel));
}
.card-carousel {
  position: relative;
  width: 100%;
  height: 100%;
  display: grid;
  place-items: center;
}
.card-carousel > img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}
.card-carousel-arrow {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 42px;
  height: 64px;
  border: 1px solid rgba(255,255,255,.18);
  border-radius: 12px;
  background: rgba(8,11,16,.72);
  color: var(--text);
  font-size: 38px;
  line-height: 1;
  cursor: pointer;
  display: grid;
  place-items: center;
  backdrop-filter: blur(5px);
  transition: background .15s ease, border-color .15s ease, transform .15s ease;
}
.card-carousel-arrow:hover,
.card-carousel-arrow:focus-visible {
  background: rgba(20,26,37,.9);
  border-color: var(--accent);
}
.card-carousel-arrow:active {
  transform: translateY(-50%) scale(.96);
}
.card-carousel-prev { left: 8px; }
.card-carousel-next { right: 8px; }
.printing-quantity-badge {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 3;
  min-width: 32px;
  height: 26px;
  padding: 0 8px;
  border-radius: 999px;
  background: rgba(8,11,16,.82);
  border: 1px solid rgba(255,255,255,.2);
  color: var(--text);
  font-size: 12px;
  font-weight: 800;
  line-height: 26px;
  text-align: center;
  box-shadow: 0 3px 10px rgba(0,0,0,.28);
  pointer-events: none;
}
.card-carousel-indicator {
  position: absolute;
  bottom: 10px;
  left: 50%;
  transform: translateX(-50%);
  padding: 4px 9px;
  border-radius: 999px;
  background: rgba(8,11,16,.72);
  color: var(--text);
  font-size: 11px;
  font-weight: 750;
  pointer-events: none;
}
@media (max-width: 700px) {
  .deck-name-input { font-size: 23px; }
  .card-carousel-arrow { width: 36px; height: 54px; font-size: 32px; }
}


/* V5.7.9 — constructor más compacto y candidatos disponibles únicamente */
.deck-builder-availability-note {
  margin: 8px 2px 0;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.4;
}
.deck-sidebar-heading-actions {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.deck-collapse-button {
  width: 28px;
  height: 28px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel2, var(--panel));
  color: var(--text);
  cursor: pointer;
  font-size: 18px;
  line-height: 1;
}
.deck-collapse-button:hover,
.deck-collapse-button:focus-visible {
  border-color: var(--accent);
}
.deck-cards-collapsible.is-collapsed {
  display: none;
}


/* V5.7.10 */
.deck-search-helper { margin: 12px 0 10px; color: var(--text); font-size: 14px; line-height: 1.45; }
.deck-card-clickable { cursor: pointer; }
.deck-card-clickable:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.deck-card-clickable:hover { border-color: var(--accent); }

/* V5.7.13.2 — Cartas del mazo: comportamiento de V5.7.10.
   El panel permanece en la barra lateral, arriba de las notas, y usa listado vertical. */
.deck-builder-current-cards-section {
  grid-column: auto;
  grid-row: auto;
  width: auto;
  align-self: auto;
}
.deck-builder-current-cards-section.is-expanded {
  grid-column: auto;
  grid-row: auto;
  width: auto;
}
.deck-current-cards {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
}
.deck-current-card {
  display: grid;
  grid-template-columns: 52px minmax(0,1fr) auto;
  gap: 12px;
  align-items: center;
  min-width: 0;
  padding: 7px;
}
.deck-current-card img,
.deck-current-card-no-image {
  width: 52px;
  height: 72px;
  aspect-ratio: auto;
  object-fit: cover;
  border-radius: 7px;
}
.deck-current-card-body {
  min-width: 0;
  display: grid;
  gap: 4px;
}
.deck-current-card-body strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.deck-current-card-body span {
  color: var(--muted);
  font-size: 12px;
}
.deck-current-card .remove-card-button {
  width: 40px;
  min-width: 40px;
}
@media (max-width: 800px) {
  .deck-builder-current-cards-section,
  .deck-builder-current-cards-section.is-expanded {
    grid-column: auto;
    grid-row: auto;
  }
}

/* V5.7.15 — constructor en tres columnas y filtro de color integrado */
.deck-builder-layout {
  grid-template-columns: 270px minmax(0, 1fr) 360px;
  gap: 20px;
  align-items: start;
}
.deck-current-cards-column {
  min-width: 0;
  align-self: start;
}
.deck-builder-current-cards-section,
.deck-builder-current-cards-section.is-expanded {
  width: 100%;
  grid-column: auto;
  grid-row: auto;
}
.deck-color-filter-inline {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  min-height: 40px;
}
.deck-color-filter-inline .deck-builder-identity-filter-label {
  margin-right: 2px;
}
.deck-color-filter-inline .deck-builder-color-options {
  display: flex;
  align-items: center;
  gap: 5px;
}
.deck-color-filter-inline .color-option {
  width: 32px;
  height: 32px;
  padding: 0;
}
.deck-color-toggle {
  white-space: nowrap;
}
@media (max-width: 1150px) {
  .deck-builder-layout {
    grid-template-columns: 250px minmax(0, 1fr);
  }
  .deck-current-cards-column {
    grid-column: 1 / -1;
    grid-row: 3;
  }
}
@media (max-width: 800px) {
  .deck-builder-layout {
    grid-template-columns: 1fr;
  }
  .deck-current-cards-column {
    grid-column: auto;
    grid-row: auto;
  }
}

/* V5.7.17 — buscador antes de filtros y color como penúltimo control */
.deck-search-helper {
  margin: 0 0 8px;
  font-size: 15px;
  line-height: 1.45;
}
.deck-search-input {
  margin-bottom: 10px;
}
.deck-builder-filters {
  margin: 0 0 14px;
}
.deck-filter-row {
  align-items: end;
}
.deck-color-filter-inline {
  min-width: 150px;
}
.deck-clear-filters-icon {
  width: 42px;
  min-width: 42px;
  height: 42px;
  padding: 0;
  display: inline-grid;
  place-items: center;
  font-size: 17px;
  line-height: 1;
  margin-left: auto;
}
.deck-clear-filters-icon:hover,
.deck-clear-filters-icon:focus-visible {
  border-color: var(--accent);
}
@media (max-width: 900px) {
  .deck-clear-filters-icon {
    margin-left: 0;
  }
}

/* V5.7.18 — filtro de color en fila propia y botón de limpiar más discreto */
.deck-filter-color-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 10px;
}
.deck-filter-color-row .deck-color-filter-inline {
  min-width: 0;
}
.deck-clear-filters-icon {
  font-size: 20px;
  font-weight: 700;
}
@media (max-width: 700px) {
  .deck-filter-color-row {
    width: 100%;
  }
}


/* V5.8.7a — escritorio: filtros activos, vacíos claros y estados de carta. */
@media (min-width: 901px) {
  .search-controls { align-items: stretch; }
  .search-controls .control-group { justify-content: flex-end; }
  .search-controls .control-group label { min-height: 16px; }
  .search-controls input,
  .search-controls select,
  .search-controls .reset-button { min-height: 42px; height: 42px; }
  .search-controls .reset-button { align-self: flex-end; }
  .color-filter-controls { min-height: 42px; align-items: center; }
  .filter-inline-control { background-position: right 12px center; }
  .active-filters-panel {
    display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
    margin: -5px 0 14px; padding: 12px 14px;
    border: 1px solid var(--line); border-radius: 12px; background: rgba(20,25,35,.72);
  }
  .active-filters-panel > strong { font-size: 12px; color: var(--muted); white-space: nowrap; }
  .active-filter-chips { display: flex; flex: 1; flex-wrap: wrap; align-items: center; gap: 7px; }
  .active-filter-chip { display: inline-flex; align-items: center; min-height: 27px; padding: 4px 9px; border-radius: 999px; border: 1px solid rgba(110,168,254,.38); background: rgba(78,141,247,.12); color: #cfe0ff; font-size: 12px; }
  .active-filters-panel .small-button { min-height: 32px; padding: 5px 11px; }
  .search-controls .reset-button.has-active-filters { border-color: var(--accent); color: #d5e4ff; }
  .empty-state { display: flex; flex-direction: column; align-items: center; gap: 10px; }
  .empty-state p { max-width: 760px; line-height: 1.6; }
  .empty-state .secondary-button { margin-top: 4px; }
  .cards-grid .card { transition: transform .16s ease, border-color .16s ease, box-shadow .16s ease; outline: none; }
  .cards-grid .card:hover,
  .cards-grid .card:focus-visible { transform: translateY(-3px); border-color: #586b8c; box-shadow: 0 9px 24px rgba(0,0,0,.24); }
  .cards-grid .card-available { border-color: rgba(101,214,154,.20); }
  .cards-grid .card-unavailable { border-color: rgba(242,125,134,.42); opacity: .78; }
  .cards-grid .card-selected { border-color: var(--accent) !important; box-shadow: 0 0 0 2px rgba(110,168,254,.28); }
  .cards-grid .card-selected::after { content: "Comandante"; position: absolute; left: 8px; bottom: 8px; padding: 4px 7px; border-radius: 6px; background: rgba(45,94,170,.94); color: #fff; font-size: 10px; font-weight: 800; }
}

/* V5.8.7a.1 — panel unificado de filtros de colección (PC). */
.unified-filter-panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 14px 16px;
  margin: 0 0 16px;
}
.unified-filter-panel .search-controls {
  display: grid;
  grid-template-columns: minmax(300px, 1fr) minmax(190px, 230px) minmax(110px, 130px);
  gap: 12px;
  align-items: end;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
}
.unified-filter-panel .search-controls .control-group { min-width: 0; }
.unified-filter-panel .search-controls label {
  display: block;
  margin: 0 0 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 650;
}
.unified-filter-panel .search-controls input,
.unified-filter-panel .search-controls select {
  width: 100%;
  min-width: 0;
  height: 42px;
  min-height: 42px;
}
.unified-filter-panel .search-row { display: flex; min-width: 0; gap: 8px; }
.unified-filter-panel .active-filters-panel {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin: 12px 0 0;
  padding: 10px 0 0;
  border: 0;
  border-top: 1px solid var(--line);
  border-radius: 0;
  background: transparent;
}
.unified-filter-panel .active-filters-panel.hidden { display: none !important; }
.unified-filter-panel .active-filters-panel > strong {
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
}
.unified-filter-panel .active-filter-chips {
  display: flex;
  flex: 1 1 300px;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}
.unified-filter-panel .active-filter-chip {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 4px 9px;
  border: 1px solid rgba(110,168,254,.38);
  border-radius: 999px;
  background: rgba(78,141,247,.12);
  color: #cfe0ff;
  font-size: 12px;
}
.unified-filter-panel .active-filters-panel .small-button {
  min-height: 32px;
  padding: 5px 11px;
  white-space: nowrap;
}
.more-filters {
  margin-top: 12px;
  border-top: 1px solid var(--line);
}
.more-filters > summary {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 38px;
  padding: 7px 2px 0;
  cursor: pointer;
  list-style: none;
  color: var(--text);
  font-size: 13px;
  font-weight: 700;
  user-select: none;
}
.more-filters > summary::-webkit-details-marker { display: none; }
.more-filters > summary::before {
  content: "▸";
  display: inline-block;
  color: var(--accent);
  transition: transform .15s ease;
}
.more-filters[open] > summary::before { transform: rotate(90deg); }
.more-filters-hint { color: var(--muted); font-size: 12px; font-weight: 450; }
.more-filters-content { padding: 12px 0 2px; }
.more-filters-content .color-filter-panel {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 14px 22px;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
}
.more-filters-section-label { color: var(--muted); font-size: 12px; font-weight: 700; }
.more-filters-content .color-options { gap: 7px; }
.more-filters-content .color-option { min-width: 40px; min-height: 38px; padding: 6px 10px; }
.more-filters-content .color-filter-controls {
  display: flex;
  flex: 1 1 520px;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px 20px;
  min-height: 38px;
}
.more-filters-content .toggle-control { white-space: nowrap; }
@media (max-width: 900px) {
  .unified-filter-panel .search-controls { grid-template-columns: minmax(0, 1fr) minmax(150px, .65fr) 100px; }
}
@media (max-width: 650px) {
  .unified-filter-panel { padding: 12px; }
  .unified-filter-panel .search-controls { grid-template-columns: 1fr; }
  .unified-filter-panel .active-filters-panel { align-items: flex-start; }
  .unified-filter-panel .active-filter-chips { flex-basis: 100%; }
  .more-filters-content .color-filter-controls { flex-basis: 100%; }
}


/* V5.8.7b — estado de persistencia, feedback de acciones y limpieza visible. */
.db-status { transition: color .18s ease, border-color .18s ease, background .18s ease; }
.db-status.is-loading { color: var(--warn); border-color: rgba(240,195,106,.35); }
.db-status.is-connected { color: var(--good); border-color: rgba(101,214,154,.35); }
.db-status.is-saving { color: #cfe0ff; border-color: rgba(110,168,254,.5); background: rgba(78,141,247,.12); }
.db-status.is-error { color: #ffd3d6; border-color: rgba(242,125,134,.65); background: rgba(242,125,134,.10); }
.clear-filters-button { color: #ffd6d9 !important; border-color: rgba(242,125,134,.55) !important; background: rgba(150,38,50,.28) !important; }
.clear-filters-button:hover { color: #fff !important; border-color: var(--bad) !important; background: rgba(170,43,56,.45) !important; }
.app-toast { position: fixed; right: 22px; bottom: 22px; z-index: 2000; max-width: min(420px, calc(100vw - 32px)); padding: 12px 16px; border: 1px solid rgba(101,214,154,.45); border-radius: 12px; background: #17241f; color: #d8f8e6; box-shadow: 0 12px 34px rgba(0,0,0,.35); font-size: 13px; line-height: 1.45; opacity: 0; transform: translateY(8px); pointer-events: none; transition: opacity .18s ease, transform .18s ease; }
.app-toast.visible { opacity: 1; transform: translateY(0); }
.app-toast[data-type="error"] { border-color: rgba(242,125,134,.65); background: #30191d; color: #ffe1e4; }


/* V5.8.7c — feedback rojo al retirar cartas y consistencia visual. */
.app-toast[data-type="removed"] { border-color: rgba(242,125,134,.72); background: #351a20; color: #ffe1e4; }

.primary-button:focus-visible, .secondary-button:focus-visible, .icon-button:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible { outline: 2px solid var(--accent2); outline-offset: 2px; }
.modal-actions { gap: 10px; }
.modal-actions button { min-height: 38px; }


/* V5.8.8a — lectura rápida de la lista principal del mazo (escritorio). */
.deck-current-cards-summary {
  margin: 0 0 10px;
  padding: 9px 11px;
  border: 1px solid var(--border, rgba(148, 163, 184, .2));
  border-radius: 9px;
  background: var(--panel2, rgba(148, 163, 184, .06));
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: .01em;
}
.deck-current-card {
  grid-template-columns: 48px minmax(0, 1fr) 36px;
  gap: 10px;
  padding: 9px;
  border: 1px solid var(--border, rgba(148, 163, 184, .18));
  border-radius: 11px;
  background: var(--panel, rgba(148, 163, 184, .035));
  transition: border-color .15s ease, background-color .15s ease, transform .15s ease;
}
.deck-current-card:hover {
  background: var(--panel2, rgba(148, 163, 184, .07));
  transform: translateY(-1px);
}
.deck-current-card img,
.deck-current-card-no-image {
  width: 48px;
  height: 67px;
  border-radius: 6px;
}
.deck-current-card-body {
  gap: 7px;
}
.deck-current-card-body strong {
  white-space: normal;
  overflow-wrap: anywhere;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  line-height: 1.3;
  font-size: 13px;
}
.deck-current-card-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 5px;
  min-width: 0;
}
.deck-current-quantity {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 29px;
  padding: 3px 7px;
  border-radius: 6px;
  background: var(--accent-soft, rgba(120, 140, 255, .14));
  color: var(--text);
  font-size: 12px;
  font-weight: 750;
  white-space: nowrap;
}
.deck-current-availability {
  display: inline-flex;
  align-items: center;
  max-width: 100%;
  padding: 3px 6px;
  border-radius: 6px;
  font-size: 10px;
  line-height: 1.3;
  overflow-wrap: anywhere;
}
.deck-current-availability.is-available {
  color: var(--success, #55c58a);
  background: rgba(46, 160, 100, .10);
}
.deck-current-availability.is-zero {
  color: var(--danger, #ef7777);
  background: rgba(220, 70, 70, .10);
}
.deck-current-card .remove-card-button {
  width: 34px;
  min-width: 34px;
  min-height: 34px;
  border-radius: 8px;
}
@media (prefers-reduced-motion: reduce) {
  .deck-current-card { transition: none; }
  .deck-current-card:hover { transform: none; }
}


/* V5.8.8b — resumen de resultados y filtros activos del buscador de candidatas. */
.deck-candidate-overview {
  display: grid;
  gap: 8px;
  margin: 0 0 10px;
}
.deck-candidate-count {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
}
.deck-active-filters {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}
.deck-active-filter-chip {
  display: inline-flex;
  align-items: center;
  max-width: 100%;
  padding: 4px 9px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--panel2);
  color: var(--text);
  font-size: 11px;
  line-height: 1.35;
  overflow-wrap: anywhere;
}
.deck-candidates-empty {
  display: grid;
  justify-items: start;
  gap: 8px;
  padding: 20px;
  border: 1px dashed var(--line);
  border-radius: 12px;
  background: var(--panel);
}
.deck-candidates-empty strong { color: var(--text); }
.deck-candidates-empty span {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}
.deck-candidates-empty .secondary-button { min-height: 36px; }


/* V5.8.8c — estadísticas legibles del dashboard de Commander */
.dashboard-total { display: inline-block; margin-right: 10px; font-size: 18px; }
.dashboard-legality { display: inline-flex; align-items: center; margin-top: 8px; padding: 5px 9px; border-radius: 999px; font-size: 12px; font-weight: 750; }
.dashboard-legality.is-legal { color: #a7f3c1; background: rgba(34,197,94,.13); border: 1px solid rgba(34,197,94,.28); }
.dashboard-legality.is-illegal { color: #ffd18a; background: rgba(245,158,11,.12); border: 1px solid rgba(245,158,11,.28); }
.dashboard-analytics-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 14px; }
.dashboard-analytics-card { min-width: 0; margin-top: 0; padding: 16px; border: 1px solid var(--line); border-radius: 14px; background: var(--panel2); }
.dashboard-analytics-card h3 { margin-bottom: 6px; }
.dashboard-help { margin: 0 0 14px; color: var(--muted); font-size: 12px; line-height: 1.5; }
.dashboard-bars { display: grid; gap: 10px; }
.dashboard-bar-row { display: grid; grid-template-columns: 86px minmax(35px,1fr) 28px; gap: 9px; align-items: center; font-size: 12px; }
.dashboard-bar-row > strong { text-align: right; font-variant-numeric: tabular-nums; }
.dashboard-bar-label { color: var(--muted); text-align: right; }
.dashboard-color-label { display: flex; align-items: center; gap: 7px; color: var(--muted); }
.dashboard-color-dot { display: inline-block; flex: 0 0 11px; width: 11px; height: 11px; border-radius: 50%; border: 1px solid rgba(255,255,255,.22); }
.dashboard-color-dot.white { background: #e8e2c8; }
.dashboard-color-dot.blue { background: #4c9bda; }
.dashboard-color-dot.black { background: #77717c; }
.dashboard-color-dot.red { background: #df665e; }
.dashboard-color-dot.green { background: #5ba878; }
.dashboard-color-dot.colorless { background: #9ca3af; }
.dashboard-bar-track { height: 10px; overflow: hidden; border-radius: 999px; background: rgba(148,163,184,.13); }
.dashboard-bar-fill { display: block; min-width: 0; height: 100%; border-radius: inherit; }
.curve-fill { background: linear-gradient(90deg,#6597e8,#8d7ce5); }
.color-fill.white { background: #e8e2c8; }
.color-fill.blue { background: #4c9bda; }
.color-fill.black { background: #77717c; }
.color-fill.red { background: #df665e; }
.color-fill.green { background: #5ba878; }
.color-fill.colorless { background: #9ca3af; }
.dashboard-problems { border-color: rgba(245,158,11,.35); }
.dashboard-problems li { margin: 6px 0; }
.dashboard-valid { border-color: rgba(34,197,94,.25); }
.dashboard-valid p { color: var(--muted); margin-bottom: 0; }
@media (max-width: 800px) { .dashboard-analytics-grid { grid-template-columns: 1fr; } }

/* V5.8.8c.1 — estadísticas prioritarias y distribución visual por tipo */
.dashboard-key-stats { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.dashboard-type-layout { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(220px, .85fr); gap: 20px; align-items: center; }
.dashboard-type-stats { margin: 0; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); }
.dashboard-type-chart-wrap { display: flex; align-items: center; justify-content: center; gap: 22px; min-width: 0; }
.dashboard-type-pie { width: 170px; height: 170px; flex: 0 0 170px; border-radius: 50%; display: grid; place-items: center; position: relative; }
.dashboard-type-pie::before { content: ""; position: absolute; inset: 27%; border-radius: 50%; background: var(--panel2); }
.dashboard-type-pie > span { z-index: 1; font-size: 22px; font-weight: 800; font-variant-numeric: tabular-nums; }
.dashboard-type-legend { display: grid; gap: 8px; min-width: 105px; }
.dashboard-type-legend-item { display: grid; grid-template-columns: 10px minmax(0, 1fr) auto; gap: 7px; align-items: center; font-size: 12px; }
.dashboard-type-legend-item i { width: 10px; height: 10px; border-radius: 3px; }
.dashboard-type-legend-item span { color: var(--muted); }
.dashboard-type-legend-item strong { font-variant-numeric: tabular-nums; }
@media (max-width: 800px) { .dashboard-key-stats { grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); } .dashboard-type-layout { grid-template-columns: 1fr; } .dashboard-type-chart-wrap { justify-content: flex-start; flex-wrap: wrap; } }

/* V5.8.8d.1 — grupos de cartas por tipo y visor sobre el dashboard */
.deck-dashboard-modal { z-index: 40; }
.card-detail-modal { z-index: 60; }
.dashboard-card-groups { display: grid; gap: 9px; }
.dashboard-card-group { border: 1px solid var(--line); border-radius: 11px; background: rgba(255,255,255,.018); overflow: hidden; }
.dashboard-card-group > summary { display: flex; align-items: center; gap: 12px; padding: 12px 14px; cursor: pointer; list-style: none; font-weight: 700; }
.dashboard-card-group > summary::-webkit-details-marker { display: none; }
.dashboard-card-group > summary::before { content: "▸"; color: var(--muted); transition: transform .15s ease; }
.dashboard-card-group[open] > summary::before { transform: rotate(90deg); }
.dashboard-card-group > summary strong { min-width: 28px; text-align: center; padding: 2px 7px; border-radius: 7px; background: var(--panel2); }
.dashboard-card-group-count { margin-left: auto; color: var(--muted); font-size: 12px; font-weight: 500; }
.dashboard-card-group .dashboard-card-list { padding: 0 10px 10px; }

.card-detail-preview .card-carousel { position: relative; }

/* V5.8.8d.3 — acciones directas desde el visor de carta */
.card-detail-deck-actions { display: flex; gap: 10px; }
.card-detail-deck-actions button { min-height: 42px; }


/* V5.8.8d.7 — estadísticas ordenadas y disponibilidad destacada */
.stats-grid {
  grid-template-columns: repeat(10, minmax(0, 1fr));
  align-items: stretch;
}
.stats-grid .stat-card { min-width: 0; min-height: 72px; }
.stats-grid .stat-card span { white-space: nowrap; }
.card-detail-zero-available { color: var(--bad, #ff6b6b) !important; }
@media (max-width: 1200px) { .stats-grid { grid-template-columns: repeat(5, minmax(0, 1fr)); } }
@media (max-width: 760px) { .stats-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }


/* V6.0: guardado explícito e historial por mazo */
.deck-save-hint { color: var(--muted); font-size: 12px; line-height: 1.45; margin: 4px 0 0; }
#saveDeckButton.has-pending-changes { box-shadow: 0 0 0 2px var(--accent); }
.deck-history-section { margin: 14px 0 18px; padding-top: 14px; border-top: 1px solid var(--line); }
.deck-history-panel { margin-top: 10px; padding: 14px; border: 1px solid var(--line); border-radius: 12px; background: var(--panel, #151a24); }
.deck-history-entry { padding: 12px 0; border-bottom: 1px solid var(--line); }
.deck-history-entry:first-child { padding-top: 0; }
.deck-history-entry:last-child { border-bottom: 0; padding-bottom: 0; }
.deck-history-entry-heading { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.deck-history-entry-heading time { color: var(--muted); font-size: 12px; }
.deck-history-entry ul { margin: 8px 0 0; padding-left: 20px; color: var(--muted); }
.deck-history-entry p, .deck-history-empty { color: var(--muted); margin: 8px 0 0; }

/* V6.0.4 — Comparación legible de notas en el historial. */
.deck-history-notes-values { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-top: 8px; }
.deck-history-notes-values > div { min-width: 0; padding: 9px 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface, #111722); }
.deck-history-notes-values span { display: block; margin-bottom: 5px; color: var(--muted); font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; }
.deck-history-notes-values pre { margin: 0; color: var(--text, #e9edf5); font: inherit; font-size: 12px; line-height: 1.45; white-space: pre-wrap; overflow-wrap: anywhere; }
@media (max-width: 700px) { .deck-history-notes-values { grid-template-columns: 1fr; } }

/* V6.2.0 — menú de exportación para compartir mazos */
.share-deck-modal { position:fixed; inset:0; z-index:60; display:grid; place-items:center; padding:20px; background:rgba(0,0,0,.76); }
.share-deck-card { width:min(540px,100%); max-height:90vh; overflow:auto; padding:24px; border:1px solid var(--line); border-radius:20px; background:var(--panel); box-shadow:0 24px 80px rgba(0,0,0,.35); }
.share-deck-head { display:flex; align-items:flex-start; justify-content:space-between; gap:16px; }
.share-deck-head h2 { margin:0; font-size:clamp(21px,3vw,28px); }
.share-deck-description { color:var(--muted); margin:10px 0 18px; }
.share-deck-options { display:grid; gap:10px; }
.share-deck-option { display:grid; grid-template-columns:48px minmax(0,1fr) 16px; gap:14px; align-items:center; width:100%; padding:14px; text-align:left; color:var(--text); background:var(--panel-2,var(--bg)); border:1px solid var(--line); border-radius:13px; cursor:pointer; transition:border-color .15s, transform .15s; }
.share-deck-option:hover { border-color:var(--accent); transform:translateY(-1px); }
.share-option-icon { display:grid; place-items:center; height:44px; border-radius:10px; font-size:12px; font-weight:800; letter-spacing:.3px; background:var(--soft); color:var(--accent); }
.share-deck-option strong,.share-deck-option small { display:block; }
.share-deck-option small { margin-top:4px; color:var(--muted); line-height:1.4; font-size:12px; }
.share-option-arrow { font-size:24px; color:var(--muted); }
.share-deck-footer { display:flex; justify-content:flex-end; margin-top:18px; }
@media(max-width:520px) { .share-deck-card { padding:18px; } .share-deck-option { grid-template-columns:42px minmax(0,1fr) 12px; gap:10px; padding:12px; } }

/* V6.2.1 — armoniza el botón Compartir con los botones principales de la app.
   El párrafo del dashboard usa color muted; fijamos el color del botón para evitar herencia. */
.dashboard-hero #shareDeckButton {
  color: #fff;
  font: inherit;
  font-weight: 750;
  line-height: 1.2;
  min-height: 44px;
  padding: 10px 17px;
  border-radius: 11px;
  background: var(--accent2);
  border: 1px solid var(--accent2);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  vertical-align: middle;
}
.dashboard-hero #shareDeckButton:hover {
  color: #fff;
  filter: brightness(1.08);
  transform: translateY(-1px);
}
.dashboard-hero p:has(#shareDeckButton) {
  margin: 14px 0 0;
}


/* V6.2.3 — centra el nombre de la marca independientemente de la versión. */
.brand-heading { position: relative; width: fit-content; max-width: 100%; margin: 0 auto; }
.brand-title { margin: 0; text-align: center; }
.app-version { position: absolute; left: calc(100% + 9px); top: 50%; transform: translateY(-50%); color: var(--muted); font-size: 11px; font-weight: 600; letter-spacing: .03em; white-space: nowrap; }
@media (max-width: 620px) {
  .app-version { left: auto; right: 0; top: calc(100% + 3px); transform: none; font-size: 10px; }
}


/* V6.4.2 — búsqueda avanzada local por impresión y artista. */
.advanced-search-filters {
  margin: 10px 0 0;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--panel, #151a24);
}
.advanced-search-filters > summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 44px;
  cursor: pointer;
  font-weight: 700;
  list-style: none;
}
.advanced-search-filters > summary::-webkit-details-marker { display: none; }
.advanced-search-filters > summary::before { content: "＋"; color: var(--accent); margin-right: 2px; }
.advanced-search-filters[open] > summary::before { content: "−"; }
.advanced-search-filters > summary span:first-of-type { margin-right: auto; }
.advanced-search-grid { display: grid; grid-template-columns: minmax(105px, .7fr) minmax(180px, 1.5fr) minmax(180px, 1.5fr) minmax(145px, 1fr) minmax(145px, 1fr); gap: 12px; padding: 8px 0 0; align-items: end; }
.advanced-search-grid .control-group { min-width: 0; }
.advanced-search-grid label { display: block; margin-bottom: 6px; color: var(--muted); font-size: 12px; font-weight: 700; }
.advanced-search-grid input, .advanced-search-grid select { width: 100%; min-width: 0; }
.advanced-search-artist { grid-column: auto; }
.advanced-search-power, .advanced-search-toughness { min-width: 0; }
.advanced-search-note { margin: 10px 0; color: var(--muted); font-size: 12px; line-height: 1.45; }
.advanced-search-actions { display: flex; justify-content: flex-end; padding-bottom: 12px; }
@media (max-width: 1050px) and (min-width: 621px) {
  .advanced-search-grid { grid-template-columns: minmax(110px, .75fr) minmax(180px, 1.25fr) minmax(180px, 1.25fr); }
  .advanced-search-power, .advanced-search-toughness { grid-column: auto; }
}
@media (max-width: 620px) {
  .advanced-search-filters { padding: 0 11px; }
  .advanced-search-filters > summary { flex-wrap: wrap; padding: 9px 0; }
  .advanced-search-filters .more-filters-hint { width: 100%; padding-left: 20px; }
  .advanced-search-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .advanced-search-set-code, .advanced-search-set-name, .advanced-search-artist { grid-column: auto; }
  .advanced-search-power, .advanced-search-toughness { grid-column: auto; }
}


/* V6.4.2.1 — búsqueda avanzada integrada dentro de «Más filtros». */
.advanced-search-section {
  padding: 2px 0 14px;
  margin-bottom: 14px;
  border-bottom: 1px solid var(--line);
}
.advanced-search-section .more-filters-section-label { margin-bottom: 12px; }
.advanced-search-section .advanced-search-grid { padding-top: 0; }
.advanced-search-section .advanced-search-note { margin: 10px 0; }
.advanced-search-section .advanced-search-actions { padding-bottom: 0; }
.more-filters > summary .more-filters-hint { text-align: right; }
@media (max-width: 620px) {
  .more-filters > summary .more-filters-hint { text-align: left; }
  .advanced-search-section { padding-bottom: 12px; }
}


/* V6.5 — filtros numéricos de fuerza y resistencia */
/* Los filtros P/T comparten fila con los criterios de impresión en la cuadrícula avanzada. */

/* Menú lateral desplegable ManaSheep */
.sidebar-toggle {
  position: fixed;
  top: 16px;
  left: 16px;
  z-index: 1100;
  width: 46px;
  height: 46px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--panel);
  color: var(--text);
  font-size: 25px;
  cursor: pointer;
  box-shadow: 0 4px 18px rgba(0,0,0,.25);
}
.sidebar-toggle:hover,
.sidebar-close:hover {
  background: var(--panel2);
}
.app-sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 1200;
  display: flex;
  flex-direction: column;
  width: min(300px, 86vw);
  padding: 20px 16px;
  background: var(--panel);
  border-right: 1px solid var(--line);
  box-shadow: 12px 0 35px rgba(0,0,0,.3);
  transform: translateX(-105%);
  visibility: hidden;
  transition: transform .22s ease, visibility .22s ease;
}
.app-sidebar.is-open {
  transform: translateX(0);
  visibility: visible;
}
.sidebar-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 5px 4px 20px;
  border-bottom: 1px solid var(--line);
}
.sidebar-brand {
  font-size: 21px;
  font-weight: 800;
  letter-spacing: -.04em;
}
.sidebar-close {
  width: 38px;
  height: 38px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: transparent;
  color: var(--text);
  font-size: 27px;
  cursor: pointer;
}
.app-sidebar .app-nav {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 8px;
  padding: 18px 0;
  border: 0;
  background: transparent;
  position: static;
}
.app-sidebar .nav-tab {
  width: 100%;
  min-height: 46px;
  padding: 12px 14px;
  text-align: left;
  border-radius: 10px;
}
.app-sidebar .nav-tab.active {
  background: rgba(78,141,247,.18);
  border-color: var(--accent);
}
.sidebar-account {
  margin-top: auto;
  padding-top: 18px;
  border-top: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 12px;
}
.sidebar-account #accountStatus {
  overflow-wrap: anywhere;
  line-height: 1.45;
}
.sidebar-account .secondary-button {
  width: 100%;
  min-height: 44px;
}
.sidebar-backdrop:not(.hidden) {
  position: fixed;
  inset: 0;
  z-index: 1150;
  background: rgba(0,0,0,.58);
  backdrop-filter: blur(2px);
}
body.sidebar-open {
  overflow: hidden;
}
@media (prefers-reduced-motion: reduce) {
  .app-sidebar {
    transition: none;
  }
}
