/*
Theme Name: cEDH MTG
Theme URI: https://cedhmtg.com
Author: cEDHMTG.com
Description: Theme for a competitive Commander (cEDH) decklist site. The theme owns everything visual and everything about cards: card images and prices (card cache with a background job), Commander rules (ban list, singleton, color identity), card tiles, the sticky side panel, status words, deck pages, the decklists gallery, commander pages, staples, the deck checker, header, footer, fonts, colors, ember particles and animations. Decklist plugins only supply lists through the cedh_decks filter.
Version: 2026.11.22.2
Requires at least: 6.2
Requires PHP: 7.4
Text Domain: cedh-theme
*/

/* =========================================================
   TOKENS. Change a color or font here and it changes everywhere.
========================================================= */
html, body { background: #0b0708; margin: 0; }
html, body { overflow-x: clip; max-width: 100%; }
#cm-root {
  --cm-bg: #0b0708;
  --cm-bg-2: #130b0d;
  --cm-surface: rgba(44, 16, 23, 0.52);
  --cm-surface-2: rgba(22, 11, 14, 0.78);
  --cm-solid: #170d10;
  --cm-border: rgba(255, 61, 87, 0.16);
  --cm-border-2: rgba(255, 255, 255, 0.07);
  --cm-accent: #ff3d57;
  --cm-accent-2: #ff9a3c;
  --cm-text: #e8dadc;
  --cm-dim: #a38e92;
  --cm-white: #fff5f6;
  --cm-banned: #b47bff;
  --cm-warn: #ff9a3c;
  --cm-muted: #9b8a8e;
  --cm-gold: #f4c542;
  --cm-ok: #4fe0a0;
  --cm-radius: 14px;
  --cm-head: 'Oxanium', 'Segoe UI', sans-serif;
  --cm-body: 'Manrope', 'Segoe UI', sans-serif;
  --cm-header-h: 66px;

  position: relative; min-height: 100vh;
  background:
    radial-gradient(ellipse 80% 50% at 50% -10%, rgba(255, 61, 87, 0.13), transparent 60%),
    radial-gradient(ellipse 60% 40% at 100% 100%, rgba(255, 154, 60, 0.06), transparent 60%),
    var(--cm-bg);
  color: var(--cm-text);
  font-family: var(--cm-body); font-size: 15px; line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}
#cm-root *, #cm-root *::before, #cm-root *::after { box-sizing: border-box; }
#cm-root a { color: inherit; text-decoration: none; }
#cm-root img { max-width: 100%; }
#cm-root h1, #cm-root h2, #cm-root h3, #cm-root h4, #cm-root h5 { font-family: var(--cm-head); color: var(--cm-white); margin: 0; letter-spacing: 0.005em; line-height: 1.15; }
#cm-root button { font-family: inherit; }
#cm-root .cm-main { position: relative; z-index: 1; }
#cm-root .cm-container { max-width: 1240px; margin: 0 auto; padding: 0 24px; }
#cm-root .cm-narrow { max-width: 820px; }
#cm-root .cm-hidden { display: none !important; }
#cm-root ::selection { background: var(--cm-accent); color: #fff; }

#cm-root .cm-eyebrow {
  display: inline-flex; align-items: center; gap: 9px;
  font-family: var(--cm-head); font-size: 12px; font-weight: 700; letter-spacing: 0.2em; text-transform: uppercase;
  color: var(--cm-accent);
}
#cm-root .cm-eyebrow::before { content: ""; width: 18px; height: 2px; background: linear-gradient(90deg, var(--cm-accent), var(--cm-accent-2)); border-radius: 2px; }
#cm-root .cm-caption { font-size: 12px; color: var(--cm-dim); }
#cm-root .cm-empty { color: var(--cm-dim); padding: 30px 0; text-align: center; }
#cm-root .cm-loading { color: var(--cm-dim); padding: 60px 0; text-align: center; }

@media (prefers-reduced-motion: reduce) { #cm-root *, #cm-root *::before, #cm-root *::after { animation: none !important; transition: none !important; } }

/* =========================================================
   BUTTONS, CHIPS, INPUTS
========================================================= */
#cm-root .cm-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; position: relative;
  font-family: var(--cm-head); font-weight: 700; font-size: 0.95rem; letter-spacing: 0.02em;
  padding: 13px 24px; border-radius: 10px; border: 1px solid transparent; cursor: pointer;
  transition: transform .18s ease, box-shadow .2s ease, border-color .2s ease, color .2s ease, background .2s ease;
  white-space: nowrap;
}
#cm-root .cm-btn-sm { padding: 9px 16px; font-size: 0.85rem; border-radius: 9px; }
#cm-root .cm-btn-primary {
  background: linear-gradient(110deg, var(--cm-accent), #ff5b3d 60%, var(--cm-accent-2)); color: #fff;
  box-shadow: 0 8px 26px -10px rgba(255, 61, 87, 0.7), inset 0 1px 0 rgba(255,255,255,0.25);
}
#cm-root .cm-btn-primary:hover { transform: translateY(-2px); box-shadow: 0 14px 34px -10px rgba(255, 61, 87, 0.85), inset 0 1px 0 rgba(255,255,255,0.25); }
#cm-root .cm-btn-ghost { background: rgba(255,255,255,0.03); border-color: rgba(255,255,255,0.14); color: var(--cm-white); }
#cm-root .cm-btn-ghost:hover { border-color: var(--cm-accent); color: var(--cm-accent); }
#cm-root .cm-btn-quiet { background: none; color: var(--cm-dim); padding-left: 10px; padding-right: 10px; }
#cm-root .cm-btn-quiet:hover { color: var(--cm-white); }
#cm-root .cm-btn:disabled { opacity: 0.45; cursor: not-allowed; transform: none; }

#cm-root .cm-chip {
  font-family: var(--cm-body); font-size: 12.5px; font-weight: 700; padding: 7px 14px; border-radius: 30px; cursor: pointer;
  border: 1px solid var(--cm-border-2); background: rgba(255,255,255,0.04); color: var(--cm-text);
  transition: border-color .15s, color .15s, background .15s, transform .15s; user-select: none;
}
#cm-root .cm-chip span { color: var(--cm-dim); font-weight: 600; margin-left: 2px; }
#cm-root .cm-chip:hover { border-color: var(--cm-accent); color: var(--cm-white); }
#cm-root .cm-chip[aria-pressed="true"] { background: linear-gradient(110deg, var(--cm-accent), var(--cm-accent-2)); border-color: transparent; color: #fff; }
#cm-root .cm-chip[aria-pressed="true"] span { color: rgba(255,255,255,0.8); }
#cm-root .cm-chip-sm { padding: 5px 11px; font-size: 12px; }
#cm-root .cm-chips { display: flex; flex-wrap: wrap; gap: 6px; }

#cm-root .cm-select { display: inline-flex; align-items: center; gap: 8px; font-size: 12px; color: var(--cm-dim); }
#cm-root .cm-select select {
  appearance: none; -webkit-appearance: none; cursor: pointer;
  background: var(--cm-surface-2) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 10 6'%3E%3Cpath d='M1 1l4 4 4-4' fill='none' stroke='%23ff3d57' stroke-width='1.6'/%3E%3C/svg%3E") no-repeat right 10px center / 10px;
  border: 1px solid var(--cm-border-2); border-radius: 8px; color: var(--cm-white);
  font: 600 13px var(--cm-body); padding: 7px 30px 7px 11px;
}
#cm-root .cm-select select:focus { outline: none; border-color: var(--cm-accent); }

#cm-root .cm-search {
  display: flex; align-items: center; gap: 9px; flex: 1 1 240px; min-width: 200px;
  background: var(--cm-surface-2); border: 1px solid var(--cm-border-2); border-radius: 10px; padding: 0 14px;
  transition: border-color .2s, box-shadow .2s;
}
#cm-root .cm-search svg { width: 17px; height: 17px; color: var(--cm-dim); flex-shrink: 0; }
#cm-root .cm-search input { flex: 1; min-width: 0; background: none; border: 0; outline: 0; color: var(--cm-white); font: 500 14px var(--cm-body); padding: 11px 0; }
#cm-root .cm-search input::placeholder { color: var(--cm-dim); }
#cm-root .cm-search:focus-within { border-color: var(--cm-accent); box-shadow: 0 0 0 3px rgba(255, 61, 87, 0.15); }
#cm-root .cm-search-lg { padding: 0 18px; border-radius: 12px; }
#cm-root .cm-search-lg input { font-size: 16px; padding: 16px 0; }

#cm-root .cm-segmented { display: inline-flex; background: var(--cm-surface-2); border: 1px solid var(--cm-border-2); border-radius: 10px; padding: 3px; }
#cm-root .cm-segmented button {
  display: inline-flex; align-items: center; gap: 6px; background: none; border: 0; cursor: pointer;
  color: var(--cm-dim); font: 700 12.5px var(--cm-body); padding: 7px 13px; border-radius: 7px; transition: color .15s, background .15s;
}
#cm-root .cm-segmented button svg { width: 14px; height: 14px; }
#cm-root .cm-segmented button:hover { color: var(--cm-white); }
#cm-root .cm-segmented button.cm-active { background: rgba(255, 61, 87, 0.16); color: var(--cm-white); box-shadow: inset 0 0 0 1px rgba(255, 61, 87, 0.4); }

#cm-root .cm-dropdown { position: relative; display: inline-block; }
#cm-root .cm-dropdown-menu {
  display: none; position: absolute; top: calc(100% + 8px); left: 0; min-width: 190px; z-index: 60;
  background: var(--cm-solid); border: 1px solid var(--cm-border); border-radius: 10px; padding: 6px;
  box-shadow: 0 24px 50px -16px rgba(0,0,0,0.8);
}
#cm-root .cm-dropdown.cm-open .cm-dropdown-menu { display: block; }
#cm-root .cm-dropdown-menu a, #cm-root .cm-dropdown-menu button {
  display: block; width: 100%; text-align: left; background: none; border: 0; cursor: pointer;
  color: var(--cm-white); font: 600 13px var(--cm-body); padding: 9px 12px; border-radius: 7px;
}
#cm-root .cm-dropdown-menu a:hover, #cm-root .cm-dropdown-menu button:hover { background: rgba(255, 61, 87, 0.12); color: var(--cm-accent); }
#cm-root .cm-account .cm-dropdown-menu { left: auto; right: 0; min-width: 150px; }

#cm-root .cm-link { display: inline-flex; align-items: center; gap: 6px; font-weight: 700; font-size: 13.5px; color: var(--cm-white); }
#cm-root .cm-link svg { width: 15px; height: 15px; color: var(--cm-accent); transition: transform .2s; }
#cm-root .cm-link:hover svg { transform: translateX(3px); }

/* =========================================================
   HEADER
========================================================= */
#cm-root .cm-header {
  position: sticky; top: 0; z-index: 50;
  background: rgba(11, 7, 8, 0.8); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--cm-border-2);
}
#cm-root .cm-header::after { content: ""; position: absolute; left: 0; right: 0; bottom: -1px; height: 1px; background: linear-gradient(90deg, transparent, rgba(255, 61, 87, 0.5), transparent); }
#cm-root .cm-header-inner { max-width: 1240px; margin: 0 auto; padding: 0 24px; height: var(--cm-header-h); display: flex; align-items: center; gap: 28px; }
#cm-root .cm-logo { display: inline-flex; align-items: center; gap: 10px; flex-shrink: 0; }
#cm-root .cm-logo-mark { width: 34px; height: 34px; filter: drop-shadow(0 0 10px rgba(255, 61, 87, 0.45)); }
#cm-root .cm-custom-logo { max-height: 40px; width: auto; }
#cm-root .cm-wordmark { font-family: var(--cm-head); font-size: 1.25rem; line-height: 1; color: var(--cm-white); letter-spacing: 0.01em; }
#cm-root .cm-wordmark b { font-weight: 800; }
#cm-root .cm-wordmark i { font-style: normal; font-weight: 600; color: var(--cm-accent); margin-left: 3px; font-size: 0.78em; letter-spacing: 0.12em; }
#cm-root .cm-nav { display: flex; align-items: center; gap: 4px; flex: 1; }
#cm-root .cm-nav a { position: relative; font-weight: 600; font-size: 14px; color: var(--cm-text); padding: 8px 12px; border-radius: 8px; transition: color .15s, background .15s; white-space: nowrap; }
#cm-root .cm-nav a:hover { color: var(--cm-white); background: rgba(255,255,255,0.04); }
#cm-root .cm-nav a.current-menu-item, #cm-root .cm-nav a[aria-current="page"] { color: var(--cm-white); }
#cm-root .cm-header-cta { display: flex; align-items: center; gap: 10px; margin-left: auto; }
#cm-root .cm-short { display: none; }
#cm-root .cm-icon-btn {
  width: 38px; height: 38px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; cursor: pointer;
  background: rgba(255, 61, 87, 0.1); border: 1px solid rgba(255, 61, 87, 0.45); color: var(--cm-accent);
}
#cm-root .cm-icon-btn svg { width: 18px; height: 18px; }
#cm-root .cm-nav-toggle { display: none; width: 40px; height: 40px; border-radius: 9px; background: none; border: 1px solid var(--cm-border-2); cursor: pointer; padding: 11px 10px; flex-direction: column; justify-content: space-between; }
#cm-root .cm-nav-toggle span { display: block; height: 2px; background: var(--cm-white); border-radius: 2px; transition: transform .2s, opacity .2s; }
#cm-root .cm-nav-toggle.cm-open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
#cm-root .cm-nav-toggle.cm-open span:nth-child(2) { opacity: 0; }
#cm-root .cm-nav-toggle.cm-open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* =========================================================
   SITEWIDE EFFECTS: embers, trails, share rail, back to top
========================================================= */
#cm-root #cm-embers { position: fixed; inset: 0; width: 100%; height: 100vh; z-index: 0; pointer-events: none; }

#cm-root .cm-trail { position: relative; }
#cm-root .cm-trail-svg { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 6; overflow: visible; }
#cm-root .cm-trail-svg rect {
  fill: none; stroke: var(--cm-accent); stroke-width: 2; stroke-linecap: round;
  filter: drop-shadow(0 0 3px var(--cm-accent)) drop-shadow(0 0 8px rgba(255, 61, 87, 0.7));
  animation: cm-trail 9s linear infinite;
}
#cm-root .cm-btn-primary .cm-trail-svg rect { stroke: rgba(255,255,255,0.95); filter: drop-shadow(0 0 3px #fff); }
@keyframes cm-trail { to { stroke-dashoffset: var(--cm-trail-len, -400); } }

#cm-root .cm-ring { position: relative; }
#cm-root .cm-ring::before {
  content: ""; position: absolute; inset: -3px; border-radius: 50%; padding: 2px; pointer-events: none; z-index: 3;
  background: conic-gradient(from 0deg, transparent 0%, var(--cm-accent) 10%, var(--cm-accent-2) 16%, transparent 26%, transparent 100%);
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0); -webkit-mask-composite: xor; mask-composite: exclude;
  animation: cm-spin 14s linear infinite;
}
@keyframes cm-spin { to { transform: rotate(360deg); } }

#cm-root .cm-share { position: fixed; left: 18px; top: 50%; transform: translateY(-50%); z-index: 40; display: flex; flex-direction: column; gap: 12px; }
#cm-root .cm-share-btn, #cm-root .cm-to-top {
  width: 46px; height: 46px; border-radius: 50%; display: flex; align-items: center; justify-content: center; cursor: pointer;
  background: rgba(22, 11, 14, 0.85); border: 1px solid var(--cm-border); color: var(--cm-accent);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); box-shadow: 0 0 16px rgba(255, 61, 87, 0.18);
  transition: transform .2s, box-shadow .2s, border-color .2s;
}
#cm-root .cm-share-btn:hover, #cm-root .cm-to-top:hover { transform: scale(1.08); border-color: var(--cm-accent); box-shadow: 0 0 26px rgba(255, 61, 87, 0.5); }
#cm-root .cm-share-btn svg, #cm-root .cm-to-top svg { width: 19px; height: 19px; position: relative; z-index: 2; }
#cm-root .cm-share-copied { position: absolute; left: 56px; white-space: nowrap; font-size: 11px; background: var(--cm-solid); border: 1px solid var(--cm-border); padding: 4px 9px; border-radius: 6px; opacity: 0; pointer-events: none; transition: opacity .2s; }
#cm-root .cm-share-btn.cm-copied .cm-share-copied { opacity: 1; }
#cm-root .cm-to-top { position: fixed; right: 22px; bottom: 24px; z-index: 45; opacity: 0; visibility: hidden; transform: translateY(10px); transition: opacity .25s, transform .25s, visibility .25s; }
#cm-root .cm-to-top.cm-visible { opacity: 1; visibility: visible; transform: none; }
@media (max-width: 1320px) { #cm-root .cm-share { display: none; } }

/* Image loading spinner (every image, automatically) */
#cm-root .cm-img-wrap { position: relative; }
#cm-root .cm-img-wrap > img { opacity: 0; transition: opacity .25s ease; }
#cm-root .cm-img-wrap.cm-img-ready > img { opacity: 1; }
#cm-root .cm-img-wrap:not(.cm-img-ready)::before {
  content: ""; position: absolute; top: 50%; left: 50%; width: 24px; height: 24px; margin: -12px 0 0 -12px; z-index: 5;
  border-radius: 50%; border: 3px solid rgba(255, 61, 87, 0.18); border-top-color: var(--cm-accent); animation: cm-spin .8s linear infinite;
}

/* =========================================================
   SECTIONS AND HEROES
========================================================= */
#cm-root .cm-section { padding: 80px 0; position: relative; }
#cm-root .cm-section-tight { padding: 40px 0; }
#cm-root .cm-section-alt { background: linear-gradient(180deg, transparent, rgba(255, 61, 87, 0.04), transparent); }
#cm-root .cm-section-head { margin-bottom: 26px; max-width: 760px; }
#cm-root .cm-section-head h2 { font-size: clamp(1.5rem, 2.6vw, 2.15rem); font-weight: 700; margin-top: 10px; }
#cm-root .cm-section-head p { color: var(--cm-dim); margin: 10px 0 0; }
#cm-root .cm-row-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; max-width: none; }
#cm-root .cm-row-head h2 { margin-top: 6px; }

#cm-root .cm-page-hero { padding: 72px 0 42px; text-align: center; border-bottom: 1px solid var(--cm-border-2); position: relative; }
#cm-root .cm-page-hero h1 { font-size: clamp(2.1rem, 5vw, 3.4rem); font-weight: 800; margin-top: 14px; }
#cm-root .cm-page-hero p, #cm-root .cm-page-intro { color: var(--cm-dim); max-width: 640px; margin: 14px auto 0; font-size: 1.02rem; }
#cm-root .cm-page-hero-sm { padding: 54px 0 30px; }
#cm-root .cm-page-hero-sm h1 { font-size: clamp(1.9rem, 4vw, 2.8rem); margin-top: 0; }
#cm-root .cm-hero-stats { display: inline-flex; gap: 32px; margin-top: 26px; flex-wrap: wrap; justify-content: center; }
#cm-root .cm-hero-stats div { display: flex; flex-direction: column; align-items: center; }
#cm-root .cm-hero-stats b { font-family: var(--cm-head); font-size: 1.7rem; color: var(--cm-white); line-height: 1; }
#cm-root .cm-hero-stats span { font-size: 11px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--cm-dim); margin-top: 6px; }

#cm-root .cm-crumbs { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; font-size: 12.5px; color: var(--cm-dim); margin-bottom: 14px; }
#cm-root .cm-crumbs a:hover { color: var(--cm-accent); }
#cm-root .cm-crumbs span { opacity: 0.6; }

/* =========================================================
   PIPS, TAGS, PILLS
========================================================= */
#cm-root .cm-pips { display: inline-flex; gap: 3px; align-items: center; }
#cm-root .cm-pip {
  width: 18px; height: 18px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center;
  font: 800 9px var(--cm-body); border: 1px solid rgba(0,0,0,0.35); box-shadow: inset 0 -2px 0 rgba(0,0,0,0.18);
}
#cm-root .cm-pip-w { background: #f3ecd2; color: #3b3425; }
#cm-root .cm-pip-u { background: #3fa7ff; color: #061a2c; }
#cm-root .cm-pip-b { background: #4a3f4d; color: #efe5f3; }
#cm-root .cm-pip-r { background: #ff4d4d; color: #2b0606; }
#cm-root .cm-pip-g { background: #3fd27a; color: #052414; }
#cm-root .cm-pip-c { background: #b9b0b2; color: #2a2425; }
#cm-root .cm-pip-btn { width: 30px; height: 30px; font-size: 12px; cursor: pointer; opacity: 0.35; transition: opacity .15s, transform .15s, box-shadow .15s; }
#cm-root .cm-pip-btn:hover { opacity: 0.75; }
#cm-root .cm-pip-btn[aria-pressed="true"] { opacity: 1; transform: scale(1.08); box-shadow: 0 0 0 2px var(--cm-bg), 0 0 0 4px var(--cm-accent); }

#cm-root .cm-tag {
  display: inline-block; font: 800 10px var(--cm-body); letter-spacing: 0.08em; text-transform: uppercase;
  padding: 4px 9px; border-radius: 20px; background: rgba(11, 7, 8, 0.82); color: var(--cm-white); border: 1px solid rgba(255,255,255,0.22);
}
#cm-root .cm-tag-turbo { color: #ff8a8a; border-color: rgba(255, 61, 87, 0.6); }
#cm-root .cm-tag-midrange { color: #ffc07a; border-color: rgba(255, 154, 60, 0.6); }
#cm-root .cm-tag-stax { color: #c9a8ff; border-color: rgba(180, 123, 255, 0.6); }
#cm-root .cm-tag-budget { color: #7ef0bd; border-color: rgba(79, 224, 160, 0.6); }
#cm-root .cm-tag-control { color: #8cc8ff; border-color: rgba(63, 167, 255, 0.6); }

#cm-root .cm-legal { display: inline-flex; align-items: center; gap: 5px; font: 800 11px var(--cm-body); letter-spacing: 0.04em; text-transform: uppercase; padding: 4px 9px; border-radius: 20px; }
#cm-root .cm-legal svg { width: 12px; height: 12px; }
#cm-root .cm-legal-ok { color: var(--cm-ok); background: rgba(79, 224, 160, 0.1); border: 1px solid rgba(79, 224, 160, 0.35); }
#cm-root .cm-legal-bad { color: var(--cm-warn); background: rgba(255, 154, 60, 0.1); border: 1px solid rgba(255, 154, 60, 0.4); }
#cm-root .cm-legal-pending { color: var(--cm-dim); border: 1px dashed rgba(255,255,255,0.2); }
#cm-root .cm-stat-chip {
  display: inline-flex; align-items: center; gap: 7px; font-size: 12.5px; font-weight: 700; color: var(--cm-text);
  padding: 5px 11px; border-radius: 20px; background: rgba(255,255,255,0.04); border: 1px solid var(--cm-border-2);
}
#cm-root .cm-stat-chip .cm-pip { width: 15px; height: 15px; font-size: 7.5px; }
#cm-root .cm-stat-gold { color: var(--cm-gold); border-color: rgba(244, 197, 66, 0.35); }
#cm-root .cm-stat-quiet { color: var(--cm-dim); }
#cm-root .cm-deck-stats-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 18px; }
#cm-root .cm-issues { margin: 14px 0 0; padding: 12px 14px 12px 32px; border-radius: 10px; background: rgba(255, 154, 60, 0.07); border: 1px solid rgba(255, 154, 60, 0.25); color: #ffd2a8; font-size: 13.5px; }
#cm-root .cm-issues li + li { margin-top: 4px; }

/* Status words (Banned, Off-color...). Labels come from the theme's PHP. */
#cm-root .cm-flags { display: flex; flex-wrap: wrap; gap: 4px; justify-content: center; }
#cm-root .cm-flag { font: 800 9.5px var(--cm-body); letter-spacing: 0.05em; text-transform: uppercase; padding: 3px 7px; border-radius: 12px; white-space: nowrap; border: 1px solid; }
#cm-root .cm-flag-banned { color: var(--cm-banned); background: rgba(180, 123, 255, 0.12); border-color: rgba(180, 123, 255, 0.55); }
#cm-root .cm-flag-warn { color: var(--cm-warn); background: rgba(255, 154, 60, 0.12); border-color: rgba(255, 154, 60, 0.55); }
#cm-root .cm-flag-muted { color: var(--cm-muted); background: rgba(255,255,255,0.05); border-color: rgba(255,255,255,0.2); }
#cm-root .cm-flag-gold { color: var(--cm-gold); background: rgba(244, 197, 66, 0.1); border-color: rgba(244, 197, 66, 0.45); }

/* =========================================================
   DECK TILES (small thumbnails)
========================================================= */
#cm-root .cm-deck-grid { display: grid; gap: 16px; grid-template-columns: repeat(6, minmax(0, 1fr)); }
#cm-root .cm-deck-grid-wide { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 20px; }
#cm-root .cm-deck-grid-ad { grid-column: 1 / -1; }
#cm-root .cm-deck-tile {
  display: flex; flex-direction: column; position: relative; overflow: hidden;
  background: linear-gradient(170deg, rgba(44, 16, 23, 0.6), rgba(22, 11, 14, 0.75));
  border: 1px solid var(--cm-border); border-radius: 12px;
  transition: transform .22s cubic-bezier(.2,.8,.2,1), border-color .22s, box-shadow .22s;
}
#cm-root .cm-deck-tile:hover { transform: translateY(-4px); border-color: rgba(255, 61, 87, 0.55); box-shadow: 0 22px 44px -22px rgba(255, 61, 87, 0.55); }
#cm-root .cm-deck-tile-thumb { position: relative; aspect-ratio: 4 / 3; overflow: hidden; background: linear-gradient(135deg, #2a1015, #120a0c); }
#cm-root .cm-deck-tile-thumb > img, #cm-root .cm-deck-tile-split img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; transition: transform .4s cubic-bezier(.2,.8,.2,1); }
#cm-root .cm-deck-tile-split { position: absolute; inset: 0; display: grid; grid-template-columns: 1fr 1fr; }
#cm-root .cm-deck-tile-split img { position: relative; }
#cm-root .cm-deck-tile-split .cm-img-wrap, #cm-root .cm-deck-tile-split > * { position: relative; overflow: hidden; }
#cm-root .cm-deck-tile:hover .cm-deck-tile-thumb img { transform: scale(1.07); }
#cm-root .cm-deck-tile-thumb::after { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, rgba(11,7,8,0) 40%, rgba(11,7,8,0.85)); pointer-events: none; }
#cm-root .cm-deck-tile-pips { position: absolute; left: 8px; bottom: 8px; z-index: 2; }
#cm-root .cm-deck-tile-pips .cm-pip { width: 16px; height: 16px; font-size: 8px; }
#cm-root .cm-deck-tile-tags { position: absolute; top: 8px; left: 8px; z-index: 2; display: flex; gap: 4px; flex-wrap: wrap; }
#cm-root .cm-deck-tile-tags .cm-tag { font-size: 8.5px; padding: 3px 7px; }
#cm-root .cm-deck-tile-body { padding: 10px 11px 11px; display: flex; flex-direction: column; flex: 1; }
#cm-root .cm-deck-tile-cmdr { font-size: 10.5px; font-weight: 700; color: var(--cm-accent); text-transform: uppercase; letter-spacing: 0.06em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#cm-root .cm-deck-tile h4 { font-size: 0.93rem; font-weight: 700; margin-top: 3px; line-height: 1.25; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
#cm-root .cm-deck-tile-meta { font-size: 11px; color: var(--cm-dim); margin-top: 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#cm-root .cm-dot { margin: 0 5px; opacity: 0.6; }
#cm-root .cm-deck-tile-foot { display: flex; justify-content: space-between; align-items: center; gap: 6px; margin-top: auto; padding-top: 9px; }
#cm-root .cm-deck-tile-foot .cm-legal { font-size: 10px; padding: 3px 7px; }
#cm-root .cm-deck-tile-price { font-size: 11.5px; font-weight: 600; color: var(--cm-dim); }
#cm-root .cm-deck-grid-wide .cm-deck-tile h4 { font-size: 1.05rem; }
#cm-root .cm-deck-grid-wide .cm-deck-tile-body { padding: 14px 16px 15px; }
#cm-root .cm-deck-grid-wide .cm-deck-tile-meta { font-size: 12px; }

/* Centered row (More lists / Other commanders under a deck): six across, centered when fewer */
#cm-root .cm-deck-grid-center { display: flex; flex-wrap: wrap; justify-content: center; }
#cm-root .cm-deck-grid-center > .cm-deck-tile { width: calc((100% - 5 * 16px) / 6); }

/* Editor review bar on draft lists */
#cm-root .cm-editor-strip { background: rgba(255,255,255,0.04); border-bottom: 1px solid var(--cm-border-2); padding: 10px 0; font-size: 13.5px; }
#cm-root .cm-editor-strip.cm-is-draft { background: rgba(244, 197, 66, 0.1); border-bottom-color: rgba(244, 197, 66, 0.35); color: #ffe39a; }
#cm-root .cm-editor-strip .cm-container { display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap; }
#cm-root .cm-editor-links { display: flex; gap: 8px; }
#cm-root .cm-tag-draft { color: #2a1d00; background: var(--cm-gold); border-color: var(--cm-gold); }

/* =========================================================
   COMMANDER TILES AND STRIP
========================================================= */
#cm-root .cm-cmdr-grid { display: grid; gap: 16px; grid-template-columns: repeat(4, minmax(0, 1fr)); }
#cm-root .cm-cmdr-tile {
  display: flex; align-items: stretch; overflow: hidden; border-radius: 12px; position: relative;
  background: var(--cm-surface); border: 1px solid var(--cm-border); transition: transform .2s, border-color .2s, box-shadow .2s;
}
#cm-root .cm-cmdr-tile:hover { transform: translateY(-3px); border-color: rgba(255, 61, 87, 0.55); box-shadow: 0 18px 40px -22px rgba(255, 61, 87, 0.6); }
#cm-root .cm-cmdr-tile-art { width: 92px; flex-shrink: 0; position: relative; overflow: hidden; display: grid; }
#cm-root .cm-cmdr-tile-art.cm-split { grid-template-rows: 1fr 1fr; }
#cm-root .cm-cmdr-tile-art img { width: 100%; height: 100%; object-fit: cover; display: block; }
#cm-root .cm-cmdr-tile-art > * { min-height: 0; overflow: hidden; }
#cm-root .cm-cmdr-tile-body { padding: 13px 14px; display: flex; flex-direction: column; justify-content: center; gap: 8px; min-width: 0; }
#cm-root .cm-cmdr-tile h4 { font-size: 0.98rem; font-weight: 700; line-height: 1.25; }
#cm-root .cm-cmdr-tile-meta { display: flex; align-items: center; gap: 10px; font-size: 12px; color: var(--cm-dim); font-weight: 600; }
#cm-root .cm-cmdr-tile-meta .cm-pip { width: 15px; height: 15px; font-size: 7.5px; }

#cm-root .cm-cmdr-strip { display: flex; gap: 8px; overflow-x: auto; padding: 2px 2px 14px; margin-bottom: 18px; scrollbar-width: thin; scrollbar-color: rgba(255,61,87,0.4) transparent; }
#cm-root .cm-cmdr-chip {
  display: inline-flex; align-items: center; gap: 8px; flex-shrink: 0; padding: 4px 12px 4px 4px; border-radius: 40px;
  background: var(--cm-surface-2); border: 1px solid var(--cm-border-2); font-size: 13px; font-weight: 700; color: var(--cm-white); transition: border-color .15s;
}
#cm-root .cm-cmdr-chip:hover { border-color: var(--cm-accent); }
#cm-root .cm-cmdr-chip > img { width: 30px; height: 30px; border-radius: 50%; object-fit: cover; flex-shrink: 0; }
#cm-root .cm-cmdr-chip.cm-img-wrap::before { width: 14px; height: 14px; margin: 0; left: 12px; top: 12px; border-width: 2px; }
#cm-root .cm-cmdr-chip b { font-size: 11px; color: var(--cm-accent); background: rgba(255, 61, 87, 0.12); padding: 1px 7px; border-radius: 10px; }

/* Filter bar */
#cm-root .cm-filterbar {
  display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin-bottom: 22px; padding: 12px;
  background: rgba(22, 11, 14, 0.6); border: 1px solid var(--cm-border-2); border-radius: 14px;
  position: sticky; top: calc(var(--cm-header-h) + 8px); z-index: 20; backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
}
#cm-root .cm-color-filter { display: flex; gap: 6px; }
#cm-root .cm-filter-count { margin-left: auto; font-size: 12.5px; color: var(--cm-dim); font-weight: 600; white-space: nowrap; }

/* =========================================================
   DECK PAGE
========================================================= */
#cm-root .cm-deck-hero, #cm-root .cm-hub-hero { padding: 46px 0 34px; border-bottom: 1px solid var(--cm-border-2); }
#cm-root .cm-deck-hero-inner, #cm-root .cm-hub-hero-inner { display: grid; grid-template-columns: 250px 1fr; gap: 44px; align-items: start; }
#cm-root .cm-deck-hero-cmdrs { position: relative; }
#cm-root .cm-deck-hero-card { display: block; border-radius: 13px; overflow: hidden; aspect-ratio: 5 / 7; background: #1a0e11; box-shadow: 0 30px 60px -25px rgba(0,0,0,0.9), 0 0 0 1px rgba(255, 61, 87, 0.25); transition: transform .3s cubic-bezier(.2,.8,.2,1); }
#cm-root .cm-deck-hero-card img { width: 100%; height: 100%; object-fit: cover; display: block; }
#cm-root .cm-deck-hero-card:hover { transform: translateY(-4px) rotate(-0.6deg); }
#cm-root .cm-deck-hero-cmdrs.cm-two { height: 0; padding-bottom: 150%; }
#cm-root .cm-deck-hero-cmdrs.cm-two .cm-deck-hero-card { position: absolute; width: 82%; }
#cm-root .cm-deck-hero-cmdrs.cm-two .cm-deck-hero-card:first-child { left: 0; top: 0; transform: rotate(-4deg); z-index: 1; }
#cm-root .cm-deck-hero-cmdrs.cm-two .cm-deck-hero-card:last-child { right: 0; top: 16%; transform: rotate(4deg); z-index: 2; }
#cm-root .cm-deck-hero-cmdrs.cm-two .cm-deck-hero-card:hover { z-index: 3; transform: rotate(0) translateY(-4px); }
#cm-root .cm-deck-hero-tags { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 10px; }
#cm-root .cm-deck-hero h1, #cm-root .cm-hub-hero h1 { font-size: clamp(2rem, 4.4vw, 3.2rem); font-weight: 800; }
#cm-root .cm-hub-hero h1 { margin-top: 10px; }
#cm-root .cm-deck-hero-sub { margin: 10px 0 0; color: var(--cm-dim); font-size: 15px; }
#cm-root .cm-card-link { color: var(--cm-white); font-weight: 700; border-bottom: 1px dashed rgba(255, 61, 87, 0.7); }
#cm-root .cm-card-link:hover { color: var(--cm-accent); }
#cm-root .cm-deck-facts { display: flex; flex-wrap: wrap; gap: 10px 30px; margin: 20px 0 0; }
#cm-root .cm-deck-facts div { display: flex; flex-direction: column; }
#cm-root .cm-deck-facts dt { font-size: 10.5px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--cm-dim); font-weight: 700; }
#cm-root .cm-deck-facts dd { margin: 3px 0 0; color: var(--cm-white); font-weight: 700; font-size: 14.5px; }
#cm-root .cm-deck-facts a { border-bottom: 1px solid rgba(255, 61, 87, 0.5); }
#cm-root .cm-deck-actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-top: 24px; }
#cm-root .cm-deck-cost { font-size: 13px; color: var(--cm-dim); font-weight: 600; margin-left: 4px; }
#cm-root .cm-hub-intro { margin-top: 18px; max-width: 720px; color: var(--cm-text); }

#cm-root .cm-toolbar { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; padding: 22px 0 4px; }
#cm-root .cm-toolbar-right { display: flex; gap: 12px; margin-left: auto; }

/* Two panes: sticky card panel left, content right */
#cm-root .cm-two-pane { display: grid; grid-template-columns: 250px minmax(0, 1fr); gap: 28px; padding-top: 20px; padding-bottom: 60px; align-items: start; }
#cm-root .cm-two-pane-flush { padding-top: 0; padding-bottom: 0; }
#cm-root .cm-panel-slot { position: sticky; top: calc(var(--cm-header-h) + 16px); align-self: start; }
#cm-root .cm-panel {
  padding: 14px; text-align: center; border-radius: var(--cm-radius);
  background: linear-gradient(170deg, rgba(44, 16, 23, 0.7), rgba(22, 11, 14, 0.85));
  border: 1px solid var(--cm-border); box-shadow: 0 30px 60px -30px rgba(0,0,0,0.9);
  transition: border-color .2s, box-shadow .2s;
}
#cm-root .cm-panel-art { display: block; position: relative; aspect-ratio: 5 / 7; border-radius: 11px; overflow: hidden; background: linear-gradient(160deg, #2a1015, #120a0c); }
#cm-root .cm-panel-art img { width: 100%; height: 100%; object-fit: cover; display: block; }
#cm-root .cm-panel-buy {
  position: absolute; left: 8px; bottom: 8px; z-index: 4; width: 30px; height: 30px; border-radius: 50%;
  background: var(--cm-accent); color: #fff; display: flex; align-items: center; justify-content: center; box-shadow: 0 4px 14px rgba(0,0,0,0.5);
}
#cm-root .cm-panel-buy svg { width: 15px; height: 15px; }
#cm-root .cm-panel-name { font-size: 1rem; font-weight: 700; margin: 12px 0 8px; line-height: 1.3; height: 2.6em; display: flex; align-items: center; justify-content: center; overflow: hidden; }
#cm-root .cm-panel-flags { min-height: 0; margin-bottom: 8px; }
#cm-root .cm-panel-flags:empty { display: none; }
#cm-root .cm-panel-info { display: flex; flex-direction: column; gap: 4px; font-size: 11.5px; color: var(--cm-dim); }
#cm-root .cm-panel-price { color: var(--cm-white); font-weight: 700; font-size: 13px; }
#cm-root .cm-panel-price small { display: block; font-size: 10px; color: var(--cm-dim); font-weight: 500; }
#cm-root .cm-panel-actions { margin-top: 14px; display: flex; flex-direction: column; gap: 8px; }
#cm-root .cm-panel-slot .cm-ad { margin-top: 16px; }

#cm-root .cm-flip-btn {
  position: absolute; right: 8px; bottom: 8px; z-index: 4; width: 28px; height: 28px; border-radius: 50%; padding: 0; cursor: pointer;
  display: flex; align-items: center; justify-content: center; background: rgba(11, 7, 8, 0.85); border: 1px solid var(--cm-border); color: var(--cm-white);
  transition: background .15s, transform .25s;
}
#cm-root .cm-flip-btn svg { width: 14px; height: 14px; }
#cm-root .cm-flip-btn:hover { background: var(--cm-accent); border-color: var(--cm-accent); transform: rotate(180deg); }

/* =========================================================
   CARD TILES (one look for deck pages, staples, checker, hubs)
========================================================= */
#cm-root .cm-group { margin-bottom: 26px; }
#cm-root .cm-group-head { font-size: 0.95rem; font-weight: 700; color: var(--cm-white); margin-bottom: 10px; display: flex; align-items: center; gap: 8px; }
#cm-root .cm-group-head span { font-family: var(--cm-body); font-size: 11px; color: var(--cm-accent); background: rgba(255, 61, 87, 0.12); border-radius: 10px; padding: 1px 8px; }
#cm-root .cm-group-commander .cm-tile-row { grid-template-columns: repeat(6, minmax(0, 1fr)); }
#cm-root .cm-tile-row, #cm-root .cm-card-row { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 12px; }
#cm-root .cm-tile {
  display: block; position: relative; border-radius: 9px; outline: 2px solid transparent; outline-offset: 2px;
  transition: transform .18s cubic-bezier(.2,.8,.2,1), outline-color .18s, box-shadow .18s;
}
#cm-root .cm-tile:hover, #cm-root .cm-tile:focus-visible { transform: translateY(-3px) scale(1.03); z-index: 4; outline-color: var(--cm-accent); box-shadow: 0 16px 34px -14px rgba(255, 61, 87, 0.6); }
#cm-root .cm-tile-art { position: relative; aspect-ratio: 5 / 7; border-radius: 9px; overflow: hidden; background: linear-gradient(160deg, #2a1015, #120a0c); }
#cm-root .cm-tile-art img { width: 100%; height: 100%; object-fit: cover; display: block; }
#cm-root .cm-tile-badge {
  position: absolute; top: 11%; right: 6px; z-index: 3; font: 800 10.5px var(--cm-body); color: var(--cm-white);
  background: rgba(11, 7, 8, 0.88); border: 1px solid var(--cm-border); padding: 2px 7px; border-radius: 20px;
}
#cm-root .cm-gc-mark {
  position: absolute; top: 11%; left: 6px; z-index: 3; font: 800 8.5px var(--cm-body); letter-spacing: 0.06em; color: #2a1d00;
  background: var(--cm-gold); padding: 2px 5px; border-radius: 5px; box-shadow: 0 2px 6px rgba(0,0,0,0.4); opacity: 0.92;
}
#cm-root .cm-tile .cm-flip-btn { width: 24px; height: 24px; right: 6px; bottom: 6px; }
#cm-root .cm-tile .cm-flip-btn svg { width: 12px; height: 12px; }
#cm-root .cm-tile-foot { display: none; padding: 5px 2px 0; }
#cm-root .cm-tile-foot .cm-flags:empty { display: none; }
#cm-root .cm-tile-sub { text-align: center; font-size: 12px; font-weight: 700; color: var(--cm-text); padding-top: 6px; }

/* Status glow (one look for tiles and the panel). */
#cm-root .cm-tile.cm-st-banned { outline-color: rgba(180, 123, 255, 0.75); box-shadow: 0 0 18px rgba(180, 123, 255, 0.35); }
#cm-root .cm-tile.cm-st-warn { outline-color: rgba(255, 154, 60, 0.75); box-shadow: 0 0 18px rgba(255, 154, 60, 0.3); }
#cm-root .cm-tile.cm-st-muted { outline-color: rgba(255,255,255,0.3); }
#cm-root .cm-tile.cm-st-banned .cm-tile-art img, #cm-root .cm-tile.cm-st-muted .cm-tile-art img { filter: saturate(0.6); }
#cm-root .cm-panel.cm-st-banned { border-color: rgba(180, 123, 255, 0.6); box-shadow: 0 0 28px -6px rgba(180, 123, 255, 0.45); }
#cm-root .cm-panel.cm-st-warn { border-color: rgba(255, 154, 60, 0.6); box-shadow: 0 0 28px -6px rgba(255, 154, 60, 0.4); }
#cm-root .cm-panel.cm-st-banned .cm-trail-svg rect { stroke: var(--cm-banned); filter: drop-shadow(0 0 4px var(--cm-banned)); }
#cm-root .cm-panel.cm-st-warn .cm-trail-svg rect { stroke: var(--cm-warn); filter: drop-shadow(0 0 4px var(--cm-warn)); }

/* List view */
#cm-root .cm-list-group { margin-bottom: 22px; }
#cm-root .cm-listview { column-count: 2; column-gap: 28px; }
#cm-root .cm-list-group { break-inside: avoid; }
#cm-root .cm-list-row { display: flex; align-items: center; gap: 10px; padding: 7px 10px; border-radius: 8px; font-size: 13.5px; transition: background .12s; }
#cm-root .cm-list-row:hover { background: rgba(255, 61, 87, 0.08); }
#cm-root .cm-list-qty { width: 16px; color: var(--cm-dim); font-weight: 700; font-size: 12px; }
#cm-root .cm-list-name { flex: 1; min-width: 0; color: var(--cm-white); font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#cm-root .cm-list-row .cm-flags { justify-content: flex-end; }
#cm-root .cm-list-cost { display: inline-flex; gap: 2px; }
#cm-root .cm-list-price { width: 58px; text-align: right; color: var(--cm-dim); font-size: 12px; }
#cm-root .cm-ms {
  width: 16px; height: 16px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center;
  font: 800 8.5px var(--cm-body); font-style: normal; background: #b9b0b2; color: #241e1f;
}
#cm-root .cm-ms-w { background: #f3ecd2; } #cm-root .cm-ms-u { background: #3fa7ff; } #cm-root .cm-ms-b { background: #4a3f4d; color: #efe5f3; }
#cm-root .cm-ms-r { background: #ff4d4d; } #cm-root .cm-ms-g { background: #3fd27a; }
#cm-root .cm-textview { width: 100%; min-height: 520px; background: rgba(0,0,0,0.35); border: 1px solid var(--cm-border-2); border-radius: 12px; color: var(--cm-text); font: 13px/1.7 ui-monospace, Menlo, Consolas, monospace; padding: 16px; resize: vertical; }

/* Notes, breakdown, hand */
#cm-root .cm-deck-notes, #cm-root .cm-deck-breakdown, #cm-root .cm-hand { margin-top: 40px; padding-top: 28px; border-top: 1px solid var(--cm-border-2); }
#cm-root .cm-deck-notes h2, #cm-root .cm-deck-breakdown h2, #cm-root .cm-hand h2 { font-size: 1.25rem; font-weight: 700; margin-bottom: 16px; }
#cm-root .cm-stat-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
#cm-root .cm-stat-card { background: var(--cm-surface); border: 1px solid var(--cm-border); border-radius: 12px; padding: 16px; }
#cm-root .cm-stat-card h5 { font-size: 0.9rem; color: var(--cm-white); }
#cm-root .cm-stat-card .cm-caption { margin: 3px 0 14px; }
#cm-root .cm-bars { display: flex; align-items: flex-end; gap: 6px; height: 130px; }
#cm-root .cm-bar-col { flex: 1; height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; }
#cm-root .cm-bar { width: 100%; border-radius: 4px 4px 0 0; background: linear-gradient(180deg, var(--cm-accent-2), var(--cm-accent)); box-shadow: 0 0 12px rgba(255, 61, 87, 0.35); }
#cm-root .cm-bar-n { font-size: 10.5px; color: var(--cm-text); margin-bottom: 3px; }
#cm-root .cm-bar-l { font-size: 10.5px; color: var(--cm-dim); margin-top: 6px; }
#cm-root .cm-hbar { display: grid; grid-template-columns: 92px 1fr 26px; gap: 8px; align-items: center; font-size: 11.5px; margin-bottom: 7px; color: var(--cm-dim); }
#cm-root .cm-hbar b { color: var(--cm-white); text-align: right; }
#cm-root .cm-hbar-track { height: 7px; border-radius: 4px; background: rgba(255,255,255,0.06); overflow: hidden; }
#cm-root .cm-hbar-fill { height: 100%; border-radius: 4px; background: linear-gradient(90deg, var(--cm-accent), var(--cm-accent-2)); }
#cm-root .cm-pie { display: flex; align-items: center; gap: 16px; }
#cm-root .cm-pie-legend { display: flex; flex-direction: column; gap: 5px; font-size: 12px; font-weight: 600; }
#cm-root .cm-pie-legend i { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 6px; }
#cm-root .cm-hand-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
#cm-root .cm-hand-head h2 { margin: 0; }
#cm-root .cm-hand-actions { display: flex; gap: 8px; }
#cm-root .cm-hand-row { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 10px; }
#cm-root .cm-hand-card { aspect-ratio: 5 / 7; border-radius: 8px; overflow: hidden; background: #1a0e11; border: 1px solid var(--cm-border-2); animation: cm-deal .35s cubic-bezier(.2,.8,.2,1) both; }
#cm-root .cm-hand-card img { width: 100%; height: 100%; object-fit: cover; display: block; }
@keyframes cm-deal { from { opacity: 0; transform: translateY(14px) rotate(-3deg); } to { opacity: 1; transform: none; } }
#cm-root .cm-more { border-top: 1px solid var(--cm-border-2); padding-top: 50px; }
#cm-root .cm-more .cm-row-head { margin-top: 10px; }
#cm-root .cm-more .cm-deck-grid + .cm-row-head { margin-top: 46px; }

/* Card hover preview for inline links */
.cm-tooltip { position: fixed; z-index: 9999; width: 220px; aspect-ratio: 5 / 7; border-radius: 12px; overflow: hidden; pointer-events: none; opacity: 0; transform: scale(.96); transition: opacity .15s, transform .15s; box-shadow: 0 30px 60px -20px rgba(0,0,0,0.9), 0 0 0 1px rgba(255, 61, 87, 0.35); background: #1a0e11; }
.cm-tooltip.cm-shown { opacity: 1; transform: none; }
.cm-tooltip img { width: 100%; height: 100%; object-fit: cover; display: block; }
#cm-root .cm-preview-btn { background: none; border: 0; color: var(--cm-accent); padding: 0 2px; vertical-align: middle; cursor: pointer; }
#cm-root .cm-preview-btn svg { width: 14px; height: 14px; }

/* Ads */
#cm-root .cm-ad { max-width: 1240px; margin: 22px auto; padding: 0 24px; text-align: center; overflow: hidden; }
#cm-root .cm-ad-label { display: block; font-size: 9.5px; letter-spacing: 0.16em; text-transform: uppercase; color: var(--cm-dim); opacity: 0.6; margin-bottom: 6px; }
#cm-root .cm-panel-slot .cm-ad, #cm-root .cm-deck-grid-ad .cm-ad { padding: 0; margin: 0; }

/* =========================================================
   HOMEPAGE
========================================================= */
#cm-root .cm-home-hero { padding: 70px 0 60px; position: relative; overflow: hidden; }
#cm-root .cm-home-hero-inner { display: grid; grid-template-columns: 1.1fr 0.9fr; gap: 40px; align-items: center; }
#cm-root .cm-home-hero h1 { font-size: clamp(2.5rem, 5.6vw, 4.4rem); font-weight: 800; margin-top: 16px; line-height: 1.02; letter-spacing: -0.01em; }
#cm-root .cm-home-hero h1 em { font-style: normal; background: linear-gradient(100deg, var(--cm-accent), var(--cm-accent-2)); -webkit-background-clip: text; background-clip: text; color: transparent; }
#cm-root .cm-home-hero p { color: var(--cm-dim); font-size: 1.08rem; max-width: 560px; margin: 18px 0 0; }
#cm-root .cm-home-search { position: relative; margin-top: 28px; max-width: 560px; }
#cm-root .cm-suggest { position: absolute; left: 0; right: 0; top: calc(100% + 6px); z-index: 30; background: var(--cm-solid); border: 1px solid var(--cm-border); border-radius: 12px; padding: 6px; box-shadow: 0 30px 60px -20px rgba(0,0,0,0.9); }
#cm-root .cm-suggest a { display: flex; justify-content: space-between; gap: 10px; padding: 10px 12px; border-radius: 8px; font-weight: 700; color: var(--cm-white); }
#cm-root .cm-suggest a b { color: var(--cm-dim); font-size: 12px; font-weight: 600; }
#cm-root .cm-suggest a:hover, #cm-root .cm-suggest a.cm-first { background: rgba(255, 61, 87, 0.12); }
#cm-root .cm-suggest-all { color: var(--cm-accent) !important; font-weight: 600 !important; font-size: 13px; }
#cm-root .cm-hero-actions { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 22px; }
#cm-root .cm-home-hero .cm-hero-stats { justify-content: flex-start; gap: 36px; }
#cm-root .cm-home-hero .cm-hero-stats div { align-items: flex-start; }
#cm-root .cm-home-fan { position: relative; height: 470px; }
#cm-root .cm-fan-card { position: absolute; width: 58%; aspect-ratio: 5 / 7; border-radius: 16px; overflow: hidden; background: #1a0e11; box-shadow: 0 40px 80px -30px rgba(0,0,0,0.95), 0 0 0 1px rgba(255, 61, 87, 0.3); }
#cm-root .cm-fan-card img { width: 100%; height: 100%; object-fit: cover; display: block; }
#cm-root .cm-fan-0 { left: 0; top: 50px; transform: rotate(-11deg); animation: cm-float 7s ease-in-out infinite; }
#cm-root .cm-fan-1 { left: 21%; top: 0; z-index: 2; animation: cm-float 7s ease-in-out -2.3s infinite; }
#cm-root .cm-fan-2 { right: 0; top: 50px; transform: rotate(11deg); animation: cm-float 7s ease-in-out -4.6s infinite; }
#cm-root .cm-home-fan::after { content: ""; position: absolute; left: 10%; right: 10%; bottom: -10px; height: 60px; background: radial-gradient(ellipse at center, rgba(255, 61, 87, 0.35), transparent 70%); filter: blur(10px); }
@keyframes cm-float { 50% { margin-top: -10px; } }

#cm-root .cm-tool-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; }
#cm-root .cm-tool { display: block; padding: 22px; border-radius: var(--cm-radius); background: var(--cm-surface); border: 1px solid var(--cm-border); transition: transform .2s, border-color .2s; }
#cm-root .cm-tool:hover { transform: translateY(-4px); border-color: rgba(255, 61, 87, 0.5); }
#cm-root .cm-tool-icon { width: 42px; height: 42px; border-radius: 11px; display: flex; align-items: center; justify-content: center; font: 800 20px var(--cm-head); color: #fff; background: linear-gradient(120deg, var(--cm-accent), var(--cm-accent-2)); box-shadow: 0 8px 22px -8px rgba(255, 61, 87, 0.7); }
#cm-root .cm-tool-icon svg { width: 20px; height: 20px; }
#cm-root .cm-tool h3 { font-size: 1.1rem; margin: 16px 0 8px; }
#cm-root .cm-tool p { color: var(--cm-dim); font-size: 13.5px; margin: 0; }

#cm-root .cm-faq details { border-bottom: 1px solid var(--cm-border-2); padding: 18px 0; }
#cm-root .cm-faq summary { cursor: pointer; list-style: none; font: 700 1.05rem var(--cm-head); color: var(--cm-white); display: flex; justify-content: space-between; gap: 20px; }
#cm-root .cm-faq summary::-webkit-details-marker { display: none; }
#cm-root .cm-faq summary::after { content: "+"; color: var(--cm-accent); font-size: 1.4rem; line-height: 1; transition: transform .2s; }
#cm-root .cm-faq details[open] summary::after { transform: rotate(45deg); }
#cm-root .cm-faq p { color: var(--cm-dim); margin: 12px 0 0; max-width: 720px; }

/* =========================================================
   PAGES, ARTICLES, CHECKER, STAPLES
========================================================= */
#cm-root .cm-prose { font-size: 15.5px; line-height: 1.7; }
#cm-root .cm-prose > *:first-child { margin-top: 0; }
#cm-root .cm-prose h2 { font-size: 1.6rem; margin: 40px 0 12px; }
#cm-root .cm-prose h3 { font-size: 1.2rem; margin: 28px 0 10px; }
#cm-root .cm-prose a:not(.cm-card-link):not(.cm-btn):not(.cm-deck-tile):not(.cm-cmdr-tile) { color: var(--cm-accent); border-bottom: 1px solid rgba(255, 61, 87, 0.4); }
#cm-root .cm-prose .cm-lede { font-size: 1.08rem; color: var(--cm-dim); max-width: 760px; margin: 0 0 26px; }
#cm-root .cm-page-content { max-width: 1240px; }
#cm-root .cm-post-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 20px; }
#cm-root .cm-post-card { display: block; border-radius: var(--cm-radius); overflow: hidden; background: var(--cm-surface); border: 1px solid var(--cm-border); }
#cm-root .cm-post-card img { width: 100%; aspect-ratio: 16 / 9; object-fit: cover; display: block; }
#cm-root .cm-post-card > div { padding: 16px 18px 20px; }
#cm-root .cm-post-card h3 { font-size: 1.1rem; margin: 6px 0 8px; }
#cm-root .cm-post-card p { color: var(--cm-dim); font-size: 13.5px; margin: 0; }

#cm-root .cm-checker-form { display: grid; gap: 14px; max-width: 760px; }
#cm-root .cm-field { display: flex; flex-direction: column; gap: 6px; font-size: 12.5px; font-weight: 700; color: var(--cm-dim); text-transform: uppercase; letter-spacing: 0.08em; }
#cm-root .cm-field textarea { width: 100%; background: var(--cm-surface-2); border: 1px solid var(--cm-border-2); border-radius: 10px; color: var(--cm-white); font: 500 14px/1.6 var(--cm-body); padding: 12px 14px; text-transform: none; letter-spacing: 0; resize: vertical; }
#cm-root .cm-field textarea:focus { outline: none; border-color: var(--cm-accent); box-shadow: 0 0 0 3px rgba(255, 61, 87, 0.15); }
#cm-root .cm-checker-actions { display: flex; gap: 14px; align-items: center; }
#cm-root .cm-checker-result { margin-top: 40px; scroll-margin-top: 90px; }
#cm-root .cm-checker-summary { margin-bottom: 26px; }
#cm-root .cm-verdict { display: flex; align-items: baseline; gap: 14px; flex-wrap: wrap; padding: 16px 18px; border-radius: 12px; background: var(--cm-surface); border: 1px solid var(--cm-border-2); }
#cm-root .cm-verdict b { font: 800 1.5rem var(--cm-head); color: var(--cm-white); }
#cm-root .cm-verdict span { color: var(--cm-dim); }
#cm-root .cm-verdict-ok { border-color: rgba(79, 224, 160, 0.45); background: rgba(79, 224, 160, 0.07); }
#cm-root .cm-verdict-ok b { color: var(--cm-ok); }
#cm-root .cm-verdict-bad { border-color: rgba(255, 154, 60, 0.45); background: rgba(255, 154, 60, 0.07); }
#cm-root .cm-verdict-bad b { color: var(--cm-warn); }
#cm-root .cm-staples-note { margin: 0 0 18px; }

/* =========================================================
   FOOTER
========================================================= */
#cm-root .cm-footer { position: relative; z-index: 1; margin-top: 40px; padding: 60px 0 40px; border-top: 1px solid var(--cm-border-2); background: linear-gradient(180deg, rgba(19, 11, 13, 0.6), rgba(11, 7, 8, 0.95)); }
#cm-root .cm-footer-grid { display: grid; grid-template-columns: 1.6fr 1fr 1fr 1fr; gap: 36px; }
#cm-root .cm-footer-brand p { color: var(--cm-dim); font-size: 13.5px; max-width: 320px; margin: 16px 0 0; }
#cm-root .cm-footer-social { display: flex; gap: 14px; margin-top: 14px; font-size: 13px; font-weight: 600; }
#cm-root .cm-footer-social a:hover { color: var(--cm-accent); }
#cm-root .cm-footer-col { display: flex; flex-direction: column; gap: 9px; }
#cm-root .cm-footer-col h5 { font-size: 12px; letter-spacing: 0.16em; text-transform: uppercase; color: var(--cm-white); margin-bottom: 6px; }
#cm-root .cm-footer-col a { font-size: 13.5px; color: var(--cm-dim); transition: color .15s; }
#cm-root .cm-footer-col a:hover { color: var(--cm-accent); }
#cm-root .cm-footer-bottom { display: flex; justify-content: space-between; gap: 20px; flex-wrap: wrap; margin-top: 44px; padding-top: 20px; border-top: 1px solid var(--cm-border-2); font-size: 12px; color: var(--cm-dim); }
#cm-root .cm-disclaimer { display: grid; grid-template-columns: 1fr 1fr; gap: 30px; margin-top: 24px; }
#cm-root .cm-disclaimer h6 { font: 700 11px var(--cm-body); letter-spacing: 0.14em; text-transform: uppercase; color: var(--cm-text); margin: 0 0 6px; }
#cm-root .cm-disclaimer p { font-size: 11.5px; color: var(--cm-dim); opacity: 0.8; margin: 0; line-height: 1.6; }
#cm-root .cm-legal-links { display: flex; gap: 16px; flex-wrap: wrap; justify-content: center; margin-top: 24px; font-size: 12px; color: var(--cm-dim); }
#cm-root .cm-legal-links a:hover { color: var(--cm-accent); }

/* =========================================================
   RESPONSIVE
========================================================= */
@media (max-width: 1180px) {
  #cm-root .cm-deck-grid { grid-template-columns: repeat(5, minmax(0, 1fr)); }
  #cm-root .cm-deck-grid-wide { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  #cm-root .cm-tile-row, #cm-root .cm-card-row, #cm-root .cm-group-commander .cm-tile-row { grid-template-columns: repeat(5, minmax(0, 1fr)); }
  #cm-root .cm-cmdr-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  #cm-root .cm-tool-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 1180px) { #cm-root .cm-deck-grid-center > .cm-deck-tile { width: calc((100% - 4 * 16px) / 5); } }
@media (max-width: 980px) {
  #cm-root .cm-deck-grid-center > .cm-deck-tile { width: calc((100% - 3 * 16px) / 4); }
  #cm-root .cm-nav { display: none; }
  #cm-root .cm-nav-toggle { display: flex; }
  #cm-root .cm-nav.cm-nav-open {
    display: flex; flex-direction: column; align-items: stretch; position: absolute; top: var(--cm-header-h); left: 0; right: 0;
    background: rgba(11, 7, 8, 0.98); padding: 14px 18px 20px; gap: 2px; border-bottom: 1px solid var(--cm-border);
  }
  #cm-root .cm-nav.cm-nav-open a { padding: 12px; font-size: 15px; }
  #cm-root .cm-deck-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  #cm-root .cm-home-hero-inner { grid-template-columns: 1fr; }
  #cm-root .cm-home-fan { height: 360px; max-width: 460px; margin: 0 auto; width: 100%; }
  #cm-root .cm-two-pane { grid-template-columns: 210px minmax(0, 1fr); gap: 20px; }
  #cm-root .cm-tile-row, #cm-root .cm-card-row, #cm-root .cm-group-commander .cm-tile-row { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  #cm-root .cm-stat-grid { grid-template-columns: 1fr; }
  #cm-root .cm-footer-grid { grid-template-columns: 1fr 1fr; }
  #cm-root .cm-listview { column-count: 1; }
}
@media (max-width: 760px) {
  #cm-root .cm-container { padding: 0 16px; }
  #cm-root .cm-header-inner { padding: 0 16px; gap: 12px; }
  #cm-root .cm-full { display: none; }
  #cm-root .cm-short { display: inline; }
  #cm-root .cm-section { padding: 54px 0; }
  #cm-root .cm-deck-grid, #cm-root .cm-deck-grid-wide { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
  #cm-root .cm-deck-grid-center > .cm-deck-tile { width: calc((100% - 12px) / 2); }
  #cm-root .cm-cmdr-grid { grid-template-columns: 1fr; }
  #cm-root .cm-deck-hero-inner, #cm-root .cm-hub-hero-inner { grid-template-columns: 1fr; gap: 24px; }
  #cm-root .cm-deck-hero-cmdrs { max-width: 210px; margin: 0 auto; width: 100%; }
  #cm-root .cm-deck-hero-text, #cm-root .cm-hub-hero-text { text-align: center; }
  #cm-root .cm-crumbs, #cm-root .cm-deck-hero-tags, #cm-root .cm-deck-facts, #cm-root .cm-deck-stats-row, #cm-root .cm-deck-actions { justify-content: center; }
  #cm-root .cm-issues { text-align: left; }
  /* No side panel on phones: the tiles carry their own status words. */
  #cm-root .cm-two-pane { grid-template-columns: 1fr; }
  #cm-root .cm-panel-slot { display: none; }
  #cm-root .cm-tile-foot { display: block; }
  #cm-root .cm-tile-row, #cm-root .cm-card-row, #cm-root .cm-group-commander .cm-tile-row { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 9px; }
  #cm-root .cm-toolbar-right { margin-left: 0; width: 100%; }
  #cm-root .cm-filterbar { position: static; }
  #cm-root .cm-filter-count { margin-left: 0; }
  #cm-root .cm-hand-row { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  #cm-root .cm-tool-grid, #cm-root .cm-post-grid, #cm-root .cm-disclaimer { grid-template-columns: 1fr; }
  #cm-root .cm-home-hero { padding-top: 40px; }
  #cm-root .cm-home-fan { height: 300px; }
  #cm-root .cm-row-head { flex-direction: column; align-items: flex-start; gap: 8px; }
}
@media (max-width: 420px) {
  #cm-root .cm-wordmark { font-size: 1.05rem; }
  #cm-root .cm-tile-row, #cm-root .cm-card-row { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* Menus built in Appearance > Menus come wrapped in <li>: show just the links */
#cm-root .cm-nav li, #cm-root .cm-footer-col li, #cm-root .cm-legal-links li { list-style: none; display: contents; }
#cm-root .cm-nav .current-menu-item > a, #cm-root .cm-nav .current_page_item > a { color: var(--cm-white); background: rgba(255, 61, 87, 0.1); }

/* Logged-in admin bar sits above the sticky header */
body.admin-bar #cm-root .cm-header { top: 32px; }
@media (max-width: 782px) { body.admin-bar #cm-root .cm-header { top: 0; } }

/* =========================================================
   COMMANDER PAGE (EDHREC-style layout)
========================================================= */
#cm-root .cm-cmd-hero { position: relative; overflow: hidden; padding: 46px 0 40px; border-bottom: 1px solid var(--cm-border-2); isolation: isolate; }
#cm-root .cm-cmd-hero::before {
  content: ""; position: absolute; inset: -40px; z-index: -2;
  background: var(--cm-hero-art) center 30% / cover no-repeat;
  filter: blur(18px) saturate(1.1); opacity: 0.38; transform: scale(1.08);
}
#cm-root .cm-cmd-hero::after {
  content: ""; position: absolute; inset: 0; z-index: -1;
  background: linear-gradient(90deg, rgba(11,7,8,0.92) 0%, rgba(11,7,8,0.7) 45%, rgba(11,7,8,0.45) 100%), linear-gradient(180deg, transparent 60%, var(--cm-bg));
}
#cm-root .cm-cmd-hero h1 { font-size: clamp(2.1rem, 4.8vw, 3.6rem); font-weight: 800; letter-spacing: -0.01em; }
#cm-root .cm-hero-pills { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 12px; }
#cm-root .cm-pill-tag {
  font: 800 11.5px var(--cm-head); letter-spacing: 0.1em; text-transform: uppercase; color: var(--cm-white);
  padding: 6px 14px; border: 1.5px solid var(--cm-accent); border-radius: 6px; transform: skewX(-12deg); background: rgba(255, 61, 87, 0.08);
}
#cm-root .cm-pill-dim { border-color: rgba(255,255,255,0.25); color: var(--cm-dim); background: rgba(255,255,255,0.03); }
#cm-root .cm-cmd-hero .cm-deck-facts { margin-top: 18px; }

/* Tab bar */
#cm-root .cm-tabs { position: sticky; top: var(--cm-header-h); z-index: 30; background: rgba(19, 11, 13, 0.92); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); border-bottom: 1px solid var(--cm-border-2); }
body.admin-bar #cm-root .cm-tabs { top: calc(var(--cm-header-h) + 32px); }
#cm-root .cm-tabs .cm-container { display: flex; gap: 4px; overflow-x: auto; scrollbar-width: none; }
#cm-root .cm-tabs a { position: relative; padding: 15px 18px; font: 700 14px var(--cm-head); letter-spacing: 0.02em; color: var(--cm-dim); white-space: nowrap; transition: color .15s; }
#cm-root .cm-tabs a:hover { color: var(--cm-white); }
#cm-root .cm-tabs a.cm-active { color: var(--cm-white); }
#cm-root .cm-tabs a.cm-active::after { content: ""; position: absolute; left: 12px; right: 12px; bottom: 0; height: 3px; border-radius: 3px 3px 0 0; background: linear-gradient(90deg, var(--cm-accent), var(--cm-accent-2)); }
#cm-root .cm-deck-pane { padding-top: 28px; }
#cm-root .cm-deck-pane .cm-panel-slot { top: calc(var(--cm-header-h) + 66px); }
#cm-root [id="decklist"], #cm-root [id="cards"], #cm-root [id="charts"], #cm-root [id="results"], #cm-root [id="similar"] { scroll-margin-top: 140px; }

/* Blocks inside the pane */
#cm-root .cm-block { margin-bottom: 46px; }
#cm-root .cm-block-head { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-bottom: 16px; padding-bottom: 12px; border-bottom: 1px solid var(--cm-border-2); }
#cm-root .cm-block-head h2 { font-size: 1.4rem; font-weight: 700; }
#cm-root .cm-block-actions { display: flex; gap: 8px; }
#cm-root .cm-dropdown-right { left: auto; right: 0; }

/* The list in columns, grouped by type */
#cm-root .cm-typed-list { column-count: 3; column-gap: 22px; }
#cm-root .cm-typed-group { break-inside: avoid; margin-bottom: 20px; }
#cm-root .cm-typed-group h3 { display: flex; align-items: center; gap: 8px; font-size: 1.02rem; font-weight: 700; margin-bottom: 7px; }
#cm-root .cm-typed-group h3 span { font-family: var(--cm-body); font-weight: 500; font-size: 0.85rem; color: var(--cm-dim); }
#cm-root .cm-type-icon { width: 17px; height: 17px; color: var(--cm-accent); flex-shrink: 0; }
#cm-root .cm-typed-row { display: flex; align-items: baseline; gap: 6px; padding: 5px 10px; font-size: 13.5px; color: var(--cm-white); border-radius: 4px; transition: background .12s; }
#cm-root .cm-typed-row:nth-of-type(odd) { background: rgba(255,255,255,0.045); }
#cm-root .cm-typed-row:hover { background: rgba(255, 61, 87, 0.16); }
#cm-root .cm-typed-row b { min-width: 12px; color: var(--cm-dim); font-weight: 800; }
#cm-root .cm-typed-row em { margin-left: auto; font: 800 9px var(--cm-body); letter-spacing: 0.05em; text-transform: uppercase; font-style: normal; color: var(--cm-warn); }
#cm-root .cm-typed-bad { box-shadow: inset 3px 0 0 var(--cm-warn); }

/* Gallery toolbar */
#cm-root .cm-gallery-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 14px; padding: 10px 12px; margin-bottom: 14px; background: rgba(22, 11, 14, 0.7); border: 1px solid var(--cm-border-2); border-radius: 12px; }
#cm-root .cm-bar-group { display: inline-flex; align-items: center; gap: 8px; font-size: 11px; font-weight: 800; letter-spacing: 0.1em; text-transform: uppercase; color: var(--cm-dim); }
#cm-root .cm-seg-sm button { padding: 6px 10px; font-size: 12px; }
#cm-root .cm-seg-sm button svg { width: 14px; height: 14px; }
#cm-root .cm-search-sm { flex: 1 1 180px; min-width: 160px; }
#cm-root .cm-search-sm input { padding: 8px 0; font-size: 13px; }
#cm-root .cm-filter-btn { width: 36px; height: 36px; background: rgba(255,255,255,0.04); border-color: var(--cm-border-2); color: var(--cm-dim); box-shadow: none; }
#cm-root .cm-filter-btn[aria-pressed="true"] { background: var(--cm-accent); border-color: var(--cm-accent); color: #fff; }
#cm-root .cm-type-chips { margin: -4px 0 14px; }
#cm-root .cm-size-s .cm-tile-row { grid-template-columns: repeat(8, minmax(0, 1fr)); gap: 8px; }
#cm-root .cm-size-l .cm-tile-row { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; }
#cm-root .cm-size-s .cm-tile-sub { font-size: 10.5px; }

/* Results table */
#cm-root .cm-table-wrap { overflow-x: auto; border: 1px solid var(--cm-border-2); border-radius: 12px; }
#cm-root .cm-results { width: 100%; border-collapse: collapse; font-size: 13.5px; min-width: 900px; }
#cm-root .cm-results th { text-align: left; font: 800 11px var(--cm-body); letter-spacing: 0.08em; text-transform: uppercase; color: var(--cm-dim); padding: 12px 14px; background: rgba(255,255,255,0.03); border-bottom: 1px solid var(--cm-border-2); white-space: nowrap; }
#cm-root .cm-results th.cm-num span { display: none; }
#cm-root .cm-results th .cm-type-icon { width: 16px; height: 16px; vertical-align: middle; }
#cm-root .cm-results td { padding: 12px 14px; border-bottom: 1px solid var(--cm-border-2); color: var(--cm-white); vertical-align: middle; }
#cm-root .cm-results tbody.cm-res-item:nth-of-type(odd) tr:not(.cm-result-detail) td, #cm-root .cm-results tbody tr:hover td { background: rgba(255,255,255,0.025); }
#cm-root .cm-results td small { color: var(--cm-dim); display: block; font-size: 11px; }
#cm-root .cm-results td a:not(.cm-link) { border-bottom: 1px solid rgba(255, 61, 87, 0.45); }
#cm-root .cm-results .cm-num { text-align: center; }
#cm-root .cm-results .cm-row-main td:first-child { box-shadow: inset 3px 0 0 var(--cm-accent); }
#cm-root .cm-link-btn { background: none; border: 0; padding: 0; cursor: pointer; color: var(--cm-accent); font: 700 13px var(--cm-body); }
#cm-root .cm-link-btn:hover { text-decoration: underline; }
#cm-root .cm-result-detail td { background: rgba(0,0,0,0.25); }
#cm-root .cm-result-list { column-count: 4; column-gap: 20px; font-size: 12.5px; color: var(--cm-text); }
#cm-root .cm-result-list span { display: block; padding: 2px 0; }
#cm-root .cm-result-list b { display: block; color: var(--cm-accent); font-size: 11px; text-transform: uppercase; letter-spacing: 0.08em; }

@media (max-width: 1180px) {
  #cm-root .cm-typed-list { column-count: 2; }
  #cm-root .cm-size-s .cm-tile-row { grid-template-columns: repeat(6, minmax(0, 1fr)); }
}
@media (max-width: 760px) {
  #cm-root .cm-typed-list { column-count: 1; }
  #cm-root .cm-cmd-hero h1 { font-size: 2rem; }
  #cm-root .cm-hero-pills { justify-content: center; }
  #cm-root .cm-size-s .cm-tile-row { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  #cm-root .cm-size-l .cm-tile-row { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  #cm-root .cm-result-list { column-count: 2; }
  #cm-root .cm-tabs a { padding: 13px 12px; font-size: 13px; }
}

/* =========================================================
   ACCOUNTS: log in, sign up, my decks, deck editor
========================================================= */
#cm-root .cm-center { justify-content: center; }
#cm-root .cm-account-hero p { margin-left: auto; margin-right: auto; }
#cm-root .cm-form { display: grid; gap: 16px; }
#cm-root .cm-field input, #cm-root .cm-field select {
  width: 100%; background: var(--cm-surface-2); border: 1px solid var(--cm-border-2); border-radius: 10px; color: var(--cm-white);
  font: 500 15px var(--cm-body); padding: 12px 14px; text-transform: none; letter-spacing: 0;
}
#cm-root .cm-field select { appearance: none; -webkit-appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 10 6'%3E%3Cpath d='M1 1l4 4 4-4' fill='none' stroke='%23ff3d57' stroke-width='1.6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 14px center; background-size: 10px; padding-right: 36px; }
#cm-root .cm-field input:focus, #cm-root .cm-field select:focus { outline: none; border-color: var(--cm-accent); box-shadow: 0 0 0 3px rgba(255, 61, 87, 0.15); }
#cm-root .cm-field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
#cm-root .cm-check { display: flex; align-items: center; gap: 8px; font-size: 13.5px; color: var(--cm-text); }
#cm-root .cm-check input { accent-color: var(--cm-accent); width: 16px; height: 16px; }
#cm-root .cm-btn-block { width: 100%; }
#cm-root .cm-auth-box { max-width: 440px; margin: 0 auto; padding: 28px; border-radius: var(--cm-radius); background: var(--cm-surface); border: 1px solid var(--cm-border); }
#cm-root .cm-auth-links { text-align: center; font-size: 13.5px; color: var(--cm-dim); margin: 0; }
#cm-root .cm-auth-links a { color: var(--cm-accent); font-weight: 700; }
#cm-root .cm-notice { padding: 12px 14px; border-radius: 10px; font-size: 14px; margin-bottom: 16px; }
#cm-root .cm-notice-bad { background: rgba(255, 61, 87, 0.1); border: 1px solid rgba(255, 61, 87, 0.45); color: #ffb3bd; }
#cm-root .cm-notice-ok { background: rgba(79, 224, 160, 0.1); border: 1px solid rgba(79, 224, 160, 0.4); color: #a8f0cf; }
#cm-root .cm-empty-box { text-align: center; padding: 50px 20px; border: 1px dashed var(--cm-border); border-radius: var(--cm-radius); color: var(--cm-dim); }
#cm-root .cm-empty-box p { margin: 0 0 18px; }
#cm-root .cm-user-decks { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 20px; }
#cm-root .cm-user-deck .cm-deck-tile { height: auto; }
#cm-root .cm-user-deck-actions { display: flex; flex-wrap: wrap; gap: 4px 14px; align-items: center; padding: 10px 4px 0; font-size: 13px; font-weight: 700; }
#cm-root .cm-user-deck-actions a { color: var(--cm-text); }
#cm-root .cm-user-deck-actions a:hover { color: var(--cm-accent); }
#cm-root .cm-user-deck-actions .cm-caption { margin-left: auto; font-weight: 500; }
#cm-root .cm-tag-private { color: #2a1d00; background: var(--cm-gold); border-color: var(--cm-gold); }
#cm-root .cm-editor { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr); gap: 32px; align-items: start; }
#cm-root .cm-editor-form textarea[name="list"] { font: 13.5px/1.6 ui-monospace, Menlo, Consolas, monospace; }
#cm-root .cm-editor-actions { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; }
#cm-root .cm-editor-sticky { position: sticky; top: calc(var(--cm-header-h) + 16px); max-height: calc(100vh - var(--cm-header-h) - 32px); overflow-y: auto; padding-right: 4px; }
#cm-root .cm-editor-sticky .cm-verdict { margin-bottom: 4px; }
#cm-root .cm-editor-preview { margin-top: 18px; }
#cm-root .cm-editor-preview .cm-tile-row { grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 8px; }
#cm-root .cm-ac-wrap { position: relative; }
#cm-root .cm-ac-list { position: absolute; left: 0; right: 0; top: 100%; z-index: 40; margin-top: 4px; background: var(--cm-solid); border: 1px solid var(--cm-border); border-radius: 10px; padding: 5px; box-shadow: 0 24px 50px -16px rgba(0,0,0,0.9); }
#cm-root .cm-ac-list button { display: block; width: 100%; text-align: left; background: none; border: 0; color: var(--cm-white); font: 600 14px var(--cm-body); padding: 9px 11px; border-radius: 7px; cursor: pointer; text-transform: none; letter-spacing: 0; }
#cm-root .cm-ac-list button:hover, #cm-root .cm-ac-list button.cm-on { background: rgba(255, 61, 87, 0.14); color: var(--cm-accent); }
@media (max-width: 1180px) { #cm-root .cm-user-decks { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 980px) {
  #cm-root .cm-editor { grid-template-columns: 1fr; }
  #cm-root .cm-editor-sticky { position: static; max-height: none; overflow: visible; }
}
@media (max-width: 760px) {
  #cm-root .cm-user-decks { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
  #cm-root .cm-field-row { grid-template-columns: 1fr; }
  #cm-root .cm-auth-box { padding: 20px; }
  #cm-root .cm-editor-preview .cm-tile-row { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  #cm-root .cm-user-deck-actions .cm-caption { margin-left: 0; width: 100%; }
}

/* Phones: card size buttons do nothing useful on a narrow screen */
@media (max-width: 760px) {
  #cm-root .cm-gallery-bar .cm-bar-group:first-child { display: none; }
  #cm-root .cm-size-s .cm-tile-row, #cm-root .cm-size-m .cm-tile-row, #cm-root .cm-size-l .cm-tile-row { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 9px; }
}
#cm-root .cm-login-btn svg { width: 16px; height: 16px; }
@media (max-width: 980px) {
  #cm-root .cm-nav.cm-nav-open { background: #0b0708; box-shadow: 0 30px 60px -20px rgba(0,0,0,0.9); }
}
@media (max-width: 760px) {
  #cm-root .cm-login-btn span { display: none; }
  #cm-root .cm-login-btn { width: 38px; height: 38px; padding: 0; border-radius: 50%; }
  #cm-root .cm-header-cta { gap: 8px; }
}
@media (max-width: 360px) { #cm-root .cm-header-cta .cm-btn-primary { display: none; } }
/* Results table becomes stacked cards on phones */
@media (max-width: 760px) {
  #cm-root .cm-table-wrap { border: 0; overflow: visible; }
  #cm-root .cm-results { min-width: 0; }
  #cm-root .cm-results thead { display: none; }
  #cm-root .cm-results tbody tr:not(.cm-result-detail) { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px 12px; padding: 14px; margin-bottom: 12px; border: 1px solid var(--cm-border-2); border-radius: 12px; background: var(--cm-surface); }
  #cm-root .cm-results td { display: block; padding: 0; border: 0; background: none !important; font-size: 13px; }
  #cm-root .cm-results td::before { content: attr(data-label); display: block; font: 800 9.5px var(--cm-body); letter-spacing: 0.1em; text-transform: uppercase; color: var(--cm-dim); margin-bottom: 2px; }
  #cm-root .cm-results td.cm-res-event, #cm-root .cm-results td.cm-res-link { grid-column: 1 / -1; }
  #cm-root .cm-results td.cm-num { text-align: left; }
  #cm-root .cm-results .cm-row-main { box-shadow: inset 3px 0 0 var(--cm-accent); }
  #cm-root .cm-results .cm-row-main td:first-child { box-shadow: none; }
  #cm-root .cm-results tr.cm-result-detail:not(.cm-hidden) { display: block; margin: -6px 0 12px; }
  #cm-root .cm-results tr.cm-result-detail td { display: block; padding: 12px; border-radius: 0 0 12px 12px; }
  #cm-root .cm-results tr.cm-result-detail td::before { content: none; }
}

/* Gallery controls stay in view while scrolling the cards (desktop), until Charts */
@media (min-width: 761px) {
  #cm-root .cm-gallery-sticky { position: sticky; top: calc(var(--cm-header-h) + 50px); z-index: 25; margin: 0 -8px 6px; padding: 8px 8px 2px; background: linear-gradient(180deg, var(--cm-bg) 85%, rgba(11,7,8,0)); }
  body.admin-bar #cm-root .cm-gallery-sticky { top: calc(var(--cm-header-h) + 82px); }
  #cm-root .cm-gallery-sticky .cm-gallery-bar { background: #170d10; margin-bottom: 8px; }
  #cm-root .cm-gallery-sticky .cm-type-chips { margin: 0 0 8px; }
}

/* Sortable result columns and Load more */
#cm-root .cm-results-sort-m { display: none; }
#cm-root .cm-results th button { background: none; border: 0; padding: 0; cursor: pointer; color: inherit; font: inherit; letter-spacing: inherit; text-transform: inherit; display: inline-flex; align-items: center; gap: 5px; }
#cm-root .cm-results th button:hover { color: var(--cm-white); }
#cm-root .cm-results th button::after { content: ""; width: 0; height: 0; border: 4px solid transparent; opacity: 0; }
#cm-root .cm-results th button.cm-sorted-desc { color: var(--cm-white); }
#cm-root .cm-results th button.cm-sorted-desc::after { opacity: 1; border-top-color: var(--cm-accent); margin-top: 4px; }
#cm-root .cm-results th button.cm-sorted-asc { color: var(--cm-white); }
#cm-root .cm-results th button.cm-sorted-asc::after { opacity: 1; border-bottom-color: var(--cm-accent); margin-top: -4px; }
#cm-root .cm-results tbody.cm-res-item.cm-hidden { display: none; }
#cm-root .cm-load-more { display: flex; flex-direction: column; align-items: center; gap: 8px; margin-top: 22px; }
@media (max-width: 760px) {
  #cm-root .cm-results tbody.cm-res-item { display: block; }
  #cm-root .cm-results-sort-m { display: flex; margin-bottom: 12px; }
}

/* Homepage: browse by colors */
#cm-root .cm-color-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
#cm-root .cm-color-card { display: flex; flex-direction: column; gap: 8px; padding: 18px; border-radius: var(--cm-radius); background: var(--cm-surface); border: 1px solid var(--cm-border); transition: transform .2s, border-color .2s; }
#cm-root .cm-color-card:hover { transform: translateY(-3px); border-color: rgba(255, 61, 87, 0.55); }
#cm-root .cm-color-card .cm-pip { width: 22px; height: 22px; font-size: 10px; }
#cm-root .cm-color-card h3 { font-size: 1.1rem; margin-top: 4px; }
#cm-root .cm-color-card p { margin: 0; font-size: 13px; color: var(--cm-text); line-height: 1.45; }
@media (max-width: 1180px) { #cm-root .cm-color-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 760px) { #cm-root .cm-color-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; } #cm-root .cm-color-card { padding: 14px; } }

/* Official mana symbols (Scryfall's symbol images) for color pips and mana costs.
   The colored circle underneath shows if an image ever fails to load. */
#cm-root .cm-pip { background-size: cover !important; background-position: center !important; background-repeat: no-repeat !important; color: transparent !important; border: 0; box-shadow: 0 1px 2px rgba(0,0,0,0.5); overflow: hidden; }
#cm-root .cm-pip-w { background-image: url(https://svgs.scryfall.io/card-symbols/W.svg); }
#cm-root .cm-pip-u { background-image: url(https://svgs.scryfall.io/card-symbols/U.svg); }
#cm-root .cm-pip-b { background-image: url(https://svgs.scryfall.io/card-symbols/B.svg); }
#cm-root .cm-pip-r { background-image: url(https://svgs.scryfall.io/card-symbols/R.svg); }
#cm-root .cm-pip-g { background-image: url(https://svgs.scryfall.io/card-symbols/G.svg); }
#cm-root .cm-pip-c { background-image: url(https://svgs.scryfall.io/card-symbols/C.svg); }
#cm-root .cm-ms { background: #b9b0b2 center / cover no-repeat; color: transparent; border-radius: 50%; box-shadow: 0 1px 2px rgba(0,0,0,0.5); }
#cm-root .cm-related { margin: 8px 0 0; font-size: 13.5px; color: var(--cm-dim); }
#cm-root .cm-related a { color: var(--cm-white); font-weight: 700; border-bottom: 1px solid rgba(255, 61, 87, 0.5); }
