/* Magic theme: candle-lit arcane library. Deep night surfaces, gilded
   edges, Cinzel capitals over EB Garamond text, the five colours of mana. */
:root {
  --bg: #0f0b14;
  --bg2: #1c1424;
  --ink: #f2eadb;
  --muted: #bcae97;
  --surface: rgba(24, 18, 30, 0.78);
  --toggle-bg: rgba(24, 18, 30, 0.7);
  --surface-solid: #18121f;
  --edge: rgba(217, 164, 65, 0.28);
  --line: rgba(242, 234, 219, 0.1);
  --accent: #d9a441;
  --accent-2: #7aa7d9;
  --accent-ink: #1a1208;
  --display: "Cinzel", "Times New Roman", serif;
  --sans: "EB Garamond", Georgia, serif;
  --shadow: 0 22px 50px rgba(0, 0, 0, 0.55);
  --shadow-soft: 0 10px 26px rgba(0, 0, 0, 0.35);
  --veil: radial-gradient(120% 90% at 50% 30%, rgba(15, 11, 20, 0.05), rgba(15, 11, 20, 0.55) 70%, rgba(15, 11, 20, 0.85));
  --gild: linear-gradient(135deg, #8a6420, #f0d48a 30%, #b07d2a 50%, #f6e2a6 70%, #8a6420);
  --card-back: radial-gradient(ellipse at 50% 50%, #c08a3a 0 22%, transparent 23%), radial-gradient(ellipse at 50% 50%, #3b2412 0 46%, #6b4423 47%);
  color-scheme: dark;
}
body { font-size: 18.5px; letter-spacing: 0.005em; }
h1, h2, h3, h4 { font-weight: 600; letter-spacing: 0.02em; }
h1 { font-weight: 700; text-shadow: 0 2px 18px rgba(0, 0, 0, 0.6); }
.kicker, .focus-kicker, .meta-row dt, .fact-grid dt, .zone-label, .field span, .search-group, .switcher-head { font-family: var(--display); letter-spacing: 0.16em; }
.btn, .chip-btn, .topnav a, .tabs button, .scope-toggle a, .crumbs a { font-family: var(--display); letter-spacing: 0.06em; font-size: 0.86rem; }
.field input[type="search"], .field select { font-family: var(--sans); font-size: 1.02rem; }
.scene { background: radial-gradient(100% 70% at 50% 0%, #2a1d3a, #0f0b14 70%); }
.scene::after { content: ""; position: absolute; inset: 0; opacity: 0.07; mix-blend-mode: overlay; background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='220' height='220'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='.7' numOctaves='3' stitchTiles='stitch'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>"); }

/* Gilded frames: the signature border of this theme */
.gild, .set-hero, .focus-panel, .toolbar, .prose-block, .htp-win, .htp-type, .phase, .sources, .card-modal, .enc-card, .quick, .showcase-card {
  border: 1px solid transparent;
  background: linear-gradient(var(--surface), var(--surface)) padding-box, linear-gradient(135deg, rgba(240, 212, 138, 0.55), rgba(138, 100, 32, 0.25) 35%, rgba(240, 212, 138, 0.15) 65%, rgba(240, 212, 138, 0.55)) border-box;
}
.card-modal { background: linear-gradient(var(--surface-solid), var(--surface-solid)) padding-box, var(--gild) border-box; border: 1.5px solid transparent; }
.set-hero::before, .prose-block::before, .focus-panel::before { content: ""; position: absolute; inset: 6px; border: 1px solid rgba(217, 164, 65, 0.14); border-radius: calc(var(--r-lg) - 6px); pointer-events: none; }
.set-hero, .prose-block, .focus-panel { position: relative; }
.btn-primary { background: var(--gild); color: var(--accent-ink); box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.4) inset, 0 8px 24px rgba(217, 164, 65, 0.3); text-shadow: 0 1px 0 rgba(255, 240, 200, 0.6); }
.btn-ghost, .chip-btn, .search-toggle, .switcher-btn { background: rgba(24, 18, 30, 0.82); border-color: rgba(217, 164, 65, 0.35); }
.brand-game { background: transparent; color: var(--accent); border: 1px solid rgba(217, 164, 65, 0.5); font-family: var(--display); letter-spacing: 0.08em; font-size: 0.78rem; }
.topbar { background: linear-gradient(180deg, rgba(15, 11, 20, 0.85), rgba(15, 11, 20, 0.35)); }
.topbar.is-scrolled { background: rgba(15, 11, 20, 0.88); box-shadow: 0 1px 0 rgba(217, 164, 65, 0.25); }
.tabs button[aria-selected="true"], .scope-toggle a[aria-selected="true"], .mode-switch a[aria-current] { background: var(--gild); color: var(--accent-ink); }
.tl-headline { font-weight: 700; }

/* Mana pips: original, drawn in CSS */
.pip { display: inline-grid; place-items: center; width: 1.25em; height: 1.25em; border-radius: 50%; font: 700 0.68em/1 var(--display), sans-serif; font-style: normal; color: #1a1208; background: #cac5c0; box-shadow: inset 0 -1px 0 rgba(0, 0, 0, 0.35), 0 1px 1px rgba(0, 0, 0, 0.4); margin: 0 1px; vertical-align: -0.15em; }
.pip-w { background: radial-gradient(circle at 35% 30%, #fffdf2, #f0e2b0); }
.pip-u { background: radial-gradient(circle at 35% 30%, #c9e8ff, #4fa3e0); }
.pip-b { background: radial-gradient(circle at 35% 30%, #bba7c4, #4b3a52); color: #f0e6ff; }
.pip-r { background: radial-gradient(circle at 35% 30%, #ffb59e, #e4553b); }
.pip-g { background: radial-gradient(circle at 35% 30%, #b8eab0, #3ea05a); }
.pip-c, .pip-x, .pip-t, .pip-q, .pip-s { background: radial-gradient(circle at 35% 30%, #f1f1f1, #b9c2cc); }
.pip-t { font-size: 0.6em; }
[class*="pip-w"][class*="u"], .pip-wu, .pip-wb, .pip-ub, .pip-ur, .pip-br, .pip-bg, .pip-rg, .pip-rw, .pip-gw, .pip-gu { background: conic-gradient(#f0e2b0 0 50%, #4fa3e0 50%); }
.ci { display: inline-flex; gap: 1px; margin-top: 4px; }
.mana-line .pip { width: 1.4em; height: 1.4em; font-size: 0.82em; }
.mtg-face { padding: 12px 16px; margin: 10px 0; border-radius: 12px; background: rgba(242, 234, 219, 0.05); border: 1px solid rgba(217, 164, 65, 0.18); }
.mtg-name { display: flex; justify-content: space-between; gap: 10px; align-items: baseline; margin: 0 0 4px; font-size: 1.15rem; }
.mtg-type { font-family: var(--display); font-size: 0.86rem; letter-spacing: 0.05em; color: var(--accent); margin: 0 0 8px; }
.oracle p { margin: 0 0 6px; }
.pt { text-align: right; font-family: var(--display); margin: 0; }
.enc-links .chip { text-decoration: none; }
.enc-links .chip:hover { border-color: var(--accent); color: var(--accent); }

/* Card tiles: dark velvet; the effect becomes an aura around the art so the
   card image itself (and its artist and copyright line) stays untouched. */
.card-tile { background: rgba(20, 15, 26, 0.86); border-color: rgba(217, 164, 65, 0.22); }
.card-tile .card-img { border-radius: 4.75% / 3.5%; background: #0a0710; }
.card-tile::after { top: calc(var(--pad) - 6px); left: calc(var(--pad) - 6px); right: calc(var(--pad) - 6px); z-index: 0; border-radius: 14px; filter: blur(3px); }
.card-tile.is-lit::after { opacity: 0.95; }
.card-tile .card-img { z-index: 1; }
.card-tile.is-lit { border-color: color-mix(in srgb, var(--tc) 60%, #d9a441); }
.card-tile.is-lit::before { opacity: calc(0.18 + var(--far, 0) * 0.18); }
.is-lit[data-foil]::before { opacity: calc(0.14 + var(--far, 0) * 0.14); }
.cm-card .card-img::after { inset: -14px; z-index: -1; border-radius: 22px; filter: blur(6px); opacity: 0.85; }
.cm-card .card-img { overflow: visible; }
.cm-card .card-img img { border-radius: 4.75% / 3.5%; position: relative; z-index: 1; }
.cm-card .card-img::before { z-index: 2; border-radius: 4.75% / 3.5%; }
.cm-card.is-flipped { animation: flip 0.6s var(--ease); }
@keyframes flip { 50% { transform: perspective(1100px) rotateY(90deg); } }
.cm-stage { background: radial-gradient(circle at 50% 45%, color-mix(in srgb, var(--tc) 30%, transparent), transparent 70%), radial-gradient(120% 100% at 50% 0%, #241a2e, #0f0b14); }

/* Timeline plaques (original design, no publisher logos) */
.mtg-pack { width: 230px; }
.plaque { position: relative; display: grid; grid-template-rows: 150px auto auto auto; justify-items: center; gap: 6px; padding: 12px 12px 14px; border-radius: 16px; text-align: center; background: linear-gradient(#17111e, #0f0b14) padding-box, var(--gild) border-box; border: 2px solid transparent; box-shadow: var(--shadow); }
.plaque-art { width: 100%; height: 150px; border-radius: 10px; overflow: hidden; background: #241a2e; box-shadow: inset 0 0 0 1px rgba(240, 212, 138, 0.3); }
.plaque-art img { width: 100%; height: 100%; object-fit: cover; }
.plaque .plaque-icon { margin-top: -38px; width: 58px; height: 58px; border-radius: 50%; display: grid; place-items: center; background: radial-gradient(circle, #f6efe0, #d9c9a6); box-shadow: 0 0 0 3px #17111e, 0 0 0 5px #d9a441; }
.plaque .plaque-icon img { width: 34px; height: 34px; object-fit: contain; }
.plaque-name { font-family: var(--display); font-size: 1rem; line-height: 1.15; min-height: 2.3em; display: grid; place-items: center; }
.plaque-year { font-style: normal; color: var(--accent); font-family: var(--display); font-size: 0.9rem; letter-spacing: 0.1em; }
.plaque-credit { font-size: 0.66rem; color: var(--muted); }
.is-upcoming .plaque { filter: saturate(0.7); }
.is-upcoming .plaque-year { color: var(--accent-2); }
.mtg-chapter { background: linear-gradient(#17111e, #0f0b14) padding-box, var(--gild) border-box; border: 2px solid transparent; width: 200px; }
.mtg-chapter .chapter-year { font-size: 2.6rem; font-family: var(--display); color: transparent; background: var(--gild); -webkit-background-clip: text; background-clip: text; }
.mtg-chapter strong { font-size: 0.86rem; letter-spacing: 0.12em; text-transform: uppercase; color: var(--accent); }
.mtg-chapter em { font-size: 0.92rem; color: var(--ink); }
.skel-pack { width: 70px; height: 70px; border-radius: 50%; background: conic-gradient(#f0e2b0 0 20%, #4fa3e0 20% 40%, #4b3a52 40% 60%, #e4553b 60% 80%, #3ea05a 80%); animation: spin 1.6s linear infinite; mask: radial-gradient(circle, transparent 42%, #000 44%); -webkit-mask: radial-gradient(circle, transparent 42%, #000 44%); }
@keyframes spin { to { transform: rotate(360deg); } }

/* Set page hero plaque */
.mtg-plaque { position: relative; display: grid; justify-items: center; gap: 8px; }
.mtg-plaque .plaque-art { height: auto; aspect-ratio: 626 / 457; max-width: 320px; border-radius: 14px; border: 2px solid transparent; background: linear-gradient(#0f0b14, #0f0b14) padding-box, var(--gild) border-box; }
.mtg-plaque .plaque-art img { animation: none; filter: none; max-height: none; }
.mtg-plaque .plaque-icon { margin-top: -50px; width: 84px; height: 84px; padding: 16px; border-radius: 50%; background: radial-gradient(circle, #f6efe0, #d9c9a6); box-shadow: 0 0 0 4px #17111e, 0 0 0 6px #d9a441, 0 10px 30px rgba(0, 0, 0, 0.5); animation: none; filter: none; }
.mtg-plaque .plaque-credit { text-align: center; }
.mtg-set .set-hero { grid-template-columns: minmax(200px, 340px) 1fr; }
@media (max-width: 640px) { .mtg-set .set-hero { grid-template-columns: minmax(0, 1fr); } .mtg-plaque .plaque-art { width: min(100%, 320px); } .scope-toggle a { font-size: min(0.86rem, 2.9vw); letter-spacing: 0.04em; } }

/* Battle: creature art in gilded medallions */
.mtg-battle .bt-fig { border-radius: 50%; overflow: hidden; border: 3px solid transparent; background: linear-gradient(#0f0b14, #0f0b14) padding-box, var(--gild) border-box; box-shadow: 0 0 30px color-mix(in srgb, var(--fc) 50%, transparent); }
.mtg-battle .bt-fig img { object-fit: cover; animation: none; filter: none; }
.mtg-battle .bt-right .bt-fig img { transform: none; }
.mtg-battle .bt-fx { inset: 0; }
.battle { background: radial-gradient(120% 90% at 50% 120%, rgba(217, 164, 65, 0.22), transparent 60%), rgba(20, 15, 26, 0.75); }

/* Encyclopedia */
.enc-tabs { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 22px; }
.enc-tabs a { text-decoration: none; padding: 7px 14px; border-radius: 999px; border: 1px solid rgba(217, 164, 65, 0.35); font-family: var(--display); font-size: 0.84rem; letter-spacing: 0.06em; }
.enc-tabs a[aria-current] { background: var(--gild); color: var(--accent-ink); }
.enc-sec { margin-top: 34px; }
.enc-card strong { font-family: var(--display); font-size: 0.98rem; letter-spacing: 0.02em; }
.plane-mini { display: block; aspect-ratio: 16 / 9; border-radius: 10px; overflow: hidden; background: #1c1424; }
.plane-mini svg { width: 100%; height: 100%; display: block; }
.planes-grid { grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); }
.pip-btn { display: inline-flex; gap: 6px; align-items: center; padding: 5px 12px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); opacity: 0.6; }
.pip-btn[aria-pressed="true"] { opacity: 1; border-color: var(--accent); }
.entry-hero { display: grid; grid-template-columns: minmax(200px, 380px) 1fr; gap: 28px; align-items: center; margin-bottom: 8px; }
.entry-art { margin: 0; }
.entry-art img { width: 100%; border-radius: 14px; border: 2px solid transparent; background: linear-gradient(#0f0b14, #0f0b14) padding-box, var(--gild) border-box; }
.plane-card-img { aspect-ratio: 88 / 63; }
.power-nine { grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); }

/* How to play */
.mana-wheel { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; }
.mana-c { display: grid; justify-items: start; gap: 4px; padding: 16px; border-radius: var(--r-md); background: var(--surface); border: 1px solid var(--line); transition: transform 0.3s var(--ease); }
.mana-c:hover { transform: translateY(-4px); }
.mana-c .pip { width: 2.4em; height: 2.4em; font-size: 1rem; }
.mana-c span { color: var(--muted); font-size: 0.95rem; }
.c-w { box-shadow: inset 0 3px 0 #f0e2b0; } .c-u { box-shadow: inset 0 3px 0 #4fa3e0; } .c-b { box-shadow: inset 0 3px 0 #7a5c8a; } .c-r { box-shadow: inset 0 3px 0 #e4553b; } .c-g { box-shadow: inset 0 3px 0 #3ea05a; }
.life-dial { width: 96px; height: 96px; border-radius: 50%; display: grid; place-items: center; background: radial-gradient(circle, #2a1d33, #0f0b14); border: 3px solid transparent; background-clip: padding-box; box-shadow: 0 0 0 3px #d9a441; }
.life-dial b { font-family: var(--display); font-size: 2rem; color: var(--accent); animation: life 4s ease-in-out infinite; }
@keyframes life { 0%, 40% { opacity: 1; } 50% { opacity: 0.3; } 60%, 100% { opacity: 1; } }
.bench i.tapped { transform: rotate(90deg); }
.lands i { background: #6b4423; }
.lands .land-w { background: linear-gradient(160deg, #fffbe8, #e8d9a8); } .lands .land-u { background: linear-gradient(160deg, #c9e8ff, #4fa3e0); } .lands .land-r { background: linear-gradient(160deg, #ffb59e, #c4402a); } .lands .land-g { background: linear-gradient(160deg, #b8eab0, #2f7f45); }
.slot-big .card-back { background: linear-gradient(160deg, #4b3a52, #241a2e); }
.mtg-types { grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); }
.type-glyph { font-size: 2rem; color: var(--accent); line-height: 1; }
.mtg-turn { grid-template-columns: repeat(5, 1fr); }
@media (max-width: 980px) { .mtg-turn { grid-template-columns: 1fr; } .entry-hero { grid-template-columns: 1fr; } }
.footer { background: rgba(12, 9, 16, 0.94); }
.mtg-battle.battle { height: clamp(260px, 30vw, 340px); }
.mtg-battle .bt-fig { width: clamp(96px, 13vw, 160px); }
.mtg-battle .bt-arena { align-items: center; }
