[hidden] { display: none !important; }

:root {
  --bg: #16150f;
  --surface: #201e17;
  --surface-2: #2b291f;
  --line: #3a382c;
  --text: #eae6d8;
  --muted: #a8a394;
  --accent: #c8853b;
  --accent-ink: #1b1305;
  --radius: 12px;
  --pad: 16px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 16px;
  line-height: 1.5;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 5;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  padding: max(env(safe-area-inset-top), 12px) var(--pad) 12px;
}
.topbar h1 { margin: 0 0 8px; font-size: 18px; font-weight: 600;
  display: flex; align-items: center; flex-wrap: wrap; }
/* Section nav — plain sibling links, same set and same order on every page.
   These were a mix of "‹ Home" and "Collection ›", where the arrows read as
   browser back/forward even though every one is an ordinary link to a section.
   Genuine back links (add.html, playtest.html) still use .back and keep the ‹. */
.crumbs { display: flex; flex-wrap: wrap; align-items: center; gap: 14px; margin-bottom: 6px; }
/* same icons the home page's tiles use, so a destination looks the same
   wherever it's linked from */
.crumbs a { display: inline-flex; align-items: center; gap: 5px;
  font-size: 13px; color: var(--muted); text-decoration: none; }
.crumbs a > span { font-size: 15px; line-height: 1; }
/* painted icons rather than emoji: same slot, but they carry the house style
   and render identically on every platform instead of per-OS emoji fonts */
.crumb-ic { flex: 0 0 auto; width: 20px; height: 20px; border-radius: 5px;
  object-fit: cover; }
.crumbs a:hover { color: var(--accent); }
.crumb-act { margin-left: auto; }   /* Playtest is an action, not a section */
.app-logo { width: 28px; height: 28px; border-radius: 50%; margin-right: 8px;
  object-fit: cover; }
/* deck page only: the logo carries the bracket, so it needs room to read */
.deck-logo { width: 52px; height: 52px; margin-right: 12px; flex: none;
  border: 1px solid var(--line); box-shadow: 0 2px 10px rgba(0,0,0,.25); }
.user-chip { position: absolute; top: max(env(safe-area-inset-top), 12px); right: var(--pad);
  font-size: 12px; color: var(--muted); }
.user-chip a { color: var(--accent); text-decoration: none; }
.user-chip a:hover { text-decoration: underline; }

/* --- sign-in page --- */
.signin-body { display: flex; align-items: center; justify-content: center;
  min-height: 100vh; padding: 20px; }
.signin-card { background: var(--surface); border: 1px solid var(--line);
  border-radius: 18px; padding: 32px 28px calc(env(safe-area-inset-bottom) + 28px);
  max-width: 380px; width: 100%; text-align: center; }
.signin-logo { width: 200px; height: 200px; border-radius: 50%; object-fit: cover;
  display: block; margin: 0 auto 18px; box-shadow: 0 8px 40px rgba(200,133,59,.25); }
.signin-title { margin: 0 0 22px; font-size: 24px; font-weight: 700; }
.signin-title span { color: var(--accent); font-weight: 500; }
.signin-buttons { display: flex; flex-direction: column; gap: 10px; }
.signin-btn { display: flex; align-items: center; justify-content: center; gap: 10px;
  padding: 12px 18px; font-size: 15px; font-weight: 500; color: var(--text);
  background: var(--surface-2); border: 1px solid var(--line);
  border-radius: var(--radius); text-decoration: none; cursor: pointer; }
.signin-btn:hover { border-color: var(--accent); color: var(--accent); }
.signin-ic { font-weight: 700; }
.signin-note { color: var(--muted); font-size: 13px; margin: 0 0 4px; }
.signin-foot { color: var(--muted); font-size: 12px; margin: 22px 0 0; }

#searchForm { margin: 0; }
#q {
  width: 100%;
  padding: 12px 14px;
  font-size: 16px;                /* 16px prevents iOS zoom-on-focus */
  color: var(--text);
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
#q:focus { outline: 2px solid var(--accent); border-color: var(--accent); }

.hint { margin: 8px 0 0; font-size: 12px; color: var(--muted); }
.hint code {
  background: var(--surface-2);
  padding: 1px 5px;
  border-radius: 5px;
  font-size: 11px;
}

main { padding: var(--pad); max-width: 1100px; margin: 0 auto; }
.status { color: var(--muted); text-align: center; padding: 24px 0; }

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

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  cursor: pointer;
  text-align: left;
  padding: 0;
  color: inherit;
  font: inherit;
  transition: border-color .12s ease;
}
.card:hover, .card:focus-visible { border-color: var(--accent); outline: none; }
.card .art {
  width: 100%;
  aspect-ratio: 626 / 457;        /* Scryfall art_crop ratio */
  object-fit: cover;
  background: var(--surface-2);
  display: block;
}
.card .meta { padding: 8px 10px; }
.card .name { font-size: 14px; font-weight: 500; }
.card .sub { font-size: 12px; color: var(--muted); margin-top: 2px;
             display: flex; justify-content: space-between; gap: 8px; }

.more {
  display: block;
  margin: 20px auto;
  padding: 10px 20px;
  background: var(--surface-2);
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  font-size: 15px;
}

/* --- Detail / art-picker sheet --- */
.sheet { position: fixed; inset: 0; z-index: 20; display: flex; }
.sheet-scrim { position: absolute; inset: 0; background: rgba(0,0,0,.55); }
.sheet-panel {
  position: relative;
  margin-top: auto;
  width: 100%;
  max-height: 88vh;
  background: var(--surface);
  border-top-left-radius: 18px;
  border-top-right-radius: 18px;
  border-top: 1px solid var(--line);
  padding: 16px var(--pad) calc(env(safe-area-inset-bottom) + 20px);
  overflow-y: auto;
}
@media (min-width: 720px) {
  .sheet { align-items: center; justify-content: center; }
  .sheet-panel { margin: 0; max-width: 640px; border-radius: 18px; border: 1px solid var(--line); }
}

.sheet-head { display: flex; align-items: center; justify-content: space-between; }
.sheet-head h2 { margin: 0; font-size: 18px; }
.sheet-type { margin: 2px 0 4px; color: var(--muted); font-size: 13px; }
.sheet-text { margin: 0 0 12px; font-size: 14px; line-height: 1.5; white-space: pre-wrap; }
.icon-btn {
  background: none; border: none; color: var(--muted);
  font-size: 20px; cursor: pointer; padding: 4px 8px;
}
.pick-label { font-size: 13px; color: var(--muted); margin: 4px 0 10px; font-weight: 500; }

.print-grid {
  list-style: none; margin: 0; padding: 0;
  display: grid; gap: 10px;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
}
.print {
  background: var(--surface-2);
  border: 2px solid transparent;
  border-radius: 10px;
  overflow: hidden;
  cursor: pointer;
  padding: 0;
  text-align: left;
  color: inherit;
  font: inherit;
}
.print[aria-pressed="true"] { border-color: var(--accent); }
.print .art { width: 100%; aspect-ratio: 626 / 457; object-fit: cover; display: block; }
.print .meta { padding: 6px 8px; font-size: 12px; }
.print .set { text-transform: uppercase; font-weight: 500; letter-spacing: .03em; }
.print .price { color: var(--muted); }
.print .rarity-m { color: var(--accent); }
.any-print { display: flex; align-items: center; justify-content: center; min-height: 96px; }
.any-print .meta { text-align: center; }

/* --- deck view (P3) --- */
.back { color: var(--muted); text-decoration: none; font-size: 14px; display: inline-block; margin-bottom: 4px; }
.export-panel { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }
.export-panel button {
  padding: 8px 14px; font-size: 14px; color: var(--text);
  background: var(--surface-2); border: 1px solid var(--line);
  border-radius: var(--radius); cursor: pointer;
}
.export-panel button:hover { border-color: var(--accent); }
/* a button whose panel is currently open */
.export-panel button.on { border-color: var(--accent); color: var(--accent); }
/* hairline between groups of actions — settings | panels | destructive */
.act-sep { width: 1px; align-self: stretch; min-height: 24px; background: var(--line); margin: 0 4px; }
/* an outbound link dressed as one of the buttons beside it */
.tt-link { display: inline-flex; align-items: center; gap: 7px; padding: 6px 14px 6px 8px;
  font-size: 14px; color: var(--text); background: var(--surface-2);
  border: 1px solid var(--line); border-radius: var(--radius); text-decoration: none; }
.tt-link:hover { border-color: var(--accent); }
/* same medallion treatment as the crumb icons, one size up */
.tt-ic { width: 22px; height: 22px; border-radius: 5px; display: block; }

/* --- collapsible deck sections -------------------------------------------- */
/* This used to be bare text with a chevron, and it read as a heading rather
   than something you could press — so nobody pressed it. It is a button, so it
   looks like one. */
.sec-bar { display: flex; align-items: center; gap: 9px; width: 100%; margin: 0 0 10px;
  padding: 7px 11px; cursor: pointer; text-align: left;
  background: var(--surface-2); border: 1px solid var(--line); border-radius: 8px;
  font-family: inherit; font-size: 13px; font-weight: 600; color: var(--accent); }
.sec-bar:hover { background: var(--surface); border-color: var(--accent); }
.sec-bar:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
/* the chevron gets its own disc, so it reads as the affordance it is */
.sec-chev { flex: 0 0 auto; width: 18px; height: 18px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 10px; font-weight: 400; color: var(--accent);
  background: var(--surface); border: 1px solid var(--line); }
.sec-bar:hover .sec-chev { border-color: var(--accent); }
.sec-label { flex: 1 1 auto; }
.sec-n { color: var(--muted); font-weight: 400; font-variant-numeric: tabular-nums;
  background: var(--surface); border: 1px solid var(--line); border-radius: 999px;
  padding: 1px 8px; font-size: 11px; }
/* say what pressing it does, on the side you'd read last */
.sec-act { color: var(--muted); font-weight: 400; font-size: 11px;
  letter-spacing: .03em; text-transform: uppercase; opacity: 0; }
.sec-bar:hover .sec-act, .sec-bar:focus-visible .sec-act { opacity: 1; }
.sec.collapsed > .sec-bar .sec-act { opacity: .75; }
.sec.collapsed > *:not(.sec-bar) { display: none; }
.sec.collapsed .sec-bar { margin-bottom: 0; }
/* #deckBody is bare markup, not a panel, so its bar needs the breathing room */
#deckBody > .sec-bar { margin-top: 6px; }
.cat-head { font-size: 15px; font-weight: 600; margin: 18px 0 6px; color: var(--accent); }
.cat-sub { font-size: 13px; font-weight: 500; margin: 10px 0 2px 8px; color: var(--muted); }
#hoverCard { position: fixed; z-index: 60; width: 260px; border-radius: 12px;
  box-shadow: 0 10px 32px rgba(0,0,0,.6); pointer-events: none; background: var(--surface-2); }
.cardlist { list-style: none; margin: 0; padding: 0; }
.cardlist li {
  display: flex; gap: 10px; align-items: baseline;
  padding: 6px 4px; border-bottom: 1px solid var(--line);
}
.cardlist .q { width: 24px; color: var(--muted); text-align: right; font-variant-numeric: tabular-nums; }
.cardlist .nm { flex: 1; }
.cardlist .pr { color: var(--muted); font-size: 13px; font-variant-numeric: tabular-nums; }

/* --- salt summary (#8) --- */
.salt-panel { background: var(--surface); border: 1px solid var(--line);
              border-radius: var(--radius); padding: 12px 14px; margin-bottom: 16px; }
.salt-head { display: flex; align-items: baseline; gap: 10px; }
.salt-num { font-size: 26px; font-weight: 600; color: var(--accent);
            font-variant-numeric: tabular-nums; }
.salt-cap { color: var(--muted); font-size: 13px; }
.salt-list { list-style: none; margin: 8px 0 0; padding: 0; }
.salt-list li { display: flex; gap: 8px; align-items: baseline; padding: 3px 0; font-size: 14px; }
.salt-list .s { color: var(--accent); width: 40px; text-align: right;
                font-variant-numeric: tabular-nums; font-size: 13px; }
.salt-src { margin: 8px 0 0; font-size: 11px; color: var(--muted); }

/* --- analytics (#14) --- */
.an-panel { background: var(--surface); border: 1px solid var(--line);
            border-radius: var(--radius); padding: 14px; margin-bottom: 16px; }
.an-stats { display: flex; gap: 18px; flex-wrap: wrap; margin-bottom: 6px; }
.an-stats div { display: flex; flex-direction: column; }
.an-stats b { font-size: 22px; font-weight: 600; color: var(--accent); font-variant-numeric: tabular-nums; }
.an-stats span { font-size: 12px; color: var(--muted); }
.an-grid { display: grid; gap: 18px; grid-template-columns: 1fr; margin-top: 10px; }
@media (min-width: 640px) { .an-grid { grid-template-columns: repeat(3, 1fr); } }
.an-h { font-size: 13px; font-weight: 500; color: var(--muted); margin: 4px 0 8px; }
.an-row { display: grid; grid-template-columns: 34px 1fr 28px; gap: 8px; align-items: center; margin: 3px 0; }
.an-k { font-size: 12px; color: var(--muted); text-align: right; }
.an-v { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.an-bar { background: var(--surface-2); border-radius: 4px; height: 12px; overflow: hidden; }
.an-bar > span { display: block; height: 100%; background: var(--accent); border-radius: 4px; min-width: 2px; }

/* --- combos (Commander Spellbook) --- */
/* --- test hand (inside the hands & odds panel) ---------------------------- */
.hand-acts { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin: 6px 0 10px; }
.hand-grid { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px;
  grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); }
.hand-grid button { display: block; width: 100%; padding: 0; background: none; cursor: default;
  border: 2px solid transparent; border-radius: 10px; }
.hand-grid img { width: 100%; aspect-ratio: 488/680; object-fit: cover;
  display: block; border-radius: 8px; background: var(--surface-2); }
/* while a London mulligan is owed, the cards are a choice — say so */
.hand-grid.picking button { cursor: pointer; }
.hand-grid.picking button:hover, .hand-grid.picking button:focus-visible {
  border-color: var(--accent); outline: none; }
.hand-cap { font-size: 11px; color: var(--muted); margin: 10px 0 4px; }
.hand-note { font-size: 12px; color: var(--accent); }

.combos-panel { background: var(--surface); border: 1px solid var(--line);
                border-radius: var(--radius); padding: 12px 14px; margin-bottom: 16px; }
.combos-head { display: flex; align-items: baseline; gap: 10px; margin-bottom: 6px; }
.cb-num { font-size: 26px; font-weight: 600; color: var(--accent); font-variant-numeric: tabular-nums; }
.cb-cap { color: var(--muted); font-size: 13px; }
.cb-h { font-size: 13px; color: var(--muted); font-weight: 500; margin: 12px 0 6px; }
.combo-list { list-style: none; margin: 0; padding: 0; }
.combo-list li { padding: 6px 0; border-bottom: 1px solid var(--line); display: flex;
                 flex-direction: column; gap: 2px; }
.combo-list a { color: var(--text); font-size: 14px; font-weight: 500; text-decoration: none; }
.combo-list a:hover { color: var(--accent); text-decoration: underline; }
.cb-cards { font-size: 12px; color: var(--muted); }
.cb-tmpl { color: var(--accent); }
.cb-miss { font-size: 12px; color: var(--accent); }
.combo-list.almost a { font-weight: 400; }
/* the combos panel's own <details> toggle is gone — sections fold as a group */
.cb-add { color: var(--accent); text-decoration: none; }
.cb-add:hover { text-decoration: underline; }
.cb-add[data-done] { color: var(--muted); cursor: default; text-decoration: none; }

/* --- collection + ownership --- */
.nav-link { font-size: 13px; font-weight: 400; color: var(--muted); text-decoration: none; margin-left: 8px; }
.nav-link:hover { color: var(--accent); }
.import-btn { padding: 8px 14px; font-size: 14px; color: var(--accent-ink); background: var(--accent);
             border-radius: var(--radius); cursor: pointer; font-weight: 500; }
.import-mode { font-size: 13px; color: var(--muted); display: flex; align-items: center; gap: 6px; }
#collSearchForm { margin: 0 0 12px; }
#collQ { width: 100%; padding: 10px 12px; font-size: 16px; color: var(--text);
         background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius); }
.own-panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
             padding: 12px 14px; margin-bottom: 16px; }
.own-head { display: flex; align-items: baseline; gap: 10px; }
.own-num { font-size: 26px; font-weight: 600; color: var(--accent); font-variant-numeric: tabular-nums; }
.own-bar { background: var(--surface-2); border-radius: 4px; height: 10px; overflow: hidden; margin: 8px 0; }
.own-bar > span { display: block; height: 100%; background: var(--accent); }

/* --- offline bar --- */
.offline-bar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
               margin-top: 8px; font-size: 12px; color: var(--muted); }
.off-ok { color: var(--accent); }
.off-meta { color: var(--muted); }
.off-btn { padding: 4px 10px; font-size: 12px; color: var(--text);
           background: var(--surface-2); border: 1px solid var(--line);
           border-radius: 6px; cursor: pointer; }
.off-btn:hover { border-color: var(--accent); }

/* --- view controls (#12) --- */
.view-controls { display: flex; gap: 12px; flex-wrap: wrap; margin: 4px 0 14px; }
.view-controls label { font-size: 12px; color: var(--muted); display: flex; align-items: center; gap: 6px; }
.view-controls select { font-size: 14px; color: var(--text); background: var(--surface-2);
  border: 1px solid var(--line); border-radius: 8px; padding: 6px 8px; }

/* --- tokens (#16) --- */
.tokens-panel { background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 12px 14px; margin-bottom: 16px; }
.token-grid { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
.token { background: var(--surface-2); border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.token .art { width: 100%; aspect-ratio: 488/680; object-fit: cover; display: block; background: var(--surface); }
.tk-meta { padding: 8px; }
.tk-name { font-size: 13px; font-weight: 500; }
.tk-src { font-size: 11px; color: var(--muted); margin: 2px 0 6px; }
/* which printing this tile is showing — a button when there's a choice to make */
.tk-ver, .tk-ver-1 { display: inline-block; font-size: 11px; color: var(--muted);
  margin-bottom: 6px; letter-spacing: .02em; }
.tk-ver { background: var(--surface); border: 1px solid var(--line);
  border-radius: 999px; padding: 2px 8px; cursor: pointer; font-family: inherit; }
.tk-ver:hover { color: var(--text); border-color: var(--accent); }
.tk-buy { display: flex; gap: 8px; }
.tk-buy a { font-size: 12px; color: var(--accent); text-decoration: none; }
.tk-buy a:hover { text-decoration: underline; }

/* --- preconstructed decks (collection) --- */
.precon-box { margin: 0 0 18px; padding: 12px 14px; background: var(--surface);
  border: 1px solid var(--line); border-radius: var(--radius); }
.precon-box .cat-head { margin-top: 0; }
.precon-box .hint { margin: 0 0 10px; }
.precon-row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.precon-row label { font-size: 12px; color: var(--muted); display: flex; align-items: center; gap: 6px; }
.precon-row select { font-size: 14px; color: var(--text); background: var(--surface-2);
  border: 1px solid var(--line); border-radius: 8px; padding: 6px 8px; }
.precon-row input[type="search"] { flex: 1 1 240px; min-width: 180px; padding: 8px 10px;
  font-size: 16px; color: var(--text); background: var(--surface-2);
  border: 1px solid var(--line); border-radius: var(--radius); }
.precon-box .ac-results { position: static; margin-top: 8px; max-height: 340px; }
/* the count line sits between the controls and the list it describes */
.precon-box #preconCount { margin: 8px 0 0; }
.precon-box .more { margin-top: 8px; }
.precon-pick { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-top: 10px;
  padding-top: 10px; border-top: 1px solid var(--line); }
.precon-pick-info { display: flex; flex-direction: column; flex: 1 1 220px; }
.precon-box details { margin-top: 10px; }
.precon-box summary { cursor: pointer; }
.precon-box .cardlist { max-height: 320px; overflow-y: auto; margin-top: 6px; }

/* --- wishlists (#2) --- */
.wl-new { display: flex; gap: 8px; margin: 8px 0 0; }
.wl-new input { flex: 1; padding: 8px 10px; font-size: 16px; color: var(--text);
  background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius); }

/* --- inline row editing (decks + wishlists) --- */
.row-step { display: flex; align-items: center; gap: 2px; }
.row-btn {
  background: var(--surface-2); border: 1px solid var(--line); border-radius: 6px;
  color: var(--text); font-size: 13px; line-height: 1; padding: 4px 7px; cursor: pointer;
}
.row-btn:hover { border-color: var(--accent); }
.row-del { color: var(--muted); border-color: transparent; background: none; }
.row-del:hover { color: var(--accent); }
.got-btn { font-size: 11px; white-space: nowrap; }
.cardlist .nm a, .cardlist a.nm { color: var(--text); text-decoration: none; }
.cardlist .nm a:hover, .cardlist a.nm:hover { color: var(--accent); }
.danger:hover { border-color: #c0503b; color: #d0705b; }

/* --- deck actions + add-card search --- */
.bracket-pick { font-size: 13px; color: var(--muted); display: flex; align-items: center; gap: 6px; }
.bracket-pick select, #acBoard {
  font-size: 14px; color: var(--text); background: var(--surface-2);
  border: 1px solid var(--line); border-radius: 8px; padding: 6px 8px;
}
.add-card { position: relative; display: flex; gap: 8px; align-items: center; margin: 0 0 14px; }
.add-card input {
  flex: 1; padding: 10px 12px; font-size: 16px; color: var(--text);
  background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius);
}
.add-card input:focus { outline: 2px solid var(--accent); border-color: var(--accent); }
.ac-results {
  position: absolute; top: 100%; left: 0; right: 0; z-index: 15;
  list-style: none; margin: 4px 0 0; padding: 4px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: 0 8px 24px rgba(0,0,0,.4); max-height: 320px; overflow-y: auto;
}
.ac-results button {
  display: flex; align-items: baseline; gap: 8px; width: 100%; text-align: left;
  background: none; border: none; color: var(--text); font: inherit;
  padding: 8px 10px; border-radius: 8px; cursor: pointer;
}
.ac-results button:hover, .ac-results button:focus-visible { background: var(--surface-2); outline: none; }
.ac-nm { font-size: 14px; font-weight: 500; }
.ac-sub { flex: 1; font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ac-pr { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }

/* --- card detail (deck edit sheet + wishlist sheet) --- */
.cd-detail { display: flex; gap: 14px; align-items: flex-start; margin: 8px 0 14px; }
/* perspective makes the flip read as a card turning over rather than squashing */
.cd-figure { position: relative; width: 168px; max-width: 42%; flex: none; perspective: 900px; }
.cd-figure .cd-img { backface-visibility: hidden; will-change: transform; }
.cd-img { width: 168px; max-width: 42%; border-radius: 9px; display: block; background: var(--surface-2); }
.cd-figure .cd-img { width: 100%; max-width: none; }
.cd-info { flex: 1; min-width: 0; }
.cd-info .sheet-type { margin-top: 0; }
@media (max-width: 420px) { .cd-img, .cd-figure { width: 132px; } }

/* format filter under the search box */
.fmt-bar { display: flex; align-items: center; gap: 8px; margin: 8px 0 0; flex-wrap: wrap; }
/* the sort's direction control sits with the dropdown it belongs to */
.fmt-bar #sortDir { padding: 6px 10px; font-size: 13px; }
/* The result count is standing text under the search bar, not a one-off
   "Searching..." message, so it doesn't get the full status block's padding. */
.status.count { padding: 10px 0 2px; text-align: left; font-size: 13px; }
.fmt-bar label { font-size: 12px; color: var(--muted); }
.fmt-bar select { font-size: 14px; color: var(--text); background: var(--surface-2);
  border: 1px solid var(--line); border-radius: 8px; padding: 6px 8px; }
.fmt-bar select:focus { outline: 2px solid var(--accent); border-color: var(--accent); }

/* --- jump-to-section rail + back to top --- */
/* The rail is fixed, so it needs a gutter of its own: main is a centred 1100px
   column and would otherwise sit underneath it. Hidden on narrow screens, where
   the page is one column anyway and back-to-top does the job. */
.deck-nav {
  position: fixed; left: 10px; top: 50%; transform: translateY(-50%);
  z-index: 15; display: none; flex-direction: column; gap: 1px;
  width: 128px; max-height: 82vh; overflow-y: auto;
  padding: 8px; border-radius: var(--radius);
  background: var(--surface); border: 1px solid var(--line);
}
.deck-nav a {
  font-size: 12px; color: var(--muted); text-decoration: none;
  padding: 5px 8px; border-radius: 7px; white-space: nowrap;
  overflow: hidden; text-overflow: ellipsis;
}
.deck-nav a:hover, .deck-nav a:focus-visible { background: var(--surface-2); color: var(--text); outline: none; }
.deck-nav a.on { color: var(--accent); background: var(--surface-2); font-weight: 600; }
@media (min-width: 1000px) {
  body.has-deck-nav .deck-nav { display: flex; }
  body.has-deck-nav { padding-left: 150px; }
}

.to-top {
  position: fixed; right: 16px; bottom: max(env(safe-area-inset-bottom), 16px);
  z-index: 16; width: 42px; height: 42px; border-radius: 50%; cursor: pointer;
  font-size: 18px; line-height: 1; color: var(--text);
  background: var(--surface); border: 1px solid var(--line);
  box-shadow: 0 4px 14px rgba(0,0,0,.45);
}
.to-top:hover, .to-top:focus-visible { color: var(--accent); border-color: var(--accent); outline: none; }

/* side decks (dungeons / attractions / stickers) — shown only when in use */
.side-panel { margin: 14px 0; padding: 10px 12px; border: 1px solid var(--line);
  border-radius: var(--radius); background: var(--surface); }
.side-panel .cat-head { margin-top: 0; }
.side-panel .add-card { margin: 8px 0 6px; }

/* flip control for double-faced cards — sits over the bottom of the art */
.flip-btn {
  position: absolute; left: 50%; bottom: 8px; transform: translateX(-50%);
  font-size: 11px; font-weight: 600; white-space: nowrap;
  padding: 4px 10px; border-radius: 999px; cursor: pointer;
  color: var(--text); background: rgba(0,0,0,.72);
  border: 1px solid var(--line);
}
.flip-btn:hover, .flip-btn:focus-visible { background: rgba(0,0,0,.9); outline: none; border-color: var(--accent); }

/* --- legality flags --- */
.chip { display: inline-block; font-size: 10px; font-weight: 600; line-height: 1.4;
  padding: 0 6px; border-radius: 7px; margin-left: 6px; vertical-align: 1px;
  text-transform: uppercase; letter-spacing: .03em; }
.chip-bad { background: #4a2320; color: #e58a76; border: 1px solid #6b342e; }
.chip-gc { background: #443a1e; color: #d9b64a; border: 1px solid #665727; }
.legality-panel { background: var(--surface); border: 1px solid #6b342e;
  border-radius: var(--radius); padding: 10px 14px; margin-bottom: 14px; }
.leg-row { margin: 4px 0; font-size: 13px; }
.leg-bad { color: #e58a76; }
.leg-gc { color: #d9b64a; }
.leg-row b { font-weight: 600; }
.ac-lock { font-size: 12px; color: var(--muted); display: flex; align-items: center;
  gap: 5px; white-space: nowrap; }

/* --- bulk add page --- */
.bulk-target { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; margin: 0 0 8px; }
.bulk-target label { font-size: 13px; color: var(--muted); display: flex; align-items: center; gap: 6px; }
.bulk-target select { font-size: 14px; color: var(--text); background: var(--surface-2);
  border: 1px solid var(--line); border-radius: 8px; padding: 6px 8px; max-width: 240px; }
.add-li { position: relative; display: flex; flex-direction: column; }
.add-tile { position: relative; flex: 1; }
.add-tile.added { border-color: var(--accent); }
/* Reads as a control, not a caption. It was 11px muted grey saying "versions",
   which is why nobody found it. */
.ver-btn { margin-top: 4px; font-size: 12px; padding: 5px 8px; color: var(--text);
  background: var(--surface-2); border: 1px solid var(--line); border-radius: 7px;
  cursor: pointer; font-family: inherit; width: 100%; }
.ver-btn:hover { border-color: var(--accent); color: var(--accent); }
/* a version has been chosen — the tile will add that printing */
.ver-btn.ver-set { border-color: var(--accent); color: var(--accent);
  background: color-mix(in srgb, var(--accent) 10%, var(--surface-2)); }

/* --- EDHREC links --- */
.edh-links { margin: 4px 0 0; font-size: 12px; color: var(--muted); }
.edh-links a { color: var(--accent); text-decoration: none; }
.edh-links a:hover { text-decoration: underline; }

/* --- rulings --- */
.rul-list { list-style: none; margin: 6px 0 0; padding: 0; }
.rul-list li { font-size: 13px; line-height: 1.5; padding: 6px 0;
  border-bottom: 1px solid var(--line); }
.rul-date { display: inline-block; color: var(--accent); font-size: 11px;
  font-variant-numeric: tabular-nums; margin-right: 8px; }
.added-badge { position: absolute; top: 6px; right: 6px; background: var(--accent);
  color: var(--accent-ink); font-size: 12px; font-weight: 700; padding: 1px 7px;
  border-radius: 10px; }
.recent-box { background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 10px 14px; margin-bottom: 14px; }
.recent-list { list-style: none; margin: 6px 0 0; padding: 0; display: flex;
  gap: 6px 12px; flex-wrap: wrap; }
.recent-list li { display: flex; align-items: center; gap: 4px; font-size: 13px;
  background: var(--surface-2); border: 1px solid var(--line); border-radius: 8px;
  padding: 2px 4px 2px 10px; }

/* --- category assign mode --- */
#assignBtn.on { border-color: var(--accent); color: var(--accent); }
.assign-bar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap;
  background: var(--surface); border: 1px solid var(--accent); border-radius: var(--radius);
  padding: 10px 12px; margin: 0 0 14px; }
.assign-bar input { flex: 1; min-width: 180px; padding: 8px 10px; font-size: 16px;
  color: var(--text); background: var(--surface-2); border: 1px solid var(--line);
  border-radius: 8px; }
.assign-bar .hint { flex-basis: 100%; margin: 0; }
.cardlist li.in-cat { background: rgba(200, 133, 59, .12); border-left: 3px solid var(--accent);
  padding-left: 6px; }
.card.in-cat { border-color: var(--accent); }

/* --- card edit sheet --- */
.edit-rows { display: flex; flex-direction: column; gap: 12px; margin: 8px 0 16px; }
.edit-row { display: flex; align-items: center; justify-content: space-between; gap: 12px;
  font-size: 14px; color: var(--muted); }
.edit-row select, .edit-row input[list], .edit-row input[type="number"] {
  font-size: 15px; color: var(--text); background: var(--surface-2);
  border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px;
}
.edit-row input[list] { flex: 1; max-width: 60%; }
.foil-row { justify-content: flex-start; }
.stepper { display: flex; align-items: center; gap: 6px; }
.stepper input { width: 58px; text-align: center; }
.stepper button {
  background: var(--surface-2); border: 1px solid var(--line); border-radius: 8px;
  color: var(--text); font-size: 16px; padding: 6px 12px; cursor: pointer;
}
.stepper button:hover { border-color: var(--accent); }
.edit-acts { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }

/* --- primer editor + deck import --- */
.primer-edit, .import-box {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 12px 14px; margin-bottom: 16px;
}
.primer-edit textarea, .import-box textarea {
  width: 100%; font: 13px/1.5 ui-monospace, SFMono-Regular, Consolas, monospace;
  color: var(--text); background: var(--surface-2); border: 1px solid var(--line);
  border-radius: 8px; padding: 10px 12px; resize: vertical;
}
.primer-edit textarea:focus, .import-box textarea:focus { outline: 2px solid var(--accent); border-color: var(--accent); }
.primer-acts { display: flex; gap: 10px; align-items: center; margin-top: 10px; flex-wrap: wrap; }

/* --- flip group ----------------------------------------------------------- */
.flip-panel { background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 12px 14px; margin-bottom: 16px; }
.flip-panel .cb-cap { display: block; margin-bottom: 10px; max-width: 70ch; }
.flip-row { display: flex; gap: 10px; flex-wrap: wrap; }
/* each side is a card-sized target, and the one showing looks pressed rather
   than merely highlighted — you should be able to tell at a glance which deck
   is on the table */
.flip-side { display: flex; flex-direction: column; gap: 2px; align-items: flex-start;
  min-width: 190px; padding: 10px 14px; cursor: pointer; text-align: left;
  font-family: inherit; color: var(--text); background: var(--surface-2);
  border: 1px solid var(--line); border-radius: var(--radius); }
.flip-side:hover:not(.on) { border-color: var(--accent); }
.flip-side.on { border-color: var(--accent); background: var(--surface);
  box-shadow: inset 0 0 0 1px var(--accent); cursor: default; }
.flip-side[disabled] { opacity: .6; cursor: progress; }
.flip-name { font-size: 14px; font-weight: 600; }
.flip-cmd { font-size: 12px; color: var(--muted); }
.flip-state { font-size: 11px; color: var(--muted); letter-spacing: .03em;
  text-transform: uppercase; margin-top: 4px; }
.flip-side.on .flip-state { color: var(--accent); }
/* the side is a card holding controls now, not one big button */
.flip-pick { display: flex; flex-direction: column; gap: 2px; align-items: flex-start;
  width: 100%; padding: 0; background: none; border: 0; cursor: pointer;
  text-align: left; font-family: inherit; color: inherit; }
.flip-side.on .flip-pick { cursor: default; }
.flip-lists { display: flex; gap: 6px; margin-top: 8px; padding-top: 8px;
  border-top: 1px solid var(--line); width: 100%; }
.flip-list-btn { flex: 1; padding: 5px 8px; font-size: 11px; cursor: pointer;
  color: var(--muted); background: var(--surface); border: 1px solid var(--line);
  border-radius: 6px; font-family: inherit; }
.flip-list-btn:hover { color: var(--text); border-color: var(--accent); }

/* the list sheet */
.fl-panel .fl-sum { margin: 0 0 10px; }
.fl-list { max-height: 52vh; overflow-y: auto; }
.fl-own { font-size: 11px; color: var(--muted); margin-left: auto; }
.fl-acts { display: flex; gap: 8px; align-items: center; flex-wrap: wrap;
  margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--line); }
.fl-acts select { font-size: 13px; color: var(--text); background: var(--surface-2);
  border: 1px solid var(--line); border-radius: 8px; padding: 6px 8px; }

/* Printing a list: the sheet becomes the page. Everything else stands aside
   rather than being screenshotted around. */
@media print {
  body.printing-list > *:not(#flipListSheet) { display: none !important; }
  body.printing-list #flipListSheet { position: static; display: block; }
  body.printing-list .sheet-scrim, body.printing-list .fl-acts,
  body.printing-list .icon-btn { display: none !important; }
  body.printing-list .sheet-panel { max-height: none; box-shadow: none; border: 0;
    background: #fff; color: #000; max-width: none; width: auto; }
  body.printing-list .fl-list { max-height: none; overflow: visible; columns: 2; }
  body.printing-list .fl-list li { break-inside: avoid; border-color: #ddd; }
  body.printing-list .nm, body.printing-list .q, body.printing-list .pr,
  body.printing-list .fl-sum, body.printing-list h2 { color: #000; }
}

.flip-acts { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-top: 10px; }
/* the "which side survives" step: destructive, so it looks it */
.flip-off { margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--line); }
.flip-off .leg-row { margin: 0 0 10px; }
.flip-off .flip-side { border-color: var(--bad, #d0503b); }
.flip-off .flip-side:hover { background: var(--surface-2); }

/* --- the primer, rendered ------------------------------------------------- */
.primer-panel { background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 12px 18px 18px; margin-bottom: 16px; }
/* the section bar carries the title, so this row holds only the Edit button */
.pr-head { display: flex; align-items: center; justify-content: flex-end; gap: 12px; }
/* A primer is prose: a reading measure, and room between the parts. */
.primer-doc { max-width: 68ch; font-size: 14px; line-height: 1.65; color: var(--text); }
.primer-doc h2 { font-size: 17px; margin: 22px 0 6px; }
.primer-doc h3 { font-size: 15px; margin: 18px 0 4px; }
.primer-doc h4, .primer-doc h5 { font-size: 13px; margin: 14px 0 4px;
  text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.primer-doc > :first-child { margin-top: 0; }
.primer-doc p { margin: 0 0 10px; }
.primer-doc ul, .primer-doc ol { margin: 0 0 12px; padding-left: 22px; }
.primer-doc li { margin-bottom: 5px; }
.primer-doc strong { color: var(--text); font-weight: 600; }
.primer-doc code { font: 12px/1.4 ui-monospace, SFMono-Regular, Consolas, monospace;
  background: var(--surface-2); border: 1px solid var(--line);
  border-radius: 4px; padding: 1px 5px; }
.primer-doc pre { background: var(--surface-2); border: 1px solid var(--line);
  border-radius: 8px; padding: 10px 12px; overflow-x: auto; margin: 0 0 12px; }
.primer-doc pre code { background: none; border: 0; padding: 0; }
.primer-doc blockquote { margin: 0 0 12px; padding: 2px 0 2px 12px;
  border-left: 3px solid var(--line); color: var(--muted); }
.primer-doc hr { border: 0; border-top: 1px solid var(--line); margin: 18px 0; }
.primer-doc a { color: var(--accent); }
/* the live preview inside the editor */
.primer-edit .primer-doc { margin-top: 12px; border-top: 1px solid var(--line); padding-top: 12px; }

/* --- rulings -------------------------------------------------------------- */
.ruling-acts { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin: 8px 0 4px; }
.ruling-acts .off-btn { text-decoration: none; }
.ruling-box { background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 12px 14px; margin-top: 16px; }
.ruling-head { display: flex; gap: 14px; align-items: flex-start; }
.ruling-head .cat-head { margin: 0 0 2px; }
.ruling-art { width: 140px; border-radius: 8px; flex: 0 0 auto; }
.ruling-row { font-size: 14px; line-height: 1.55; color: var(--text);
  margin: 10px 0; padding-top: 10px; border-top: 1px solid var(--line); }
.ruling-date { color: var(--muted); font-size: 12px; margin-right: 8px;
  font-variant-numeric: tabular-nums; }
@media (max-width: 560px) {
  .ruling-head { flex-direction: column; }
  .ruling-art { width: 100%; max-width: 220px; }
}

/* --- trade ---------------------------------------------------------------- */
/* the ⇄ toggle on a collection row: quiet until it's on */
.trade-btn { color: var(--muted); border-color: transparent; background: none; }
.trade-btn:hover { color: var(--accent); border-color: var(--accent); }
.trade-btn.on { color: var(--accent-ink); background: var(--accent); border-color: var(--accent); }

.trade-list { background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 12px 14px; margin-bottom: 18px; }
.trade-head { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.trade-head .cat-head { margin: 0 auto 0 0; }
.trade-total { font-size: 16px; font-weight: 600; color: var(--text);
  font-variant-numeric: tabular-nums; }
.trade-acts { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-top: 10px; }

/* --- format rules --------------------------------------------------------- */
.rule-grid { display: grid; gap: 14px;
  grid-template-columns: repeat(auto-fill, minmax(min(320px, 100%), 1fr)); }
.rule-card { background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 12px 14px; }
.rule-card h2 { margin: 0 0 10px; font-size: 16px; font-weight: 600; }
/* label/value pairs: the four questions you ask about any format */
.rule-grid-in { display: grid; grid-template-columns: auto 1fr; gap: 4px 12px;
  font-size: 13px; align-items: baseline; }
.rule-k { color: var(--muted); }
.rule-v { color: var(--text); }
.rule-pool, .rule-note { font-size: 13px; color: var(--muted); line-height: 1.5;
  margin: 10px 0 0; }
.rule-pool b { color: var(--text); font-weight: 600; }
.rule-links { display: flex; gap: 12px; flex-wrap: wrap; margin: 10px 0 0; font-size: 12px; }
.rule-links a { color: var(--accent); text-decoration: none; }
.rule-links a:hover { text-decoration: underline; }
.rule-asof { margin: 6px 0 0; font-size: 11px; color: var(--muted); opacity: .7; }

/* --- banned & restricted -------------------------------------------------- */
.fmt-note { background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 10px 14px; margin-bottom: 16px; }
.fmt-note p { margin: 0 0 6px; font-size: 14px; color: var(--muted); line-height: 1.5; }
.fmt-note p:last-child { margin-bottom: 0; }
.fmt-note b { color: var(--text); }
.bl-bar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin: 8px 0 4px; }
.bl-bar select { font-size: 14px; color: var(--text); background: var(--surface-2);
  border: 1px solid var(--line); border-radius: 8px; padding: 6px 8px; max-width: 60%; }

/* --- EDHREC picks on the bulk-add page ------------------------------------ */
.edh-box { background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 12px 14px; margin-bottom: 16px; }
.edh-head { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.edh-head .cb-h { margin: 0 auto 0 0; }
.edh-cat { border-top: 1px solid var(--line); margin-top: 8px; padding-top: 4px; }
.edh-cat > summary { cursor: pointer; padding: 6px 0; font-size: 14px; font-weight: 600; }
.edh-cat > summary::marker { color: var(--muted); }
.edh-cat .grid { margin-top: 10px; }
.edh-stat { font-size: 11px; color: var(--muted); }
/* already in the deck — still addable (a second copy of a basic, say), just
   clearly not a suggestion you need to act on */
.edh-have .add-tile { outline: 1px solid var(--accent); }
.edh-have .art { opacity: .5; }

/* --- wishlists detail --- */
.wl-head { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.wl-head .cat-head { margin-right: auto; }
.wl-fill { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin: 10px 0; }
.wl-fill select { font-size: 14px; color: var(--text); background: var(--surface-2);
  border: 1px solid var(--line); border-radius: 8px; padding: 6px 8px; max-width: 60%; }
.wl-buyall { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin: 10px 0; }

/* Per-card vendor compare. Replaced a plain TCG/CK pair of name searches and a
   single price: each chip now carries that store's price for the printing this
   row is about, and links straight to it. The cheapest of the three is marked,
   and a store with nothing in stock shows a dash rather than a stale number. */
.wl-prices { display: flex; gap: 6px; align-items: baseline; }
.vp { font-size: 11px; color: var(--muted); text-decoration: none; white-space: nowrap;
      border: 1px solid var(--line); border-radius: 6px; padding: 2px 6px;
      font-variant-numeric: tabular-nums; }
.vp b { font-weight: 600; opacity: .7; margin-right: 2px; }
.vp:hover { border-color: var(--accent); color: var(--accent); }
.vp.best { color: var(--text); border-color: var(--accent); }
.vp.best b { opacity: 1; color: var(--accent); }
.vp-out { opacity: .45; }
.own-acts { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-top: 10px; }
.own-acts select { font-size: 14px; color: var(--text); background: var(--surface-2);
  border: 1px solid var(--line); border-radius: 8px; padding: 6px 8px; max-width: 60%; }

/* --- playtest sandbox --- */
.pt-body { overscroll-behavior: none; }
.pt-bar { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; gap: 12px;
  background: var(--surface); border-bottom: 1px solid var(--line);
  padding: max(env(safe-area-inset-top), 10px) 14px 10px; }
.pt-name { font-size: 15px; font-weight: 500; flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pt-life { display: flex; align-items: center; gap: 8px; }
.pt-life b { font-size: 20px; color: var(--accent); font-variant-numeric: tabular-nums; min-width: 30px; text-align: center; }
.pt-btn { padding: 6px 12px; font-size: 13px; color: var(--text); background: var(--surface-2);
  border: 1px solid var(--line); border-radius: 8px; cursor: pointer; }
.pt-btn:hover { border-color: var(--accent); }
.pt-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; padding: 10px 14px;
  background: var(--surface); border-bottom: 1px solid var(--line); position: sticky; top: 52px; z-index: 4; }
.pt-info { font-size: 12px; color: var(--muted); margin-left: auto; }
.pt-main { padding: 10px 14px calc(env(safe-area-inset-bottom) + 20px); max-width: 1100px; margin: 0 auto; }
.pt-zone { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 8px 10px; margin-bottom: 10px; }
.pt-zone.battlefield { min-height: 180px; }
.pt-zone-label { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; margin-bottom: 6px; }
.pt-cards { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.pt-card { position: relative; width: 84px; cursor: pointer; transition: transform .12s; }
.pt-card img { width: 100%; border-radius: 5px; display: block; background: var(--surface-2); }
.pt-card.tapped { transform: rotate(90deg); margin: 20px 24px; }
.pt-counter { position: absolute; bottom: 4px; right: 4px; background: var(--accent);
  color: var(--accent-ink); font-size: 11px; font-weight: 600; padding: 1px 5px; border-radius: 8px; }
.pt-tok { position: absolute; top: 4px; left: 4px; background: var(--surface-0); color: var(--muted);
  font-size: 10px; padding: 0 4px; border-radius: 4px; border: 1px solid var(--line); }
.pt-piles { display: flex; gap: 8px; margin-bottom: 10px; }
.pt-pile { flex: 1; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 10px 6px; font-size: 12px; color: var(--muted); cursor: pointer; display: flex; flex-direction: column;
  align-items: center; gap: 2px; }
.pt-pile:hover { border-color: var(--accent); }
.pt-pile-n { font-size: 20px; font-weight: 600; color: var(--text); font-variant-numeric: tabular-nums; }
.pt-pile small { font-size: 10px; }
.pt-preview { width: 180px; max-width: 60%; border-radius: 8px; display: block; margin: 0 auto 12px; }
.pt-act-row { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.pt-act { padding: 10px 14px; font-size: 14px; color: var(--text); background: var(--surface-2);
  border: 1px solid var(--line); border-radius: var(--radius); cursor: pointer; }
.pt-act:hover { border-color: var(--accent); }
.pt-zone-list { list-style: none; margin: 0; padding: 0; }
.pt-zone-list li { display: flex; align-items: center; gap: 10px; padding: 6px 0;
  border-bottom: 1px solid var(--line); cursor: pointer; }
.pt-zone-list img { width: 40px; border-radius: 4px; }

/* --- playtest: mana bar + next-level tools --- */
.pt-primary { border-color: var(--accent); color: var(--accent); }
.pt-mana { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding: 8px 14px;
  background: var(--surface); border-bottom: 1px solid var(--line); position: sticky; top: 104px; z-index: 3; }
.pt-turn, .pt-storm { font-size: 12px; color: var(--muted); display: flex; align-items: center; gap: 6px; }
.pt-turn b, .pt-storm b { color: var(--accent); font-size: 16px; font-variant-numeric: tabular-nums; min-width: 18px; text-align: center; }
.pt-pool { display: flex; gap: 6px; }
.pt-pip { display: flex; align-items: center; gap: 3px; border: none; border-radius: 6px;
  padding: 4px 8px; font-size: 12px; font-weight: 600; color: #1b1305; cursor: pointer; }
.pt-pip b { font-variant-numeric: tabular-nums; }
/* --- playtest: OBS capture session --- */
.pt-capture { display: flex; align-items: center; gap: 10px; padding: 8px 14px;
  background: var(--surface); border-bottom: 1px solid var(--line); }
.pt-capture .pt-info { margin-left: 0; }
.cap-live { color: var(--accent); font-weight: 600; }
.pt-cap-panel { padding: 10px 14px 14px; background: var(--surface);
  border-bottom: 1px solid var(--line); }
.pt-cap-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.pt-cap-row label { font-size: 12px; color: var(--muted); }
.pt-cap-row input { flex: 1 1 320px; min-width: 220px; padding: 6px 10px; font-size: 13px;
  color: var(--text); background: var(--surface-2); border: 1px solid var(--line);
  border-radius: 8px; font-family: ui-monospace, SFMono-Regular, Consolas, monospace; }
.pt-cap-row .pt-btn { text-decoration: none; }
.pt-cap-note { font-size: 12px; color: var(--muted); margin: 8px 0 0; max-width: 78ch; line-height: 1.5; }
.pt-cap-strong { color: var(--text); font-weight: 600; }
.pt-cap-seed { margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--line); align-items: flex-start; }
.pt-cap-seed .pt-cap-note { margin: 0; flex: 1 1 320px; }
/* --- shuffle verification ------------------------------------------------- */
.v-order { margin: 0; padding-left: 30px; font-size: 13px; line-height: 1.7;
  max-height: 60vh; overflow-y: auto; columns: 2; column-gap: 28px; }
@media (max-width: 640px) { .v-order { columns: 1; } }
.v-order li { break-inside: avoid; }
.pt-cap-hand { display: flex; gap: 14px; align-items: flex-start; flex-wrap: wrap;
  margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--line); }
.pt-cap-hand > div:last-child { flex: 1 1 320px; }
/* white plate behind the code: a QR on a dark background reads as inverted and
   most phone cameras won't look twice */
.pt-qr { background: #fff; padding: 8px; border-radius: 8px; line-height: 0; }

/* --- hand surface (phone) ------------------------------------------------- */
.hand-body { padding-bottom: 78px; }              /* room for the fixed bar */
.hand-main { padding: 10px 12px; }
.hand-board { margin-bottom: 14px; }
.hand-counts { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 8px; }
.hd-chip { font-size: 12px; color: var(--muted); background: var(--surface);
  border: 1px solid var(--line); border-radius: 999px; padding: 3px 10px; }
.hd-chip b { color: var(--text); font-variant-numeric: tabular-nums; }
.hd-n { font-size: 12px; color: var(--muted); font-weight: 400; }
.hand-h { font-size: 13px; color: var(--muted); font-weight: 500; margin: 0 0 6px; }
/* the board is a reference, not a workspace, so it gets thumbnails */
.hand-mini { list-style: none; margin: 0; padding: 0; display: flex; gap: 6px;
  flex-wrap: wrap; }
.hand-mini-card { width: 58px; padding: 0; background: none; border: 0; cursor: pointer; }
.hand-mini-card img { width: 58px; aspect-ratio: 488/680; object-fit: cover;
  border-radius: 5px; display: block; }
/* the hand is the workspace: bigger, and scrolled sideways rather than wrapped,
   so the cards stay in the order you're used to seeing them */
.hand-strip { list-style: none; margin: 0; padding: 0 0 6px; display: flex; gap: 8px;
  overflow-x: auto; scroll-snap-type: x proximity; -webkit-overflow-scrolling: touch; }
.hand-strip > li { scroll-snap-align: center; flex: 0 0 auto; }
.hand-card { width: 120px; padding: 0; background: none; border: 0; cursor: pointer; }
.hand-card img { width: 120px; aspect-ratio: 488/680; object-fit: cover;
  border-radius: 8px; display: block; }
.hand-back { display: flex; align-items: center; justify-content: center;
  width: 100%; aspect-ratio: 488/680; border-radius: 8px; font-size: 12px;
  color: var(--muted); background: var(--surface-2); border: 1px solid var(--line); }
.hand-preview { width: 100%; max-width: 260px; border-radius: 10px; display: block; margin: 0 auto 12px; }
.hand-log { font-size: 12px; color: var(--muted); margin: 14px 0 0; min-height: 1.4em; }
#hQuery { width: 100%; padding: 10px 12px; font-size: 16px; color: var(--text);
  background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius);
  margin-bottom: 10px; }
/* fixed, and above the home indicator on a phone */
.hand-bar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 5;
  display: flex; gap: 6px; justify-content: space-between;
  padding: 8px 10px calc(8px + env(safe-area-inset-bottom));
  background: var(--surface); border-top: 1px solid var(--line); }
.hand-bar .pt-btn { flex: 1; text-align: center; padding: 10px 4px; font-size: 13px; }

.pt-hint { font-size: 12px; color: var(--muted); margin: 0 0 10px; }
.pt-zone-list.look li { justify-content: space-between; }
.pt-look-acts { display: flex; gap: 6px; margin-left: auto; }
.pt-mini { font-size: 12px; padding: 4px 8px; color: var(--text); background: var(--surface-2);
  border: 1px solid var(--line); border-radius: 6px; cursor: pointer; }
.pt-mini:hover { border-color: var(--accent); }

/* --- playtest Tier 1: face-down, zoom, reveal --- */
.pt-card.facedown .pt-back { width: 100%; aspect-ratio: 488/680; border-radius: 5px;
  background: repeating-linear-gradient(45deg, #2b2620, #2b2620 6px, #332e26 6px, #332e26 12px);
  border: 1px solid var(--line); display: flex; align-items: center; justify-content: center;
  color: var(--muted); font-size: 11px; letter-spacing: .1em; }
.pt-zoom { position: fixed; inset: 0; z-index: 40; background: rgba(0,0,0,.85);
  display: flex; align-items: center; justify-content: center; padding: 20px; }
.pt-zoom img { max-height: 92vh; max-width: 92vw; border-radius: 12px; }
.pt-reveal { display: flex; flex-direction: column; align-items: center; gap: 2px;
  padding: 6px; background: var(--surface); border: 1px solid var(--accent); border-radius: var(--radius); }
.pt-reveal small { font-size: 10px; color: var(--muted); text-transform: uppercase; }
.pt-reveal img { width: 64px; border-radius: 5px; cursor: pointer; }

/* --- Tier 2 stats panel --- */
.odds-row { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; margin: 4px 0 8px; }
.odds-row select, .odds-row input[type="number"] { font-size: 14px; color: var(--text);
  background: var(--surface-2); border: 1px solid var(--line); border-radius: 8px; padding: 6px 8px; }
.odds-row select { max-width: 60%; }
.odds-row input[type="number"] { width: 56px; }
.odds-row label { font-size: 13px; color: var(--muted); display: flex; align-items: center; gap: 6px; }
.odds-out { font-size: 14px; color: var(--text); margin: 4px 0 12px; }
.odds-out b { color: var(--accent); }

/* --- basics tool --- */
.basics-tool { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin: 0 0 14px; }
.basics-tool label { font-size: 13px; color: var(--muted); display: flex; align-items: center; gap: 6px; }
.basics-tool input { width: 60px; padding: 6px 8px; font-size: 15px; color: var(--text);
  background: var(--surface-2); border: 1px solid var(--line); border-radius: 8px; }
.basics-msg { font-size: 12px; color: var(--muted); }

/* --- landing page --------------------------------------------------------- */
.home-top { text-align: center; }
.home-top h1 { justify-content: center; font-size: 22px; margin-bottom: 4px; }
.home-logo { width: 40px; height: 40px; margin-right: 10px; }
.home-top .hint { margin: 0; }

/* min(…,100%) keeps the track from forcing the page wider than the viewport */
.home-nav { display: grid; gap: 12px; margin: 4px 0 22px;
  grid-template-columns: repeat(auto-fit, minmax(min(200px, 100%), 1fr)); }
.home-btn { display: grid; grid-template-columns: 34px 1fr; align-items: center;
  column-gap: 12px; row-gap: 2px; padding: 16px 18px; text-decoration: none;
  color: var(--text); background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); transition: border-color .15s ease, transform .15s ease; }
.home-btn:hover { border-color: var(--accent); transform: translateY(-2px); }
.home-ic { grid-row: 1 / 3; font-size: 24px; text-align: center; }
img.home-ic { width: 34px; height: 34px; border-radius: 8px; object-fit: cover; }
.home-t { font-size: 17px; font-weight: 600; }
.home-s { font-size: 12px; color: var(--muted); }

.home-hd { display: flex; align-items: baseline; justify-content: space-between;
  gap: 10px; font-size: 15px; font-weight: 600; margin: 0 0 12px;
  padding-bottom: 8px; border-bottom: 1px solid var(--line); }

/* --- format filter -------------------------------------------------------- */
.fmt-head { display: flex; justify-content: flex-end; margin-bottom: 6px; }
/* Arrows ride over the ends of the strip and disappear at each end, so they
   never point somewhere there's nothing to go. */
.fmt-scroll { position: relative; }
.fmt-nav { position: absolute; top: 50%; left: -8px; transform: translateY(-50%);
  z-index: 3; width: 46px; height: 46px; padding: 0; overflow: hidden;
  border-radius: 50%; border: 1px solid var(--line); background: var(--surface);
  cursor: pointer; box-shadow: 0 2px 12px rgba(0, 0, 0, .6); }
.fmt-nav-r { left: auto; right: -8px; }
.fmt-nav img { display: block; width: 100%; height: 100%; object-fit: cover; }
.fmt-nav:hover { border-color: var(--accent); }
.fmt-nav[hidden] { display: none; }
@media (max-width: 560px) { .fmt-nav { width: 38px; height: 38px; } }
.fmt-acts { display: flex; gap: 8px; flex-wrap: wrap; margin: 10px 0; }
.fmt-toggles { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px;
  grid-template-columns: repeat(auto-fill, minmax(min(220px, 100%), 1fr)); }
.fmt-toggles label { display: flex; align-items: center; gap: 8px; padding: 6px 4px;
  font-size: 14px; cursor: pointer; border-radius: 6px; }
.fmt-toggles label:hover { background: var(--surface-2); }
/* One emblem per format. There are 25, so this scrolls sideways rather than
   wrapping into a wall that buries the decks underneath it. */
.fmt-bar { display: flex; gap: 10px; margin: 0 0 12px; padding: 0 0 8px;
  overflow-x: auto; overflow-y: hidden; scroll-snap-type: x proximity;
  -webkit-overflow-scrolling: touch; }
.fmt-cell { position: relative; display: flex; flex: 0 0 auto; scroll-snap-align: start; }
.fmt { display: flex; flex-direction: column; align-items: center; gap: 6px;
  width: 132px; padding: 10px 6px 8px; cursor: pointer; color: var(--muted);
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.fmt img { width: 108px; height: 108px; border-radius: 10px; object-fit: contain; }
.fmt-t { font-size: 12px; line-height: 1.25; text-align: center; }
.fmt-n { font-size: 11px; opacity: .55; font-variant-numeric: tabular-nums; }
.fmt:hover { border-color: var(--accent); color: var(--text); }
.fmt.on { border-color: var(--accent); color: var(--text); background: var(--surface-2); }
.fmt-empty { opacity: .45; }
.fmt-new { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);
  opacity: 0; pointer-events: none; transition: opacity .12s;
  white-space: nowrap; font-size: 12px; font-weight: 500; padding: 5px 12px;
  color: var(--accent-ink); background: var(--accent); border-radius: 999px;
  cursor: pointer; box-shadow: 0 2px 10px rgba(0, 0, 0, .55); }
.fmt-cell:hover .fmt-new, .fmt-cell:focus-within .fmt-new { opacity: 1; pointer-events: auto; }
.fmt-cell:hover .fmt img, .fmt-cell:focus-within .fmt img { opacity: .45; }
/* keep the scrollbar from stealing the emblems' height */
.fmt-bar::-webkit-scrollbar { height: 8px; }
.fmt-bar::-webkit-scrollbar-thumb { background: var(--line); border-radius: 4px; }
@media (hover: none) {
  .fmt-cell { flex-direction: column; }
  .fmt-new { position: static; transform: none; opacity: 1; pointer-events: auto;
    margin-top: 4px; box-shadow: none; }
  .fmt-cell:hover .fmt img { opacity: 1; }
}
@media (max-width: 560px) {
  .fmt { width: 104px; }
  .fmt img { width: 84px; height: 84px; }
}

/* --- bracket filter ------------------------------------------------------- */
/* The same logos the deckboxes wear as a 24px badge, here at a size where they
   can actually be read. Picking one filters the wall below; the plain Deck
   Builder logo is the "everything" option. */
.brk-bar { display: flex; flex-wrap: wrap; gap: 10px; margin: 0 0 16px; padding: 0; }
.brk-cell { position: relative; display: flex; }
/* Hovering a bracket offers to start a deck in it. Sits over the logo, which
   dims so the pill stays legible against the art. */
.brk-new { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);
  opacity: 0; pointer-events: none; transition: opacity .12s;
  white-space: nowrap; font-size: 12px; font-weight: 500; padding: 5px 12px;
  color: var(--accent-ink); background: var(--accent); border-radius: 999px;
  cursor: pointer; box-shadow: 0 2px 10px rgba(0, 0, 0, .55); }
.brk-cell:hover .brk-new, .brk-cell:focus-within .brk-new { opacity: 1; pointer-events: auto; }
.brk-cell:hover .brk img, .brk-cell:focus-within .brk img { opacity: .45; }
.brk { display: flex; flex-direction: column; align-items: center; gap: 6px;
  width: 156px; padding: 10px 6px 8px; cursor: pointer; color: var(--muted);
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.brk img { width: 128px; height: 128px; border-radius: 10px; object-fit: contain; }
.brk-t { font-size: 12px; line-height: 1.25; text-align: center; }
.brk-n { font-size: 11px; opacity: .55; font-variant-numeric: tabular-nums; }
.brk:hover { border-color: var(--accent); color: var(--text); }
.brk.on { border-color: var(--accent); color: var(--text); background: var(--surface-2); }
.brk-empty { opacity: .45; }        /* no decks in it — still selectable */
/* Six of these at full size wrap to three rows on a phone and push the decks
   off screen, so they stay nearer the original size there. */
@media (max-width: 560px) {
  .brk { width: 104px; padding: 8px 4px 6px; }
  .brk img { width: 84px; height: 84px; }
}
/* A touch screen has no hover, so an overlay would be unreachable — the build
   button sits under the chip there instead of over the logo. */
@media (hover: none) {
  .brk-cell { flex-direction: column; }
  .brk-new { position: static; transform: none; opacity: 1; pointer-events: auto;
    margin-top: 4px; box-shadow: none; }
  .brk-cell:hover .brk img { opacity: 1; }
}

/* --- deckbox tiles -------------------------------------------------------- */
.dbox-grid { list-style: none; margin: 0; padding: 0; display: grid; gap: 18px;
  grid-template-columns: repeat(auto-fill, minmax(min(150px, 100%), 1fr)); }
.dbox-tile { position: relative; display: flex; flex-direction: column; gap: 8px; }
/* Delete, revealed on hover so it can't be hit by accident while browsing.
   Confirms before it fires. */
.dbox-del { position: absolute; top: 6px; right: 6px; z-index: 2;
  width: 26px; height: 26px; border-radius: 50%; padding: 0;
  opacity: 0; pointer-events: none; transition: opacity .12s;
  font-size: 12px; line-height: 1; cursor: pointer;
  color: var(--text); background: rgba(0, 0, 0, .62); border: 1px solid var(--line); }
.dbox-tile:hover .dbox-del, .dbox-tile:focus-within .dbox-del { opacity: 1; pointer-events: auto; }
.dbox-del:hover { background: #7a2b22; border-color: #c0503b; color: #fff; }
/* no hover on touch — otherwise it could never be reached */
@media (hover: none) { .dbox-del { opacity: 1; pointer-events: auto; } }

/* the box itself: art on the face, lid seam up top, depth down the left edge */
.dbox { position: relative; display: block; aspect-ratio: 5 / 7; overflow: hidden;
  border-radius: 12px; border: 1px solid var(--line); background: var(--surface-2);
  color: var(--text); text-decoration: none;
  box-shadow: 0 6px 18px rgba(0,0,0,.45);
  transform: perspective(800px) rotateY(-5deg);
  transition: transform .18s ease, box-shadow .18s ease; }
.dbox:hover, .dbox:focus-visible { transform: perspective(800px) rotateY(0deg) translateY(-3px);
  box-shadow: 0 14px 28px rgba(0,0,0,.6); }
.dbox::before { content: ""; position: absolute; inset: 0 auto 0 0; width: 10px; z-index: 2;
  background: linear-gradient(90deg, rgba(0,0,0,.6), rgba(0,0,0,0)); pointer-events: none; }
.dbox-art { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
/* the logo fallback is a wordmark — letterbox it instead of cropping the type off */
.dbox-art.is-logo { object-fit: contain; padding: 12% 10% 22%;
  background: radial-gradient(circle at 50% 38%, #2f2c22, #14130e); }
.dbox-lid { position: absolute; left: 0; right: 0; top: 0; height: 26%; z-index: 2;
  border-bottom: 1px solid rgba(0,0,0,.6);
  box-shadow: 0 1px 0 rgba(255,255,255,.12);
  background: linear-gradient(180deg, rgba(255,255,255,.12), rgba(255,255,255,0)); }
.dbox-glare { position: absolute; inset: 0; z-index: 2;
  background: linear-gradient(115deg, rgba(255,255,255,.14) 0%, rgba(255,255,255,0) 42%); }
/* bracket medallion, centred on the lid */
.dbox-badge { position: absolute; top: 4.5%; left: 50%; transform: translateX(-50%);
  z-index: 3; width: 34%; aspect-ratio: 1; border-radius: 50%; overflow: hidden;
  border: 1px solid rgba(255,255,255,.45); box-shadow: 0 3px 10px rgba(0,0,0,.6); }
.dbox-badge img { display: block; width: 100%; height: 100%; object-fit: cover; }
/* the face is already the bracket logo — no need to stamp it twice */
.dbox.hide-badge .dbox-badge { display: none; }
.dbox-face { position: absolute; left: 0; right: 0; bottom: 0; z-index: 3;
  display: flex; flex-direction: column; gap: 2px; padding: 16px 10px 10px;
  background: linear-gradient(0deg, rgba(0,0,0,.9) 40%, rgba(0,0,0,0)); }
.dbox-name { font-size: 14px; font-weight: 600; line-height: 1.25; }
.dbox-sub { font-size: 11px; color: #cbc5b4; }
.dbox-art-btn { align-self: stretch; padding: 6px 8px; font-size: 12px; cursor: pointer;
  color: var(--muted); background: var(--surface); border: 1px solid var(--line);
  border-radius: 8px; }
.dbox-art-btn:hover { color: var(--accent); border-color: var(--accent); }

/* --- deckbox art picker --------------------------------------------------- */
.art-opt { display: block; width: 100%; }
.art-opt-img { display: block; width: 100%; aspect-ratio: 626 / 457; object-fit: cover;
  background: var(--surface-2); }
.art-opt-nm { display: block; padding: 6px 8px; font-size: 12px; line-height: 1.3; }
.art-opt-cmd { font-size: 9px; font-weight: 700; color: var(--accent);
  border: 1px solid var(--accent); border-radius: 4px; padding: 0 3px; vertical-align: 1px; }

/* session expiry — a failed write must never look like a successful one */
.auth-lost { position: fixed; left: 0; right: 0; bottom: 0; z-index: 90;
  padding: 12px var(--pad) calc(env(safe-area-inset-bottom) + 12px);
  font-size: 14px; text-align: center; color: #fff2dd;
  background: #7a2d16; border-top: 1px solid #a8542f;
  box-shadow: 0 -4px 18px rgba(0,0,0,.5); }
.auth-lost a { color: #ffd9a8; font-weight: 600; }

/* --- grid view: qty controls without opening the card sheet --------------- */
.card-face { display: block; width: 100%; padding: 0; border: 0; background: none;
  color: inherit; font: inherit; text-align: left; cursor: pointer; }
.card-steps { display: flex; align-items: center; gap: 4px; cursor: default;
  padding: 6px 8px; border-top: 1px solid var(--line); }
.card-steps .q { min-width: 22px; text-align: center; font-size: 13px;
  font-variant-numeric: tabular-nums; }
.card-steps .row-del { margin-left: auto; }

/* ---------------------------------------------------------------- AI panel */
/* Sits between the page chrome and its content on home, decks and each deck.
   Hidden entirely when the assistant is off, so it costs nothing visually. */
.ai-panel { background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 14px; margin: 0 0 18px; }
.ai-panel .cat-head { margin-top: 0; display: flex; align-items: center; gap: 8px; }
.ai-panel .cat-head .cb-cards { margin-left: auto; font-weight: 400; }
.ai-form { display: flex; gap: 8px; align-items: flex-end; }
.ai-form textarea { flex: 1; resize: vertical; min-height: 44px;
  padding: 10px 12px; font: inherit; font-size: 14px; color: var(--text);
  background: var(--bg); border: 1px solid var(--line); border-radius: 10px; }
.ai-form textarea:focus { outline: none; border-color: var(--accent); }
.ai-reply { margin-top: 12px; font-size: 14px; line-height: 1.6; }
.ai-reply p { margin: 0 0 10px; }
.ai-reply ul { margin: 0 0 10px; padding-left: 20px; }
.ai-reply code { background: var(--surface-2); border-radius: 4px; padding: 1px 5px;
  font-size: 12px; }
.ai-h { font-weight: 600; color: var(--accent); margin: 12px 0 4px; }
.ai-diff { margin-top: 6px; max-height: 340px; overflow-y: auto;
  border-top: 1px solid var(--line); padding-top: 8px; }
.ai-cards { list-style: none; margin: 0 0 8px; padding: 0;
  columns: 2; column-gap: 18px; font-size: 13px; }
.ai-cards li { break-inside: avoid; padding: 1px 0; }
@media (max-width: 560px) { .ai-cards { columns: 1; } .ai-form { flex-direction: column;
  align-items: stretch; } }

/* ----------------------------------------------------------- deck gallery */
.gal-grid { display: grid; gap: 12px; margin-bottom: 18px;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); }
.gal-card { display: flex; flex-direction: column; gap: 2px; padding: 0 0 10px;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); overflow: hidden; text-decoration: none;
  color: var(--text); transition: border-color .15s, transform .15s; }
.gal-card:hover { border-color: var(--accent); transform: translateY(-2px); }
.gal-art { width: 100%; aspect-ratio: 626 / 240; object-fit: cover;
  background: var(--surface-2); margin-bottom: 6px; }
.gal-art-none { background: linear-gradient(160deg, var(--surface-2), var(--surface)); }
.gal-card > span { padding: 0 10px; }
.gal-name { font-weight: 600; font-size: 15px; line-height: 1.25; }
.gal-by { color: var(--muted); }
.gal-lock { margin-top: 4px; font-size: 12px; color: var(--accent); }

/* ------------------------------------------------------------ deck sharing */
.share-box .pick-label { margin-top: 16px; }
.share-toggles { display: grid; gap: 8px; margin-bottom: 10px;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); }
.share-opt { display: flex; gap: 8px; align-items: flex-start; padding: 10px;
  font-size: 14px; background: var(--bg); border: 1px solid var(--line);
  border-radius: 10px; cursor: pointer; }
.share-opt:hover { border-color: var(--accent); }
.share-opt input { margin-top: 3px; }
.share-link { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.share-link input { flex: 1; min-width: 220px; padding: 8px 10px; font: inherit;
  font-size: 13px; color: var(--muted); background: var(--bg);
  border: 1px solid var(--line); border-radius: 8px; }
.set-row { display: flex; gap: 8px; align-items: center; font-size: 14px; }

/* --------------------------------------------------------- settings: keys */
.prov-card { background: var(--bg); border: 1px solid var(--line);
  border-radius: 10px; padding: 12px; margin-bottom: 10px; }
.prov-card .pick-label { margin: 0 0 2px; display: flex; gap: 8px;
  align-items: baseline; flex-wrap: wrap; }
.prov-card input { width: 100%; padding: 7px 10px; font: inherit; font-size: 13px;
  color: var(--text); background: var(--surface); border: 1px solid var(--line);
  border-radius: 8px; }

/* ------------------------------------------------------------ suggestions */
.sug-group { margin-bottom: 14px; }
.sug-body, .sug-note { display: block; margin-top: 2px; }
.sug-note { color: var(--accent); }
.primer-view { font-size: 14px; }

/* ------------------------------------------------------------- busy paw */
/* A minute of silence reads as "it's stuck". The paw turns while the
   assistant is working, purely so there's something alive on screen. */
.paw-spin { width: 22px; height: 22px; flex: 0 0 auto; vertical-align: -5px;
  animation: paw-turn 1.6s linear infinite; }
@keyframes paw-turn { to { transform: rotate(360deg); } }
/* Reduced motion still needs a sign of life, just not a spinning one. */
@media (prefers-reduced-motion: reduce) {
  .paw-spin { animation: paw-pulse 1.4s ease-in-out infinite; }
  @keyframes paw-pulse { 0%, 100% { opacity: .35; } 50% { opacity: 1; } }
}
.ai-busy { display: flex; align-items: center; gap: 8px; }

/* ------------------------------------------------------------- tab shell */
/* app.html hosts the ordinary pages in iframes so a background tab keeps
   running - an AI deck build survives you going to look at something else. */
.shell-body { height: 100vh; height: 100dvh; margin: 0; display: flex;
  flex-direction: column; overflow: hidden; }
.frames { flex: 1; min-height: 0; position: relative; }
.tabframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0;
  background: var(--bg); }

.tabbar { display: flex; align-items: stretch; gap: 2px; padding: 4px 6px 0;
  background: var(--surface); border-bottom: 1px solid var(--line);
  overflow-x: auto; scrollbar-width: thin; flex: 0 0 auto; }
.tab { display: inline-flex; align-items: center; gap: 6px; max-width: 220px;
  padding: 7px 6px 7px 12px; font-size: 13px; color: var(--muted);
  background: var(--bg); border: 1px solid var(--line); border-bottom: none;
  border-radius: 9px 9px 0 0; cursor: pointer; white-space: nowrap;
  transition: color .12s, background .12s; }
.tab:hover { color: var(--text); }
.tab-on { color: var(--text); background: var(--surface-2);
  border-color: var(--accent); }
.tab-t { overflow: hidden; text-overflow: ellipsis; }
.tab-x { padding: 0 4px; font-size: 12px; line-height: 1; color: inherit;
  background: none; border: 0; border-radius: 4px; cursor: pointer; opacity: .5; }
.tab-x:hover { opacity: 1; background: var(--line); }
.tab-add { margin-left: 4px; padding: 0 10px; font-size: 15px; color: var(--muted);
  background: none; border: 0; cursor: pointer; }
.tab-add:hover { color: var(--accent); }

/* Walking paws: the SVG animates itself (SMIL), so no CSS animation here -
   adding one would spin the whole thing while the paws are trying to walk. */
.paw-walk { width: 28px; height: 28px; flex: 0 0 auto; vertical-align: -7px; }

/* The foil price is its own choice, not a label. Clicking the tile buys the
   normal printing; clicking this buys the foil, and ticks the Foil box. */
.print-foil { display: block; width: 100%; margin-top: 2px; padding: 3px 6px;
  font: inherit; font-size: 11px; color: var(--muted); background: var(--surface-2);
  border: 1px solid var(--line); border-radius: 0 0 8px 8px; cursor: pointer; }
.print-foil:hover { color: var(--text); border-color: var(--accent); }
.print-foil[aria-pressed="true"] { color: var(--accent-ink); background: var(--accent);
  border-color: var(--accent); font-weight: 600; }

/* ------------------------------------------------------------------- help */
.help-list { margin: 6px 0 0; padding-left: 20px; font-size: 14px; line-height: 1.6; }
.help-list li { margin-bottom: 6px; }
.ruling-box p { font-size: 14px; line-height: 1.6; margin: 0 0 8px; }
.help-keys { width: 100%; border-collapse: collapse; font-size: 14px; }
.help-keys td { padding: 6px 8px; border-bottom: 1px solid var(--line);
  vertical-align: top; }
.help-keys td:first-child { width: 42%; white-space: nowrap; }
kbd { display: inline-block; padding: 2px 6px; font-family: inherit; font-size: 12px;
  color: var(--text); background: var(--surface-2); border: 1px solid var(--line);
  border-bottom-width: 2px; border-radius: 5px; }
.site-foot { margin: 26px 0 40px; padding-top: 14px; border-top: 1px solid var(--line);
  text-align: center; }
.site-foot p { margin: 0 0 6px; }

/* ------------------------------------------------------------ credit meter */
.meter-bar { height: 8px; margin: 8px 0; background: var(--surface-2);
  border: 1px solid var(--line); border-radius: 5px; overflow: hidden; }
.meter-fill { height: 100%; width: 0; background: var(--accent);
  transition: width .3s ease; }
.meter-full { background: #c0503b; }

/* The studio lockup in the footer. Dimmed until hovered so it signs the page
   without competing with it. */
.foot-mark { display: inline-block; margin-bottom: 10px; opacity: .75;
  transition: opacity .15s; }
.foot-mark:hover { opacity: 1; }
.foot-mark img { display: block; width: 200px; max-width: 60vw; height: auto; }

/* The active filter can outlive its chip once its format is hidden, so the
   heading carries the way out. */
#clearFilter { margin-left: 10px; vertical-align: middle; }

/* ---------------------------------------------------------- deck catalog */
/* A card-index cabinet: wooden drawers with brass plates, holding paper index
   cards. Kept from the prototype, minus its webfonts - a CDN on the critical
   path of a page that otherwise loads entirely from this server. */
.cat-rail { display: flex; gap: 18px; overflow-x: auto; padding: 4px 2px 20px;
  scroll-snap-type: x proximity; }
.cat-drawer { flex: 0 0 280px; scroll-snap-align: start; display: flex;
  flex-direction: column; padding: 12px 12px 14px; border-radius: 10px;
  border: 1px solid #0c0805;
  background: linear-gradient(180deg, #54391f, #3b2917 14%, #2a1c10 100%);
  box-shadow: 0 1px 0 #6c4a28 inset, 0 14px 26px -12px #000a; }
.cat-drawer-open { background: linear-gradient(180deg, #3a3527, #2b2820 14%, #201d16 100%); }
.cat-drop { outline: 2px dashed var(--accent); outline-offset: -6px; }

.cat-plate { position: relative; margin-bottom: 12px; padding: 8px 42px 8px 12px;
  border: 1px solid #5b3f16; border-radius: 6px;
  background: linear-gradient(180deg, #f0d081, #c8974a 45%, #7c561f);
  box-shadow: 0 1px 0 #fbeec2 inset, 0 3px 7px -2px #000a; }
.cat-label { width: 100%; font: inherit; font-size: 15px; font-weight: 600;
  color: #241503; background: transparent; border: 0; outline: none;
  text-shadow: 0 1px 0 #f4dfa4; }
.cat-label:read-only { cursor: default; }
.cat-n { position: absolute; right: 9px; top: 50%; transform: translateY(-50%);
  padding: 1px 7px; font-size: 11px; font-weight: 600; color: #3a250a;
  background: #f3dca0; border: 1px solid #7c561f; border-radius: 20px;
  font-variant-numeric: tabular-nums; }

.cat-cards { flex: 1; display: flex; flex-direction: column; gap: 8px;
  min-height: 96px; padding: 6px 5px; border-radius: 6px; background: #0f140d;
  box-shadow: 0 2px 8px #0006 inset; }
.cat-card { position: relative; padding: 8px 26px 8px 12px; cursor: grab;
  border-radius: 3px 3px 4px 4px; border: 1px solid #cdbf9c;
  border-top: 3px solid #9e3b2f; color: #2b2318; font-size: 13px; line-height: 1.3;
  background: linear-gradient(180deg, #ece2ca, #e2d6b8);
  box-shadow: 0 2px 5px -1px #0008; }
.cat-card:active { cursor: grabbing; }
.cat-dragging { opacity: .4; }
.cat-name { display: block; color: #2b2318; text-decoration: none; font-weight: 600; }
.cat-name:hover { color: #7c2318; text-decoration: underline; }
.cat-meta { display: block; margin-top: 2px; font-size: 10px; color: #6a5c44; }
.cat-rm { position: absolute; top: 4px; right: 5px; padding: 2px; opacity: 0;
  color: #b0452f; font-size: 13px; line-height: 1; background: none; border: 0;
  cursor: pointer; }
.cat-card:hover .cat-rm, .cat-card:focus-within .cat-rm { opacity: .85; }
.cat-rm:hover { color: #7c2318; }

/* Drag-and-drop is unusable on a phone, so every card also carries this. */
.cat-move { display: flex; align-items: center; gap: 5px; margin-top: 5px; }
.cat-move-t { font-size: 10px; color: #6a5c44; }
.cat-move select { flex: 1; min-width: 0; padding: 1px 4px; font: inherit;
  font-size: 11px; color: #2b2318; background: #f6efdc; border: 1px solid #cdbf9c;
  border-radius: 4px; }

.cat-empty { margin: 0; padding: 22px 8px; text-align: center; font-size: 12px;
  font-style: italic; color: #5f6b56; }
.cat-foot { display: flex; justify-content: flex-end; margin-top: 8px; }
.cat-del { padding: 0; font: inherit; font-size: 11px; color: #8a7a5c;
  background: none; border: 0; cursor: pointer; }
.cat-del:hover { color: #d0705b; }

@media (max-width: 560px) { .cat-drawer { flex-basis: 84vw; } }
@media (prefers-reduced-motion: no-preference) {
  .cat-card { transition: transform .12s ease, box-shadow .12s ease; }
  .cat-card:hover { transform: translateY(-1px) rotate(-.35deg);
    box-shadow: 0 5px 10px -2px #0009; }
}
