:root {
  --bg: #f5efe6;
  --bg-glow: #efe3d3;
  --surface: #fffcf7;
  --surface-2: #f8f2e9;
  --well: #ffffff;
  --ink: #1d2721;
  --muted: #5a645d;
  --line: #e4d9ca;
  --accent: #a8243b;       /* cranberry */
  --accent-ink: #ffffff;
  --accent-soft: #f6e3e5;
  --pine: #1f4a37;
  --pine-soft: #e2ece5;
  --gold: #a86f12;
  --focus: #1f4a37;
  --shadow: 0 1px 2px rgb(40 30 20 / .06), 0 8px 24px -12px rgb(40 30 20 / .18);
  --shadow-hover: 0 2px 4px rgb(40 30 20 / .06), 0 18px 38px -16px rgb(40 30 20 / .28);
  --radius: 24px;
  --radius-sm: 14px;
  --font: 'Manrope', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --display: 'Fraunces', Georgia, serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #111714;
    --bg-glow: #18221d;
    --surface: #19211d;
    --surface-2: #1f2924;
    --well: #f3efe8;
    --ink: #eef0ea;
    --muted: #a3ada6;
    --line: #2c3832;
    --accent: #f07d8f;
    --accent-ink: #2a0b11;
    --accent-soft: #3a1f25;
    --pine: #8fd0ae;
    --pine-soft: #1f3329;
    --gold: #e0b45c;
    --focus: #8fd0ae;
    --shadow: 0 1px 2px rgb(0 0 0 / .3), 0 8px 24px -12px rgb(0 0 0 / .6);
    --shadow-hover: 0 2px 4px rgb(0 0 0 / .3), 0 18px 38px -16px rgb(0 0 0 / .7);
    color-scheme: dark;
  }
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  font: 500 16px/1.5 var(--font);
  color: var(--ink);
  background:
    radial-gradient(1200px 500px at 85% -10%, var(--bg-glow), transparent 70%),
    var(--bg);
  background-attachment: fixed;
}
img { display: block; max-width: 100%; }
button, input, select { font: inherit; color: inherit; }
a { color: inherit; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 6px; }
main:focus, [tabindex="-1"]:focus { outline: none; }

.sr-only {
  position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.skip {
  position: absolute; left: 16px; top: -60px; z-index: 10;
  background: var(--ink); color: var(--bg); padding: 10px 16px; border-radius: 12px; text-decoration: none;
}
.skip:focus { top: 12px; }

/* ---------------------------------------------------------------- layout */
.topbar, main { width: min(1180px, 100% - 32px); margin-inline: auto; }
.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 20px 0 8px; flex-wrap: wrap;
}
.brand {
  display: inline-flex; align-items: center; gap: 8px; text-decoration: none;
  font: 650 20px/1 var(--display); letter-spacing: -.01em;
}
.brand svg { color: var(--gold); }
#topnav { display: flex; gap: 8px; flex-wrap: wrap; }
.pill {
  display: inline-flex; align-items: center; min-height: 36px; padding: 6px 14px;
  border: 1px solid var(--line); border-radius: 999px; text-decoration: none;
  font-size: 14px; font-weight: 600; background: var(--surface);
  max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.pill:hover { border-color: var(--muted); }
.pill[aria-current="page"] { background: var(--ink); color: var(--bg); border-color: var(--ink); }
main { padding: 16px 0 96px; }

/* ---------------------------------------------------------------- type */
h1, h2, h3 { margin: 0; }
h1 { font: 650 clamp(34px, 5.5vw, 60px)/1.04 var(--display); letter-spacing: -.025em; }
h1 em { font-style: italic; color: var(--accent); font-weight: 500; }
h2 { font: 650 24px/1.2 var(--display); letter-spacing: -.01em; }
.eyebrow {
  margin: 0 0 10px; font-size: 13px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--pine);
}
.lede { max-width: 54ch; font-size: 18px; color: var(--muted); margin: 16px 0 0; }
.muted { color: var(--muted); }
.meta { margin: 10px 0 0; color: var(--muted); font-weight: 600; }

/* ---------------------------------------------------------------- buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 10px 18px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--surface); color: var(--ink);
  font-weight: 700; font-size: 15px; text-decoration: none; cursor: pointer;
  transition: background .15s, border-color .15s, transform .15s;
  white-space: nowrap;
}
.btn:hover { border-color: var(--muted); }
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { filter: brightness(1.07); }
.btn.ghost { background: transparent; border-color: transparent; }
.btn.ghost:hover { background: var(--surface-2); }
.btn.danger { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.small { min-height: 38px; padding: 7px 14px; font-size: 14px; }
.btn:disabled { opacity: .55; cursor: progress; }
.icon-btn {
  display: inline-grid; place-items: center; width: 40px; height: 40px; border-radius: 50%;
  border: 1px solid transparent; background: transparent; color: var(--muted); cursor: pointer;
}
.icon-btn:hover { background: var(--surface-2); color: var(--ink); border-color: var(--line); }
.linklike {
  border: 0; background: none; padding: 0; cursor: pointer; font-weight: 700;
  color: var(--pine); text-decoration: underline; text-underline-offset: 3px;
}

/* ---------------------------------------------------------------- forms */
.field { display: flex; flex-direction: column; gap: 6px; margin: 0 0 16px; min-width: 0; }
.field.inline { flex-direction: row; align-items: center; gap: 8px; margin: 0; }
.field.inline label { font-size: 14px; color: var(--muted); }
.field label { font-weight: 700; font-size: 14px; }
.req, .opt { font-weight: 500; color: var(--muted); font-size: 13px; margin-left: 4px; }
.row { display: flex; gap: 12px; align-items: flex-end; }
.row.wrap { flex-wrap: wrap; }
.row .field { margin-bottom: 0; }
.grow { flex: 1 1 200px; }
input, select {
  width: 100%; min-height: 46px; padding: 10px 14px;
  border: 1px solid var(--line); border-radius: var(--radius-sm);
  background: var(--surface); color: var(--ink);
}
input::placeholder { color: var(--muted); opacity: .8; }
input:hover, select:hover { border-color: var(--muted); }
input:focus-visible, select:focus-visible { outline: 3px solid var(--focus); outline-offset: 1px; border-color: var(--focus); }
input[aria-invalid="true"] { border-color: var(--accent); }
select { appearance: none; padding-right: 36px; cursor: pointer;
  background-image: linear-gradient(45deg, transparent 50%, currentColor 50%), linear-gradient(135deg, currentColor 50%, transparent 50%);
  background-position: calc(100% - 19px) 50%, calc(100% - 14px) 50%; background-size: 5px 5px; background-repeat: no-repeat; }
.field.inline select { width: auto; min-height: 42px; border-radius: 999px; }
.hint { margin: 2px 0 0; font-size: 14px; color: var(--muted); min-height: 1.4em; }
.form-error { margin: 0 0 12px; color: var(--accent); font-weight: 700; min-height: 0; }
.form-error:empty { display: none; }

/* ---------------------------------------------------------------- home */
.hero { padding: 48px 0 36px; }
.lists { margin: 8px 0 32px; }
.lists h2 { margin-bottom: 14px; }
.list-cards { list-style: none; margin: 0; padding: 0; display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.list-card {
  position: relative; display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 20px 22px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--line);
  box-shadow: var(--shadow); transition: box-shadow .2s, transform .2s;
}
.list-card:hover { box-shadow: var(--shadow-hover); transform: translateY(-2px); }
.list-card svg { color: var(--muted); flex: none; }
.list-link { text-decoration: none; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.list-link::after { content: ''; position: absolute; inset: 0; border-radius: inherit; }
.list-link:focus-visible { outline: none; }
.list-link:focus-visible::after { outline: 3px solid var(--focus); outline-offset: 2px; }
.list-eyebrow { font-size: 13px; color: var(--muted); font-weight: 700; }
.list-title { font: 650 20px/1.25 var(--display); overflow-wrap: anywhere; }
.create {
  max-width: 720px; padding: 28px; border-radius: var(--radius);
  background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow);
}
.create h2 { margin-bottom: 18px; }
.create .row { margin-bottom: 18px; }

/* ---------------------------------------------------------------- list page */
.list-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 20px 32px; flex-wrap: wrap; padding: 36px 0 22px; }
.list-head-text { min-width: 0; }
.list-head h1 { overflow-wrap: anywhere; }
.list-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.rename { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.rename input { font: 650 28px/1.1 var(--display); max-width: 560px; }
.notice {
  display: flex; gap: 12px; align-items: flex-start; padding: 14px 18px; margin-bottom: 22px;
  border-radius: 18px; background: var(--pine-soft); color: var(--ink);
}
.notice svg { color: var(--pine); flex: none; margin-top: 2px; }
.notice p { margin: 0; }
.notice.festive { background: var(--accent-soft); }
.notice.festive svg { color: var(--accent); }

.toolbar { display: flex; gap: 12px; align-items: center; justify-content: space-between; flex-wrap: wrap; margin-bottom: 6px; scroll-margin-top: 16px; }
.search { position: relative; flex: 1 1 280px; max-width: 440px; }
.search svg { position: absolute; left: 16px; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
.search input { padding-left: 46px; border-radius: 999px; }
.selects { display: flex; gap: 12px; flex-wrap: wrap; }
.result-count { margin: 10px 0 14px; color: var(--muted); font-size: 14px; font-weight: 600; min-height: 1.5em; }

/* ---------------------------------------------------------------- cards */
.grid {
  list-style: none; margin: 0; padding: 0; display: grid; gap: 20px;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 240px), 1fr));
}
.card {
  position: relative; display: flex; flex-direction: column;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 10px; box-shadow: var(--shadow);
  transition: box-shadow .25s, transform .25s;
}
.card:hover { box-shadow: var(--shadow-hover); transform: translateY(-3px); }
.card-media {
  aspect-ratio: 1 / 1; border-radius: 18px; background: var(--well);
  display: grid; place-items: center; overflow: hidden;
}
.card-media img { width: 100%; height: 100%; object-fit: contain; padding: 14px; mix-blend-mode: multiply; transition: transform .4s; }
.card:hover .card-media img { transform: scale(1.04); }
.card-media.noimg { background: linear-gradient(140deg, var(--pine-soft), var(--accent-soft)); }
.card-media.noimg span { font: 650 64px/1 var(--display); color: var(--pine); opacity: .55; }
.card-body { display: flex; flex-direction: column; gap: 4px; padding: 14px 8px 6px; flex: 1; }
.site { margin: 0; font-size: 12px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.card-title { font: 600 17px/1.3 var(--font); letter-spacing: -.005em; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.card-title a { text-decoration: none; }
.card-title a::after { content: ''; position: absolute; inset: 0; border-radius: var(--radius); }
.card-title a:hover { text-decoration: underline; text-underline-offset: 3px; }
.card-title a:focus-visible { outline: none; }
.card-title a:focus-visible::after { outline: 3px solid var(--focus); outline-offset: 2px; }
.note { margin: 0; font-size: 14px; color: var(--muted); overflow-wrap: anywhere; }
.card-foot { margin-top: auto; padding-top: 10px; display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.price { margin: 0; font: 650 20px/1 var(--display); letter-spacing: -.01em; }
.price.none { font: 600 14px/1 var(--font); color: var(--muted); }
.card-actions, .card-foot > .btn { position: relative; z-index: 1; }
.card-actions { display: flex; gap: 2px; margin-right: -4px; }

.card.is-claimed .card-media { opacity: .5; filter: grayscale(.6); }
.claim-tag {
  position: absolute; top: 20px; left: 20px; z-index: 1;
  display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px;
  border-radius: 999px; background: var(--pine); color: var(--surface); font-size: 13px; font-weight: 700;
  max-width: calc(100% - 40px); overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

.empty {
  grid-column: 1 / -1; text-align: center; padding: 56px 24px; border-radius: var(--radius);
  border: 2px dashed var(--line); color: var(--muted);
  display: flex; flex-direction: column; align-items: center; gap: 6px;
}
.empty svg { color: var(--accent); margin-bottom: 8px; }
.empty p { margin: 0; max-width: 46ch; }
.empty .empty-title { font: 650 22px/1.2 var(--display); color: var(--ink); }
.empty .btn { margin-top: 16px; }
.empty.big { border: 0; padding-top: 80px; }
.empty.big h1 { color: var(--ink); }
.loading { padding: 80px 0; text-align: center; color: var(--muted); }

/* ---------------------------------------------------------------- pager */
.pager { display: flex; justify-content: center; align-items: center; gap: 6px; margin-top: 36px; flex-wrap: wrap; }
.pager:empty { display: none; }
.page-btn {
  min-width: 44px; height: 44px; padding: 0 12px; display: inline-grid; place-items: center;
  border-radius: 999px; border: 1px solid var(--line); background: var(--surface); cursor: pointer; font-weight: 700;
}
.page-btn:hover:not(:disabled):not(.current) { border-color: var(--muted); }
.page-btn.current { background: var(--ink); color: var(--bg); border-color: var(--ink); cursor: default; }
.page-btn:disabled { opacity: .4; cursor: default; }
.gap { padding: 0 4px; color: var(--muted); }

/* ---------------------------------------------------------------- dialogs */
dialog {
  width: min(560px, 100% - 32px); max-height: calc(100dvh - 32px); overflow: auto;
  border: 1px solid var(--line); border-radius: 28px; padding: 26px; margin: auto;
  background: var(--surface); color: var(--ink); box-shadow: 0 30px 80px -20px rgb(0 0 0 / .45);
}
dialog::backdrop { background: rgb(15 20 17 / .55); backdrop-filter: blur(4px); }
dialog h2 { margin-bottom: 14px; }
dialog form > p { margin: 0 0 16px; }
.dlg-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.dlg-head h2 { margin: 0; }
.dlg-grid { display: grid; grid-template-columns: 132px 1fr; gap: 16px; margin-bottom: 16px; }
.dlg-fields .field:last-child, .dlg-fields .row { margin-bottom: 0; }
.dlg-fields .field { margin-bottom: 14px; }
.img-well {
  aspect-ratio: 1; border-radius: 18px; background: var(--well); border: 1px solid var(--line);
  display: grid; place-items: center; overflow: hidden; color: #6b716c; font-size: 13px; text-align: center; padding: 8px;
}
.img-well img { width: 100%; height: 100%; object-fit: contain; mix-blend-mode: multiply; }
.dlg-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 8px; flex-wrap: wrap; }
.field .row { align-items: stretch; }
.field .row .btn { flex: none; }
#f-currency { width: 96px; }

/* ---------------------------------------------------------------- toast */
.toast {
  position: fixed; left: 50%; bottom: 24px; z-index: 20; transform: translate(-50%, 20px);
  max-width: calc(100% - 32px); padding: 12px 20px; border-radius: 999px;
  background: var(--ink); color: var(--bg); font-weight: 700; box-shadow: var(--shadow-hover);
  opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast:empty { display: none; }

@media (max-width: 560px) {
  .hero { padding-top: 28px; }
  .list-head { padding-top: 24px; }
  .list-actions .btn { flex: 1 1 auto; }
  .create { padding: 20px; }
  dialog { padding: 20px; border-radius: 24px; }
  .dlg-grid { grid-template-columns: 96px 1fr; gap: 12px; }
  .field .row { flex-wrap: wrap; }
  .field .row .btn { width: 100%; }
  .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
  .card { padding: 8px; border-radius: 20px; }
  .card-media { border-radius: 14px; }
  .card-title { font-size: 15px; }
  .price { font-size: 17px; }
  .card-foot > .btn { width: 100%; }
  .claim-tag { top: 14px; left: 14px; font-size: 12px; max-width: calc(100% - 28px); }
}
@media (max-width: 340px) { .grid { grid-template-columns: 1fr; } }

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