/* ============ Masthead ============ */
.masthead {
  padding: clamp(40px, 7vw, 80px) 0 clamp(28px, 4vw, 44px);
  border-bottom: 1px solid var(--hairline);
}
.mast-kicker {
  font-family: var(--font-display);
  font-size: 12px; font-weight: 600;
  letter-spacing: 0.22em; text-transform: uppercase;
  color: var(--gold);
  margin: 0 0 18px;
  display: flex; align-items: center; gap: 12px;
}
.mast-kicker::after {
  content: ""; flex: 1; height: 1px;
  background: linear-gradient(90deg, var(--border), transparent);
}
.mast-row { display: flex; align-items: flex-end; justify-content: space-between; gap: 40px; flex-wrap: wrap; }
.mast-title {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: clamp(44px, 8vw, 92px);
  line-height: 0.92; letter-spacing: -0.02em;
  color: var(--white);
  margin: 0;
}
.mast-title em { font-style: normal; color: var(--gold); }
.mast-sub {
  margin: 18px 0 0; max-width: 38ch;
  font-size: 15px; line-height: 1.6; color: var(--text-2);
}

/* stat block */
.stats { display: flex; gap: clamp(20px, 3vw, 38px); flex-shrink: 0; }
.stat { text-align: right; }
.stat-num {
  font-family: var(--font-display); font-weight: 700;
  font-size: 34px; line-height: 1; color: var(--white);
  font-variant-numeric: tabular-nums;
}
.stat-num.gold { color: var(--gold); }
.stat-label {
  margin-top: 8px; font-size: 11px; letter-spacing: 0.1em;
  text-transform: uppercase; color: var(--muted);
}

/* acquired progress */
.progress-wrap { margin-top: 26px; }
.progress-head {
  display: flex; justify-content: space-between; align-items: baseline;
  font-size: 12px; color: var(--text-2); margin-bottom: 9px;
  letter-spacing: 0.02em;
}
.progress-head b { color: var(--text); font-weight: 600; }
.progress-track { height: 5px; background: var(--surface-2); border-radius: 99px; overflow: hidden; }
.progress-fill { height: 100%; background: var(--gold); border-radius: 99px; transition: width 0.5s cubic-bezier(.2,.8,.2,1); }

/* ============ Toolbar ============ */
.toolbar {
  position: sticky; top: 50px; z-index: 30;
  background: rgba(10,10,10,0.86); backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--hairline);
  padding: 14px 0;
}
.toolbar-inner { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }

.search {
  position: relative; flex: 1 1 240px; min-width: 200px;
}
.search input {
  width: 100%; height: 40px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 10px; color: var(--white);
  padding: 0 14px 0 38px; font-size: 14px;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.search input::placeholder { color: var(--muted); }
.search input:focus { outline: none; border-color: #3a3a3a; box-shadow: 0 0 0 3px rgba(234,179,8,0.08); }
.search svg { position: absolute; left: 13px; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; }

/* segmented + select controls */
.seg { display: flex; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 3px; gap: 2px; }
.seg button {
  border: none; background: transparent; color: var(--text-2);
  font-size: 12.5px; font-weight: 500; padding: 6px 12px; border-radius: 7px;
  letter-spacing: 0.01em; transition: background 0.14s, color 0.14s; white-space: nowrap;
}
.seg button:hover { color: var(--text); }
.seg button.on { background: var(--surface-2); color: var(--white); box-shadow: inset 0 0 0 1px var(--border); }

.tool-select {
  height: 40px; background: var(--surface); border: 1px solid var(--border);
  border-radius: 10px; color: var(--text); font-size: 13px; padding: 0 32px 0 13px;
  -webkit-appearance: none; appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='none' stroke='%235e5e5e' stroke-width='2'%3E%3Cpath d='M2 4l4 4 4-4'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 12px center;
  cursor: pointer; transition: border-color 0.15s;
}
.tool-select:hover { border-color: #3a3a3a; }
.tool-select:focus { outline: none; border-color: #3a3a3a; }

.add-btn {
  height: 40px; padding: 0 16px; border: none; border-radius: 10px;
  background: var(--gold); color: #1a1500; font-weight: 700; font-size: 13.5px;
  letter-spacing: 0.01em; display: inline-flex; align-items: center; gap: 7px;
  transition: filter 0.14s, transform 0.08s;
}
.add-btn:hover { filter: brightness(1.08); }
.add-btn:active { transform: scale(0.97); }

.edit-btn {
  height: 40px; padding: 0 16px; border: 1px solid var(--border); border-radius: 10px;
  background: transparent; color: var(--text); font-weight: 600; font-size: 13.5px;
  letter-spacing: 0.01em; display: inline-flex; align-items: center; gap: 7px;
  text-decoration: none; transition: border-color 0.15s, background 0.15s;
}
.edit-btn:hover { border-color: #3a3a3a; background: #1a1a1a; }

/* category filter row */
.cats { display: flex; gap: 8px; flex-wrap: wrap; padding: 14px 0 2px; }
.cat-chip {
  border: 1px solid var(--border); background: transparent;
  color: var(--text-2); font-size: 12.5px; font-weight: 500;
  padding: 6px 13px; border-radius: 99px; letter-spacing: 0.01em;
  transition: all 0.14s; display: inline-flex; align-items: center; gap: 7px;
}
.cat-chip:hover { border-color: #3a3a3a; color: var(--text); }
.cat-chip.on { background: var(--white); border-color: var(--white); color: #0a0a0a; font-weight: 600; }
.cat-chip .ct { font-variant-numeric: tabular-nums; opacity: 0.55; font-size: 11px; }
.cat-chip.on .ct { opacity: 0.5; }

/* ============ Grid + cards ============ */
.results-meta {
  display: flex; align-items: baseline; gap: 10px;
  padding: 22px 0 14px; color: var(--text-2); font-size: 13px;
}
.results-meta b { color: var(--text); font-weight: 600; }
.results-meta .clear { margin-left: auto; color: var(--gold); cursor: pointer; font-size: 12.5px; }
.results-meta .clear:hover { text-decoration: underline; }

.group-head {
  display: flex; align-items: center; gap: 14px;
  padding: 26px 0 14px; margin-top: 6px;
}
.group-head:first-child { padding-top: 8px; }
.group-title {
  font-family: var(--font-display); font-weight: 700; font-size: 14px;
  letter-spacing: 0.14em; text-transform: uppercase; color: var(--white);
  display: inline-flex; align-items: center; gap: 10px;
}
.group-dot { width: 8px; height: 8px; border-radius: 99px; }
.group-count { color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; }
.group-head .line { flex: 1; height: 1px; background: var(--hairline); }

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(var(--row-min), 1fr));
  gap: var(--grid-gap);
  padding-bottom: 20px;
}

.card {
  position: relative; text-align: left;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 0;
  display: flex; flex-direction: column; gap: 0;
  transition: border-color 0.18s, transform 0.18s, box-shadow 0.18s, background 0.18s;
  overflow: hidden;
}

/* image cover — only shown when .has-img */
.card-img {
  width: 100%; aspect-ratio: 16/9; overflow: hidden;
  background: var(--surface-2); flex-shrink: 0;
}
.card-img img {
  width: 100%; height: 100%; object-fit: cover;
  transition: transform 0.35s cubic-bezier(.2,.85,.25,1);
  display: block;
}
.card:hover .card-img img { transform: scale(1.04); }

/* inner padding wrapper so ::before stripe still works */
.card-inner {
  padding: var(--card-pad);
  display: flex; flex-direction: column; gap: 12px;
  flex: 1;
}
.card::before {
  content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px;
  background: var(--prio-color, transparent);
  opacity: 0.85; transition: opacity 0.18s;
}
.card:hover {
  border-color: #333; transform: translateY(-3px);
  box-shadow: 0 14px 40px rgba(0,0,0,0.5);
  background: var(--surface-2);
}
.card.acquired { opacity: 0.52; }
.card.acquired:hover { opacity: 0.78; }

.card-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; }
.card-idx {
  font-family: var(--font-display); font-size: 11px; font-weight: 600;
  color: var(--muted); font-variant-numeric: tabular-nums; letter-spacing: 0.05em;
  padding-top: 4px;
}
.card-name {
  font-family: var(--font-display); font-weight: 600;
  font-size: var(--name-size); line-height: 1.18; color: var(--white);
  letter-spacing: -0.01em; flex: 1; margin: 0;
  text-wrap: balance;
}
.card.acquired .card-name { text-decoration: line-through; text-decoration-color: var(--muted); color: var(--text-2); }

.fav-btn {
  border: none; background: transparent; color: var(--muted);
  padding: 2px; line-height: 0; flex-shrink: 0; transition: color 0.14s, transform 0.12s;
}
.fav-btn:hover { color: var(--text); transform: scale(1.12); }
.fav-btn.on { color: var(--gold); }

.card-meta { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.tag {
  font-size: 11px; letter-spacing: 0.04em; text-transform: uppercase;
  color: var(--text-2); border: 1px solid var(--border); border-radius: 6px;
  padding: 3px 8px; font-weight: 500;
}
.prio-tag {
  font-size: 11px; letter-spacing: 0.04em; text-transform: uppercase;
  font-weight: 600; display: inline-flex; align-items: center; gap: 6px;
}
.prio-tag .pd { width: 7px; height: 7px; border-radius: 99px; }

.card-notes {
  font-size: 13.5px; line-height: 1.55; color: var(--text-2);
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}

.card-foot {
  display: flex; align-items: center; justify-content: space-between;
  margin-top: auto; padding-top: 12px; border-top: 1px solid var(--hairline);
}
.price { font-family: var(--font-display); font-weight: 700; font-size: 17px; color: var(--white); font-variant-numeric: tabular-nums; }
.price.none { color: var(--muted); font-weight: 500; font-size: 13px; }
.card-foot .got {
  font-size: 11px; letter-spacing: 0.05em; text-transform: uppercase;
  color: var(--green); font-weight: 600; display: inline-flex; align-items: center; gap: 5px;
}
.added { font-size: 11.5px; color: var(--muted); letter-spacing: 0.02em; }

/* empty */
.empty { text-align: center; padding: 80px 20px; color: var(--text-2); }
.empty h3 { font-family: var(--font-display); color: var(--text); font-weight: 600; font-size: 20px; margin: 0 0 8px; }
.empty p { margin: 0; font-size: 14px; }
.empty .clear { color: var(--gold); cursor: pointer; }
.empty .clear:hover { text-decoration: underline; }

/* loading */
.loading { text-align: center; padding: 80px 20px; color: var(--text-2); }
.loading-spinner {
  width: 32px; height: 32px; border: 2px solid var(--border);
  border-top-color: var(--gold); border-radius: 50%;
  animation: spin 0.7s linear infinite; margin: 0 auto 16px;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ============ Drawer ============ */
.scrim {
  position: fixed; inset: 0; z-index: 60;
  background: rgba(0,0,0,0.6); backdrop-filter: blur(2px);
  opacity: 0; animation: fade 0.2s forwards;
}
@keyframes fade { to { opacity: 1; } }

.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; z-index: 61;
  width: min(460px, 100vw);
  background: var(--bg-2); border-left: 1px solid var(--border);
  display: flex; flex-direction: column;
  transform: translateX(100%); animation: slidein 0.32s cubic-bezier(.2,.85,.25,1) forwards;
  box-shadow: -30px 0 80px rgba(0,0,0,0.6);
}
@keyframes slidein { to { transform: translateX(0); } }

/* drawer product image */
.drawer-img {
  width: 100%; aspect-ratio: 16/9; overflow: hidden; flex-shrink: 0;
  background: var(--surface-2); border-bottom: 1px solid var(--hairline);
}
.drawer-img img { width: 100%; height: 100%; object-fit: cover; display: block; }

.drawer-head { padding: 22px 26px; border-bottom: 1px solid var(--hairline); display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; }
.drawer-x { border: 1px solid var(--border); background: var(--surface); color: var(--text-2); width: 32px; height: 32px; border-radius: 8px; line-height: 0; flex-shrink: 0; transition: all 0.14s; }
.drawer-x:hover { color: var(--white); border-color: #3a3a3a; }
.drawer-eyebrow { font-size: 11px; letter-spacing: 0.16em; text-transform: uppercase; color: var(--gold); margin-bottom: 12px; font-family: var(--font-display); font-weight: 600; }
.drawer-name { font-family: var(--font-display); font-weight: 700; font-size: 27px; line-height: 1.12; color: var(--white); letter-spacing: -0.01em; margin: 0; }

.drawer-body { padding: 24px 26px; overflow-y: auto; flex: 1; display: flex; flex-direction: column; gap: 24px; }
.d-price { font-family: var(--font-display); font-weight: 800; font-size: 40px; color: var(--white); font-variant-numeric: tabular-nums; line-height: 1; }
.d-price small { font-size: 14px; color: var(--text-2); font-weight: 500; margin-left: 8px; letter-spacing: 0.02em; }

.d-block label { display: block; font-size: 11px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); margin-bottom: 11px; }
.d-notes { font-size: 15px; line-height: 1.65; color: var(--text); }
.d-notes.empty-note { color: var(--muted); font-style: italic; }

.d-field { display: flex; justify-content: space-between; padding: 11px 0; border-bottom: 1px solid var(--hairline); font-size: 14px; }
.d-field:last-child { border-bottom: none; }
.d-field .k { color: var(--text-2); }
.d-field .v { color: var(--text); font-weight: 500; }

/* priority picker */
.prio-pick { display: flex; gap: 8px; }
.prio-pick button {
  flex: 1; border: 1px solid var(--border); background: var(--surface);
  color: var(--text-2); padding: 11px 8px; border-radius: 10px; font-size: 12.5px; font-weight: 600;
  letter-spacing: 0.02em; transition: all 0.14s; display: flex; flex-direction: column; align-items: center; gap: 6px;
}
.prio-pick button .pd { width: 8px; height: 8px; border-radius: 99px; }
.prio-pick button:hover { border-color: #3a3a3a; color: var(--text); }
.prio-pick button.on { background: var(--surface-2); color: var(--white); border-color: #3f3f3f; }

.drawer-foot { padding: 18px 26px; border-top: 1px solid var(--hairline); display: flex; gap: 10px; }
.btn {
  flex: 1; height: 44px; border-radius: 10px; font-size: 13.5px; font-weight: 600;
  border: 1px solid var(--border); background: var(--surface); color: var(--text);
  transition: all 0.14s; display: inline-flex; align-items: center; justify-content: center; gap: 8px;
}
.btn:hover { border-color: #3a3a3a; color: var(--white); }
.btn.primary { background: var(--gold); border-color: var(--gold); color: #1a1500; font-weight: 700; }
.btn.primary:hover { filter: brightness(1.08); color: #1a1500; }
.btn.acq { background: rgba(91,191,123,0.1); border-color: rgba(91,191,123,0.35); color: var(--green); }
.btn.danger-ghost { flex: 0 0 44px; color: var(--text-2); }
.btn.danger-ghost:hover { color: var(--red); border-color: rgba(224,102,102,0.4); }
.btn a, .drawer-foot a { color: inherit; text-decoration: none; }

/* ============ Modal (add) ============ */
.modal {
  position: fixed; inset: 0; z-index: 70;
  display: flex; align-items: center; justify-content: center; padding: 20px;
  background: rgba(0,0,0,0.65); backdrop-filter: blur(3px);
  opacity: 0; animation: fade 0.2s forwards;
}
.modal-box {
  width: min(520px, 100%); background: var(--bg-2);
  border: 1px solid var(--border); border-radius: 18px;
  transform: translateY(14px) scale(0.98); animation: pop 0.26s cubic-bezier(.2,.85,.25,1) forwards;
  max-height: 90vh; display: flex; flex-direction: column; overflow: hidden;
}
@keyframes pop { to { transform: translateY(0) scale(1); } }
.modal-head { padding: 22px 26px 18px; border-bottom: 1px solid var(--hairline); display: flex; justify-content: space-between; align-items: center; }
.modal-head h2 { font-family: var(--font-display); font-weight: 700; font-size: 21px; color: var(--white); margin: 0; }
.modal-body { padding: 22px 26px; overflow-y: auto; display: flex; flex-direction: column; gap: 16px; }
.field label { display: block; font-size: 11px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); margin-bottom: 8px; }
.field input, .field select, .field textarea {
  width: 100%; background: var(--surface); border: 1px solid var(--border);
  border-radius: 10px; color: var(--white); padding: 11px 13px; font-size: 14px;
  transition: border-color 0.15s; resize: vertical;
}
.field input:focus, .field select:focus, .field textarea:focus { outline: none; border-color: #3a3a3a; box-shadow: 0 0 0 3px rgba(234,179,8,0.08); }
.field input::placeholder, .field textarea::placeholder { color: var(--muted); }
.field-row { display: flex; gap: 14px; }
.field-row .field { flex: 1; }
.modal-foot { padding: 16px 26px; border-top: 1px solid var(--hairline); display: flex; gap: 10px; justify-content: flex-end; }
.modal-foot .btn { flex: 0 0 auto; padding: 0 22px; }

footer.site {
  border-top: 1px solid var(--hairline); margin-top: 30px;
  padding: 22px 0; display: flex; justify-content: space-between;
  font-size: 12px; color: var(--muted); letter-spacing: 0.02em;
}

@media (max-width: 560px) {
  .mast-row { gap: 24px; }
  .stats { width: 100%; justify-content: space-between; }
  .stat { text-align: left; }
}

/* ============ Mobile: compact toolbar + scrollable categories ============ */
@media (max-width: 640px) {
  .masthead { padding: 24px 0 16px; }
  .mast-title { font-size: 36px; }
  .mast-sub { display: none; }
  .mast-kicker { margin-bottom: 10px; }
  .progress-wrap { margin-top: 16px; }

  .toolbar { padding: 10px 0; }
  .toolbar-inner { gap: 8px; }
  .search { min-width: 0; flex-basis: 100%; }
  .search input { height: 36px; font-size: 13px; }
  .seg button { padding: 5px 9px; font-size: 11.5px; }
  .tool-select { height: 34px; font-size: 12px; padding: 0 26px 0 10px; }
  .add-btn { height: 34px; padding: 0 12px; font-size: 12.5px; }
  .edit-btn { height: 34px; padding: 0 12px; font-size: 12.5px; }

  .cats {
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    padding: 10px 0 2px;
    scrollbar-width: none;
    margin: 0 calc(-1 * clamp(16px, 4vw, 48px));
    padding-left: clamp(16px, 4vw, 48px);
    padding-right: clamp(16px, 4vw, 48px);
  }
  .cats::-webkit-scrollbar { display: none; }
  .cat-chip { flex-shrink: 0; }
}

/* ============ Price Check Panel ============ */
.price-check-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  margin-top: 10px;
  overflow: hidden;
}
.pc-header {
  display: flex; justify-content: space-between; align-items: center;
  padding: 13px 16px;
  border-bottom: 1px solid var(--hairline);
}
.pc-title {
  display: flex; align-items: center;
  font-size: 12px; font-weight: 600;
  letter-spacing: 0.06em; text-transform: uppercase;
  color: var(--gold);
}
.pc-loading {
  display: flex; align-items: center; gap: 10px;
  padding: 16px; font-size: 13px; color: var(--text-2);
}
.pc-msg { padding: 16px; font-size: 13px; color: var(--text-2); margin: 0; }
.pc-results { display: flex; flex-direction: column; gap: 1px; }
.pc-result {
  display: block; padding: 12px 16px;
  border-bottom: 1px solid var(--hairline);
  text-decoration: none; transition: background 0.15s;
}
.pc-result:last-child { border-bottom: none; }
.pc-result:hover { background: var(--surface-2); }
.pc-result-title {
  font-size: 13px; color: var(--white); font-weight: 500;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.pc-result-price {
  font-size: 15px; font-weight: 700; color: var(--gold);
  margin-top: 3px;
}
.pc-result-snippet {
  font-size: 12px; color: var(--text-2); margin-top: 4px;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.pc-shops {
  padding: 12px 16px;
  border-top: 1px solid var(--hairline);
}
.pc-shops-label {
  font-size: 10px; letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--muted); margin-bottom: 8px;
}
.pc-shops-links { display: flex; flex-wrap: wrap; gap: 6px; }
.pc-shop-link {
  font-size: 12px; padding: 4px 10px;
  border: 1px solid var(--border); border-radius: 20px;
  color: var(--text); text-decoration: none; transition: all 0.15s;
}
.pc-shop-link:hover { border-color: var(--gold); color: var(--gold); }
.btn.on { border-color: var(--gold); color: var(--gold); }
