:root {
  --card-w: 63mm;
  --card-h: 88mm;
}

/* ── FONTS ─────────────────────────────────────────────── */

@font-face {
  font-family: 'belerenb';
  src: url('assets/fonts/beleren-b.ttf') format('truetype');
  font-weight: bold;
  font-style: normal;
}

@font-face {
  font-family: 'mplantin';
  src: url('assets/fonts/mplantin.ttf') format('truetype');
  font-weight: normal;
  font-style: normal;
}

@font-face {
  font-family: 'mplantin';
  src: url('assets/fonts/mplantin-i.ttf') format('truetype');
  font-weight: normal;
  font-style: italic;
}

@font-face {
  font-family: 'gothammedium';
  src: url('assets/fonts/gotham-medium.ttf') format('truetype');
  font-weight: normal;
  font-style: normal;
}

@font-face {
  font-family: 'belerenbsc';
  src: url('assets/fonts/beleren-bsc.ttf') format('truetype');
  font-weight: bold;
  font-style: normal;
}

/* ── SCREEN LAYOUT ─────────────────────────────────────── */

*, *::before, *::after { box-sizing: border-box; }

body {
  margin: 0;
  padding: 0;
  background: #1e1e1e;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  color: #e0e0e0;
}

#controls {
  max-width: 560px;
  margin: 0 auto;
  padding: 28px 24px 20px;
}

h1 {
  font-size: 22px;
  font-weight: 700;
  margin: 0 0 20px;
  color: #f0f0f0;
}

/* ── INPUT-MODE TABS (B2) ───────────────────────────────── */

.tabs {
  display: flex;
  gap: 0;
  margin-bottom: 16px;
  border-bottom: 2px solid #383838;
}

.tab {
  padding: 7px 18px;
  border-radius: 6px 6px 0 0;
  border: none;
  background: transparent;
  color: #888;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: color 0.12s, background 0.12s;
}

.tab:hover  { color: #ccc; background: #2a2a2a; }
.tab.active { color: #fff; background: #2d2d2d; border-bottom: 2px solid #3b82f6; }

.mode-panel { }

/* ── FORM ELEMENTS ──────────────────────────────────────── */

.form-group {
  margin-bottom: 14px;
}

.form-row {
  display: flex;
  gap: 10px;
  margin-bottom: 14px;
}

.form-row .form-group {
  flex: 1;
  margin-bottom: 0;
}

label {
  display: block;
  font-size: 13px;
  color: #aaa;
  margin-bottom: 5px;
}

.field-hint {
  font-size: 11px;
  color: #777;
  margin-bottom: 6px;
}

.field-hint a {
  color: #7db4ff;
}

input[type="text"],
select,
textarea {
  width: 100%;
  padding: 9px 12px;
  border-radius: 6px;
  border: 1px solid #444;
  background: #2d2d2d;
  color: #e8e8e8;
  font-size: 14px;
  outline: none;
  transition: border-color 0.15s;
}

textarea {
  resize: vertical;
  min-height: 160px;
  font-family: 'Courier New', Courier, monospace;
  font-size: 13px;
  line-height: 1.5;
}

input[type="text"]:focus,
select:focus,
textarea:focus {
  border-color: #5b9cf6;
}

select option { background: #2d2d2d; }

/* ── WATERMARK COMBOBOX (searchable set picker) ─────────── */

.wm-combo {
  position: relative;
}

.wm-combo-input {
  cursor: text;
}

.wm-combo-list {
  position: absolute;
  z-index: 20;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  max-height: 320px;
  overflow-y: auto;
  margin: 0;
  padding: 4px;
  list-style: none;
  background: #2d2d2d;
  border: 1px solid #444;
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45);
}

.wm-combo-option {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 9px;
  border-radius: 5px;
  cursor: pointer;
  font-size: 13px;
  color: #e0e0e0;
}

.wm-combo-option:hover,
.wm-combo-option.active {
  background: #3b3b3b;
}

.wm-combo-option.selected {
  color: #7db4ff;
}

.wm-combo-icon {
  width: 18px;
  height: 18px;
  flex: none;
  object-fit: contain;
  filter: invert(1) brightness(1.4);
}

.wm-combo-icon--blank {
  display: inline-block;
}

.wm-combo-label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.wm-combo-empty {
  padding: 9px;
  font-size: 13px;
  color: #888;
}

/* Inline checkbox row */
.inline-check {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 14px;
}

.inline-check label {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 0;
  cursor: pointer;
  font-size: 13px;
  color: #aaa;
}

.inline-check input[type="checkbox"] {
  width: 14px;
  height: 14px;
  accent-color: #3b82f6;
  cursor: pointer;
}

/* ── BUTTONS ────────────────────────────────────────────── */

.actions {
  margin-top: 18px;
  display: flex;
  gap: 10px;
  align-items: center;
}

button {
  padding: 9px 22px;
  border-radius: 6px;
  border: none;
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  background: #3b82f6;
  color: #fff;
  transition: background 0.15s;
}

button:hover  { background: #2563eb; }
button:active { background: #1d4ed8; }

button.secondary             { background: #404040; }
button.secondary:hover       { background: #525252; }
button.secondary:active      { background: #5e5e5e; }

button.danger                { background: #7f1d1d; }
button.danger:hover          { background: #991b1b; }
button.danger:active         { background: #b91c1c; }

.cache-row {
  display: flex;
  gap: 8px;
}

.cache-row select {
  flex: 1;
}

/* ── STATUS ─────────────────────────────────────────────── */

#status {
  margin-top: 12px;
  font-size: 13px;
  min-height: 18px;
  line-height: 1.4;
}
#status.error   { color: #f87171; }
#status.loading { color: #60a5fa; }

/* ── CARD GRID (SCREEN) ─────────────────────────────────── */

#cardGrid {
  display: flex;
  flex-wrap: wrap;
  gap: 5mm;
  padding: 4px 24px 32px;
  justify-content: center;
}

/* A3: card-cell wrapper (holds canvas + crop-mark pseudo-elements) */
.card-cell {
  width:  var(--card-w);
  height: var(--card-h);
  flex-shrink: 0;
  position: relative;
}

/* ── CARD CANVAS ─────────────────────────────────────────── */

.card {
  width:  var(--card-w);
  height: var(--card-h);
  flex-shrink: 0;
  display: block;
  box-shadow: 0 3px 10px rgba(0,0,0,0.6);
}

/* Screen canvas: downsampled for crisp preview; print canvas: hidden */
.card--screen { display: block; }
.card--print  { display: none;  }

/* ── CARD HOVER OVERLAY ─────────────────────────────────── */

.card-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: rgba(0, 0, 0, 0.48);
  opacity: 0;
  transition: opacity 0.15s;
  border-radius: 4.5%;   /* matches canvas corner cutout */
  pointer-events: none;
}

.card-overlay-btns {
  display: flex;
  gap: 10px;
}

.card-cell:hover .card-overlay {
  opacity: 1;
  pointer-events: auto;
}

.card-btn {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: 2px solid rgba(255,255,255,0.85);
  background: rgba(0, 0, 0, 0.65);
  color: #fff;
  font-size: 17px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.12s, transform 0.1s;
  padding: 0;
}

.card-btn:hover  { background: rgba(59,130,246,0.85); transform: scale(1.12); }
.card-btn:active { transform: scale(0.96); }

.card-wm-select {
  width: 86%;
  font-size: 11px;
  padding: 4px 6px;
  border-radius: 5px;
  border: 1px solid rgba(255,255,255,0.35);
  background: rgba(0,0,0,0.72);
  color: #fff;
  cursor: pointer;
  outline: none;
}
.card-wm-select option { background: #1e1e1e; }

/* Drag handle for reordering the card grid */
.card-drag-handle {
  width: 86%;
  text-align: center;
  font-size: 14px;
  line-height: 1;
  padding: 3px 0;
  color: #ddd;
  background: rgba(0,0,0,0.72);
  border: 1px solid rgba(255,255,255,0.35);
  border-radius: 5px;
  cursor: grab;
  user-select: none;
}
.card-drag-handle:active { cursor: grabbing; }
.card-cell--dragging { opacity: 0.4; }

/* Inline title/subtitle editor (double-click a card) */
.inline-title-edit {
  position: absolute;
  top: 7%;
  left: 6%;
  right: 6%;
  z-index: 5;
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.inline-title-input {
  width: 100%;
  font-size: 12px;
  padding: 5px 7px;
  border-radius: 4px;
  border: 1px solid #5b9cf6;
  background: rgba(20, 20, 20, 0.96);
  color: #fff;
  outline: none;
}
/* Hide the hover overlay while inline-editing so it doesn't intercept clicks. */
.card-cell.inline-editing .card-overlay { display: none; }

/* ── MODALS ──────────────────────────────────────────────── */

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.82);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

/* Fullscreen lightbox: just the canvas centred */
#fullscreenCanvas {
  max-width:  min(90vw, 90vh * 0.714);  /* keep 63:88 aspect */
  max-height: 90vh;
  width: auto;
  height: auto;
  border-radius: 4.5%;
  box-shadow: 0 8px 40px rgba(0,0,0,0.8);
  display: block;
}

.modal-close {
  position: fixed;
  top: 18px;
  right: 22px;
  background: transparent;
  border: none;
  color: #fff;
  font-size: 26px;
  cursor: pointer;
  line-height: 1;
  padding: 4px 8px;
  opacity: 0.75;
  transition: opacity 0.12s;
}
.modal-close:hover { opacity: 1; background: transparent; }

/* Edit modal box */
.modal-box {
  background: #252525;
  border-radius: 10px;
  width: min(1040px, 96vw);
  max-height: 92vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 12px 48px rgba(0,0,0,0.7);
}

/* Two-column body: fields on the left, live preview on the right */
.modal-body {
  display: flex;
  flex: 1;
  min-height: 0;
}
.modal-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
}
.modal-preview {
  flex-shrink: 0;
  width: 360px;
  padding: 14px 18px;
  border-left: 1px solid #383838;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}
.modal-preview-label {
  font-size: 12px;
  color: #888;
  align-self: flex-start;
}
#editPreviewCanvas {
  width: 100%;
  height: auto;
  aspect-ratio: 63 / 88;
  border-radius: 4.5%;
  background: #1a1a1a;
  box-shadow: 0 4px 18px rgba(0,0,0,0.55);
  display: block;
}
/* Art reposition controls (drag-to-pan + zoom + reset), art styles only */
#editPreviewCanvas.art-pannable        { cursor: grab; }
#editPreviewCanvas.art-pannable.panning { cursor: grabbing; }
.art-transform {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.art-transform-hint {
  font-size: 11px;
  color: #777;
}
.art-transform-row {
  display: flex;
  align-items: center;
  gap: 8px;
}
.art-transform-row label {
  font-size: 12px;
  color: #aaa;
}
.art-transform-row input[type="range"] {
  flex: 1;
  min-width: 0;
  accent-color: #6a9bd1;
}
.art-transform-reset {
  align-self: flex-start;
  font-size: 12px;
  padding: 5px 10px;
}

/* Keep the preview on the side at all widths — just narrow it on smaller screens. */
@media (max-width: 720px) {
  .modal-preview { width: 260px; padding: 12px; }
}
@media (max-width: 560px) {
  .modal-preview { width: 180px; padding: 10px; }
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px 10px;
  border-bottom: 1px solid #383838;
}

.modal-title {
  font-weight: 700;
  font-size: 15px;
  color: #f0f0f0;
}

.modal-close-sm {
  background: transparent;
  border: none;
  color: #aaa;
  font-size: 18px;
  cursor: pointer;
  padding: 2px 6px;
  line-height: 1;
  transition: color 0.12s;
}
.modal-close-sm:hover { color: #fff; background: transparent; }

/* Edit modal: per-type card tables (replaces the old free-text textarea) */
.edit-cards-field { flex: 1; min-height: 0; padding-bottom: 14px; }
.edit-cards-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.auto-sort-toggle {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  color: #aaa;
  margin: 0;
  cursor: pointer;
}
.auto-sort-toggle input { accent-color: #6a9bd1; }

.edit-card-tables { display: flex; flex-direction: column; gap: 14px; }
.edit-card-table-section { }
.edit-card-table-heading {
  font-size: 12px;
  font-weight: 600;
  color: #999;
  padding: 6px 2px 4px;
  border-bottom: 1px solid #383838;
}
.edit-card-table { width: 100%; border-collapse: collapse; }
.edit-card-table td { padding: 3px 4px; }

.edit-card-handle-cell { width: 26px; }
.edit-card-handle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  font-size: 13px;
  color: #999;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 5px;
  cursor: grab;
  user-select: none;
}
.edit-card-handle:hover, .edit-card-handle:focus { color: #ddd; border-color: #555; outline: none; }
.edit-card-handle:active { cursor: grabbing; }
.edit-card-row--dragging { opacity: 0.4; }

.edit-card-count  { width: 44px; text-align: center; }
.edit-card-name   { width: 100%; min-width: 120px; }
.edit-card-cost   { width: 90px; font-family: 'Courier New', Courier, monospace; }
.edit-card-rarity { width: auto; background-color: #2d2d2d; }
.edit-card-table input[type="text"],
.edit-card-table input[type="number"],
.edit-card-table select {
  padding: 5px 7px;
  font-size: 12.5px;
}

/* Cost cell: mana-icon display by default, swaps to the raw {w}{u} text input on click */
.edit-card-cost-cell { min-width: 84px; }
.edit-card-cost-display {
  display: flex;
  align-items: center;
  gap: 2px;
  min-height: 24px;
  width: 100%;
  padding: 3px 6px;
  border: 1px solid transparent;
  border-radius: 5px;
  background: transparent;
  cursor: pointer;
}
.edit-card-cost-display:hover, .edit-card-cost-display:focus {
  border-color: #4a4a4a;
  background: #2a2a2a;
  outline: none;
}
.edit-card-cost-display .mana-icon {
  width: 15px;
  height: 15px;
  flex: none;
}
.edit-card-cost-empty {
  color: #666;
  font-size: 12px;
}
.edit-card-cost-unknown {
  font-family: 'Courier New', Courier, monospace;
  font-size: 11px;
  color: #ccc;
}

.edit-card-remove {
  border: none;
  background: transparent;
  color: #777;
  font-size: 13px;
  line-height: 1;
  padding: 4px 6px;
  cursor: pointer;
  border-radius: 5px;
}
.edit-card-remove:hover { color: #f87171; background: #333; }

.edit-card-empty-row td {
  color: #666;
  font-size: 12px;
  font-style: italic;
  padding: 6px 4px;
}

.edit-card-addrow .edit-card-add-input {
  width: 100%;
  background: transparent;
  border: 1px dashed #444;
  color: #ccc;
  font-size: 12.5px;
  padding: 5px 7px;
}
.edit-card-addrow .edit-card-add-input:focus { border-color: #6a9bd1; border-style: solid; }

.modal-footer {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 18px;
  border-top: 1px solid #383838;
}

.modal-status {
  flex: 1;
  font-size: 13px;
  line-height: 1.4;
}
.modal-status.error { color: #f87171; }

/* Batch title/subtitle edit — a narrower modal, table body scrolls */
.batch-edit-box { width: min(680px, 96vw); }
.batch-edit-body {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 4px 18px 14px;
}
.batch-edit-table { width: 100%; border-collapse: collapse; }
.batch-edit-table th {
  position: sticky;
  top: 0;
  text-align: left;
  font-size: 12px;
  font-weight: 600;
  color: #999;
  padding: 8px 8px 6px;
  background: #252525;
  border-bottom: 1px solid #383838;
}
.batch-edit-table td { padding: 4px 8px; }
.batch-edit-table input[type="text"] {
  width: 100%;
  padding: 6px 9px;
  font-size: 13px;
}
.batch-edit-table input.subtitle-input { color: #aaa; }

.modal-field {
  padding: 10px 18px 0;
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.modal-field label {
  font-size: 12px;
  color: #aaa;
}
.modal-field input {
  background: #1a1a1a;
  border: 1px solid #444;
  border-radius: 5px;
  color: #eee;
  font-size: 13px;
  padding: 6px 10px;
  outline: none;
}
.modal-field input:focus { border-color: #666; }

/* art url row: input + reset button + live preview thumbnail */
.art-url-row { display: flex; gap: 8px; align-items: center; }
.art-url-row input { flex: 1; min-width: 0; }
.art-reset-btn {
  flex-shrink: 0;
  width: 30px;
  height: 30px;
  padding: 0;
  font-size: 13px;
  line-height: 1;
  background: #333;
  color: #bbb;
  border: 1px solid #444;
  border-radius: 5px;
}
.art-reset-btn:hover  { background: #444; color: #fff; }
.art-reset-btn:active { background: #4a4a4a; }

/* color override toggles: Auto + WUBRG + C swatch buttons */
.color-toggles { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.color-toggle {
  position: relative;
  width: 30px;
  height: 30px;
  padding: 0;
  font-size: 13px;
  font-weight: 700;
  line-height: 1;
  background: #1a1a1a;
  color: #888;
  border: 2px solid #444;
  border-radius: 50%;
  cursor: pointer;
}
/* Order badge (1st/2nd) shown on the two active swatches of a manual 2-color
   override, so the ability to reorder them (via editColorSwap) is visible. */
.color-toggle[data-order]::after {
  content: attr(data-order);
  position: absolute;
  top: -4px;
  right: -4px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #fff;
  color: #111;
  font-size: 9px;
  font-weight: 700;
  line-height: 14px;
  text-align: center;
}
.color-swap-btn { width: auto; padding: 0 10px; font-size: 15px; }
.color-toggle--auto {
  width: auto;
  padding: 0 12px;
  border-radius: 15px;
  font-weight: 600;
}
.color-toggle:hover { border-color: #777; color: #ccc; }
/* active = selected: tint swatch with its MTG color (refs js/config.js COLOR_HEX) */
.color-toggle.active { color: #111; border-color: #fff; }
.color-toggle--W.active { background: #b79d58; }
.color-toggle--U.active { background: #5e98d9; }
.color-toggle--B.active { background: #5e5e5e; color: #eee; }
.color-toggle--R.active { background: #d16e5e; }
.color-toggle--G.active { background: #5e9e5e; }
.color-toggle--C.active { background: #9e9e9e; }
.color-toggle--auto.active { background: #4a4a4a; color: #fff; border-color: #888; }
.art-preview-thumb {
  width: 50px;
  height: 36px;
  border-radius: 4px;
  border: 1px solid #444;
  background: #1a1a1a;
  flex-shrink: 0;
  overflow: hidden;
}
.art-preview-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }

/* color-blend slider: range + percent readout + Auto reset */
.blend-row { display: flex; gap: 10px; align-items: center; }
.blend-row input[type="range"] {
  flex: 1;
  min-width: 0;
  accent-color: #888;
  cursor: pointer;
}
.blend-value {
  flex-shrink: 0;
  width: 42px;
  text-align: right;
  font-size: 13px;
  color: #ccc;
  font-variant-numeric: tabular-nums;
}
.blend-row .art-reset-btn {
  width: auto;
  padding: 0 10px;
}

/* art picker panel */
.art-picker {
  margin: 10px 18px 0;
  background: #1a1a1a;
  border: 1px solid #383838;
  border-radius: 7px;
  overflow: hidden;
}
.art-picker-tabs { display: flex; border-bottom: 1px solid #2c2c2c; }
.art-picker-tab {
  flex: 1;
  padding: 7px 0;
  font-size: 12px;
  color: #888;
  background: transparent;
  border: none;
  cursor: pointer;
  font-weight: 500;
}
.art-picker-tab.active { color: #5b9cf6; border-bottom: 2px solid #5b9cf6; margin-bottom: -1px; }
.art-picker-tab:hover { background: #242424; }
.art-picker-search-row { padding: 8px 10px; border-bottom: 1px solid #2c2c2c; }
.art-picker-search-row input {
  width: 100%;
  background: #242424;
  border: 1px solid #383838;
  border-radius: 4px;
  color: #e0e0e0;
  font-size: 12px;
  padding: 5px 9px;
  outline: none;
}
.art-picker-search-row input:focus { border-color: #555; }
.art-picker-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
  padding: 10px;
  max-height: 340px;
  overflow-y: auto;
}
.art-picker-thumb {
  aspect-ratio: 4/3;
  border-radius: 4px;
  border: 1.5px solid transparent;
  background: #2a2a2a;
  overflow: hidden;
  cursor: pointer;
  position: relative;
  transition: border-color 0.1s;
}
.art-picker-thumb:hover { border-color: #666; }
.art-picker-thumb.selected { border-color: #5b9cf6; }
.art-picker-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
/* Broken art: hide the empty <img> and show a placeholder glyph behind it. */
.art-picker-thumb--broken { display: flex; align-items: center; justify-content: center; }
.art-picker-thumb--broken img { display: none; }
.art-picker-thumb--broken::before {
  content: "⊘";
  color: #555;
  font-size: 18px;
}
/* "Find other artworks" button — top-right corner of deck-tab thumbs, on hover. */
.art-picker-thumb-find {
  position: absolute;
  top: 3px; right: 3px;
  width: 20px; height: 20px;
  padding: 0;
  border: none;
  border-radius: 4px;
  background: rgba(0,0,0,.72);
  color: #ddd;
  font-size: 11px;
  line-height: 20px;
  text-align: center;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.1s, background 0.1s;
}
.art-picker-thumb:hover .art-picker-thumb-find,
.art-picker-thumb-find:focus-visible { opacity: 1; }
.art-picker-thumb-find:hover { background: #5b9cf6; }
.art-picker-thumb-name {
  position: absolute;
  bottom: 0; left: 0; right: 0;
  background: rgba(0,0,0,.72);
  font-size: 8px;
  color: #ccc;
  padding: 2px 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.art-picker-empty {
  grid-column: 1 / -1;
  text-align: center;
  color: #555;
  font-size: 12px;
  padding: 20px 0;
}
.art-picker-loading {
  grid-column: 1 / -1;
  text-align: center;
  color: #555;
  font-size: 12px;
  padding: 16px 0;
}
.art-picker-status {
  font-size: 11px;
  color: #888;
  padding: 6px 10px 0;
  min-height: 12px;
}
.art-picker-status:empty { padding: 0; }

/* ── PRINT LAYOUT (A2 + A3) ─────────────────────────────── */

/* Default @page is A4; JavaScript injects an override for Letter. */
@page { size: A4 portrait; margin: 0; }

@media print {
  body  { background: white; }

  #controls { display: none !important; }

  /* Canvas must print its pixel content faithfully */
  canvas {
    print-color-adjust: exact;
    -webkit-print-color-adjust: exact;
    image-rendering: auto;
  }

  #cardGrid {
    display: grid;
    grid-template-columns: repeat(3, var(--card-w));
    grid-auto-rows: var(--card-h);
    gap: 2mm;
    padding: 4mm;
    justify-content: center;
    width: auto;
  }

  /* Grid items are .card-cell; page break every 9 cells */
  .card-cell {
    width:  var(--card-w);
    height: var(--card-h);
    position: relative;
  }

  .card-cell:nth-child(9n + 1):not(:first-child) {
    break-before: page;
    page-break-before: always;
  }

  .card {
    box-shadow: none;
    break-inside: avoid;
    page-break-inside: avoid;
  }

  /* Swap: hide the display canvas, show the full-res print canvas */
  .card--screen { display: none !important; }
  .card--print  { display: block !important; }

  .card-overlay, .modal-overlay { display: none !important; }

  /* A3: crop-mark hairlines — visible when body.crop-marks is set */
  body.crop-marks .card-cell {
    box-shadow: 0 0 0 0.3mm rgba(0, 0, 0, 0.65);
  }
}
