/* ============================================================
   Useful Websites Directory — pastel dashboard theme
   ============================================================ */

/* ---------- Poppins (self-hosted, latin subset) ---------- */
@font-face { font-family: "Poppins"; font-style: normal; font-weight: 400; font-display: swap; src: url("fonts/poppins-400.woff2") format("woff2"); }
@font-face { font-family: "Poppins"; font-style: normal; font-weight: 500; font-display: swap; src: url("fonts/poppins-500.woff2") format("woff2"); }
@font-face { font-family: "Poppins"; font-style: normal; font-weight: 600; font-display: swap; src: url("fonts/poppins-600.woff2") format("woff2"); }
@font-face { font-family: "Poppins"; font-style: normal; font-weight: 700; font-display: swap; src: url("fonts/poppins-700.woff2") format("woff2"); }
@font-face { font-family: "Poppins"; font-style: normal; font-weight: 800; font-display: swap; src: url("fonts/poppins-800.woff2") format("woff2"); }

/* ---------- Inter (self-hosted variable, latin subset) — body text ---------- */
@font-face { font-family: "Inter"; font-style: normal; font-weight: 400 700; font-display: swap; src: url("fonts/inter-latin.woff2") format("woff2"); }

/* ---------- Font roles ---------- */
:root {
  --font-head: "Poppins", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-body: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

/* ---------- Theme tokens ---------- */
:root {
  --bg: #ffffff;              /* white canvas */
  --sidebar-bg: #ffffff;
  --surface: #ffffff;
  --surface-2: #f3f4f6;       /* neutral light grey (was lavender) */
  --border: #ebebef;
  --border-strong: #dcdce1;
  --text: #2b2b3a;
  --text-muted: #7c7b91;
  --primary: #9a86e6;        /* pastel violet */
  --primary-soft: #efeafc;
  --primary-hover: #8770df;
  --badge-featured-bg: #fdf1d6;
  --badge-featured-text: #a8791f;
  --badge-sponsored-bg: #e3f2f0;
  --badge-sponsored-text: #2f8a7a;
  --tag-bg: #f1f0f9;
  --tag-text: #6f6e85;
  --shadow-sm: 0 1px 2px rgba(16, 24, 40, 0.04), 0 4px 10px rgba(16, 24, 40, 0.06);
  --shadow: 0 4px 14px rgba(80, 70, 130, 0.07);
  --shadow-hover: 0 10px 28px rgba(80, 70, 130, 0.14);
  --radius: 4px;
  --radius-sm: 4px;
  --sidebar-w: 268px;
}

:root[data-theme="dark"] {
  --bg: #14141c;
  --sidebar-bg: #191824;
  --surface: #1f1e2b;
  --surface-2: #262536;
  --border: #2c2b3d;
  --border-strong: #383650;
  --text: #e9e8f2;
  --text-muted: #9d9cb5;
  --primary: #b3a3f0;
  --primary-soft: #2a2740;
  --primary-hover: #c4b8f5;
  --badge-featured-bg: #3a3016;
  --badge-featured-text: #f0d089;
  --badge-sponsored-bg: #16332e;
  --badge-sponsored-text: #86d6c6;
  --tag-bg: #262536;
  --tag-text: #b5b3cc;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
  --shadow: 0 4px 14px rgba(0, 0, 0, 0.35);
  --shadow-hover: 0 10px 28px rgba(0, 0, 0, 0.5);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #14141c;
    --sidebar-bg: #191824;
    --surface: #1f1e2b;
    --surface-2: #262536;
    --border: #2c2b3d;
    --border-strong: #383650;
    --text: #e9e8f2;
    --text-muted: #9d9cb5;
    --primary: #b3a3f0;
    --primary-soft: #2a2740;
    --primary-hover: #c4b8f5;
    --badge-featured-bg: #3a3016;
    --badge-featured-text: #f0d089;
    --badge-sponsored-bg: #16332e;
    --badge-sponsored-text: #86d6c6;
    --tag-bg: #262536;
    --tag-text: #b5b3cc;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
    --shadow: 0 4px 14px rgba(0, 0, 0, 0.35);
    --shadow-hover: 0 10px 28px rgba(0, 0, 0, 0.5);
  }
}

/* Per-category pastel lightness tuning (deeper text in dark mode) */
:root { --cat-dot-l: 78%; --cat-tint-l: 93%; --cat-text-l: 42%; --cat-sat: 62%; }
:root[data-theme="dark"] { --cat-dot-l: 62%; --cat-tint-l: 22%; --cat-text-l: 72%; --cat-sat: 45%; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) { --cat-dot-l: 62%; --cat-tint-l: 22%; --cat-text-l: 72%; --cat-sat: 45%; }
}

/* ---------- Base ---------- */
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--text);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--primary-hover); text-decoration: none; }
a:hover { text-decoration: underline; }

/* Poppins for display/headings; Inter (body) for everything else. */
h1, h2, h3, .brand, .page-head h1, .category-head h2, .card-title, .prose h1, .prose h2 {
  font-family: var(--font-head);
  letter-spacing: -0.01em;
}

.skip-link { position: absolute; left: -9999px; top: 0; background: var(--primary); color: #fff; padding: 10px 16px; border-radius: 0 0 8px 0; z-index: 200; }
.skip-link:focus { left: 0; }

/* ---------- Layout shell ---------- */
.layout { display: flex; min-height: 100vh; }

/* ---------- Sidebar ---------- */
.sidebar {
  width: var(--sidebar-w); flex: 0 0 var(--sidebar-w);
  background: var(--sidebar-bg);
  border-right: 1px solid var(--border);
  position: sticky; top: 0; height: 100vh;
  display: flex; flex-direction: column;
  padding: 22px 16px;
}
.sidebar-top { display: flex; align-items: center; justify-content: space-between; padding: 0 6px 18px; }
.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--text); font-size: 1.12rem; }
.brand:hover { text-decoration: none; }
.brand-mark { font-size: 1.35rem; }
.brand-text strong { color: var(--primary-hover); font-weight: 800; }
.sidebar-close { display: none; background: none; border: none; color: var(--text-muted); font-size: 1.1rem; cursor: pointer; padding: 4px 8px; }

.cat-nav { flex: 1; overflow-y: auto; margin: 4px 0; scrollbar-width: thin; scrollbar-color: var(--border-strong) transparent; }
.cat-nav::-webkit-scrollbar { width: 7px; }
.cat-nav::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 999px; }
.cat-nav-label { font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.1em; color: var(--text-muted); margin: 6px 10px 10px; font-weight: 700; }

.cat-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 2px; }
.cat-item {
  display: flex; align-items: center; gap: 11px;
  width: 100%; text-align: left; cursor: pointer;
  background: none; border: none; color: var(--text-muted);
  padding: 9px 12px; border-radius: var(--radius-sm); font-size: 0.93rem; font-weight: 600;
  font-family: inherit; transition: background .15s, color .15s;
}
.cat-item:hover { background: var(--surface-2); color: var(--text); }
.cat-item.active {
  background: hsl(var(--cat-h, 265) var(--cat-sat) var(--cat-tint-l));
  color: hsl(var(--cat-h, 265) 45% var(--cat-text-l));
}
.cat-item.active .cat-dot { transform: scale(1.15); box-shadow: 0 0 0 3px hsl(var(--cat-h, 265) var(--cat-sat) var(--cat-tint-l)); }
.cat-dot {
  width: 12px; height: 12px; border-radius: 5px; flex: 0 0 auto;
  background: hsl(var(--cat-h, 265) var(--cat-sat) var(--cat-dot-l));
  transition: transform .15s, box-shadow .15s;
}
.cat-item.all .cat-dot { background: conic-gradient(from 210deg, #f3b7c8, #f7cfa6, #f2e6a0, #b6e3c0, #a9cdf0, #c9b7ef, #f3b7c8); }
.cat-name { flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cat-count { font-size: 0.76rem; font-weight: 700; color: var(--text-muted); background: var(--surface-2); border-radius: 4px; padding: 1px 8px; min-width: 24px; text-align: center; }
.cat-item.active .cat-count { background: hsl(var(--cat-h, 265) var(--cat-sat) var(--cat-dot-l) / .5); color: hsl(var(--cat-h, 265) 45% var(--cat-text-l)); }

.sidebar-foot { padding-top: 14px; border-top: 1px solid var(--border); margin-top: 6px; }
.sidebar-foot-links { display: flex; align-items: center; justify-content: space-between; margin-top: 12px; padding: 0 6px; }
.sidebar-foot-links a { color: var(--text-muted); font-size: 0.88rem; }
.theme-btn { background: none; border: 1px solid var(--border-strong); border-radius: 4px; padding: 6px 10px; cursor: pointer; font-size: 1rem; line-height: 1; }
.theme-btn:hover { background: var(--surface-2); }

/* ---------- Buttons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border: 1px solid var(--border-strong); background: var(--surface); color: var(--text);
  padding: 9px 16px; border-radius: var(--radius-sm); font-size: 0.9rem; font-weight: 700;
  cursor: pointer; transition: background .15s, border-color .15s, transform .05s; }
.btn:hover { text-decoration: none; background: var(--surface-2); }
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-hover); border-color: var(--primary-hover); }
.btn-block { width: 100%; }

/* ---------- Content column ---------- */
.content { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.topbar {
  position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; gap: 14px;
  padding: 14px 28px;
  background: color-mix(in srgb, var(--bg) 85%, transparent);
  backdrop-filter: saturate(160%) blur(10px);
  border-bottom: 1px solid var(--border);
}
.menu-btn { display: none; background: var(--surface); border: 1px solid var(--border-strong); border-radius: 4px; padding: 8px 12px; font-size: 1.05rem; cursor: pointer; color: var(--text); }
.search-wrap { position: relative; flex: 1; max-width: 560px; }
.search-icon { position: absolute; left: 16px; top: 50%; transform: translateY(-50%); font-size: 0.9rem; opacity: 0.6; pointer-events: none; }
#search { width: 100%; padding: 12px 18px 12px 42px; font-size: 0.98rem; font-family: inherit;
  border: 1px solid var(--border-strong); border-radius: 4px; background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); transition: border-color .15s, box-shadow .15s; }
#search:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 4px var(--primary-soft); }
.topbar-submit { flex: 0 0 auto; }

.main-inner { padding: 26px 28px 40px; max-width: 1180px; width: 100%; }

.page-head { margin-bottom: 18px; display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.page-controls { display: flex; align-items: center; gap: 10px; flex: 0 0 auto; }
.btn-surprise { background: var(--surface); }
.sort-wrap { display: inline-flex; align-items: center; gap: 6px; font-size: 0.82rem; color: var(--text-muted); font-weight: 600; }
.sort-wrap select { font-family: inherit; font-size: 0.85rem; padding: 8px 10px; border-radius: 4px;
  border: 1px solid var(--border-strong); background: var(--surface); color: var(--text); cursor: pointer; }
@media (max-width: 520px) { .surprise-text { display: none; } }
.page-head h1 { font-size: 1.6rem; margin: 0 0 4px; letter-spacing: -0.02em; }
.page-sub { color: var(--text-muted); margin: 0; font-size: 0.95rem; }

/* ---------- Ad slot ---------- */
.ad-slot { margin: 0 0 26px; min-height: 88px; border: 1.5px dashed var(--border-strong); border-radius: var(--radius);
  display: flex; align-items: center; justify-content: center; color: var(--text-muted);
  font-size: 0.72rem; letter-spacing: 0.12em; text-transform: uppercase; background: var(--surface-2); }
.ad-slot span { opacity: 0.65; }

/* ---------- Directory ---------- */
.category-block { margin-bottom: 40px; scroll-margin-top: 90px; }
.category-head { display: flex; align-items: center; gap: 12px; margin-bottom: 18px; }
.category-head .cat-dot { width: 14px; height: 14px; border-radius: 4px; }
.category-head h2 { font-size: 1.22rem; margin: 0; letter-spacing: -0.01em; }
.category-head .count { color: var(--text-muted); font-size: 0.82rem; font-weight: 600;
  background: hsl(var(--cat-h, 265) var(--cat-sat) var(--cat-tint-l)); color: hsl(var(--cat-h, 265) 45% var(--cat-text-l));
  padding: 2px 10px; border-radius: 4px; }

.card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(266px, 1fr)); gap: 16px; }

/* ---------- View toggle (grid / list) ---------- */
.view-toggle { flex: 0 0 auto; display: inline-flex; border: 1px solid var(--border-strong); border-radius: 4px; overflow: hidden; }
.view-btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; height: 40px; padding: 0 12px;
  background: var(--surface); border: none; cursor: pointer; color: var(--text-muted);
  font-family: inherit; font-size: 0.82rem; font-weight: 600; white-space: nowrap; transition: background .13s, color .13s; }
.view-btn + .view-btn { border-left: 1px solid var(--border-strong); }
.view-btn:hover { background: var(--surface-2); color: var(--text); }
.view-btn.active { background: var(--primary-soft); color: var(--primary-hover); }
.view-btn svg { width: 15px; height: 15px; flex: 0 0 auto; }
.view-label { line-height: 1; }
@media (max-width: 680px) { .view-label { display: none; } .view-btn { padding: 0; width: 38px; } }

/* ---------- List (row) layout ---------- */
.list { display: flex; flex-direction: column; gap: 10px; }
.list-row { position: relative; display: flex; align-items: center; gap: 14px; overflow: hidden;
  background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--radius);
  padding: 12px 16px; box-shadow: var(--shadow-sm); transition: transform .12s, box-shadow .12s, border-color .12s; }
.list-row::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px;
  background: hsl(var(--cat-h, 265) var(--cat-sat) var(--cat-dot-l)); opacity: 0; transition: opacity .12s; }
.list-row:hover { transform: translateY(-1px); box-shadow: var(--shadow); border-color: var(--border-strong); }
.list-row:hover::before { opacity: 1; }
.list-row .card-favicon { width: 38px; height: 38px; font-size: 1rem; }
.list-main { flex: 1 1 auto; min-width: 0; }
.list-line { display: flex; align-items: center; gap: 8px; }
.list-name { font-family: var(--font-head); font-weight: 700; color: var(--text); font-size: 1.02rem; letter-spacing: -0.01em; }
.list-desc { color: var(--text-muted); font-size: 0.9rem; margin: 2px 0 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.list-tags { flex: 0 0 auto; display: flex; gap: 6px; max-width: 300px; overflow: hidden; }
@media (max-width: 760px) { .list-tags { display: none; } }
@media (max-width: 480px) { .list-desc { white-space: normal; } }

.card { position: relative; display: flex; flex-direction: column;
  background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--radius);
  padding: 18px; box-shadow: var(--shadow-sm); overflow: hidden;
  transition: transform .14s, box-shadow .14s, border-color .14s; }
.card::before { content: ""; position: absolute; inset: 0 0 auto 0; height: 4px;
  background: hsl(var(--cat-h, 265) var(--cat-sat) var(--cat-dot-l)); opacity: 0; transition: opacity .14s; }
.card:hover { transform: translateY(-3px); box-shadow: var(--shadow-hover); border-color: var(--border-strong); }
.card:hover::before { opacity: 1; }

.card-top { display: flex; align-items: center; gap: 11px; margin-bottom: 9px; }
.card-favicon { position: relative; overflow: hidden; width: 34px; height: 34px; border-radius: 4px; flex: 0 0 auto;
  display: inline-flex; align-items: center; justify-content: center; color: #fff; font-weight: 800; font-size: 0.95rem; }
.card-favicon .fav-letter { position: relative; z-index: 0; }
.card-favicon .fav-img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain;
  background: #fff; padding: 3px; z-index: 1; }
.card-title { font-size: 1.03rem; font-weight: 700; margin: 0; }
.card-title a { color: var(--text); }
.card-title a::after { content: "↗"; font-size: 0.72em; margin-left: 4px; color: var(--text-muted); opacity: 0; transition: opacity .12s; }
.card:hover .card-title a::after { opacity: 1; }
.card-desc { color: var(--text-muted); font-size: 0.9rem; margin: 0 0 13px; flex: 1; }
.card-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: auto; }
.tag { font-size: 0.73rem; padding: 3px 9px; border-radius: 4px; background: var(--tag-bg); color: var(--tag-text);
  font-weight: 600; cursor: pointer; border: none; font-family: inherit; }
.tag:hover { color: var(--text); background: var(--primary-soft); }

.badges { position: absolute; top: 14px; right: 14px; display: flex; gap: 6px; }
.badge { font-size: 0.62rem; font-weight: 700; padding: 3px 7px; border-radius: 4px; text-transform: uppercase; letter-spacing: 0.03em; }
.badge-featured { background: var(--badge-featured-bg); color: var(--badge-featured-text); }
.badge-sponsored { background: var(--badge-sponsored-bg); color: var(--badge-sponsored-text); }

.loading, .empty-state { text-align: center; color: var(--text-muted); padding: 50px 0; }
mark { background: color-mix(in srgb, var(--primary) 30%, transparent); color: inherit; border-radius: 3px; padding: 0 1px; }

/* ---------- Card footer + vote button ---------- */
.card-foot { display: flex; align-items: flex-end; justify-content: space-between; gap: 10px; margin-top: auto; }
.card-foot .card-tags { margin-top: 0; }

.vote-btn {
  flex: 0 0 auto; display: inline-flex; flex-direction: column; align-items: center; gap: 1px;
  min-width: 46px; padding: 6px 10px; cursor: pointer;
  background: var(--surface-2); border: 1px solid var(--border-strong); border-radius: 4px;
  color: var(--text-muted); font-family: inherit; line-height: 1; transition: all .13s;
}
.vote-btn:hover { border-color: var(--primary); color: var(--primary-hover); background: var(--primary-soft); }
.vote-btn .vote-arrow { font-size: 0.72rem; }
.vote-btn .vote-count { font-size: 0.9rem; font-weight: 700; color: var(--text); }
.vote-btn.voted { background: var(--primary-soft); border-color: var(--primary); color: var(--primary-hover); }
.vote-btn.voted .vote-arrow { color: var(--primary-hover); }
.vote-btn.voted .vote-count { color: var(--primary-hover); }
.vote-btn:active { transform: scale(0.94); }

/* ---------- Top 100 leaderboard ---------- */
.leaderboard { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; counter-reset: none; }
.lb-row {
  display: flex; align-items: center; gap: 14px;
  background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--radius);
  padding: 12px 16px; box-shadow: var(--shadow-sm); transition: transform .12s, box-shadow .12s, border-color .12s;
}
.lb-row:hover { transform: translateY(-2px); box-shadow: var(--shadow); border-color: var(--border-strong); }
.lb-rank {
  flex: 0 0 auto; width: 34px; text-align: center; font-family: var(--font-head);
  font-weight: 700; font-size: 1.05rem; color: var(--text-muted);
}
.lb-row.lb-top .lb-rank { color: hsl(var(--cat-h, 265) 55% 55%); font-size: 1.25rem; }
.lb-row .card-favicon { width: 38px; height: 38px; font-size: 1rem; }
.lb-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.lb-name { font-family: var(--font-head); font-weight: 700; color: var(--text); font-size: 1.02rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lb-cat { font-size: 0.78rem; color: var(--text-muted); }
.lb-row .vote-btn { min-width: 54px; }

/* ---------- Sidebar: Top 100 item ---------- */
.cat-item.top100 { color: var(--text); font-weight: 700; }
.cat-item.top100 .cat-flame { margin-left: 5px; font-size: 0.95rem; }
.cat-item.top100 .cat-count { background: color-mix(in srgb, #ff7a59 22%, var(--surface-2)); color: #d1502f; }
.cat-item.top100.active { background: color-mix(in srgb, #ff7a59 16%, var(--surface)); color: #c2461f; }
:root[data-theme="dark"] .cat-item.top100 .cat-count { color: #ff9c7d; }
:root[data-theme="dark"] .cat-item.top100.active { color: #ff9c7d; }

/* ---------- Toast ---------- */
.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%) translateY(12px);
  background: var(--text); color: var(--bg); padding: 11px 18px; border-radius: 4px;
  font-size: 0.9rem; font-weight: 600; box-shadow: var(--shadow-hover); z-index: 300;
  opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; max-width: 90vw; text-align: center;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ---------- Entry meta: pricing / open-source / no-signup / platforms ---------- */
.meta-row { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: 0 0 11px; }
.list-main .meta-row { margin: 7px 0 0; }
.chip { font-size: 0.66rem; font-weight: 600; padding: 2px 7px; border-radius: 4px; white-space: nowrap; letter-spacing: 0.01em; }
.chip-free { background: color-mix(in srgb, #22c55e 12%, var(--surface)); color: #2a9d5c; }
.chip-freemium { background: color-mix(in srgb, #3b82f6 11%, var(--surface)); color: #4479df; }
.chip-paid { background: color-mix(in srgb, #f59e0b 14%, var(--surface)); color: #bd7c12; }
.chip-oss { background: color-mix(in srgb, #10b981 11%, var(--surface)); color: #169571; }
.chip-nosignup { background: var(--surface-2); color: var(--text-muted); }
.plat { font-size: 0.64rem; font-weight: 600; padding: 2px 6px; border-radius: 4px; white-space: nowrap;
  background: var(--surface-2); color: var(--text-muted); }
:root[data-theme="dark"] .chip-free { color: #6ee7a8; }
:root[data-theme="dark"] .chip-freemium { color: #9db8ff; }
:root[data-theme="dark"] .chip-paid { color: #fbbf24; }
:root[data-theme="dark"] .chip-oss { color: #6ee7c0; }

.badge-new { background: color-mix(in srgb, #10b981 15%, var(--surface)); color: #169571; }
:root[data-theme="dark"] .badge-new { color: #6ee7c0; }

/* ---------- Card / row actions (save + vote) ---------- */
.card-actions { display: flex; align-items: center; gap: 8px; flex: 0 0 auto; }
.save-btn { display: inline-flex; align-items: center; justify-content: center; width: 40px; height: 40px;
  font-size: 1.15rem; line-height: 1; cursor: pointer; background: var(--surface-2);
  border: 1px solid var(--border-strong); border-radius: 4px; color: var(--text-muted); transition: all .13s; }
.save-btn:hover { border-color: #f0b429; color: #d69e00; background: color-mix(in srgb, #f0b429 12%, var(--surface)); }
.save-btn.saved { color: #d69e00; border-color: #f0b429; background: color-mix(in srgb, #f0b429 16%, var(--surface)); }

/* ---------- Sidebar: My List item ---------- */
.cat-item.saved .cat-star { color: #e0a100; margin-left: 4px; }

/* ---------- Reaction tags ---------- */
.reactions { margin-top: 12px; border-top: 1px solid var(--border); padding-top: 10px; }
.list-row { flex-wrap: wrap; }
.list-row .reactions { flex-basis: 100%; margin-top: 10px; }
.react-toggle { display: inline-flex; align-items: center; gap: 6px; background: none; border: none; cursor: pointer;
  font-family: inherit; font-size: 0.8rem; font-weight: 600; color: var(--text-muted); padding: 0; }
.react-toggle:hover { color: var(--text); }
.react-total { background: var(--surface-2); color: var(--text-muted); font-size: 0.68rem; font-weight: 700; padding: 1px 7px; border-radius: 4px; }
.react-panel { display: none; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.reactions.open .react-panel { display: flex; }
.react-chip { display: inline-flex; align-items: center; gap: 5px; cursor: pointer; font-family: inherit;
  font-size: 0.72rem; font-weight: 600; padding: 4px 9px; border-radius: 4px; border: 1px solid var(--border-strong);
  background: var(--surface); color: var(--text-muted); transition: background .12s, border-color .12s, color .12s; }
.react-chip:hover { border-color: var(--primary); color: var(--text); }
.react-chip.on { background: var(--primary-soft); border-color: var(--primary); color: var(--primary-hover); }
.react-chip .rx-count { font-weight: 700; color: var(--text); }
.react-chip.on .rx-count { color: var(--primary-hover); }
.rx-emoji { font-size: 0.82rem; }

/* ---------- Direct "Visit" link on cards ---------- */
.visit-ext { display: inline-flex; align-items: center; justify-content: center; width: 40px; height: 40px;
  font-size: 1.05rem; text-decoration: none; background: var(--surface-2); border: 1px solid var(--border-strong);
  border-radius: 4px; color: var(--text-muted); transition: background .13s, border-color .13s, color .13s; }
.visit-ext:hover { border-color: var(--primary); color: var(--primary-hover); background: var(--primary-soft); text-decoration: none; }

/* ============================================================
   Detail page
   ============================================================ */
.d-topbar { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 14px 28px;
  border-bottom: 1px solid var(--border); background: var(--sidebar-bg); position: sticky; top: 0; z-index: 30; }
.d-wrap { max-width: 960px; margin: 0 auto; padding: 22px 24px 60px; }
.breadcrumb { font-size: 0.85rem; color: var(--text-muted); margin-bottom: 18px; }
.breadcrumb a { color: var(--text-muted); }
.breadcrumb a:hover { color: var(--text); }

.d-hero { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; padding-bottom: 22px; border-bottom: 1px solid var(--border); }
.d-favicon { position: relative; overflow: hidden; border-radius: 8px; flex: 0 0 auto; display: inline-flex;
  align-items: center; justify-content: center; color: #fff; font-weight: 800; font-size: 1.4rem; }
.d-favicon .fav-letter { position: relative; z-index: 0; }
.d-favicon .fav-img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; background: #fff; padding: 6px; z-index: 1; }
.d-hero-main { flex: 1 1 260px; min-width: 0; }
.d-hero-main h1 { font-family: var(--font-head); font-size: 1.9rem; margin: 0 0 8px; letter-spacing: -0.02em; }
.d-hero-actions { display: flex; flex-direction: column; align-items: flex-end; gap: 10px; }
.d-visit { padding: 12px 22px; font-size: 0.95rem; }
#detail-actions { display: flex; gap: 8px; }

.d-body { display: grid; grid-template-columns: 1fr 300px; gap: 32px; margin-top: 26px; }
.d-h2 { font-family: var(--font-head); font-size: 1.2rem; margin: 26px 0 10px; }
.d-main .d-h2:first-child { margin-top: 0; }
.d-desc { color: var(--text); line-height: 1.7; }
.d-features { margin: 0; padding-left: 20px; color: var(--text); line-height: 1.7; }
.d-features li { margin-bottom: 5px; }
.d-tags { margin-top: 16px; }
.d-tags .tag { text-decoration: none; }
.d-hint { color: var(--text-muted); font-size: 0.9rem; margin: 4px 0 12px; }

.d-facts, .d-related { background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--radius);
  padding: 18px; box-shadow: var(--shadow-sm); margin-bottom: 18px; }
.d-facts h3, .d-related h3 { font-family: var(--font-head); font-size: 1rem; margin: 0 0 12px; }
.d-facts dl { margin: 0; display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; font-size: 0.9rem; }
.d-facts dt { color: var(--text-muted); }
.d-facts dd { margin: 0; text-align: right; }

.mini-grid { display: flex; flex-direction: column; gap: 10px; }
.more-cat .mini-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }
.mini-card { display: flex; align-items: center; gap: 11px; padding: 11px 12px; border: 1px solid var(--border-strong);
  border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow-sm); text-decoration: none;
  transition: transform .12s, box-shadow .12s; }
.mini-card:hover { transform: translateY(-2px); box-shadow: var(--shadow); text-decoration: none; }
.mini-main { min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.mini-name { font-family: var(--font-head); font-weight: 700; color: var(--text); font-size: 0.92rem; }
.mini-desc { font-size: 0.78rem; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mini-card .chip { margin-top: 3px; align-self: flex-start; }
.more-cat { margin-top: 30px; }

@media (max-width: 760px) {
  .d-body { grid-template-columns: 1fr; }
  .d-hero-actions { align-items: stretch; width: 100%; }
  .d-topbar { padding: 12px 16px; }
  .d-wrap { padding: 18px 16px 40px; }
}

/* ---------- Footer ---------- */
.site-footer { border-top: 1px solid var(--border); margin-top: 30px; padding-top: 18px; }
.disclosure { color: var(--text-muted); font-size: 0.78rem; margin: 0; }

/* ---------- Shared chrome for sub-pages (about, submit) ---------- */
.container { width: 100%; max-width: 1140px; margin: 0 auto; padding: 0 20px; }
.site-header { background: var(--sidebar-bg); border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 30; }
.header-inner { display: flex; align-items: center; justify-content: space-between; height: 62px; }
.header-actions { display: flex; align-items: center; gap: 10px; }
.btn-icon { padding: 8px 11px; font-size: 1rem; line-height: 1; }
.footer-inner { display: flex; flex-wrap: wrap; gap: 16px; justify-content: space-between; align-items: center; padding-bottom: 24px; }
.footer-note { color: var(--text-muted); margin: 0; font-size: 0.92rem; }
.footer-links { display: flex; gap: 16px; }
.footer-links a { color: var(--text-muted); font-size: 0.9rem; }

/* ---------- Sidebar scrim (mobile) ---------- */
.sidebar-scrim { position: fixed; inset: 0; background: rgba(20, 18, 35, 0.45); z-index: 90; }

/* ---------- Responsive ---------- */
@media (max-width: 860px) {
  .sidebar {
    position: fixed; top: 0; left: 0; z-index: 100; height: 100vh;
    transform: translateX(-100%); transition: transform .22s ease; box-shadow: var(--shadow-hover);
  }
  .sidebar.open { transform: translateX(0); }
  .sidebar-close { display: block; }
  .menu-btn { display: inline-flex; }
  .topbar-submit { display: none; }
  .main-inner { padding: 20px 18px 40px; }
  .topbar { padding: 12px 18px; }
}
@media (min-width: 861px) {
  .sidebar-scrim { display: none !important; }
}
@media (max-width: 480px) {
  .card-grid { grid-template-columns: 1fr; }
  .page-head h1 { font-size: 1.35rem; }
}
