/* Budget Bauble. Carved stone panels on a mana-pattern table, gold lettering.
   Type is EB Garamond with Goudy Bookletter 1911 headings, both open-licensed and served from this directory.
   The ui-*.png files are low-resolution, so they are drawn pixelated. */
@font-face { font-family: "EB Garamond"; src: url("eb-garamond-400.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "EB Garamond"; src: url("eb-garamond-400-italic.woff2") format("woff2"); font-weight: 400; font-style: italic; font-display: swap; }
@font-face { font-family: "EB Garamond"; src: url("eb-garamond-700.woff2") format("woff2"); font-weight: 700; font-display: swap; }
@font-face { font-family: "Keyrune"; src: url("keyrune.woff2") format("woff2"); font-display: block; }
@font-face { font-family: "Goudy Bookletter 1911"; src: url("goudy-bookletter-1911-400.woff2") format("woff2"); font-weight: 400; font-display: swap; }
:root {
  --display: "Goudy Bookletter 1911", "EB Garamond", "Palatino Linotype", Palatino, Georgia, serif;
  --desk: #989894;
  --table: url("ui-table-w.png");
  --face: #2c2b2e;
  --paper: #0b0d0b;
  --hi: #86838c;
  --light: #5a5860;
  --shadow: #19181b;
  --dark: #000;
  --gold: #e3bd62;
  --gold-dim: #b3924a;
  --tip: #d9c692;
  --ink: #1d1608;
  --text: #e9dfc8;
  --muted: #a9a08c;
  --link: #9cc4f0;
  --rule: #4d5a48;
  --stone: #2a2030 url("ui-stone.png");
  --raised: inset -1px -1px var(--dark), inset 1px 1px var(--hi), inset -2px -2px var(--shadow), inset 2px 2px var(--light);
  --pressed: inset -1px -1px var(--light), inset 1px 1px var(--dark), inset -2px -2px var(--face), inset 2px 2px var(--shadow);
  --sunken: inset 0 0 0 1px var(--rule), inset 2px 2px 6px #000;
  --field: inset 0 0 0 1px var(--rule);
  --glyph-drop: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='18'%3E%3Cpath d='M4 7h10l-5 6z' fill='%23e3bd62'/%3E%3C/svg%3E");
  color-scheme: dark;
  font-family: "EB Garamond", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, serif;
  font-size: 17px;
  line-height: 1.5;
  color: var(--text);
  background: var(--desk);
}

* { box-sizing: border-box; }
body { margin: 0; padding-bottom: 64px; background: var(--desk) var(--table); }
/* The visitor's table tint; tint.js sets data-tint from the picker in the navigation bar. */
:root[data-tint="u"] { --desk: #676a71; --table: url("ui-table-u.png"); }
:root[data-tint="b"] { --desk: #63645f; --table: url("ui-table-b.png"); }
:root[data-tint="r"] { --desk: #8e6052; --table: url("ui-table-r.png"); }
:root[data-tint="g"] { --desk: #6e644c; --table: url("ui-table-g.png"); }
img { max-width: 100%; height: auto; display: block; }
h1, h2, h3, p { margin-top: 0; }
h1, h2, h3 { font-family: var(--display); font-weight: 400; line-height: 1.2; color: var(--gold); text-shadow: 1px 1px 0 #000; }
h1 { font-size: 2rem; margin-bottom: 14px; }
h2 { font-size: 1.35rem; margin-bottom: 10px; }
h3 { font-size: 1rem; }
a { color: var(--link); text-decoration: underline; }
a:visited { color: #b9a6dc; }
a:focus-visible, button:focus-visible, summary:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
button, input, select { font: inherit; color: inherit; touch-action: manipulation; }
a { touch-action: manipulation; }
label { display: block; }
label > span, .field > label { display: block; font-size: .86rem; margin-bottom: 4px; color: var(--muted); }

/* Controls */
.button, .small-button, .task, .start {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: 0; border-radius: 3px; background: var(--stone); image-rendering: pixelated; box-shadow: var(--raised);
  color: var(--gold); text-shadow: 1px 1px 0 #000; text-decoration: none; white-space: nowrap; cursor: pointer;
  padding: 7px 16px; min-height: 34px;
}
.button:visited, .small-button:visited, .task:visited, .start:visited { color: var(--gold); }
.button:hover, .small-button:hover:enabled, .task:hover, .start:hover { color: #fff3c9; }
.button:active, .small-button:active:enabled, .task:active, .start:active { box-shadow: var(--pressed); padding: 8px 15px 6px 17px; }
.button.default { font-weight: 700; background: linear-gradient(#a8603c, #6f3620); box-shadow: inset -1px -1px #2b1208, inset 1px 1px #dc9a70, inset -2px -2px #53260f, inset 2px 2px #b97450, 0 0 0 1px var(--dark); color: #fff0cf; }
.button.default:active { box-shadow: inset 1px 1px #2b1208, inset 2px 2px #53260f, 0 0 0 1px var(--dark); }
.small-button { padding: 5px 12px; min-height: 30px; font-size: .9rem; }
.small-button:active:enabled { padding: 6px 11px 4px 13px; }
button:disabled { color: #7d7669; cursor: default; filter: saturate(.3); }
input, select {
  width: 100%; min-height: 32px; padding: 6px 8px; border: 0; border-radius: 0;
  background: var(--paper); box-shadow: var(--sunken); color: var(--text);
}
input::placeholder { color: #7d7669; }
input:focus, select:focus { outline: 2px solid var(--gold); outline-offset: 1px; }
select { appearance: none; -webkit-appearance: none; padding-right: 28px; background: var(--paper) var(--glyph-drop) no-repeat right 4px center; }
/* Searchable list that identity-picker.js builds in place of a select. */
.combo { position: relative; display: flex; align-items: center; gap: 6px; padding: 0 28px 0 8px; background: var(--paper) var(--glyph-drop) no-repeat right 4px center; box-shadow: var(--sunken); }
.combo:focus-within { outline: 2px solid var(--gold); outline-offset: 1px; }
.combo input { flex: 1; min-width: 0; padding-left: 0; padding-right: 0; background: none; box-shadow: none; text-overflow: ellipsis; }
.combo input:focus { outline: 0; }
.combo .colors { flex: none; }
.combo .colors:empty { display: none; }
.combo .mana { width: 18px; height: 18px; }
.combo ul { position: absolute; z-index: 20; top: calc(100% + 3px); left: 0; min-width: 100%; width: max-content; max-height: 340px; overflow-y: auto; margin: 0; padding: 4px; list-style: none; background: var(--face); box-shadow: var(--raised), 0 6px 18px #000a; }
.combo li { padding: 5px 10px; }
.combo li[role="option"] { display: flex; align-items: center; gap: 8px; cursor: pointer; }
.combo li[role="option"]:hover, .combo li.active { background: #0007; color: var(--gold); }
.combo li[aria-selected="true"] { color: var(--gold); }
.combo li[hidden] { display: none; }
.combo-group { margin-top: 4px; font-size: .75rem; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); border-top: 1px solid var(--rule); }
.combo-empty { color: var(--muted); }
progress { appearance: none; -webkit-appearance: none; display: block; width: 100%; height: 22px; border: 0; padding: 3px; background: var(--paper); box-shadow: var(--sunken); }
progress::-webkit-progress-bar { background: transparent; }
progress::-webkit-progress-value { background: linear-gradient(#f3d98c, #a87f2c); }
progress::-moz-progress-bar { background: linear-gradient(#f3d98c, #a87f2c); }

/* Stone panels */
.window {
  background: var(--face); min-width: 0; padding: 0;
  border: 14px solid #3a393d; border-image: url("ui-frame.png") 20 round; image-rendering: pixelated;
  box-shadow: 0 6px 18px #000a;
}
.window > * { image-rendering: auto; }
.title-bar { display: flex; align-items: center; gap: 8px; padding: 4px 10px; background: var(--stone); image-rendering: pixelated; box-shadow: inset 0 -1px #000, inset 0 -2px #5b4a6c; color: var(--gold); font-family: var(--display); font-variant: small-caps; letter-spacing: .05em; text-shadow: 1px 1px 0 #000; min-height: 28px; }
.title-icon { flex: none; image-rendering: auto; }
.title-text { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.title-text h3 { font: inherit; margin: 0; overflow: hidden; text-overflow: ellipsis; }
.title-text a, .title-text a:visited { color: inherit; text-decoration: none; }
.title-text a:hover { text-decoration: underline; }
.window-body { padding: 16px; }
.well { background: var(--paper); box-shadow: var(--sunken); padding: 2px; }
.status-bar { display: flex; gap: 2px; margin: 4px; font-size: .86rem; color: var(--muted); }
.status-field { box-shadow: var(--field); background: #0006; padding: 3px 8px; margin: 0; flex: 1; min-width: 0; }

/* Page + navigation: the tiled floor from the adventure screen */
main { max-width: 1120px; margin: 0 auto; padding: 24px 20px 8px; display: grid; gap: 22px; }
.taskbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; display: flex; align-items: stretch; gap: 6px;
  padding: 7px 8px 6px; background: #17131a url("ui-floor.png") 0 0 / auto 100% repeat-x; image-rendering: pixelated;
  box-shadow: inset 0 2px #000, inset 0 3px #6a5a2c, 0 -4px 14px #000a;
}
.taskbar nav { display: flex; gap: 6px; flex: 1; min-width: 0; }
/* The page buttons keep their labels; the currency strip is only as wide as its two codes. */
.taskbar nav:not(.currency) { flex: 0 1 auto; }
.taskbar nav.currency { flex: none; }
.start { font-weight: 400; padding: 4px 12px 4px 8px; gap: 6px; flex: none; }
.start:active { padding: 5px 11px 3px 9px; }
.start b { font-weight: 700; }
.start img { image-rendering: auto; }
.task { justify-content: flex-start; flex: 0 1 auto; min-width: 0; padding: 4px 12px; overflow: hidden; }
.task span { overflow: hidden; text-overflow: ellipsis; }
.task-short { display: none; }
.small-button[aria-current] { box-shadow: var(--pressed), 0 0 0 1px var(--gold-dim); font-weight: 700; color: #fff3c9; }
.task[aria-current] { box-shadow: var(--pressed), 0 0 0 1px var(--gold-dim); font-weight: 700; color: #fff3c9; padding: 5px 11px 3px 13px; }
.tints { display: flex; align-items: center; gap: 6px; padding: 0 8px; background: #000a; box-shadow: var(--field); flex: none; }
.tint { padding: 0; border: 0; cursor: pointer; opacity: .55; }
.tint:hover, .tint[aria-pressed="true"] { opacity: 1; }
.tint[aria-pressed="true"] { box-shadow: 0 0 0 1px #000, 0 0 0 3px var(--gold); }
.socials a { display: flex; }
.socials a, .socials a:visited { color: var(--text); }
.socials a:hover { color: var(--gold); }
.socials svg { fill: currentColor; }
.taskbar .socials { display: flex; align-items: center; gap: 10px; padding: 0 10px; background: #000a; box-shadow: var(--field); flex: none; }
.currency { background: #000a; box-shadow: var(--field); color: var(--muted); padding: 4px 10px; display: flex; align-items: center; gap: 8px; font-size: .86rem; flex: none; }
.currency a, .currency a:visited { color: var(--muted); }
.currency a:hover { color: var(--text); }
.currency b { color: var(--gold); }
.skip { position: absolute; left: 12px; top: -100px; z-index: 40; padding: 8px 12px; background: var(--tip); color: var(--ink); border: 1px solid var(--dark); }
.skip:focus { top: 10px; }
.demo-banner { background: var(--tip); color: var(--ink); border-bottom: 1px solid var(--dark); padding: 5px 16px; text-align: center; font-size: .86rem; }
.network-error, .form-message, #notice:not(:empty) {
  background: #3a1512; box-shadow: inset 0 0 0 1px #000, inset 0 0 0 2px #a8463a, 0 6px 18px #000a; padding: 14px 18px 14px 54px; max-width: 720px; margin: 16px auto;
  position: relative; min-height: 56px;
}
.network-error::before, .form-message::before, #notice:not(:empty)::before {
  content: "×"; position: absolute; left: 14px; top: 12px; width: 28px; height: 28px; border-radius: 50%;
  background: #c8301e; color: #fff; font: 700 24px/26px Arial, sans-serif; text-align: center; box-shadow: 1px 1px 0 var(--dark);
}
.network-error { position: sticky; top: 10px; z-index: 20; }
.form-message { margin: 0; max-width: none; }
.site-footer { max-width: 1080px; margin: 14px auto 24px; padding: 16px 20px; background: #141216e6; box-shadow: inset 0 0 0 1px #000, inset 0 0 0 2px #4a4850, 0 6px 18px #000a; display: flex; justify-content: space-between; gap: 40px; color: var(--muted); font-size: .86rem; }
.site-footer p { margin: 4px 0 0; }
.site-footer a, .site-footer a:visited { color: var(--text); }
.site-footer .brand { font-family: var(--display); font-size: 1.3rem; text-decoration: none; color: var(--gold); }
.site-footer > div:last-child { max-width: 620px; text-align: right; }
.footer-links { display: flex; justify-content: flex-end; flex-wrap: wrap; gap: 6px 18px; margin-top: 10px; }
.site-footer .socials { justify-content: flex-start; gap: 6px 14px; }
[hidden] { display: none !important; }
.sr-only { position: absolute; top: 0; left: 0; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }


/* Shared text */
.eyebrow { display: flex; align-items: center; gap: 8px; font-size: .79rem; font-weight: 700; letter-spacing: .06em; color: var(--gold); margin-bottom: 10px; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--gold); box-shadow: 0 0 6px var(--gold); }
.lead { max-width: 720px; margin-bottom: 18px; }
.note { font-size: .86rem; color: var(--muted); }
.text-link { font-size: .93rem; }
.section-heading { display: flex; justify-content: space-between; align-items: end; gap: 20px; margin-bottom: 14px; }
.section-heading h2, .section-heading .eyebrow { margin-bottom: 0; }
.section-heading .eyebrow { margin-bottom: 6px; }
.section-heading > span { font-size: .86rem; }
.breadcrumb { justify-self: start; }
.empty { text-align: center; padding: 48px 24px; margin: 4px 0 12px; }
.empty p { max-width: 520px; margin: 0 auto 20px; }

/* Home */
.hero { display: grid; grid-template-columns: 1.1fr 1fr; gap: 28px; align-items: center; padding: 28px; background: linear-gradient(90deg, #120f18e0 20%, #120f1866 55%, #120f1800), url("ui-castle.png") right 30% / cover; image-rendering: pixelated; }
.hero > * { image-rendering: auto; }
.hero h1 { font-size: clamp(2.2rem, 4.4vw, 3.3rem); line-height: 1.05; margin-bottom: 16px; }
.hero h1 em { font-style: normal; color: var(--gold); }
.hero-description { max-width: 440px; font-size: 1.07rem; margin-bottom: 20px; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.hero-footnote { font-size: .86rem; color: var(--muted); margin: 14px 0 0; }
.daily-deck { position: relative; display: grid; grid-template-columns: minmax(0, 190px) 1fr; gap: 16px; align-items: center; padding: 14px; background: #000b; }
.daily-deck img { width: 100%; border-radius: 4.5% / 3.2%; }
.daily-deck h2 { font-size: 1.5rem; margin: 0 0 8px; }
.daily-deck h2 a { color: inherit; text-decoration: none; }
.daily-deck h2 a::after { content: ""; position: absolute; inset: 0; }
.daily-deck:hover, .daily-deck:focus-within { outline: 2px solid var(--gold); outline-offset: 2px; }
.daily-deck h2 a:focus-visible { outline: none; }
.daily-price { margin: 12px 0 6px; }
.daily-price b { font-size: 1.9rem; color: var(--gold); margin-right: 4px; }
.daily-deck .note { margin: 0 0 12px; }
.daily-cta { color: var(--gold); font-weight: 700; }
.hero-stamp { letter-spacing: .08em; }
.hero-stamp b { font-weight: 700; }
.hero-empty { text-align: center; padding: 40px 20px; font-size: 1.2rem; text-shadow: 1px 1px 2px #000; background: linear-gradient(#0006, #0009), url("ui-vista.png") center / cover; image-rendering: pixelated; }
.hero-empty span { font-size: 5rem; line-height: 1; color: var(--gold); }
.hero-empty p { margin: 8px 0 0; }
.home-section .lead { margin-bottom: 14px; }
.home-section .window-body > .note:last-child { margin: 10px 0 0; }
.precon-features { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; }
.precon-feature { position: relative; display: flex; flex-direction: column; padding: 8px; }
.precon-feature img { width: 100%; height: auto; aspect-ratio: 626 / 457; object-fit: cover; border-radius: 3px; }
.precon-feature h3 { margin: 10px 0 2px; }
.precon-feature h3 a { color: inherit; text-decoration: none; }
.precon-feature h3 a::after { content: ""; position: absolute; inset: 0; }
.precon-feature h3 a:focus-visible { outline: none; }
.precon-feature:hover, .precon-feature:focus-within { outline: 2px solid var(--gold); outline-offset: 2px; }
.precon-feature .note { flex: 1; margin: 0 0 8px; }
.feature-bottom { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 6px 8px; }
.feature-bottom .mana { width: 20px; height: 20px; }
.feature-price { margin: 0; font-size: .86rem; white-space: nowrap; }
.feature-price b { font-size: 1.35rem; color: var(--gold); margin-right: 2px; }

/* Discovery */
.filters { display: grid; grid-template-columns: 1fr 1.3fr 1fr 1fr; gap: 12px; align-items: end; padding: 16px 14px 14px; margin: 14px 0; border: 1px solid var(--rule); background: #0004; }
.filters label, .filters .field { min-width: 0; }
.filters .button { grid-column: -2 / -1; }
.filters .search-field { grid-column: 1 / -1; }
.search-field summary { width: fit-content; cursor: pointer; font-size: .93rem; color: var(--link); }
.search-field label { max-width: 420px; margin-top: 10px; }
.results-heading { margin: 0 0 14px; }
.results-heading > span { flex: 1.4; }
.ranking-grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 16px; }
.ranking-card { position: relative; display: flex; flex-direction: column; border-width: 8px; box-shadow: none; }
.ranking-card:hover { filter: brightness(1.15); }
.ranking-card:has(a:focus-visible) { outline: 2px solid var(--gold); outline-offset: 2px; }
.ranking-art { display: block; padding: 8px; }
.ranking-art { position: relative; }
.ranking-card.outside .ranking-art img { filter: grayscale(1) brightness(.6); }
.ranking-card.outside .ranking-meta b, .ranking-card.outside h2 { color: var(--hi); }
.sticker { position: absolute; top: 18px; left: 50%; transform: translateX(-50%) rotate(-6deg); background: var(--tip); color: var(--ink); border: 1px solid var(--dark); padding: 2px 10px; font-size: .79rem; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; white-space: nowrap; box-shadow: 0 2px 4px #000c; }
.ranking-art img { width: 100%; aspect-ratio: 488 / 680; object-fit: cover; border-radius: 4.5% / 3.2%; }
.ranking-info { padding: 10px 8px 6px; flex: 1; display: flex; flex-direction: column; }
.ranking-info h2 { font-size: .93rem; line-height: 1.35; min-height: 2.7em; margin-bottom: 6px; }
.ranking-info h2 a, .ranking-info h2 a:visited { color: inherit; text-decoration: none; }
.ranking-info h2 a::after { content: ""; position: absolute; inset: 0; }
.ranking-info h2 a:focus-visible { outline: 0; }
.ranking-card:hover h2 a { text-decoration: underline; }
.ranking-meta { display: flex; align-items: baseline; justify-content: space-between; gap: 6px; }
.ranking-meta b { font-size: 1.35rem; color: var(--gold); }
.ranking-meta > span, .ranking-info > p { font-size: .79rem; color: var(--muted); }
.ranking-info > p { margin: 0 0 10px; flex: 1; }
.ranking-bottom { display: flex; align-items: center; justify-content: space-between; gap: 6px; flex-wrap: wrap; }
.ranking-bottom .mana { width: 20px; height: 20px; }
.ranking-set { font-size: .79rem; color: var(--muted); white-space: nowrap; }
.colors { display: inline-flex; gap: 3px; }
.mana { display: inline-flex; align-items: center; justify-content: center; width: 24px; height: 24px; border-radius: 50%; box-shadow: 0 0 0 1px #000, 0 0 0 2px #6b6558; background: #8d8a84 center / cover; image-rendering: pixelated; font-size: 0; text-decoration: none; }
.mana-w { background-image: url("ui-mana-w.png"); }
.mana-u { background-image: url("ui-mana-u.png"); }
.mana-b { background-image: url("ui-mana-b.png"); }
.mana-r { background-image: url("ui-mana-r.png"); }
.mana-g { background-image: url("ui-mana-g.png"); }
.mana-c { font-size: .7rem; font-weight: 700; color: var(--ink); }
.pagination { display: flex; justify-content: space-between; gap: 12px; padding-top: 16px; }
.pagination:empty { display: none; }

/* Commander */
.commander-detail { display: grid; grid-template-columns: 290px 1fr; gap: 32px; padding: 24px; }
.detail-image img { width: 100%; border-radius: 4.5% / 3.2%; }
.detail-image .well { padding: 10px; }
.detail-image p { font-size: .79rem; text-align: center; margin: 8px 0 0; }
.commander-detail h1 { font-size: 2.2rem; margin-bottom: 8px; }
.commander-detail .lead { margin: 12px 0 10px; font-weight: 700; }
.oracle { white-space: pre-line; background: var(--tip); color: var(--ink); box-shadow: inset 0 0 0 1px #000, inset 0 0 12px #6b5a2c; padding: 10px 12px; }
.detail-stats { display: flex; gap: 10px; margin: 16px 0 12px; flex-wrap: wrap; }
.detail-stats > div { display: flex; flex-direction: column; padding: 8px 14px; min-width: 150px; }
.detail-stats span { font-size: .79rem; }
.detail-stats b { font-size: 1.6rem; line-height: 1.2; color: var(--gold); }
.suggestions-preview { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 16px; padding: 16px; }
.card-preview img { width: 100%; border-radius: 4.5% / 3.2%; }
.card-preview div { display: flex; justify-content: space-between; gap: 8px; margin-top: 6px; font-size: .79rem; }
.card-preview div b { font-weight: 400; }
.card-preview div span { white-space: nowrap; }

/* Build a draft */
.build-commander { display: flex; gap: 24px; align-items: center; padding: 20px; }
.commander-portrait { width: 135px; flex: none; border-radius: 4.5% / 3.2%; }
.build-commander h1 { font-size: clamp(1.7rem, 3.4vw, 2.4rem); margin-bottom: 8px; }
.build-commander .note { margin: 8px 0; }
.commander-link { flex: none; line-height: 0; }
.commander-text summary { cursor: pointer; }
.commander-text .oracle { max-width: 660px; margin: 10px 0 0; }
.build-settings { display: grid; grid-template-columns: 1.4fr 1fr 1fr; gap: 12px; }
.type-counts { margin: 20px 0 8px; padding: 12px 14px 14px; border: 1px solid var(--rule); background: #0004; display: grid; grid-template-columns: repeat(8, minmax(0, 1fr)); gap: 12px; }
.type-counts legend { padding: 0 6px; font-weight: 700; }
.type-counts input { min-width: 0; }
.type-total { font-weight: 700; margin: 10px 0 0; }
.template-choice { margin: 16px 0 0; max-width: 900px; }
.build-controls > .note { margin: 14px 0 18px; max-width: 950px; }
.build-actions, .save-draft { display: flex; align-items: center; gap: 20px; }
.draft-heading { display: flex; align-items: end; justify-content: space-between; gap: 24px; margin-bottom: 16px; }
.draft-heading h2 { margin: 0; }
.draft-stats { display: flex; gap: 10px; }
.draft-stats > div { display: flex; flex-direction: column; padding: 6px 14px; box-shadow: var(--field); }
.draft-stats b { font-size: 1.5rem; line-height: 1.2; white-space: nowrap; color: var(--gold); }
.draft-stats span { font-size: .79rem; }
.draft-notice { background: var(--tip); color: var(--ink); border: 1px solid var(--dark); padding: 8px 12px; }
.save-draft { margin: 18px 0 8px; }
.save-draft p { margin: 0; max-width: 320px; }
.draft-section { margin-top: 22px; }
.draft-section .section-heading { margin-bottom: 8px; }
.draft-section h3 { font-size: 1.15rem; margin: 0; }
.section-count { font-weight: 400; font-size: .86rem; color: var(--muted); }
.draft-card-grid { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 16px; padding: 16px; }
.draft-card-grid:empty { display: none; }
.draft-card, .draft-card:visited { color: var(--text); text-decoration: none; }
.draft-card > div { position: relative; }
.draft-card img { width: 100%; aspect-ratio: 488 / 680; object-fit: cover; border-radius: 4.5% / 3.2%; }
.draft-card > b { display: block; font-size: .79rem; font-weight: 400; line-height: 1.35; margin: 6px 0 2px; }
.draft-card > span { font-size: .79rem; color: var(--muted); }
.card-popup { color: var(--text); width: min(760px, calc(100vw - 24px)); max-height: calc(100dvh - 24px); overflow: auto; }
.card-popup::backdrop { background: #000c; }
.export-dialog, .feedback-dialog { color: var(--text); width: min(560px, calc(100vw - 24px)); max-height: calc(100dvh - 24px); overflow: auto; }
.export-dialog::backdrop, .feedback-dialog::backdrop { background: #000c; }
.export-formats { display: flex; flex-wrap: wrap; gap: 6px 18px; margin: 0 0 10px; padding: 8px 12px 10px; border: 1px solid var(--rule); }
.export-formats legend { padding: 0 6px; font-weight: 700; }
.export-formats label { display: flex; align-items: center; gap: 6px; }
.export-formats input { width: 16px; min-height: 16px; height: 16px; padding: 0; flex: none; accent-color: var(--gold); box-shadow: none; }
.export-text { display: block; width: 100%; margin: 10px 0; padding: 8px 10px; resize: vertical; font: .9rem/1.45 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; color: var(--text); background: var(--paper); border: 0; border-radius: 0; box-shadow: var(--sunken); }
.export-text:focus { outline: 2px solid var(--gold); outline-offset: 1px; }
.feedback-form label { margin-bottom: 12px; }
.feedback-form textarea { display: block; width: 100%; padding: 8px 10px; resize: vertical; font: inherit; color: var(--text); background: var(--paper); border: 0; border-radius: 0; box-shadow: var(--sunken); }
.feedback-form textarea:focus { outline: 2px solid var(--gold); outline-offset: 1px; }
.feedback-shot label { display: flex; align-items: center; gap: 6px; margin-bottom: 8px; }
.feedback-shot input { width: 16px; min-height: 16px; height: 16px; padding: 0; flex: none; accent-color: var(--gold); box-shadow: none; }
.feedback-preview { width: 100%; max-height: 240px; object-fit: contain; background: #000; box-shadow: var(--field); margin-bottom: 12px; }
.feedback-shot:has(input:not(:checked)) .feedback-preview { opacity: .25; }
.feedback-status { margin: 8px 0 0; min-height: 1.4em; }
.export-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.export-status { margin: 8px 0 0; min-height: 1.4em; }
.card-popup .window-body { display: flex; gap: 20px; align-items: start; }
.card-popup .card-face { width: min(336px, 48%); flex: none; }
.popup-image { display: block; width: 100%; height: auto; aspect-ratio: 488 / 680; border-radius: 4.5% / 3.2%; background: var(--paper); }
.popup-text { flex: 1; min-width: 0; }
.popup-text p { margin: 0 0 12px; }
.popup-type { color: var(--muted); }
.popup-price span { display: block; font-size: .86rem; color: var(--muted); }
.popup-price b { font-size: 1.4rem; color: var(--gold); }
.new-badge { position: absolute; top: 6px; left: 6px; background: var(--gold); color: var(--ink); border: 1px solid var(--dark); border-radius: 3px; padding: 0 6px; font-size: .7rem; font-weight: 700; letter-spacing: .08em; line-height: 1.6; box-shadow: 0 1px 3px #000a; }
.copy-badge { position: absolute; top: 6px; right: 6px; background: var(--tip); color: var(--ink); border: 1px solid var(--dark); border-radius: 10px; padding: 0 7px; font-size: .86rem; font-weight: 700; line-height: 1.5; box-shadow: 0 1px 3px #000a; }
.empty-type { font-size: .86rem; color: var(--muted); margin: 0; }
.template-panel { margin: 18px 0; padding: 14px; border: 1px solid var(--rule); background: #0004; }
.template-panel > .note { margin: 10px 0 0; }
.table-scroll { position: relative; min-width: 0; max-width: 100%; overflow-x: auto; }
.cost-curve { display: flex; align-items: flex-end; gap: 4px; list-style: none; margin: 0; padding: 14px 10px 8px; min-width: 620px; }
.cost-curve li { flex: 1 1 0; min-width: 0; }
.cost-curve a, .cost-curve a:visited { display: flex; flex-direction: column; align-items: center; color: var(--muted); text-decoration: none; font-size: .72rem; white-space: nowrap; }
.curve-bar { width: 100%; height: calc(var(--h) * 150px); min-height: 2px; margin: 3px 0 5px; background: var(--link); }
.cost-curve .incomplete .curve-bar { background: var(--light); }
.cost-curve .current .curve-bar { background: var(--gold); }
.cost-curve .current a { color: var(--gold); font-weight: 700; }
.cost-curve a:hover, .cost-curve a:focus-visible { color: var(--text); }
.cost-curve a:hover .curve-bar, .cost-curve a:focus-visible .curve-bar { filter: brightness(1.2); }
.deck-stats { margin: 22px 0; }
.deck-stats h3 { font-size: 1.15rem; margin: 18px 0 8px; }
.deck-stats .detail-stats { margin: 0; }
.mana-curve { display: flex; align-items: flex-end; gap: 6px; list-style: none; margin: 0; padding: 14px 10px 8px; max-width: 520px; }
.mana-curve li { flex: 1 1 0; min-width: 0; display: flex; flex-direction: column; align-items: center; color: var(--muted); font-size: .79rem; }
.mana-bar { width: 100%; height: calc(var(--h) * 110px); min-height: 2px; margin: 3px 0 5px; background: var(--link); }
.curve-match { font-size: .68rem; }
.curve-key { color: var(--link); }
.curve-key.current { color: var(--gold); }
.curve-key.incomplete { color: var(--hi); }
/* Price trend charts. The plot keeps a legible width and scrolls sideways on a narrow screen. */
.trend { margin-top: 26px; }
.trend-controls { display: flex; flex-wrap: wrap; gap: 8px 22px; margin: 18px 0 0; }
.trend-controls > div { display: flex; gap: 4px; }
.trend .table-scroll + .table-scroll { margin-top: 10px; }
.chart-frame { position: relative; min-width: 640px; }
.trend-chart { display: block; width: 100%; height: auto; touch-action: pan-y; }
.trend-chart .grid { stroke: #ffffff14; }
.trend-chart .grid.zero { stroke: #ffffff38; }
.trend-chart .axis { fill: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; }
.trend-chart .crosshair { stroke: var(--hi); visibility: hidden; }
.trend-chart .crosshair.on { visibility: visible; }
.trend-line { fill: none; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.trend-end { stroke: var(--paper); stroke-width: 2; }
.line-key { flex: none; width: 28px; height: 8px; }
.line-key line { stroke-width: 2; stroke-linecap: round; }
.chart-tip { position: absolute; top: 10px; z-index: 1; pointer-events: none; display: grid; grid-template-columns: auto auto 1fr; gap: 2px 8px; align-items: center; padding: 8px 10px; background: var(--face); box-shadow: var(--raised), 0 4px 12px #000a; font-size: .82rem; white-space: nowrap; }
.chart-tip[hidden] { display: none; }
.chart-tip b { grid-column: 1 / -1; color: var(--gold); font-weight: 400; }
.chart-tip strong { text-align: right; font-variant-numeric: tabular-nums; }
.chart-tip span { color: var(--muted); }
.trend-table td, .trend-table thead th { white-space: nowrap; font-variant-numeric: tabular-nums; }
.trend-table tbody th { display: flex; align-items: center; gap: 10px; text-align: left; }
/* The operator's pipeline status: long text reads left and wraps; a state is a word and a color. */
.pipeline-table td, .pipeline-table thead th { text-align: left; }
.pipeline-table td.when, .pipeline-table tbody th { white-space: nowrap; font-variant-numeric: tabular-nums; }
.pipeline-table .state { font-weight: 700; white-space: nowrap; }
.pipeline-table .state-ok { color: #9fd98a; }
.pipeline-table .state-retrying { color: var(--gold); }
.pipeline-table .state-behind { color: #ff8a78; }
table { width: 100%; border-collapse: collapse; font-size: .86rem; }
th, td { text-align: right; padding: 6px 12px; border-bottom: 1px solid #ffffff14; }
th:first-child { text-align: left; }
thead th { background: var(--stone); image-rendering: pixelated; color: var(--gold); border-bottom: 1px solid #000; font-weight: 400; }
tbody th { font-weight: 400; }
tbody tr:last-child > * { border-bottom: 0; }

/* Budget boosters: set names read left, numbers right; packs worth more than they cost stand out. */
.pack-table tbody th { text-align: left; }
.pack-table th[scope="col"]:nth-child(2) { text-align: left; }
.pack-table td, .pack-table thead th { white-space: nowrap; }
.pack-table .set-code { color: var(--muted); font-size: .79rem; }
.pack-table .estimated { color: var(--ink); background: var(--tip); border-radius: 3px; padding: 0 5px; font-size: .72rem; }
.pack-table .net { color: #ff8a78; }
.pack-table .gain .net { color: #9fd98a; font-weight: 700; }
.pack-table .gain th { color: var(--gold); }
.pack-table .typical { color: #ff8a78; }
.pack-table .typical.win { color: #9fd98a; font-weight: 700; }
.pack-table tbody th a, .pack-table tbody th a:visited { color: inherit; }
/* A set symbol from the Keyrune font, in a box of one width so names line up. */
.ss { display: inline-block; flex: none; width: 1.4em; font: 400 1.25em/1 "Keyrune"; text-align: center; vertical-align: -.12em; color: var(--gold); }
.pack-name { display: flex; align-items: center; gap: 10px; }
.pack-name .ss { font-size: 1.7rem; }
.pack-name > div { min-width: 0; }
/* One set's pack: slot and card tables read left for words, right for numbers. */
.ev-table tbody th, .ev-table .text { text-align: left; }
.ev-table td:not(.text), .ev-table thead th { white-space: nowrap; }
.ev-table .set-code { color: var(--muted); font-size: .79rem; }
.ev-table td:first-child { text-align: left; width: 1%; }
.pool-card { display: inline-flex; align-items: center; gap: 12px; vertical-align: middle; color: inherit; }
.pool-card:visited { color: inherit; }
.pool-card img { flex: none; width: 56px; height: auto; aspect-ratio: 488 / 680; border-radius: 4.5% / 3.2%; background: var(--paper); }
.pack-odds { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; font-size: .86rem; color: var(--muted); margin: 0 0 18px; }
.pack-odds .well { padding: 2px 8px; }
.pack-odds b { color: var(--text); }
ul.note { padding-left: 18px; margin: 10px 0 0; }
/* Budget precon upgrades: the list of decks, then one deck's swaps, statistics, and upgraded list. */
.precon-filters { grid-template-columns: 1.6fr 1fr 1.3fr auto; }
.precon-filters .button { grid-column: auto; }
.precon-table tbody th, .swap-table tbody th, .swap-table td.cut, .swap-table td.choices { text-align: left; }
.precon-table td, .precon-table thead th, .swap-table thead th { white-space: nowrap; }
.precon-table .year-row th { background: #0006; color: var(--gold); font-family: var(--display); font-size: 1rem; padding-top: 12px; }
.precon-name { display: flex; align-items: center; gap: 12px; }
.precon-name img { flex: none; width: 56px; aspect-ratio: 626 / 457; object-fit: cover; border-radius: 3px; }
.precon-name div { display: flex; flex-direction: column; min-width: 0; }
.precon-name a { font-size: 1rem; }
.precon-name span { font-size: .79rem; color: var(--muted); }
.precon-table .colors .mana { width: 20px; height: 20px; }
.precon-table .upgrade { color: var(--gold); font-weight: 700; }
.precon-table .short { color: var(--muted); font-size: .72rem; font-weight: 400; }
.precon-table .stale { color: var(--muted); }
.precon-page .commander-portrait + .commander-portrait { margin-left: -84px; }
.upgrade-form .build-settings { grid-template-columns: 1fr 1fr auto; align-items: end; margin-bottom: 14px; }
.upgrade-form .draft-notice, .land-note { margin: 0 0 12px; }
.swap-table th[scope="col"]:nth-child(2), .swap-table th[scope="col"]:nth-child(4), .swap-table th[scope="col"]:nth-child(5) { text-align: left; }
.swap-table tbody th, .swap-table td.cut { min-width: 300px; }
.swap-card { display: flex; gap: 12px; align-items: start; }
.swap-face { flex: none; width: 90px; line-height: 0; }
.swap-face img { width: 100%; height: auto; aspect-ratio: 488 / 680; border-radius: 4.5% / 3.2%; }
.swap-table .role, .swap-table .badge { font-size: .7rem; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); border: 1px solid var(--rule); border-radius: 3px; padding: 0 5px; white-space: nowrap; }
.swap-table .badge { color: var(--ink); background: var(--tip); border-color: var(--dark); }
.swap-table td.cut b { color: #ff8a78; }
.swap-table tbody td:nth-child(3) { color: var(--gold); font-weight: 700; white-space: nowrap; }
.choices label, .set-aside label { display: flex; align-items: center; gap: 6px; white-space: nowrap; font-size: .79rem; }
.choices input, .set-aside input { width: 16px; min-height: 16px; height: 16px; padding: 0; flex: none; accent-color: var(--gold); box-shadow: none; }
.swap-table + .note, .table-scroll + .note { margin: 10px 0 14px; }
.swap-heading { margin: 16px 0 6px; }
.swap-heading h3 { font-size: 1.15rem; margin: 0; }
.set-aside { margin: 0 0 14px; padding: 10px 14px; border: 1px solid var(--rule); background: #0004; display: flex; flex-wrap: wrap; gap: 6px 22px; }
.set-aside legend { padding: 0 6px; font-weight: 700; }
.set-aside .note { flex-basis: 100%; margin: 4px 0 0; }
.land-note { margin-top: 12px; }
.compare-table td, .compare-table thead th { white-space: nowrap; }
.compare-table td:last-child { color: var(--gold); font-weight: 700; }
.mana-curve.paired .bars { display: flex; align-items: flex-end; gap: 2px; width: 100%; margin: 3px 0 5px; }
.mana-curve.paired .mana-bar { flex: 1; margin: 0; }
.mana-bar.was { background: var(--light); }
.decklist { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); column-gap: 28px; padding: 4px 12px; }
.decklist .deck-row { padding: 5px 0; font-size: .93rem; }
.decklist .deck-row:last-child { border-bottom: 1px solid #ffffff14; }
.decklist .deck-row > span { font-size: .79rem; color: var(--muted); white-space: nowrap; }
.precon-page .list-view + .draft-section { margin-top: 14px; }
/* Deck page: the commander beside the list, which shows as stacks of faces or as text. */
.deck-page { max-width: 1480px; }
.deck-layout { display: grid; grid-template-columns: 280px minmax(0, 1fr); gap: 22px; align-items: start; }
.deck-layout.settings-only { grid-template-columns: minmax(0, 560px); justify-content: center; }
.deck-side { position: sticky; top: 16px; max-height: calc(100dvh - 96px); overflow-y: auto; }
.deck-side .commander-link { display: block; margin-bottom: 12px; }
.deck-side .commander-portrait { width: 100%; }
.deck-side h1 { font-size: 1.5rem; margin-bottom: 8px; overflow-wrap: anywhere; }
.deck-side .strategy { margin: 8px 0 0; }
.deck-side .budget-status { margin: 2px 0; }
.deck-side .note { margin-bottom: 10px; }
.deck-side .draft-notice, .deck-side .warning { font-size: .86rem; margin: 0 0 8px; padding: 6px 10px; }
.deck-side .warning { padding: 0; }
.deck-actions { display: grid; gap: 8px; margin: 14px 0 4px; }
.deck-actions .button { width: 100%; }
.deck-actions .save-draft { margin: 0; }
.deck-side .build-settings, .deck-side .type-counts { grid-template-columns: 1fr 1fr; }
.deck-side .build-settings > label:first-child { grid-column: 1 / -1; }
.deck-side .build-controls { padding: 0 0 4px; }
.deck-side .build-actions { flex-wrap: wrap; gap: 12px; margin-top: 14px; }
.settings-only .deck-side { position: static; max-height: none; }
.settings-only .commander-link { max-width: 200px; }
.deck-main { display: grid; gap: 22px; min-width: 0; }
.commander-pair { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: 6px; }
.commander-pair .commander-link { margin: 0; }
/* A double-faced card's picture, under the button that card-flip.js turns it over with. */
.card-face { position: relative; align-self: start; }
.card-face > .commander-link { margin: 0; max-width: none; }
.flip { position: absolute; left: 50%; bottom: 9%; translate: -50%; gap: 0; white-space: pre; opacity: .92; }
.flip:hover { opacity: 1; }
.flip[hidden] { display: none; }
.deck-values { display: grid; grid-template-columns: 1fr auto; gap: 2px 12px; margin: 10px 0; font-size: .86rem; }
.deck-values dt { color: var(--muted); }
.deck-values dd { margin: 0; text-align: right; font-variant-numeric: tabular-nums; }
.deck-side .eyebrow { margin-bottom: 6px; }
.deck-side .page-actions { margin-bottom: 0; }
.deck-toolbar { display: flex; gap: 4px; margin-bottom: 16px; }
.deck-columns { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 24px 16px; align-items: start; }
.deck-stack { min-width: 0; }
.deck-stack h3 { display: flex; align-items: baseline; gap: 6px; font-size: 1rem; margin: 0 0 6px; white-space: nowrap; }
.deck-stack.cont h3 { color: var(--muted); }
.stack-price { margin-left: auto; font-family: system-ui, sans-serif; font-size: .75rem; color: var(--muted); text-shadow: none; }
.deck-stack ol { list-style: none; margin: 0; padding: 0; }
.deck-card, .deck-card:visited { position: relative; display: block; color: var(--text); text-decoration: none; }
.deck-card img { width: 100%; aspect-ratio: 488 / 680; object-fit: cover; border-radius: 4.5% / 3.2%; background: var(--paper); box-shadow: 0 -1px 0 #000, 0 2px 6px #000a; }
/* Each face covers the one above it down to the name; a percentage margin follows the card's width. */
[data-view="stacks"] .deck-stack li + li { margin-top: -120.5%; }
[data-view="stacks"] .deck-card { transition: transform .12s ease-out; }
[data-view="stacks"] .deck-card:hover, [data-view="stacks"] .deck-card:focus-visible { transform: translateX(10px); }
[data-view="stacks"] .deck-card:hover img { box-shadow: 0 0 0 2px var(--gold), 0 2px 8px #000; }
/* A card the upgrade adds: gold edge, and a tab clear of its name. */
.deck-card.added img { box-shadow: 0 0 0 2px var(--gold), 0 2px 6px #000a; }
[data-view="stacks"] .deck-card .new-badge { top: 14%; left: auto; right: -5px; font-size: .62rem; padding: 0 4px; }
[data-view="stacks"] .deck-stack li:not(:last-child) .new-badge { top: 4px; }
[data-view="text"] .deck-card .new-badge { position: static; flex: none; font-size: .62rem; box-shadow: none; }
[data-view="stacks"] .deck-qty, [data-view="stacks"] .deck-name, [data-view="stacks"] .deck-price { display: none; }
[data-view="text"] .deck-columns { display: block; columns: 4 230px; column-gap: 32px; }
[data-view="text"] .deck-stack:not(.cont):not(:first-child) { margin-top: 18px; }
[data-view="text"] .deck-stack h3 { break-after: avoid; }
[data-view="text"] .deck-stack.cont h3, [data-view="text"] .deck-card img, [data-view="text"] .copy-badge { display: none; }
[data-view="text"] .deck-card { display: flex; align-items: baseline; gap: 8px; padding: 3px 0; border-bottom: 1px solid #ffffff14; font-size: .93rem; break-inside: avoid; }
[data-view="text"] .deck-card:hover .deck-name, [data-view="text"] .deck-card:focus-visible .deck-name { color: var(--gold); }
.deck-qty { flex: none; min-width: 1.3em; text-align: right; color: var(--muted); font-variant-numeric: tabular-nums; }
.deck-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.deck-price { flex: none; font-size: .79rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.deck-main .deck-view + .disclosure { margin-top: 28px; }
/* A saved deck's remove buttons: on the strip of a stacked face left showing, or ending a text row. */
.remove-card { margin: 0; flex: none; }
.remove-card button { display: block; width: 20px; height: 20px; padding: 0; border: 1px solid var(--dark); border-radius: 10px; background: var(--tip); color: var(--ink); font-size: .9rem; font-weight: 700; line-height: 1; cursor: pointer; box-shadow: 0 1px 3px #000a; }
.remove-card button:hover, .remove-card button:focus-visible { background: #ff8a78; }
[data-view="stacks"] .deck-stack li { position: relative; }
[data-view="stacks"] .remove-card { position: absolute; top: 3px; right: 3px; }
[data-view="stacks"] .deck-stack li:has(.remove-card) .copy-badge { right: 28px; }
[data-view="text"] .deck-stack li { display: flex; align-items: center; gap: 8px; break-inside: avoid; }
[data-view="text"] .deck-stack li .deck-card { flex: 1; min-width: 0; }
@media (hover: hover) {
  [data-view="stacks"] .remove-card { opacity: 0; }
  [data-view="stacks"] .deck-stack li:hover .remove-card, [data-view="stacks"] .remove-card:focus-within { opacity: 1; }
}
/* The full card beside the pointer, in a window of its own; card-inspector.js fills and places it. */
.card-inspector { position: fixed; z-index: 50; top: 0; left: 0; width: 300px; border-width: 8px; pointer-events: none; visibility: hidden; opacity: 0; transform: translateY(8px) scale(.96); transform-origin: left center; transition: opacity .1s ease-out, transform .14s ease-out; box-shadow: 0 12px 32px #000d; }
.card-inspector.on { visibility: visible; opacity: 1; transform: none; }
.inspector-face { width: calc(100% - 12px); margin: 6px; aspect-ratio: 488 / 680; border-radius: 4.5% / 3.2%; background: var(--paper); }
.card-inspector .status-bar { flex-wrap: wrap; font-size: .79rem; }
.card-inspector .status-field { flex: 1 1 auto; white-space: nowrap; }
.inspector-price { color: var(--gold); flex-grow: 0 !important; }
/* Guided tour: tour.js places a gold frame on one part of the page and a note beside it. Neither blocks the page. */
.tour-ring { position: fixed; z-index: 44; border-radius: 4px; pointer-events: none; box-shadow: 0 0 0 2px var(--gold), 0 0 0 9999px #0009; }
.tour-card { position: fixed; z-index: 45; width: min(360px, calc(100vw - 24px)); border-width: 8px; box-shadow: 0 12px 32px #000d; }
.tour-card:focus { outline: 0; }
.tour-card h2 { margin-bottom: 8px; }
.tour-card p { margin-bottom: 14px; }
.tour-actions { display: flex; align-items: center; gap: 8px; }
.tour-actions .note { margin: 0 auto 0 0; }
/* Builder */
.deck-tools .section-heading { margin: 22px 0 8px; }
.list-view { padding: 2px 12px; }
.deck-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 8px 0; border-bottom: 1px solid #ffffff14; }
.deck-row:last-child { border-bottom: 0; }
.deck-row > div:first-child { display: flex; flex-direction: column; min-width: 0; }
.deck-row > div:first-child > span { font-size: .79rem; color: var(--muted); }
.deck-row b { font-weight: 700; }
.row-controls { display: flex; align-items: center; gap: 12px; flex: none; }
.tag { font-size: .7rem !important; font-weight: 700; letter-spacing: .08em; color: var(--gold) !important; }
.empty-list { padding: 24px 0; color: var(--muted); }
.land-row { display: flex; align-items: center; gap: 10px; margin: 8px 0; }
.land-row label { flex: 1; }
.land-row input { width: 72px; }
.budget-number { font-size: 2.4rem; font-weight: 700; line-height: 1.1; margin: 12px 0 2px; color: var(--gold); text-shadow: 1px 1px 0 #000; }
.budget-number + p { margin-bottom: 10px; }
.budget-status { font-weight: 700; margin: 10px 0; }
.over-budget, .warning, .unpriced { color: #ff8a78; }
.warning, .unpriced { font-size: .86rem; }
.budget-form { border-top: 1px solid var(--rule); margin-top: 16px; padding-top: 14px; }
.budget-form button { margin: 8px 0 14px; }
.delete-deck { border-top: 1px solid var(--rule); margin-top: 16px; padding-top: 12px; font-size: .86rem; }
.delete-deck summary { cursor: pointer; }
.delete-deck p { margin: 10px 0; }

/* My decks + pricing */
.saved-deck { display: flex; align-items: center; justify-content: space-between; gap: 24px; padding: 10px 0; border-bottom: 1px solid #ffffff14; color: var(--text); text-decoration: none; }
.saved-deck:visited { color: var(--text); }
.saved-deck:last-child { border-bottom: 0; }
.saved-deck:hover, .saved-deck:focus-visible { background: var(--stone); image-rendering: pixelated; color: var(--text); outline: 1px solid var(--gold-dim); outline-offset: -1px; margin: 0 -10px; padding: 10px; }
.saved-deck h2 { font-size: 1.07rem; margin: 0; flex: 1; }
.notepad { max-width: 1080px; width: 100%; margin: 0 auto; }
.prose { padding: 18px 20px 24px; }
.prose h1 { font-size: 1.6rem; }
.prose h2 { font-size: 1.07rem; margin: 26px 0 6px; }
.prose p { line-height: 1.65; }

/* Use concise navigation labels before the full labels become cramped. */
@media (max-width: 1300px) {
  .task-long { display: none; }
  .task-short { display: inline; }
}
@media (max-width: 1000px) {
  .filters { grid-template-columns: 1fr 1.3fr 1fr; }
  .filters .button { grid-column: 1 / -1; }
  .ranking-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
  .type-counts { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .draft-card-grid { grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 12px; }
  .draft-heading { flex-direction: column; align-items: start; gap: 12px; }
  .decklist { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .precon-filters { grid-template-columns: 1.6fr 1fr 1.3fr; }
  .precon-filters .button { grid-column: 1 / -1; }
  .suggestions-preview { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .commander-detail { grid-template-columns: 240px 1fr; gap: 24px; }
  .deck-layout { grid-template-columns: 1fr; }
  .deck-side { position: static; max-height: none; }
  /* The commander shrinks to a strip above the list. */
  .deck-side > .window-body { display: grid; grid-template-columns: 130px minmax(0, 1fr); column-gap: 16px; align-content: start; }
  .deck-side > .window-body > * { grid-column: 2; }
  .deck-side > .window-body > .commander-link { grid-column: 1; grid-row: 1 / span 6; margin: 0; }
  .deck-side > .window-body > .deck-actions, .deck-side > .window-body > .disclosure, .deck-side > .window-body > .page-actions, .deck-side > .window-body > .delete-deck { grid-column: 1 / -1; }
  .deck-actions { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .settings-only .deck-side > .window-body { display: block; }
}
@media (max-width: 760px) {
  main { padding: 16px 16px 4px; gap: 16px; }
  .window { border-width: 8px; }
  .window-body { padding: 12px; }
  .button, .small-button { min-height: 40px; }
  input, select { min-height: 40px; font-size: 16px; }
  .combo ul { left: auto; right: 0; max-width: calc(100vw - 64px); }
  .task-long, .start-prefix, .demo-banner span { display: none; }
  .currency { padding: 4px 6px; gap: 6px; font-size: .79rem; }
  .task-short { display: inline; }
  .taskbar nav:not(.currency) { flex: 1; }
  .task { flex: 1 1 0; justify-content: center; min-height: 40px; }
  .start { min-height: 40px; padding: 4px 8px; }
  .start > span { display: none; }
  .task { padding: 4px 6px; }
  .hero { grid-template-columns: 1fr; padding: 18px 14px; gap: 20px; }
  .daily-deck { grid-template-columns: minmax(0, 120px) 1fr; gap: 12px; padding: 10px; }
  .daily-deck h2 { font-size: 1.25rem; }
  .daily-price b { font-size: 1.5rem; }
  .precon-features { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .section-heading { flex-direction: column; align-items: start; gap: 8px; }
  .filters { grid-template-columns: 1fr 1fr; }
  .filters .button { grid-column: 1 / -1; }
  .results-heading { flex-direction: column; }
  .ranking-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
  .ranking-art { padding: 5px; }
    .ranking-info h2 { font-size: .86rem; }
  .ranking-meta { flex-direction: column; gap: 0; }
  .ranking-meta b { font-size: 1.2rem; }
  .footer-links { justify-content: flex-start; }
  .build-commander { align-items: start; gap: 14px; padding: 14px; }
  .commander-portrait { width: 90px; }
  .build-settings { grid-template-columns: 1fr 1fr; }
  .build-settings > label:first-child { grid-column: 1 / -1; }
  .precon-filters { grid-template-columns: 1fr 1fr; }
  .precon-filters > label:first-child { grid-column: 1 / -1; }
  .upgrade-form .build-settings { grid-template-columns: 1fr 1fr; }
  .upgrade-form .build-settings > label:first-child { grid-column: auto; }
  .upgrade-form .build-settings .button { grid-column: 1 / -1; }
  .decklist { grid-template-columns: 1fr; }
  .precon-name img { width: 44px; }
  .precon-page .commander-portrait + .commander-portrait { margin-left: -60px; }
  .type-counts { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .draft-card-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; padding: 10px; }
  .card-popup .window-body { flex-direction: column; align-items: center; }
  .card-popup .card-face { width: min(300px, 100%); }
  /* The commander is a thumbnail here; its button keeps to the arrow. */
  .commander-link .flip { padding-inline: 8px; min-height: 30px; }
  .commander-link .flip span { display: none; }
  .popup-text { align-self: stretch; }
  .draft-section .section-heading { flex-direction: row; align-items: end; }
  .build-actions, .save-draft { flex-wrap: wrap; gap: 12px; }
  .save-draft { align-items: start; flex-direction: column; }
  th, td { padding: 6px 8px; }
  .site-footer { flex-direction: column; gap: 14px; margin: 14px 16px 24px; }
  .tints { gap: 4px; padding: 0 6px; }
  .tint.mana { width: 20px; height: 20px; }
  .site-footer > div:last-child { text-align: left; }
  .commander-detail { grid-template-columns: 1fr; padding: 14px; }
  .detail-image { width: 230px; max-width: 100%; margin: 0 auto; }
  .commander-detail h1 { font-size: 1.8rem; }
  .suggestions-preview { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; padding: 10px; }
  .card-preview div { flex-direction: column; gap: 0; }
  .deck-side > .window-body { grid-template-columns: 96px minmax(0, 1fr); column-gap: 12px; }
  .deck-side h1 { font-size: 1.25rem; }
  .deck-columns { grid-template-columns: repeat(auto-fill, minmax(128px, 1fr)); gap: 18px 10px; }
  .deck-actions { grid-template-columns: 1fr 1fr; }
  .deck-actions > :first-child { grid-column: 1 / -1; }
  .deck-row { gap: 10px; }
  .row-controls { gap: 8px; }
  .saved-deck { flex-direction: column; align-items: start; gap: 2px; }
  .prose { padding: 14px; }
}
/* Five page buttons leave no room for the table colors on a phone. */
@media (max-width: 640px) {
  .tints, .taskbar .socials { display: none; }
  .task { font-size: .82rem; padding: 4px 3px; }
  .taskbar, .taskbar nav { gap: 4px; }
}
@media (max-width: 460px) {
  .ranking-grid, .draft-card-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .ranking-meta { flex-direction: row; }
  .commander-portrait { width: 75px; }
  .task { font-size: .76rem; padding: 4px 2px; }
  .tints { gap: 3px; padding: 0 4px; }
  .tint.mana { width: 18px; height: 18px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; animation: none !important; }
}

/* Task-focused layouts retain the carved frames while quieting the work areas. */
body { background-image: linear-gradient(#18171ba6, #18171ba6), var(--table); }
.button:not(.default), .small-button, .task { background: #302b35; image-rendering: auto; }
button, input, select, .task, .currency { font-family: system-ui, sans-serif; }
input, select { font-size: .9rem; }
.task { font-size: .82rem; }
.currency { font-size: .75rem; }
.disclosure { min-width: 0; margin: 16px 0; border-top: 1px solid var(--rule); }
.disclosure > summary { cursor: pointer; padding: 12px 0; color: var(--link); }
.disclosure > .window-body { padding: 4px 0 12px; }
.disclosure > .note { margin: 0 0 12px; }
.disclosure.window > summary { padding: 12px 16px; }
.disclosure.window > .window-body { padding: 0 16px 16px; }
.page-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 10px 16px; margin: 12px 0; }
.page-actions a { max-width: 100%; white-space: normal; }
.budget-remaining { margin: 12px 0; }
.strategy { font-size: .88rem; color: var(--text); text-transform: lowercase; }
.strategy::first-letter { text-transform: uppercase; }
.filters .search-field { grid-column: 1 / -1; grid-row: 1; }
.filters .search-field input { max-width: 100%; }
#decklist, #suggestions, #basic-lands, #upgrade-swaps { scroll-margin-top: 20px; }
.suggestion-search { margin-bottom: 12px; }
#suggestion-list { max-height: 32rem; overflow: auto; scrollbar-gutter: stable; }
.comparison-packs tbody th { min-width: 160px; }
.comparison-packs thead th:nth-child(2) { text-align: right; }
.comparison-packs .set-code { display: block; }
.save-draft { flex-wrap: wrap; }
.build-commander > div { min-width: 0; }
.build-commander h1 { overflow-wrap: anywhere; }
.draft-stats { flex-wrap: wrap; }

@media (max-width: 760px) {
  body { padding-bottom: calc(76px + env(safe-area-inset-bottom)); }
  .taskbar { padding-bottom: calc(7px + env(safe-area-inset-bottom)); gap: 5px; }
  .taskbar nav:not(.currency) { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 3px; }
  .task, .task[aria-current] { padding: 4px 2px; min-height: 44px; font-size: .73rem; white-space: normal; text-align: center; }
  .task span { overflow: visible; text-overflow: clip; }
  .start, .start:active { padding: 4px; min-height: 44px; }
  .start img { width: 24px; }
  .taskbar nav.currency { flex-direction: column; justify-content: center; gap: 2px; padding: 2px 5px; font-size: .65rem; }
  .currency a { min-width: 30px; min-height: 24px; text-align: center; }
  .button, .small-button { min-height: 44px; }
  .tints, .taskbar .socials { display: none; }
  .disclosure { margin: 12px 0; }
  .build-settings { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .build-settings label { min-width: 0; }
  .draft-stats > div { padding: 6px 10px; }
  .build-actions .button, .save-draft .button { white-space: normal; }
  .land-row { flex-wrap: wrap; }
  .land-row label { flex-basis: calc(100% - 88px); }
  .land-row button { margin-left: auto; }
  .deck-row { align-items: start; }
  .row-controls { flex-direction: column; gap: 4px; }

  /* Keep each comparison together on a phone. Explicit table roles preserve
     table semantics when the visual rows become cards. */
  .swap-table, .precon-table, .comparison-packs { display: block; width: 100%; }
  .swap-table thead, .precon-table thead, .comparison-packs thead {
    position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden; clip: rect(0, 0, 0, 0);
  }
  .swap-table tbody, .precon-table tbody, .comparison-packs tbody { display: block; }
  .swap-table tbody tr, .precon-table tbody tr, .comparison-packs tbody tr {
    display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px;
    padding: 14px 10px; border-bottom: 1px solid var(--rule);
  }
  .swap-table tbody th, .swap-table tbody td,
  .precon-table tbody th, .precon-table tbody td,
  .comparison-packs tbody th, .comparison-packs tbody td {
    min-width: 0; padding: 0; border: 0; white-space: normal; text-align: left;
  }
  .swap-table [data-label]::before, .precon-table [data-label]::before, .comparison-packs [data-label]::before {
    content: attr(data-label); display: block; font-size: .78rem; color: var(--muted); font-weight: 400; margin-bottom: 3px;
  }
  .swap-table tbody th, .swap-table td.cut, .swap-table td.choices { grid-column: 1 / -1; }
  .swap-table tbody td:first-child { display: none; }
  .swap-table td.cut { min-width: 0; }
  .swap-face { width: 62px; }
  .swap-card > div { min-width: 0; }
  .swap-table .role, .swap-table .badge { white-space: normal; }
  .choices label { min-height: 44px; white-space: normal; font-size: .86rem; }
  .precon-table tbody th, .comparison-packs tbody th { grid-column: 1 / -1; }
  .precon-table .year-row { padding: 10px; }
  .precon-table .year-row th { font-size: 1.1rem; }
  .precon-name img { width: 56px; }
  .comparison-packs tbody th { font-size: 1rem; }
  .comparison-packs tbody td:nth-child(2) { grid-column: 1 / -1; }
  .comparison-packs tbody td:nth-child(n+5) { font-size: .8rem; }
}

@media (max-width: 360px) {
  /* Keep all task labels readable; the footer still links to the homepage. */
  .taskbar .start { display: none; }
}

/* Landing pages of the ranking */
.crumbs { display: flex; flex-wrap: wrap; gap: 6px; font-size: .86rem; color: var(--muted); }
.hub-links { display: flex; flex-wrap: wrap; gap: 6px 18px; list-style: none; margin: 0 0 10px; padding: 0; }
.hub-links a { display: inline-flex; align-items: center; gap: 6px; }
.hub-group + .hub-group { margin-top: 14px; }
.hub-group h2, .hub-precons h2 { margin-bottom: 8px; }
.hub-precons { margin-bottom: 18px; }
.hub-index { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 8px 24px; list-style: none; margin: 0 0 22px; padding: 0; }
.hub-index li { display: flex; flex-direction: column; }
.h1-kind { display: block; font-size: .55em; font-weight: 400; color: var(--muted); }
.deck-about { margin: 22px 0 6px; max-width: 820px; }
.deck-about p { margin-bottom: 10px; }
.hub-search { margin-top: 16px; }

/* Command Zone template page */
.template-form { display: grid; gap: 8px; margin: 14px 0 22px; }
.template-form label { font-weight: 700; }
.template-form textarea { display: block; width: 100%; padding: 8px 10px; resize: vertical; font: inherit; color: var(--text); background: var(--paper); border: 0; border-radius: 0; box-shadow: var(--sunken); }
.template-form textarea:focus { outline: 2px solid var(--gold); outline-offset: 1px; }
.template-form .button { justify-self: start; }
.template-result { margin-bottom: 26px; }
.template-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 2px 20px; list-style: none; margin: 0 0 12px; padding: 0; }
.popup-text .popup-deck { display: block; width: max-content; max-width: 100%; margin-top: 10px; }

/* The deck page as its own share picture (1200 x 630): "#shot" in the address drops
   the navigation and keeps the commander, the price, and the top of the list. */
body:has(#shot:target) :is(.taskbar, .crumbs, .skip, .demo-banner, .deck-toolbar, .flip, .deck-actions) { display: none; }
body:has(#shot:target) .page { padding-top: 14px; }
body:has(#shot:target) .commander-portrait { width: 152px; height: auto; }
body:has(#shot:target) .deck-side :is(.strategy, .note, .colors, .draft-notice, .warning, .disclosure) { display: none; }
body:has(#shot:target) .deck-side .window-body::after { content: "budgetbauble.com"; display: block; margin-top: 10px; font: 400 1.2rem var(--display); color: var(--gold); letter-spacing: .02em; }
