@font-face {
  font-family: "PrintokenTitle";
  src: url("fonts/free/Cinzel.ttf") format("truetype-variations"),
       url("fonts/free/Cinzel.ttf") format("truetype");
  font-weight: 400 900;
  font-display: block;
}
@font-face {
  font-family: "PrintokenBody";
  src: url("fonts/free/EBGaramond.ttf") format("truetype-variations"),
       url("fonts/free/EBGaramond.ttf") format("truetype");
  font-weight: 400 800;
  font-style: normal;
  font-display: block;
}
@font-face {
  font-family: "PrintokenBody";
  src: url("fonts/free/EBGaramond-Italic.ttf") format("truetype-variations"),
       url("fonts/free/EBGaramond-Italic.ttf") format("truetype");
  font-weight: 400 800;
  font-style: italic;
  font-display: block;
}
@font-face {
  font-family: "PrintokenMana";
  src: url("fonts/free/Mana.ttf") format("truetype");
  font-display: block;
}

:root {
  --bg: #f6f5f1;
  --ink: #111;
  --line: #d6d3cb;
  --accent: #111;
  font-family: -apple-system, BlinkMacSystemFont, "Inter", "Helvetica Neue", sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
  padding-bottom: 4rem;
}

header {
  padding: 1rem 1rem 0.5rem;
  text-align: center;
}
header .logo { color: inherit; text-decoration: none; }
header .logo:hover { opacity: 0.85; }
h1 { margin: 0; font-size: 1.4rem; letter-spacing: 0.02em; }
.tag { margin: 0.25rem 0 0; color: #666; font-size: 0.85rem; }

main {
  max-width: 1000px;
  margin: 0 auto;
  padding: 1rem;
}

.view {
  display: grid;
  gap: 1.5rem;
  grid-template-columns: 1fr;
}

@media (min-width: 800px) {
  #view-create { grid-template-columns: 1fr 1fr; align-items: start; }
  #view-create #preview-wrap { position: sticky; top: 1rem; }
}

/* ----- Cross-page navigation ----- */

.page-nav {
  display: flex;
  justify-content: center;
  gap: 0.5rem;
  margin: 0.5rem 0 0;
  flex-wrap: wrap;
}
.page-nav a.ghost {
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  min-height: 44px; /* comfortable tap target */
}

/* ----- Search ----- */

.search-bar {
  display: grid;
  gap: 0.5rem;
  grid-template-columns: 1fr;
  max-width: 600px;
  margin: 0 auto 1rem;
}
@media (min-width: 600px) {
  .search-bar { grid-template-columns: 1fr auto auto; align-items: center; }
}
.search-bar input[type=search] {
  padding: 0.7rem 0.9rem;
  font: inherit;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  min-width: 0;
}
.search-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.85rem;
  color: #555;
  user-select: none;
}
.search-bar button {
  padding: 0.7rem 1.2rem;
}

.search-status { text-align: center; color: #666; font-size: 0.85rem; min-height: 1.2em; margin: 0.25rem 0 0.75rem; }

.search-results {
  display: grid;
  gap: 0.75rem;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  max-width: 1000px;
  margin: 0 auto;
}
.result-tile {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  padding: 0.4rem;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 10px;
  cursor: pointer;
  text-align: left;
  font: inherit;
  color: inherit;
  transition: transform 0.08s ease, box-shadow 0.08s ease;
}
.result-tile:hover, .result-tile:focus { transform: translateY(-2px); box-shadow: 0 4px 12px rgba(0,0,0,0.08); outline: none; }
.result-tile img { width: 100%; height: auto; border-radius: 6px; display: block; }
.result-meta { display: flex; flex-direction: column; gap: 1px; padding: 0.1rem 0.2rem 0.3rem; }
.result-name { font-size: 0.85rem; font-weight: 600; line-height: 1.2; }
.result-set { font-size: 0.7rem; color: #888; }

#search-preview:not([hidden]) {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
  max-width: 480px;
  margin: 0 auto;
}
.preview-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  gap: 0.75rem;
  font-weight: 600;
}
.preview-bar #search-preview-name { font-size: 1rem; color: #111; }
button.ghost, a.ghost {
  background: transparent;
  color: #111;
  border: 1px solid var(--line);
  padding: 0.45rem 0.8rem;
  font-weight: 500;
  font-size: 0.8rem;
  font-family: inherit;
}
button.ghost:hover, a.ghost:hover { background: #eee; }
#search-canvases {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3rem;
  width: 100%;
}

details.advanced {
  width: 100%;
  max-width: 320px;
  margin: 0.75rem auto 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  overflow: hidden;
}
details.advanced > summary {
  cursor: pointer;
  padding: 0.5rem 0.8rem;
  font-size: 0.85rem;
  font-weight: 600;
  color: #444;
  user-select: none;
  list-style: none;
}
details.advanced > summary::after { content: " ▾"; color: #888; font-weight: 400; }
details.advanced[open] > summary::after { content: " ▴"; }
.advanced-grid {
  display: grid;
  gap: 0.75rem;
  padding: 0.75rem 0.8rem 0.9rem;
  border-top: 1px solid var(--line);
}
.advanced-grid label {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  font-size: 0.75rem;
  color: #555;
}
.advanced-grid label.inline { flex-direction: row; align-items: center; gap: 0.5rem; }
.advanced-grid input[type=range] { width: 100%; }
.advanced-grid output { font-size: 0.7rem; color: #888; align-self: flex-end; }

/* ----- Momir Basic ----- */

.momir-intro {
  text-align: center;
  color: #666;
  font-size: 0.9rem;
  margin: 0 0 1rem;
}

.momir-controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  flex-wrap: wrap;
}

.momir-cmc-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.momir-cmc-val {
  font-size: 2.5rem;
  font-weight: 700;
  min-width: 2.5rem;
  text-align: center;
  line-height: 1;
}

#momir-preview:not([hidden]) {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
  max-width: 480px;
  margin: 0 auto;
}

#momir-canvases {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3rem;
  width: 100%;
}

.momir-face {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  width: 100%;
}

.momir-face-label {
  margin: 0;
  font-size: 0.8rem;
  font-weight: 600;
  color: #555;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.momir-canvas {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 4px;
  width: min(100%, 320px);
  height: auto;
  image-rendering: pixelated;
  box-shadow: 0 2px 12px rgba(0,0,0,0.06);
}

.momir-face button { width: 100%; max-width: 320px; }

/* ----- Card-shaped form, proportions from M15 token template ----- */
/* Template grid: 375 × 523, with regions
     name  y 26-54   (28u)
     art   y 62-351  (289u)
     type  y 354-374 (20u)
     text  y 388-482 (94u)
     pt    y 466-508 (overlaps text bottom-right)
   We mirror the proportions in the form. Gaps approximate the template's
   empty bands between regions (8u, 3u, 14u). */

.card-form {
  width: 100%;
  max-width: 480px;
  margin: 0 auto;
  background: #fff;
  border: 2px solid #111;
  border-radius: 18px;
  padding: 0;
  display: grid;
  /* Loosely follows the M15 template proportions, but the name and type rows
     get a UX-friendly minimum so their controls aren't squashed.
     Row heights scaled from 420px → 480px baseline (×1.143) to preserve
     the M15 aspect ratio as the card gets wider. */
  grid-template-rows: 55px 10px 320px 17px auto 17px 164px;
  grid-template-columns: 1fr;
  gap: 0;
  box-shadow: 0 6px 24px rgba(0,0,0,0.08);
  position: relative;
  min-height: 640px;
  overflow: hidden; /* clip row corners against the rounded card edge */
}

/* Spacer rows (the gaps) — empty divs would work, but we let grid eat them */

.card-row {
  margin: 0;
  padding: 4px 8px;
  border: 0;
  border-radius: 0;
  background: #fafaf7;
  display: flex;
  align-items: center;
  gap: 6px;
  min-height: 0; /* allow rows to shrink to grid track */
  min-width: 0;
  overflow: hidden;
}

.title-row { grid-row: 1; }
.art-row   { grid-row: 3; }
.type-row  { grid-row: 5; }
.text-row  { grid-row: 7; }

.card-row legend { padding: 0 0.3rem; font-weight: 600; font-size: 0.65rem; text-transform: uppercase; letter-spacing: 0.05em; color: #777; }

label {
  display: block;
  font-size: 0.7rem;
  color: #666;
  margin: 0;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  min-width: 0;
}

label.grow { flex: 1 1 auto; min-width: 0; }

input[type=text], input[type=file], textarea, select {
  display: block;
  width: 100%;
  margin-top: 1px;
  padding: 0.3rem 0.45rem;
  font: inherit;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 4px;
  color: var(--ink);
}
textarea { resize: none; height: 100%; }

/* Title row: name + cost — slim, dark band like a card title */
.title-row { background: #111; padding: 4px 6px; gap: 6px; }
.title-row input { background: #fff; padding: 3px 8px; font-weight: 600; border: 0; }
.title-row .grow { flex: 1 1 auto; min-width: 0; }
.title-row .cost { width: 100px; flex: 0 0 auto; font-weight: 400; text-align: right; font-family: "Courier New", monospace; }

/* Art row: dominates the card visually, like the real art window */
.art-row {
  flex-direction: column;
  align-items: stretch;
  justify-content: center;
  padding: 10px;
  background: repeating-linear-gradient(45deg, #f4f3ee, #f4f3ee 6px, #ecebe5 6px, #ecebe5 12px);
  text-align: center;
  gap: 6px;
}
.art-row input[type=file] { background: rgba(255,255,255,0.85); border-style: dashed; }
.art-row .hint { margin: 0; font-size: 0.65rem; color: #888; }

/* Type row: thin band, type+subtype+colors all inline */
.type-row { background: #111; padding: 4px 6px; gap: 6px; align-items: center; }
.type-row .tagpicker { background: #fff; min-height: 26px; padding: 2px; }
.type-row .grow { flex: 1 1 auto; min-width: 0; }
.type-row .prefix-hint,
.type-row .dash {
  display: inline-block;
  color: #ccc;
  font-size: 0.7rem;
  text-transform: none;
  letter-spacing: 0;
  flex: 0 0 auto;
  padding: 0 2px;
}

/* Text row: rules + flavor — gets the largest slice after art */
.text-row {
  flex-direction: column;
  align-items: stretch;
  gap: 0;
  padding: 8px 10px 36px; /* leave room for the PT pill bottom-right */
  position: relative;
  background: #fff;
}
.text-row textarea {
  min-height: 28px;
  border: 0;
  padding: 4px 0;
  background: transparent;
  font-size: 0.9rem;
  line-height: 1.3;
  outline: none;
  font-family: inherit;
  color: var(--ink);
  width: 100%;
}
.text-row textarea:focus { background: #f7f6f1; }
.text-row textarea::placeholder { color: #888; opacity: 1; }
.text-row textarea.rules  { flex: 2 1 0; }
.text-row textarea.flavor {
  flex: 1 1 0;
  font-style: italic;
  border-top: 1px dashed var(--line);
  padding-top: 6px;
  margin-top: 4px;
}
.text-row textarea.flavor::placeholder { font-style: italic; color: #aaa; }

/* Tag picker */
.tagpicker {
  margin-top: 4px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 5px;
  padding: 4px;
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  align-items: center;
  position: relative;
  min-height: 34px;
}
.tagpicker .chips {
  display: contents;
}
.tagpicker .chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: #111;
  color: #fff;
  font-size: 0.75rem;
  padding: 2px 4px 2px 8px;
  border-radius: 999px;
  text-transform: none;
  letter-spacing: 0;
  font-weight: 500;
}
.tagpicker .chip-x {
  background: transparent;
  color: #fff;
  border: 0;
  font-size: 0.95rem;
  line-height: 1;
  padding: 0 4px;
  cursor: pointer;
  border-radius: 999px;
}
.tagpicker .chip-x:hover { background: rgba(255,255,255,0.15); }

.tagpicker .add-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  padding: 0;
  border: 1px dashed #888;
  background: transparent;
  color: #555;
  border-radius: 999px;
  font-size: 1rem;
  font-weight: 600;
  line-height: 1;
  cursor: pointer;
}
.tagpicker .add-btn:hover { background: #eee; color: #111; border-color: #555; }
.tagpicker .search-wrap[hidden] { display: none; }

.tagpicker .search-wrap {
  position: relative;
  flex: 1 1 100px;
  min-width: 100px;
}
.tagpicker .tagsearch {
  border: 0;
  outline: 0;
  padding: 4px 6px;
  margin: 0;
  width: 100%;
  background: transparent;
  font-size: 0.85rem;
  text-transform: none;
  letter-spacing: 0;
  color: var(--ink);
}
/* Tagpicker popover is portaled to <body> so it escapes the clipped card. */
.tagpicker-popover {
  position: fixed;
  top: -9999px;
  left: -9999px;
  z-index: 1000;
  list-style: none;
  margin: 0;
  padding: 4px 0;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 6px;
  max-height: 220px;
  overflow-y: auto;
  box-shadow: 0 8px 24px rgba(0,0,0,0.18);
  font-size: 0.85rem;
  color: var(--ink);
}
.tagpicker-popover li {
  padding: 4px 10px;
  cursor: pointer;
}
.tagpicker-popover li.active,
.tagpicker-popover li:hover { background: #eee; }
.tagpicker-popover li.custom { color: #555; font-style: italic; }
.tagpicker-popover li.custom.active { color: #111; background: #ffe9b3; }

fieldset.colors {
  border: 1px solid #444;
  border-radius: 6px;
  padding: 2px 4px;
  margin: 0;
  display: flex;
  flex-wrap: nowrap;
  gap: 2px;
  background: #1a1a1a;
  flex: 0 0 auto;
}
fieldset.colors label {
  display: inline-flex; align-items: center; justify-content: center;
  margin: 0; color: #eee;
  text-transform: none; font-size: 0.65rem; font-weight: 700;
  width: 18px; height: 18px;
  border-radius: 999px;
  cursor: pointer;
  user-select: none;
}
fieldset.colors input { position: absolute; opacity: 0; pointer-events: none; }
fieldset.colors label:has(input:checked) { background: #fff; color: #111; }
fieldset.colors label:hover { background: #333; }
fieldset.colors label:has(input:checked):hover { background: #ddd; }

/* Text row: rules + flavor stacked */
.text-row {
  flex-direction: column;
  align-items: stretch;
  gap: 6px;
  min-height: 130px;
}
.text-row label { display: block; }

/* P/T row: positioned to overlap the text row's bottom-right corner,
   exactly like the P/T box on a real M15 card. */
.pt-row {
  position: absolute;
  right: 18px;
  bottom: 18px;
  background: #fff;
  border: 1.5px solid #111;
  border-radius: 8px;
  padding: 4px 8px;
  display: flex;
  align-items: center;
  gap: 2px;
  z-index: 5;
  box-shadow: 0 2px 6px rgba(0,0,0,0.06);
}
.pt-row input { min-width: 2.5ch; width: 2.5ch; padding: 2px 4px; text-align: center; font-weight: 700; border: 0; background: transparent; font-size: 1rem; }
.pt-row input:focus { outline: 1px solid #111; }
.pt-row .slash { font-weight: 700; color: #999; padding: 0 1px; }

/* Output settings — separate panel below the card */
.output {
  width: 100%;
  max-width: 420px;
  margin: 16px auto 0;
  padding: 0.75rem 1rem 1rem;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  display: grid;
  gap: 0.6rem;
  grid-template-columns: 1fr 1fr;
}
.output legend { grid-column: 1 / -1; padding: 0 0.4rem; font-weight: 600; font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.05em; color: #555; }

.hint { font-size: 0.75rem; color: #888; margin: 0.4rem 0 0; }

#preview-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
}

#preview {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 4px;
  width: min(100%, 424px);
  height: auto;
  image-rendering: pixelated;
  box-shadow: 0 2px 12px rgba(0,0,0,0.06);
}

button {
  font: inherit;
  background: var(--ink);
  color: #fff;
  border: 0;
  padding: 0.7rem 1.4rem;
  border-radius: 999px;
  font-weight: 600;
  cursor: pointer;
}
button:active { transform: translateY(1px); }
button:disabled { opacity: 0.55; cursor: not-allowed; transform: none; }

/* ----- Art row: preview + compact controls (create page) ----- */
.art-preview {
  flex: 1 1 0;
  min-height: 0;
  border-radius: 4px;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}
.art-preview img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}
.art-preview-hint {
  font-style: italic;
  font-size: 0.75rem;
  color: #aaa;
  pointer-events: none;
}
.art-controls {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.art-controls input[type=file] {
  font-size: 0.7rem;
  padding: 2px 4px;
}
.art-controls select {
  font-size: 0.75rem;
  padding: 3px 4px;
}
.ai-row {
  display: flex;
  gap: 5px;
  align-items: center;
}
.ai-row textarea {
  flex: 1 1 0;
  min-width: 0;
  height: 28px;
  min-height: unset;
  font-size: 0.75rem;
  background: rgba(255,255,255,0.85);
  border: 1px solid var(--line);
  border-radius: 4px;
  resize: none;
  padding: 3px 6px;
  color: var(--ink);
  line-height: 1.4;
  overflow: hidden;
}
.ai-row textarea::placeholder { color: #999; }
#ai-generate {
  flex: 0 0 auto;
  padding: 0.3rem 0.6rem;
  font-size: 0.72rem;
  border-radius: 999px;
  white-space: nowrap;
}
#ai-regenerate {
  flex: 0 0 auto;
  padding: 0.25rem 0.55rem;
  font-size: 1rem;
  background: rgba(255,255,255,0.8);
  color: #111;
  border: 1px solid var(--line);
  border-radius: 999px;
  font-weight: 400;
  line-height: 1;
}
#ai-regenerate:hover { background: #fff; }
.ai-status {
  font-size: 0.65rem;
  color: #666;
  margin: 0;
  text-align: center;
}
.ai-status.ai-status--error { color: #b00; }

/* ═══════════════════════════════════════════════════════════════
   RECEIPT THEME  (receipt-theme branch)
   Mimics thermal receipt paper: cream stock, Courier, dashes.
   ═══════════════════════════════════════════════════════════════ */

:root {
  --bg:     #faf6ee;   /* warm cream — "unprinted" receipt stock */
  --ink:    #1a1209;   /* near-black thermal ink */
  --mid:    #8a7d6a;   /* faded mid-tone */
  --line:   #c8bfaf;   /* dashed border colour */
  --roll-shadow: rgba(26,18,9,.13);
  font-family: 'Courier Prime', 'Courier New', Courier, monospace;
}

/* ── Base ── */
body {
  background: #e8e0d0;  /* slightly darker surround — "counter surface" */
}

/* Receipt "paper roll" strip centred on the page */
main {
  background: var(--bg);
  box-shadow: 2px 0 8px var(--roll-shadow), -2px 0 8px var(--roll-shadow);
  max-width: 620px;
  padding: 1.5rem 1.25rem 3rem;
}

/* ── Header ── */
header {
  font-family: 'Courier Prime', 'Courier New', Courier, monospace;
  border-bottom: 1px dashed var(--ink);
  padding-bottom: 0.75rem;
  margin-bottom: 0;
}

h1 {
  font-family: inherit;
  font-weight: 700;
  font-size: 1.5rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.tag {
  color: var(--mid);
  font-size: 0.8rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.tag::before { content: '* '; }
.tag::after  { content: ' *'; }

.back-link, .create-link {
  font-size: 0.75rem;
  color: var(--mid);
  letter-spacing: 0.04em;
}
.back-link a, .create-link a { color: var(--ink); }

/* ── Buttons ── */
button {
  font-family: inherit;
  background: var(--ink);
  color: var(--bg);
  border-radius: 0;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-size: 0.78rem;
  padding: 0.55rem 1.1rem;
}
button.ghost, a.ghost {
  background: transparent;
  color: var(--ink);
  border: 1px dashed var(--ink);
}
button.ghost:hover, a.ghost:hover { background: rgba(26,18,9,.07); }

/* ── Search bar ── */
.search-bar {
  gap: 6px;
}

.search-bar input[type=search] {
  font-family: inherit;
  font-size: 0.9rem;
  background: var(--bg);
  border: 1px dashed var(--ink);
  border-radius: 0;
  padding: 0.55rem 0.75rem;
  color: var(--ink);
}
.search-bar input[type=search]::placeholder { color: var(--mid); }

.search-bar button {
  border-radius: 0;
}

.search-toggle {
  font-size: 0.75rem;
  letter-spacing: 0.04em;
  color: var(--mid);
}

/* ── Search status ── */
.search-status {
  font-size: 0.75rem;
  color: var(--mid);
  letter-spacing: 0.04em;
}

/* ── Result tiles ── */
.card-tile {
  background: var(--bg);
  border: 1px dashed var(--line);
  border-radius: 0;
  box-shadow: none;
}
.card-tile:hover {
  border-color: var(--ink);
  box-shadow: none;
  transform: none;
}

.tile-name {
  font-weight: 700;
  letter-spacing: 0.04em;
}

.tile-type {
  color: var(--mid);
  font-size: 0.75rem;
  letter-spacing: 0.04em;
}

/* ── Output / advanced panels ── */
fieldset.output {
  border: 1px dashed var(--ink);
  border-radius: 0;
  font-size: 0.78rem;
  letter-spacing: 0.04em;
}

fieldset.output legend {
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

details.advanced summary {
  font-size: 0.75rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--mid);
}

select, input[type=range] {
  font-family: inherit;
  font-size: 0.78rem;
  border: 1px dashed var(--line);
  border-radius: 0;
  background: var(--bg);
  color: var(--ink);
}

/* ── Create form ── */
#view-create {
  gap: 1.25rem;
}

/* Card form — keep the MTG card shape, but receipt-coloured */
.card-form {
  border: 1px dashed var(--ink);
}

/* Title row */
.title-row {
  background: var(--ink);
  border-bottom: none;
}

.title-row input[name=name] {
  font-family: 'Courier Prime', 'Courier New', Courier, monospace;
  font-weight: 700;
  letter-spacing: 0.06em;
  background: transparent;
  color: var(--bg);
}
.title-row input[name=name]::placeholder { color: #8a7a65; }

.title-row input[name=cost] {
  font-family: 'Courier Prime', 'Courier New', Courier, monospace;
  background: transparent;
  color: var(--bg);
}
.title-row input[name=cost]::placeholder { color: #8a7a65; }

/* Type row */
.type-row {
  font-size: 0.75rem;
  background: var(--ink);
  color: var(--bg);
  letter-spacing: 0.04em;
}

.prefix-hint { color: var(--mid); }

/* Text row */
.text-row {
  background: #f3ede0;
  border-top: 1px dashed var(--line);
  border-bottom: 1px dashed var(--line);
}

.text-row textarea {
  font-family: 'Courier Prime', 'Courier New', Courier, monospace;
  font-size: 0.78rem;
  background: transparent;
  color: var(--ink);
}

/* P/T row */
.pt-row {
  background: var(--ink);
  color: var(--bg);
}

.pt-row input {
  font-family: 'Courier Prime', 'Courier New', Courier, monospace;
  font-weight: 700;
  background: transparent;
  color: var(--bg);
}
.pt-row input::placeholder { color: #8a7a65; }

/* Art preview hint */
.art-preview-hint {
  font-family: 'Courier Prime', 'Courier New', Courier, monospace;
  font-style: italic;
  color: var(--mid);
}

/* AI controls */
.ai-row textarea {
  font-family: 'Courier Prime', 'Courier New', Courier, monospace;
  font-size: 0.75rem;
  background: rgba(250,246,238,.9);
  border: 1px dashed var(--line);
  border-radius: 0;
}

#ai-generate {
  border-radius: 0;
  font-size: 0.7rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

#ai-regenerate {
  border-radius: 0;
  border: 1px dashed var(--ink);
  background: transparent;
  color: var(--ink);
}
#ai-regenerate:hover { background: rgba(26,18,9,.07); }

.art-controls select {
  border: 1px dashed var(--line);
  border-radius: 0;
}

/* Save / download buttons */
#download, #search-save {
  width: 100%;
  margin-top: 0.75rem;
  border-radius: 0;
  letter-spacing: 0.1em;
}

/* Receipt tear-off dashes at the foot */
body[data-page]::after {
  content: '- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -';
  display: block;
  text-align: center;
  color: var(--mid);
  font-family: 'Courier Prime', 'Courier New', Courier, monospace;
  font-size: 0.75rem;
  letter-spacing: 0.1em;
  padding: 1.5rem 1rem 0.5rem;
  max-width: 540px;
  margin: 0 auto;
  overflow: hidden;
}

/* ── Preview wrap (create page) ── */
#preview-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
}
