:root {
  --bg: #f4f1de;
  --surface: #ffffff;
  --surface-2: #ebe7d2;
  --ink: #12140d;
  --ink-soft: #55584a;
  --line: rgba(18, 20, 13, 0.14);
  --line-strong: rgba(18, 20, 13, 0.28);

  --lime: #d7ff4d;
  --lime-ink: #12140d;
  --lime-text: #5f7a05;
  --teal: #1c9a80;
  --teal-ink: #ffffff;
  --teal-soft: rgba(28, 154, 128, 0.14);
  --amber: #d98a1f;
  --amber-ink: #12140d;
  --amber-soft: rgba(217, 138, 31, 0.16);
  --lime-soft: rgba(150, 191, 20, 0.18);

  --dark: #0d1a12;
  --dark-ink: #f4f1de;

  --danger: #b23a24;
  --shadow: 0 1px 2px rgba(18, 20, 13, 0.06), 0 10px 28px -14px rgba(18, 20, 13, 0.3);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0e120c;
    --surface: #171c13;
    --surface-2: #1f2518;
    --ink: #eeeadb;
    --ink-soft: #a3a793;
    --line: rgba(238, 234, 219, 0.14);
    --line-strong: rgba(238, 234, 219, 0.26);
    --lime: #d7ff4d;
    --lime-ink: #12140d;
    --lime-text: #d7ff4d;
    --teal: #3fc3a4;
    --teal-ink: #08130f;
    --teal-soft: rgba(63, 195, 164, 0.16);
    --amber: #eaab4c;
    --amber-ink: #12140d;
    --amber-soft: rgba(234, 171, 76, 0.16);
    --lime-soft: rgba(215, 255, 77, 0.14);
    --dark: #060a06;
    --dark-ink: #f4f1de;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 14px 32px -16px rgba(0, 0, 0, 0.7);
  }
}
:root[data-theme="dark"] {
  --bg: #0e120c;
  --surface: #171c13;
  --surface-2: #1f2518;
  --ink: #eeeadb;
  --ink-soft: #a3a793;
  --line: rgba(238, 234, 219, 0.14);
  --line-strong: rgba(238, 234, 219, 0.26);
  --lime: #d7ff4d;
  --lime-ink: #12140d;
  --lime-text: #d7ff4d;
  --teal: #3fc3a4;
  --teal-ink: #08130f;
  --teal-soft: rgba(63, 195, 164, 0.16);
  --amber: #eaab4c;
  --amber-ink: #12140d;
  --amber-soft: rgba(234, 171, 76, 0.16);
  --lime-soft: rgba(215, 255, 77, 0.14);
  --dark: #060a06;
  --dark-ink: #f4f1de;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 14px 32px -16px rgba(0, 0, 0, 0.7);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
}
body {
  font-family: "Work Sans", ui-sans-serif, system-ui, sans-serif;
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

.wrap { max-width: 1040px; margin: 0 auto; padding: 0 20px 90px; }

a { color: inherit; }
button { font: inherit; }
img { max-width: 100%; display: block; }

/* ---------- topbar ---------- */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 18px 0;
  flex-wrap: wrap;
}
.brand {
  display: flex;
  align-items: center;
  gap: 9px;
  font-family: "Archivo", sans-serif;
  font-weight: 900;
  font-size: 1.05rem;
  letter-spacing: -0.01em;
}
.brand .mark {
  width: 30px; height: 30px;
  border-radius: 8px;
  background: var(--lime);
  color: var(--lime-ink);
  display: inline-flex; align-items: center; justify-content: center;
}
.brand .mark svg { width: 18px; height: 18px; }

.whoami {
  font-family: "JetBrains Mono", monospace;
  font-size: 0.78rem;
  color: var(--ink-soft);
  display: flex;
  align-items: center;
  gap: 8px;
}
.whoami button {
  border: 1px solid var(--line-strong);
  background: transparent;
  color: var(--ink);
  border-radius: 999px;
  padding: 5px 12px;
  cursor: pointer;
  font-family: "JetBrains Mono", monospace;
  font-size: 0.74rem;
}

/* ---------- hero ---------- */
.hero {
  display: grid;
  grid-template-columns: 1.15fr 1fr;
  gap: 18px;
  margin-top: 8px;
}
@media (max-width: 780px) { .hero { grid-template-columns: 1fr; } }

.hero-left {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 22px;
  padding: 34px 30px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  box-shadow: var(--shadow);
}
.eyebrow {
  font-family: "JetBrains Mono", monospace;
  font-size: 0.72rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-soft);
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.eyebrow .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--teal); }

h1 {
  font-family: "Archivo", sans-serif;
  font-weight: 900;
  font-size: clamp(2.1rem, 4.6vw, 3.1rem);
  line-height: 0.98;
  letter-spacing: -0.015em;
  margin: 0;
  text-wrap: balance;
  text-transform: uppercase;
}

.lede { color: var(--ink-soft); max-width: 46ch; font-size: 1.02rem; }

.hero-controls { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin-top: 4px; }

.roll-btn {
  font-family: "Archivo", sans-serif;
  font-weight: 700;
  font-size: 1rem;
  color: var(--lime-ink);
  background: var(--lime);
  border: none;
  border-radius: 999px;
  padding: 15px 26px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  transition: transform 0.15s ease;
  box-shadow: 0 8px 18px -8px rgba(150, 191, 20, 0.7);
}
.roll-btn:hover { transform: translateY(-1px) rotate(-0.3deg); }
.roll-btn:active { transform: translateY(0); }
.roll-btn:disabled { opacity: 0.6; cursor: default; transform: none; }
.roll-btn svg { width: 18px; height: 18px; }

select.mini-select, .toggle-line {
  font-family: "JetBrains Mono", monospace;
  font-size: 0.78rem;
  color: var(--ink-soft);
}
select.mini-select {
  background: var(--surface-2);
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  padding: 8px 12px;
  color: var(--ink);
  cursor: pointer;
}
.toggle-line {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  cursor: pointer;
  user-select: none;
}
.toggle-line input { accent-color: var(--teal); width: 15px; height: 15px; }

.stat-row {
  display: flex;
  flex-wrap: wrap;
  gap: 18px;
  margin-top: 6px;
  padding-top: 16px;
  border-top: 1px dashed var(--line-strong);
}
.stat {
  font-family: "JetBrains Mono", monospace;
  font-size: 0.78rem;
  color: var(--ink-soft);
  display: flex;
  align-items: baseline;
  gap: 6px;
}
.stat b {
  font-family: "Archivo", sans-serif;
  font-size: 1.1rem;
  color: var(--ink);
  font-weight: 900;
}

/* ---------- hero right: picker stage ---------- */
.hero-right {
  background: var(--teal);
  color: var(--teal-ink);
  border-radius: 22px;
  padding: 26px;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
  min-height: 320px;
}
.hero-right .sticker { position: absolute; color: var(--teal-ink); }
.hero-right .sticker svg { width: 100%; height: 100%; }
.sticker.s1 { width: 46px; top: 18px; left: 20px; opacity: 0.35; }
.sticker.s2 { width: 34px; bottom: 24px; right: 26px; opacity: 0.3; }
.sticker.s3 { width: 26px; top: 30px; right: 40px; opacity: 0.4; }

.picker-stage {
  width: 100%;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  z-index: 1;
}
.picker-empty { font-size: 0.98rem; opacity: 0.92; max-width: 30ch; }

.picker-result {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  animation: land 0.35s ease;
}
@media (prefers-reduced-motion: reduce) { .picker-result { animation: none; } }
@keyframes land {
  from { opacity: 0; transform: translateY(8px) scale(0.98); }
  to { opacity: 1; transform: none; }
}
.picker-media {
  width: 100%;
  max-width: 280px;
  height: 130px;
  border-radius: 16px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.16);
  display: flex;
  align-items: center;
  justify-content: center;
}
.picker-media img { width: 100%; height: 100%; object-fit: cover; }
.picker-media svg { width: 40px; height: 40px; color: var(--teal-ink); }

.picker-result h2 {
  font-family: "Archivo", sans-serif;
  font-weight: 900;
  font-size: clamp(1.4rem, 3.4vw, 1.9rem);
  margin: 0;
  text-wrap: balance;
  letter-spacing: -0.01em;
}
.picker-result .notes { opacity: 0.88; max-width: 34ch; font-size: 0.94rem; }
.picker-actions { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; margin-top: 4px; }
.picker-actions a, .picker-actions button {
  font-family: "Work Sans", sans-serif;
  font-weight: 700;
  font-size: 0.88rem;
  text-decoration: none;
  background: rgba(255, 255, 255, 0.18);
  color: var(--teal-ink);
  border: none;
  border-radius: 999px;
  padding: 8px 16px;
  cursor: pointer;
}
.rolling {
  font-family: "JetBrains Mono", monospace;
  font-size: 0.9rem;
  letter-spacing: 0.02em;
  opacity: 0.85;
}

/* ---------- steps ---------- */
.steps {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
  margin-top: 18px;
}
@media (max-width: 700px) { .steps { grid-template-columns: 1fr; } }
.step { border-radius: 18px; padding: 20px; display: flex; flex-direction: column; gap: 8px; }
.step .num { font-family: "JetBrains Mono", monospace; font-size: 0.72rem; opacity: 0.75; }
.step h3 { font-family: "Archivo", sans-serif; font-weight: 700; font-size: 1.02rem; margin: 0; }
.step p { margin: 0; font-size: 0.88rem; opacity: 0.85; }
.step.a { background: var(--lime); color: var(--lime-ink); }
.step.b { background: var(--dark); color: var(--dark-ink); }
.step.c { background: var(--amber); color: var(--amber-ink); }

/* ---------- chips ---------- */
.chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-family: "JetBrains Mono", monospace;
  font-size: 0.7rem;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid var(--line-strong);
  color: var(--ink-soft);
  background: transparent;
}
.chip[data-hue="lime"] { color: var(--lime-text); background: var(--lime-soft); border-color: transparent; }
.chip[data-hue="teal"] { color: var(--teal); background: var(--teal-soft); border-color: transparent; }
.chip[data-hue="amber"] { color: var(--amber); background: var(--amber-soft); border-color: transparent; }

/* ---------- filter bar ---------- */
section.catalog { margin-top: 40px; }
.catalog-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}
.catalog-head h2 {
  font-family: "Archivo", sans-serif;
  font-weight: 900;
  font-size: 1.5rem;
  margin: 0;
  text-transform: uppercase;
  letter-spacing: -0.01em;
}
.count { font-family: "JetBrains Mono", monospace; font-size: 0.78rem; color: var(--ink-soft); }

.catalog-head-right { display: flex; align-items: center; gap: 12px; }

.trash-toggle {
  font-family: "JetBrains Mono", monospace;
  font-size: 0.74rem;
  color: var(--ink-soft);
  background: transparent;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  padding: 6px 12px;
  cursor: pointer;
}
.trash-toggle:hover { color: var(--ink); border-color: var(--ink); }

.trash-panel {
  border: 1px dashed var(--line-strong);
  border-radius: 18px;
  padding: 18px;
  margin-bottom: 22px;
  background: var(--surface-2);
}
.trash-panel-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 4px; }
.trash-panel-head h3 { font-family: "Archivo", sans-serif; font-weight: 700; font-size: 1.05rem; margin: 0; }
.trash-hint { font-size: 0.85rem; color: var(--ink-soft); margin: 0 0 14px; }

.distance-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-family: "JetBrains Mono", monospace;
  font-size: 0.72rem;
  color: var(--ink-soft);
}
.distance-chip svg { width: 13px; height: 13px; }

.controls-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 10px; }
.controls-row.spread { justify-content: space-between; margin-bottom: 18px; }

.filter-btn {
  font-family: "JetBrains Mono", monospace;
  font-size: 0.74rem;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid var(--line-strong);
  background: transparent;
  color: var(--ink-soft);
  cursor: pointer;
}
.filter-btn.active { background: var(--ink); color: var(--bg); border-color: var(--ink); }

/* ---------- grid + cards ---------- */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(268px, 1fr)); gap: 16px; }

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 18px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: border-color 0.15s ease, transform 0.15s ease;
}
.card:hover { border-color: var(--line-strong); transform: translateY(-1px); }
.card.visited { opacity: 0.68; }

.card-media { height: 140px; display: flex; align-items: center; justify-content: center; position: relative; }
.card-media[data-hue="lime"] { background: var(--lime); color: var(--lime-ink); }
.card-media[data-hue="teal"] { background: var(--teal); color: var(--teal-ink); }
.card-media[data-hue="amber"] { background: var(--amber); color: var(--amber-ink); }
.card-media svg { width: 42px; height: 42px; }
.card-media img { width: 100%; height: 100%; object-fit: cover; }
.card-media .credit {
  position: absolute;
  right: 6px;
  bottom: 5px;
  font-family: "JetBrains Mono", monospace;
  font-size: 0.6rem;
  color: rgba(255, 255, 255, 0.85);
  background: rgba(0, 0, 0, 0.35);
  padding: 1px 6px;
  border-radius: 999px;
}

.card-body { padding: 16px; display: flex; flex-direction: column; gap: 8px; flex-grow: 1; }
.card-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }

.card h3 {
  font-family: "Archivo", sans-serif;
  font-weight: 700;
  font-size: 1.08rem;
  margin: 0;
  text-wrap: balance;
  letter-spacing: -0.005em;
}
.card .notes { color: var(--ink-soft); font-size: 0.9rem; flex-grow: 1; }

.card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  font-family: "JetBrains Mono", monospace;
  font-size: 0.7rem;
  color: var(--ink-soft);
}

/* star rating */
.stars { display: inline-flex; align-items: center; gap: 2px; }
.stars button { background: none; border: none; padding: 1px; cursor: pointer; color: var(--line-strong); line-height: 0; }
.stars button svg { width: 16px; height: 16px; display: block; }
.stars button.filled { color: var(--amber); }
.stars button:hover { color: var(--amber); }
.rating-meta { font-family: "JetBrains Mono", monospace; font-size: 0.72rem; color: var(--ink-soft); }
.rating-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

.card-actions { display: flex; gap: 8px; align-items: center; margin-top: 2px; flex-wrap: wrap; }
.link-btn, .text-btn {
  font-family: "Work Sans", sans-serif;
  font-size: 0.84rem;
  font-weight: 600;
  text-decoration: none;
  color: var(--teal);
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
}
.text-btn.muted { color: var(--ink-soft); font-weight: 500; }
.text-btn.danger { color: var(--danger); font-weight: 500; }
.dot-sep { color: var(--line-strong); }

.empty-state {
  border: 1px dashed var(--line-strong);
  border-radius: 18px;
  padding: 44px 20px;
  text-align: center;
  color: var(--ink-soft);
}

/* ---------- fab + dialog ---------- */
.fab {
  position: fixed;
  right: 22px;
  bottom: 22px;
  background: var(--ink);
  color: var(--bg);
  border: none;
  border-radius: 999px;
  padding: 14px 20px;
  font-family: "Archivo", sans-serif;
  font-weight: 700;
  font-size: 0.9rem;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  box-shadow: 0 10px 22px -10px rgba(0, 0, 0, 0.5);
  z-index: 5;
}

dialog#add-dialog {
  border: none;
  border-radius: 20px;
  padding: 0;
  background: var(--surface);
  color: var(--ink);
  width: min(480px, calc(100vw - 48px));
  box-shadow: var(--shadow);
}
dialog#add-dialog::backdrop { background: rgba(8, 10, 6, 0.5); }

.dialog-inner { padding: 26px; display: flex; flex-direction: column; gap: 16px; }
.dialog-inner h2 { font-family: "Archivo", sans-serif; font-weight: 900; font-size: 1.3rem; margin: 0; text-transform: uppercase; }

.field { display: flex; flex-direction: column; gap: 5px; }
.field label {
  font-family: "JetBrains Mono", monospace;
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--ink-soft);
}
.field input, .field select, .field textarea {
  font-family: "Work Sans", sans-serif;
  font-size: 0.95rem;
  color: var(--ink);
  background: var(--surface-2);
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  padding: 10px 12px;
  outline: none;
}
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--teal); }
.field textarea { resize: vertical; min-height: 64px; font-family: "Work Sans", sans-serif; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

.dialog-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 4px; }

.btn-primary {
  font-family: "Archivo", sans-serif;
  font-weight: 700;
  font-size: 0.9rem;
  background: var(--lime);
  color: var(--lime-ink);
  border: none;
  border-radius: 10px;
  padding: 10px 18px;
  cursor: pointer;
}
.btn-secondary {
  font-family: "Work Sans", sans-serif;
  font-weight: 600;
  font-size: 0.9rem;
  background: transparent;
  color: var(--ink-soft);
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  padding: 10px 16px;
  cursor: pointer;
}

.status-line {
  font-family: "JetBrains Mono", monospace;
  font-size: 0.74rem;
  color: var(--ink-soft);
  text-align: center;
  margin-top: 30px;
}

.discover-line {
  font-size: 0.85rem;
  color: var(--ink-soft);
  text-align: center;
  margin-top: 10px;
}
.discover-line a { color: var(--teal); font-weight: 600; text-decoration: none; }
.discover-line a:hover { text-decoration: underline; }

@media (max-width: 520px) { .field-row { grid-template-columns: 1fr; } }
