/* ══ MKCL AI CURRICULUM MAP — LIGHT THEME STYLES ═════════════
   Font: Plus Jakarta Sans (Google Fonts)
   Theme: Clean white & light-blue, high-contrast readable text
   ═══════════════════════════════════════════════════════════ */

:root {
  /* Backgrounds */
  --bg:        #F0F4FF;
  --surface:   #FFFFFF;
  --card:      #FFFFFF;
  --card-hov:  #F8FAFF;
  --border:    #E2E8F0;
  --border-md: #CBD5E1;

  /* Text */
  --t-primary:   #0F172A;
  --t-secondary: #334155;
  --t-muted:     #64748B;
  --t-accent:    #2563EB;

  /* Category colors */
  --text-c:   #2563EB;
  --audio-c:  #7C3AED;
  --video-c:  #059669;
  --image-c:  #EA580C;
  --anim-c:   #DB2777;
  --gfx-c:    #DC2626;

  /* Spacing & radius */
  --r-sm:  8px;
  --r-md: 12px;
  --r-lg: 18px;
  --r-xl: 24px;

  /* Shadows */
  --shadow-sm: 0 1px 3px rgba(15,23,42,0.06), 0 1px 2px rgba(15,23,42,0.04);
  --shadow-md: 0 4px 12px rgba(15,23,42,0.08), 0 2px 6px rgba(15,23,42,0.05);
  --shadow-lg: 0 12px 32px rgba(15,23,42,0.12), 0 4px 12px rgba(15,23,42,0.06);
}

/* ── RESET ───────────────────────────────────────────────── */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; font-size: 16px; }
body {
  font-family: 'Plus Jakarta Sans', system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--t-primary);
  min-height: 100vh;
  overflow-x: hidden;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

/* ── TOP NAV BAR ─────────────────────────────────────────── */
.top-nav {
  position: sticky; top: 0; z-index: 100;
  background: rgba(255,255,255,0.94);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  padding: 0 24px;
  display: flex; align-items: center; gap: 0;
  height: 56px;
}
.nav-brand {
  font-size: 15px; font-weight: 800; color: var(--t-accent);
  letter-spacing: -0.02em; margin-right: 24px; white-space: nowrap;
  text-decoration: none;
}
.nav-tabs { display: flex; gap: 2px; flex: 1; }
.tab-btn {
  padding: 8px 16px; border-radius: var(--r-sm);
  border: none; background: transparent;
  font-family: inherit; font-size: 13px; font-weight: 600;
  color: var(--t-muted); cursor: pointer; transition: all .18s;
  display: flex; align-items: center; gap: 6px; white-space: nowrap;
}
.tab-btn:hover { background: var(--bg); color: var(--t-secondary); }
.tab-btn.active {
  background: var(--bg); color: var(--t-accent);
  font-weight: 700;
  box-shadow: inset 0 -2px 0 var(--t-accent);
}
.nav-right { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.export-nav-btn {
  display: flex; align-items: center; gap: 6px;
  padding: 7px 14px; border-radius: var(--r-sm);
  background: #EFF6FF; border: 1.5px solid #BFDBFE;
  color: #1D4ED8; font-family: inherit; font-size: 13px; font-weight: 700;
  cursor: pointer; transition: all .18s;
}
.export-nav-btn:hover { background: #DBEAFE; }

/* ── TAB PANELS ──────────────────────────────────────────── */
.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* ── HERO (Home Tab) ─────────────────────────────────────── */
.hero {
  max-width: 1100px; margin: 0 auto; padding: 40px 24px;
}
.hero-top {
  display: grid; grid-template-columns: 1fr 1fr; gap: 40px;
  align-items: start; margin-bottom: 36px;
}
@media (max-width: 768px) {
  .hero-top { grid-template-columns: 1fr; }
}

.hero-text { }
.hero-badge {
  display: inline-flex; align-items: center; gap: 6px;
  background: #EFF6FF; border: 1.5px solid #BFDBFE;
  color: #1D4ED8; font-size: 11px; font-weight: 700;
  letter-spacing: 1.5px; text-transform: uppercase;
  padding: 5px 14px; border-radius: 999px; margin-bottom: 16px;
}
.hero-badge .blink {
  width: 6px; height: 6px; border-radius: 50%;
  background: #2563EB; animation: blink 2s ease-in-out infinite;
}
@keyframes blink { 0%,100%{opacity:1} 50%{opacity:.3} }

.hero h1 {
  font-size: clamp(1.7rem, 4vw, 2.8rem);
  font-weight: 800; letter-spacing: -0.025em;
  line-height: 1.1; color: var(--t-primary); margin-bottom: 12px;
}
.hero h1 .accent {
  background: linear-gradient(130deg, #2563EB, #7C3AED 55%, #DB2777);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text;
}
.hero-desc {
  font-size: 15px; font-weight: 400; color: var(--t-secondary);
  line-height: 1.7; margin-bottom: 20px; max-width: 480px;
}
.hero-stats {
  display: flex; gap: 24px; flex-wrap: wrap;
}
.hero-stat { }
.hs-num { font-size: 22px; font-weight: 800; color: var(--t-primary); display: block; }
.hs-lbl { font-size: 11px; font-weight: 600; color: var(--t-muted); text-transform: uppercase; letter-spacing: 1px; }

/* Curriculum map image */
.hero-map-img {
  border-radius: var(--r-lg); overflow: hidden;
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--border);
  cursor: zoom-in;
}
.hero-map-img img { width: 100%; height: auto; display: block; }

/* Intro video section */
.intro-video-section {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-xl); padding: 24px;
  box-shadow: var(--shadow-sm); margin-bottom: 32px;
}
.ivs-header {
  display: flex; align-items: center; gap: 12px;
  margin-bottom: 16px; flex-wrap: wrap;
}
.ivs-title {
  font-size: 15px; font-weight: 700; color: var(--t-primary); flex: 1;
}
.intro-lang-tabs { display: flex; gap: 6px; }
.intro-lang-btn {
  padding: 6px 14px; border-radius: 999px;
  border: 1.5px solid var(--border);
  background: var(--bg); color: var(--t-muted);
  font-family: inherit; font-size: 12px; font-weight: 700;
  cursor: pointer; transition: all .18s;
}
.intro-lang-btn:hover { border-color: var(--t-accent); color: var(--t-accent); }
.intro-lang-btn.active {
  background: #EFF6FF; border-color: #93C5FD;
  color: #1D4ED8;
}

/* ── CONVERSION MAP ──────────────────────────────────────── */
.map-section { max-width: 960px; margin: 0 auto; padding: 24px; }
.map-canvas-wrap {
  position: relative; background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--r-xl);
  padding: 20px; box-shadow: var(--shadow-sm);
  margin-bottom: 12px;
}
.map-canvas { position: relative; min-height: 500px; }
#svgLines {
  position: absolute; inset: 0; width: 100%; height: 100%;
  pointer-events: none; overflow: visible; z-index: 1;
}
.nodes-grid {
  position: relative; z-index: 3;
  display: grid;
  grid-template-areas:
    ".        text       .    audio     ."
    "graphics .          hub  .         video"
    ".        image      .    animation .";
  grid-template-columns: 1fr 1fr .4fr 1fr 1fr;
  grid-template-rows: 1fr .5fr 1fr;
  min-height: 500px;
  align-items: center; justify-items: center;
}
.hub-node {
  grid-area: hub; width: 52px; height: 52px; border-radius: 50%;
  background: var(--bg); border: 1.5px solid var(--border-md);
  display: flex; align-items: center; justify-content: center;
  font-size: 20px; box-shadow: var(--shadow-sm);
}
.cat-node {
  --c: #2563EB;
  width: 116px; height: 116px; border-radius: 50%;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 5px; cursor: pointer; z-index: 4;
  border: 2.5px solid var(--c);
  background: radial-gradient(circle at 38% 34%, rgba(255,255,255,.8) 0%, white 100%);
  box-shadow: var(--shadow-md);
  transition: transform .28s cubic-bezier(.34,1.56,.64,1), box-shadow .28s ease, opacity .2s;
  text-decoration: none; color: inherit; user-select: none;
}
.cat-node:hover {
  transform: scale(1.1);
  box-shadow: var(--shadow-lg), 0 0 0 4px color-mix(in srgb, var(--c) 15%, transparent);
}
.cat-node.selected {
  transform: scale(1.13);
  box-shadow: var(--shadow-lg), 0 0 0 5px color-mix(in srgb, var(--c) 20%, transparent), 0 0 32px color-mix(in srgb, var(--c) 25%, transparent);
  background: radial-gradient(circle at 38% 34%, color-mix(in srgb, var(--c) 10%, white) 0%, white 100%);
}
.cat-node.dimmed { opacity: .25; transform: scale(.92); pointer-events: none; }
.cat-node .n-emoji { font-size: 26px; line-height: 1; }
.cat-node .n-label {
  font-size: 10.5px; font-weight: 800; letter-spacing: 1px;
  text-transform: uppercase; color: var(--c);
}
.cat-node[data-cat=text]      { --c: var(--text-c);  grid-area: text; }
.cat-node[data-cat=audio]     { --c: var(--audio-c); grid-area: audio; }
.cat-node[data-cat=video]     { --c: var(--video-c); grid-area: video; }
.cat-node[data-cat=image]     { --c: var(--image-c); grid-area: image; }
.cat-node[data-cat=animation] { --c: var(--anim-c);  grid-area: animation; }
.cat-node[data-cat=graphics]  { --c: var(--gfx-c);   grid-area: graphics; }

.map-hint {
  text-align: center; font-size: 14px; font-weight: 500;
  color: var(--t-muted); padding: 10px 0 4px;
  animation: gentlepulse 3s ease-in-out infinite;
}
.map-hint strong { color: var(--t-secondary); }
@keyframes gentlepulse { 0%,100%{opacity:.6} 50%{opacity:1} }

/* Path result */
#pathResult { margin-top: 20px; }
.path-bar {
  display: flex; align-items: center; flex-wrap: wrap; gap: 10px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-lg); padding: 14px 18px; margin-bottom: 8px;
  box-shadow: var(--shadow-sm);
}
.path-pill {
  display: flex; align-items: center; gap: 8px;
  padding: 7px 14px; border-radius: var(--r-sm);
  border: 1px solid currentColor; font-size: 13px; font-weight: 700;
}
.path-arrow { font-size: 20px; color: var(--t-muted); flex: 1; text-align: center; }
.path-controls { display: flex; gap: 8px; margin-left: auto; }
.ctrl-btn {
  padding: 7px 14px; border-radius: var(--r-sm);
  border: 1.5px solid var(--border); background: var(--bg);
  color: var(--t-secondary); font-family: inherit;
  font-size: 12px; font-weight: 700; cursor: pointer; transition: all .18s;
}
.ctrl-btn:hover { background: var(--border); color: var(--t-primary); }
.ctrl-btn.danger { border-color: #FECACA; color: #DC2626; background: #FEF2F2; }
.ctrl-btn.danger:hover { background: #FEE2E2; }

/* ── BROWSE VIEW ─────────────────────────────────────────── */
.browse-section-wrap { max-width: 1200px; margin: 0 auto; padding: 20px 24px 60px; }

.browse-controls {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 24px;
}
.browse-search-wrap { position: relative; flex: 1; min-width: 200px; }
.browse-search {
  width: 100%; padding: 11px 16px 11px 42px;
  background: var(--surface); border: 1.5px solid var(--border);
  border-radius: 999px; font-family: inherit; font-size: 14px; font-weight: 500;
  color: var(--t-primary); outline: none; transition: all .18s;
}
.browse-search::placeholder { color: var(--t-muted); }
.browse-search:focus { border-color: #93C5FD; box-shadow: 0 0 0 3px #DBEAFE; }
.search-ico { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--t-muted); font-size: 16px; }

/* Format filter pills */
.filter-pills { display: flex; gap: 6px; flex-wrap: wrap; }
.filter-pill {
  padding: 6px 14px; border-radius: 999px; font-family: inherit;
  font-size: 12px; font-weight: 700; cursor: pointer;
  border: 1.5px solid var(--border); background: var(--surface);
  color: var(--t-muted); transition: all .18s; white-space: nowrap;
}
.filter-pill:hover { border-color: var(--border-md); color: var(--t-secondary); }
.filter-pill.active { color: white; border-color: transparent; }

.browse-section { margin-bottom: 40px; }
.browse-cat-head {
  display: flex; align-items: center; gap: 12px; margin-bottom: 16px;
}
.bch-icon {
  width: 38px; height: 38px; border-radius: 10px; font-size: 18px;
  display: flex; align-items: center; justify-content: center;
  border: 1.5px solid;
}
.bch-title { font-size: 18px; font-weight: 800; letter-spacing: -0.01em; }
.bch-line { flex: 1; height: 1px; opacity: .35; }
.bch-count {
  font-size: 12px; font-weight: 700; color: var(--t-muted);
  background: var(--bg); padding: 3px 10px; border-radius: 999px;
  border: 1px solid var(--border);
}

/* ── TOOL CARD ───────────────────────────────────────────── */
.tools-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 14px;
}
.tool-card {
  --cat-color: #2563EB;
  background: var(--surface); border: 1.5px solid var(--border);
  border-radius: var(--r-md); padding: 16px 16px 12px;
  display: flex; flex-direction: column; gap: 10px;
  box-shadow: var(--shadow-sm);
  transition: all .22s cubic-bezier(.34,1.56,.64,1);
  position: relative; overflow: hidden;
  animation: fadeUp .3s ease both;
}
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}
.tool-card::before {
  content: ''; position: absolute; top: 0; left: 0; right: 0; height: 3px;
  background: var(--cat-color); opacity: 0; transition: opacity .2s;
}
.tool-card:hover {
  border-color: var(--border-md);
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}
.tool-card:hover::before { opacity: 1; }

.tc-header { display: flex; align-items: flex-start; gap: 10px; }
.tc-emoji { font-size: 26px; line-height: 1; flex-shrink: 0; }
.tc-info { flex: 1; min-width: 0; }
.tc-name { font-size: 14px; font-weight: 800; color: var(--t-primary); line-height: 1.25; margin-bottom: 3px; }
.tc-desc { font-size: 12px; font-weight: 400; color: var(--t-secondary); line-height: 1.55; }

.tc-tags { display: flex; flex-wrap: wrap; gap: 5px; }
.tool-tag {
  font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .4px;
  padding: 3px 8px; border-radius: 5px;
  background: var(--bg); color: var(--t-muted); border: 1px solid var(--border);
}
.tool-tag.tag-bidir { background: #EFF6FF; color: #1D4ED8; border-color: #BFDBFE; }
.tool-tag.tag-fwd   { background: #F5F3FF; color: #6D28D9; border-color: #DDD6FE; }
.tool-tag.tag-special { background: #FFFBEB; color: #92400E; border-color: #FDE68A; }

.tc-actions { display: flex; gap: 8px; }
.btn-watch {
  flex: 1; display: flex; align-items: center; justify-content: center; gap: 6px;
  padding: 8px 10px; border-radius: var(--r-sm);
  background: var(--bg); border: 1.5px solid var(--border);
  color: var(--t-secondary); font-family: inherit; font-size: 12px; font-weight: 700;
  cursor: pointer; transition: all .18s;
}
.btn-watch:hover { border-color: #93C5FD; color: #1D4ED8; background: #EFF6FF; }
.btn-watch.has-video { border-color: #A7F3D0; color: #065F46; background: #ECFDF5; }
.btn-watch.has-video:hover { background: #D1FAE5; border-color: #6EE7B7; }
.vid-avail { font-size: 9px; color: #10B981; }

.btn-site {
  flex: 1; display: flex; align-items: center; justify-content: center; gap: 5px;
  padding: 8px 10px; border-radius: var(--r-sm);
  background: var(--bg); border: 1.5px solid var(--border);
  color: var(--t-secondary); font-family: inherit; font-size: 12px; font-weight: 700;
  cursor: pointer; transition: all .18s; text-decoration: none;
}
.btn-site:hover { background: #EFF6FF; border-color: #93C5FD; color: #1D4ED8; }

/* ── INLINE VIDEO PANEL ──────────────────────────────────── */
.inline-video-panel {
  border-top: 1px solid var(--border); padding-top: 12px;
  animation: slideDown .25s ease;
}
@keyframes slideDown {
  from { opacity: 0; transform: translateY(-8px); }
  to   { opacity: 1; transform: translateY(0); }
}

.iv-lang-tabs { display: flex; gap: 5px; margin-bottom: 10px; }
.iv-lang-btn {
  flex: 1; display: flex; align-items: center; justify-content: center; gap: 5px;
  position: relative; padding: 7px 6px; border-radius: var(--r-sm);
  border: 1.5px solid var(--border); background: var(--bg);
  font-family: inherit; font-size: 11px; font-weight: 700; color: var(--t-muted);
  cursor: pointer; transition: all .15s; white-space: nowrap;
}
.iv-lang-btn:hover { border-color: var(--border-md); color: var(--t-secondary); }
.iv-lang-btn.active { background: #EFF6FF; border-color: #93C5FD; color: #1D4ED8; }

.has-vid-dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: #10B981; display: inline-block; flex-shrink: 0;
}

.iv-video-wrap {
  position: relative; width: 100%; padding-top: 56.25%;
  background: var(--bg); border-radius: var(--r-md);
  border: 1px solid var(--border); overflow: hidden; margin-bottom: 10px;
}
.iv-video-wrap iframe, .iv-video-wrap video {
  position: absolute; inset: 0; width: 100%; height: 100%; border: none;
}
.iv-video-wrap .video-badge {
  position: absolute; bottom: 8px; right: 8px;
  background: rgba(15,23,42,.65); color: white;
  font-size: 10px; font-weight: 700; padding: 3px 8px;
  border-radius: 999px; letter-spacing: .5px;
}

/* The chart-specific video wrap needs height, not padding-top */
.chart-video {
  padding-top: 0 !important;
  height: 200px;
}

/* Empty video state */
.video-empty {
  position: absolute; inset: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 8px; padding: 16px; text-align: center;
}
.ve-icon { font-size: 36px; opacity: .25; }
.ve-text { font-size: 13px; font-weight: 700; color: var(--t-secondary); }
.ve-sub  { font-size: 11px; color: var(--t-muted); line-height: 1.5; max-width: 200px; }
.ve-open-btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 16px; border-radius: var(--r-sm);
  background: #EFF6FF; border: 1.5px solid #93C5FD;
  color: #1D4ED8; font-size: 12px; font-weight: 700;
  text-decoration: none; margin-top: 4px; transition: all .18s;
}
.ve-open-btn:hover { background: #DBEAFE; }

/* Add URL panel */
.add-url-panel {
  background: var(--bg); border: 1px solid var(--border);
  border-radius: var(--r-sm); padding: 12px; margin-bottom: 10px;
}
.aup-label {
  font-size: 11px; font-weight: 700; color: var(--t-secondary);
  text-transform: uppercase; letter-spacing: .5px; margin-bottom: 6px;
}
.aup-row { display: flex; gap: 6px; }
.aup-input {
  flex: 1; padding: 8px 12px; border-radius: var(--r-sm);
  border: 1.5px solid var(--border); background: var(--surface);
  font-family: inherit; font-size: 12px; color: var(--t-primary);
  outline: none; transition: all .18s; min-width: 0;
}
.aup-input::placeholder { color: var(--t-muted); }
.aup-input:focus { border-color: #93C5FD; box-shadow: 0 0 0 3px #DBEAFE; }
.aup-save-btn {
  padding: 8px 12px; border-radius: var(--r-sm);
  background: #EFF6FF; border: 1.5px solid #93C5FD;
  color: #1D4ED8; font-family: inherit; font-size: 12px; font-weight: 700;
  cursor: pointer; transition: all .15s; white-space: nowrap;
}
.aup-save-btn:hover { background: #DBEAFE; }
.aup-feedback { font-size: 11px; color: #059669; margin-top: 5px; height: 14px; font-weight: 600; }

.iv-actions { }
.iv-goto-btn {
  display: block; text-align: center; padding: 10px 16px;
  border-radius: var(--r-sm);
  background: linear-gradient(135deg, #1E40AF, #2563EB);
  color: white; font-family: inherit; font-size: 13px; font-weight: 700;
  text-decoration: none; transition: all .18s;
}
.iv-goto-btn:hover { background: linear-gradient(135deg, #1E3A8A, #1D4ED8); transform: translateY(-1px); box-shadow: var(--shadow-md); }

/* ── INTERACTIVE CHART ───────────────────────────────────── */
.chart-section { max-width: 1200px; margin: 0 auto; padding: 20px 24px 60px; }
.chart-header { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.chart-title { font-size: 20px; font-weight: 800; color: var(--t-primary); }
.chart-subtitle { font-size: 13px; color: var(--t-muted); }
.chart-filters { display: flex; gap: 6px; flex-wrap: wrap; margin-left: auto; }

.chart-layout { display: grid; grid-template-columns: 1fr 320px; gap: 20px; }
@media (max-width: 900px) { .chart-layout { grid-template-columns: 1fr; } }

#chartCanvas {
  width: 100%; height: 560px; display: block;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-xl); cursor: default; box-shadow: var(--shadow-sm);
}

#chartInfo {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-xl); padding: 20px;
  box-shadow: var(--shadow-sm); height: fit-content; position: sticky; top: 72px;
}

.ci-empty {
  text-align: center; padding: 40px 20px; color: var(--t-muted);
  font-size: 14px; font-weight: 500;
}
.ci-empty-icon { font-size: 48px; opacity: .2; margin-bottom: 12px; }
.ci-header {
  display: flex; align-items: flex-start; gap: 12px;
  padding-bottom: 12px; border-bottom: 1px solid; margin-bottom: 12px;
}
.ci-emoji { font-size: 32px; line-height: 1; }
.ci-name { font-size: 17px; font-weight: 800; color: var(--t-primary); margin-bottom: 2px; }
.ci-cat  { font-size: 12px; font-weight: 700; }
.ci-desc { font-size: 13px; color: var(--t-secondary); line-height: 1.6; margin-bottom: 12px; }
.ci-tags { display: flex; flex-wrap: wrap; gap: 5px; margin-bottom: 14px; }
.ci-lang-tabs { display: flex; gap: 5px; margin-bottom: 10px; }
.ci-footer { margin-top: 14px; }

/* ── ANALYTICS ───────────────────────────────────────────── */
.analytics-section { max-width: 1000px; margin: 0 auto; padding: 24px; }
.stats-header { display: flex; align-items: flex-start; gap: 12px; margin-bottom: 24px; flex-wrap: wrap; }
.stats-title { font-size: 22px; font-weight: 800; color: var(--t-primary); margin-bottom: 4px; }
.stats-sub { font-size: 13px; color: var(--t-muted); line-height: 1.6; flex: 1; }
.stats-clear-btn {
  padding: 7px 14px; border-radius: var(--r-sm);
  border: 1.5px solid #FECACA; background: #FEF2F2;
  color: #DC2626; font-family: inherit; font-size: 12px; font-weight: 700;
  cursor: pointer; transition: all .15s; white-space: nowrap;
}
.stats-clear-btn:hover { background: #FEE2E2; }

.stats-kpi-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 28px; }
@media (max-width: 640px) { .stats-kpi-row { grid-template-columns: 1fr 1fr; } }
.stats-kpi {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-md); padding: 20px 16px; text-align: center;
  box-shadow: var(--shadow-sm);
}
.kpi-num { display: block; font-size: 28px; font-weight: 800; color: var(--t-accent); letter-spacing: -0.03em; }
.kpi-label { display: block; font-size: 11px; font-weight: 600; color: var(--t-muted); text-transform: uppercase; letter-spacing: 1px; margin-top: 4px; }

.stats-section-title {
  font-size: 14px; font-weight: 700; color: var(--t-primary);
  margin-bottom: 14px; display: flex; align-items: center; gap: 8px;
}
.stats-section-title::after { content: ''; flex: 1; height: 1px; background: var(--border); }

.stats-bar-chart {
  display: flex; align-items: flex-end; gap: 6px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-md); padding: 16px;
  margin-bottom: 28px; overflow-x: auto; min-height: 120px;
  box-shadow: var(--shadow-sm);
}
.chart-col { display: flex; flex-direction: column; align-items: center; gap: 4px; min-width: 40px; }
.chart-bar-wrap { height: 80px; display: flex; align-items: flex-end; }
.chart-bar {
  width: 28px; background: linear-gradient(180deg, #2563EB, #3B82F6);
  border-radius: 5px 5px 2px 2px; min-height: 4px; transition: height .4s ease;
}
.chart-label { font-size: 10px; font-weight: 600; color: var(--t-muted); }
.chart-count { font-size: 11px; font-weight: 700; color: var(--t-primary); }

.stats-2col { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
@media (max-width: 640px) { .stats-2col { grid-template-columns: 1fr; } }
.stats-list {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-md); overflow: hidden; box-shadow: var(--shadow-sm);
}
.stats-row {
  display: flex; align-items: center; gap: 10px; padding: 10px 14px;
  border-bottom: 1px solid var(--border); font-size: 13px;
}
.stats-row:last-child { border-bottom: none; }
.stats-rank { font-size: 11px; font-weight: 800; color: var(--t-muted); width: 18px; }
.stats-name { flex: 1; font-weight: 600; color: var(--t-primary); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.stats-pill {
  font-size: 10px; font-weight: 700; padding: 3px 8px; border-radius: 5px;
  background: #F1F5F9; color: var(--t-muted); white-space: nowrap;
}
.stats-pill.alt { background: #ECFDF5; color: #065F46; }
.stats-empty { padding: 24px; text-align: center; color: var(--t-muted); font-size: 13px; }

/* ── EXPORT MODAL ────────────────────────────────────────── */
.modal-overlay {
  position: fixed; inset: 0; z-index: 1000;
  background: rgba(15,23,42,.55); backdrop-filter: blur(8px);
  display: flex; align-items: center; justify-content: center; padding: 24px;
  opacity: 0; pointer-events: none; transition: opacity .25s;
}
.modal-overlay.open { opacity: 1; pointer-events: all; }
.modal-box {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-xl); width: 100%; max-width: 560px;
  max-height: 90vh; overflow-y: auto;
  box-shadow: var(--shadow-lg);
  transform: scale(.94) translateY(12px); transition: transform .28s cubic-bezier(.34,1.56,.64,1);
  padding: 28px;
}
.modal-overlay.open .modal-box { transform: scale(1) translateY(0); }
.modal-title { font-size: 20px; font-weight: 800; color: var(--t-primary); margin-bottom: 6px; }
.modal-sub { font-size: 13px; color: var(--t-secondary); line-height: 1.7; margin-bottom: 22px; }

.export-steps { display: flex; flex-direction: column; gap: 12px; margin-bottom: 22px; }
.export-step {
  background: var(--bg); border: 1px solid var(--border);
  border-radius: var(--r-md); padding: 14px;
}
.es-num {
  display: inline-flex; align-items: center; justify-content: center;
  width: 22px; height: 22px; border-radius: 50%;
  font-size: 11px; font-weight: 800; margin-bottom: 6px;
}
.es-title { font-size: 14px; font-weight: 700; color: var(--t-primary); margin-bottom: 4px; }
.es-desc { font-size: 12px; color: var(--t-secondary); line-height: 1.65; }
.es-desc a { color: var(--t-accent); text-decoration: none; }
.es-desc a:hover { text-decoration: underline; }
.es-desc code {
  background: #E2E8F0; padding: 2px 6px; border-radius: 4px;
  font-family: monospace; font-size: 11px; color: var(--t-primary);
}

.export-dl-btn {
  width: 100%; display: flex; align-items: center; justify-content: center; gap: 8px;
  padding: 14px; border-radius: var(--r-sm);
  background: linear-gradient(135deg, #1E40AF, #2563EB);
  border: none; color: white; font-family: inherit; font-size: 15px; font-weight: 800;
  cursor: pointer; transition: all .18s; margin-bottom: 10px;
}
.export-dl-btn:hover { background: linear-gradient(135deg, #1E3A8A, #1D4ED8); transform: translateY(-1px); box-shadow: var(--shadow-md); }
.export-close-btn {
  width: 100%; padding: 11px; border-radius: var(--r-sm);
  border: 1.5px solid var(--border); background: var(--bg);
  color: var(--t-muted); font-family: inherit; font-size: 13px; font-weight: 600;
  cursor: pointer; transition: all .15s;
}
.export-close-btn:hover { background: var(--border); color: var(--t-secondary); }

/* ── SHARED COMPONENTS ───────────────────────────────────── */
.section-label {
  font-size: 12px; font-weight: 700; color: var(--t-muted);
  text-transform: uppercase; letter-spacing: 1.2px;
  display: flex; align-items: center; gap: 10px; margin: 18px 0 12px;
}
.section-label::after { content: ''; flex: 1; height: 1px; background: var(--border); }

.tip-text {
  font-size: 12px; color: var(--t-muted); text-align: center;
  margin-top: 14px; font-style: italic; line-height: 1.5;
}
.tip-text strong { color: var(--t-secondary); font-style: normal; }

.empty-state {
  text-align: center; padding: 60px 24px;
  font-size: 15px; font-weight: 500; color: var(--t-muted);
}

/* ── IMAGE LIGHTBOX ──────────────────────────────────────── */
.lightbox-overlay {
  position: fixed; inset: 0; z-index: 2000;
  background: rgba(15,23,42,.88); backdrop-filter: blur(8px);
  display: flex; align-items: center; justify-content: center; padding: 24px;
  cursor: zoom-out;
}
.lightbox-overlay img { max-width: 100%; max-height: 90vh; border-radius: var(--r-lg); box-shadow: var(--shadow-lg); }

/* ── RESPONSIVE ──────────────────────────────────────────── */
@media (max-width: 640px) {
  .cat-node { width: 84px; height: 84px; }
  .cat-node .n-emoji { font-size: 20px; }
  .cat-node .n-label { font-size: 9px; }
  .nodes-grid { min-height: 380px; }
  .tools-grid { grid-template-columns: 1fr; }
  .top-nav { gap: 0; padding: 0 12px; height: 50px; }
  .tab-btn { padding: 6px 10px; font-size: 11px; }
  .nav-brand { font-size: 13px; margin-right: 8px; }
  .chart-layout { grid-template-columns: 1fr; }
  #chartCanvas { height: 400px; }
}

/* ── FOOTER ──────────────────────────────────────────────── */
footer {
  text-align: center; padding: 24px;
  color: var(--t-muted); font-size: 12px; font-weight: 500;
  border-top: 1px solid var(--border); margin-top: 20px;
}
footer strong { color: var(--t-secondary); }

/* ── STUDENT VIEW EXTRAS ──────────────────────────────────── */
/* Disabled "Tutorial Coming Soon" button for tools without videos */
.btn-watch.no-video {
  background: #F1F5F9; color: #94A3B8;
  border: 1.5px dashed #CBD5E1; cursor: not-allowed;
  opacity: .8; font-size: 12px;
}
.btn-watch.no-video:hover { background: #F1F5F9; color: #94A3B8; }

/* ════════════════════════════════════════════════════════════════
   DARK MODE — CSS custom-property overrides
   Applied when <html data-theme="dark">
   ════════════════════════════════════════════════════════════════ */
[data-theme="dark"] {
  --bg:        #0D1117;
  --surface:   #161B22;
  --card:      #1C2333;
  --card-hov:  #22304A;
  --border:    #30363D;
  --border-md: #4A5568;

  --t-primary:   #E6EDF3;
  --t-secondary: #C9D1D9;
  --t-muted:     #8B949E;
  --t-accent:    #58A6FF;

  /* Softer category colours for dark bg (better contrast) */
  --text-c:   #60A5FA;
  --audio-c:  #A78BFA;
  --video-c:  #34D399;
  --image-c:  #FB923C;
  --anim-c:   #F472B6;
  --gfx-c:    #F87171;

  --shadow-sm: 0 1px 3px rgba(0,0,0,.3), 0 1px 2px rgba(0,0,0,.2);
  --shadow-md: 0 4px 12px rgba(0,0,0,.4), 0 2px 6px rgba(0,0,0,.25);
  --shadow-lg: 0 12px 32px rgba(0,0,0,.5), 0 4px 12px rgba(0,0,0,.3);
}

/* Nav in dark mode */
[data-theme="dark"] .top-nav { background: rgba(22,27,34,.96); }

/* Cat nodes in dark mode */
[data-theme="dark"] .cat-node {
  background: radial-gradient(circle at 38% 34%, rgba(255,255,255,.06) 0%, rgba(255,255,255,.02) 100%);
}
[data-theme="dark"] .cat-node:hover,
[data-theme="dark"] .cat-node.selected {
  background: radial-gradient(circle at 38% 34%, color-mix(in srgb, var(--c) 18%, #1C2333) 0%, #1C2333 100%);
}
[data-theme="dark"] .btn-watch.has-video { background: #052e16; border-color: #166534; color: #4ade80; }
[data-theme="dark"] .btn-watch.has-video:hover { background: #166534; }
[data-theme="dark"] .btn-watch:hover { background: #1a2e4a; border-color: #2563EB55; color: #60a5fa; }
[data-theme="dark"] .btn-site:hover  { background: #1a2e4a; border-color: #2563EB55; color: #60a5fa; }
[data-theme="dark"] .hero-badge { background: #1a2e4a; border-color: #2563EB44; color: #60a5fa; }
[data-theme="dark"] .tool-tag.tag-bidir { background: #1a2e4a; color: #60a5fa; border-color: #2563EB44; }
[data-theme="dark"] .tool-tag.tag-fwd   { background: #2e1065; color: #a78bfa; border-color: #7c3aed44; }
[data-theme="dark"] .tool-tag.tag-special { background: #3b1500; color: #fb923c; border-color: #ea580c44; }
[data-theme="dark"] .intro-lang-btn.active { background: #1a2e4a; border-color: #2563EB66; color: #60a5fa; }
[data-theme="dark"] .iv-lang-btn.active    { background: #1a2e4a; border-color: #2563EB66; color: #60a5fa; }
[data-theme="dark"] .filter-pill.active    { color: #0F172A; }
[data-theme="dark"] .ctrl-btn.danger { background: #450a0a; border-color: #991b1b; color: #f87171; }
[data-theme="dark"] .stats-pill     { background: #1C2333; color: #94a3b8; }
[data-theme="dark"] .stats-pill.alt { background: #052e16; color: #4ade80; }
[data-theme="dark"] .browse-search  { background: var(--card); border-color: var(--border); color: var(--t-primary); }
[data-theme="dark"] .browse-search:focus { border-color: #58A6FF; box-shadow: 0 0 0 3px #1d4ed855; }
[data-theme="dark"] .iv-goto-btn { background: linear-gradient(135deg, #1d4ed8, #3b82f6); }
[data-theme="dark"] .quick-card { border-color: var(--border); background: var(--card); }
[data-theme="dark"] .quick-card:hover { background: var(--card-hov); border-color: var(--border-md); }
[data-theme="dark"] .aup-input { background: var(--card); border-color: var(--border); color: var(--t-primary); }
[data-theme="dark"] #chartCanvas { background: var(--surface); border-color: var(--border); }
[data-theme="dark"] .has-vid-dot { background: #4ade80; }
[data-theme="dark"] .vid-avail { color: #4ade80; }

/* ════════════════════════════════════════════════════════════════
   FONT SIZE SCALING
   [data-fontsize="base"] = default (16px root)
   [data-fontsize="large"] = 18px root (+12.5%)
   [data-fontsize="xl"]    = 20px root (+25%)
   ════════════════════════════════════════════════════════════════ */
[data-fontsize="large"] { font-size: 18px; }
[data-fontsize="xl"]    { font-size: 20px; }

/* ════════════════════════════════════════════════════════════════
   REDUCED MOTION
   Respects OS preference AND manual toggle
   ════════════════════════════════════════════════════════════════ */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
    scroll-behavior: auto !important;
  }
}
/* Manual reduce via data-motion="reduce" */
[data-motion="reduce"] *, [data-motion="reduce"] *::before, [data-motion="reduce"] *::after {
  animation-duration: .01ms !important;
  animation-iteration-count: 1 !important;
  transition-duration: .01ms !important;
}

/* ════════════════════════════════════════════════════════════════
   HIGH CONTRAST MODE
   Respects OS forced-colors (Windows High Contrast / WCAG 1.4.11)
   ════════════════════════════════════════════════════════════════ */
@media (forced-colors: active) {
  .cat-node, .tool-card, .btn-watch, .btn-site, .filter-pill {
    forced-color-adjust: none;
    border: 2px solid ButtonText;
  }
  .hero h1 .accent { -webkit-text-fill-color: unset; color: Highlight; }
}

/* ════════════════════════════════════════════════════════════════
   SKIP NAVIGATION LINK (WCAG 2.4.1)
   Visually hidden until focused by keyboard
   ════════════════════════════════════════════════════════════════ */
.skip-link {
  position: fixed; top: -100px; left: 16px; z-index: 9999;
  background: var(--t-accent); color: #fff;
  padding: 10px 20px; border-radius: 0 0 8px 8px;
  font-size: 14px; font-weight: 700; text-decoration: none;
  transition: top .15s; box-shadow: var(--shadow-md);
}
.skip-link:focus { top: 0; outline: 3px solid #fff; outline-offset: 2px; }

/* ════════════════════════════════════════════════════════════════
   FOCUS STYLES — WCAG 2.4.7 + 2.4.11
   Consistent 2px ring on all interactive elements for keyboard users
   Uses :focus-visible so mouse users don't see the ring
   ════════════════════════════════════════════════════════════════ */
:focus { outline: none; }

:focus-visible {
  outline: 2.5px solid var(--t-accent);
  outline-offset: 2px;
  border-radius: 4px;
}

/* Larger ring for major interactive targets */
.tab-btn:focus-visible,
.cat-node:focus-visible,
.btn-watch:focus-visible,
.btn-site:focus-visible,
.filter-pill:focus-visible,
.intro-lang-btn:focus-visible,
.iv-lang-btn:focus-visible,
.quick-card:focus-visible,
.iv-goto-btn:focus-visible,
.ctrl-btn:focus-visible,
.theme-toggle-btn:focus-visible {
  outline: 3px solid var(--t-accent);
  outline-offset: 3px;
  border-radius: var(--r-sm);
}

/* Inputs already have border-based focus rings — add ring too */
.browse-search:focus-visible {
  outline: 2.5px solid var(--t-accent);
  outline-offset: 1px;
}

/* ════════════════════════════════════════════════════════════════
   TOUCH TARGETS — WCAG 2.5.5 (min 44×44px)
   ════════════════════════════════════════════════════════════════ */
.tab-btn      { min-height: 44px; min-width: 44px; }
.theme-toggle-btn { min-width: 44px; min-height: 44px; }
.filter-pill  { min-height: 36px; }      /* Allow slightly smaller on non-touch */
.intro-lang-btn { min-height: 36px; }
.iv-lang-btn    { min-height: 36px; }

/* On actual touch devices, enforce 44px */
@media (pointer: coarse) {
  .filter-pill, .intro-lang-btn, .iv-lang-btn, .ctrl-btn { min-height: 44px; }
  .btn-watch, .btn-site { min-height: 44px; padding: 10px; }
}

/* ════════════════════════════════════════════════════════════════
   SCREEN-READER ONLY UTILITY (visually hidden but accessible)
   ════════════════════════════════════════════════════════════════ */
.sr-only {
  position: absolute; width: 1px; height: 1px;
  padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0,0,0,0); white-space: nowrap; border: 0;
}

/* ════════════════════════════════════════════════════════════════
   ACCESSIBILITY TOOLBAR (theme + font size + motion controls)
   ════════════════════════════════════════════════════════════════ */
.a11y-toolbar {
  display: flex; align-items: center; gap: 2px; margin-left: auto;
}
.theme-toggle-btn {
  display: flex; align-items: center; justify-content: center;
  width: 36px; height: 36px; border-radius: var(--r-sm);
  border: 1.5px solid var(--border); background: transparent;
  color: var(--t-secondary); font-size: 16px; cursor: pointer;
  transition: background .15s, border-color .15s; font-family: inherit;
}
.theme-toggle-btn:hover { background: var(--bg); border-color: var(--border-md); }

/* ════════════════════════════════════════════════════════════════
   ARIA LIVE REGION — invisible announcement area
   ════════════════════════════════════════════════════════════════ */
#a11y-announce {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0,0,0,0); white-space: nowrap; pointer-events: none;
}

/* ════════════════════════════════════════════════════════════════
   WCAG CONTRAST FIXES (replacing failing colours)
   ════════════════════════════════════════════════════════════════ */
/* Fix: #10B981 on #ECFDF5 was 2.41:1 → use darker green text */
.btn-watch.has-video { color: #065F46 !important; }   /* 5.6:1 on #ECFDF5 ✅ */
.has-vid-dot         { background: #059669; }          /* improved visibility */
.vid-avail           { color: #059669; }

/* Fix: very light text in stats pills */
.stats-pill { color: #475569; }                        /* 5.0:1 on #F1F5F9 ✅ */

/* ════════════════════════════════════════════════════════════════
   KEYBOARD NAVIGATION — Map nodes (focusable as buttons)
   ════════════════════════════════════════════════════════════════ */
.cat-node {
  /* Already has href="#" so is focusable; add role via HTML */
  transition: transform .28s cubic-bezier(.34,1.56,.64,1),
              box-shadow .28s ease, opacity .2s, outline .1s;
}

/* Canvas fallback table (accessible alternative) */
.chart-fallback-table {
  width: 100%; border-collapse: collapse; font-size: 13px;
  background: var(--surface); border-radius: var(--r-md); overflow: hidden;
}
.chart-fallback-table th {
  background: var(--bg); padding: 10px 12px; text-align: left;
  font-size: 11px; font-weight: 800; color: var(--t-muted);
  text-transform: uppercase; letter-spacing: .5px;
  border-bottom: 1px solid var(--border);
}
.chart-fallback-table td { padding: 9px 12px; border-bottom: 1px solid var(--border); }
.chart-fallback-table tr:last-child td { border-bottom: none; }
.chart-fallback-table tr:hover td { background: var(--card-hov); }

/* Show/hide chart vs table */
#chartCanvas { display: block; }
.chart-table-view { display: none; }
.chart-table-view.visible { display: block; }

/* ════════════════════════════════════════════════════════════════
   PRINT STYLES (WCAG 1.3.1 — content readable when printed)
   ════════════════════════════════════════════════════════════════ */
@media print {
  .top-nav, .a11y-toolbar, footer .print-hide,
  .btn-watch, .btn-site, .iv-lang-tabs, .iv-video-wrap,
  .iv-actions, .intro-video-section, .quick-grid,
  .chart-section, .lightbox-overlay { display: none !important; }

  body { background: #fff; color: #000; font-size: 12pt; }
  .tab-panel { display: block !important; }  /* print all tabs */
  .tool-card { break-inside: avoid; border: 1px solid #ccc; margin-bottom: 8pt; }
  .tc-name { font-size: 11pt; font-weight: bold; }
  .tc-desc { font-size: 10pt; }
  a[href]::after { content: " (" attr(href) ")"; font-size: 9pt; color: #555; }
  .hero h1 .accent { -webkit-text-fill-color: #000; background: none; }
  h1, h2, h3 { page-break-after: avoid; }
  .browse-section { page-break-inside: avoid; }
}

/* ════════════════════════════════════════════════════════════════
   QUICK-CARDS (Home tab) — dark mode + accessibility
   ════════════════════════════════════════════════════════════════ */
.quick-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin-top: 12px; }
@media (max-width: 640px) { .quick-grid { grid-template-columns: 1fr; } }

.quick-card {
  background: var(--surface); border: 1.5px solid var(--border);
  border-radius: var(--r-lg); padding: 24px 20px;
  text-align: center; cursor: pointer; transition: all .22s;
  font-family: inherit; color: inherit;
  box-shadow: var(--shadow-sm);
}
.quick-card:hover {
  border-color: var(--border-md); box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}
.qc-icon  { font-size: 28px; margin-bottom: 8px; }
.qc-title { font-size: 15px; font-weight: 800; color: var(--t-primary); margin-bottom: 5px; }
.qc-desc  { font-size: 12px; color: var(--t-secondary); line-height: 1.55; }

/* ════════════════════════════════════════════════════════════════
   FEATURES — Favorites, Progress, Ratings, Sort, Share,
               Visitor Counter, Feedback, Recently Viewed
   ════════════════════════════════════════════════════════════════ */

/* ── Visitor counter stat (hero row) ────────────────────────── */
.hero-stat.visitor-stat .hs-num { color: var(--t-accent); }
.visitor-stat-wrap { display: flex; align-items: center; gap: 4px; }
.visitor-live-dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: #10B981; flex-shrink: 0;
  animation: pulse-dot 2s ease-in-out infinite;
}
@keyframes pulse-dot {
  0%,100% { opacity: 1; transform: scale(1); }
  50%      { opacity: .5; transform: scale(.75); }
}

/* ── Tool card — meta buttons (top-right: ❤️ 🔗) ────────────── */
.tc-header { position: relative; }
.tc-meta-btns {
  display: flex; gap: 2px;
  position: absolute; top: 0; right: 0;
  opacity: 0; transition: opacity .15s;
}
.tool-card:hover .tc-meta-btns,
.tool-card:focus-within .tc-meta-btns { opacity: 1; }
.fav-btn, .share-btn {
  display: flex; align-items: center; justify-content: center;
  width: 28px; height: 28px; border-radius: 6px;
  border: 1.5px solid transparent; background: transparent;
  font-size: 15px; cursor: pointer; transition: background .15s, border-color .15s;
  line-height: 1;
}
.fav-btn:hover  { background: #FEF2F2; border-color: #FECACA; }
.fav-btn.active { opacity: 1 !important; color: #E11D48; }
.share-btn:hover { background: #EFF6FF; border-color: #BFDBFE; }

/* Always show if active fav */
.tool-card .tc-meta-btns:has(.fav-btn.active) { opacity: 1; }

/* ── Tried badge on card name ────────────────────────────────── */
.tried-badge {
  display: inline-flex; align-items: center; gap: 2px;
  font-size: 10px; font-weight: 700; color: #059669;
  background: #D1FAE5; border: 1px solid #A7F3D0;
  border-radius: 99px; padding: 1px 7px;
  margin-left: 6px; vertical-align: middle;
}
.tag-new {
  display: inline-flex; align-items: center;
  font-size: 9px; font-weight: 800; color: #fff;
  background: #F59E0B; border-radius: 99px;
  padding: 1px 6px; margin-left: 6px; vertical-align: middle;
  letter-spacing: .4px; text-transform: uppercase;
}

/* ── Tool card — tried state ─────────────────────────────────── */
.tool-card.is-tried {
  border-color: #A7F3D0 !important;
  background: linear-gradient(135deg, var(--surface) 0%, #F0FDF4 100%);
}
.tool-card.is-tried::before { background: #10B981 !important; }

/* ── Star rating row ─────────────────────────────────────────── */
.tc-rating {
  display: flex; align-items: center; gap: 6px;
  padding: 4px 0 2px;
}
.tc-rating-label {
  font-size: 11px; font-weight: 600; color: var(--t-muted);
  white-space: nowrap;
}
.stars-row { display: flex; gap: 1px; }
.star-btn {
  background: none; border: none; cursor: pointer;
  font-size: 17px; padding: 2px; line-height: 1;
  color: #D1D5DB; transition: color .1s, transform .1s;
}
.star-btn:hover, .star-btn.filled { color: #F59E0B; }
.star-btn:hover { transform: scale(1.2); }
.star-btn:focus-visible { outline: 2px solid var(--t-accent); outline-offset: 2px; border-radius: 3px; }

/* ── "I Tried This" button ───────────────────────────────────── */
.tried-btn {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 6px 10px; border-radius: 8px;
  font-size: 12px; font-weight: 700; cursor: pointer;
  border: 1.5px solid #E2E8F0; color: var(--t-secondary);
  background: var(--surface); transition: all .15s;
  min-height: 36px; white-space: nowrap;
}
.tried-btn:hover { border-color: #6EE7B7; color: #059669; background: #ECFDF5; }
.tried-btn.active { border-color: #6EE7B7; color: #059669; background: #D1FAE5; }
.tried-btn:focus-visible { outline: 2.5px solid var(--t-accent); outline-offset: 2px; }

/* Make action row wrap on small cards */
.tc-actions { flex-wrap: wrap; }

/* ── Sort row in Browse ──────────────────────────────────────── */
.sort-row {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 0 4px; flex-wrap: wrap;
}
.sort-row-label {
  font-size: 12px; font-weight: 700; color: var(--t-muted);
  white-space: nowrap;
}
.sort-pill {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 5px 12px; border-radius: 99px;
  font-size: 12px; font-weight: 600; cursor: pointer;
  border: 1.5px solid var(--border); color: var(--t-secondary);
  background: var(--surface); transition: all .15s;
  min-height: 34px;
}
.sort-pill:hover { border-color: var(--t-accent); color: var(--t-accent); }
.sort-pill.active { border-color: var(--t-accent); color: var(--t-accent); background: #EFF6FF; font-weight: 700; }
.sort-pill:focus-visible { outline: 2.5px solid var(--t-accent); outline-offset: 2px; }

/* ── Recently Viewed section (Home tab) ──────────────────────── */
.home-section {
  max-width: 960px; margin: 0 auto 0;
  padding: 16px 24px 0;
}
.home-section-title {
  font-size: 13px; font-weight: 800; color: var(--t-muted);
  text-transform: uppercase; letter-spacing: .8px;
  margin-bottom: 12px; display: flex; align-items: center; gap: 8px;
}
.rv-chips, .fav-chips {
  display: flex; flex-wrap: wrap; gap: 8px;
}
.rv-chip, .fav-chip {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 7px 14px; border-radius: 10px;
  border: 1.5px solid var(--border); background: var(--surface);
  font-size: 13px; font-weight: 600; cursor: pointer;
  color: var(--t-secondary); transition: all .15s;
}
.rv-chip:hover, .fav-chip:hover {
  border-color: var(--t-accent); color: var(--t-accent);
  background: #EFF6FF; transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(37,99,235,.12);
}
.rv-chip:focus-visible, .fav-chip:focus-visible {
  outline: 2.5px solid var(--t-accent); outline-offset: 2px;
}
.rv-emoji, .fav-emoji { font-size: 16px; }
.fav-cat { font-size: 14px; margin-left: 2px; }
.fav-more-btn {
  display: inline-flex; align-items: center;
  padding: 7px 14px; border-radius: 10px;
  border: 1.5px dashed var(--border); background: transparent;
  font-size: 13px; font-weight: 700; cursor: pointer;
  color: var(--t-muted); transition: all .15s;
}
.fav-more-btn:hover { border-color: var(--t-accent); color: var(--t-accent); }

/* ── Floating Feedback Button (FAB) ──────────────────────────── */
.feedback-fab {
  position: fixed; bottom: 28px; right: 28px; z-index: 400;
  display: flex; align-items: center; gap: 8px;
  padding: 13px 20px; border-radius: 99px;
  background: linear-gradient(135deg, #7C3AED, #2563EB);
  color: #fff; font-size: 14px; font-weight: 700;
  border: none; cursor: pointer; box-shadow: 0 4px 20px rgba(37,99,235,.35);
  transition: transform .2s, box-shadow .2s;
  will-change: transform;
}
.feedback-fab:hover {
  transform: translateY(-2px) scale(1.03);
  box-shadow: 0 8px 28px rgba(37,99,235,.45);
}
.feedback-fab:focus-visible {
  outline: 3px solid #fff; outline-offset: 3px;
}
.feedback-fab .fab-icon { font-size: 18px; }
.feedback-fab .fab-text { letter-spacing: .2px; }
@media (max-width: 480px) {
  .feedback-fab .fab-text { display: none; }
  .feedback-fab { padding: 14px; border-radius: 50%; }
}
/* ═══════════════════════════════════════════════════════════
   TOOL VIDEO MODAL STYLES
   ═══════════════════════════════════════════════════════════ */

.tool-video-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.85);
  backdrop-filter: blur(8px);
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  animation: fadeIn 0.3s ease;
}

.tool-video-modal {
  background: var(--bg-primary);
  border-radius: 16px;
  max-width: 1000px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.4);
  animation: slideUp 0.3s ease;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes slideUp {
  from { 
    opacity: 0;
    transform: translateY(30px);
  }
  to { 
    opacity: 1;
    transform: translateY(0);
  }
}

/* Header */
.tv-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  padding: 24px;
  border-bottom: 1px solid var(--border-primary);
}

.tv-header-text h2 {
  margin: 0 0 4px 0;
  font-size: 20px;
  font-weight: 700;
  color: var(--t-primary);
}

.tv-tool-name {
  margin: 0;
  font-size: 14px;
  color: var(--t-secondary);
  font-weight: 500;
}

.tv-close {
  background: var(--bg-secondary);
  border: none;
  width: 36px;
  height: 36px;
  border-radius: 8px;
  font-size: 18px;
  cursor: pointer;
  color: var(--t-secondary);
  transition: all 0.2s;
  flex-shrink: 0;
}

.tv-close:hover {
  background: var(--bg-tertiary);
  color: var(--t-primary);
  transform: scale(1.05);
}

/* Language Selector */
.tv-lang-selector {
  padding: 16px 24px;
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border-primary);
}

.tv-lang-label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--t-secondary);
  margin-bottom: 8px;
}

.tv-lang-tabs {
  display: flex;
  gap: 8px;
}

.tv-lang-btn {
  flex: 1;
  padding: 10px 16px;
  background: var(--bg-primary);
  border: 2px solid var(--border-primary);
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  color: var(--t-secondary);
  cursor: pointer;
  transition: all 0.2s;
}

.tv-lang-btn:hover {
  background: var(--bg-tertiary);
  border-color: var(--accent);
}

.tv-lang-btn.active {
  background: var(--accent);
  border-color: var(--accent);
  color: white;
}

/* Video Container */
.tv-video-container {
  position: relative;
  background: #000;
  padding: 24px;
}

.tool-hls-video {
  width: 100%;
  height: auto;
  max-height: 60vh;
  border-radius: 12px;
  background: #000;
  display: block;
}

.tv-loading-status {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: rgba(0, 0, 0, 0.9);
  color: white;
  padding: 12px 24px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  pointer-events: none;
}

/* Video Info */
.tv-info {
  padding: 20px 24px 24px;
}

.tv-description {
  margin: 0;
  font-size: 14px;
  line-height: 1.6;
  color: var(--t-secondary);
}

/* Responsive */
@media (max-width: 768px) {
  .tool-video-modal {
    max-height: 95vh;
    border-radius: 16px 16px 0 0;
    margin-top: auto;
  }
  
  .tv-lang-tabs {
    flex-direction: column;
  }
  
  .tool-hls-video {
    max-height: 50vh;
  }
}
/* ── Feedback Modal ───────────────────────────────────────────── */
.feedback-overlay {
  position: fixed; inset: 0; z-index: 500;
  background: rgba(15,23,42,.65); backdrop-filter: blur(4px);
  display: none; align-items: center; justify-content: center;
  padding: 16px;
}
.feedback-overlay.open { display: flex; }
.feedback-modal {
  background: var(--surface); border: 1.5px solid var(--border);
  border-radius: 20px; box-shadow: 0 24px 60px rgba(0,0,0,.2);
  width: 100%; max-width: 520px; max-height: 90vh;
  overflow-y: auto; position: relative;
}
.fb-header {
  padding: 24px 24px 16px;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: flex-start; gap: 14px;
}
.fb-icon { font-size: 32px; flex-shrink: 0; }
.fb-header-text h2 { font-size: 18px; font-weight: 800; color: var(--t-primary); margin: 0 0 4px; }
.fb-header-text p  { font-size: 13px; color: var(--t-muted); margin: 0; line-height: 1.5; }
.fb-close {
  position: absolute; top: 16px; right: 16px;
  width: 32px; height: 32px; border-radius: 8px;
  border: 1.5px solid var(--border); background: transparent;
  cursor: pointer; font-size: 16px; color: var(--t-muted);
  display: flex; align-items: center; justify-content: center;
  transition: background .15s;
}
.fb-close:hover { background: var(--bg); }
.fb-close:focus-visible { outline: 2.5px solid var(--t-accent); outline-offset: 2px; }

.fb-body { padding: 20px 24px 24px; }
.fb-group { margin-bottom: 16px; }
.fb-group:last-child { margin-bottom: 0; }
.fb-label {
  display: block; font-size: 12px; font-weight: 700;
  color: var(--t-secondary); margin-bottom: 6px;
  text-transform: uppercase; letter-spacing: .5px;
}
.fb-required { color: #E11D48; margin-left: 2px; }
.fb-input, .fb-select, .fb-textarea {
  width: 100%; padding: 10px 14px;
  border: 1.5px solid var(--border); border-radius: 10px;
  font-size: 14px; font-family: inherit; color: var(--t-primary);
  background: var(--bg); box-sizing: border-box;
  transition: border-color .15s, box-shadow .15s;
}
.fb-input:focus, .fb-select:focus, .fb-textarea:focus {
  border-color: var(--t-accent); box-shadow: 0 0 0 3px rgba(37,99,235,.15);
  outline: none;
}
.fb-input[aria-invalid="true"], .fb-textarea[aria-invalid="true"] {
  border-color: #EF4444; box-shadow: 0 0 0 3px rgba(239,68,68,.15);
}
.fb-textarea { resize: vertical; min-height: 100px; line-height: 1.55; }
.fb-char-count { font-size: 11px; color: var(--t-muted); text-align: right; margin-top: 4px; }
.fb-tool-fields { animation: fadeIn .2s ease; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }
.fb-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 480px) { .fb-row { grid-template-columns: 1fr; } }

.fb-submit {
  width: 100%; padding: 13px; border-radius: 12px;
  background: linear-gradient(135deg, #7C3AED, #2563EB);
  color: #fff; font-size: 15px; font-weight: 700;
  border: none; cursor: pointer; margin-top: 8px;
  transition: opacity .15s, transform .15s;
}
.fb-submit:hover { opacity: .9; transform: translateY(-1px); }
.fb-submit:focus-visible { outline: 3px solid var(--t-accent); outline-offset: 3px; }
.fb-cancel {
  width: 100%; padding: 10px; border-radius: 12px;
  background: transparent; color: var(--t-muted);
  font-size: 14px; font-weight: 600; border: 1.5px solid var(--border);
  cursor: pointer; margin-top: 8px; transition: background .15s;
}
.fb-cancel:hover { background: var(--bg); }

/* Success state */
.fb-success {
  padding: 32px 24px; text-align: center;
}
.fb-success-icon { font-size: 52px; margin-bottom: 16px; }
.fb-success-title { font-size: 20px; font-weight: 800; color: var(--t-primary); margin-bottom: 8px; }
.fb-success-msg { font-size: 14px; color: var(--t-secondary); line-height: 1.6; }

/* ── Feature toast notifications ─────────────────────────────── */
#featToastWrap {
  position: fixed; bottom: 90px; right: 20px; z-index: 600;
  display: flex; flex-direction: column; gap: 8px; pointer-events: none;
}
.feat-toast {
  padding: 10px 18px; border-radius: 10px;
  font-size: 13px; font-weight: 700;
  box-shadow: 0 4px 16px rgba(0,0,0,.15);
  animation: toastIn .25s ease, toastOut .25s ease 2.75s forwards;
  pointer-events: none;
}
.feat-toast.success { background: #065F46; color: #fff; }
.feat-toast.error   { background: #991B1B; color: #fff; }
.feat-toast.info    { background: #1E40AF; color: #fff; }
@keyframes toastIn  { from { opacity: 0; transform: translateX(30px); } to { opacity: 1; transform: none; } }
@keyframes toastOut { from { opacity: 1; } to { opacity: 0; } }

/* ── Dark mode overrides ──────────────────────────────────────── */
[data-theme="dark"] .tool-card.is-tried {
  border-color: #166534 !important;
  background: linear-gradient(135deg, var(--surface) 0%, #052e16 100%);
}
[data-theme="dark"] .tried-badge { background: #052e16; border-color: #166534; color: #4ade80; }
[data-theme="dark"] .tried-btn:hover, [data-theme="dark"] .tried-btn.active { background: #052e16; border-color: #166534; color: #4ade80; }
[data-theme="dark"] .fav-btn:hover  { background: #3B0764; border-color: #7C3AED; }
[data-theme="dark"] .sort-pill.active { background: #1d4ed855; }
[data-theme="dark"] .rv-chip:hover, [data-theme="dark"] .fav-chip:hover { background: #1d4ed855; border-color: #58A6FF; }
[data-theme="dark"] .feedback-modal  { background: var(--surface); }
[data-theme="dark"] .fb-input, [data-theme="dark"] .fb-select, [data-theme="dark"] .fb-textarea {
  background: var(--bg); border-color: rgba(255,255,255,.12); color: #E6EDF3;
}
[data-theme="dark"] .fb-input:focus, [data-theme="dark"] .fb-select:focus, [data-theme="dark"] .fb-textarea:focus {
  border-color: #58A6FF; box-shadow: 0 0 0 3px rgba(88,166,255,.2);
}
[data-theme="dark"] .fb-cancel { border-color: rgba(255,255,255,.12); }
[data-theme="dark"] .fb-cancel:hover { background: rgba(255,255,255,.06); }
[data-theme="dark"] .star-btn { color: rgba(255,255,255,.2); }
[data-theme="dark"] .star-btn:hover, [data-theme="dark"] .star-btn.filled { color: #FBBF24; }

/* ── Print: hide interactive extras ──────────────────────────── */
@media print {
  .feedback-fab, .feedback-overlay, #featToastWrap,
  .fav-btn, .share-btn, .tried-btn, .tc-rating, .sort-row { display: none !important; }
}

/* ── Inline text link button (used in progress section) ─────── */
.inline-link-btn {
  background: none; border: none; padding: 0;
  color: var(--t-accent); font-size: inherit; font-weight: 700;
  font-family: inherit; cursor: pointer; text-decoration: underline;
  text-underline-offset: 2px;
}
.inline-link-btn:hover { opacity: .8; }
.inline-link-btn:focus-visible { outline: 2px solid var(--t-accent); outline-offset: 2px; border-radius: 2px; }
