:root {
  color-scheme: dark;
  --bg: #090f1b;
  --panel: #121d2d;
  --panel-2: #1a293c;
  --line: #35475a;
  --ink: #f8f3e9;
  --ink-dim: #c5ced8;
  --ink-faint: #aab8c7;
  --accent: #f2c879;
  --accent-2: #a7d9ff;
  --accent-ink: #261906;
  --gold: #ffd17d;
  --gold-bg: #34291d;
  --gold-line: #8e7040;
  --purple: #d3afff;
  --purple-bg: #2b223a;
  --purple-line: #73568f;
  --blue: #95cefa;
  --blue-bg: #1b3143;
  --blue-line: #4b7798;
  --radius: 16px;
  --shadow: 0 24px 60px rgba(0, 0, 0, .34);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; min-height: 100vh; color: var(--ink); background:
  radial-gradient(ellipse 70% 30% at 50% -7%, rgba(239, 178, 81, .17), transparent 80%),
  radial-gradient(circle at 91% 19%, rgba(82, 126, 173, .11), transparent 27rem),
  repeating-linear-gradient(120deg, transparent 0 45px, rgba(238, 214, 168, .012) 45px 46px),
  var(--bg);
  font: 15px/1.5 ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
}
body::before { content: ""; position: fixed; inset: 0 0 auto; height: 5px; pointer-events: none;
  background: linear-gradient(90deg, transparent, #9a6c30 18%, #f5d48d 50%, #9a6c30 82%, transparent); z-index: 5; }
button, input { font: inherit; }
button { -webkit-tap-highlight-color: transparent; }
button:focus-visible, input:focus-visible { outline: 2px solid var(--accent-2); outline-offset: 3px; }
[hidden] { display: none !important; }
.wrap { max-width: 1400px; margin: 0 auto; padding: 34px clamp(16px, 3vw, 42px) 72px; }

/* Header: the crest and gold rule set the visual language for the tool. */
header { position: relative; display: grid; grid-template-columns: 122px minmax(0, 1fr) auto;
  align-items: center; gap: 26px; padding: 24px 22px 36px; margin-bottom: 19px;
  border-bottom: 1px solid rgba(242, 200, 121, .38); }
header::after { content: "◆"; position: absolute; bottom: -11px; left: 50%; transform: translateX(-50%);
  padding: 0 13px; color: var(--accent); background: var(--bg); font-size: 13px; }
.crest { display: grid; place-items: center; width: 122px; height: 122px; border-radius: 50%;
  background: radial-gradient(circle, rgba(241, 194, 104, .17), rgba(241, 194, 104, .045) 60%, transparent 70%);
  filter: drop-shadow(0 11px 13px rgba(0, 0, 0, .45)); }
.crest img { display: block; width: 106px; height: 106px; object-fit: contain; }
.eyebrow { margin: 0 0 5px; color: var(--accent); font-size: 12px; font-weight: 800;
  letter-spacing: .2em; text-transform: uppercase; }
header h1 { margin: 0 0 8px; font: 700 clamp(34px, 4.2vw, 56px)/1.05 Georgia, "Times New Roman", serif;
  letter-spacing: -.035em; text-shadow: 0 3px 22px rgba(0, 0, 0, .55); }
header p { max-width: 64ch; margin: 0; color: var(--ink-dim); font-size: 16px; line-height: 1.6; }
.hero-stat { min-width: 155px; padding: 15px 0 15px 26px; border-left: 1px solid var(--gold-line); text-align: right; }
.hero-stat b { display: block; color: var(--accent); font: 700 30px/1.1 Georgia, "Times New Roman", serif;
  font-variant-numeric: tabular-nums; }
.hero-stat span { display: block; margin-top: 5px; color: var(--ink-dim); font-size: 11px;
  font-weight: 700; letter-spacing: .08em; text-transform: uppercase; }

.layout { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(390px, .85fr);
  gap: 24px; align-items: start; }
.result-column { position: sticky; top: 18px; }
.panel { position: relative; padding: 24px; overflow: hidden; border: 1px solid var(--line);
  border-radius: var(--radius); background:
  linear-gradient(145deg, rgba(255, 255, 255, .045), transparent 37%),
  linear-gradient(180deg, #182536, var(--panel) 36%);
  box-shadow: var(--shadow), inset 0 0 0 1px rgba(255, 255, 255, .025); }
.panel::before { content: ""; position: absolute; inset: 0 26px auto; height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255, 215, 143, .55), transparent); pointer-events: none; }
.panel + .panel { margin-top: 20px; }
.panel h2 { margin: 0 0 5px; color: var(--ink); font: 700 27px/1.2 Georgia, "Times New Roman", serif;
  letter-spacing: -.02em; }
.panel h2::before { content: "✦"; margin-right: 10px; color: var(--accent); font: 18px/1 Georgia, serif; }
.sub { margin: 0 0 17px; color: var(--ink-dim); font-size: 13.5px; line-height: 1.5; }

/* Card collection */
.tier { margin: 0 0 26px; }
.tier:last-child { margin-bottom: 0; }
.tier-head { display: flex; align-items: center; gap: 10px; margin: 0 0 10px; padding-bottom: 7px;
  border-bottom: 1px solid var(--line); }
.tier-name { font-size: 12px; font-weight: 850; letter-spacing: .19em; text-transform: uppercase; }
.tier-name::before { content: "◆"; font-size: 9px; margin-right: 8px; vertical-align: 1px; }
.tier-name.Gold { color: var(--gold); }
.tier-name.Purple { color: var(--purple); }
.tier-name.Blue { color: var(--blue); }
.tier-head button { margin-left: auto; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(228px, 1fr)); gap: 10px; }
.card { position: relative; display: flex; align-items: center; gap: 11px; min-height: 92px;
  padding: 12px; color: var(--ink); border: 1px solid var(--line); border-left: 3px solid var(--tier-line);
  border-radius: 10px; background: linear-gradient(135deg, rgba(255, 255, 255, .035), transparent 55%), var(--panel-2);
  text-align: left; transition: border-color .18s, background .18s, transform .18s, box-shadow .18s; }
.card.Gold, .ico.Gold { --tier: var(--gold); --tier-bg: var(--gold-bg); --tier-line: var(--gold-line); }
.card.Purple, .ico.Purple { --tier: var(--purple); --tier-bg: var(--purple-bg); --tier-line: var(--purple-line); }
.card.Blue, .ico.Blue { --tier: var(--blue); --tier-bg: var(--blue-bg); --tier-line: var(--blue-line); }
.card:hover { transform: translateY(-2px); border-color: var(--tier-line);
  box-shadow: 0 10px 24px rgba(0, 0, 0, .23); }
.card.on { background: linear-gradient(135deg, var(--tier-bg), var(--panel-2) 74%);
  border-color: var(--tier-line); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .025); }
.card img { display: block; width: 50px; height: 60px; flex: 0 0 auto; object-fit: contain;
  filter: drop-shadow(0 5px 5px rgba(0, 0, 0, .48)); }
.card .txt { min-width: 0; flex: 1; }
.card .nm { display: block; color: var(--ink); font-size: 14px; font-weight: 750; line-height: 1.25; }
.card .st { display: block; margin-top: 3px; color: var(--ink-dim); font-size: 11.5px;
  font-variant-numeric: tabular-nums; }
.card:not(.on) .nm { color: #d2dce6; }
.lvbar { display: flex; gap: 3px; margin-top: 9px; }
.lvbar button { flex: 1; min-width: 0; min-height: 25px; padding: 1px 0; color: var(--ink-dim);
  border: 1px solid #536276; border-radius: 5px; background: rgba(8, 15, 26, .35);
  font-size: 11px; line-height: 1.2; cursor: pointer; transition: background .15s, border-color .15s; }
.lvbar button:hover { border-color: var(--tier); background: var(--tier-bg); }
.lvbar button[aria-pressed="true"] { color: var(--accent-ink); border-color: var(--tier); background: var(--tier); font-weight: 850; }

/* Utility actions and screenshot import */
button.mini { min-height: 32px; padding: 5px 10px; color: var(--ink-dim);
  border: 1px solid #526276; border-radius: 7px; background: rgba(14, 24, 37, .66);
  font-size: 12px; font-weight: 650; cursor: pointer; transition: background .15s, border-color .15s, color .15s; }
button.mini:hover { color: var(--ink); border-color: var(--accent); background: #27364b; }
button.mini.primary { color: var(--accent-ink); border-color: #f7d596;
  background: linear-gradient(#f9d994, #dfaa54); box-shadow: 0 3px 13px rgba(227, 165, 69, .18); }
button.mini.primary:hover { color: #211504; background: linear-gradient(#ffe3a8, #f0bd67); }
.import { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 13px;
  margin: 0 0 23px; padding: 14px; border: 1px solid rgba(242, 200, 121, .39);
  border-radius: 10px; background: linear-gradient(110deg, rgba(242, 200, 121, .075), transparent 85%); }
.import .sub { display: flex; align-items: center; gap: 7px; margin: 0; color: var(--ink-dim); }
.import input[type="checkbox"] { width: 16px; height: 16px; margin: 0; accent-color: var(--accent); }
.import #importNote { flex-basis: 100%; margin-top: 5px; color: var(--ink); }
.actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 24px; padding-top: 17px;
  border-top: 1px solid var(--line); }

/* Recommendation controls and rows */
.controls { display: flex; flex-wrap: wrap; gap: 13px 17px; align-items: flex-end; margin-top: 18px; }
.field { display: flex; flex-direction: column; gap: 7px; }
.field label { color: var(--ink-dim); font-size: 11px; font-weight: 800;
  letter-spacing: .11em; text-transform: uppercase; }
.seg { display: flex; gap: 3px; padding: 3px; border: 1px solid var(--line);
  border-radius: 9px; background: #0c1624; }
.seg button { min-height: 32px; padding: 5px 11px; color: var(--ink-dim); border: 0;
  border-radius: 6px; background: transparent; font-size: 12.5px; cursor: pointer; }
.seg button:hover { color: var(--ink); background: #26384b; }
.seg button[aria-pressed="true"] { color: var(--accent-ink); background: var(--accent);
  font-weight: 800; box-shadow: 0 2px 9px rgba(0, 0, 0, .2); }
.count { margin: 17px 0 11px; color: var(--ink-dim); font-size: 13px; }
.count b { color: var(--accent); font-variant-numeric: tabular-nums; }
ol.decks { list-style: none; margin: 0; padding: 0; }
ol.decks li { position: relative; display: grid; grid-template-columns: 31px minmax(0, 1fr) auto;
  align-items: center; gap: 10px; margin-top: 9px; padding: 12px 10px;
  border: 1px solid var(--line); border-radius: 10px; background: rgba(8, 17, 29, .45); }
ol.decks li:not(.empty):hover { border-color: #6b7989; background: #203047; }
ol.decks li:first-child:not(.empty) { padding: 16px 13px; border-color: var(--gold-line);
  background: linear-gradient(115deg, rgba(190, 132, 48, .2), rgba(25, 35, 49, .72) 75%);
  box-shadow: inset 0 0 0 1px rgba(255, 210, 125, .06); }
ol.decks li:first-child:not(.empty)::before { content: "BEST MATCH"; position: absolute; top: -10px; right: 11px;
  padding: 2px 7px; color: var(--accent-ink); border-radius: 4px; background: var(--accent);
  font-size: 9px; font-weight: 850; letter-spacing: .08em; }
ol.decks li.empty { display: block; padding: 17px; color: var(--ink-dim); }
.rank { align-self: start; padding-top: 12px; color: var(--ink-dim); font-size: 12px;
  font-weight: 800; text-align: center; font-variant-numeric: tabular-nums; }
ol.decks li:first-child .rank { color: var(--accent); }
.deck-body { min-width: 0; }
.icons { display: flex; flex-wrap: wrap; gap: 6px; padding: 2px 0 4px; }
.ico { position: relative; display: flex; flex-direction: column; align-items: center; width: 58px; }
.ico img { display: block; width: 52px; height: 61px; object-fit: contain;
  filter: drop-shadow(0 4px 5px rgba(0, 0, 0, .45)); }
.ico b { position: absolute; top: -5px; left: 50%; transform: translateX(-50%);
  padding: 2px 5px; color: var(--tier); border: 1px solid var(--tier-line); border-radius: 99px;
  background: #152033; font-size: 10px; line-height: 1; white-space: nowrap; }
.ico em { max-width: 58px; margin-top: 3px; overflow: hidden; color: var(--ink-dim);
  font-size: 10.5px; font-style: normal; text-align: center; text-overflow: ellipsis; white-space: nowrap; }
.meta { margin-top: 7px; color: var(--ink-dim); font-size: 11.5px; font-variant-numeric: tabular-nums; }
.score { min-width: 75px; text-align: right; font-variant-numeric: tabular-nums; }
.score b { display: block; color: var(--ink); font-size: 19px; font-weight: 800; letter-spacing: -.025em; }
ol.decks li:first-child .score b { color: var(--accent); font-size: 22px; }
.score span { display: block; color: var(--ink-dim); font-size: 10px; font-weight: 750;
  letter-spacing: .07em; text-transform: uppercase; }
.empty { color: var(--ink-dim); }
.upgrades { display: flex; flex-direction: column; gap: 9px; }
.upg { display: flex; flex-wrap: wrap; align-items: baseline; gap: 7px 9px; padding: 8px 0;
  border-top: 1px solid var(--line); font-size: 13px; }
.upg .delta { margin-left: auto; color: var(--accent); font-weight: 800; font-variant-numeric: tabular-nums; }
.chip { flex: 0 0 auto; padding: 3px 8px; border: 1px solid; border-radius: 99px; font-size: 11.5px; }
.chip.Gold { color: var(--gold); border-color: var(--gold-line); background: var(--gold-bg); }
.chip.Purple { color: var(--purple); border-color: var(--purple-line); background: var(--purple-bg); }
.chip.Blue { color: var(--blue); border-color: var(--blue-line); background: var(--blue-bg); }
footer { max-width: 100ch; margin: 35px auto 0; padding-top: 17px; border-top: 1px solid var(--line);
  color: var(--ink-dim); font-size: 12.5px; line-height: 1.75; }
footer b { color: var(--ink); }

@media (max-width: 1080px) {
  .layout { grid-template-columns: 1fr; }
  .result-column { position: static; }
}
@media (max-width: 700px) {
  .wrap { padding: 18px 15px 48px; }
  header { grid-template-columns: 76px minmax(0, 1fr); gap: 14px; padding: 15px 0 27px; }
  .crest { width: 76px; height: 76px; }
  .crest img { width: 70px; height: 70px; }
  header h1 { font-size: clamp(30px, 7vw, 42px); }
  header p { font-size: 13.5px; }
  .eyebrow { font-size: 10px; }
  .hero-stat { display: none; }
  .panel { padding: 18px; }
  .panel h2 { font-size: 24px; }
  .grid { grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); }
  .rank { padding-top: 7px; }
}
@media (max-width: 480px) {
  .panel { padding: 16px 13px; }
  ol.decks li { grid-template-columns: 24px minmax(0, 1fr); }
  .score { grid-column: 2; min-width: 0; display: flex; align-items: baseline; gap: 6px; text-align: left; }
  .score span { display: inline; }
  .ico { width: 48px; }
  .ico img { width: 44px; height: 52px; }
  .ico em { max-width: 48px; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .card, button { transition: none !important; }
  .card:hover { transform: none; }
}

/* standard back link, same wording/styling as the other tool pages */
.kc-home{display:inline-flex;align-items:center;margin:0 0 12px;color:var(--accent);font:600 .8rem system-ui,sans-serif;text-decoration:none;white-space:nowrap;padding:.35rem .75rem;border:1px solid var(--gold-line);border-radius:999px;background:var(--gold-bg)}
.kc-home:hover{color:var(--gold);border-color:var(--gold)}
