/* The palette is Wooly's character sheet: light lavender #c7ccf6, pale grey #e9edf2, dark slate purple #797397, mint #91e9e4, periwinkle #a2a0fc,
   pink #edc3d6 (on #fcfbfc). Everything that has a colour uses these variables, so the whole look changes here. Lavender-blue (--focus) marks
   where you are and what is selected; pink (--accent) marks the main action; mint is for good news and small highlights. */
:root {
  color-scheme: dark;
  --bg: #2c2641;                                          /* a dusky mauve-plum, from the sheet's slate purple: twilight, not midnight */
  --surface: #38314f;
  --border: #4d4570;
  --fg: #fbf8ff;
  --muted: #cdc5e3;
  --forbidden: #ff8aa6;
  --limited: #ffbe8a;
  --semi: #f2dc8a;
  --ok: #91e9e4;
  --focus: #a2a0fc;
  --on-primary: #1f1a33;
  --on-tier: #1f1a33;
  --accent: #edc3d6;
  --on-accent: #2b1d2f;
  --nav: #f0eaff;
  --hover: rgba(162, 160, 252, .22);
  --hover-soft: rgba(162, 160, 252, .12);
  --glass: rgba(44, 38, 65, .72);
  --glow-a: rgba(162, 160, 252, .34);
  --glow-b: rgba(237, 195, 214, .32);
  --glow-c: rgba(145, 233, 228, .16);
  --mint: #91e9e4;
  --mint-glow: rgba(145, 233, 228, .26);
  --card-edge: rgba(205, 197, 255, .40);
  --card-shadow: rgba(15, 10, 35, .40);
  --tab-end: #e0b4e6;
  --pink-line: #edc3d6;
  --cta-glow: rgba(237, 195, 214, .32);
  --shadow: 0 8px 28px rgba(10, 5, 30, .55);
}

/* Nunito: a soft, rounded font (SIL Open Font License, see /static/fonts/OFL.txt), served from this site; it falls back to the system font while loading. */
@font-face {
  font-family: "Nunito"; font-style: normal; font-weight: 200 1000; font-display: swap;
  src: url("/static/fonts/nunito-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "Nunito"; font-style: normal; font-weight: 200 1000; font-display: swap;
  src: url("/static/fonts/nunito-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

* { box-sizing: border-box; }

/* The page's scrollbar always has its room, so a short tab and a long one are the same width and nothing slides sideways when you switch. */
html { scrollbar-gutter: stable; }
@supports not (scrollbar-gutter: stable) { html { overflow-y: scroll; } }

body {
  margin: 0;
  background:
    radial-gradient(62rem 40rem at 4% -10%, var(--glow-a), transparent 68%),
    radial-gradient(54rem 36rem at 100% 0%, var(--glow-b), transparent 68%),
    radial-gradient(70rem 40rem at 50% 112%, var(--glow-c), transparent 68%),
    var(--bg);
  background-attachment: fixed;
  color: var(--fg);
  font-family: "Nunito", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  line-height: 1.45;
}

.sr-only {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap;
}

.muted { color: var(--muted); }

main { max-width: 72rem; margin: 0 auto; padding: 20px 16px 0; }
/* the header is not a separate colour: the page's own, see-through and frosted, with the bar's contents kept to the content's width */
.top { background: var(--glass); -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px); position: relative; z-index: 15; }      /* (below the card details and the picture viewer) */
h1 { margin: 0; font-size: 1.35rem; }                       /* (the site's name, shown only while there is no logo) */
.brand { grid-area: brand; justify-self: start; display: flex; align-items: center; min-height: 2.75rem; }
.brand-link { display: flex; align-items: center; color: inherit; text-decoration: none; border-radius: 10px; }
.brand-link:focus-visible { outline: 2px solid var(--focus); outline-offset: 4px; }          /* keeps its room while the logo loads, so nothing jumps */
#title-text:empty { display: none; }
.logo { display: block; width: auto; height: auto; max-width: 100%; max-height: 2.75rem; border-radius: 8px; }      /* small, like the menu text, with the page's rounded corners */
/* the top bar, in three zones like the reference: the logo on the left, the pages in the middle, the buttons on the right */
.bar { display: grid; grid-template-columns: 1fr auto 1fr; grid-template-areas: "brand tabs actions"; align-items: center; gap: 10px 24px; max-width: 72rem; min-height: 5rem; margin: 0 auto; padding: 12px 16px; }
.status.friendly { font-size: 1.05rem; }
.top p { margin: 0 0 14px; }

.tools { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px; margin-bottom: 8px; }
.search input {
  width: min(22rem, 100%);
  padding: 10px 18px;
  font: inherit;
  color: var(--fg);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
}
.sort { display: flex; align-items: center; gap: 8px; }
.tiers { display: flex; flex-wrap: wrap; gap: 8px; margin: 0; padding: 0; border: 0; min-width: 0; }
.chip { --tier: var(--muted); }
.chip[data-tier="forbidden"] { --tier: var(--forbidden); }
.chip[data-tier="limited"] { --tier: var(--limited); }
.chip[data-tier="semi_limited"] { --tier: var(--semi); }
.chip {
  position: relative; display: inline-flex; align-items: center; gap: 8px; padding: 8px 12px; cursor: pointer; user-select: none;
  color: var(--muted); background: var(--surface); border: 1px solid var(--border); border-radius: 999px;
}
.chip::before { content: ""; width: 10px; height: 10px; border-radius: 50%; border: 2px solid var(--tier); box-sizing: border-box; }
.chip input { position: absolute; opacity: 0; width: 1px; height: 1px; pointer-events: none; }      /* still a real checkbox for keyboards and screen readers */
.chip:has(input:checked) { color: var(--fg); font-weight: 600; border-color: var(--tier); }
.chip:has(input:checked)::before { background: var(--tier); }
.chip:has(input:not(:checked)) span { text-decoration: line-through; }
.chip:has(input:disabled) { cursor: default; opacity: 0.6; }
.chip:has(input:focus-visible) { outline: 2px solid var(--focus); outline-offset: 2px; }
.sort select {
  padding: 10px 14px; font: inherit; color: var(--fg);
  background: var(--surface); border: 1px solid var(--border); border-radius: 999px;
}
.sort select:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.search input:focus, .sort select:focus { border-color: var(--pink-line); }
.search input:focus-visible, .card:focus-visible, .close:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }

.status { padding: 32px 0; text-align: center; color: var(--muted); }
.status.error { color: var(--forbidden); }

.tabs { grid-area: tabs; display: flex; gap: 8px; margin: 0; }
.tab { padding: 11px 20px; text-align: center; white-space: nowrap; color: var(--nav); text-decoration: none; font-size: 1.05rem; font-weight: 600; border-radius: 999px; }
.tab:hover:not([aria-current="page"]) { color: var(--fg); background: var(--hover-soft); }
.tab[hidden] { display: none; }
.tab[aria-current="page"] { color: var(--on-primary); background: linear-gradient(135deg, var(--focus), var(--tab-end)); }      /* the page you are on: a lavender-to-orchid pill */
/* the bar's buttons (/site addbutton): the first is the solid main action, like the references' "Get started"; the others are softer */
.bar-actions { grid-area: actions; justify-self: end; display: flex; flex-wrap: wrap; justify-content: flex-end; align-items: center; gap: 10px; }
.bar-actions:empty { display: none; }
.bar-cta { padding: 11px 22px; font-size: 1rem; font-weight: 700; color: var(--on-accent); text-decoration: none; white-space: nowrap; background: var(--accent); border: 2px solid transparent; border-radius: 999px; box-shadow: 0 6px 18px var(--cta-glow); }
.bar-cta:hover { filter: brightness(1.1); }
.bar-cta.secondary { color: var(--fg); background: transparent; border-color: var(--focus); }
.bar-cta.secondary:hover { background: var(--hover-soft); filter: none; }
.bar-cta.discord { color: #fff; background: #5865f2; border-color: transparent; }
.bar-cta:focus-visible { outline: 2px solid var(--fg); outline-offset: 2px; }
/* a narrower screen (a phone, a small window): the logo with the buttons beside it, then the pages across the full width */
@media (max-width: 860px) {
  .bar { grid-template-columns: auto 1fr; grid-template-areas: "brand actions" "tabs tabs"; min-height: 0; padding-bottom: 8px; }
  .bar-cta { padding: 9px 14px; font-size: .95rem; }
  .bar-actions { gap: 8px; }
  .tabs { width: 100%; gap: 4px; }
  .tab { flex: 1 1 0; padding: 10px 4px; font-size: .95rem; }
}
/* wider screens: the bar stays at the top while the page scrolls (a two-row bar would use too much of a smaller screen) */
@media (min-width: 861px) {
  .top { position: sticky; top: 0; }
  .builder-switch { top: 5rem; }
}
.tab:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }

.check-form { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0 8px; }
.check-form input {
  flex: 1 1 18rem; min-width: 0;
  padding: 10px 12px; font: inherit; color: var(--fg);
  background: var(--surface); border: 1px solid var(--border); border-radius: 12px;
}
.check-form input:focus-visible, .primary:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.primary {
  padding: 10px 18px; font: inherit; font-weight: 600; color: var(--on-primary);
  background: var(--focus); border: 0; border-radius: 12px; cursor: pointer;
}
.primary:disabled { opacity: .55; cursor: progress; }

.banner { margin: 16px 0 12px; padding: 14px 16px; background: var(--surface); border: 1px solid var(--border); border-left: 6px solid var(--muted); border-radius: 14px; }
.banner.pass { border-left-color: var(--ok); }
.banner.fail { border-left-color: var(--forbidden); }
.banner.incomplete { border-left-color: var(--limited); }
.banner h2 { margin: 0 0 4px; font-size: 1.2rem; }
.banner p { margin: 0 0 2px; }
.problems { margin: 0 0 12px; padding-left: 1.2rem; }
.problems li { margin: 2px 0; }
.warning { margin: 0 0 10px; padding: 10px 12px; background: var(--surface); border: 1px solid var(--limited); border-radius: 8px; }
.tier-deck { --tier: var(--focus); }
.card.flagged { --tier: var(--forbidden); }
.card.flagged .art {
  outline: 5px solid var(--forbidden); outline-offset: -5px;
  box-shadow: 0 0 0 3px var(--bg), 0 0 0 5px var(--forbidden), 0 0 18px 6px var(--forbidden);
}
.card.flagged .art::before {                                  /* a red wash over the picture */
  content: ""; position: absolute; inset: 0; z-index: 1; pointer-events: none;
  background: rgba(255, 95, 130, .30);
}
.card.flagged .art::after {                                   /* a warning mark in the corner */
  content: "!"; position: absolute; left: 5px; top: 5px; z-index: 3;
  width: 26px; height: 26px; line-height: 26px; text-align: center;
  font-size: 1.05rem; font-weight: 800; color: var(--on-tier); background: var(--forbidden);
  border: 2px solid #fff; border-radius: 50%; box-shadow: 0 1px 5px rgba(0, 0, 0, .6);
}
.card.flagged .badge { z-index: 3; }
.card.flagged .name { color: var(--forbidden); font-weight: 800; }


section { margin: 40px 0 10px; }
section h2 { display: flex; align-items: center; gap: 12px; margin: 0 0 14px; font-size: 1.5rem; line-height: 1.2; }
section h2 .sub { padding: 2px 12px; font-size: .85rem; font-weight: 600; color: var(--fg); background: var(--mint-glow); border-radius: 999px; }
section h3.subheading { display: flex; align-items: baseline; gap: 8px; margin: 26px 0 10px; font-size: 1rem; font-weight: 600; color: var(--muted); }
section h2::before { content: ""; align-self: center; width: 13px; height: 13px; border-radius: 50%; background: var(--tier); box-shadow: 0 0 12px var(--tier); }
.tier-forbidden { --tier: var(--forbidden); }
.tier-limited { --tier: var(--limited); }
.tier-semi_limited { --tier: var(--semi); }
.group-plain { --tier: var(--muted); }
/* a card's badge always shows its own limit's colour, whichever way the list is grouped */
.card.t-forbidden { --tier: var(--forbidden); }
.card.t-limited { --tier: var(--limited); }
.card.t-semi_limited { --tier: var(--semi); }

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(96px, 1fr));
  gap: 12px;
  margin: 0; padding: 0; list-style: none;
}

.card {
  position: relative;
  display: flex; flex-direction: column; gap: 6px;
  width: 100%;
  padding: 0;
  font: inherit; color: inherit; text-align: center;
  background: none; border: 0; cursor: pointer;
}
.card .art {
  display: block;
  position: relative;
  aspect-ratio: 421 / 614;
  overflow: hidden;
  border-radius: 10px;
  border: 1px solid var(--card-edge);
  box-shadow: 0 6px 16px var(--card-shadow);
  background: var(--surface);
  transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
}
.card:hover .art, .card:focus-visible .art { transform: translateY(-4px); border-color: var(--mint); box-shadow: 0 12px 26px var(--mint-glow); }
@media (prefers-reduced-motion: reduce) { .card .art { transition: none; } .card:hover .art, .card:focus-visible .art { transform: none; } }
.card img { display: block; width: 100%; height: 100%; object-fit: cover; }
.card .name {
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
  font-size: .78rem; line-height: 1.25;
}
/* a card with no picture: the name takes the picture's place */
.card.noimage .art { display: grid; place-items: center; padding: 6px; font-size: .78rem; }
.card.noimage .art img { display: none; }

.badge {
  position: absolute; top: 4px; right: 4px; z-index: 1;
  min-width: 22px; padding: 1px 6px;
  font-size: .75rem; font-weight: 700; line-height: 1.4; text-align: center;
  color: var(--on-tier); background: var(--tier);
  border-radius: 999px;
  box-shadow: 0 1px 4px rgba(0, 0, 0, .45);
}

/* The detail panel: floats beside the card (mouse) or sits at the bottom of the screen (touch) */
.panel {
  position: fixed; z-index: 20;
  width: min(35rem, calc(100vw - 24px));
  max-height: calc(100vh - 16px);
  overflow: auto;
  padding: 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: var(--shadow);
}
.panel[hidden], .backdrop[hidden] { display: none; }
.panel.sheet { left: 0; right: 0; bottom: 0; width: auto; max-height: 92vh; border-radius: 14px 14px 0 0; }
.panel.floating { pointer-events: none; }               /* a hover panel never steals the mouse */
.backdrop { position: fixed; inset: 0; z-index: 19; background: rgba(0, 0, 0, .45); }

.detail { display: grid; grid-template-columns: 13rem 1fr; gap: 16px; }
.detail img { display: block; width: 100%; border-radius: 6px; background: var(--bg); aspect-ratio: 421 / 614; object-fit: cover; }
.detail.noimage { grid-template-columns: 1fr; }
.detail.noimage img { display: none; }
.detail h3 { margin: 0 0 6px; font-size: 1.3rem; line-height: 1.2; }
.detail .tierline { margin: 0 0 10px; font-size: .95rem; font-weight: 700; color: var(--tier); }
.detail .meta, .detail .stats { margin: 0 0 6px; font-size: .95rem; color: var(--muted); }
.detail .stats { color: var(--fg); font-weight: 700; font-size: 1.05rem; }
.detail .text { grid-column: 1 / -1; margin-top: 6px; font-size: 1rem; line-height: 1.45; }
.detail .text h4 { margin: 10px 0 3px; font-size: .85rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.detail .text p { margin: 0 0 8px; white-space: pre-wrap; }

.close {
  display: none;
  margin: 0 0 8px auto; padding: 6px 12px;
  font: inherit; color: var(--fg);
  background: var(--bg); border: 1px solid var(--border); border-radius: 8px; cursor: pointer;
}
.panel.sheet .close { display: block; }

@media (max-width: 720px) {
  .detail { grid-template-columns: minmax(8rem, 42%) 1fr; gap: 14px; }
  .detail h3 { font-size: 1.25rem; }
  .detail .meta, .detail .text { font-size: 1rem; }
  .panel { padding: 16px; }
}

@media (max-width: 480px) {
  .grid { grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); gap: 10px; }
}

/* The tournament info page: pictures of any shape, and a viewer for one at a time */
/* a tab's heading has the same room above and below on every tab (Info wraps its heading with the buttons, the others don't) */
.info-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0 20px; margin: 0 0 14px; }
.info-title { margin: 14px 0 12px; font-size: 1.75rem; font-weight: 700; line-height: 1.2; }
#intro, .tab-intro { margin: 0 0 12px; }
.info-title:empty { display: none; }
.info-title::after { content: "\2726"; margin-left: .4em; font-size: .5em; vertical-align: .75em; color: var(--pink-line); }          /* a small sparkle */

.info-grid {
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: 18px;     /* two columns: each picture is half the page */
  grid-auto-rows: 4px;                                                                /* the page gives each tile a span of these (layoutInfo), so pictures stack snugly */
  margin: 0 0 24px; padding: 0; list-style: none;
}
.info-grid > li { padding-bottom: 18px; }                                              /* the gap under a picture (TILE_GAP_PX) */
@media (max-width: 700px) { .info-grid { grid-template-columns: minmax(0, 1fr); } }          /* one column on a phone */
.info-tile {
  display: block; width: 100%; padding: 0; cursor: zoom-in;
  background: var(--surface); border: 1px solid var(--border); border-radius: 16px; overflow: hidden;
}
.info-tile:hover { border-color: var(--focus); }
.info-tile:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
/* width and height attributes give the picture its shape before it loads; height: auto keeps that shape at any width */
.info-tile img { display: block; width: 100%; height: auto; }

.lightbox {
  position: fixed; inset: 0; z-index: 40;
  display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 8px;
  padding: 12px; background: rgba(0, 0, 0, .92);
  touch-action: pan-y;
}
.lightbox[hidden] { display: none; }
.lb-figure { margin: 0; display: grid; justify-items: center; align-items: center; gap: 10px; min-width: 0; }
.lb-figure img {
  display: block; max-width: 100%; object-fit: contain;                           /* its size comes from the page (Views.fitWithin) */
  background: #111; border-radius: 6px;
}
.lb-nav, .lb-close {
  color: #fff; background: rgba(255, 255, 255, .14); border: 0; border-radius: 999px; cursor: pointer;
  font: inherit; line-height: 1;
}
.lb-nav { width: 48px; height: 48px; font-size: 2rem; }
.lb-close { position: absolute; top: 10px; right: 10px; z-index: 1; width: 44px; height: 44px; font-size: 1.2rem; }
.lb-nav:hover, .lb-close:hover { background: rgba(255, 255, 255, .28); }
.lb-nav:focus-visible, .lb-close:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }
.lb-nav[hidden] { display: none; }

@media (max-width: 600px) {
  .lightbox { grid-template-columns: 1fr; align-content: center; padding: 8px; }
  .lb-nav { position: absolute; top: 50%; transform: translateY(-50%); width: 42px; height: 42px; }
  .lb-prev { left: 6px; }
  .lb-next { right: 6px; }
}

/* ── The deck builder ─────────────────────────────────────────────────────── */

.builder { display: grid; grid-template-columns: minmax(260px, 24rem) minmax(0, 1fr); gap: 28px; align-items: start; }
.builder-switch { display: none; }
.builder-pane { min-width: 0; }
.builder .search input { width: 100%; }
.builder .hint { margin: 8px 0; min-height: 1.4em; font-size: .9rem; }
.builder section { margin: 18px 0 8px; }

.results {
  display: grid; gap: 6px; margin: 0; padding: 0; list-style: none;
  max-height: calc(100vh - 15rem); overflow-y: auto;                      /* the list scrolls on its own, the deck stays in view */
}
.result { display: flex; gap: 6px; }
.result-add {
  flex: 1 1 auto; min-width: 0; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 4px 10px;
  padding: 9px 12px; font: inherit; text-align: left; color: var(--fg); cursor: pointer;
  background: var(--surface); border: 1px solid var(--border); border-radius: 12px;
}
.result-add:hover { border-color: var(--focus); }
.result-add:focus-visible, .step:focus-visible, .plain:focus-visible, .pane-tab:focus-visible, .result-info:focus-visible,
.code-row input:focus-visible, .open-form input:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.r-name { font-weight: 600; overflow-wrap: anywhere; }
.r-tags { display: inline-flex; flex-wrap: wrap; gap: 6px; font-size: .78rem; }
.r-tag, .r-count { color: var(--muted); }
.r-count { font-weight: 700; color: var(--focus); }
.limit-chip { --tier: var(--muted); padding: 0 8px; font-weight: 700; color: var(--tier); border: 1px solid var(--tier); border-radius: 999px; }
.limit-chip.t-forbidden { --tier: var(--forbidden); }
.limit-chip.t-limited { --tier: var(--limited); }
.limit-chip.t-semi_limited { --tier: var(--semi); }
.result-info { display: none; width: 40px; flex: none; font: italic 700 1rem Georgia, serif; color: var(--muted); background: var(--surface); border: 1px solid var(--border); border-radius: 8px; cursor: pointer; }
@media (hover: none) { .result-info { display: block; } }

/* how the deck stands: one card, a headline, two size chips, and any card problems */
.status-card { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin: 0 0 12px; padding: 14px 16px; background: var(--surface); border: 1px solid var(--border); border-left: 6px solid var(--muted); border-radius: 14px; }
.status-card[data-state="ready"] { border-left-color: var(--ok); }
.status-card[data-state="problem"] { border-left-color: var(--forbidden); }
.summary { min-width: 0; }
.summary h2 { margin: 0 0 8px; font-size: 1.2rem; }
.summary p { margin: 0; }
.count-chips { display: flex; flex-wrap: wrap; gap: 6px 8px; }
.count-chip { padding: 2px 12px; font-size: .9rem; color: var(--fg); background: var(--hover-soft); border-radius: 999px; }
.count-chip.bad { color: var(--forbidden); background: rgba(255, 138, 166, .16); }
.summary .problems { margin: 10px 0 0; }
/* small quiet actions: Clear deck, and Open a deck link */
.text-button { padding: 4px 8px; font: inherit; font-size: .9rem; color: var(--muted); text-decoration: underline; text-underline-offset: 3px; background: none; border: 0; border-radius: 8px; cursor: pointer; }
.text-button:hover:not(:disabled) { color: var(--fg); }
.text-button:disabled { opacity: .4; cursor: default; text-decoration: none; }
.text-button:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.status-card .text-button { flex: none; }
.open-line { margin: 4px 0 0; }
.deck-actions { margin: 12px 0; }
.primary.big { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px; width: 100%; padding: 12px 18px; color: var(--on-accent); background: var(--accent); border-radius: 999px; box-shadow: 0 6px 18px var(--cta-glow); }
.primary.big.quiet { color: var(--fg); background: transparent; border: 2px solid var(--focus); box-shadow: none; }      /* while the deck has a problem the button is quiet: you can still use it, but it isn't the moment */
.primary.big .cta { font-size: 1.1rem; }
.primary.big .cta-sub { font-size: .8rem; font-weight: 400; opacity: .9; }
.plain {
  padding: 10px 16px; font: inherit; font-weight: 600; color: var(--fg); cursor: pointer;
  background: var(--surface); border: 1px solid var(--border); border-radius: 12px;
}
.plain:disabled { opacity: .5; cursor: default; }
.primary:disabled { cursor: default; }
.code-box { margin: 6px 0 12px; padding: 12px; background: var(--surface); border: 1px solid var(--border); border-radius: 14px; }
.code-box[hidden] { display: none; }
.code-row { display: flex; gap: 8px; }
.code-row .plain { min-width: 7.5rem; }                              /* (so the button doesn't change width when it says Copied)*/
.plain.done { color: var(--ok); border-color: var(--ok); }
.code-row input, .open-form input {
  flex: 1 1 auto; min-width: 0; padding: 10px 12px; font: .9rem ui-monospace, Menlo, Consolas, monospace; color: var(--fg);
  background: var(--bg); border: 1px solid var(--border); border-radius: 12px;
}
.code-note { margin: 8px 0 0; font-size: .9rem; color: var(--muted); }
.code-note.error, #open-message.error { color: var(--forbidden); }
.open-form { display: flex; gap: 8px; margin: 8px 0 4px; }
.open-form[hidden] { display: none; }
.open-form input { font-family: inherit; }
#open-message { margin: 0 0 8px; font-size: .9rem; }
#open-message:empty { display: none; }

/* each card in the deck: its tile, with a minus and a plus under it */
.deck-card { display: flex; flex-direction: column; gap: 6px; }
.deck-controls { display: flex; gap: 6px; }
.step {
  flex: 1; padding: 4px 0; font: inherit; font-weight: 700; line-height: 1.2; color: var(--fg); cursor: pointer;
  background: var(--surface); border: 1px solid var(--border); border-radius: 6px;
}
.step:hover:not(:disabled) { border-color: var(--focus); }
.step:disabled { opacity: .4; cursor: not-allowed; }

/* a phone: one pane at a time, with two buttons to switch */
@media (max-width: 899px) {
  .builder { grid-template-columns: minmax(0, 1fr); gap: 12px; }
  .builder-switch { display: flex; gap: 8px; position: sticky; top: 0; z-index: 5; padding: 8px 0; background: var(--bg); }
  .pane-tab {
    flex: 1; padding: 10px; font: inherit; font-weight: 600; color: var(--muted); cursor: pointer;
    background: var(--surface); border: 1px solid var(--border); border-radius: 12px;
  }
  .pane-tab[aria-pressed="true"] { color: var(--fg); border-color: var(--focus); }
  .pane-tab.has-problems #pane-count { color: var(--forbidden); }
  .builder[data-pane="cards"] #builder-deck, .builder[data-pane="deck"] #builder-cards { display: none; }
  .results { max-height: none; overflow: visible; }
}

/* a card list's detail (the deck builder's search results): narrower, so it fits under the row inside the list's own column */
.panel.compact { padding: 12px; }
.panel.compact .detail { grid-template-columns: 8rem 1fr; gap: 12px; }
.panel.compact .detail h3 { font-size: 1.1rem; }
.panel.compact .detail .meta, .panel.compact .detail .text { font-size: .95rem; }

/* the buttons under every deck card line up, whatever the names' lengths: the name always takes two lines' room and the
   buttons sit at the bottom */
.deck-card { height: 100%; }
.deck-card .card { flex: 1 1 auto; }
.deck-card .card .name { min-height: 2.5em; }
.deck-controls { margin-top: auto; }

/* a phone: the two main buttons stay at the bottom of the screen while the deck scrolls past, so they are always in reach */
@media (max-width: 899px) {
  #builder-deck { display: flex; flex-direction: column; }
  .deck-actions {
    order: 99;                                  /* last in the pane: a bar only sticks to the bottom while it is below the screen */
    position: sticky; bottom: 0; z-index: 4; margin: 12px -16px 0; padding: 10px 16px;
    background: var(--bg); border-top: 1px solid var(--border);
  }
}

/* the deck's name: a pill field with its character count inside at the right */
.name-field { position: relative; margin: 0 0 12px; }
.name-field input { width: 100%; padding: 10px 64px 10px 18px; font: inherit; font-weight: 600; color: var(--fg); background: var(--surface); border: 1px solid var(--border); border-radius: 999px; }
.name-field input::placeholder { font-weight: 400; color: var(--muted); }
.name-field input:focus { border-color: var(--pink-line); }
.name-field input:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.name-count { position: absolute; right: 18px; top: 50%; transform: translateY(-50%); font-size: .8rem; color: var(--muted); pointer-events: none; }

/* the card shown in the deck's link preview: a small button in the name field (the card's picture and a caret) that opens a list of the deck's cards */
.featured-btn { position: absolute; right: 52px; top: 50%; transform: translateY(-50%); display: flex; align-items: center; gap: 4px; height: 34px; padding: 0 6px; color: var(--muted); background: transparent; border: 1px solid transparent; border-radius: 10px; cursor: pointer; font: inherit; }
.featured-btn[hidden] { display: none; }
.featured-btn:hover, .featured-btn[aria-expanded="true"] { border-color: var(--focus); color: var(--fg); }
.featured-btn:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.featured-btn img { display: block; width: 24px; height: 35px; margin: -2px 0; border-radius: 3px; object-fit: cover; box-shadow: 0 1px 4px rgba(0, 0, 0, .5); }
.featured-btn img[hidden] { display: none; }
.featured-btn.auto::before { content: ""; width: 22px; height: 30px; border: 1.5px dashed currentColor; border-radius: 3px; }
.featured-btn:not(.auto)::before { content: none; }
.name-field.has-picker input { padding-right: 112px; }
.featured-menu { position: absolute; z-index: 12; right: 0; top: calc(100% + 6px); width: min(22rem, 100%); max-height: min(22rem, 60vh); overflow: auto; padding: 6px; background: var(--surface); border: 1px solid var(--border); border-radius: 14px; box-shadow: 0 12px 32px rgba(0, 0, 0, .45); }
.featured-menu[hidden] { display: none; }
.featured-menu .menu-note { margin: 4px 8px 6px; font-size: .8rem; color: var(--muted); }
.featured-option { display: flex; align-items: center; gap: 10px; width: 100%; padding: 5px 8px; font: inherit; font-size: .92rem; text-align: left; color: var(--fg); background: none; border: 0; border-radius: 10px; cursor: pointer; }
.featured-option:hover, .featured-option:focus-visible { background: var(--hover-soft); outline: none; }
.featured-option[aria-selected="true"] { color: var(--mint); font-weight: 700; }
.featured-option img { flex: none; width: 24px; height: 35px; border-radius: 3px; object-fit: cover; }
.featured-option .no-art { flex: none; display: block; width: 24px; height: 35px; border: 1.5px dashed var(--muted); border-radius: 3px; }
