:root {
  --theme-name: "mana";
  --page-bg: #21170f;
  --paper: rgba(255, 244, 218, 0.94);
  --ink: #24160d;
  --muted: #745d42;
  --rule: #b98a42;
  --rule-dark: #4c2f16;
  --header: #100b08;
  --header-soft: #3b2512;
  --panel-head: #ead19a;
  --panel-soft: rgba(255, 248, 226, 0.9);
  --focus: #1f7a5a;
  --legal-bg: #e5f7de;
  --legal-border: #2f8d56;
  --illegal-bg: #ffe2d3;
  --illegal-border: #b94222;
  --mana-gold: #e4c36d;
  --mana-green: #2e8b57;
  --mana-blue: #3979b8;
  --mana-red: #b9482f;
  --mana-black: #211a1a;
  --mana-white: #f5ead1;
  --theme-glow: 0 0 28px rgba(228, 195, 109, 0.34), 0 0 56px rgba(46, 139, 87, 0.18);
  --theme-glow-soft: 0 0 18px rgba(228, 195, 109, 0.2);
  --panel-gradient: linear-gradient(145deg, rgba(255, 250, 232, 0.96), rgba(230, 203, 146, 0.9));
  --card-frame: #080604;
  --card-hover-glow: 0 0 18px rgba(228, 195, 109, 0.42), 0 0 26px rgba(46, 139, 87, 0.28);
  --button-gradient: linear-gradient(135deg, #1f6f4c, #c1933e);
  --mana-parchment:
    radial-gradient(circle at 16% 12%, rgba(255, 255, 245, 0.45), transparent 18%),
    radial-gradient(circle at 86% 84%, rgba(107, 70, 26, 0.16), transparent 27%),
    radial-gradient(circle at 48% 36%, rgba(204, 155, 72, 0.12), transparent 30%),
    linear-gradient(135deg, rgba(255, 250, 232, 0.98), rgba(233, 204, 142, 0.94) 48%, rgba(214, 180, 113, 0.9)),
    repeating-linear-gradient(36deg, rgba(95, 58, 20, 0.045) 0 1px, transparent 1px 8px),
    repeating-linear-gradient(112deg, rgba(255, 255, 255, 0.05) 0 1px, transparent 1px 11px);
  --mana-board:
    radial-gradient(circle at 12% 16%, rgba(255, 248, 210, 0.32), transparent 24%),
    radial-gradient(circle at 88% 78%, rgba(35, 102, 58, 0.16), transparent 28%),
    radial-gradient(circle at 54% 54%, rgba(175, 108, 38, 0.16), transparent 34%),
    linear-gradient(145deg, rgba(249, 232, 184, 0.96), rgba(202, 159, 82, 0.8)),
    repeating-linear-gradient(90deg, rgba(72, 45, 17, 0.045) 0 1px, transparent 1px 10px),
    repeating-linear-gradient(0deg, rgba(255, 255, 255, 0.05) 0 1px, transparent 1px 13px);
  --mana-plate:
    linear-gradient(180deg, rgba(76, 50, 21, 0.98), rgba(35, 21, 10, 0.98)),
    radial-gradient(circle at 50% 0%, rgba(255, 231, 157, 0.28), transparent 48%);
}

body.theme-mana {
  background:
    radial-gradient(circle at 8% 10%, rgba(245, 234, 209, 0.24), transparent 23%),
    radial-gradient(circle at 25% 84%, rgba(46, 139, 87, 0.24), transparent 31%),
    radial-gradient(circle at 88% 18%, rgba(57, 121, 184, 0.24), transparent 29%),
    radial-gradient(circle at 82% 76%, rgba(185, 72, 47, 0.22), transparent 31%),
    radial-gradient(circle at 47% 48%, rgba(228, 195, 109, 0.15), transparent 34%),
    linear-gradient(135deg, #100b08 0%, #2d1e12 38%, #122416 73%, #24130f 100%);
  background-attachment: fixed;
}

body.theme-mana::before {
  background:
    linear-gradient(90deg, rgba(228, 195, 109, 0.045) 1px, transparent 1px),
    linear-gradient(rgba(228, 195, 109, 0.035) 1px, transparent 1px);
  background-size: 44px 44px;
  content: "";
  inset: 0;
  opacity: 0.65;
  pointer-events: none;
  position: fixed;
  z-index: -1;
}

.theme-mana .site-header {
  background:
    linear-gradient(90deg, rgba(16, 11, 8, 0.98), rgba(72, 43, 16, 0.96) 46%, rgba(12, 48, 35, 0.97)),
    radial-gradient(circle at 8% 0%, rgba(245, 234, 209, 0.18), transparent 28%);
  border-bottom-color: var(--mana-gold);
  box-shadow: 0 3px 0 rgba(50, 29, 9, 0.9), 0 16px 38px rgba(12, 7, 3, 0.42);
}

.theme-mana .site-footer {
  color: #ead9b2;
  text-shadow: 0 1px 0 rgba(0, 0, 0, 0.45);
}

.theme-mana .brand-title {
  color: #fff7d8;
  text-shadow: 0 0 18px rgba(228, 195, 109, 0.34), 0 1px 0 #000;
}

.theme-mana .brand-kicker,
.theme-mana .theme-switcher span {
  color: #e8d8ae;
}

.theme-mana .db-nav,
.theme-mana .db-nav a,
.theme-mana .db-nav button,
.theme-mana .theme-switcher a {
  border-color: rgba(228, 195, 109, 0.48);
}

.theme-mana .db-nav a,
.theme-mana .db-nav button,
.theme-mana .theme-switcher a {
  background: linear-gradient(180deg, rgba(70, 45, 21, 0.96), rgba(33, 22, 13, 0.96));
  color: #fff3d0;
}

.theme-mana .db-nav a:hover,
.theme-mana .db-nav a[aria-current="page"],
.theme-mana .db-nav button:hover,
.theme-mana .theme-switcher a:hover,
.theme-mana .theme-switcher a[aria-current="true"] {
  background: linear-gradient(180deg, #f7e5ad, #d5a952);
  border-color: #f8e9ba;
  color: #231409;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.34), 0 0 14px rgba(228, 195, 109, 0.32);
}

.theme-mana .page-shell {
  position: relative;
}

.theme-mana .db-panel,
.theme-mana .deck-gallery-panel,
.theme-mana .card-image-card,
.theme-mana .deck-gallery-card,
.theme-mana .my-deck-card,
.theme-mana .archive-table-row,
.theme-mana .deck-builder-search,
.theme-mana .builder-detail-search,
.theme-mana .builder-quick-filter-panel,
.theme-mana .deck-builder-legality,
.theme-mana .deck-gallery-info {
  background: var(--mana-parchment);
  background-blend-mode: normal, multiply, overlay, normal, multiply, overlay;
  border-color: rgba(199, 151, 63, 0.82);
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.38),
    inset 0 0 28px rgba(91, 51, 17, 0.12),
    0 2px 0 rgba(62, 39, 15, 0.22),
    0 16px 38px rgba(20, 11, 4, 0.18);
}

.theme-mana .db-panel-head,
.theme-mana .db-subhead,
.theme-mana .deck-gallery-panel-head,
.theme-mana .compact-list-title {
  background:
    linear-gradient(90deg, rgba(71, 47, 19, 0.98), rgba(178, 131, 49, 0.96) 52%, rgba(33, 101, 67, 0.96)),
    radial-gradient(circle at 10% 0%, rgba(255, 255, 255, 0.25), transparent 28%);
  border-color: rgba(255, 230, 164, 0.48);
  color: #fff8df;
  text-shadow: 0 1px 0 rgba(0, 0, 0, 0.45);
}

.theme-mana .section-title,
.theme-mana .compact-list-title,
.theme-mana .deck-gallery-panel-head h2 {
  color: inherit;
}

.theme-mana .section-note,
.theme-mana .meta-label,
.theme-mana .mobile-meta,
.theme-mana .deck-source-note,
.theme-mana .form-action-note,
.theme-mana .status-reason-compact {
  color: #6f5638;
}

.theme-mana .field-label {
  color: #5a3518;
}

.theme-mana .db-input,
.theme-mana .db-select,
.theme-mana .db-textarea,
.theme-mana .auth-panel input {
  background: rgba(255, 251, 238, 0.96);
  border-color: rgba(153, 106, 38, 0.62);
  color: #24160d;
  box-shadow: inset 0 1px 3px rgba(80, 48, 16, 0.12);
}

.theme-mana .db-input:focus,
.theme-mana .db-select:focus,
.theme-mana .db-textarea:focus {
  border-color: var(--mana-green);
  box-shadow: 0 0 0 2px rgba(46, 139, 87, 0.24), inset 0 1px 3px rgba(80, 48, 16, 0.12);
}

.theme-mana .quick-tabs,
.theme-mana .active-filter-chip {
  background:
    linear-gradient(180deg, rgba(255, 248, 222, 0.94), rgba(225, 196, 132, 0.86)),
    repeating-linear-gradient(90deg, rgba(94, 60, 20, 0.06) 0 1px, transparent 1px 8px);
  border-color: rgba(185, 138, 66, 0.72);
  box-shadow: inset 0 0 14px rgba(89, 52, 15, 0.08);
}

.theme-mana .db-button-primary,
.theme-mana .quick-tab-active,
.theme-mana .segmented-button-active,
.theme-mana .builder-quick-filter.is-active,
.theme-mana .pagination-current {
  background: var(--button-gradient);
  border-color: #f0d184;
  color: #fff9e7;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.23), 0 0 16px rgba(46, 139, 87, 0.28);
  text-shadow: 0 1px 0 rgba(0, 0, 0, 0.42);
}

.theme-mana .db-button-secondary,
.theme-mana .quick-tab,
.theme-mana .segmented-button,
.theme-mana .builder-quick-filter,
.theme-mana .pagination-link,
.theme-mana .builder-menu-link,
.theme-mana .builder-mini-button {
  background: linear-gradient(180deg, #fff8e2, #ead8ad);
  border-color: rgba(166, 118, 45, 0.72);
  color: #35200f;
}

.theme-mana .db-button-secondary:hover,
.theme-mana .quick-tab:hover,
.theme-mana .segmented-button:hover,
.theme-mana .builder-quick-filter:hover,
.theme-mana .pagination-link:hover,
.theme-mana .builder-menu-link:hover,
.theme-mana .builder-mini-button:hover {
  background: linear-gradient(180deg, #2c8a5b, #155f42);
  border-color: #f0d184;
  color: #fff8df;
  box-shadow: 0 0 14px rgba(46, 139, 87, 0.3);
}

.theme-mana .status-legal,
.theme-mana .status-badge.status-legal {
  background: #e5f7de;
  border-color: #2e8b57;
  color: #10472e;
}

.theme-mana .status-warning,
.theme-mana .deck-builder-warning {
  background: #fff1c7;
  border-color: #c99320;
  color: #5d3e05;
}

.theme-mana .status-illegal,
.theme-mana .status-banned {
  background: #ffe2d6;
  border-color: #b23a1b;
  color: #6d1608;
}

.theme-mana .card-image-grid,
.theme-mana .deck-builder-results,
.theme-mana .deck-builder-grid,
.theme-mana .deck-grid-body {
  background: var(--mana-board);
  background-blend-mode: normal, multiply, overlay, normal, multiply, overlay;
  box-shadow:
    inset 0 0 0 1px rgba(255, 245, 204, 0.24),
    inset 0 0 34px rgba(74, 43, 15, 0.15);
}

.theme-mana .card-image-link,
.theme-mana .deck-card-art-link,
.theme-mana .builder-card-art,
.theme-mana .builder-deck-art,
.theme-mana .deck-gallery-mini-card,
.theme-mana .deck-hero-card-art,
.theme-mana .deck-hero-card {
  border-color: var(--card-frame);
  box-shadow:
    0 5px 13px rgba(0, 0, 0, 0.44),
    0 0 0 1px rgba(245, 219, 137, 0.36),
    0 0 10px rgba(32, 110, 70, 0.14),
    0 0 18px rgba(228, 195, 109, 0.14);
}

.theme-mana .card-image-link:hover,
.theme-mana .deck-card-art-link:hover,
.theme-mana .builder-card-art:hover,
.theme-mana .builder-deck-art:hover,
.theme-mana .deck-gallery-mini-card:hover {
  box-shadow:
    0 8px 19px rgba(0, 0, 0, 0.48),
    0 0 0 1px rgba(255, 239, 175, 0.62),
    var(--card-hover-glow);
}

.theme-mana .card-image-link .card-thumb-placeholder,
.theme-mana .deck-card-placeholder {
  background:
    radial-gradient(circle at 50% 32%, rgba(255, 255, 255, 0.24), transparent 34%),
    linear-gradient(135deg, #5a4329, #d3b36a);
  color: #fff2c9;
}

.theme-mana .deck-gallery-card {
  background:
    linear-gradient(180deg, rgba(35, 22, 12, 0.58), rgba(13, 8, 5, 0.96)),
    #1a110b;
  border-color: rgba(233, 199, 105, 0.58);
  box-shadow: 0 18px 38px rgba(0, 0, 0, 0.28), var(--theme-glow-soft);
}

.theme-mana .deck-gallery-card::after {
  background: linear-gradient(90deg, #f1d783, #2e8b57, #3979b8, #b9482f);
  height: 4px;
}

.theme-mana .deck-gallery-card-art::before {
  background-image:
    linear-gradient(180deg, rgba(21, 11, 4, 0.42), rgba(11, 6, 2, 0.92)),
    radial-gradient(circle at 20% 12%, rgba(245, 234, 209, 0.16), transparent 30%),
    var(--deck-list-bg);
  opacity: 0.75;
}

.theme-mana .deck-gallery-card-meta span,
.theme-mana .deck-summary-strip span,
.theme-mana .deck-details-summary span,
.theme-mana .deck-hero-meta-gallery span {
  background: rgba(245, 234, 209, 0.15);
  border-color: rgba(245, 219, 137, 0.38);
  color: #fff2c9;
}

.theme-mana .deck-hero,
.theme-mana .deck-hero-gallery {
  background:
    radial-gradient(circle at 70% 35%, rgba(228, 195, 109, 0.16), transparent 32%),
    linear-gradient(135deg, #0f0804, #3a2411 48%, #0e2a20);
  border-color: rgba(245, 219, 137, 0.56);
  box-shadow:
    inset 0 0 0 1px rgba(255, 239, 175, 0.12),
    inset 0 0 38px rgba(228, 195, 109, 0.08),
    0 18px 42px rgba(0, 0, 0, 0.32),
    var(--theme-glow-soft);
}

.theme-mana .deck-hero-gallery::after {
  background:
    linear-gradient(90deg, rgba(10, 6, 3, 0.94) 0%, rgba(41, 25, 10, 0.78) 42%, rgba(11, 31, 22, 0.68) 100%),
    radial-gradient(circle at 80% 15%, rgba(228, 195, 109, 0.24), transparent 30%),
    linear-gradient(135deg, rgba(46, 139, 87, 0.22), rgba(185, 72, 47, 0.12));
}

.theme-mana .deck-hero h1,
.theme-mana .deck-gallery-card-title {
  text-shadow: 0 0 14px rgba(228, 195, 109, 0.22), 0 2px 0 rgba(0, 0, 0, 0.7);
}

.theme-mana .deck-mana-curve {
  background: rgba(18, 10, 5, 0.74);
  border-color: rgba(228, 195, 109, 0.48);
  box-shadow: inset 0 0 16px rgba(228, 195, 109, 0.08), 0 0 18px rgba(46, 139, 87, 0.12);
}

.theme-mana .deck-curve-bar {
  background: linear-gradient(180deg, #ffe9a3, #2e8b57);
  box-shadow: 0 0 8px rgba(228, 195, 109, 0.36);
}

.theme-mana .deck-gallery-panel {
  background: var(--mana-parchment);
  background-blend-mode: normal, multiply, overlay, normal, multiply, overlay;
  border-color: rgba(139, 93, 35, 0.88);
  box-shadow:
    0 13px 34px rgba(23, 13, 4, 0.2),
    inset 0 0 0 1px rgba(255, 247, 214, 0.48),
    inset 0 0 36px rgba(81, 47, 12, 0.13);
}

.theme-mana .deck-inline-type-label {
  color: #7e5a25;
}

.theme-mana .deck-quantity-badge {
  background: linear-gradient(180deg, #2c1a0d, #070503);
  border-color: #f8e4a4;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.5), 0 0 10px rgba(228, 195, 109, 0.42);
}

.theme-mana .builder-card-menu {
  background: rgba(255, 249, 231, 0.98);
  border-color: #7b4b1f;
  box-shadow: 0 16px 34px rgba(25, 13, 5, 0.34), 0 0 0 1px rgba(245, 219, 137, 0.34);
}

.theme-mana .source-text-block,
.theme-mana .deck-source-example {
  background: #fff7df;
  border-color: rgba(185, 138, 66, 0.55);
  color: #2c1d10;
}

.theme-mana .quick-filter-button-color,
.theme-mana .builder-quick-filter-color {
  background:
    radial-gradient(circle at 45% 18%, rgba(255, 250, 212, 0.38), transparent 34%),
    linear-gradient(180deg, rgba(62, 39, 15, 0.96), rgba(24, 15, 8, 0.98));
  border-color: rgba(234, 200, 111, 0.55);
  border-radius: 999px;
  box-shadow:
    inset 0 0 0 1px rgba(255, 247, 210, 0.12),
    0 2px 8px rgba(34, 19, 7, 0.24);
  min-height: 36px;
  min-width: 36px;
  padding: 4px;
}

.theme-mana .quick-filter-button-color:hover,
.theme-mana .quick-filter-button-color.quick-filter-button-active,
.theme-mana .builder-quick-filter-color:hover,
.theme-mana .builder-quick-filter-color.is-active {
  background:
    radial-gradient(circle at 45% 18%, rgba(255, 250, 212, 0.48), transparent 34%),
    linear-gradient(180deg, rgba(97, 70, 24, 0.98), rgba(31, 82, 54, 0.98));
  border-color: rgba(255, 231, 158, 0.95);
  box-shadow:
    inset 0 0 0 1px rgba(255, 248, 215, 0.35),
    0 0 0 2px rgba(240, 209, 132, 0.45),
    0 0 18px rgba(228, 195, 109, 0.42),
    0 0 26px rgba(46, 139, 87, 0.18);
  transform: translateY(-1px);
}

.theme-mana .quick-filter-button-type,
.theme-mana .builder-quick-filter-type {
  position: relative;
  background:
    linear-gradient(180deg, rgba(255, 249, 229, 0.96), rgba(212, 174, 103, 0.9)),
    repeating-linear-gradient(135deg, rgba(77, 45, 13, 0.08) 0 1px, transparent 1px 7px);
  border-color: rgba(128, 78, 26, 0.78);
  border-radius: 8px;
  box-shadow:
    inset 0 0 0 1px rgba(255, 252, 229, 0.34),
    inset 0 -8px 14px rgba(93, 57, 18, 0.09),
    0 2px 5px rgba(40, 22, 7, 0.16);
  overflow: hidden;
}

.theme-mana .quick-filter-button-type::before,
.theme-mana .builder-quick-filter-type::before {
  background: linear-gradient(90deg, transparent, rgba(255, 245, 191, 0.38), transparent);
  content: "";
  height: 1px;
  left: 8%;
  position: absolute;
  right: 8%;
  top: 4px;
}

.theme-mana .quick-filter-button-type > *,
.theme-mana .builder-quick-filter-type > * {
  position: relative;
  z-index: 1;
}

.theme-mana .quick-filter-button-type:hover,
.theme-mana .quick-filter-button-type.quick-filter-button-active,
.theme-mana .builder-quick-filter-type:hover,
.theme-mana .builder-quick-filter-type.is-active {
  background:
    linear-gradient(180deg, #2f8c5b, #164e36),
    radial-gradient(circle at 50% 0%, rgba(255, 225, 137, 0.32), transparent 58%);
  border-color: #f0d184;
  color: #fff8df;
  box-shadow:
    inset 0 0 0 1px rgba(255, 239, 183, 0.22),
    0 0 0 1px rgba(78, 49, 16, 0.5),
    0 0 16px rgba(228, 195, 109, 0.28);
  transform: translateY(-1px);
}

.theme-mana .mana-pip {
  border-color: rgba(255, 236, 166, 0.78);
  box-shadow:
    inset 0 1px 2px rgba(255, 255, 255, 0.62),
    inset 0 -2px 3px rgba(0, 0, 0, 0.24),
    inset 0 0 0 1px rgba(255, 255, 255, 0.08),
    0 0 0 1px rgba(54, 32, 11, 0.5),
    0 2px 7px rgba(0, 0, 0, 0.28),
    0 0 10px rgba(228, 195, 109, 0.22);
  height: 28px;
  width: 28px;
}

.theme-mana .quick-filter-button-color:hover .mana-pip,
.theme-mana .quick-filter-button-color.quick-filter-button-active .mana-pip,
.theme-mana .builder-quick-filter-color:hover .mana-pip,
.theme-mana .builder-quick-filter-color.is-active .mana-pip {
  box-shadow:
    inset 0 1px 3px rgba(255, 255, 255, 0.72),
    inset 0 -2px 4px rgba(0, 0, 0, 0.26),
    0 0 0 1px rgba(54, 32, 11, 0.54),
    0 0 0 2px rgba(255, 235, 164, 0.38),
    0 3px 10px rgba(0, 0, 0, 0.32),
    0 0 16px rgba(228, 195, 109, 0.45);
}

.theme-mana .type-filter-icon {
  background:
    radial-gradient(circle at 50% 24%, rgba(255, 247, 204, 0.48), transparent 38%),
    linear-gradient(180deg, rgba(112, 72, 27, 0.16), rgba(54, 34, 14, 0.1));
  border-radius: 999px;
  color: #4c2c10;
  filter: drop-shadow(0 1px 0 rgba(255, 255, 255, 0.28));
  height: 22px;
  width: 22px;
}

.theme-mana .quick-filter-button-type:hover .type-filter-icon,
.theme-mana .quick-filter-button-type.quick-filter-button-active .type-filter-icon,
.theme-mana .builder-quick-filter-type:hover .type-filter-icon,
.theme-mana .builder-quick-filter-type.is-active .type-filter-icon {
  color: #fff2be;
  filter: drop-shadow(0 0 6px rgba(245, 218, 127, 0.34));
}

/* Second pass: make Mana feel like a fantasy card-table skin, not Classic recolored. */
body.theme-mana {
  background:
    radial-gradient(circle at 9% 16%, rgba(246, 235, 200, 0.2), transparent 18%),
    radial-gradient(circle at 31% 83%, rgba(46, 139, 87, 0.3), transparent 26%),
    radial-gradient(circle at 89% 24%, rgba(60, 130, 180, 0.2), transparent 24%),
    radial-gradient(circle at 75% 78%, rgba(176, 60, 38, 0.2), transparent 28%),
    radial-gradient(circle at 54% 40%, rgba(227, 188, 94, 0.16), transparent 38%),
    linear-gradient(135deg, #0f0906 0%, #2c180b 34%, #102917 66%, #201008 100%);
}

.theme-mana .card-search-panel,
.theme-mana .card-results-head,
.theme-mana .deck-builder-meta-form,
.theme-mana .deck-description-panel,
.theme-mana .deck-builder-import-panel {
  border-color: rgba(236, 205, 122, 0.8);
  box-shadow:
    0 18px 42px rgba(13, 7, 2, 0.28),
    inset 0 0 0 1px rgba(255, 247, 207, 0.28),
    inset 0 0 42px rgba(81, 47, 12, 0.13);
}

.theme-mana .card-search-panel {
  background:
    radial-gradient(circle at 12% 0%, rgba(255, 252, 222, 0.52), transparent 24%),
    radial-gradient(circle at 92% 24%, rgba(42, 123, 75, 0.17), transparent 33%),
    radial-gradient(circle at 40% 82%, rgba(143, 81, 24, 0.13), transparent 42%),
    linear-gradient(135deg, rgba(255, 244, 205, 0.97), rgba(216, 174, 87, 0.9) 58%, rgba(121, 93, 38, 0.86)),
    repeating-linear-gradient(33deg, rgba(82, 49, 14, 0.055) 0 1px, transparent 1px 9px);
  background-blend-mode: normal, multiply, multiply, normal, multiply;
  border-radius: 4px;
  position: relative;
}

.theme-mana .card-search-panel::before {
  background:
    linear-gradient(90deg, rgba(83, 50, 16, 0.34), transparent 18%, transparent 82%, rgba(20, 67, 44, 0.28)),
    radial-gradient(circle at 50% 0%, rgba(255, 237, 161, 0.2), transparent 38%);
  content: "";
  inset: 0;
  pointer-events: none;
  position: absolute;
  z-index: 0;
}

.theme-mana .card-search-panel > * {
  position: relative;
  z-index: 1;
}

.theme-mana .card-search-head,
.theme-mana .card-results-head,
.theme-mana .deck-builder-legality {
  background:
    linear-gradient(90deg, rgba(75, 48, 18, 0.96), rgba(168, 121, 39, 0.88) 45%, rgba(31, 96, 62, 0.9)),
    radial-gradient(circle at 12% 0%, rgba(255, 244, 187, 0.22), transparent 34%);
  border-bottom: 1px solid rgba(255, 228, 150, 0.42);
  color: #fff7d6;
  text-shadow: 0 1px 0 rgba(0, 0, 0, 0.48);
}

.theme-mana .card-search-form {
  background:
    radial-gradient(circle at 18% 16%, rgba(255, 252, 229, 0.55), transparent 32%),
    linear-gradient(145deg, rgba(250, 231, 180, 0.82), rgba(212, 159, 73, 0.5)),
    repeating-linear-gradient(90deg, rgba(89, 55, 20, 0.045) 0 1px, transparent 1px 11px);
  box-shadow: inset 0 10px 26px rgba(56, 33, 11, 0.08);
}

.theme-mana .card-search-primary-row,
.theme-mana .quick-filter-panel,
.theme-mana .detail-panel,
.theme-mana .active-filter-bar,
.theme-mana .builder-quick-filter-panel,
.theme-mana .builder-detail-search {
  background:
    radial-gradient(circle at 18% 12%, rgba(255, 252, 229, 0.58), transparent 28%),
    radial-gradient(circle at 100% 92%, rgba(35, 96, 57, 0.13), transparent 30%),
    linear-gradient(145deg, rgba(255, 241, 199, 0.94), rgba(214, 174, 94, 0.78)),
    repeating-linear-gradient(118deg, rgba(71, 43, 14, 0.055) 0 1px, transparent 1px 10px);
  border: 1px solid rgba(120, 76, 25, 0.76);
  box-shadow:
    inset 0 0 0 1px rgba(255, 251, 223, 0.35),
    inset 0 0 22px rgba(92, 54, 18, 0.12),
    0 2px 5px rgba(39, 22, 7, 0.13);
  padding: 8px;
}

.theme-mana .quick-tabs {
  background:
    linear-gradient(180deg, rgba(87, 57, 24, 0.95), rgba(44, 27, 12, 0.94)),
    radial-gradient(circle at 50% 0%, rgba(255, 237, 163, 0.22), transparent 42%);
  border-color: rgba(236, 205, 122, 0.8);
  box-shadow:
    inset 0 0 0 1px rgba(255, 241, 183, 0.18),
    0 8px 18px rgba(32, 18, 6, 0.18);
}

.theme-mana .quick-tab,
.theme-mana .segmented-button {
  background:
    linear-gradient(180deg, rgba(255, 242, 198, 0.98), rgba(216, 178, 105, 0.92)),
    repeating-linear-gradient(90deg, rgba(78, 48, 14, 0.07) 0 1px, transparent 1px 8px);
  border-color: rgba(124, 78, 24, 0.76);
  color: #2c1b0d;
}

.theme-mana .quick-tab-active,
.theme-mana .quick-tab-active:hover,
.theme-mana .segmented-button-active,
.theme-mana .segmented-button-active:hover {
  background:
    linear-gradient(180deg, #f8e8b3, #b8842e 48%, #276846),
    radial-gradient(circle at 50% 0%, rgba(255, 255, 225, 0.42), transparent 45%);
  border-color: #ffe7a0;
  color: #160e06;
  box-shadow:
    inset 0 0 0 1px rgba(255, 251, 220, 0.36),
    0 0 15px rgba(228, 195, 109, 0.36);
}

.theme-mana .db-input,
.theme-mana .db-select,
.theme-mana .db-textarea {
  background:
    linear-gradient(180deg, rgba(255, 251, 230, 0.98), rgba(238, 214, 159, 0.96)),
    repeating-linear-gradient(100deg, rgba(92, 56, 17, 0.035) 0 1px, transparent 1px 8px);
  border-color: rgba(117, 74, 22, 0.75);
  box-shadow:
    inset 0 1px 3px rgba(71, 40, 10, 0.15),
    inset 0 0 0 1px rgba(255, 255, 231, 0.42);
}

.theme-mana .db-button-primary {
  background:
    linear-gradient(180deg, #3c9b68, #206b48 52%, #8b6928),
    radial-gradient(circle at 50% 0%, rgba(255, 238, 160, 0.42), transparent 48%);
  border-color: rgba(255, 230, 151, 0.94);
}

.theme-mana .db-button-secondary,
.theme-mana .active-filter-chip,
.theme-mana .active-filter-reset {
  background:
    linear-gradient(180deg, rgba(255, 244, 207, 0.98), rgba(218, 180, 105, 0.94));
  border-color: rgba(133, 85, 27, 0.76);
  color: #301e0e;
}

.theme-mana .detail-summary {
  background:
    linear-gradient(90deg, rgba(62, 38, 15, 0.96), rgba(177, 127, 43, 0.88), rgba(37, 101, 67, 0.9));
  border-color: rgba(255, 230, 150, 0.58);
  color: #fff8df;
  text-shadow: 0 1px 0 rgba(0, 0, 0, 0.45);
}

.theme-mana .quick-filter-panel,
.theme-mana .builder-quick-filter-panel {
  gap: 8px;
}

.theme-mana .quick-filter-label,
.theme-mana .card-tool-label {
  color: #5b3918;
  letter-spacing: 0.04em;
}

.theme-mana .quick-filter-button-color,
.theme-mana .builder-quick-filter-color {
  background:
    radial-gradient(circle at 50% 45%, rgba(22, 13, 5, 0.96), rgba(8, 5, 3, 0.98)),
    conic-gradient(from 18deg, #6c4419, #ffe5a0, #614017, #1c1006, #d4a957, #6c4419);
  border: 1px solid rgba(255, 231, 158, 0.72);
  box-shadow:
    inset 0 0 0 1px rgba(255, 247, 210, 0.17),
    inset 0 0 9px rgba(0, 0, 0, 0.42),
    0 2px 7px rgba(25, 13, 4, 0.38),
    0 0 0 1px rgba(68, 39, 10, 0.5);
  min-height: 40px;
  min-width: 40px;
}

.theme-mana .mana-pip {
  height: 30px;
  width: 30px;
  box-shadow:
    inset 0 2px 4px rgba(255, 255, 255, 0.68),
    inset 0 -4px 5px rgba(0, 0, 0, 0.34),
    inset 0 0 0 1px rgba(255, 255, 255, 0.16),
    0 0 0 1px rgba(35, 20, 6, 0.7),
    0 3px 9px rgba(0, 0, 0, 0.42),
    0 0 12px rgba(230, 197, 106, 0.24);
}

.theme-mana .quick-filter-button-color:hover,
.theme-mana .quick-filter-button-color.quick-filter-button-active,
.theme-mana .builder-quick-filter-color:hover,
.theme-mana .builder-quick-filter-color.is-active {
  box-shadow:
    inset 0 0 0 1px rgba(255, 251, 220, 0.46),
    inset 0 0 11px rgba(0, 0, 0, 0.32),
    0 0 0 2px rgba(255, 230, 151, 0.72),
    0 0 18px rgba(228, 195, 109, 0.55),
    0 0 32px rgba(47, 139, 85, 0.22);
}

.theme-mana .quick-filter-button-type,
.theme-mana .builder-quick-filter-type {
  background:
    linear-gradient(180deg, rgba(255, 238, 184, 0.98), rgba(195, 139, 57, 0.92) 72%, rgba(117, 75, 26, 0.94)),
    radial-gradient(circle at 50% 0%, rgba(255, 255, 226, 0.42), transparent 42%);
  border-color: rgba(103, 62, 18, 0.95);
  border-radius: 9px;
  box-shadow:
    inset 0 0 0 1px rgba(255, 248, 214, 0.34),
    inset 0 -10px 18px rgba(66, 38, 11, 0.16),
    0 2px 6px rgba(32, 17, 5, 0.24);
}

.theme-mana .quick-filter-button-type:hover,
.theme-mana .quick-filter-button-type.quick-filter-button-active,
.theme-mana .builder-quick-filter-type:hover,
.theme-mana .builder-quick-filter-type.is-active {
  background:
    linear-gradient(180deg, #f2d280, #2d8758 58%, #175339),
    radial-gradient(circle at 50% 0%, rgba(255, 248, 202, 0.42), transparent 44%);
  border-color: #ffe8a6;
  color: #fff8dc;
}

.theme-mana .type-filter-icon {
  background:
    radial-gradient(circle at 50% 24%, rgba(255, 247, 204, 0.5), transparent 38%),
    linear-gradient(180deg, rgba(77, 48, 17, 0.2), rgba(31, 19, 7, 0.18));
  color: #4a2b0f;
}

.theme-mana .card-image-grid,
.theme-mana .deck-grid-body,
.theme-mana .deck-builder-grid,
.theme-mana .deck-builder-results {
  background:
    radial-gradient(ellipse at 50% 38%, rgba(255, 242, 193, 0.92), transparent 58%),
    radial-gradient(circle at 12% 15%, rgba(255, 252, 224, 0.35), transparent 25%),
    radial-gradient(circle at 93% 86%, rgba(35, 99, 59, 0.2), transparent 30%),
    linear-gradient(145deg, rgba(245, 217, 151, 0.92), rgba(184, 128, 48, 0.68)),
    repeating-linear-gradient(29deg, rgba(72, 42, 12, 0.06) 0 1px, transparent 1px 7px),
    repeating-linear-gradient(105deg, rgba(255, 252, 226, 0.06) 0 1px, transparent 1px 13px);
  background-blend-mode: normal, normal, multiply, normal, multiply, overlay;
  box-shadow:
    inset 0 0 0 1px rgba(255, 245, 201, 0.3),
    inset 0 0 42px rgba(59, 34, 10, 0.2),
    inset 0 0 110px rgba(55, 34, 13, 0.12);
}

.theme-mana .deck-grid-body,
.theme-mana .deck-builder-grid {
  min-height: 132px;
  overflow: hidden;
  position: relative;
}

.theme-mana .deck-grid-body::before,
.theme-mana .deck-builder-grid::before,
.theme-mana .card-image-grid::before,
.theme-mana .deck-builder-results::before {
  background:
    radial-gradient(circle at 19% 18%, rgba(255, 252, 229, 0.2), transparent 20%),
    radial-gradient(circle at 61% 43%, rgba(255, 238, 170, 0.16), transparent 28%),
    radial-gradient(circle at 89% 78%, rgba(53, 91, 47, 0.16), transparent 31%),
    radial-gradient(circle at 6% 98%, rgba(87, 48, 14, 0.2), transparent 35%),
    linear-gradient(90deg, rgba(64, 36, 12, 0.22), transparent 16%, transparent 82%, rgba(12, 70, 44, 0.2)),
    repeating-linear-gradient(73deg, rgba(75, 46, 16, 0.07) 0 1px, transparent 1px 15px),
    repeating-linear-gradient(6deg, rgba(255, 251, 222, 0.07) 0 1px, transparent 1px 18px);
  content: "";
  inset: 0;
  mix-blend-mode: multiply;
  opacity: 0.72;
  pointer-events: none;
  position: absolute;
  z-index: 0;
}

.theme-mana .deck-grid-body > *,
.theme-mana .deck-builder-grid > *,
.theme-mana .card-image-grid > *,
.theme-mana .deck-builder-results > * {
  position: relative;
  z-index: 1;
}

.theme-mana .deck-gallery-panel,
.theme-mana .deck-builder-section {
  background:
    linear-gradient(180deg, rgba(58, 36, 13, 0.94), rgba(20, 12, 5, 0.95));
  border-color: rgba(229, 192, 100, 0.88);
  box-shadow:
    0 12px 30px rgba(12, 7, 2, 0.24),
    0 0 0 1px rgba(27, 74, 47, 0.28),
    inset 0 0 0 1px rgba(255, 239, 180, 0.18);
}

.theme-mana .deck-gallery-panel-head {
  background:
    linear-gradient(90deg, #4b2e12, #b27b28 47%, #196344),
    radial-gradient(circle at 10% 0%, rgba(255, 241, 180, 0.26), transparent 36%);
  color: #fff7d9;
}

.theme-mana .builder-empty {
  background:
    radial-gradient(circle at 50% 35%, rgba(255, 249, 216, 0.44), transparent 40%),
    linear-gradient(145deg, rgba(236, 199, 125, 0.52), rgba(132, 89, 34, 0.22));
  border: 1px dashed rgba(106, 68, 22, 0.34);
  color: #6b4a25;
}

.theme-mana .deck-builder-search {
  background:
    radial-gradient(circle at 14% 10%, rgba(255, 251, 222, 0.36), transparent 25%),
    linear-gradient(145deg, rgba(89, 57, 23, 0.98), rgba(28, 71, 48, 0.9)),
    repeating-linear-gradient(45deg, rgba(255, 230, 151, 0.035) 0 1px, transparent 1px 9px);
  color: #fff4ce;
}

.theme-mana .deck-builder-search .field-label,
.theme-mana .deck-builder-search .quick-filter-label {
  color: #f2db9d;
}

.theme-mana .deck-builder-results {
  border-top: 1px solid rgba(255, 230, 151, 0.32);
}

.theme-mana .builder-card-result h3,
.theme-mana .builder-card-unresolved {
  color: #fff2c6;
  text-shadow: 0 1px 0 rgba(0, 0, 0, 0.62);
}

.theme-mana .card-image-link,
.theme-mana .deck-card-art-link,
.theme-mana .builder-card-art,
.theme-mana .builder-deck-art,
.theme-mana .deck-gallery-mini-card,
.theme-mana .deck-hero-card-art,
.theme-mana .deck-hero-card {
  box-shadow:
    0 5px 13px rgba(0, 0, 0, 0.46),
    0 0 0 1px rgba(255, 237, 158, 0.42),
    0 0 10px rgba(45, 126, 81, 0.18);
}

.theme-mana .deck-gallery-card {
  background:
    radial-gradient(circle at 82% 15%, rgba(228, 195, 109, 0.16), transparent 32%),
    linear-gradient(135deg, rgba(54, 33, 14, 0.94), rgba(12, 39, 26, 0.96));
}

.theme-mana .deck-hero-gallery {
  background:
    radial-gradient(circle at 68% 30%, rgba(228, 195, 109, 0.2), transparent 28%),
    linear-gradient(135deg, rgba(12, 6, 3, 0.96), rgba(56, 34, 12, 0.86) 48%, rgba(8, 44, 29, 0.9));
}

.theme-mana .deck-hero-card {
  box-shadow:
    0 7px 18px rgba(0, 0, 0, 0.5),
    0 0 0 1px rgba(255, 232, 154, 0.48),
    0 0 18px rgba(228, 195, 109, 0.26),
    0 0 28px rgba(46, 139, 87, 0.12);
}

/* Third pass: compact the work surfaces while keeping the fantasy table feel. */
.theme-mana .card-search-panel {
  background:
    radial-gradient(circle at 14% 0%, rgba(255, 254, 230, 0.6), transparent 22%),
    radial-gradient(circle at 92% 28%, rgba(52, 127, 78, 0.13), transparent 30%),
    linear-gradient(135deg, rgba(255, 243, 205, 0.98), rgba(224, 187, 107, 0.84) 55%, rgba(147, 117, 49, 0.76)),
    repeating-linear-gradient(33deg, rgba(82, 49, 14, 0.04) 0 1px, transparent 1px 10px);
}

.theme-mana .card-search-head {
  padding: 6px 11px;
}

.theme-mana .card-search-head .section-title {
  font-size: 16px;
  line-height: 1.05;
}

.theme-mana .card-search-head .section-note,
.theme-mana .card-results-head .section-note {
  color: rgba(63, 43, 17, 0.74);
  font-size: 11px;
}

.theme-mana .card-search-form {
  gap: 6px;
  padding: 7px 10px 9px;
}

.theme-mana .card-search-primary-row {
  gap: 6px;
  grid-template-columns: minmax(300px, 1fr) auto minmax(360px, auto);
  padding: 5px 7px;
}

.theme-mana .card-search-input {
  font-size: 14px;
  height: 32px;
  padding: 5px 9px;
}

.theme-mana .card-search-actions {
  gap: 5px;
}

.theme-mana .card-search-actions .db-button {
  height: 32px;
  min-width: 72px;
  padding-left: 12px;
  padding-right: 12px;
}

.theme-mana .card-search-tools {
  gap: 6px;
}

.theme-mana .card-tool-group {
  gap: 3px;
}

.theme-mana .card-tool-label {
  font-size: 9px;
}

.theme-mana .segmented-button {
  height: 25px;
  padding: 6px 8px 0;
}

.theme-mana .card-per-page-control .db-select {
  height: 27px;
}

.theme-mana .quick-tabs {
  min-height: 30px;
}

.theme-mana .quick-tab {
  padding-bottom: 8px;
  padding-top: 8px;
}

.theme-mana .quick-filter-panel {
  gap: 5px;
  padding: 5px 7px;
}

.theme-mana .quick-filter-row {
  gap: 5px;
  grid-template-columns: 40px minmax(0, 1fr);
}

.theme-mana .quick-filter-row-type {
  grid-template-columns: 40px minmax(0, 1fr) auto;
}

.theme-mana .quick-filter-buttons {
  gap: 5px;
}

.theme-mana .quick-filter-buttons-color {
  gap: 1px;
}

.theme-mana .quick-filter-button-color,
.theme-mana .builder-quick-filter-color {
  min-height: 34px;
  min-width: 34px;
  padding: 3px;
}

.theme-mana .quick-filter-button-color {
  min-height: 35px;
  min-width: 35px;
}

.theme-mana .mana-pip {
  height: 25px;
  width: 25px;
}

.theme-mana .quick-filter-button-type,
.theme-mana .builder-quick-filter-type {
  gap: 2px;
  min-height: 32px;
  padding: 4px 5px;
}

.theme-mana .type-filter-icon {
  height: 16px;
  width: 17px;
}

.theme-mana .quick-filter-text {
  font-size: 8px;
  letter-spacing: 0;
}

.theme-mana .active-filter-bar {
  gap: 5px;
  padding: 5px 7px;
}

.theme-mana .active-filter-chip {
  padding-bottom: 3px;
  padding-top: 3px;
}

.theme-mana .detail-summary {
  padding: 6px 9px;
}

.theme-mana .filter-grid {
  gap: 7px;
  padding: 8px;
}

.theme-mana .card-search-panel + .db-panel {
  border-color: rgba(215, 174, 82, 0.76);
  box-shadow:
    0 12px 30px rgba(16, 9, 3, 0.2),
    inset 0 0 0 1px rgba(255, 247, 214, 0.22);
}

.theme-mana .card-image-grid {
  background:
    radial-gradient(ellipse at 50% 34%, rgba(255, 245, 204, 0.74), transparent 54%),
    radial-gradient(circle at 8% 12%, rgba(255, 252, 228, 0.26), transparent 22%),
    radial-gradient(circle at 94% 86%, rgba(42, 102, 61, 0.14), transparent 30%),
    linear-gradient(145deg, rgba(237, 206, 137, 0.84), rgba(172, 118, 43, 0.5)),
    repeating-linear-gradient(30deg, rgba(72, 42, 12, 0.045) 0 1px, transparent 1px 8px);
}

.theme-mana .deck-grid-body,
.theme-mana .deck-builder-grid {
  background:
    radial-gradient(ellipse at 36% 42%, rgba(255, 240, 186, 0.55), transparent 42%),
    radial-gradient(circle at 8% 10%, rgba(255, 252, 222, 0.18), transparent 24%),
    radial-gradient(circle at 95% 80%, rgba(29, 92, 55, 0.28), transparent 34%),
    radial-gradient(circle at 0% 100%, rgba(66, 35, 11, 0.28), transparent 38%),
    linear-gradient(145deg, rgba(224, 185, 103, 0.84), rgba(133, 91, 34, 0.64)),
    repeating-linear-gradient(25deg, rgba(72, 42, 12, 0.07) 0 1px, transparent 1px 9px),
    repeating-linear-gradient(100deg, rgba(255, 252, 226, 0.05) 0 1px, transparent 1px 15px);
  box-shadow:
    inset 0 0 0 1px rgba(255, 242, 194, 0.2),
    inset 0 0 46px rgba(47, 30, 11, 0.24),
    inset 0 0 120px rgba(25, 64, 40, 0.18);
}

.theme-mana .deck-grid-body {
  padding-bottom: 3px;
  padding-top: 2px;
}

.theme-mana .deck-grid-body::before,
.theme-mana .deck-builder-grid::before {
  opacity: 0.58;
}

.theme-mana .deck-gallery-alert,
.theme-mana .deck-builder-warning,
.theme-mana .form-errors,
.theme-mana .errorlist {
  background:
    radial-gradient(circle at 16% 0%, rgba(255, 252, 220, 0.46), transparent 28%),
    linear-gradient(135deg, rgba(255, 238, 180, 0.96), rgba(213, 155, 61, 0.76)),
    repeating-linear-gradient(110deg, rgba(91, 54, 15, 0.052) 0 1px, transparent 1px 9px);
  border: 1px solid rgba(149, 91, 24, 0.78);
  box-shadow:
    inset 0 0 0 1px rgba(255, 249, 218, 0.34),
    0 8px 18px rgba(31, 16, 4, 0.14);
  color: #3f270d;
}

.theme-mana .deck-gallery-alert {
  border-left: 4px solid #c99423;
}

.theme-mana .deck-gallery-alert-head .status-warning,
.theme-mana .deck-builder-warning .status-warning,
.theme-mana .status-warning {
  background: linear-gradient(180deg, #fff0b8, #d89d2d);
  border-color: #8b5a13;
  color: #372006;
}

.theme-mana .status-illegal,
.theme-mana .status-banned,
.theme-mana .builder-remove-button {
  color: #7f210d;
}

.theme-mana .builder-card-menu {
  background:
    radial-gradient(circle at 20% 0%, rgba(255, 252, 222, 0.5), transparent 28%),
    linear-gradient(145deg, rgba(255, 241, 198, 0.98), rgba(198, 145, 61, 0.94));
  border-color: rgba(92, 55, 15, 0.9);
  box-shadow:
    0 16px 32px rgba(19, 9, 2, 0.36),
    0 0 0 1px rgba(255, 236, 166, 0.38),
    inset 0 0 18px rgba(88, 52, 16, 0.12);
}

.theme-mana .builder-menu-link,
.theme-mana .builder-mini-button {
  background:
    linear-gradient(180deg, #fff0be, #d5a454 72%, #8d6427);
  border-color: rgba(77, 48, 15, 0.86);
  color: #271708;
}

.theme-mana .builder-remove-button:hover,
.theme-mana .builder-menu-link:hover,
.theme-mana .builder-mini-button:hover {
  background:
    linear-gradient(180deg, #2f8c5b, #164c35);
  border-color: #f0d184;
  color: #fff8df;
}

.theme-mana .deck-builder-search-form {
  gap: 6px;
  padding: 8px;
}

.theme-mana .deck-builder-filter-row {
  gap: 6px;
}

.theme-mana .deck-builder-results {
  gap: 5px;
  padding: 5px;
}

.theme-mana .deck-builder-import-panel,
.theme-mana .deck-description-panel {
  background:
    linear-gradient(145deg, rgba(75, 48, 19, 0.92), rgba(26, 69, 46, 0.82));
}

.theme-mana .deck-builder-import-panel .detail-summary,
.theme-mana .deck-description-panel .detail-summary {
  opacity: 0.9;
}

@media (max-width: 900px) {
  .theme-mana .card-search-primary-row {
    grid-template-columns: minmax(0, 1fr);
  }

  .theme-mana .card-search-tools {
    align-items: start;
  }

  .theme-mana .quick-filter-row {
    grid-template-columns: 36px minmax(0, 1fr);
  }

  .theme-mana .quick-filter-row-type {
    grid-template-columns: 36px minmax(0, 1fr);
  }
}

/* Fourth pass: final Mana polish for header and board surfaces. */
.theme-mana .site-header {
  background:
    radial-gradient(circle at 12% 0%, rgba(255, 234, 159, 0.16), transparent 24%),
    radial-gradient(circle at 88% 100%, rgba(31, 119, 73, 0.22), transparent 28%),
    linear-gradient(90deg, #130b05 0%, #38210c 43%, #123b2a 100%);
  border-bottom-color: rgba(238, 199, 104, 0.92);
  box-shadow:
    0 4px 20px rgba(23, 13, 5, 0.44),
    inset 0 -1px 0 rgba(255, 239, 184, 0.18);
}

.theme-mana .site-header .container {
  position: relative;
}

.theme-mana .db-nav a,
.theme-mana .db-nav button,
.theme-mana .theme-switcher a {
  background:
    linear-gradient(180deg, rgba(78, 52, 23, 0.98), rgba(33, 22, 12, 0.98));
  border-color: rgba(211, 171, 82, 0.56);
  box-shadow:
    inset 0 1px 0 rgba(255, 240, 183, 0.14),
    0 1px 0 rgba(0, 0, 0, 0.16);
}

.theme-mana .db-nav a:hover,
.theme-mana .db-nav a[aria-current="page"],
.theme-mana .db-nav button:hover,
.theme-mana .theme-switcher a:hover,
.theme-mana .theme-switcher a[aria-current="true"] {
  background:
    radial-gradient(circle at 50% 0%, rgba(255, 251, 222, 0.6), transparent 42%),
    linear-gradient(180deg, #f0d58d, #b9822b 72%, #5d3d13);
  border-color: rgba(255, 236, 166, 0.95);
  color: #1d1106;
  text-shadow: 0 1px 0 rgba(255, 248, 219, 0.35);
}

.theme-mana .deck-gallery-panel,
.theme-mana .deck-builder-section {
  border-color: rgba(133, 91, 34, 0.84);
  box-shadow:
    0 11px 24px rgba(28, 14, 4, 0.17),
    0 0 0 1px rgba(255, 236, 166, 0.2),
    inset 0 0 0 1px rgba(70, 41, 14, 0.16);
}

.theme-mana .deck-gallery-panel-head,
.theme-mana .deck-builder-section-header {
  background:
    linear-gradient(180deg, rgba(255, 238, 180, 0.36), rgba(124, 85, 31, 0.12));
  border-bottom-color: rgba(130, 86, 30, 0.46);
  padding-bottom: 5px;
  padding-top: 5px;
}

.theme-mana .deck-grid-body,
.theme-mana .deck-builder-grid {
  background:
    radial-gradient(ellipse at 40% 32%, rgba(255, 238, 176, 0.34), transparent 34%),
    radial-gradient(circle at 4% 8%, rgba(255, 251, 222, 0.14), transparent 18%),
    radial-gradient(circle at 100% 82%, rgba(18, 78, 49, 0.34), transparent 38%),
    radial-gradient(circle at 2% 100%, rgba(61, 32, 9, 0.34), transparent 42%),
    linear-gradient(145deg, rgba(205, 160, 80, 0.8), rgba(118, 80, 30, 0.7)),
    repeating-linear-gradient(24deg, rgba(63, 37, 11, 0.08) 0 1px, transparent 1px 7px),
    repeating-linear-gradient(96deg, rgba(255, 247, 208, 0.045) 0 1px, transparent 1px 13px);
  box-shadow:
    inset 0 0 0 1px rgba(255, 236, 166, 0.16),
    inset 0 0 36px rgba(40, 24, 8, 0.28),
    inset 0 0 112px rgba(18, 64, 40, 0.24);
}

.theme-mana .deck-grid-body {
  padding: 1px 2px 2px;
}

.theme-mana .deck-builder-grid {
  padding-bottom: 3px;
  padding-top: 3px;
}

.theme-mana .deck-grid-body::before,
.theme-mana .deck-builder-grid::before {
  background:
    radial-gradient(circle at 30% 14%, rgba(255, 252, 224, 0.2), transparent 20%),
    radial-gradient(circle at 78% 88%, rgba(75, 42, 10, 0.18), transparent 26%),
    linear-gradient(90deg, rgba(45, 24, 7, 0.14), transparent 18%, transparent 82%, rgba(22, 64, 41, 0.14)),
    repeating-linear-gradient(18deg, rgba(61, 34, 9, 0.052) 0 1px, transparent 1px 10px);
  opacity: 0.44;
}

.theme-mana .deck-image-grid-continuous,
.theme-mana .deck-builder-card-grid {
  gap: 5px;
}

.theme-mana .deck-gallery-alert,
.theme-mana .deck-builder-warning,
.theme-mana .form-errors,
.theme-mana .errorlist {
  background:
    radial-gradient(circle at 15% 0%, rgba(255, 250, 220, 0.36), transparent 24%),
    linear-gradient(135deg, rgba(247, 224, 154, 0.94), rgba(185, 125, 43, 0.74)),
    repeating-linear-gradient(105deg, rgba(78, 47, 14, 0.055) 0 1px, transparent 1px 8px);
  border-color: rgba(130, 78, 21, 0.82);
  box-shadow:
    inset 0 0 0 1px rgba(255, 246, 205, 0.3),
    0 6px 14px rgba(28, 13, 3, 0.13);
  padding: 6px 8px;
}

.theme-mana .deck-gallery-alert {
  border-left-width: 3px;
}

.theme-mana .deck-gallery-alert-body,
.theme-mana .deck-builder-warning {
  font-size: 11px;
  gap: 5px;
  line-height: 1.35;
}

.theme-mana .builder-card-menu {
  padding: 5px;
}

.theme-mana .builder-menu-link,
.theme-mana .builder-mini-button {
  min-height: 25px;
}

/* Premium pass: cohesive fantasy-card-game surfaces. */
:root {
  --theme-bg: #140d07;
  --theme-bg-layer:
    radial-gradient(circle at 12% 6%, rgba(246, 226, 155, 0.18), transparent 23%),
    radial-gradient(circle at 74% 14%, rgba(38, 122, 72, 0.18), transparent 28%),
    radial-gradient(circle at 20% 88%, rgba(190, 115, 37, 0.14), transparent 34%),
    radial-gradient(circle at 94% 80%, rgba(33, 94, 58, 0.22), transparent 34%);
  --theme-surface: rgba(247, 229, 180, 0.94);
  --theme-surface-strong: rgba(83, 52, 19, 0.96);
  --theme-surface-soft: rgba(255, 246, 216, 0.9);
  --theme-border: rgba(126, 78, 23, 0.74);
  --theme-border-strong: rgba(229, 196, 109, 0.82);
  --theme-accent: #d9ac45;
  --theme-accent-2: #2e8052;
  --theme-accent-3: #8c431e;
  --theme-text: #241407;
  --theme-muted: #73512a;
  --theme-glow: 0 0 18px rgba(232, 200, 120, 0.35), 0 0 34px rgba(47, 107, 63, 0.18);
  --theme-glow-soft: 0 0 14px rgba(232, 200, 120, 0.2);
  --theme-card-frame: #050302;
  --theme-card-shadow: 0 6px 14px rgba(18, 8, 2, 0.42), 0 0 0 1px rgba(232, 200, 120, 0.18);
  --theme-button-bg: linear-gradient(180deg, rgba(91, 61, 25, 0.94), rgba(31, 66, 43, 0.94));
  --theme-button-border: rgba(207, 165, 73, 0.68);
  --theme-button-hover: linear-gradient(180deg, rgba(198, 147, 50, 0.98), rgba(42, 109, 61, 0.98));
  --theme-warning-bg: rgba(241, 217, 151, 0.96);
  --theme-success-bg: rgba(219, 241, 198, 0.95);
  --theme-danger-bg: rgba(244, 194, 166, 0.95);
  --theme-input-bg: rgba(255, 250, 225, 0.98);
  --theme-input-border: rgba(111, 70, 22, 0.68);
  --mana-premium-board:
    radial-gradient(ellipse at 50% 28%, rgba(255, 246, 194, 0.25), transparent 27%),
    radial-gradient(circle at 10% 12%, rgba(255, 251, 225, 0.2), transparent 20%),
    radial-gradient(circle at 90% 86%, rgba(41, 88, 48, 0.26), transparent 31%),
    linear-gradient(90deg, rgba(63, 35, 11, 0.24), transparent 14%, transparent 86%, rgba(38, 82, 47, 0.22)),
    linear-gradient(145deg, rgba(232, 198, 124, 0.86), rgba(170, 115, 43, 0.76) 54%, rgba(87, 54, 20, 0.7)),
    repeating-linear-gradient(18deg, rgba(68, 38, 13, 0.052) 0 1px, transparent 1px 8px),
    repeating-linear-gradient(104deg, rgba(255, 248, 211, 0.055) 0 1px, transparent 1px 13px);
  --mana-premium-parchment:
    radial-gradient(circle at 12% 4%, rgba(255, 253, 225, 0.42), transparent 20%),
    radial-gradient(circle at 86% 96%, rgba(98, 61, 19, 0.14), transparent 26%),
    linear-gradient(145deg, rgba(251, 238, 197, 0.96), rgba(220, 183, 108, 0.86)),
    repeating-linear-gradient(28deg, rgba(90, 53, 17, 0.045) 0 1px, transparent 1px 9px);
}

body.theme-mana {
  background:
    var(--theme-bg-layer),
    linear-gradient(135deg, #0d0906 0%, #28180b 33%, #122916 67%, #241108 100%);
}

body.theme-mana::after {
  background:
    radial-gradient(ellipse at 50% -10%, rgba(255, 225, 146, 0.14), transparent 36%),
    radial-gradient(ellipse at 50% 110%, rgba(22, 78, 48, 0.22), transparent 42%),
    repeating-linear-gradient(115deg, rgba(255, 237, 168, 0.032) 0 1px, transparent 1px 18px);
  content: "";
  inset: 0;
  opacity: 0.72;
  pointer-events: none;
  position: fixed;
  z-index: -1;
}

.theme-mana .site-header {
  background:
    radial-gradient(circle at 8% 0%, rgba(255, 231, 156, 0.2), transparent 28%),
    radial-gradient(circle at 88% 0%, rgba(48, 130, 75, 0.19), transparent 30%),
    linear-gradient(90deg, rgba(13, 8, 5, 0.98), rgba(82, 47, 17, 0.96) 42%, rgba(13, 55, 36, 0.97));
  border-bottom: 1px solid rgba(232, 200, 120, 0.72);
  box-shadow:
    inset 0 -1px 0 rgba(255, 244, 192, 0.12),
    0 6px 0 rgba(41, 23, 7, 0.72),
    0 18px 46px rgba(10, 5, 2, 0.42);
}

.theme-mana .db-nav a,
.theme-mana .db-nav button,
.theme-mana .theme-switcher a {
  background:
    linear-gradient(180deg, rgba(79, 52, 23, 0.92), rgba(30, 19, 9, 0.96)),
    radial-gradient(circle at 50% 0%, rgba(255, 226, 145, 0.18), transparent 60%);
  border-color: rgba(232, 200, 120, 0.5);
  box-shadow:
    inset 0 1px 0 rgba(255, 244, 196, 0.16),
    0 1px 0 rgba(0, 0, 0, 0.4);
}

.theme-mana .db-nav a:hover,
.theme-mana .db-nav a[aria-current="page"],
.theme-mana .db-nav button:hover,
.theme-mana .theme-switcher a:hover,
.theme-mana .theme-switcher a[aria-current="true"] {
  background:
    linear-gradient(180deg, rgba(180, 128, 48, 0.95), rgba(42, 97, 55, 0.95)),
    radial-gradient(circle at 50% 0%, rgba(255, 246, 198, 0.28), transparent 58%);
  border-color: rgba(255, 235, 158, 0.86);
  color: #fff8d8;
  box-shadow: var(--theme-glow);
}

.theme-mana .db-panel,
.theme-mana .card-search-panel,
.theme-mana .quick-filter-panel,
.theme-mana .detail-panel,
.theme-mana .deck-detail-actions-panel,
.theme-mana .deck-builder-search,
.theme-mana .builder-quick-filter-panel,
.theme-mana .builder-detail-search,
.theme-mana .deck-builder-legality,
.theme-mana .deck-builder-import-panel,
.theme-mana .deck-description-panel,
.theme-mana .archive-table-row,
.theme-mana .my-deck-card {
  background: var(--mana-premium-parchment);
  border-color: var(--theme-border);
  box-shadow:
    inset 0 0 0 1px rgba(255, 250, 211, 0.22),
    inset 0 0 30px rgba(92, 55, 18, 0.09),
    0 12px 30px rgba(17, 9, 3, 0.19);
}

.theme-mana .db-panel-head,
.theme-mana .deck-gallery-panel-head,
.theme-mana .detail-summary,
.theme-mana .builder-detail-search .detail-summary,
.theme-mana .db-subhead {
  background:
    linear-gradient(180deg, rgba(94, 61, 25, 0.95), rgba(35, 72, 44, 0.94)),
    radial-gradient(circle at 12% 0%, rgba(255, 229, 146, 0.24), transparent 34%);
  border-color: rgba(232, 200, 120, 0.46);
  color: #fff4cc;
  text-shadow: 0 1px 0 rgba(26, 12, 4, 0.65);
}

.theme-mana .db-input,
.theme-mana .db-select,
.theme-mana select.db-input,
.theme-mana textarea.db-input,
.theme-mana .deck-copy-fallback,
.theme-mana .pagination-page-input {
  background: linear-gradient(180deg, rgba(255, 250, 225, 0.98), rgba(239, 216, 157, 0.96));
  border-color: var(--theme-input-border);
  box-shadow: inset 0 2px 5px rgba(71, 43, 14, 0.12);
  color: var(--theme-text);
}

.theme-mana .db-input:focus,
.theme-mana .db-select:focus,
.theme-mana textarea.db-input:focus {
  border-color: var(--theme-border-strong);
  box-shadow: 0 0 0 2px rgba(232, 200, 120, 0.28), inset 0 2px 5px rgba(71, 43, 14, 0.12);
}

.theme-mana .quick-tabs,
.theme-mana .active-filter-bar {
  background:
    linear-gradient(180deg, rgba(86, 55, 21, 0.88), rgba(42, 85, 50, 0.76)),
    radial-gradient(circle at 15% 0%, rgba(255, 235, 156, 0.18), transparent 36%);
  border-color: rgba(232, 200, 120, 0.42);
}

.theme-mana .quick-tab,
.theme-mana .segmented-button,
.theme-mana .view-toggle-link,
.theme-mana .pagination-link,
.theme-mana .pagination-current,
.theme-mana .db-button,
.theme-mana .db-button-secondary,
.theme-mana .active-filter-chip,
.theme-mana .active-filter-reset,
.theme-mana .deck-builder-search-actions .db-button {
  background: var(--theme-button-bg);
  border-color: var(--theme-button-border);
  color: #fff4cc;
  box-shadow:
    inset 0 1px 0 rgba(255, 250, 210, 0.16),
    0 5px 12px rgba(29, 14, 5, 0.16);
}

.theme-mana .quick-tab:hover,
.theme-mana .quick-tab-active,
.theme-mana .segmented-button:hover,
.theme-mana .segmented-button-active,
.theme-mana .view-toggle-link:hover,
.theme-mana .view-toggle-link[aria-current="true"],
.theme-mana .pagination-current,
.theme-mana .db-button:hover,
.theme-mana .db-button-secondary:hover,
.theme-mana .active-filter-reset:hover {
  background: var(--theme-button-hover);
  border-color: rgba(255, 239, 171, 0.9);
  color: #fffbe7;
  box-shadow: var(--theme-glow);
}

.theme-mana .quick-filter-button-color,
.theme-mana .builder-quick-filter-color {
  border-radius: 999px;
  box-shadow: none;
  padding: 2px;
}

.theme-mana .quick-filter-button-color .mana-pip,
.theme-mana .builder-quick-filter-color .mana-pip {
  border-color: rgba(255, 231, 152, 0.72);
  box-shadow:
    inset 0 2px 3px rgba(255, 255, 255, 0.62),
    inset 0 -3px 5px rgba(0, 0, 0, 0.32),
    0 0 0 2px rgba(58, 34, 10, 0.7),
    0 0 0 3px rgba(232, 200, 120, 0.28),
    0 4px 9px rgba(20, 9, 2, 0.28);
}

.theme-mana .quick-filter-button-color:hover .mana-pip,
.theme-mana .quick-filter-button-color.quick-filter-button-active .mana-pip,
.theme-mana .builder-quick-filter-color:hover .mana-pip,
.theme-mana .builder-quick-filter-color.is-active .mana-pip {
  box-shadow:
    inset 0 2px 3px rgba(255, 255, 255, 0.7),
    inset 0 -3px 5px rgba(0, 0, 0, 0.34),
    0 0 0 2px rgba(255, 247, 199, 0.9),
    0 0 0 4px rgba(232, 200, 120, 0.34),
    0 0 16px rgba(232, 200, 120, 0.46),
    0 0 24px rgba(42, 109, 61, 0.22);
  transform: translateY(-1px);
}

.theme-mana .quick-filter-button-type,
.theme-mana .builder-quick-filter-type {
  background:
    linear-gradient(180deg, rgba(248, 229, 177, 0.94), rgba(181, 131, 55, 0.78)),
    repeating-linear-gradient(90deg, rgba(65, 38, 12, 0.05) 0 1px, transparent 1px 7px);
  border-color: rgba(111, 70, 22, 0.72);
  border-radius: 7px;
  color: #2b1606;
  box-shadow:
    inset 0 1px 0 rgba(255, 250, 210, 0.42),
    inset 0 -6px 12px rgba(76, 42, 12, 0.08);
}

.theme-mana .quick-filter-button-type:hover,
.theme-mana .quick-filter-button-type.quick-filter-button-active,
.theme-mana .builder-quick-filter-type:hover,
.theme-mana .builder-quick-filter-type.is-active {
  background:
    linear-gradient(180deg, rgba(60, 118, 65, 0.98), rgba(30, 70, 43, 0.98)),
    radial-gradient(circle at 50% 0%, rgba(255, 231, 150, 0.24), transparent 60%);
  border-color: rgba(255, 233, 153, 0.82);
  color: #fff4cc;
  box-shadow: var(--theme-glow);
}

.theme-mana .type-filter-icon {
  filter: drop-shadow(0 1px 0 rgba(255, 240, 180, 0.35));
}

.theme-mana .card-image-link,
.theme-mana .deck-card-art-link,
.theme-mana .builder-card-art,
.theme-mana .builder-deck-art,
.theme-mana .deck-gallery-mini-card,
.theme-mana .deck-hero-card {
  border-color: var(--theme-card-frame);
  box-shadow: var(--theme-card-shadow);
}

@media (max-width: 640px) {
  .theme-mana .quick-filter-row-color {
    gap: 2px;
    grid-template-columns: 30px minmax(0, 1fr);
  }

  .theme-mana .quick-filter-buttons-color {
    gap: 0;
    justify-content: flex-start;
    overflow-x: visible;
    padding-bottom: 0;
    scrollbar-width: none;
  }

  .theme-mana .quick-filter-buttons-color::-webkit-scrollbar {
    display: none;
  }

  .theme-mana .quick-filter-button-color {
    flex: 0 0 32px;
    height: 32px;
    min-height: 32px;
    min-width: 32px;
    padding: 1px;
    width: 32px;
  }

  .theme-mana .quick-filter-button-color .mana-pip {
    height: 28px;
    width: 28px;
  }
}

.theme-mana .card-image-card:hover .card-image-link,
.theme-mana .deck-image-card-gallery:hover .deck-card-art-link,
.theme-mana .builder-card-result:hover .builder-card-art,
.theme-mana .builder-deck-card:hover .builder-deck-art,
.theme-mana .deck-gallery-mini-card:hover {
  box-shadow:
    0 0 0 1px rgba(255, 239, 170, 0.45),
    0 0 20px rgba(232, 200, 120, 0.28),
    0 0 32px rgba(41, 101, 58, 0.18),
    0 8px 18px rgba(15, 8, 2, 0.45);
}

.theme-mana .deck-gallery-panel,
.theme-mana .deck-builder-section {
  background: linear-gradient(180deg, rgba(68, 43, 15, 0.94), rgba(24, 58, 36, 0.9));
  border-color: rgba(215, 177, 91, 0.72);
  box-shadow:
    inset 0 0 0 1px rgba(255, 238, 166, 0.14),
    0 18px 42px rgba(15, 7, 2, 0.3);
}

.theme-mana .deck-grid-body,
.theme-mana .deck-builder-grid,
.theme-mana .deck-builder-results,
.theme-mana .card-image-grid {
  background: var(--mana-premium-board);
  box-shadow:
    inset 0 0 0 1px rgba(255, 243, 190, 0.16),
    inset 0 0 34px rgba(51, 28, 8, 0.28),
    inset 0 0 95px rgba(27, 78, 47, 0.16);
}

.theme-mana .deck-grid-body,
.theme-mana .deck-builder-grid {
  padding: 2px;
}

.theme-mana .deck-image-grid-continuous,
.theme-mana .deck-builder-card-grid {
  gap: 4px;
}

.theme-mana .deck-hero-gallery,
.theme-mana .deck-gallery-card {
  background:
    radial-gradient(circle at 72% 14%, rgba(232, 200, 120, 0.22), transparent 34%),
    radial-gradient(circle at 9% 100%, rgba(38, 112, 66, 0.2), transparent 34%),
    linear-gradient(135deg, rgba(25, 13, 7, 0.95), rgba(22, 61, 39, 0.9));
  border-color: rgba(232, 200, 120, 0.52);
}

.theme-mana .deck-mana-curve {
  background: linear-gradient(180deg, rgba(23, 55, 36, 0.88), rgba(28, 17, 9, 0.9));
  border-color: rgba(232, 200, 120, 0.42);
}

.theme-mana .deck-curve-bar {
  background: linear-gradient(180deg, #fff2b5, #d59d35 58%, #2f7a4d);
  box-shadow: 0 0 10px rgba(232, 200, 120, 0.38);
}

.theme-mana .deck-quantity-badge {
  background: linear-gradient(180deg, #1f1308, #050302);
  border-color: rgba(255, 246, 205, 0.9);
  box-shadow:
    0 0 0 1px rgba(50, 26, 7, 0.75),
    0 0 12px rgba(232, 200, 120, 0.3);
}

.theme-mana .builder-card-menu {
  background:
    radial-gradient(circle at 20% 0%, rgba(255, 247, 202, 0.22), transparent 28%),
    linear-gradient(145deg, rgba(52, 31, 12, 0.98), rgba(18, 48, 32, 0.98));
  border-color: rgba(232, 200, 120, 0.7);
  box-shadow:
    inset 0 0 0 1px rgba(255, 242, 190, 0.1),
    0 16px 32px rgba(13, 6, 2, 0.42),
    0 0 22px rgba(232, 200, 120, 0.16);
}

.theme-mana .builder-menu-link,
.theme-mana .builder-mini-button {
  background: linear-gradient(180deg, rgba(241, 216, 151, 0.96), rgba(162, 108, 39, 0.94));
  border-color: rgba(87, 52, 15, 0.74);
  color: #241407;
}

.theme-mana .builder-menu-link:hover,
.theme-mana .builder-mini-button:hover {
  background: linear-gradient(180deg, rgba(59, 118, 65, 0.98), rgba(24, 62, 39, 0.98));
  border-color: rgba(255, 239, 171, 0.82);
  color: #fff4cc;
}

.theme-mana .deck-gallery-alert,
.theme-mana .deck-builder-warning,
.theme-mana .form-errors,
.theme-mana .errorlist,
.theme-mana .messages,
.theme-mana .message {
  background:
    radial-gradient(circle at 15% 0%, rgba(255, 250, 220, 0.38), transparent 24%),
    linear-gradient(135deg, rgba(241, 217, 151, 0.96), rgba(176, 115, 38, 0.78)),
    repeating-linear-gradient(105deg, rgba(78, 47, 14, 0.055) 0 1px, transparent 1px 8px);
  border-color: rgba(126, 73, 18, 0.82);
  color: #2e1706;
}

.theme-mana .deck-copy-feedback {
  color: #225f3d;
  text-shadow: 0 1px 0 rgba(255, 244, 190, 0.5);
}

@media (max-width: 700px) {
  .theme-mana .deck-grid-body,
  .theme-mana .deck-builder-grid,
  .theme-mana .deck-builder-results,
  .theme-mana .card-image-grid {
    background-attachment: local;
  }
}
