/* Dol Guldur dusk, brass fittings, parchment text. Shared by every page. */
:root {
  --door: #1e1b22;
  --door-deep: #161419;
  --pocket: #100f12;
  --dialog: #151318;
  --glow: #26232c;      /* these five are replaced by js/theme.js */
  --brass: #c9a24b;
  --brass-ink: #1c1608;
  --brass-soft: rgba(201, 162, 75, 0.16);
  --metal-1: #fee9ba;   /* the binder metal (gold), highlight to shadow: replaced by js/theme.js */
  --metal-2: #eacc8a;
  --metal-3: #c9a24b;
  --metal-4: #8f6e25;
  --metal-5: #4d3a0e;
  --parchment: #ece4cc;
  --sage: #a9baa4;
  --ember: #e07a5f;
  --line: rgba(236, 228, 204, 0.14);
  --line-strong: rgba(236, 228, 204, 0.26);
  --display: 'IM Fell English', 'Iowan Old Style', Georgia, serif;
  --ui: 'Alegreya Sans', 'Segoe UI', system-ui, sans-serif;
  --card-radius: 4.75% / 3.4%;
  color-scheme: dark;
}

/* Leather colours, for binder covers and swatches. */
.cover-green { --leather: #2f5b40; --leather-dark: #1b3a28; }
.cover-oxblood { --leather: #6b2b2a; --leather-dark: #44181a; }
.cover-navy { --leather: #29405f; --leather-dark: #172840; }
.cover-tan { --leather: #8c6438; --leather-dark: #5e4122; }
.cover-slate { --leather: #42505a; --leather-dark: #283239; }
.cover-plum { --leather: #573159; --leather-dark: #36193a; }
.cover-teal { --leather: #24595a; --leather-dark: #133838; }
.cover-ink { --leather: #2c2c33; --leather-dark: #16161a; }

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100vh;
  background: radial-gradient(120% 60% at 50% 0%, var(--glow) 0%, transparent 70%), var(--door);
  color: var(--parchment);
  font: 400 1rem/1.5 var(--ui);
  font-variant-numeric: lining-nums tabular-nums;
}

h1, h2, h3 { font-family: var(--display); font-weight: 400; margin: 0; line-height: 1.15; }
p { margin: 0; }
a { color: var(--brass); }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
button:disabled { cursor: default; opacity: 0.4; }
:focus-visible { outline: 2px solid var(--brass); outline-offset: 2px; }
code { background: rgba(236, 228, 204, 0.08); padding: 1px 5px; border-radius: 4px; font-size: 0.88em; }

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

.cn { font-family: var(--display); color: var(--brass); }
.status { color: var(--sage); margin: 10px 0 16px; }
.status.error { color: var(--ember); }
.badge {
  display: inline-block; padding: 0 8px; border-radius: 999px; font-size: 0.78rem;
  background: var(--brass); color: var(--brass-ink); font-weight: 500;
}

.mana { display: inline-flex; gap: 1px; vertical-align: -0.15em; }
.mana img { width: 1.05em; height: 1.05em; display: block; }

/* ------------------------------------------------------------- controls */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--brass);
  background: var(--brass);
  color: var(--brass-ink);
  border-radius: 8px;
  padding: 8px 14px;
  text-decoration: none;
  font-weight: 500;
}
.btn.quiet { background: transparent; color: var(--parchment); border-color: var(--line-strong); }
.btn.quiet:not(:disabled):hover { border-color: var(--brass); }
.btn.small { padding: 4px 10px; font-size: 0.875rem; }
.btn.danger { background: #a3402c; border-color: #a3402c; color: var(--parchment); }

.link {
  background: none; border: 0; padding: 0;
  color: var(--parchment); text-decoration: underline;
  text-decoration-color: rgba(201, 162, 75, 0.6); text-underline-offset: 3px;
}
.link:hover { color: var(--brass); }
.link.small { font-size: 0.9rem; color: var(--sage); }

input[type='search'], input[type='text'], input:not([type]), textarea, select {
  background: var(--pocket);
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  padding: 9px 12px;
  min-width: 0;
}
input::placeholder, textarea::placeholder { color: rgba(169, 186, 164, 0.7); }
input:focus, textarea:focus, select:focus { border-color: var(--brass); outline: none; }
select option { background: var(--door-deep); color: var(--parchment); }
textarea { width: 100%; resize: vertical; font: 0.92rem/1.5 ui-monospace, 'SF Mono', Menlo, Consolas, monospace; }

.seg { display: inline-flex; border: 1px solid var(--line-strong); border-radius: 8px; overflow: hidden; flex: none; }
.seg button, .seg label span { display: block; background: transparent; border: 0; padding: 8px 14px; color: var(--sage); cursor: pointer; }
.seg > * + * { border-left: 1px solid var(--line-strong); }
.seg button[aria-pressed='true'], .seg button[aria-checked='true'], .seg input:checked + span { background: var(--brass-soft); color: var(--parchment); }
.seg label { position: relative; }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg label:has(input:focus-visible) { outline: 2px solid var(--brass); outline-offset: -2px; }

.stepper { display: inline-flex; align-items: center; gap: 4px; }
.stepper button {
  width: 34px; height: 34px; border-radius: 8px;
  border: 1px solid var(--line-strong); background: transparent;
  font-size: 1.2rem; line-height: 1;
}
.stepper button:last-child { border-color: var(--brass); color: var(--brass); }
.stepper button:not(:disabled):hover { background: var(--brass-soft); }
.stepper output { min-width: 2ch; text-align: center; font-weight: 700; font-size: 1.05rem; }

.bar { height: 6px; background: rgba(236, 228, 204, 0.1); border-radius: 3px; overflow: hidden; }
.bar-fill { height: 100%; background: var(--brass); border-radius: 3px; transition: width 0.4s ease; }

/* ------------------------------------------------------------- masthead */

.masthead { max-width: 1440px; margin: 0 auto; padding: 18px 24px 0; display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; }
.masthead-row { display: flex; align-items: center; justify-content: space-between; gap: 14px 24px; flex-wrap: wrap; }
.title-block { display: flex; align-items: center; gap: 14px; min-width: 0; max-width: 100%; }
.title-block h1 { min-width: 0; }  /* so a long title ends in … instead of widening the page */
.home {
  flex: none; display: grid; place-items: center;
  width: 40px; height: 40px; border-radius: 10px;
  border: 1px solid var(--line-strong); color: var(--brass);
}
.home svg { width: 24px; height: 24px; fill: currentColor; }
.home:hover { border-color: var(--brass); background: var(--brass-soft); }
.set-icon, .cover-icon, .cover-emblem, .chip-icon {
  display: inline-block;
  background: var(--brass);
  -webkit-mask: var(--icon) center / contain no-repeat;
  mask: var(--icon) center / contain no-repeat;
}
.set-icon { width: 32px; height: 32px; flex: none; }
h1 { font-size: clamp(1.6rem, 3vw, 2.3rem); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.preview-badge {
  flex: none; padding: 2px 10px; border: 1px dashed var(--brass); border-radius: 999px;
  color: var(--brass); font-size: 0.85rem; white-space: nowrap;
}

.ctx-summary { min-width: min(320px, 100%); }
.summary-text { color: var(--sage); text-align: right; }
.progress { display: grid; gap: 6px; }
.progress p { color: var(--sage); text-align: right; }
.progress b { color: var(--parchment); font-weight: 700; }

.tabs { display: flex; gap: 22px; overflow-x: auto; scrollbar-width: none; }
.tabs a {
  color: var(--sage); text-decoration: none; font-weight: 500; font-size: 1.05rem;
  padding: 6px 0 8px; border-bottom: 2px solid transparent; white-space: nowrap;
}
.tabs a:hover { color: var(--parchment); }
.tabs a[aria-current='page'] { color: var(--parchment); border-color: var(--brass); }

.quick-add { position: relative; display: flex; gap: 8px; flex: 0 1 440px; margin-left: auto; }
.quick-add input { width: 100%; }
.foil-toggle {
  flex: none; border: 1px solid var(--line-strong); background: transparent;
  border-radius: 8px; padding: 0 14px; color: var(--sage);
}
.foil-toggle[aria-pressed='true'] {
  color: var(--brass-ink); border-color: transparent;
  background: linear-gradient(120deg, #e8d18a, #b7e0d6 45%, #d9b6e6 75%, #e8d18a);
}

.suggestions {
  position: absolute; top: calc(100% + 6px); left: 0; right: 0; z-index: 20;
  margin: 0; padding: 6px; list-style: none;
  background: var(--pocket); border: 1px solid var(--line-strong); border-radius: 10px;
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.45);
  max-height: min(70vh, 520px); overflow-y: auto;
}
.suggestions li {
  display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 10px;
  padding: 7px 8px; border-radius: 6px; cursor: pointer;
}
.suggestions li[aria-selected='true'] { background: var(--brass-soft); }
.suggestions li.none { display: block; color: var(--sage); cursor: default; }
.suggestions img { width: 38px; border-radius: var(--card-radius); display: block; }
.suggestions .chip-icon { width: 22px; height: 22px; background: var(--parchment); }
.sg-text { display: grid; min-width: 0; }
.sg-name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sg-meta { color: var(--sage); font-size: 0.85rem; }
.sg-finish { font-size: 0.8rem; color: var(--sage); }
.sg-finish.foil { color: var(--brass); }

main { max-width: 1440px; margin: 0 auto; padding: 18px 24px 120px; }

/* ------------------------------------------------------------- card grid */

.page-lead { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px 24px; margin-bottom: 18px; }
.page-lead p { color: var(--sage); max-width: 62ch; }
.page-lead .pricing-note { flex-basis: 100%; order: 3; margin-top: -4px; }
.pricing-note { max-width: 80ch; }
.actions { display: flex; flex-wrap: wrap; gap: 10px; }

.query { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; }
.query input { flex: 1 1 420px; font-size: 1.05rem; padding: 11px 14px; }
.sort { display: inline-flex; align-items: center; gap: 8px; color: var(--sage); }

.shortcuts { display: flex; flex-wrap: wrap; gap: 8px; margin: 14px 0 6px; }
.shortcut {
  background: transparent; border: 1px solid var(--line-strong); border-radius: 999px;
  padding: 4px 12px; font-size: 0.92rem; color: var(--parchment);
}
.shortcut:hover { border-color: var(--brass); }
.shortcut[aria-pressed='true'] { background: var(--brass); border-color: var(--brass); color: var(--brass-ink); }

.syntax { margin: 10px 0; color: var(--sage); }
.syntax summary { cursor: pointer; width: max-content; }
.syntax dl {
  display: grid; grid-template-columns: minmax(0, max-content) 1fr; gap: 6px 22px;
  margin: 10px 0 0; padding: 14px 16px; background: var(--door-deep); border-radius: 8px; max-width: 920px;
}
.syntax dt { color: var(--parchment); font-family: var(--display); }
.syntax dd { margin: 0; }

.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(176px, 1fr)); gap: 22px 18px; }
.tile { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.tile-art { padding: 0; border: 0; background: none; border-radius: var(--card-radius); overflow: hidden; }
.tile-art img { display: block; width: 100%; aspect-ratio: 63 / 88; object-fit: cover; }
.tile.missing .tile-art img { filter: grayscale(0.85) brightness(0.6); }
.tile.missing .tile-art:hover img { filter: grayscale(0.4) brightness(0.85); }
.tile h3 { font-size: 1rem; line-height: 1.25; }
.tile-treat, .tile-where { font-size: 0.85rem; color: var(--sage); }
.finish-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 2px; }
.finish-chip {
  display: inline-flex; align-items: center; gap: 6px;
  border: 1px solid var(--line-strong); border-radius: 999px;
  padding: 1px 10px; font-size: 0.82rem; color: var(--sage);
}
.finish-chip:has(button) { padding-right: 0; }
.finish-chip b { color: var(--parchment); font-weight: 700; }
.finish-chip.have { border-color: rgba(201, 162, 75, 0.6); color: var(--parchment); }
.finish-chip button {
  border: 0; border-left: 1px solid var(--line-strong); background: transparent;
  padding: 2px 10px; border-radius: 0 999px 999px 0; font-weight: 700; color: var(--brass);
}
.finish-chip button:hover { background: var(--brass-soft); }

/* ------------------------------------------------------------- log */

.log { list-style: none; margin: 0; padding: 0; max-width: 1000px; }
.log li {
  display: grid; grid-template-columns: 130px 52px minmax(0, 1fr) auto;
  align-items: start; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line);
}
.log li.undone { opacity: 0.5; }
.log time, .undone-note { color: var(--sage); font-size: 0.9rem; padding-top: 2px; }
.log .delta { font-weight: 700; color: var(--brass); padding-top: 1px; }
.log .delta.down { color: var(--ember); }
.log .delta.move { color: var(--sage); }
.log-text { min-width: 0; }
.log-text a { color: var(--parchment); }
.log-text details { margin-top: 4px; color: var(--sage); font-size: 0.92rem; }
.log-text ul { margin: 6px 0 0; padding-left: 18px; }

/* ------------------------------------------------------------- dialogs */

dialog {
  width: min(920px, calc(100vw - 32px));
  max-height: calc(100vh - 32px);
  padding: 0;
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  background: var(--dialog);
  color: var(--parchment);
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.6);
}
dialog::backdrop { background: color-mix(in srgb, var(--pocket) 75%, transparent); backdrop-filter: blur(2px); }
.close {
  position: absolute; top: 10px; right: 10px; z-index: 1;
  width: 38px; height: 38px; border: 0; background: transparent;
  font-size: 1.8rem; line-height: 1; color: var(--sage);
}
.close:hover { color: var(--parchment); }

.detail { position: relative; display: grid; grid-template-columns: minmax(0, 360px) minmax(0, 1fr); gap: 28px; padding: 26px; }
.detail-art { display: grid; gap: 10px; justify-items: center; align-content: start; }
.detail-art img { width: 100%; border-radius: var(--card-radius); box-shadow: 0 14px 30px rgba(0, 0, 0, 0.5); }
.detail-art.missing img { filter: grayscale(0.6) brightness(0.8); }
.detail-info { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.detail-info h2 { font-size: 2rem; padding-right: 40px; }
.detail-treat { color: var(--brass); margin-top: -6px; }
.detail-info h3 { font-size: 1.15rem; margin-top: 4px; }
.facts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px 20px; margin: 0; }
.facts dt { color: var(--sage); font-size: 0.85rem; }
.facts dd { margin: 0; }

.places { display: grid; gap: 10px; }
.place { display: grid; gap: 8px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--pocket); }
.place.current { border-color: rgba(201, 162, 75, 0.55); }
.place-name { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; }
.place-name a { color: var(--parchment); font-weight: 500; text-decoration-color: rgba(201, 162, 75, 0.6); text-underline-offset: 3px; }
.place-name > span:not(.badge) { color: var(--sage); font-size: 0.88rem; }
.finish-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; }
.finish-name { font-weight: 500; flex: 1 1 auto; }
.finish-price { color: var(--sage); }
.finish-row select.move { padding: 5px 8px; font-size: 0.88rem; }
.place-add { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; color: var(--sage); font-size: 0.92rem; }
.place-add select { padding: 5px 8px; font-size: 0.9rem; }
.place .link { justify-self: start; }

.siblings { display: flex; flex-wrap: wrap; gap: 8px; }
.sibling { width: 62px; padding: 0; border: 0; background: none; display: grid; gap: 3px; text-align: center; font-size: 0.75rem; color: var(--sage); }
.sibling img { width: 100%; border-radius: var(--card-radius); display: block; filter: grayscale(0.85) brightness(0.55); }
.sibling.owned img { filter: none; }
.sibling.current img { outline: 2px solid var(--brass); outline-offset: 2px; }
.detail-links { margin-top: auto; padding-top: 6px; }

.form-dialog { width: min(580px, calc(100vw - 32px)); }
.form-dialog.wide { width: min(1040px, calc(100vw - 32px)); }
.form { display: flex; flex-direction: column; gap: 18px; padding: 0 24px 22px; }
.form-head { position: relative; display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 20px 0 2px; }
.form-head h2 { font-size: 1.6rem; padding-right: 40px; }
.form-head .close { top: 12px; right: -10px; }
.field { display: grid; gap: 6px; border: 0; padding: 0; margin: 0; min-width: 0; position: relative; }
.field > label, .field > legend { font-weight: 500; padding: 0; margin-bottom: 2px; }
.field .seg { justify-self: start; }
.combo { position: relative; display: grid; }
.optional { color: var(--sage); font-weight: 400; }
.hint { color: var(--sage); font-size: 0.88rem; }
.form-foot { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 10px; padding-top: 4px; }
.swatches { display: flex; gap: 12px; flex-wrap: wrap; }
.swatch {
  position: relative; width: 36px; height: 36px; border-radius: 50%; cursor: pointer;
  background: radial-gradient(circle at 35% 30%, var(--leather), var(--leather-dark));
  box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.12);
}
.swatch input { position: absolute; opacity: 0; }
.swatch:has(input:checked) { outline: 2px solid var(--brass); outline-offset: 3px; }
.swatch:has(input:focus-visible) { outline: 2px dashed var(--parchment); outline-offset: 3px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chips:empty { display: none; }
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  border: 1px solid var(--line-strong); border-radius: 999px; padding: 3px 4px 3px 10px;
}
.chip .chip-icon { width: 18px; height: 18px; background: var(--parchment); }
.chip b { font-weight: 500; color: var(--sage); }
.chip button { border: 0; background: none; width: 24px; height: 24px; border-radius: 50%; color: var(--sage); }
.chip button:hover { background: var(--brass-soft); color: var(--parchment); }
.import-result { display: grid; gap: 12px; }
.import-added { font-family: var(--display); font-size: 1.4rem; }
.import-list summary { cursor: pointer; color: var(--sage); }
.import-list ul { margin: 8px 0 0; padding-left: 18px; max-height: 220px; overflow-y: auto; font-size: 0.92rem; }

.empty-state { max-width: 560px; margin: 48px auto; display: grid; gap: 12px; text-align: center; color: var(--sage); }

/* Sign in (only when the site has sign-in on) */
.welcome { display: grid; place-items: start center; padding: clamp(16px, 6vh, 64px) 0; }
.welcome-card {
  width: min(440px, 100%); display: grid; gap: 14px; padding: 28px 24px 24px;
  border: 1px solid var(--line-strong); border-radius: 12px; background: var(--dialog);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.35);
}
.welcome-card h2 { font-size: 1.9rem; }
.welcome-card .status { margin: 0; }
.welcome-note { text-align: center; }
/* Google's own light button: white, a grey outline, and the coloured G */
.btn.sign-in-google {
  display: flex; align-items: center; justify-content: center; gap: 12px; margin-top: 8px; padding: 11px 16px;
  background: #fff; border-color: #747775; color: #1f1f1f; font-weight: 500; text-decoration: none;
}
.btn.sign-in-google:hover { background: #f2f2f2; }
.btn.sign-in-google svg { width: 20px; height: 20px; flex: none; }
.account-line { display: inline-flex; align-items: center; gap: 10px; color: var(--sage); font-size: 0.92rem; }
.empty-state h2 { color: var(--parchment); }
.danger-zone { margin-top: 48px; padding-top: 16px; border-top: 1px solid var(--line); }
.account-form .danger-zone { display: grid; gap: 14px; margin-top: 4px; }
.account-form .danger-zone h3 { font-size: 1.3rem; }
.account-links { display: flex; flex-wrap: wrap; gap: 10px; }
.account-line .link { color: var(--parchment); }

/* ------------------------------------------------------------- appearance */

.appearance h3 { font-size: 1.3rem; margin-bottom: 4px; }
.appearance .hint { margin-bottom: 12px; }
.themes { display: grid; grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 10px; }
.theme {
  position: relative; display: grid; gap: 6px; padding: 6px;
  border: 1px solid transparent; border-radius: 10px; background: none; text-align: left; cursor: pointer;
}
.theme:hover { border-color: var(--line-strong); }
.theme.current { border-color: var(--brass); background: var(--brass-soft); }
.theme:has(input:focus-visible) { outline: 2px solid var(--brass); outline-offset: 2px; }
.theme-chip {
  position: relative; display: block; aspect-ratio: 1.5; border-radius: 8px; overflow: hidden;
  background: radial-gradient(120% 80% at 50% 0%, var(--c), transparent 70%), var(--a);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.08);
}
/* a little binder page inside each chip */
.theme-chip::after {
  content: ''; position: absolute; left: 24%; right: 24%; top: 28%; bottom: 0;
  border-radius: 4px 4px 0 0; background: var(--b); box-shadow: 0 -1px 0 rgba(255, 255, 255, 0.05);
}
.theme.custom:not(.current) .theme-chip {
  background: conic-gradient(from 45deg, #3f1f1c, #3a2c1e, #1d3a2b, #173540, #262a4c, #1e1b22, #3f1f1c);
}
.theme.custom:not(.current) .theme-chip::after { background: rgba(0, 0, 0, 0.35); }
.theme-chip input[type='color'] { position: absolute; inset: 0; z-index: 1; width: 100%; height: 100%; opacity: 0; border: 0; padding: 0; cursor: pointer; }
.theme-name { font-size: 0.9rem; }

/* binder metals: each choice carries its five shades as --m1 to --m5 */
.metals { display: flex; flex-wrap: wrap; gap: 8px; }
.metal {
  position: relative; display: grid; justify-items: center; gap: 6px; min-width: 66px; padding: 7px 6px 6px;
  border: 1px solid transparent; border-radius: 10px; background: none; color: inherit; cursor: pointer;
}
.metal:hover { border-color: var(--line-strong); }
.metal.current { border-color: var(--brass); background: var(--brass-soft); }
.metal:has(input:focus-visible) { outline: 2px solid var(--brass); outline-offset: 2px; }
.metal-chip {
  position: relative; display: block; width: 34px; height: 34px; border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, var(--m1), var(--m2) 25%, var(--m3) 55%, var(--m4) 85%, var(--m5));
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.35), 0 2px 5px rgba(0, 0, 0, 0.45);
}
.metal.custom:not(.current) .metal-chip {
  background: conic-gradient(from 30deg, #c9a24b, #c78f80, #b87333, #b8bdc3, #6b727a, #45494f, #c9a24b);
}
.metal-chip input[type='color'] { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; border: 0; padding: 0; cursor: pointer; }
.metal-name { font-size: 0.85rem; white-space: nowrap; }

.cover-list { list-style: none; margin: 0; padding: 0; }
.cover-list li {
  display: grid; grid-template-columns: 30px minmax(0, 1fr) auto; align-items: center; gap: 8px 14px;
  padding: 10px 0; border-bottom: 1px solid var(--line);
}
.mini-cover {
  width: 30px; height: 38px; border-radius: 2px 5px 5px 2px;
  background: linear-gradient(160deg, var(--leather), var(--leather-dark));
  box-shadow: inset 4px 0 0 rgba(0, 0, 0, 0.3), 0 2px 4px rgba(0, 0, 0, 0.4);
}
.cover-list-name { font-family: var(--display); font-size: 1.1rem; }
.cover-list .swatches { gap: 8px; }
.cover-list .swatch { width: 30px; height: 30px; }

/* ------------------------------------------------------------- toasts */

.toasts {
  position: fixed; left: 50%; bottom: max(18px, env(safe-area-inset-bottom)); transform: translateX(-50%);
  z-index: 200; display: grid; gap: 8px; width: min(560px, calc(100vw - 32px));
}
.toast {
  display: flex; align-items: center; gap: 14px; padding: 12px 14px 12px 16px;
  background: var(--pocket); border: 1px solid var(--line-strong); border-left: 3px solid var(--brass);
  border-radius: 8px; box-shadow: 0 14px 34px rgba(0, 0, 0, 0.5);
}
.toast p { flex: 1; }
.toast.error { border-left-color: var(--ember); }
.toast button { background: none; border: 0; color: var(--brass); font-weight: 700; padding: 4px 6px; }

/* ------------------------------------------------------------- small screens */

@media (max-width: 900px) {
  .masthead { padding: 14px 16px 0; }
  main { padding: 14px 16px 120px; }
  .ctx-summary { min-width: 0; width: 100%; }
  .progress p, .summary-text { text-align: left; }
  .quick-add { flex: 1 1 100%; order: -1; margin-left: 0; }
  .detail { grid-template-columns: 1fr; padding: 18px; gap: 18px; }
  .detail-art img { max-width: 230px; }
  .tiles { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 18px 12px; }
  .log li { grid-template-columns: 52px minmax(0, 1fr) auto; }
  .log time { display: none; }
  .syntax dl { grid-template-columns: 1fr; }
  .syntax dd { margin-bottom: 6px; }
  .form { padding: 0 18px 18px; }
  .themes { grid-template-columns: repeat(auto-fill, minmax(70px, 1fr)); gap: 6px; }
  .theme-name { font-size: 0.8rem; line-height: 1.2; }
  .cover-list li { grid-template-columns: 30px minmax(0, 1fr); }
  .cover-list .swatches { grid-column: 1 / -1; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
}
