* { box-sizing: border-box; margin: 0; }

body {
  font-family: -apple-system, "Segoe UI", Roboto, sans-serif;
  background: #14161a;
  color: #e6e6e6;
  padding: 1.5rem;
  max-width: 1100px;
  margin: 0 auto;
}

header { margin-bottom: 1rem; }
h1 { font-size: 1.4rem; }
.subtitle { color: #9aa0a8; font-size: 0.9rem; margin-top: 0.25rem; }

.import-panel textarea {
  width: 100%;
  height: 10rem;
  background: #1c1f24;
  color: #e6e6e6;
  border: 1px solid #33383f;
  border-radius: 6px;
  padding: 0.6rem;
  font-family: ui-monospace, Menlo, monospace;
  font-size: 0.8rem;
  resize: vertical;
}

.controls {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin: 0.6rem 0;
  font-size: 0.9rem;
  color: #9aa0a8;
}
.controls select, .controls input {
  background: #1c1f24;
  color: #e6e6e6;
  border: 1px solid #33383f;
  border-radius: 4px;
  padding: 0.25rem 0.4rem;
  margin-left: 0.3rem;
}
.controls button {
  background: #3b6ecc;
  color: #fff;
  border: none;
  border-radius: 6px;
  padding: 0.45rem 1.1rem;
  font-size: 0.9rem;
  cursor: pointer;
}
.controls button:hover { background: #4a7de0; }
.controls button:disabled { background: #2a3138; cursor: wait; }

#status { color: #9aa0a8; font-size: 0.85rem; min-height: 1.2em; }
.error { color: #e06c75; margin-top: 1rem; }
.warn { color: #d8a657; font-size: 0.85rem; margin: 0.5rem 0; }
.pool-note { color: #9aa0a8; font-size: 0.85rem; }

.results-head { display: flex; align-items: center; justify-content: space-between; margin-top: 1rem; }
.view-toggle { display: flex; gap: 0; border: 1px solid #33383f; border-radius: 6px; overflow: hidden; }
.view-toggle button {
  background: #1c1f24;
  color: #9aa0a8;
  border: none;
  padding: 0.3rem 0.8rem;
  font-size: 0.8rem;
  cursor: pointer;
}
.view-toggle button.active { background: #232b3a; color: #e6e6e6; }

/* stacked card-art columns */
.art-cols {
  display: flex;
  gap: 0.6rem;
  align-items: flex-start;
  overflow-x: auto;
  padding-bottom: 1rem;
}
.art-col { flex: 1 1 0; min-width: 96px; max-width: 160px; }
.art-col-head {
  display: flex;
  justify-content: space-between;
  color: #9aa0a8;
  font-size: 0.78rem;
  padding: 0 0.2rem 0.3rem;
}
.art-col-head b { color: #c8cdd4; }
.stack { display: flex; flex-direction: column; }
.slot {
  aspect-ratio: 488 / 94;
  overflow: hidden;
  border-radius: 7px 7px 0 0;
  cursor: default;
}
.slot:last-child { aspect-ratio: 488 / 680; border-radius: 7px; }
/* Reserve the card shape before load: a 0-height lazy image never loads. */
.slot img { width: 100%; height: auto; aspect-ratio: 488 / 680; display: block; }
.slot:hover { outline: 2px solid #4a7de0; outline-offset: -2px; z-index: 2; position: relative; }
.slot-text {
  aspect-ratio: auto;
  background: #1c1f24;
  border: 1px solid #33383f;
  font-size: 0.72rem;
  padding: 0.25rem 0.4rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

#card-preview {
  position: fixed;
  display: none;
  width: 320px;
  z-index: 100;
  pointer-events: none;
}
#card-preview img {
  width: 100%;
  border-radius: 14px;
  box-shadow: 0 10px 34px rgba(0, 0, 0, 0.65);
}

.tabs { display: flex; flex-wrap: wrap; gap: 0.4rem; margin: 0.75rem 0 1rem; }
.tab {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  background: #1c1f24;
  color: #e6e6e6;
  border: 1px solid #33383f;
  border-radius: 6px;
  padding: 0.35rem 0.6rem;
  font-size: 0.82rem;
  cursor: pointer;
}
.tab:hover { border-color: #566070; }
.tab.active { border-color: #3b6ecc; background: #232b3a; }
.tab.infeasible { opacity: 0.45; }
.tab-guild { color: #c8cdd4; }
.tab-score { color: #9aa0a8; font-variant-numeric: tabular-nums; }

.pip {
  display: inline-block;
  width: 1.15em;
  height: 1.15em;
  line-height: 1.15em;
  border-radius: 50%;
  text-align: center;
  font-size: 0.75em;
  font-weight: 700;
  color: #1a1a1a;
}
.pip-W { background: #f3ecd8; }
.pip-U { background: #a8c8e8; }
.pip-B { background: #b5a8a4; }
.pip-R { background: #e8a08a; }
.pip-G { background: #a8c8a0; }

.stats { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-bottom: 0.6rem; }
.stat {
  background: #1c1f24;
  border: 1px solid #33383f;
  border-radius: 6px;
  padding: 0.4rem 0.7rem;
  font-size: 0.8rem;
}
.stat span { color: #9aa0a8; display: block; font-size: 0.72rem; }
.stat b { font-size: 0.95rem; font-variant-numeric: tabular-nums; }

.curve { display: flex; gap: 0.3rem; margin-bottom: 1rem; font-size: 0.78rem; }
.curve-chip {
  background: #1c1f24;
  border: 1px solid #33383f;
  border-radius: 4px;
  padding: 0.2rem 0.45rem;
  color: #c8cdd4;
  font-variant-numeric: tabular-nums;
}
.curve-chip b { color: #9aa0a8; margin-right: 0.35rem; font-weight: 600; }

.deck-cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 1rem; }
.deck-col h3 {
  font-size: 0.85rem;
  color: #9aa0a8;
  border-bottom: 1px solid #33383f;
  padding-bottom: 0.3rem;
  margin-bottom: 0.4rem;
}
.deck-col ul { list-style: none; padding: 0; }
.deck-col li {
  display: flex;
  align-items: baseline;
  gap: 0.45rem;
  padding: 0.14rem 0;
  font-size: 0.84rem;
}
.card-count { color: #9aa0a8; width: 1em; text-align: right; }
.card-mv { color: #6f7680; width: 1.2em; text-align: right; font-variant-numeric: tabular-nums; }
.card-name { flex: 1; }
.card-name.nodata { color: #8a8f96; font-style: italic; }
.card-rating { color: #9aa0a8; font-variant-numeric: tabular-nums; }
.footnote { color: #6f7680; font-size: 0.75rem; margin-top: 0.8rem; }
.card-cast { color: #6f7680; font-variant-numeric: tabular-nums; font-size: 0.78rem; width: 3.2em; text-align: right; }
.card-cast.low { color: #d8a657; }
.splash-pip { margin-left: 0.15rem; opacity: 0.8; font-size: 0.85em; }
.splash-note { color: #c8cdd4; font-size: 0.85rem; margin: 0.5rem 0; }
.splash-note.muted { color: #8a8f96; }
.card-tag { font-size: 0.68rem; color: #9aa0a8; border: 1px solid #33383f; border-radius: 3px; padding: 0 0.25rem; margin-left: 0.3rem; vertical-align: 1px; }
.mode-toggle { margin-right: 0.5rem; }
.mode-diff { color: #9aa0a8; font-size: 0.82rem; margin: 0.4rem 0; }
.mode-diff b { color: #c8cdd4; font-weight: 600; }
.results-head .pool-note { flex: 1; }
.credit { color: #8a8f96; font-size: 0.8rem; margin-top: 0.2rem; }
.credit a { color: #a8c8e8; }
.crumbs { color: #8a8f96; font-size: 0.8rem; margin-bottom: 0.4rem; }
.crumbs a { color: #a8c8e8; }
