:root {
  --bg: #14131a;
  --panel: #1e1c27;
  --text: #e8e6ef;
  --muted: #9b97ad;
  --accent: #b388ff;
  --accent-2: #7c4dff;
  --line: #2c2a36;
  --danger: #ff6b6b;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.55;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

.site-header {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  padding: 1rem 1.5rem;
  border-bottom: 1px solid var(--line);
  background: var(--panel);
}
.brand { justify-self: start; font-weight: 700; font-size: 1.2rem; color: var(--text); }
.site-header nav { justify-self: center; display: flex; gap: 1.5rem; }
.site-header nav a { color: var(--muted); }
.site-header nav a:hover { color: var(--text); }
@media (max-width: 560px) {
  .site-header { grid-template-columns: 1fr; gap: .5rem; text-align: center; }
  .brand, .site-header nav { justify-self: center; }
  .site-header nav { flex-wrap: wrap; justify-content: center; gap: 1rem; }
}

.container { max-width: 960px; margin: 0 auto; padding: 1.5rem; }

.hero h1 { font-size: 1.8rem; margin-bottom: .3rem; }
.hero p { color: var(--muted); max-width: 60ch; }

.card-block {
  background: var(--panel);
  border: 1px solid #2c2a36;
  border-radius: 12px;
  padding: 1.2rem 1.4rem;
  margin: 1.2rem 0;
}
.card-block h2 { margin-top: 0; }

.meta { color: var(--muted); font-size: .9rem; }
.value-line { font-size: 1.05rem; }

.button {
  display: inline-block;
  background: var(--accent-2);
  color: #fff;
  padding: .5rem .9rem;
  border-radius: 8px;
  border: none;
  font-size: .95rem;
  cursor: pointer;
}
.button:hover { background: var(--accent); text-decoration: none; }

.filters {
  margin: 1rem 0;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .5rem;
}
.filters .chip { margin-right: 0; }
.filters .chip-select { vertical-align: middle; }
.chip {
  display: inline-block;
  padding: .3rem .8rem;
  border: 1px solid #2c2a36;
  border-radius: 999px;
  margin-right: .5rem;
  color: var(--muted);
}
.chip.active { background: var(--accent-2); color: #fff; border-color: var(--accent-2); }

.deck-list { list-style: none; padding: 0; }
.deck-list li {
  padding: .7rem 0;
  border-bottom: 1px solid #2c2a36;
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

.analysis {
  background: var(--panel);
  border: 1px solid #2c2a36;
  border-radius: 12px;
  padding: 1rem 1.4rem;
  margin: 1.2rem 0;
}
.analysis h2, .analysis h3 { margin-top: 1rem; }

.card-grid {
  list-style: none;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: .8rem;
}
.card-grid .card {
  background: var(--panel);
  border: 1px solid #2c2a36;
  border-radius: 10px;
  padding: .5rem;
  text-align: center;
}
.card-grid img { width: 100%; border-radius: 6px; display: block; }
.card-name { display: block; font-size: .82rem; margin-top: .4rem; }
.card-price { display: block; font-size: .78rem; color: var(--muted); }
.card.not-owned { opacity: .7; }

.price-box {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 1rem 1.4rem;
  margin: 1.2rem 0;
}
.price-figures {
  display: flex;
  gap: 2rem;
  flex-wrap: wrap;
  text-align: center;
  color: var(--muted);
  font-size: .85rem;
}
.price-figures .big { font-size: 1.5rem; font-weight: 700; color: var(--text); }
.price-figures .owned { color: #5bd6a0; }
.price-figures .missing { color: var(--danger); }
.price-box details { margin-top: .8rem; }
.price-box summary { cursor: pointer; color: var(--accent); }
.price-list { list-style: none; padding: 0; margin: .5rem 0 0; }
.price-list li {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding: .2rem 0;
  border-bottom: 1px solid var(--line);
  font-size: .9rem;
}
.badge {
  display: inline-block;
  font-size: .7rem;
  color: var(--danger);
  border: 1px solid var(--danger);
  border-radius: 999px;
  padding: 0 .4rem;
  margin-top: .3rem;
}

.vote-form { margin: 1rem 0; max-width: 560px; }
.vote-option {
  display: grid;
  grid-template-columns: auto 1fr 2fr auto;
  align-items: center;
  gap: .6rem;
  padding: .5rem 0;
}
.vote-bar {
  background: #2c2a36;
  border-radius: 999px;
  height: 10px;
  overflow: hidden;
}
.vote-fill { display: block; height: 100%; background: var(--accent); }
.vote-pct { font-size: .85rem; color: var(--muted); white-space: nowrap; }
.vote-form .button { margin-top: .8rem; }

.price-headline { font-size: 1.05rem; margin: 0 0 .3rem; }
.price-headline .big { font-size: 1.6rem; font-weight: 700; }

/* Decklist text / export */
.decklist-text {
  margin: 1rem 0;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: .8rem 1.2rem;
}
.decklist-text summary { cursor: pointer; color: var(--accent); }
.export-controls { display: flex; gap: .8rem; align-items: center; flex-wrap: wrap; margin: .8rem 0; }
.dl-area {
  width: 100%;
  font-family: ui-monospace, Menlo, monospace;
  font-size: .85rem;
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: .6rem;
}

/* Deck overview: stat chips + charts */
.overview { margin: 1.2rem 0; }
.stat-chips { display: flex; flex-wrap: wrap; gap: .5rem; margin: .3rem 0 1rem; }
.chip-stat {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: .28rem .75rem;
  font-size: .9rem;
  color: var(--muted);
}
.chip-stat b { color: var(--text); }
.color-chip { display: inline-flex; align-items: center; gap: .2rem; }
.color-chip i { font-style: normal; color: var(--muted); margin-right: .35rem; font-size: .85rem; }

.overview-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
@media (max-width: 640px) { .overview-cols { grid-template-columns: 1fr; } }
.panel-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: .9rem 1.1rem;
}
.panel-card h3 { margin: .1rem 0 .9rem; }

.curve-bars { display: flex; gap: 8px; align-items: flex-end; }
.curve-col {
  flex: 1;
  height: 150px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
}
.curve-bar {
  width: 64%;
  background: linear-gradient(var(--accent), var(--accent-2));
  border-radius: 5px 5px 0 0;
  min-height: 3px;
}
.curve-count { font-size: .72rem; color: var(--muted); line-height: 1; margin-bottom: 3px; }
.curve-label { font-size: .74rem; color: var(--muted); margin-top: 5px; }

.type-bars { list-style: none; padding: 0; margin: 0; }
.type-bars li {
  display: grid;
  grid-template-columns: 92px 1fr 28px;
  align-items: center;
  gap: .5rem;
  padding: .22rem 0;
}
.type-name { color: var(--muted); font-size: .85rem; }
.type-track { background: #2c2a36; border-radius: 999px; height: 9px; overflow: hidden; }
.type-fill { display: block; height: 100%; background: linear-gradient(90deg, var(--accent-2), var(--accent)); }
.type-n { text-align: right; font-size: .85rem; }

/* Analysis typography */
.analysis h2 {
  border-bottom: 1px solid var(--line);
  padding-bottom: .3rem;
  margin-top: 1.6rem;
  font-size: 1.25rem;
}
.analysis h3 { color: var(--accent); margin-top: 1rem; }
.analysis ul { padding-left: 1.15rem; }
.analysis li { margin: .3rem 0; }
.analysis strong { color: #efe9ff; }
.analysis blockquote {
  margin: 1rem 0;
  padding: .7rem 1.1rem;
  border-left: 4px solid var(--accent);
  background: rgba(124, 77, 255, .12);
  border-radius: 0 10px 10px 0;
}
.analysis blockquote p { margin: .25rem 0; }
.analysis hr { border: none; border-top: 1px solid var(--line); margin: 1.2rem 0; }

/* Deck feed (home / archive / list decks) */
.feed { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 1rem; margin: 1rem 0; }
.feed-card {
  display: flex;
  gap: .9rem;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: .8rem;
  color: var(--text);
}
.feed-card:hover { border-color: var(--accent); text-decoration: none; }
.feed-thumb { width: 64px; flex: 0 0 64px; border-radius: 8px; object-fit: cover; align-self: flex-start; }
.feed-thumb-empty {
  display: flex; align-items: center; justify-content: center;
  height: 88px; background: #2c2a36; color: var(--muted); font-weight: 700; font-size: 1.4rem;
}
.feed-body { display: flex; flex-direction: column; gap: .25rem; min-width: 0; }
.feed-title { font-weight: 600; }
.feed-desc { color: var(--muted); font-size: .9rem; }

.deck-desc { font-size: 1.05rem; color: var(--text); margin: .2rem 0 .4rem; }
.filters-sep { display: inline-block; width: 1px; height: 1.1rem; background: var(--line); margin: 0 .4rem; vertical-align: middle; }

/* Evening Duel — index cards */
.duel-feed { grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); }
.duel-card {
  display: flex;
  flex-direction: column;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: .9rem;
  color: var(--text);
}
.duel-card:hover { border-color: var(--accent); text-decoration: none; }
.duel-thumbs { display: flex; align-items: center; justify-content: center; gap: .6rem; }
.duel-thumbs img {
  width: 42%;
  max-width: 130px;
  border-radius: 8px;
  box-shadow: 0 4px 14px rgba(0, 0, 0, .45);
}
.duel-vs { font-weight: 800; color: var(--muted); letter-spacing: .06em; }
.duel-meta { display: flex; flex-direction: column; gap: .25rem; margin-top: .7rem; }
.duel-tag { font-size: .72rem; text-transform: uppercase; letter-spacing: .06em; color: var(--accent); font-weight: 700; }

/* Matchup verdict block */
.matchup-block {
  background: linear-gradient(135deg, rgba(124, 77, 255, .14), rgba(0, 0, 0, 0));
  border: 1px solid var(--accent);
  border-radius: 12px;
  padding: 1rem 1.3rem;
  margin: 1rem 0 1.4rem;
}
.matchup-block h2 { margin-top: 0; }
.matchup-block strong { color: #efe9ff; }
.matchup-block blockquote {
  margin: .6rem 0; padding: .5rem .9rem;
  border-left: 4px solid var(--accent); background: rgba(124, 77, 255, .12);
  border-radius: 0 8px 8px 0;
}

/* Evening Duel — versus page */
.versus {
  display: grid;
  grid-template-columns: 1fr minmax(210px, 280px) 1fr;
  gap: 1.2rem;
  align-items: start;
  margin: 1.2rem 0;
}
@media (max-width: 820px) { .versus { grid-template-columns: 1fr; } }
.vs-side {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 1rem 1.1rem;
}
.vs-name { margin-top: 0; }
.vs-highlights { gap: .5rem; }
.vs-highlights .highlight-card { width: 31%; max-width: 110px; }
.vs-decklist summary { cursor: pointer; color: var(--accent); }

.vs-mid { padding-top: .5rem; }
.vs-badge {
  text-align: center;
  font-weight: 800;
  letter-spacing: .1em;
  color: var(--muted);
  margin-bottom: .8rem;
}
.vs-metric { margin: .55rem 0; }
.vs-metric-head { display: flex; justify-content: space-between; font-size: .85rem; }
.vs-metric-label { color: var(--muted); }
.vs-metric-bar { display: flex; height: 8px; border-radius: 999px; overflow: hidden; margin-top: .2rem; }
.vs-fill-a { background: var(--accent); }
.vs-fill-b { background: #5bd6a0; }
.vs-h { margin: 1.1rem 0 .5rem; text-align: center; font-size: .9rem; color: var(--muted); }

.vs-curve { display: flex; gap: 4px; align-items: flex-end; }
.vs-curve-col { flex: 1; display: flex; flex-direction: column; align-items: center; }
.vs-curve-pair { display: flex; gap: 2px; align-items: flex-end; height: 80px; }
.vs-curve-pair span { width: 6px; border-radius: 2px 2px 0 0; min-height: 2px; }
.vs-bar-a { background: var(--accent); }
.vs-bar-b { background: #5bd6a0; }

.vs-colors { display: flex; flex-direction: column; gap: .35rem; align-items: center; }
.vs-colors > div { display: inline-flex; align-items: center; gap: .25rem; }
.vs-dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }
.vs-dot-a { background: var(--accent); }
.vs-dot-b { background: #5bd6a0; }
.vs-legend { text-align: center; font-size: .82rem; color: var(--muted); margin-top: .8rem; }
.vs-legend .vs-dot { margin-right: .25rem; }

/* Commander title block */
.commander-hero {
  display: flex;
  gap: 1.4rem;
  align-items: flex-start;
  background: linear-gradient(135deg, rgba(124, 77, 255, .16), rgba(0, 0, 0, 0));
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 1.2rem;
  margin: 1rem 0 1.4rem;
}
.commander-art img {
  width: 230px;
  max-width: 42vw;
  border-radius: 12px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, .5);
  display: block;
}
.commander-info { flex: 1; min-width: 0; }
.commander-label { text-transform: uppercase; letter-spacing: .08em; font-size: .75rem; color: var(--accent); font-weight: 700; }
.commander-name { margin: .2rem 0 .4rem; display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; }
.commander-oracle { white-space: pre-wrap; }
@media (max-width: 640px) { .commander-hero { flex-direction: column; align-items: center; text-align: center; } }

/* Highlight (key) cards */
.highlights { margin: 1rem 0 1.4rem; }
.highlights-title { margin: 0 0 .5rem; color: var(--muted); font-size: .82rem; text-transform: uppercase; letter-spacing: .05em; }
.highlight-cards { display: flex; gap: 1rem; flex-wrap: wrap; }
.highlight-card { width: 200px; max-width: 44vw; text-align: center; color: var(--text); }
.highlight-card img { width: 100%; border-radius: 10px; box-shadow: 0 6px 18px rgba(0,0,0,.45); transition: transform .12s; display: block; }
.highlight-card:hover img { transform: translateY(-4px); }
.highlight-name { display: block; margin-top: .45rem; font-size: .85rem; }

/* Colour donut */
.pie-row { display: flex; align-items: center; gap: 1.1rem; }
.pie { width: 96px; height: 96px; border-radius: 50%; position: relative; flex: 0 0 auto; }
.pie-hole { position: absolute; inset: 24%; border-radius: 50%; background: var(--panel); }
.pie-legend { list-style: none; padding: 0; margin: 0; font-size: .9rem; }
.pie-legend li { display: flex; align-items: center; gap: .35rem; padding: .12rem 0; }

/* Decklist grid/list toggle */
.deck-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
.view-toggle { display: inline-flex; border: 1px solid var(--line); border-radius: 999px; overflow: hidden; }
.vt-btn { background: var(--panel); color: var(--muted); border: none; padding: .35rem .95rem; cursor: pointer; font-size: .85rem; }
.vt-btn.active { background: var(--accent-2); color: #fff; }

.deck-list-view { margin: .5rem 0 1rem; }
.dl-group { margin: 1rem 0 .2rem; font-size: 1rem; }
.dl-table { width: 100%; border-collapse: collapse; }
.dl-table td { padding: .32rem .4rem; border-bottom: 1px solid var(--line); }
.dl-qty { width: 2.5rem; color: var(--muted); }
.dl-cmc { width: 3rem; text-align: center; color: var(--muted); }
.dl-price { width: 5rem; text-align: right; color: var(--muted); }
.dl-table tr.not-owned { opacity: .55; }

/* Archive badges */
.archive-deck { display: inline-flex; align-items: center; gap: .5rem; }
.archive-pips { display: inline-flex; gap: 2px; }

.import-error {
  background: rgba(255, 107, 107, .12);
  border: 1px solid var(--danger);
  color: #ffb4b4;
  border-radius: 8px;
  padding: .6rem .9rem;
}

/* Admin rename form */
.rename-form { display: flex; gap: .5rem; margin: -.4rem 0 1rem; max-width: 480px; }
.rename-form input { flex: 1; padding: .45rem .6rem; border-radius: 8px; border: 1px solid var(--line); background: var(--bg); color: var(--text); }

/* Admin card editing table */
.admin-cards { width: 100%; border-collapse: collapse; }
.admin-cards td { padding: .3rem .4rem; border-bottom: 1px solid var(--line); vertical-align: middle; }
.ac-name { width: 60%; }
.ac-qty .qty-form { display: flex; gap: .4rem; align-items: center; margin: 0; }
.ac-qty input { width: 4rem; padding: .3rem; border-radius: 6px; border: 1px solid var(--line); background: var(--bg); color: var(--text); }
.ac-qty .button, .ac-del .button { padding: .25rem .6rem; font-size: .8rem; }
.ac-del { width: 2.5rem; text-align: right; }
.ac-del form { margin: 0; }

/* Type quick-nav (list page) */
html { scroll-behavior: smooth; }
.type-nav {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  flex-wrap: wrap;
  gap: .4rem;
  padding: .6rem 0;
  margin-bottom: .5rem;
  background: var(--bg);
  border-bottom: 1px solid var(--line);
}
.type-nav a {
  font-size: .82rem;
  color: var(--muted);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: .2rem .7rem;
}
.type-nav a:hover { color: var(--text); border-color: var(--accent); text-decoration: none; }
.type-nav a span { color: var(--accent); }
.dl-group[id] { scroll-margin-top: 3.2rem; }

/* Goldfish simulator */
.deck-actions { display: flex; gap: .6rem; flex-wrap: wrap; }
.gf-bar { display: flex; gap: .6rem; align-items: center; flex-wrap: wrap; margin: 1rem 0; }
.gf-status { color: var(--muted); font-size: .9rem; }
.gf-zone { margin: 1rem 0; }
.gf-zone h3 { margin: .3rem 0; }
.gf-cards { display: flex; flex-wrap: wrap; gap: .6rem; min-height: 28px; }
.gf-bf {
  min-height: 140px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: .7rem;
  align-items: flex-start;
}
.gf-card { position: relative; width: 86px; cursor: pointer; }
.gf-card img { width: 100%; border-radius: 6px; display: block; }
.gf-card .gf-noimg {
  display: block; font-size: .72rem; padding: .35rem;
  background: #2c2a36; border-radius: 6px; text-align: center; min-height: 110px;
}
.gf-tapped img { transform: rotate(90deg); opacity: .85; }
.gf-x {
  position: absolute; top: 2px; right: 2px; display: none;
  border: none; background: rgba(0,0,0,.65); color: #fff; border-radius: 4px;
  cursor: pointer; font-size: .8rem; line-height: 1; padding: 1px 5px;
}
.gf-card:hover .gf-x { display: block; }
.gf-foot { display: flex; gap: 1.5rem; color: var(--muted); margin-top: 1rem; }

/* Hover card preview */
#card-preview {
  display: none;
  position: fixed;
  width: 300px;
  z-index: 1000;
  pointer-events: none;
  border-radius: 12px;
  box-shadow: 0 12px 34px rgba(0, 0, 0, .65);
}
#card-preview img { width: 100%; display: block; border-radius: 12px; }
.card-grid img { cursor: pointer; }

/* Card detail page */
.card-detail-grid {
  display: grid;
  grid-template-columns: 300px 1fr;
  gap: 1.5rem;
  align-items: start;
}
.card-detail-art img { width: 100%; border-radius: 12px; }
.oracle {
  white-space: pre-wrap;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: .8rem 1rem;
}
.kv { list-style: none; padding: 0; }
.kv li {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  border-bottom: 1px solid var(--line);
  padding: .3rem 0;
}
.kv li span:first-child { color: var(--muted); }
.card-title { display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; }
.type-line { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; }
.legality { display: flex; flex-wrap: wrap; gap: .4rem; }
.leg {
  font-size: .76rem;
  text-transform: capitalize;
  border-radius: 999px;
  padding: .15rem .6rem;
  border: 1px solid var(--line);
  background: var(--panel);
}
.leg-ok { color: #5bd6a0; border-color: #2e6b52; background: rgba(91, 214, 160, .1); }
.leg-no { color: var(--muted); opacity: .6; }
@media (max-width: 640px) { .card-detail-grid { grid-template-columns: 1fr; } }

/* Mana symbol pips */
.mana-cost { display: inline-flex; gap: 2px; }
.ms {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.3em;
  height: 1.3em;
  border-radius: 50%;
  font-size: .82em;
  font-weight: 700;
  color: #1a1a1a;
  background: #cfcabf;
  box-shadow: inset 0 -1px 1px rgba(0,0,0,.25);
  text-transform: uppercase;
}
.ms-w { background: #fffbd5; }
.ms-u { background: #aae0fa; }
.ms-b { background: #b3aca6; }
.ms-r { background: #f9aa8f; }
.ms-g { background: #9bd3ae; }
.ms-c, .ms-generic, .ms-s { background: #cac5c0; }
.ms-hybrid { background: linear-gradient(135deg, #fffbd5 50%, #aae0fa 50%); font-size: .7em; }
.ms-tap, .ms-e { background: #d9d4cd; }

/* Rarity badge */
.rarity {
  font-size: .72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .04em;
  border-radius: 4px;
  padding: .12rem .45rem;
  border: 1px solid currentColor;
}
.rarity-common { color: #c9c9c9; }
.rarity-uncommon { color: #9fb8c8; }
.rarity-rare { color: #d4b25a; }
.rarity-mythic { color: #e0712f; }
.rarity-special, .rarity-bonus { color: #b07bd0; }

/* Viewer feedback */
.feedback { margin: 2rem 0; }
.verdict-buttons { display: flex; gap: .6rem; flex-wrap: wrap; }
.verdict-btn {
  display: flex;
  align-items: center;
  gap: .4rem;
  background: var(--panel);
  border: 1px solid var(--line);
  color: var(--text);
  border-radius: 10px;
  padding: .5rem .8rem;
  cursor: pointer;
  font-size: .9rem;
}
.verdict-btn:hover { border-color: var(--accent); }
.verdict-btn.chosen { border-color: var(--accent); background: rgba(124, 77, 255, .18); }
.verdict-btn .emoji { font-size: 1.1rem; }
.verdict-btn .vcount { color: var(--muted); font-size: .8rem; }

.comment-form { display: grid; gap: .5rem; max-width: 600px; margin: 1rem 0; }
.comment-form input, .comment-form textarea {
  padding: .5rem; border-radius: 8px; border: 1px solid var(--line);
  background: var(--bg); color: var(--text);
}
.comments { list-style: none; padding: 0; }
.comment { border-bottom: 1px solid var(--line); padding: .7rem 0; }
.comment.pinned { background: rgba(124, 77, 255, .07); border-radius: 8px; padding: .7rem; }
.comment-head { display: flex; gap: .6rem; align-items: center; }
.comment-body { white-space: pre-wrap; margin-top: .3rem; }
.badge-pin {
  font-size: .7rem; color: var(--accent);
  border: 1px solid var(--accent); border-radius: 999px; padding: 0 .4rem;
}

/* Admin forms */
.stack label { display: block; margin: .6rem 0; }
.stack input:not([type=checkbox]):not([type=radio]):not([type=file]),
.stack select, .stack textarea {
  width: 100%;
  padding: .5rem;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--bg);
  color: var(--text);
}
.deck-row { padding: .8rem 0; border-bottom: 1px solid var(--line); }
.deck-row.is-hidden { opacity: .5; }
.row-actions { display: flex; gap: .5rem; flex-wrap: wrap; }
.row-actions form { margin: 0; }

.site-footer {
  max-width: 960px;
  margin: 2rem auto 1rem;
  padding: 1rem 1.5rem;
  color: var(--muted);
  font-size: .8rem;
  border-top: 1px solid #2c2a36;
}

/* Generate page: multi-list build pool + method picker */
.gen-pool, .gen-method {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: .6rem 1rem;
  margin: .6rem 0;
}
.gen-pool legend, .gen-method legend { color: var(--muted); padding: 0 .4rem; }
.gen-lists {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: .3rem .9rem;
}
.gen-list { display: flex; align-items: center; gap: .45rem; margin: 0; }
.gen-list input { width: auto; }
.gen-method label { display: block; margin: .35rem 0; }
.gen-method label input { width: auto; margin-right: .4rem; }

/* Archive: list-filter dropdown styled like a chip */
.chip-select {
  padding: .3rem .8rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--panel);
  color: var(--muted);
  font-size: .9rem;
}

/* Flash banner after an API build */
.ai-flash {
  background: rgba(124, 77, 255, .12);
  border: 1px solid var(--accent-2);
  border-radius: 10px;
  padding: .7rem 1rem;
  margin-bottom: 1rem;
  color: var(--text);
  font-size: .9rem;
}

/* Duel page action buttons (watch / hotseat table) */
.duel-actions { display: flex; gap: .6rem; flex-wrap: wrap; }

/* Duel result + predictions */
.vs-score {
  display: flex; justify-content: center; align-items: baseline; gap: .5rem;
  font-size: 1.9rem; font-weight: 800; margin: .3rem 0 .6rem;
}
.vs-score span { color: var(--muted); font-size: 1.2rem; }
.vs-score b { color: var(--muted); }
.vs-score b.won { color: #5bd6a0; }

.predict-block {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 1rem 1.4rem;
  margin: 1.2rem 0;
}
.predict-block h2 { margin: 0 0 .3rem; }
.predict-row { display: flex; gap: .8rem; flex-wrap: wrap; margin: .8rem 0; }
.predict-row form { flex: 1; min-width: 200px; }
.predict-btn {
  width: 100%; padding: .7rem 1rem; border-radius: 10px; cursor: pointer;
  background: var(--bg); color: var(--text); font-size: .95rem; font-weight: 600;
  border: 1px solid var(--line);
}
.predict-btn.pa:hover, .predict-btn.pa.chosen { border-color: #8b6dff; box-shadow: 0 0 12px rgba(139,109,255,.25); }
.predict-btn.pb:hover, .predict-btn.pb.chosen { border-color: #ff8a5c; box-shadow: 0 0 12px rgba(255,138,92,.25); }
.predict-bar {
  display: flex; height: 12px; border-radius: 999px; overflow: hidden;
  background: var(--bg); margin: .6rem 0 .3rem;
}
.predict-bar .pa-fill { background: #8b6dff; }
.predict-bar .pb-fill { background: #ff8a5c; }
.predict-block .wa { color: #8b6dff; } .predict-block .wb { color: #ff8a5c; }

.duel-record { font-size: .95rem; }
.duel-record .rec-win { color: #5bd6a0; }
.duel-record .rec-loss { color: var(--danger); }

/* Goldfish draw-odds panel */
.gf-odds {
  margin: 1rem 0;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: .8rem 1.2rem;
}
.gf-odds summary { cursor: pointer; color: var(--accent); }
.gf-odds-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 1.2rem; margin-top: .8rem; }
@media (max-width: 640px) { .gf-odds-cols { grid-template-columns: 1fr; } }
.gf-odds h4 { margin: 0 0 .5rem; }
.odds-table { border-collapse: collapse; width: 100%; font-size: .88rem; margin-top: .4rem; }
.odds-table th { text-align: left; color: var(--muted); font-weight: 500; padding: .25rem .6rem .25rem 0; white-space: nowrap; }
.odds-table td { padding: .25rem .6rem .25rem 0; }
.odds-table tr { border-bottom: 1px solid var(--line); }
.odds-table b { color: #5bd6a0; }

/* Compare page picker */
.compare-pick { display: flex; gap: .6rem; align-items: center; flex-wrap: wrap; margin: 1rem 0 1.4rem; }
.compare-pick select {
  padding: .5rem; border-radius: 8px; border: 1px solid var(--line);
  background: var(--panel); color: var(--text); max-width: 300px;
}

/* Deck version history */
.version-list { list-style: none; padding: 0; margin: .6rem 0 0; }
.version-list li { padding: .55rem 0; border-bottom: 1px solid var(--line); }
.version-diff { display: flex; flex-wrap: wrap; gap: .35rem; margin-top: .3rem; }
.vd-add, .vd-rem {
  font-size: .8rem; border-radius: 999px; padding: .1rem .55rem;
  border: 1px solid transparent;
}
.vd-add { color: #5bd6a0; border-color: rgba(91,214,160,.4); background: rgba(91,214,160,.08); }
.vd-rem { color: var(--danger); border-color: rgba(255,107,107,.4); background: rgba(255,107,107,.08); }

/* Landing fork: MTG / DnD */
.fork-hero { text-align: center; margin: 2rem 0 1.5rem; }
.fork-hero h1 { font-size: 2.2rem; margin-bottom: .2rem; }
.fork { display: grid; grid-template-columns: 1fr 1fr; gap: 1.4rem; margin: 1rem 0 2rem; }
@media (max-width: 640px) { .fork { grid-template-columns: 1fr; } }
.fork-card {
  display: flex; flex-direction: column; align-items: flex-start; gap: .5rem;
  padding: 2rem 1.8rem; border-radius: 16px; border: 1px solid var(--line);
  background: var(--panel); color: var(--text); text-decoration: none;
  transition: transform .15s ease, box-shadow .15s ease, border-color .15s ease;
}
.fork-card:hover { transform: translateY(-3px); text-decoration: none; }
.fork-mtg:hover { border-color: var(--accent-2); box-shadow: 0 10px 34px rgba(124,77,255,.25); }
.fork-dnd { opacity: .75; }
.fork-dnd:hover { border-color: #c0392b; box-shadow: 0 10px 34px rgba(192,57,43,.2); }
.fork-emoji { font-size: 2.6rem; }
.fork-card h2 { margin: 0; }
.fork-card p { color: var(--muted); margin: 0 0 .6rem; }
.fork-soon {
  font-size: .85rem; color: #e67e22; border: 1px dashed #e67e22;
  border-radius: 999px; padding: .3rem .8rem;
}

/* ===== Admin v2 ===== */
.admin-head { display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; margin: .4rem 0 1.1rem; }
.admin-head h1 { margin: 0; }
.admin-head .grow { flex: 1; }

.site-header nav a.on { color: var(--text); border-bottom: 2px solid var(--accent-2); padding-bottom: 2px; }

/* status badges */
.b { display: inline-block; font-size: .72rem; padding: .08rem .55rem; border-radius: 999px;
     border: 1px solid var(--line); color: var(--muted); white-space: nowrap; }
.b-pub   { color: #5bd6a0; border-color: rgba(91,214,160,.5);  background: rgba(91,214,160,.08); }
.b-draft { color: #e6b422; border-color: rgba(230,180,34,.5);  background: rgba(230,180,34,.08); }
.b-free  { color: var(--accent); border-color: rgba(179,136,255,.5); background: rgba(179,136,255,.08); }
.b-fmt   { text-transform: capitalize; }
.b-res   { color: #5bd6a0; border-color: rgba(91,214,160,.5); }

/* compact action buttons */
.btn-sm {
  display: inline-block; font-size: .78rem; padding: .28rem .6rem; border-radius: 7px;
  background: var(--panel); border: 1px solid var(--line); color: var(--muted);
  cursor: pointer; line-height: 1.2;
}
.btn-sm:hover { color: var(--text); border-color: var(--accent); text-decoration: none; }
.btn-danger { border-color: rgba(255,107,107,.45); color: var(--danger); }
.btn-danger:hover { border-color: var(--danger); color: #fff; background: rgba(255,107,107,.18); }

/* collapsed create/import forms — content first, forms out of the way */
.newform { margin: 1rem 0; background: var(--panel); border: 1px dashed #3a3554; border-radius: 12px; }
.newform > summary { cursor: pointer; padding: .8rem 1.2rem; color: var(--accent); font-weight: 600; }
.newform > summary:hover { color: var(--text); }
.newform[open] > summary { border-bottom: 1px solid var(--line); }
.newform .inner { padding: .6rem 1.2rem 1.2rem; }

/* row layout for admin content */
.row-line { display: flex; align-items: center; gap: .55rem; flex-wrap: wrap; padding: .6rem 0; border-bottom: 1px solid var(--line); }
.row-line .title { font-weight: 600; }
.row-line .grow { flex: 1; }
.row-line form { margin: 0; display: inline; }
.row-sub { padding: .2rem 0 .6rem; border-bottom: 1px solid var(--line); }
.row-sub summary { cursor: pointer; color: var(--muted); font-size: .82rem; }
.row-sub[open] summary { color: var(--accent); }
.row-sub .inner { padding: .6rem 0 .2rem; }

/* dashboard */
.stat-tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(136px, 1fr)); gap: .8rem; margin: .4rem 0 1rem; }
.stat-tile { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: .8rem 1rem; }
.stat-tile b { display: block; font-size: 1.55rem; line-height: 1.2; }
.stat-tile span { color: var(--muted); font-size: .78rem; }
.stat-tile a { color: inherit; }
.quick-actions { display: flex; gap: .6rem; flex-wrap: wrap; margin: .4rem 0 1.2rem; }

/* poll result mini-bars */
.poll-bar { display: flex; align-items: center; gap: .5rem; font-size: .85rem; padding: .15rem 0; }
.poll-bar .track { flex: 1; height: 8px; background: var(--bg); border-radius: 999px; overflow: hidden; max-width: 300px; }
.poll-bar .fill { display: block; height: 100%; background: linear-gradient(90deg, var(--accent-2), var(--accent)); }

/* ===== D&D section ===== */
.dnd-brand { font-size: 1.15rem; }
.dnd-right { justify-self: end; display: flex; align-items: center; gap: .4rem; font-size: .9rem; }
.dnd-right a { color: var(--muted); }
.dnd-right a:hover, .dnd-right a.on { color: var(--text); }
.dnd-right a.lang.on { color: var(--accent); font-weight: 700; }
.dnd-hero { text-align: center; margin: 1.5rem 0; }
.dnd-hero h1 { font-size: 2rem; margin-bottom: .3rem; }

.srd-filters { display: flex; gap: .5rem; flex-wrap: wrap; margin: 1rem 0; }
.srd-filters input, .srd-filters select {
  padding: .45rem .7rem; border-radius: 8px; border: 1px solid var(--line);
  background: var(--panel); color: var(--text); font-size: .9rem;
}
.srd-filters input { min-width: 200px; }

.srd-list { display: flex; flex-direction: column; }
.srd-row {
  display: flex; align-items: center; gap: .5rem; flex-wrap: wrap;
  padding: .55rem .6rem; border-bottom: 1px solid var(--line);
  color: var(--text); text-decoration: none; border-radius: 8px;
}
.srd-row:hover { background: var(--panel); text-decoration: none; }
.srd-row .title { font-weight: 600; }
.srd-row .grow { flex: 1; }

/* Stat blocks (spells & monsters) */
.statblock {
  background: var(--panel); border: 1px solid var(--line); border-radius: 14px;
  border-top: 3px solid var(--accent-2);
  padding: 1.2rem 1.5rem; margin: 1rem 0; max-width: 820px;
}
.statblock h1 { margin: 0 0 .1rem; font-size: 1.6rem; }
.statblock h3 {
  margin: 1.1rem 0 .4rem; color: var(--accent);
  border-bottom: 1px solid var(--line); padding-bottom: .2rem;
}
.sb-sub { color: var(--muted); font-style: italic; margin: 0 0 .8rem; }
.sb-grid { display: grid; grid-template-columns: 1fr 1fr; gap: .35rem 1.4rem; margin: .8rem 0; }
@media (max-width: 560px) { .sb-grid { grid-template-columns: 1fr; } }
.sb-grid b { color: var(--accent); }
.sb-abilities {
  display: grid; grid-template-columns: repeat(6, 1fr); gap: .5rem;
  margin: 1rem 0; text-align: center;
}
@media (max-width: 560px) { .sb-abilities { grid-template-columns: repeat(3, 1fr); } }
.sb-ab { background: var(--bg); border: 1px solid var(--line); border-radius: 10px; padding: .45rem .2rem; }
.sb-ab .ab-name { display: block; font-size: .7rem; color: var(--muted); letter-spacing: .1em; }
.sb-ab b { font-size: 1.15rem; }
.sb-ab .ab-mod { display: block; font-size: .85rem; color: var(--accent); }
.sb-lines p { margin: .25rem 0; }
.sb-lines b { color: var(--accent); }
.sb-action { margin: .45rem 0; }
.sb-action b { color: var(--text); }
.sb-text { line-height: 1.6; }
.sb-text table { border-collapse: collapse; margin: .6rem 0; }
.sb-text th, .sb-text td { border: 1px solid var(--line); padding: .3rem .6rem; }

/* Generic SRD entry renderer */
.srd-dl { margin: .2rem 0; }
.srd-dl dt {
  color: var(--muted); font-size: .78rem; text-transform: capitalize;
  letter-spacing: .04em; margin-top: .5rem;
}
.srd-dl dd { margin: .1rem 0 .3rem .9rem; }
.srd-dl.d0 > dt { color: var(--accent); font-size: .85rem; }
.srd-li { border-left: 2px solid var(--line); padding-left: .7rem; margin: .4rem 0; }
.srd-generic .b { margin: 0 .15rem .15rem 0; }

/* ===== Visual deck builder ===== */
.vb-setup-row { display: flex; gap: .8rem; align-items: center; margin-top: .6rem; }
.vb-filters { display: flex; gap: .6rem; flex-wrap: wrap; align-items: center; margin: 1rem 0; }
.vb-filters input {
  padding: .45rem .7rem; border-radius: 8px; border: 1px solid var(--line);
  background: var(--panel); color: var(--text); min-width: 220px;
}
.vb-tabs { display: flex; gap: 3px; flex-wrap: wrap; }
.vb-tab {
  padding: .25rem .65rem; border-radius: 999px; font-size: .8rem; cursor: pointer;
  background: none; border: 1px solid var(--line); color: var(--muted);
}
.vb-tab.on { background: var(--accent-2); color: #fff; border-color: var(--accent-2); }
.vb-colors { display: flex; gap: 4px; }
.vb-color { cursor: pointer; border: 2px solid transparent; opacity: .45; }
.vb-color.on { opacity: 1; border-color: var(--accent); }

.vb-cols { display: grid; grid-template-columns: 1fr 300px; gap: 1rem; align-items: start; }
@media (max-width: 860px) { .vb-cols { grid-template-columns: 1fr; } }

.vb-pool {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: .55rem; max-height: 74vh; overflow-y: auto; padding: .3rem;
  background: var(--panel); border: 1px solid var(--line); border-radius: 12px;
}
.vb-card { position: relative; cursor: pointer; border-radius: 8px; transition: transform .12s; }
.vb-card:hover { transform: translateY(-3px); }
.vb-card img { width: 100%; border-radius: 8px; display: block; }
.vb-card.maxed { opacity: .35; }
.vb-card .vb-qty {
  position: absolute; bottom: 6px; right: 6px; font-size: .72rem; font-weight: 700;
  background: rgba(20,18,28,.9); border: 1px solid var(--line); border-radius: 999px;
  padding: .05rem .45rem;
}
.vb-noimg {
  display: flex; align-items: center; justify-content: center; text-align: center;
  min-height: 150px; padding: .5rem; font-size: .75rem;
  background: var(--bg); border: 1px dashed var(--line); border-radius: 8px;
}

.vb-deck {
  position: sticky; top: 1rem; display: flex; flex-direction: column; gap: .55rem;
  background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: .9rem;
}
.vb-deck input, .vb-deck select {
  padding: .45rem .6rem; border-radius: 8px; border: 1px solid var(--line);
  background: var(--bg); color: var(--text); width: 100%;
}
.vb-count { font-size: 1.05rem; }
.vb-curve { display: flex; gap: 4px; align-items: flex-end; height: 84px; }
.vbc-col { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; }
.vbc-bar { width: 70%; background: linear-gradient(var(--accent), var(--accent-2)); border-radius: 3px 3px 0 0; min-height: 2px; }
.vbc-n { font-size: .66rem; color: var(--muted); }
.vbc-l { font-size: .68rem; color: var(--muted); margin-top: 2px; }
.vb-basics { display: flex; gap: 4px; flex-wrap: wrap; }
.vb-basic {
  font-size: .7rem; padding: .2rem .45rem; border-radius: 6px; cursor: pointer;
  background: var(--bg); border: 1px solid var(--line); color: var(--muted);
}
.vb-basic:hover { color: var(--text); border-color: var(--accent); }
.vb-decklist { max-height: 34vh; overflow-y: auto; }
.vb-row { display: flex; align-items: center; gap: .45rem; padding: .18rem 0; border-bottom: 1px solid var(--line); font-size: .86rem; }
.vb-rq { min-width: 1.2rem; text-align: right; font-weight: 700; }
.vb-rn { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.vb-minus {
  width: 20px; height: 20px; border-radius: 50%; line-height: 1; cursor: pointer;
  background: var(--bg); border: 1px solid var(--line); color: var(--danger); padding: 0;
}
