/* ============================================================ Market Hub */
:root {
  --bg:        #0b0c0f;
  --bg-elev:   #14161c;
  --card:      #131519;
  --card-hover:#181b21;
  --border:    #23262e;
  --border-h:  #353a44;
  --text:      #e8eaef;
  --text-dim:  #9aa1ad;
  --text-read: #c8cdd6;
  --text-faint:#646b78;
  --accent:    #10b981;
  --accent-soft: rgba(16, 185, 129, 0.14);
  --danger:    #f0606a;
  --bar-bg:    rgba(11, 12, 15, 0.82);
  --shadow:    0 10px 30px -16px rgba(0, 0, 0, 0.7);
  --radius:    14px;
  --maxw:      1240px;
}

[data-theme="light"] {
  --bg:        #f6f7f9;
  --bg-elev:   #eef0f3;
  --card:      #ffffff;
  --card-hover:#ffffff;
  --border:    #e6e8ec;
  --border-h:  #d2d6dd;
  --text:      #15181d;
  --text-dim:  #5b626e;
  --text-read: #2c323b;
  --text-faint:#9aa1ad;
  --accent:    #0f9d6e;
  --accent-soft: rgba(15, 157, 110, 0.12);
  --bar-bg:    rgba(246, 247, 249, 0.85);
  --shadow:    0 12px 28px -18px rgba(20, 30, 50, 0.35);
}

/* Category accent palette — one deliberate colour per market category.
   Each .acc-* sets --cat; consumers (cards, counts, sidebar dots) read it. */
.acc-blue   { --cat: #3b82f6; }
.acc-green  { --cat: #10b981; }
.acc-amber  { --cat: #f59e0b; }
.acc-purple { --cat: #a855f7; }
.acc-teal   { --cat: #14b8a6; }
.acc-pink   { --cat: #ec4899; }
.acc-orange { --cat: #fb923c; }
.acc-indigo { --cat: #818cf8; }

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Inter, Helvetica, Arial, sans-serif;
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

a { color: inherit; }

/* ----------------------------------------------------------------- header */
.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  background: var(--bar-bg);
  backdrop-filter: saturate(140%) blur(14px);
  -webkit-backdrop-filter: saturate(140%) blur(14px);
  border-bottom: 1px solid var(--border);
}

.bar {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 14px 22px;
  display: flex;
  align-items: center;
  gap: 18px;
}

.brand { display: flex; align-items: center; gap: 11px; flex: 0 0 auto; }
.brand-mark { display: inline-flex; filter: drop-shadow(0 2px 6px var(--accent-soft)); }
.brand-text { display: flex; flex-direction: column; line-height: 1.12; }
.brand-text strong { font-size: 16px; letter-spacing: -0.02em; font-weight: 650; }
.brand-text small { font-size: 11px; color: var(--text-faint); letter-spacing: 0.01em; }

.search {
  position: relative;
  flex: 1 1 auto;
  max-width: 440px;
  margin-left: auto;
}
.search svg { position: absolute; left: 13px; top: 50%; transform: translateY(-50%); color: var(--text-faint); pointer-events: none; }
.search input {
  width: 100%;
  padding: 11px 14px 11px 40px;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: 12px;
  color: var(--text);
  font-size: 14px;
  outline: none;
  transition: border-color 0.16s, box-shadow 0.16s, background 0.16s;
}
.search input::placeholder { color: var(--text-faint); }
.search input:hover { border-color: var(--border-h); }
.search:focus-within svg { color: var(--accent); }
.search input:focus { border-color: var(--accent); background: var(--card); box-shadow: 0 0 0 3px var(--accent-soft); }
.search input::-webkit-search-cancel-button { -webkit-appearance: none; }

/* header search on generated sub-pages (tool / learn / etc.) — submits to homepage */
.site-search { position: relative; flex: 1 1 auto; max-width: 360px; margin-left: auto; }
.site-search svg { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--text-faint); pointer-events: none; }
.site-search input {
  width: 100%; padding: 9px 14px 9px 36px;
  background: var(--bg-elev); border: 1px solid var(--border); border-radius: 11px;
  color: var(--text); font: inherit; font-size: 14px; outline: none;
  transition: border-color 0.15s, box-shadow 0.15s, background 0.15s;
}
.site-search input::placeholder { color: var(--text-faint); }
.site-search:focus-within svg { color: var(--accent); }
.site-search input:focus { border-color: var(--accent); background: var(--card); box-shadow: 0 0 0 3px var(--accent-soft); }
.site-search input::-webkit-search-cancel-button { -webkit-appearance: none; }
@media (max-width: 720px) {
  .site-search { order: 4; flex-basis: 100%; max-width: none; margin-left: 0; }
  .site-search input { font-size: 16px; }
}

/* ----------------------------------------------------- search suggestions */
.suggest {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  right: 0;
  z-index: 60;
  padding: 6px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: 0 16px 40px -12px rgba(0, 0, 0, 0.45), 0 2px 8px rgba(0, 0, 0, 0.18);
  max-height: min(62vh, 430px);
  overflow-y: auto;
  overscroll-behavior: contain;
  animation: suggest-in 0.15s ease;
}
.suggest[hidden] { display: none; }
@keyframes suggest-in { from { opacity: 0; transform: translateY(-5px); } to { opacity: 1; transform: none; } }

.sug-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 6px 10px 7px; margin-bottom: 2px;
  font-size: 10.5px; font-weight: 600; letter-spacing: 0.05em; text-transform: uppercase;
  color: var(--text-faint);
}
.sug-hint { display: inline-flex; align-items: center; gap: 6px; }
.sug-hint-t { color: var(--text-faint); }
.sug-head kbd {
  font-family: inherit; font-size: 13px; line-height: 1; font-weight: 700;
  min-width: 20px; height: 20px; padding: 0 5px;
  display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid var(--border-h); border-radius: 6px;
  background: var(--bg-elev); color: var(--text-dim);
  box-shadow: 0 1px 0 var(--border-h);
}
.sug-row {
  display: flex; align-items: center; gap: 11px;
  padding: 8px 10px; border-radius: 10px;
  text-decoration: none; color: var(--text); cursor: pointer;
}
.sug-row:hover, .sug-row.active { background: var(--bg-elev); }
.sug-row.active { box-shadow: inset 0 0 0 1px var(--border-h); }
.sug-row .fav { width: 26px; height: 26px; border-radius: 7px; padding: 4px; flex: 0 0 auto; font-size: 12px; }
.sug-main { display: flex; flex-direction: column; gap: 1px; min-width: 0; flex: 1 1 auto; }
.sug-name { font-size: 13.5px; font-weight: 600; letter-spacing: -0.01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sug-name b { color: var(--accent); font-weight: 700; }
.sug-meta { font-size: 11.5px; color: var(--text-faint); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sug-sec {
  flex: 0 0 auto; font-size: 10.5px; font-weight: 600; padding: 2px 9px; border-radius: 999px;
  color: var(--cat); background: color-mix(in srgb, var(--cat) 15%, transparent);
}
.sug-go { flex: 0 0 auto; color: var(--text-faint); font-size: 17px; opacity: 0.45; transition: opacity 0.12s, color 0.12s, transform 0.12s; }
.sug-row:hover .sug-go, .sug-row.active .sug-go { opacity: 1; color: var(--accent); transform: translateX(1px); }
.sug-empty { padding: 16px 12px; text-align: center; color: var(--text-faint); font-size: 13px; }

.actions { display: flex; align-items: center; gap: 9px; flex: 0 0 auto; }

.icon-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 38px; height: 38px;
  border: 1px solid var(--border);
  background: var(--bg-elev);
  color: var(--text-dim);
  border-radius: 11px;
  cursor: pointer;
  transition: 0.16s;
}
.icon-btn:hover { color: var(--text); border-color: var(--border-h); }

.btn {
  font: inherit; font-size: 13.5px; font-weight: 550;
  border-radius: 11px; padding: 9px 15px;
  border: 1px solid var(--border);
  background: var(--bg-elev); color: var(--text);
  cursor: pointer; transition: 0.16s; text-decoration: none;
  display: inline-flex; align-items: center; gap: 6px; white-space: nowrap;
}
.btn:hover { border-color: var(--border-h); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #04130d; font-weight: 650; }
.btn.primary:hover { filter: brightness(1.06); }
.btn.ghost { background: transparent; }
.btn:focus-visible, .icon-btn:focus-visible, .site-link:focus-visible {
  outline: 2px solid var(--accent); outline-offset: 2px;
}
.add-btn { box-shadow: 0 6px 16px -9px color-mix(in srgb, var(--accent) 70%, transparent); }
.add-btn:hover { box-shadow: 0 8px 20px -9px color-mix(in srgb, var(--accent) 80%, transparent); }

/* ---------------------------------------------------------- site nav */
.brand { text-decoration: none; }
.site-head .bar { gap: 14px; }
.site-nav { display: flex; align-items: center; gap: 2px; }
.site-head .site-nav { margin-left: 6px; }
.site-head .actions { margin-left: auto; }
.site-link {
  font-size: 14px; font-weight: 550; color: var(--text-dim); text-decoration: none;
  padding: 7px 12px; border-radius: 9px; transition: 0.15s; position: relative;
}
.site-link:hover { color: var(--text); background: var(--bg-elev); }
.site-link.active { color: var(--text); }
.site-link.active::after {
  content: ""; position: absolute; left: 12px; right: 12px; bottom: 2px;
  height: 2px; border-radius: 2px; background: var(--accent);
}

/* ----------------------------------------------------- reading progress */
.reading-progress {
  position: fixed; top: 0; left: 0; right: 0; height: 3px; z-index: 50;
  background: transparent; pointer-events: none;
}
.reading-progress i {
  display: block; height: 100%; width: 0%;
  background: linear-gradient(90deg, var(--accent), #34d399);
  transition: width 0.08s linear;
}

/* --------------------------------------------------------------- sub-bar */
.subbar {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 0 22px 13px;
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}
.filters { display: flex; gap: 7px; flex-wrap: wrap; }
.pill {
  font: inherit; font-size: 13px; font-weight: 500;
  padding: 6px 13px; border-radius: 999px;
  border: 1px solid var(--border);
  background: transparent; color: var(--text-dim);
  cursor: pointer; transition: 0.15s;
  display: inline-flex; align-items: center; gap: 7px;
}
.pill:hover { color: var(--text); border-color: var(--border-h); }
.pill.active { background: var(--text); color: var(--bg); border-color: var(--text); }
.pill.pill-my.active { background: var(--accent); border-color: var(--accent); color: #04130d; }
.pill-count {
  font-size: 11px; font-variant-numeric: tabular-nums;
  padding: 1px 6px; border-radius: 999px;
  background: var(--bg-elev); color: var(--text-faint);
}
.pill.active .pill-count { background: rgba(0,0,0,0.18); color: inherit; }
.pill[data-filter="all"]:not(.active) .pill-count    { color: var(--accent); background: var(--accent-soft); }
.pill[data-filter="stocks"]:not(.active) .pill-count { color: #3b82f6; background: color-mix(in srgb, #3b82f6 18%, transparent); }
.pill[data-filter="crypto"]:not(.active) .pill-count { color: #f59e0b; background: color-mix(in srgb, #f59e0b 18%, transparent); }
.pill[data-filter="macro"]:not(.active) .pill-count  { color: #a855f7; background: color-mix(in srgb, #a855f7 18%, transparent); }
.pill[data-filter="my"]:not(.active) .pill-count     { color: #eab308; background: color-mix(in srgb, #eab308 22%, transparent); }
.pill:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.subbar-right { margin-left: auto; display: flex; align-items: center; gap: 14px; }
.status { font-size: 12.5px; color: var(--text-faint); }

/* grid / compact-list view toggle */
.view-toggle { display: inline-flex; gap: 2px; padding: 2px; background: var(--bg-elev); border: 1px solid var(--border); border-radius: 9px; }
.view-btn {
  display: inline-flex; align-items: center; justify-content: center; width: 30px; height: 26px;
  border: none; background: transparent; color: var(--text-faint); border-radius: 7px; cursor: pointer; transition: 0.15s;
}
.view-btn:hover { color: var(--text); }
.view-btn.active { background: var(--card); color: var(--text); box-shadow: 0 1px 3px rgba(0,0,0,0.22); }
.view-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ----------------------------------------------------- in-page jump nav */
.jumpbar {
  max-width: var(--maxw); margin: 0 auto; padding: 0 22px 12px;
  display: flex; gap: 7px; overflow-x: auto; scrollbar-width: none;
}
.jumpbar[hidden] { display: none; }
.jumpbar::-webkit-scrollbar { display: none; }
.jb-chip {
  --cat: var(--accent);
  display: inline-flex; align-items: center; gap: 7px;
  font-size: 12.5px; font-weight: 550; color: var(--text-dim); text-decoration: none;
  padding: 5px 12px; border-radius: 999px; border: 1px solid var(--border);
  background: transparent; white-space: nowrap; transition: 0.15s;
}
.jb-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--cat); }
.jb-chip:hover { color: var(--text); border-color: var(--border-h); }
.jb-chip.active { background: color-mix(in srgb, var(--cat) 15%, transparent); color: var(--cat); border-color: transparent; font-weight: 600; }
.jb-chip:focus-visible { outline: 2px solid var(--cat); outline-offset: 2px; }

/* ------------------------------------------------ browse: nav + content */
.browse {
  max-width: var(--maxw); margin: 0 auto; padding: 0 22px;
  display: grid; grid-template-columns: 248px minmax(0, 1fr); gap: 28px; align-items: start;
}
.browse.no-catnav { grid-template-columns: 1fr; }
.browse-main { min-width: 0; }
.browse .hero { max-width: none; margin: 0; padding: 30px 0 6px; }

.content {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 26px 22px 10px;
}
.browse .content { max-width: none; margin: 0; padding: 24px 0 30px; }
#content .sec[id], #content .grp-title[id] { scroll-margin-top: calc(var(--header-h, 150px) + 16px); }

/* sticky category sidebar (desktop) */
.catnav { position: sticky; top: calc(var(--header-h, 150px) + 12px); align-self: start; }
.catnav[hidden] { display: none; }
.catnav-inner {
  max-height: calc(100vh - var(--header-h, 150px) - 30px); overflow-y: auto;
  padding: 30px 8px 18px 0; display: flex; flex-direction: column; gap: 1px;
  scrollbar-width: thin; scrollbar-color: var(--border) transparent;
}
.catnav-inner::-webkit-scrollbar { width: 8px; }
.catnav-inner::-webkit-scrollbar-track { background: transparent; }
.catnav-inner::-webkit-scrollbar-thumb { background: var(--border); border-radius: 8px; border: 2px solid var(--bg); background-clip: padding-box; }
.catnav-inner:hover::-webkit-scrollbar-thumb { background: var(--border-h); background-clip: padding-box; }
.cat-label {
  font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.07em;
  color: var(--text-faint); margin: 0 0 10px 11px;
}
.cat-link {
  --cat: var(--accent);
  display: flex; align-items: center; gap: 9px;
  text-decoration: none; border-radius: 8px; padding: 6px 11px;
  border-left: 2px solid transparent; transition: background 0.14s, color 0.14s, border-color 0.14s;
}
.cat-dot { flex: 0 0 auto; width: 7px; height: 7px; border-radius: 50%; background: var(--cat); transition: box-shadow 0.15s; }
.cat-name { flex: 1 1 auto; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cat-sec { font-size: 13.5px; font-weight: 650; color: var(--text); margin-top: 9px; }
.cat-sec:first-of-type { margin-top: 0; }
.cat-sec .cat-dot { width: 8px; height: 8px; }
.cat-grp { font-size: 12.5px; color: var(--text-dim); padding-left: 16px; }
.cat-link:hover { background: var(--bg-elev); color: var(--text); }
.cat-link.within { color: var(--text); }
.cat-link.active {
  color: var(--cat); font-weight: 650;
  background: color-mix(in srgb, var(--cat) 14%, transparent); border-left-color: var(--cat);
}
.cat-link.active .cat-dot { box-shadow: 0 0 0 3px color-mix(in srgb, var(--cat) 26%, transparent); }
.cat-count {
  flex: 0 0 auto; font-size: 10.5px; font-variant-numeric: tabular-nums;
  color: var(--cat); background: color-mix(in srgb, var(--cat) 15%, transparent); border-radius: 999px; padding: 1px 7px;
}
.cat-link:focus-visible { outline: 2px solid var(--cat); outline-offset: 2px; }

@media (min-width: 921px) { .jumpbar { display: none; } }
@media (max-width: 920px) {
  .browse { grid-template-columns: 1fr; gap: 0; }
  .catnav { display: none; }
}

.sec { margin-bottom: 14px; }
.sec-head { display: flex; align-items: center; gap: 10px; margin: 18px 0 4px; }
.sec-title {
  font-size: 19px; font-weight: 650; letter-spacing: -0.02em; margin: 0;
  display: flex; align-items: center; gap: 9px;
}
.sec-title::before {
  content: ""; width: 4px; height: 17px; border-radius: 3px; background: var(--accent);
}
.sec-count, .grp-count {
  --cat: var(--accent);
  font-size: 11px; font-weight: 650; font-variant-numeric: tabular-nums;
  color: var(--cat); background: color-mix(in srgb, var(--cat) 16%, transparent);
  padding: 1px 8px; border-radius: 999px;
}
.grp-count { margin-left: 2px; }

.grp-title {
  font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.07em;
  color: var(--text-faint); margin: 22px 0 11px;
  display: flex; align-items: center; gap: 12px;
}
.grp-title::after { content: ""; flex: 1; height: 1px; background: var(--border); }

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

/* ----------------------------------------------------------------- cards */
.card {
  --cat: var(--accent);
  position: relative; overflow: hidden;
  display: flex; gap: 13px; align-items: flex-start;
  padding: 15px 15px 14px 18px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  text-decoration: none;
  transition: transform 0.2s ease, border-color 0.2s ease, background 0.2s ease, box-shadow 0.2s ease;
  animation: rise 0.32s ease both;
}
.card::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: var(--cat); opacity: 0.95; transition: width 0.2s ease, opacity 0.2s ease; }
.card:hover { transform: translateY(-3px) scale(1.02); border-color: var(--cat); background: var(--card-hover); box-shadow: 0 16px 36px -18px rgba(0, 0, 0, 0.6); z-index: 1; }
.card:hover::before { opacity: 1; width: 5px; }
.card:focus-visible { outline: 2px solid var(--cat); outline-offset: 2px; }

.fav {
  width: 34px; height: 34px; border-radius: 9px; flex: 0 0 34px;
  /* Always a light chip so any favicon (dark- or colour-on-transparent) stays
     visible in both light and dark mode. Brand icons are designed for white. */
  background: #ffffff; object-fit: contain; padding: 5px;
  border: 1px solid var(--border);
}
.fav-mono {
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-weight: 650; font-size: 16px; padding: 0;
}

.card-body { min-width: 0; flex: 1; }
.card-top { display: flex; align-items: center; gap: 8px; min-width: 0; padding-right: 24px; }
.card-name { font-weight: 700; font-size: 15px; letter-spacing: -0.01em; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.card-desc {
  margin: 4px 0 0; font-size: 12.7px; line-height: 1.5; color: var(--text-dim);
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
}
.card-host {
  display: block; margin-top: 8px; font-size: 10.5px; color: var(--text-faint); opacity: 0.62;
  letter-spacing: 0.01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

.tag-custom {
  font-size: 9.5px; font-weight: 650; text-transform: uppercase; letter-spacing: 0.06em;
  padding: 2px 6px; border-radius: 5px;
  background: var(--accent-soft); color: var(--accent);
}

.card-star {
  position: absolute; top: 11px; right: 11px;
  width: 26px; height: 26px; border-radius: 8px; padding: 0;
  border: 1px solid transparent; background: transparent; color: var(--text-faint);
  display: inline-flex; align-items: center; justify-content: center;
  cursor: pointer; opacity: 0; transition: 0.15s;
}
.card:hover .card-star { opacity: 1; }
.card-star:hover { color: #eab308; background: var(--bg-elev); border-color: var(--border); }
.card-star.on { opacity: 1; color: #eab308; }
.card-star:focus-visible { opacity: 1; outline: 2px solid var(--accent); outline-offset: 2px; }

.card-x {
  position: absolute; bottom: 11px; right: 11px;
  width: 22px; height: 22px; border-radius: 7px;
  border: 1px solid var(--border); background: var(--bg-elev); color: var(--text-faint);
  display: inline-flex; align-items: center; justify-content: center;
  cursor: pointer; opacity: 0; transition: 0.15s; padding: 0;
}
.card:hover .card-x { opacity: 1; }
.card-x:hover { color: var(--danger); border-color: var(--danger); }
.card-x:focus-visible { opacity: 1; outline: 2px solid var(--accent); outline-offset: 2px; }

/* compact list view (denser rows for power users) */
.content.list .grid { grid-template-columns: 1fr; gap: 7px; }
.content.list .card { padding: 9px 14px 9px 15px; align-items: center; }
.content.list .card:hover { transform: none; }
.content.list .fav { width: 28px; height: 28px; flex-basis: 28px; }
.content.list .card-body { display: flex; align-items: baseline; flex-wrap: wrap; gap: 0 10px; padding-right: 66px; }
.content.list .card-top { padding-right: 0; }
.content.list .card-name { font-size: 14px; }
.content.list .card-desc { display: none; }
.content.list .card-host { margin-top: 0; }
.content.list .card-star { top: 50%; bottom: auto; transform: translateY(-50%); right: 40px; }
.content.list .card-x { top: 50%; bottom: auto; transform: translateY(-50%); }

/* ----------------------------------------------------------- empty state */
.empty {
  text-align: center; padding: 70px 20px; color: var(--text-faint);
}
.empty h3 { color: var(--text-dim); font-weight: 600; margin: 0 0 6px; font-size: 16px; }
.empty p { margin: 0 0 18px; font-size: 13.5px; }
.empty-my { padding: 56px 20px; }
.empty-my .empty-star {
  display: inline-flex; align-items: center; justify-content: center;
  width: 52px; height: 52px; margin-bottom: 14px; border-radius: 14px;
  color: #eab308; background: color-mix(in srgb, #eab308 14%, transparent);
}
.empty-my .empty-star svg { width: 26px; height: 26px; }
.empty-my p { max-width: 42ch; margin-left: auto; margin-right: auto; }
.empty-cta { display: flex; gap: 9px; justify-content: center; flex-wrap: wrap; }

/* --------------------------------------------------------------- footer */
.foot {
  max-width: var(--maxw); margin: 0 auto; padding: 24px 22px 50px;
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
  border-top: 1px solid var(--border); margin-top: 18px;
  font-size: 12.5px; color: var(--text-faint);
}
.foot a { color: var(--text-dim); cursor: pointer; text-decoration: none; border-bottom: 1px dotted var(--text-faint); }
.foot a:hover { color: var(--accent); border-color: var(--accent); }
.foot .spacer { flex: 1; }

/* ---------------------------------------------------------------- modal */
.modal { position: fixed; inset: 0; z-index: 60; display: flex; align-items: center; justify-content: center; padding: 20px; }
.modal[hidden] { display: none; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(0,0,0,0.55); backdrop-filter: blur(3px); animation: fade 0.2s ease; }
.modal-card {
  position: relative; width: 100%; max-width: 440px;
  background: var(--bg-elev); border: 1px solid var(--border); border-radius: 18px;
  padding: 24px; box-shadow: 0 30px 70px -20px rgba(0,0,0,0.6);
  animation: pop 0.22s cubic-bezier(0.2, 0.9, 0.3, 1.2) both;
}
.modal-card h2 { margin: 0 0 18px; font-size: 17px; font-weight: 650; letter-spacing: -0.01em; }
.modal-card label { display: block; font-size: 12px; font-weight: 600; color: var(--text-dim); margin-bottom: 13px; }
.modal-card input, .modal-card textarea, .modal-card select {
  width: 100%; margin-top: 6px; padding: 9px 11px; font: inherit; font-size: 13.5px;
  background: var(--card); border: 1px solid var(--border); border-radius: 10px; color: var(--text);
  outline: none; transition: 0.15s; resize: vertical;
}
.modal-card input:focus, .modal-card textarea:focus, .modal-card select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.modal-card .row { display: flex; gap: 12px; }
.modal-card .row label { flex: 1; }
.modal-actions { display: flex; justify-content: flex-end; gap: 9px; margin-top: 6px; }

/* ---------------------------------------------------------------- toast */
.toast {
  position: fixed; left: 50%; bottom: 28px; transform: translate(-50%, 14px);
  background: var(--text); color: var(--bg); font-size: 13px; font-weight: 550;
  padding: 10px 18px; border-radius: 11px; z-index: 70; opacity: 0;
  transition: opacity 0.22s, transform 0.22s; box-shadow: 0 10px 30px -10px rgba(0,0,0,0.5);
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* --------------------------------------------------------- footer meta */
.footer-meta { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; margin-top: 12px; }
.footer-contact { font-size: 13px; color: var(--text-dim); text-decoration: none; border-bottom: 1px dotted var(--text-faint); }
.footer-contact:hover { color: var(--accent); border-color: var(--accent); }

/* ------------------------------------------------------------ social row */
.social-row { display: flex; gap: 10px; }
.social-link {
  display: inline-flex; align-items: center; justify-content: center;
  width: 34px; height: 34px; border-radius: 9px;
  color: var(--text-faint); background: var(--bg-elev); border: 1px solid var(--border);
  transition: color 0.15s, border-color 0.15s, transform 0.15s;
}
.social-link:hover { color: var(--accent); border-color: var(--accent); transform: translateY(-1px); }
.social-link:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---------------------------------------------------- back-to-top button */
.to-top {
  position: fixed; right: 22px; bottom: 22px; z-index: 45;
  width: 46px; height: 46px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 20px; line-height: 1; padding: 0;
  color: var(--text); background: var(--card);
  border: 1px solid var(--border);
  box-shadow: 0 10px 28px -10px rgba(0, 0, 0, 0.55);
  cursor: pointer;
  transition: transform 0.16s ease, color 0.16s, border-color 0.16s, background 0.16s;
}
.to-top:hover { color: var(--accent); border-color: var(--accent); background: var(--card-hover); transform: translateY(-2px); }
.to-top:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.to-top[hidden] { display: none; }
@media (max-width: 480px) { .to-top { right: 14px; bottom: 14px; width: 42px; height: 42px; } }

/* --------------------------------------------------------------- 404 page */
.notfound { max-width: 640px; margin: 0 auto; padding: 72px 22px 90px; text-align: center; }
.nf-code {
  display: block; font-size: 92px; font-weight: 800; line-height: 1; letter-spacing: -0.04em;
  background: linear-gradient(180deg, var(--accent), #34d399);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.notfound h1 { font-size: 27px; letter-spacing: -0.02em; margin: 16px 0 8px; }
.notfound p { color: var(--text-dim); font-size: 15px; line-height: 1.6; margin: 0 auto 26px; max-width: 46ch; }
.nf-search { display: flex; gap: 9px; justify-content: center; margin: 0 auto 18px; max-width: 430px; }
.nf-search input {
  flex: 1; min-width: 0; padding: 11px 14px; font: inherit; font-size: 16px;
  background: var(--bg-elev); border: 1px solid var(--border); border-radius: 11px; color: var(--text); outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.nf-search input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.nf-actions { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }
@media (max-width: 480px) {
  .notfound { padding: 52px 16px 70px; }
  .nf-code { font-size: 70px; }
  .nf-search { flex-wrap: wrap; }
  .nf-search .btn { flex: 1 1 100%; }
}

/* ---------------------------------------------------------- cookie consent */
.consent {
  position: fixed; left: 16px; right: 16px; bottom: 16px; z-index: 65;
  max-width: 600px; margin: 0 auto;
  display: flex; align-items: center; gap: 16px; flex-wrap: wrap;
  background: var(--card); border: 1px solid var(--border); border-radius: 14px;
  padding: 14px 18px; box-shadow: 0 18px 44px -14px rgba(0, 0, 0, 0.55);
  animation: consent-in 0.3s ease both;
}
.consent[hidden] { display: none; }
@keyframes consent-in { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
.consent-text { flex: 1 1 240px; margin: 0; font-size: 12.8px; line-height: 1.5; color: var(--text-dim); }
.consent-text a { color: var(--accent); text-decoration: none; }
.consent-text a:hover { text-decoration: underline; }
.consent-emoji { margin-right: 5px; }
.consent-actions { display: flex; gap: 9px; flex: 0 0 auto; }
.consent .btn { padding: 8px 16px; font-size: 13px; }
@media (max-width: 480px) {
  .consent { left: 10px; right: 10px; bottom: 10px; padding: 13px 15px; gap: 12px; }
  .consent-actions { flex: 1 1 100%; }
  .consent-actions .btn { flex: 1; }
}

/* ------------------------------------------------------------ animations */
@keyframes rise { from { opacity: 0; transform: translateY(7px); } to { opacity: 1; transform: translateY(0); } }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes pop  { from { opacity: 0; transform: scale(0.96) translateY(8px); } to { opacity: 1; transform: scale(1) translateY(0); } }

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; scroll-behavior: auto; }
}

/* --------------------------------------------------------------- mobile */
@media (max-width: 720px) {
  .bar { flex-wrap: wrap; gap: 10px; padding-top: 11px; padding-bottom: 11px; }
  .search { order: 3; max-width: none; flex-basis: 100%; margin-left: 0; }
  .search input { padding-top: 10px; padding-bottom: 10px; }
  .brand { flex: 1; }
  .status { display: none; }
  .grid { grid-template-columns: 1fr; }
  .add-btn span { display: none; }

  /* Header takes far less vertical space on phones:
     filters become one tidy edge-to-edge scrolling row instead of wrapping,
     and the grid/list toggle is hidden (the layout is single-column anyway). */
  .subbar { gap: 10px; padding-bottom: 10px; }
  .filters {
    flex-wrap: nowrap; overflow-x: auto; -webkit-overflow-scrolling: touch;
    scrollbar-width: none; margin: 0 -22px; padding: 2px 22px;
  }
  .filters::-webkit-scrollbar { display: none; }
  .pill { flex: 0 0 auto; }
  .subbar-right { display: none; }
}

/* --------------------------------------------------- affiliate / legal */
.tag-partner {
  font-size: 9.5px; font-weight: 650; text-transform: uppercase; letter-spacing: 0.06em;
  padding: 2px 6px; border-radius: 5px;
  background: rgba(240, 176, 92, 0.16); color: #e0a44e;
}
.legal {
  max-width: var(--maxw); margin: 0 auto; padding: 6px 22px 60px;
  font-size: 12px; color: var(--text-faint); line-height: 1.65;
}
.legal a { color: var(--text-dim); text-decoration: none; border-bottom: 1px dotted var(--text-faint); }
.legal a:hover { color: var(--accent); border-color: var(--accent); }
.disclosure { margin: 0 0 8px; }

/* ------------------------------------------------------------------ FAQ */
.faq { max-width: var(--maxw); margin: 30px auto 0; padding: 8px 22px 6px; }
.faq > h2 {
  font-size: 19px; font-weight: 650; letter-spacing: -0.02em; margin: 0 0 15px;
  display: flex; align-items: center; gap: 9px;
}
.faq > h2::before { content: ""; width: 4px; height: 17px; border-radius: 3px; background: var(--accent); }
.faq-item {
  border: 1px solid var(--border); border-radius: 12px; background: var(--card);
  margin-bottom: 9px; padding: 0 16px; transition: border-color 0.15s, background 0.15s;
}
.faq-item:hover { border-color: var(--border-h); }
.faq-item[open] { border-color: var(--border-h); background: var(--card-hover); }
.faq-item summary {
  cursor: pointer; padding: 14px 0; font-weight: 600; font-size: 14.5px; color: var(--text);
  list-style: none; display: flex; justify-content: space-between; align-items: center; gap: 14px;
}
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item summary::after { content: "+"; color: var(--text-faint); font-size: 19px; line-height: 1; transition: transform 0.2s; }
.faq-item[open] summary::after { transform: rotate(45deg); color: var(--accent); }
.faq-item p { margin: 0 0 16px; color: var(--text-dim); font-size: 13.5px; line-height: 1.65; max-width: 84ch; }
.faq-item summary:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 8px; }

/* ------------------------------------------------- static SEO directory */
.directory {
  max-width: var(--maxw); margin: 0 auto; padding: 14px 22px 6px;
  border-top: 1px solid var(--border);
}
.directory > h2 {
  font-size: 13px; font-weight: 650; text-transform: uppercase; letter-spacing: 0.07em;
  color: var(--text-faint); margin: 0 0 4px;
}
.directory > p { margin: 0 0 20px; font-size: 12.5px; color: var(--text-faint); }
.dir-section { margin-bottom: 22px; }
.dir-section h3 {
  font-size: 14px; font-weight: 650; margin: 0 0 11px; color: var(--text-dim);
  display: flex; align-items: center; gap: 8px;
}
.dir-section h3::before { content: ""; width: 3px; height: 13px; border-radius: 2px; background: var(--accent); }
.dir-links {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 4px 18px;
}
.dir-links a {
  font-size: 13px; color: var(--text-dim); text-decoration: none; padding: 3px 0;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.dir-links a:hover { color: var(--accent); }

/* ----------------------------------------------------------- tool pages */
.tool-wrap { max-width: 760px; margin: 0 auto; padding: 32px 22px 60px; }
.crumbs { font-size: 12.5px; color: var(--text-faint); margin-bottom: 18px; }
.crumbs a { color: var(--text-dim); text-decoration: none; }
.crumbs a:hover { color: var(--accent); }
.tool-head { display: flex; align-items: center; gap: 14px; margin-bottom: 4px; }
.tool-head .fav { width: 46px; height: 46px; flex-basis: 46px; border-radius: 12px; padding: 7px; }
.tool h1 { font-size: 26px; letter-spacing: -0.02em; margin: 0; }
.tool-sub { font-size: 13px; color: var(--text-faint); margin: 3px 0 0; }
.tool-lead { font-size: 16.5px; line-height: 1.6; color: var(--text); margin: 22px 0 22px; }
.tool-cta { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 8px; }
.tool-cta .note { font-size: 11.5px; color: var(--text-faint); }
.tool-shot { margin: 20px 0 6px; }
.tool-shot img { display: block; width: 100%; height: auto; border: 1px solid var(--border); border-radius: 14px; background: var(--card); }
.tool h2 { font-size: 15px; letter-spacing: -0.01em; margin: 30px 0 11px; }
.tool p { color: var(--text-dim); line-height: 1.7; margin: 0 0 12px; }
.tool ul.points { color: var(--text-dim); line-height: 1.7; padding-left: 20px; margin: 0; }
.facts { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 8px; }
.facts li { font-size: 13px; background: var(--card); border: 1px solid var(--border); border-radius: 10px; padding: 9px 12px; color: var(--text-dim); }
.facts b { color: var(--text); font-weight: 600; }
.related { display: flex; flex-wrap: wrap; gap: 8px; }
.related a {
  font-size: 13px; text-decoration: none; color: var(--text-dim);
  border: 1px solid var(--border); border-radius: 999px; padding: 6px 13px; transition: 0.15s;
}
.related a:hover { color: var(--accent); border-color: var(--border-h); }

/* ----------------------------------------------------------------- hero */
.hero {
  position: relative; max-width: var(--maxw); margin: 0 auto; padding: 36px 22px 4px;
  display: flex; align-items: center; justify-content: flex-start; gap: 40px;
}
.hero::before {
  content: ""; position: absolute; top: -8px; right: -8px; left: 0; height: 230px; z-index: 0; pointer-events: none;
  background: radial-gradient(58% 130% at 88% 0%, var(--accent-soft), transparent 62%);
}
.hero > * { position: relative; z-index: 1; }
.hero-text { flex: 0 1 auto; min-width: 0; max-width: 58ch; }
.hero h1 { font-size: 31px; line-height: 1.12; letter-spacing: -0.03em; margin: 0 0 12px; max-width: 19ch; }
.hero p { font-size: 15px; color: var(--text-dim); margin: 0 0 20px; max-width: 60ch; line-height: 1.55; }
.hero-cta { display: flex; gap: 11px; flex-wrap: wrap; }
.hero-cta .btn { padding: 13px 24px; font-size: 15px; border-radius: 12px; }
.hero-cta .btn.primary { box-shadow: 0 10px 24px -10px color-mix(in srgb, var(--accent) 75%, transparent); }
.hero-cta .btn.primary:hover { transform: translateY(-1px); }
.hero-cta .btn.ghost { border-color: var(--border-h); }
.btn-arr { transition: transform 0.16s; }
.hero-cta .btn.primary:hover .btn-arr { transform: translateX(3px); }
body.is-browsing .hero { display: none; }
#content { scroll-margin-top: 96px; }

/* hero side panel — pro-trader "terminal" overview */
.hero-aside { flex: 0 0 320px; }
.hero-panel {
  background: linear-gradient(180deg, var(--card), var(--bg-elev));
  border: 1px solid var(--border); border-radius: 16px; padding: 15px 16px 14px; box-shadow: var(--shadow);
}
.hp-top { display: flex; align-items: center; gap: 8px; font-size: 10.5px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--text-faint); }
.hp-label { margin-right: auto; }
.hp-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); animation: pulse 2.6s ease-out infinite; }
.hp-tick { color: var(--accent); letter-spacing: 0.03em; }
.hp-spark { display: block; width: 100%; height: 72px; margin: 12px 0 13px; }
.spk-line { fill: none; stroke: var(--accent); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; stroke-dasharray: 900; animation: draw 1.9s ease forwards 0.15s; }
.spk-area { fill: url(#spk); animation: fadein 1.1s ease both 0.9s; }
.hp-stats { display: flex; gap: 8px; }
.hp-stat { flex: 1; text-align: center; background: var(--bg-elev); border: 1px solid var(--border); border-radius: 10px; padding: 9px 6px; }
.hp-stat b { display: block; font-size: 20px; font-weight: 700; letter-spacing: -0.02em; color: var(--text); font-variant-numeric: tabular-nums; }
.hp-stat span { font-size: 10px; color: var(--text-faint); text-transform: uppercase; letter-spacing: 0.05em; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 var(--accent-soft); } 70% { box-shadow: 0 0 0 7px transparent; } 100% { box-shadow: 0 0 0 0 transparent; } }
@keyframes draw { from { stroke-dashoffset: 900; } to { stroke-dashoffset: 0; } }
@keyframes fadein { from { opacity: 0; } to { opacity: 1; } }
@media (max-width: 1080px) { .hero-aside { display: none; } }

/* ----------------------------------------------------------- newsletter */
.newsletter { max-width: var(--maxw); margin: 24px auto 0; padding: 8px 22px 30px; scroll-margin-top: 96px; }
.nl-inner {
  display: flex; align-items: center; gap: 24px; flex-wrap: wrap;
  background: var(--bg-elev); border: 1px solid var(--border); border-radius: 16px; padding: 24px 26px;
  background-image: radial-gradient(130% 150% at 100% 0%, var(--accent-soft), transparent 58%);
}
.nl-copy { flex: 1 1 280px; }
.nl-copy h2 { margin: 0 0 5px; font-size: 18px; letter-spacing: -0.01em; }
.nl-copy p { margin: 0; font-size: 13px; color: var(--text-dim); line-height: 1.5; }
.nl-form { display: flex; gap: 9px; flex: 1 1 320px; max-width: 440px; }
.nl-form input {
  flex: 1; min-width: 0; padding: 11px 14px; font: inherit; font-size: 14px;
  background: var(--card); border: 1px solid var(--border); border-radius: 11px; color: var(--text);
  outline: none; transition: 0.15s;
}
.nl-form input::placeholder { color: var(--text-faint); }
.nl-form input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.nl-form .btn { white-space: nowrap; }
.nl-success { margin: 0; font-weight: 600; color: var(--accent); }
.nl-note { margin: 11px 2px 0; font-size: 11.5px; color: var(--text-faint); }
.nl-err { color: var(--danger); }

@media (max-width: 720px) {
  .hero { padding-top: 26px; }
  .hero h1 { font-size: 24px; }
  /* Stack copy over form. Reset the flex-basis (1 1 320px / 280px) that was
     sized for a horizontal row — in a column it becomes a huge VERTICAL size,
     ballooning the input and button to ~300px tall. */
  .nl-inner { flex-direction: column; align-items: stretch; gap: 16px; }
  .nl-copy, .nl-form { flex: 0 0 auto; }
  .nl-form { max-width: none; }
}

/* ------------------------------------------------- courses: cards/grid */
.nav-learn { padding: 9px 14px; }
.learn-teaser { max-width: var(--maxw); margin: 26px auto 0; padding: 8px 22px 4px; border-top: 1px solid var(--border); }
.lt-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin: 18px 0 2px; }
.lt-head h2 { font-size: 19px; letter-spacing: -0.02em; margin: 0; display: flex; align-items: center; gap: 9px; }
.lt-head h2::before { content: ""; width: 4px; height: 17px; border-radius: 3px; background: var(--accent); }
.lt-all { font-size: 13px; color: var(--text-dim); text-decoration: none; white-space: nowrap; }
.lt-all:hover { color: var(--accent); }
.lt-sub { margin: 0 0 16px; font-size: 13px; color: var(--text-faint); }

.learn-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(270px, 1fr)); gap: 15px; }
.course-card {
  --cc: var(--accent);
  position: relative; display: flex; flex-direction: column; gap: 9px; padding: 18px 18px 15px;
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
  text-decoration: none; overflow: hidden;
  transition: transform 0.16s, border-color 0.16s, background 0.16s, box-shadow 0.16s;
}
.course-card::before {
  content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: var(--cc); opacity: 0.95;
}
.course-card:hover { transform: translateY(-3px); border-color: var(--border-h); background: var(--card-hover); box-shadow: var(--shadow); }
.course-card:focus-visible { outline: 2px solid var(--cc); outline-offset: 2px; }
.course-tool:focus-visible, .crumbs a:focus-visible, .related a:focus-visible, .lt-all:focus-visible,
.course-cta a:focus-visible, .tools-used a:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.cc-crypto { --cc: #f7931a; }
.cc-stocks { --cc: #3b82f6; }
.cc-macro  { --cc: #a855f7; }
.cc-general { --cc: #10b981; }
.cc-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.cc-tag {
  font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em;
  color: var(--cc); padding: 3px 8px; border-radius: 999px;
  background: color-mix(in srgb, var(--cc) 14%, transparent);
}
.cc-level {
  font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em;
  padding: 3px 8px; border-radius: 999px; white-space: nowrap;
}
.lvl-beginner     { color: #10b981; background: color-mix(in srgb, #10b981 16%, transparent); }
.lvl-intermediate { color: #f59e0b; background: color-mix(in srgb, #f59e0b 16%, transparent); }
.lvl-advanced     { color: #f0606a; background: color-mix(in srgb, #f0606a 16%, transparent); }
.cc-title { font-weight: 650; font-size: 16px; letter-spacing: -0.01em; color: var(--text); line-height: 1.25; }
.cc-desc { font-size: 12.8px; line-height: 1.5; color: var(--text-dim); display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.cc-foot {
  display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: auto; padding-top: 10px;
  border-top: 1px solid var(--border);
}
.cc-meta { display: flex; align-items: center; gap: 12px; font-size: 11.5px; color: var(--text-faint); }
.cc-m { display: inline-flex; align-items: center; gap: 5px; font-variant-numeric: tabular-nums; }
.cc-m .mi { opacity: 0.85; flex: 0 0 auto; }
.cc-go { font-size: 12.5px; font-weight: 600; color: var(--text-faint); transition: color 0.15s; display: inline-flex; align-items: center; gap: 4px; white-space: nowrap; }
.cc-arr { transition: transform 0.16s ease; }
.course-card:hover .cc-go { color: var(--cc); }
.course-card:hover .cc-arr { transform: translateX(3px); }

/* per-card completion track */
.cc-track { display: flex; align-items: center; gap: 9px; margin-top: 11px; }
.cc-bar { flex: 1 1 auto; height: 4px; border-radius: 999px; background: var(--border); overflow: hidden; }
.cc-bar > i { display: block; height: 100%; width: 0; border-radius: 999px; background: var(--cc); transition: width 0.45s ease; }
.cc-status { font-size: 10.5px; font-weight: 650; color: var(--text-faint); white-space: nowrap; display: inline-flex; align-items: center; gap: 4px; }
.course-card.is-progress .cc-status { color: var(--cc); }
.course-card.is-done .cc-status { color: var(--cc); }
.course-card.is-done .cc-status svg { color: var(--cc); }

/* ---------------------------------------------------- learn index page */
.learn-wrap { max-width: var(--maxw); margin: 0 auto; padding: 28px 22px 56px; }
.learn-hero { margin: 8px 0 30px; max-width: 760px; }
.learn-kicker {
  display: inline-block; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em;
  color: var(--accent); margin-bottom: 12px; padding: 4px 11px; border-radius: 999px; background: var(--accent-soft);
}
.learn-hero h1 { font-size: 34px; line-height: 1.1; letter-spacing: -0.03em; margin: 0 0 13px; }
.learn-intro { font-size: 15.5px; color: var(--text-dim); margin: 0 0 22px; line-height: 1.6; }
.learn-stats { display: flex; flex-wrap: wrap; gap: 10px 28px; }
.lstat { font-size: 13px; color: var(--text-dim); }
.lstat b { color: var(--text); font-weight: 700; font-size: 16px; margin-right: 3px; }

/* --------------------------------------------------------- course page */
.course-wrap { max-width: 1080px; margin: 0 auto; padding: 26px 22px 54px; }

.course-hero { margin: 4px 0 6px; }
.course-badges { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 15px; }
.badge {
  font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em;
  padding: 4px 11px; border-radius: 999px; color: var(--accent);
  background: var(--accent-soft);
}
.badge-crypto { color: #f7931a; background: color-mix(in srgb, #f7931a 15%, transparent); }
.badge-stocks { color: #3b82f6; background: color-mix(in srgb, #3b82f6 15%, transparent); }
.badge-macro  { color: #a855f7; background: color-mix(in srgb, #a855f7 15%, transparent); }
.meta-pill {
  font-size: 12px; font-weight: 550; color: var(--text-dim);
  padding: 4px 11px; border-radius: 999px; border: 1px solid var(--border); background: var(--bg-elev);
}
.course-hero h1 { font-size: 33px; line-height: 1.12; letter-spacing: -0.03em; margin: 0 0 13px; max-width: 22ch; }
.course-lead { font-size: 17px; line-height: 1.6; color: var(--text-read); margin: 0; max-width: 70ch; }

/* two-column reading layout with a sticky, scroll-spy table of contents */
.course-layout { display: grid; grid-template-columns: 224px minmax(0, 1fr); gap: 46px; align-items: start; margin-top: 30px; }
.course-side { position: sticky; top: 84px; }
.course-main { min-width: 0; max-width: 720px; }

.course-toc { background: var(--card); border: 1px solid var(--border); border-radius: 14px; padding: 15px 14px; }
.toc-label { display: block; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.07em; color: var(--text-faint); margin-bottom: 10px; padding: 0 7px; }
.course-toc ol { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 1px; }
.course-toc li { margin: 0; }
.course-toc a {
  display: flex; gap: 9px; align-items: center; font-size: 13px; line-height: 1.35;
  color: var(--text-dim); text-decoration: none; padding: 7px 9px; border-radius: 8px; transition: 0.14s;
}
.toc-i {
  flex: 0 0 18px; width: 18px; height: 18px; border-radius: 6px;
  background: var(--bg-elev); color: var(--text-faint);
  display: inline-flex; align-items: center; justify-content: center; font-size: 10.5px; font-weight: 700;
  transition: 0.14s;
}
.toc-text { flex: 1 1 auto; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.toc-check { flex: 0 0 auto; display: none; color: var(--accent); }
.course-toc a:hover { color: var(--text); background: var(--bg-elev); }
.course-toc a.active { color: var(--accent); background: var(--accent-soft); font-weight: 600; }
.course-toc a.active .toc-i { background: var(--accent); color: #04130d; }
.course-toc a.done .toc-i { background: color-mix(in srgb, var(--accent) 18%, transparent); color: var(--accent); }
.course-toc a.done .toc-check { display: inline-flex; }
.course-toc a.done.active .toc-i { background: var(--accent); color: #04130d; }
.course-toc a:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.lesson { margin: 0; }
.lesson-head { margin: 36px 0 14px; padding-top: 30px; border-top: 1px solid var(--border); }
.course-main .lesson:first-child .lesson-head { margin-top: 4px; padding-top: 0; border-top: none; }
.lesson-eyebrow { display: block; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.07em; color: var(--accent); margin-bottom: 7px; }
.lesson-title { font-size: 23px; letter-spacing: -0.02em; line-height: 1.2; margin: 0; scroll-margin-top: 88px; }

.course .lesson-h { font-size: 15.5px; font-weight: 650; margin: 24px 0 9px; }
.course p { color: var(--text-read); line-height: 1.75; margin: 0 0 15px; }
.course ul.points, .course ol.points { color: var(--text-read); line-height: 1.72; padding-left: 22px; margin: 0 0 15px; }
.course ul.points li, .course ol.points li { margin: 7px 0; }
.course code { background: var(--bg-elev); border: 1px solid var(--border); border-radius: 5px; padding: 1px 5px; font-size: 0.88em; }

/* callouts (tip / warning) with icon + label */
.callout {
  display: flex; gap: 12px; align-items: flex-start; margin: 0 0 18px; padding: 14px 16px;
  border: 1px solid var(--border); border-left: 3px solid var(--accent);
  background: var(--accent-soft); border-radius: 10px;
}
.callout-ico { flex: 0 0 auto; display: inline-flex; margin-top: 1px; color: var(--accent); }
.callout-body { min-width: 0; }
.callout-label { display: block; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; color: var(--accent); margin-bottom: 3px; }
.callout-body p { margin: 0; font-size: 13.8px; line-height: 1.6; color: var(--text-read); }
.callout-warn { border-left-color: #e0a44e; background: rgba(240, 176, 92, 0.1); }
.callout-warn .callout-ico, .callout-warn .callout-label { color: #e0a44e; }
.callout-key { border-left-color: #3b82f6; background: color-mix(in srgb, #3b82f6 9%, transparent); }
.callout-key .callout-ico, .callout-key .callout-label { color: #3b82f6; }

/* inline tool CTA inside a lesson */
.course-tool {
  position: relative; display: flex; align-items: center; gap: 14px; margin: 6px 0 20px; padding: 14px 16px;
  background: var(--card); border: 1px solid var(--border); border-radius: 12px; text-decoration: none;
  overflow: hidden; transition: 0.16s;
}
.course-tool::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--accent); opacity: 0.55; transition: 0.16s; }
.course-tool:hover { border-color: var(--border-h); background: var(--card-hover); transform: translateY(-1px); box-shadow: var(--shadow); }
.course-tool:hover::before { opacity: 1; }
.course-tool .fav { width: 40px; height: 40px; flex-basis: 40px; border-radius: 10px; padding: 6px; background: #ffffff; border: 1px solid var(--border); }
.ct-body { min-width: 0; flex: 1; display: flex; flex-direction: column; gap: 2px; }
.ct-eyebrow { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.07em; color: var(--text-faint); }
.ct-name { font-weight: 650; font-size: 14.5px; color: var(--text); display: flex; align-items: center; gap: 7px; }
.ct-desc { font-size: 12.6px; color: var(--text-dim); line-height: 1.45; }
.ct-go { font-size: 13px; font-weight: 650; color: var(--accent); white-space: nowrap; display: inline-flex; align-items: center; gap: 4px; }
.ct-arr { display: inline-block; transition: 0.16s; }
.course-tool:hover .ct-arr { transform: translate(2px, -2px); }

.tools-used { margin-top: 40px; padding-top: 26px; border-top: 1px solid var(--border); }
.tools-used h2, .course-next h2 { font-size: 16px; letter-spacing: -0.01em; margin: 0 0 14px; }
.course-next { margin-top: 36px; }

/* per-lesson prev/next nav (at the foot of each lesson) */
.lesson-nav { display: flex; gap: 12px; margin: 28px 0 4px; }
.lesson-nav a {
  flex: 1 1 0; min-width: 0; display: flex; flex-direction: column; gap: 2px;
  padding: 11px 14px; border: 1px solid var(--border); border-radius: 11px;
  text-decoration: none; background: var(--card); transition: 0.16s;
}
.lesson-nav a:hover { border-color: var(--border-h); background: var(--card-hover); transform: translateY(-1px); }
.lesson-nav .ln-next { text-align: right; align-items: flex-end; }
.ln-dir { font-size: 11.5px; font-weight: 650; color: var(--accent); }
.ln-name { font-size: 12.5px; color: var(--text-dim); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%; }
.lesson-nav .ln-spacer { flex: 1 1 0; border: none; background: transparent; pointer-events: none; }
.lesson-nav a:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* end-of-course: mark complete + next course */
.course-end { margin-top: 42px; padding-top: 28px; border-top: 1px solid var(--border); scroll-margin-top: 88px; }
.ce-bar { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin-bottom: 18px; }
.mark-complete { gap: 8px; }
.mark-complete .mc-ico { display: inline-flex; }
.mark-complete.is-complete { background: color-mix(in srgb, var(--accent) 16%, transparent); color: var(--accent); border-color: transparent; }
.mark-complete.is-complete:hover { filter: none; }
.ce-status { font-size: 13px; font-weight: 550; color: var(--text-dim); }

.next-course {
  --cc: var(--accent);
  position: relative; display: flex; flex-direction: column; gap: 5px; overflow: hidden;
  padding: 18px 20px; border: 1px solid var(--border); border-radius: 14px; text-decoration: none;
  background: linear-gradient(180deg, var(--card), var(--bg-elev)); transition: 0.18s;
}
.next-course::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: var(--cc); }
.next-course:hover { border-color: var(--border-h); transform: translateY(-2px); box-shadow: var(--shadow); }
.nc-label { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; color: var(--cc); }
.nc-title { font-size: 17px; font-weight: 650; letter-spacing: -0.01em; color: var(--text); line-height: 1.25; }
.nc-meta { font-size: 12.5px; color: var(--text-faint); }
.nc-go { margin-top: 6px; font-size: 13px; font-weight: 600; color: var(--text-dim); display: inline-flex; align-items: center; gap: 5px; }
.next-course:hover .nc-go { color: var(--cc); }
.next-course:hover .cc-arr { transform: translateX(3px); }
.next-course:focus-visible, .mark-complete:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.course-cta {
  width: min(1036px, calc(100% - 44px)); margin: 22px auto 0; padding: 24px 26px;
  display: flex; align-items: center; justify-content: space-between; gap: 18px; flex-wrap: wrap;
  background: var(--bg-elev); border: 1px solid var(--border); border-radius: 16px;
  background-image: radial-gradient(130% 150% at 100% 0%, var(--accent-soft), transparent 58%);
}
.cta-copy h2 { margin: 0 0 4px; font-size: 18px; letter-spacing: -0.01em; }
.cta-copy p { margin: 0; font-size: 13.5px; color: var(--text-dim); }

@media (max-width: 860px) {
  /* minmax(0,…) is essential: a bare 1fr expands to fit the no-wrap TOC chip
     bar (min-content), blowing the page width out to thousands of px. */
  .course-layout { grid-template-columns: minmax(0, 1fr); gap: 4px; }
  .course-main { max-width: none; }
  /* CONTENTS moves to the top as a sticky, horizontally-scrolling chip bar */
  .course-side { position: sticky; top: var(--header-h, 60px); z-index: 6; margin: 0 -22px 10px; }
  .course-toc {
    border-radius: 0; border-left: none; border-right: none; border-top: none;
    padding: 9px 22px; background: var(--bar-bg);
    -webkit-backdrop-filter: saturate(140%) blur(12px); backdrop-filter: saturate(140%) blur(12px);
  }
  .toc-label { display: none; }
  .course-toc ol { flex-direction: row; flex-wrap: nowrap; overflow-x: auto; gap: 6px; scrollbar-width: none; }
  .course-toc ol::-webkit-scrollbar { display: none; }
  .course-toc a { white-space: nowrap; border: 1px solid var(--border); border-radius: 999px; padding: 6px 11px; }
  .course-toc a.active { border-color: transparent; }
  .course-toc .toc-text { max-width: 34vw; }
}
@media (max-width: 720px) {
  .course-hero h1 { font-size: 26px; }
  .learn-hero h1 { font-size: 27px; }
  .lesson-nav { flex-direction: column; }
  .lesson-nav .ln-next { text-align: left; align-items: flex-start; }
  .course-cta { justify-content: stretch; }
  .site-link { padding: 6px 9px; }
}

/* ----------------------------------------------------- course figures */
.course-fig { margin: 20px 0 22px; }
.course-fig img { display: block; width: 100%; max-width: 100%; height: auto; border-radius: 14px; border: 1px solid var(--border); background: #14161c; }
.course-fig figcaption { margin-top: 9px; font-size: 12.3px; color: var(--text-faint); text-align: center; line-height: 1.45; }

/* ===================================================== mobile-friendliness */

/* iOS Safari zooms the page when focusing an input < 16px. Bump form inputs
   to 16px on small screens to keep the layout stable. */
@media (max-width: 720px) {
  .search input,
  .nl-form input,
  .modal-card input,
  .modal-card textarea,
  .modal-card select { font-size: 16px; }
}

/* Touch devices (no hover): the per-card "hide" (×) and "save" (★) buttons are
   hover-revealed on desktop — keep them visible here, and drop sticky-hover
   lift/scale that would otherwise stay stuck after a tap. */
@media (hover: none) {
  .card:hover { transform: none; background: var(--card); box-shadow: none; }
  .card:hover::before { width: 4px; opacity: 0.95; }
  .card:active { background: var(--card-hover); }
  .card-star, .card-x { opacity: 0.6; }
  .card-star.on { opacity: 1; }
}

/* Comfortable spacing and type on small phones. */
@media (max-width: 480px) {
  .bar { padding-left: 15px; padding-right: 15px; }
  .subbar { padding-left: 15px; padding-right: 15px; }
  .browse { padding-left: 15px; padding-right: 15px; }
  .hero { padding-left: 15px; padding-right: 15px; }
  .newsletter,
  .learn-teaser,
  .faq,
  .legal,
  .learn-wrap,
  .course-wrap,
  .tool-wrap { padding-left: 15px; padding-right: 15px; }

  .hero { padding-top: 26px; }
  .hero h1 { font-size: 25px; }
  .hero p { font-size: 14px; }
  .sec-title { font-size: 17px; }
  .brand-text small { display: none; }   /* reclaim topbar width */

  /* keep the course CONTENTS chip-bar flush with the narrower gutter */
  .course-side { margin-left: -15px; margin-right: -15px; }
  .course-toc { padding-left: 15px; padding-right: 15px; }
  .course-toc .toc-text { max-width: 46vw; }

  /* stack the Category / Group fields in the add-link modal */
  .modal-card .row { flex-direction: column; gap: 0; }

  /* keep the scrolling filter row flush with the narrower gutter */
  .filters { margin-left: -15px; margin-right: -15px; padding-left: 15px; padding-right: 15px; }
}
/* fade-in when scrolled into view (JS adds .reveal then .in; default visible for no-JS / reduced-motion) */
.course-fig.reveal { opacity: 0; transform: translateY(12px); }
.course-fig.reveal.in { opacity: 1; transform: none; transition: opacity 0.55s ease, transform 0.55s ease; }
