@import url('./design-tokens.css');

/* ==========================================================================
   Skill.Sea Master Stylesheet (ExamForge Design Reference Inspired)
   Full Edge-to-Edge Architecture + Mobile Screen Perfection
   ========================================================================== */

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  -webkit-tap-highlight-color: transparent;
}

html, body {
  min-height: 100vh;
  min-height: 100dvh;
  width: 100%;
  background-color: var(--surface-0);
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 13px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

/* Touch device pull-to-refresh prevention (preserves desktop mouse wheel scroll) */
@media (pointer: coarse) {
  html, body {
    overscroll-behavior-y: none;
  }
}

/* Mobile-Native Touch Ergonomics & Immediate Feedback */
button,
.btn-icon,
.nv,
.mob-tab-btn,
.pill,
.cat-pill,
.cmd-box,
.btn-action,
.copy-pill,
.filter-chip-remove {
  touch-action: manipulation;
  -webkit-user-select: none;
  user-select: none;
}

button:active,
.btn-icon:active,
.mob-tab-btn:active,
.pill:active,
.cat-pill:active,
.btn-action:active,
.copy-pill:active {
  transform: scale(0.97);
  opacity: 0.88;
}

/* ==========================================================================
   Accessibility & Assistive Technology Utilities (WCAG 2.1 & WIG Compliant)
   ========================================================================== */
.skip-link {
  position: absolute;
  top: -60px;
  left: 16px;
  background: var(--teal-strong);
  color: #ffffff;
  padding: 8px 16px;
  border-radius: var(--radius);
  font-weight: 500;
  z-index: 9999;
  text-decoration: none;
  box-shadow: var(--shadow-md);
  transition: top 0.15s ease;
}

.skip-link:focus {
  top: 12px;
  outline: 2px solid #ffffff;
  outline-offset: 2px;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border-width: 0;
}

:focus-visible {
  outline: 2px solid var(--teal);
  outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* ==========================================================================
   Full Edge-to-Edge Layout Architecture
   ========================================================================== */
.app-container {
  width: 100%;
  max-width: 100%;
  margin: 0;
  padding: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.ef-frame {
  width: 100%;
  border: none;
  border-radius: 0;
  background: var(--surface-2);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ==========================================================================
   Header Navigation Bar (ExamForge Reference Spec)
   ========================================================================== */
.hd {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 48px;
  padding: 0 16px;
  border-bottom: 0.5px solid var(--border);
  background: var(--surface-1);
  user-select: none;
  position: sticky;
  top: 0;
  z-index: 50;
  backdrop-filter: blur(8px);
}

.hd-brand {
  display: flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
  color: inherit;
  margin-right: 12px;
}

.brand-icon {
  width: 26px;
  height: 26px;
  border-radius: 6px;
  background: var(--teal-strong);
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  flex-shrink: 0;
}

.brand-title {
  font-weight: 500;
  font-size: 14.5px;
  letter-spacing: -0.2px;
}

.brand-tag {
  font-size: 11px;
  color: var(--text-muted);
  font-family: var(--font-mono);
  margin-left: 2px;
  display: inline-block;
}

/* Desktop Header Navigation Pills */
.nv-group {
  display: flex;
  align-items: center;
  gap: 4px;
}

.nv {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  border-radius: var(--radius);
  color: var(--text-secondary);
  font-size: 12.5px;
  cursor: pointer;
  background: transparent;
  border: none;
  transition: background-color 0.15s ease, color 0.15s ease;
  text-decoration: none;
  white-space: nowrap;
}

.nv:hover {
  background: rgba(11, 11, 11, 0.05);
  color: var(--text-primary);
}

[data-theme="dark"] .nv:hover {
  background: rgba(255, 255, 255, 0.06);
}

.nv.on {
  background: var(--teal-nav-active);
  color: var(--text-primary);
  font-weight: 500;
}

.nv i, .nv svg {
  font-size: 15px;
  flex-shrink: 0;
}

.spacer {
  flex: 1;
}

/* Header Controls Right */
.pill {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border: 0.5px solid var(--border-strong);
  border-radius: var(--radius);
  font-size: 12px;
  color: var(--text-secondary);
  background: var(--surface-1);
  text-decoration: none;
  cursor: pointer;
  transition: border-color 0.15s ease, background-color 0.15s ease;
  white-space: nowrap;
}

.pill:hover {
  border-color: var(--border-stronger);
  color: var(--text-primary);
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--teal);
  box-shadow: 0 0 0 2px rgba(29, 158, 117, 0.2);
  display: inline-block;
}

.btn-icon {
  background: transparent;
  border: none;
  cursor: pointer;
  color: var(--text-secondary);
  padding: 6px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  transition: background-color 0.15s ease, color 0.15s ease;
}

.btn-icon:hover {
  color: var(--text-primary);
  background: rgba(11, 11, 11, 0.05);
}

[data-theme="dark"] .btn-icon:hover {
  background: rgba(255, 255, 255, 0.08);
}

.avatar-badge {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--bg-accent);
  color: var(--text-accent);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 500;
  text-decoration: none;
}

/* ==========================================================================
   Edge-to-Edge Telemetry Metrics Row (Modern Stacked Cards)
   ========================================================================== */
.metrics-row {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  padding: 14px 16px;
  border-bottom: 0.5px solid var(--border);
  background: var(--surface-1);
}

.mc {
  background: var(--surface-2);
  border: 0.5px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 14px;
  position: relative;
  transition: transform 0.15s ease, border-color 0.15s ease, background-color 0.15s ease;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 8px;
  text-align: left;
  min-width: 0;
  box-sizing: border-box;
}

.mc:hover {
  border-color: var(--border-strong);
  background: var(--surface-3);
  transform: translateY(-1px);
}

.mc-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-width: 0;
}

.mc-label {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11.5px;
  font-weight: 500;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.mc-label i {
  font-size: 13px;
  color: var(--teal);
}

.mc-badge {
  font-size: 11px;
  font-weight: 500;
  color: var(--text-muted);
  background: rgba(255, 255, 255, 0.04);
  border: 0.5px solid var(--border);
  border-radius: 4px;
  padding: 1px 6px;
  line-height: 1.3;
  white-space: nowrap;
}

.mc b,
.mc .mc-value {
  display: block;
  font-size: 22px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.3px;
  color: var(--text-primary);
  line-height: 1.1;
}

.mc .mc-sub {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 400;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.mc-sub .status-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--teal);
  box-shadow: 0 0 6px rgba(16, 185, 129, 0.4);
  flex-shrink: 0;
}

.mc-sub .status-dot-hot {
  background: #f59e0b;
  box-shadow: 0 0 6px rgba(245, 158, 11, 0.4);
}

.mc-badge-hot {
  color: #f59e0b;
  border-color: rgba(245, 158, 11, 0.3);
  background: rgba(245, 158, 11, 0.08);
}

/* ==========================================================================
   Category Navigation Rail
   ========================================================================== */
.rail-container {
  padding: 10px 16px;
  border-bottom: 0.5px solid var(--border);
  background: var(--surface-1);
  position: relative;
}

.category-rail {
  display: flex;
  gap: 6px;
  align-items: center;
  overflow-x: auto;
  white-space: nowrap;
  scrollbar-width: none;
  -ms-overflow-style: none;
  padding-bottom: 2px;
}

.category-rail::-webkit-scrollbar {
  display: none;
}

.cat-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  border-radius: 999px;
  border: 0.5px solid var(--border);
  background: var(--surface-2);
  color: var(--text-secondary);
  font-size: 12px;
  cursor: pointer;
  transition: background-color 0.15s ease, color 0.15s ease, border-color 0.15s ease;
  user-select: none;
  flex-shrink: 0;
}

.cat-pill.cat-color-emerald { --cat-accent: #10b981; }
.cat-pill.cat-color-blue { --cat-accent: #3b82f6; }
.cat-pill.cat-color-sky { --cat-accent: #0284c7; }
.cat-pill.cat-color-cyan { --cat-accent: #06b6d4; }
.cat-pill.cat-color-teal { --cat-accent: #14b8a6; }
.cat-pill.cat-color-amber { --cat-accent: #f59e0b; }
.cat-pill.cat-color-orange { --cat-accent: #ea580c; }
.cat-pill.cat-color-rose { --cat-accent: #f43f5e; }
.cat-pill.cat-color-crimson { --cat-accent: #e11d48; }
.cat-pill.cat-color-indigo { --cat-accent: #6366f1; }
.cat-pill.cat-color-lime { --cat-accent: #84cc16; }
.cat-pill.cat-color-pink { --cat-accent: #ec4899; }
.cat-pill.cat-color-slate { --cat-accent: #64748b; }

.cat-pill i {
  color: var(--cat-accent, var(--teal));
  transition: color 0.15s ease;
}

.cat-pill:hover {
  border-color: var(--cat-accent, var(--border-strong));
  background: var(--cat-bg, var(--surface-2));
  color: var(--text-primary);
}

.cat-pill.active {
  background: var(--cat-accent, var(--teal-strong));
  border-color: var(--cat-accent, var(--teal-strong));
  color: #ffffff;
  font-weight: 500;
}

.cat-pill.active i {
  color: #ffffff;
}

.cat-pill .cat-count {
  font-size: 10.5px;
  opacity: 0.8;
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
}

/* ==========================================================================
   Toolbar (Search & Filter)
   ========================================================================== */
.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 16px;
  border-bottom: 0.5px solid var(--border);
  background: var(--surface-1);
  flex-wrap: wrap;
}

.search-box {
  display: flex;
  align-items: center;
  gap: 8px;
  border: 0.5px solid var(--border-strong);
  border-radius: var(--radius);
  background: var(--surface-1);
  padding: 6px 12px;
  width: 340px;
  max-width: 100%;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.search-box:focus-within {
  border-color: var(--teal);
  box-shadow: 0 0 0 2px rgba(29, 158, 117, 0.15);
}

.search-box i {
  color: var(--text-muted);
  font-size: 15px;
}

.search-box input {
  border: none;
  background: transparent;
  outline: none;
  width: 100%;
  color: var(--text-primary);
  font-size: 12.5px;
  font-family: inherit;
}

.search-box input::placeholder {
  color: var(--text-muted);
}

.kbd-shortcut {
  font-size: 11px;
  font-family: var(--font-mono);
  color: var(--text-muted);
  border: 0.5px solid var(--border-strong);
  border-radius: 4px;
  padding: 1px 5px;
  background: var(--surface-2);
}

.toolbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.filter-select {
  border: 0.5px solid var(--border-strong);
  background: var(--surface-1);
  color: var(--text-primary);
  font-size: 12px;
  border-radius: var(--radius);
  padding: 6px 10px;
  cursor: pointer;
  max-width: 220px;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.filter-select:focus-visible {
  outline: 2px solid var(--teal);
  outline-offset: 1px;
  border-color: var(--teal);
}

/* Active Filters Bar */
.active-filters-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  border-bottom: 0.5px solid var(--border);
  background: var(--surface-1);
  flex-wrap: wrap;
  font-size: 11.5px;
}

.active-filters-label {
  color: var(--text-muted);
  font-weight: 500;
  text-transform: uppercase;
  font-size: 11px;
  letter-spacing: 0.05em;
}

.filter-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 8px;
  background: var(--surface-2);
  border: 0.5px solid var(--border-strong);
  border-radius: var(--radius-chip);
  color: var(--text-primary);
  font-size: 11.5px;
}

.filter-chip-remove {
  background: transparent;
  border: none;
  padding: 0 2px;
  cursor: pointer;
  color: var(--text-muted);
  font-size: 13px;
  display: inline-flex;
  align-items: center;
  line-height: 1;
  transition: color 0.12s ease;
}

.filter-chip-remove:hover {
  color: var(--text-danger);
}

.filter-chip-remove:focus-visible {
  outline: 2px solid var(--teal);
  outline-offset: 1px;
  border-radius: 2px;
}

.filter-reset-btn {
  background: transparent;
  border: none;
  color: var(--teal);
  cursor: pointer;
  font-size: 11.5px;
  margin-left: auto;
  text-decoration: underline;
  padding: 2px 6px;
}

.filter-reset-btn:hover {
  color: var(--teal-strong);
}

.view-toggle {
  display: flex;
  border: 0.5px solid var(--border-strong);
  border-radius: var(--radius);
  background: var(--surface-1);
  padding: 2px;
  gap: 2px;
}

.view-btn {
  border: none;
  background: transparent;
  color: var(--text-muted);
  padding: 4px 8px;
  border-radius: 6px;
  cursor: pointer;
  display: flex;
  align-items: center;
  font-size: 14px;
  transition: background-color 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
}

.view-btn.active {
  background: var(--surface-2);
  color: var(--text-primary);
  box-shadow: var(--shadow-sm);
}

/* ==========================================================================
   Full Edge-to-Edge Leaderboard Table View
   ========================================================================== */
.table-scroll {
  overflow-x: auto;
  min-height: 450px;
  width: 100%;
}

.rank-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12.5px;
  text-align: left;
}

.rank-table thead th {
  background: var(--surface-1);
  color: var(--text-secondary);
  font-weight: 500;
  font-size: 11px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 11px 16px;
  border-bottom: 0.5px solid var(--border);
  user-select: none;
}

.rank-table tbody tr {
  border-bottom: 0.5px solid var(--border);
  transition: background-color 0.12s ease;
  cursor: pointer;
}

.rank-table tbody tr:hover {
  background-color: var(--surface-hover);
}

.rank-table td {
  padding: 10px 16px;
  vertical-align: middle;
}

/* Rank column */
.col-rank {
  width: 48px;
  text-align: center;
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}

.rank-pill {
  width: 24px;
  height: 24px;
  border-radius: 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
}

.rank-top-1 { background: #fae17d; color: #523700; }
.rank-top-2 { background: #e3e2e0; color: #32302d; }
.rank-top-3 { background: #f3cca4; color: #5c2f00; }

/* Skill & Repo column */
.skill-meta {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.skill-icon-tile {
  width: 32px;
  height: 32px;
  border-radius: 6px;
  background: var(--surface-1);
  border: 0.5px solid var(--border);
  color: var(--teal);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  flex-shrink: 0;
  margin-top: 1px;
}

.skill-info {
  min-width: 0;
}

.skill-title-row {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.skill-title {
  font-weight: 500;
  color: var(--text-primary);
  font-size: 13px;
  text-decoration: none;
}

.skill-title:hover {
  color: var(--teal);
}

.skill-repo {
  font-size: 11px;
  color: var(--text-muted);
  font-family: var(--font-mono);
  display: inline-flex;
  align-items: center;
  gap: 3px;
  text-decoration: none;
}

.skill-repo:hover {
  color: var(--text-secondary);
  text-decoration: underline;
}

.skill-desc {
  font-size: 11.5px;
  color: var(--text-secondary);
  margin-top: 2px;
  display: -webkit-box;
  -webkit-line-clamp: 1;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 700px;
}

/* Category Color Palette System (Rich Harmonics) */
.cat-color-emerald {
  --cat-bg: rgba(16, 185, 129, 0.10);
  --cat-border: rgba(16, 185, 129, 0.28);
  --cat-text: #059669;
}
[data-theme="dark"] .cat-color-emerald {
  --cat-bg: rgba(16, 185, 129, 0.16);
  --cat-border: rgba(16, 185, 129, 0.35);
  --cat-text: #34d399;
}

.cat-color-blue {
  --cat-bg: rgba(59, 130, 246, 0.10);
  --cat-border: rgba(59, 130, 246, 0.28);
  --cat-text: #2563eb;
}
[data-theme="dark"] .cat-color-blue {
  --cat-bg: rgba(59, 130, 246, 0.16);
  --cat-border: rgba(59, 130, 246, 0.35);
  --cat-text: #60a5fa;
}

.cat-color-sky {
  --cat-bg: rgba(2, 132, 199, 0.10);
  --cat-border: rgba(2, 132, 199, 0.28);
  --cat-text: #0284c7;
}
[data-theme="dark"] .cat-color-sky {
  --cat-bg: rgba(2, 132, 199, 0.16);
  --cat-border: rgba(2, 132, 199, 0.35);
  --cat-text: #38bdf8;
}

.cat-color-cyan {
  --cat-bg: rgba(6, 182, 212, 0.10);
  --cat-border: rgba(6, 182, 212, 0.28);
  --cat-text: #0891b2;
}
[data-theme="dark"] .cat-color-cyan {
  --cat-bg: rgba(6, 182, 212, 0.16);
  --cat-border: rgba(6, 182, 212, 0.35);
  --cat-text: #22d3ee;
}

.cat-color-teal {
  --cat-bg: rgba(20, 184, 166, 0.10);
  --cat-border: rgba(20, 184, 166, 0.28);
  --cat-text: #0d9488;
}
[data-theme="dark"] .cat-color-teal {
  --cat-bg: rgba(20, 184, 166, 0.16);
  --cat-border: rgba(20, 184, 166, 0.35);
  --cat-text: #2dd4bf;
}

.cat-color-amber {
  --cat-bg: rgba(245, 158, 11, 0.10);
  --cat-border: rgba(245, 158, 11, 0.28);
  --cat-text: #b45309;
}
[data-theme="dark"] .cat-color-amber {
  --cat-bg: rgba(245, 158, 11, 0.16);
  --cat-border: rgba(245, 158, 11, 0.35);
  --cat-text: #fbbf24;
}

.cat-color-orange {
  --cat-bg: rgba(234, 88, 12, 0.10);
  --cat-border: rgba(234, 88, 12, 0.28);
  --cat-text: #c2410c;
}
[data-theme="dark"] .cat-color-orange {
  --cat-bg: rgba(234, 88, 12, 0.16);
  --cat-border: rgba(234, 88, 12, 0.35);
  --cat-text: #fb923c;
}

.cat-color-rose {
  --cat-bg: rgba(244, 63, 94, 0.10);
  --cat-border: rgba(244, 63, 94, 0.28);
  --cat-text: #e11d48;
}
[data-theme="dark"] .cat-color-rose {
  --cat-bg: rgba(244, 63, 94, 0.16);
  --cat-border: rgba(244, 63, 94, 0.35);
  --cat-text: #fb7185;
}

.cat-color-crimson {
  --cat-bg: rgba(225, 29, 72, 0.10);
  --cat-border: rgba(225, 29, 72, 0.28);
  --cat-text: #be123c;
}
[data-theme="dark"] .cat-color-crimson {
  --cat-bg: rgba(225, 29, 72, 0.16);
  --cat-border: rgba(225, 29, 72, 0.35);
  --cat-text: #fda4af;
}

.cat-color-indigo {
  --cat-bg: rgba(99, 102, 241, 0.10);
  --cat-border: rgba(99, 102, 241, 0.28);
  --cat-text: #4f46e5;
}
[data-theme="dark"] .cat-color-indigo {
  --cat-bg: rgba(99, 102, 241, 0.16);
  --cat-border: rgba(99, 102, 241, 0.35);
  --cat-text: #818cf8;
}

.cat-color-lime {
  --cat-bg: rgba(132, 204, 22, 0.10);
  --cat-border: rgba(132, 204, 22, 0.28);
  --cat-text: #4d7c0f;
}
[data-theme="dark"] .cat-color-lime {
  --cat-bg: rgba(132, 204, 22, 0.16);
  --cat-border: rgba(132, 204, 22, 0.35);
  --cat-text: #a3e635;
}

.cat-color-pink {
  --cat-bg: rgba(236, 72, 153, 0.10);
  --cat-border: rgba(236, 72, 153, 0.28);
  --cat-text: #be185d;
}
[data-theme="dark"] .cat-color-pink {
  --cat-bg: rgba(236, 72, 153, 0.16);
  --cat-border: rgba(236, 72, 153, 0.35);
  --cat-text: #f472b6;
}

.cat-color-slate {
  --cat-bg: rgba(100, 116, 139, 0.10);
  --cat-border: rgba(100, 116, 139, 0.25);
  --cat-text: #475569;
}
[data-theme="dark"] .cat-color-slate {
  --cat-bg: rgba(100, 116, 139, 0.16);
  --cat-border: rgba(100, 116, 139, 0.32);
  --cat-text: #94a3b8;
}

/* Category & Tags */
.tg {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  padding: 2.5px 8.5px;
  border-radius: var(--radius-chip);
  white-space: nowrap;
  font-weight: 500;
  transition: background-color 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.tg-hot {
  background: var(--bg-danger);
  color: var(--text-danger);
  font-weight: 500;
}

.tg-vault {
  background: var(--bg-neutral);
  color: var(--text-neutral);
}

.tg-cat {
  background: var(--cat-bg, var(--surface-1));
  border: 0.5px solid var(--cat-border, var(--border-strong));
  color: var(--cat-text, var(--text-secondary));
  cursor: pointer;
}

.tg-cat:hover {
  filter: brightness(1.15);
  border-color: var(--cat-text, var(--border-strong));
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

/* Dedicated Active Tag Pill */
.tag-active-pill {
  display: inline-flex;
  align-items: center;
  gap: 3.5px;
  padding: 1.5px 7px;
  font-size: 11px;
  font-weight: 600;
  border-radius: 9999px;
  background: rgba(16, 185, 129, 0.14);
  border: 0.5px solid rgba(16, 185, 129, 0.38);
  color: #059669;
  letter-spacing: 0.03em;
  user-select: none;
}

[data-theme="dark"] .tag-active-pill {
  background: rgba(16, 185, 129, 0.18);
  border-color: rgba(16, 185, 129, 0.45);
  color: #34d399;
}

/* 1-Click Install Command Switcher Header */
.col-cmd-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.cmd-type-toggle {
  display: inline-flex;
  align-items: center;
  background: var(--surface-2);
  border: 0.5px solid var(--border-strong);
  border-radius: 6px;
  padding: 3px 4px;
  gap: 2px;
  user-select: none;
}

.cmd-type-btn {
  background: transparent;
  border: none;
  border-radius: 4px;
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 500;
  padding: 2px 7px;
  cursor: pointer;
  transition: background-color 0.12s ease, color 0.12s ease;
  line-height: 1.2;
}

.cmd-type-btn:hover {
  color: var(--text-primary);
}

.cmd-type-btn.active {
  background: var(--surface-1);
  color: var(--teal);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.15);
  font-weight: 600;
}

/* Command Box */
.cmd-box {
  display: flex;
  align-items: center;
  background: var(--surface-1);
  border: 0.5px solid var(--border);
  border-radius: 6px;
  padding: 4px 8px;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-secondary);
  max-width: 270px;
  position: relative;
  cursor: pointer;
  transition: border-color 0.15s ease, background-color 0.15s ease, color 0.15s ease;
}

.cmd-box:hover {
  border-color: var(--teal);
  color: var(--text-primary);
  background: var(--surface-2);
}

.cmd-box:focus-visible {
  outline: 2px solid var(--teal);
  outline-offset: 1px;
  border-color: var(--teal);
}

.cmd-box code {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
  padding-right: 6px;
}

.cmd-copy-icon {
  font-size: 13px;
  color: var(--text-muted);
}

.cmd-box:hover .cmd-copy-icon {
  color: var(--teal);
}

/* Action button */
.btn-action {
  background: var(--surface-1);
  border: 0.5px solid var(--border-strong);
  border-radius: 6px;
  padding: 5px 10px;
  font-size: 11.5px;
  color: var(--text-secondary);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.btn-action:hover {
  background: var(--teal);
  border-color: var(--teal);
  color: #ffffff;
}

/* ==========================================================================
   Card Grid View
   ========================================================================== */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 14px;
  padding: 16px;
  width: 100%;
}

.skill-card {
  border: 0.5px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface-2);
  padding: 14px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 10px;
  cursor: pointer;
  transition: border-color 0.15s ease, transform 0.15s ease, box-shadow 0.15s ease;
  min-width: 0;
  overflow: hidden;
  box-sizing: border-box;
}

.skill-card:hover {
  border-color: var(--border-strong);
  box-shadow: var(--shadow-sm);
  transform: translateY(-1px);
}

.card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
  min-width: 0;
}

.card-title {
  font-size: 13.5px;
  font-weight: 500;
  color: var(--text-primary);
  word-break: break-word;
}

.card-repo {
  font-size: 11px;
  font-family: var(--font-mono);
  color: var(--text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  display: block;
  max-width: 220px;
}

.card-desc {
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.45;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  word-break: break-word;
}

.card-bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  border-top: 0.5px solid var(--border);
  padding-top: 10px;
  min-width: 0;
  overflow: hidden;
}

.card-bottom .tg-cat {
  max-width: 58%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex-shrink: 1;
}

.card-bottom .tg-cat span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.card-bottom .cmd-box {
  max-width: 40%;
  flex-shrink: 0;
  min-width: 0;
}

/* ==========================================================================
   Dedicated View Pages (Hot-Set, Categories, Library & Repos, Guide)
   ========================================================================== */
.page-view {
  display: none;
  width: 100%;
  padding: 16px;
  flex-direction: column;
  gap: 16px;
}

.page-view.active {
  display: flex;
}

.page-hero {
  background: var(--surface-1);
  border: 0.5px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px;
}

.page-hero h2 {
  font-size: 18px;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
}

.page-hero p {
  font-size: 12.5px;
  color: var(--text-secondary);
}

/* Repositories / Library Directory Grid */
.repo-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(360px, 1fr));
  gap: 14px;
  width: 100%;
}

.repo-card {
  border: 0.5px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface-2);
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 12px;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.repo-card:hover {
  border-color: var(--border-strong);
  box-shadow: var(--shadow-sm);
}

.repo-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.repo-name {
  font-size: 14px;
  font-weight: 500;
  color: var(--text-primary);
}

.repo-upstream {
  font-size: 11.5px;
  color: var(--teal);
  font-family: var(--font-mono);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.repo-upstream:hover {
  text-decoration: underline;
}

.repo-stats-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

/* Category Directory Grid */
.category-directory-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 14px;
  width: 100%;
}

.cat-dir-card {
  border: 0.5px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface-2);
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  cursor: pointer;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease;
}

.cat-dir-card:hover {
  border-color: var(--teal);
  box-shadow: var(--shadow-sm);
  transform: translateY(-1px);
}

.cat-dir-header {
  display: flex;
  align-items: center;
  gap: 10px;
}

.cat-dir-icon {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: var(--teal-nav-active);
  color: var(--teal-strong);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 17px;
  flex-shrink: 0;
}

.cat-dir-title {
  font-size: 13.5px;
  font-weight: 500;
}

.cat-dir-count {
  font-size: 11px;
  color: var(--text-muted);
}

/* ==========================================================================
   Slide-Over Drawer & Modal
   ========================================================================== */
.drawer-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(2px);
  z-index: 100;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.2s ease, visibility 0.2s ease;
}

.drawer-backdrop.open {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.drawer-panel {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: 600px;
  max-width: 100vw;
  background: var(--surface-2);
  border-left: 0.5px solid var(--border-strong);
  box-shadow: var(--shadow-drawer);
  z-index: 101;
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform 0.24s cubic-bezier(0.165, 0.84, 0.44, 1);
}

.drawer-backdrop.open .drawer-panel {
  transform: translateX(0);
}

.drawer-hd {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 18px;
  border-bottom: 0.5px solid var(--border);
  background: var(--surface-1);
}

.drawer-title-group h2 {
  font-size: 16px;
  font-weight: 500;
  color: var(--text-primary);
}

.drawer-title-group .sub {
  font-size: 11.5px;
  color: var(--text-muted);
  font-family: var(--font-mono);
}

.drawer-body {
  flex: 1;
  overflow-y: auto;
  padding: 18px;
}

.code-snippet-box {
  background: var(--surface-1);
  border: 0.5px solid var(--border-strong);
  border-radius: 8px;
  padding: 10px 14px;
  position: relative;
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 1.6;
  margin-bottom: 12px;
  overflow-x: auto;
}

.code-snippet-box .copy-pill {
  position: absolute;
  top: 8px;
  right: 8px;
  background: var(--surface-2);
  border: 0.5px solid var(--border);
  border-radius: 6px;
  padding: 3px 8px;
  font-size: 11px;
  font-family: inherit;
  color: var(--text-secondary);
  cursor: pointer;
  transition: background-color 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.code-snippet-box .copy-pill:hover {
  background: var(--teal);
  color: #ffffff;
  border-color: var(--teal);
}

.code-snippet-box .copy-pill:focus-visible {
  outline: 2px solid var(--teal);
  outline-offset: 2px;
}

.metadata-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  margin-bottom: 18px;
}

.meta-box {
  background: var(--surface-1);
  border: 0.5px solid var(--border);
  border-radius: 6px;
  padding: 8px 10px;
  font-size: 11.5px;
}

.meta-box .lbl {
  color: var(--text-muted);
  display: block;
  font-size: 10.5px;
  margin-bottom: 2px;
}

.meta-box .val {
  color: var(--text-primary);
  font-weight: 500;
  word-break: break-all;
}

/* Toast Message */
.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: var(--teal-strong);
  color: #ffffff;
  padding: 8px 16px;
  border-radius: var(--radius);
  font-size: 12.5px;
  font-weight: 500;
  box-shadow: var(--shadow-md);
  z-index: 200;
  display: flex;
  align-items: center;
  gap: 8px;
  transform: translateY(100px);
  opacity: 0;
  transition: transform 0.25s cubic-bezier(0.165, 0.84, 0.44, 1), opacity 0.25s ease;
  pointer-events: none;
}

.toast.show {
  transform: translateY(0);
  opacity: 1;
}

/* Pagination Bar */
.pagination-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
  border-top: 0.5px solid var(--border);
  background: var(--surface-1);
  font-size: 12px;
  color: var(--text-secondary);
}

.pagination-controls {
  display: flex;
  align-items: center;
  gap: 6px;
  font-variant-numeric: tabular-nums;
}

.page-btn {
  border: 0.5px solid var(--border-strong);
  background: var(--surface-2);
  color: var(--text-secondary);
  padding: 4px 10px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 11.5px;
  transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.page-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.page-btn:not(:disabled):hover {
  background: var(--teal-nav-active);
  color: var(--text-primary);
  border-color: var(--teal);
}

/* ==========================================================================
   Mobile Bottom Navigation Tab Bar (ExamForge Reference .tb Spec)
   ========================================================================== */
.mobile-tab-bar {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: calc(54px + env(safe-area-inset-bottom, 0px));
  background: var(--surface-1);
  border-top: 0.5px solid var(--border);
  z-index: 80;
  justify-content: space-around;
  align-items: center;
  padding: 0 4px max(4px, env(safe-area-inset-bottom, 0px)) 4px;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.mob-tab-btn {
  flex: 1;
  min-height: 48px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  background: transparent;
  border: none;
  color: var(--text-secondary);
  font-size: 11px;
  cursor: pointer;
  padding: 4px 0;
  transition: color 0.15s ease;
}

.mob-tab-btn i {
  font-size: 18px;
}

.mob-tab-btn.on {
  color: var(--teal);
  font-weight: 500;
}

/* ==========================================================================
   Mobile Responsive Rules (Perfect Mobile Screen Architecture)
   ========================================================================== */
@media (max-width: 860px) {
  .metrics-row {
    grid-template-columns: repeat(2, 1fr);
  }
  .drawer-panel {
    width: 100vw;
    max-width: 100vw;
  }
  .col-cmd {
    display: none;
  }
  .repo-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 680px) {
  body {
    padding-bottom: calc(58px + env(safe-area-inset-bottom, 0px));
  }

  .hd {
    padding: max(0px, env(safe-area-inset-top, 0px)) max(12px, env(safe-area-inset-right, 0px)) 0 max(12px, env(safe-area-inset-left, 0px));
    height: calc(46px + env(safe-area-inset-top, 0px));
  }

  /* Prevent iOS Safari auto-zoom on input focus (minimum 16px font-size) */
  input[type="text"],
  input[type="search"],
  select {
    font-size: 16px !important;
  }

  /* Mobile Native Bottom Sheet Drawer */
  .drawer-panel {
    top: auto;
    bottom: 0;
    left: 0;
    right: 0;
    width: 100%;
    max-width: 100%;
    max-height: 85dvh;
    border-radius: 18px 18px 0 0;
    border-left: none;
    border-top: 0.5px solid var(--border-strong);
    transform: translateY(100%);
    box-shadow: 0 -10px 32px rgba(0, 0, 0, 0.45);
    padding-bottom: max(16px, env(safe-area-inset-bottom, 0px));
  }

  .drawer-panel::before {
    content: '';
    display: block;
    width: 38px;
    height: 4px;
    background: var(--text-muted);
    opacity: 0.35;
    border-radius: 9999px;
    margin: 8px auto 2px auto;
  }

  .drawer-backdrop.open .drawer-panel {
    transform: translateY(0);
  }

  .hd .nv-group {
    display: none; /* Replaced by bottom tab bar */
  }

  .mobile-tab-bar {
    display: flex; /* Active mobile bottom bar */
  }

  .metrics-row {
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
    padding: 10px 12px;
  }

  .mc {
    padding: 8px 10px;
  }

  .mc b {
    font-size: 17px;
  }

  .toolbar {
    padding: 10px 12px;
  }

  .search-box {
    width: 100%;
  }

  .table-scroll {
    overflow-x: auto;
  }

  .rank-table td, .rank-table thead th {
    padding: 8px 10px;
  }

  .col-rank {
    width: 36px;
  }

  .skill-meta {
    gap: 8px;
  }

  .skill-icon-tile {
    width: 26px;
    height: 26px;
    font-size: 14px;
  }

  .skill-desc {
    max-width: 220px;
  }

  .card-grid {
    grid-template-columns: 1fr;
    padding: 10px 12px;
  }

  .category-directory-grid {
    grid-template-columns: 1fr;
  }

  .page-view {
    padding: 12px;
  }

  .guide-grid {
    grid-template-columns: 1fr;
  }
}

/* ==========================================================================
   Installation Guide & Cheatsheet (Professional Design)
   ========================================================================== */
.guide-container {
  display: flex;
  flex-direction: column;
  gap: 20px;
  padding: 4px 0 32px 0;
  max-width: 1200px;
  margin: 0 auto;
  width: 100%;
}

.guide-hero {
  background: var(--surface-1);
  border: 0.5px solid var(--border-strong);
  border-radius: var(--radius);
  padding: 22px 26px;
  position: relative;
  overflow: hidden;
}

.guide-hero h2 {
  font-size: 19px;
  font-weight: 600;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 6px;
}

.guide-hero p {
  color: var(--text-secondary);
  font-size: 13px;
  line-height: 1.6;
  max-width: 860px;
}

.guide-quick-nav {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 14px;
}

.guide-nav-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  border-radius: 9999px;
  background: var(--surface-2);
  border: 0.5px solid var(--border);
  color: var(--text-secondary);
  font-family: inherit;
  font-size: 11.5px;
  font-weight: 500;
  line-height: inherit;
  cursor: pointer;
  transition: background-color 0.15s ease, color 0.15s ease, border-color 0.15s ease;
  text-decoration: none;
}

.guide-nav-pill:hover {
  background: var(--surface-hover);
  color: var(--teal);
  border-color: var(--teal);
}

.guide-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}

.guide-card {
  background: var(--surface-1);
  border: 0.5px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 22px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
  position: relative;
}

.guide-card:hover {
  border-color: var(--border-strong);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.05);
}

.guide-card.highlight {
  border-color: var(--teal);
  background: linear-gradient(180deg, var(--surface-1) 0%, rgba(29, 158, 117, 0.03) 100%);
}

.guide-card-hd {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.guide-card-title {
  display: flex;
  align-items: center;
  gap: 9px;
  font-size: 14.5px;
  font-weight: 600;
  color: var(--text-primary);
}

.guide-card-badge {
  font-size: 11px;
  font-family: var(--font-mono);
  padding: 2px 7px;
  border-radius: 4px;
  background: var(--surface-2);
  border: 0.5px solid var(--border);
  color: var(--text-secondary);
  white-space: nowrap;
}

.guide-card-badge.badge-teal {
  background: rgba(16, 185, 129, 0.12);
  border-color: rgba(16, 185, 129, 0.3);
  color: var(--teal);
  font-weight: 600;
}

.guide-card-desc {
  font-size: 12.5px;
  color: var(--text-secondary);
  line-height: 1.55;
}

.guide-code-block {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.guide-code-lbl {
  font-size: 11px;
  font-weight: 500;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.guide-code-box {
  background: var(--surface-2);
  border: 0.5px solid var(--border);
  border-radius: 6px;
  padding: 8px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: var(--text-primary);
  transition: border-color 0.15s ease, background-color 0.15s ease;
  cursor: pointer;
}

.guide-code-box:hover {
  border-color: var(--teal);
  background: var(--surface-hover);
}

.guide-code-box code {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
  font-family: inherit;
}

.guide-copy-btn {
  background: var(--surface-1);
  border: 0.5px solid var(--border);
  border-radius: 4px;
  padding: 3px 8px;
  font-size: 10.5px;
  font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  transition: background-color 0.12s ease, border-color 0.12s ease, color 0.12s ease;
  flex-shrink: 0;
}

.guide-copy-btn:hover {
  background: var(--teal);
  color: #ffffff;
  border-color: var(--teal);
}

.guide-notes {
  font-size: 11.5px;
  color: var(--text-muted);
  line-height: 1.5;
  border-left: 2px solid var(--teal);
  padding-left: 10px;
  margin-top: 2px;
}

.btn-copy-cat {
  background: var(--surface-2);
  border: 0.5px solid var(--border);
  border-radius: 4px;
  padding: 2px 7px;
  font-size: 11px;
  color: var(--text-secondary);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  transition: color 0.12s ease, border-color 0.12s ease;
}

.btn-copy-cat:hover {
  color: var(--teal);
  border-color: var(--teal);
}

/* ==========================================================================
   FEATURE 3: Floating Agent Stack Tray & Modal Panel
   ========================================================================== */
.agent-stack-tray {
  position: fixed;
  bottom: 24px;
  right: 28px;
  z-index: 95;
  font-family: inherit;
  transition: transform 0.22s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.2s ease;
}

@media (max-width: 768px) {
  .agent-stack-tray {
    bottom: calc(56px + 14px + env(safe-area-inset-bottom, 0px));
    right: 14px;
    left: 14px;
  }
}

.stack-tray-dock {
  background: var(--surface-1);
  border: 0.5px solid var(--border-strong);
  border-radius: 9999px;
  padding: 8px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.14), 0 1px 3px rgba(0, 0, 0, 0.08);
  cursor: pointer;
  user-select: none;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  transition: border-color 0.15s ease, transform 0.15s ease, box-shadow 0.15s ease;
}

.stack-tray-dock:hover {
  border-color: var(--teal);
  transform: translateY(-1px);
  box-shadow: 0 6px 22px rgba(0, 0, 0, 0.18), 0 0 0 2px var(--teal-tint);
}

.stack-tray-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

.stack-icon-pill {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--teal);
  color: #ffffff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  flex-shrink: 0;
}

.stack-tray-text {
  display: flex;
  flex-direction: column;
}

.stack-tray-title {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-primary);
  line-height: 1.2;
}

.stack-tray-sub {
  font-size: 11px;
  color: var(--text-muted);
  line-height: 1.2;
}

.stack-tray-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.stack-count-badge {
  background: var(--teal-tint);
  color: var(--teal);
  border: 0.5px solid var(--teal);
  padding: 1px 7px;
  border-radius: 9999px;
  font-size: 11px;
  font-weight: 500;
}

.stack-tray-chevron {
  font-size: 14px;
  color: var(--text-muted);
  transition: transform 0.2s ease;
}

.agent-stack-tray.expanded .stack-tray-chevron {
  transform: rotate(180deg);
}

.stack-tray-panel {
  position: absolute;
  bottom: calc(100% + 12px);
  right: 0;
  width: 440px;
  max-width: calc(100vw - 28px);
  max-height: 520px;
  background: var(--surface-2);
  border: 0.5px solid var(--border-strong);
  border-radius: 12px;
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.22);
  display: none;
  flex-direction: column;
  overflow: hidden;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  animation: stackPanelPop 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes stackPanelPop {
  from { opacity: 0; transform: translateY(8px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.agent-stack-tray.expanded .stack-tray-panel {
  display: flex;
}

.stack-panel-hd {
  padding: 14px 16px;
  background: var(--surface-1);
  border-bottom: 0.5px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.stack-panel-title {
  display: flex;
  flex-direction: column;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-primary);
}

.stack-panel-sub {
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 400;
}

.stack-items-list {
  padding: 10px 14px;
  overflow-y: auto;
  max-height: 240px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.stack-item-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 10px;
  background: var(--surface-1);
  border: 0.5px solid var(--border);
  border-radius: 6px;
  transition: border-color 0.12s ease;
}

.stack-item-row:hover {
  border-color: var(--teal);
}

.stack-item-info {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.stack-item-name {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.stack-item-cat {
  font-size: 11px;
  color: var(--text-muted);
}

.stack-item-del {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px;
  border-radius: 4px;
  font-size: 14px;
  transition: color 0.12s ease, background 0.12s ease;
}

.stack-item-del:hover {
  color: #e05252;
  background: rgba(224, 82, 82, 0.1);
}

.stack-panel-footer {
  padding: 12px 14px;
  background: var(--surface-1);
  border-top: 0.5px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.stack-export-actions {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.stack-btn {
  width: 100%;
  padding: 7px 12px;
  border-radius: 6px;
  font-size: 11.5px;
  font-weight: 500;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  background: var(--surface-2);
  border: 0.5px solid var(--border-strong);
  color: var(--text-primary);
  transition: background-color 0.12s ease, border-color 0.12s ease, color 0.12s ease;
  font-family: inherit;
}

.stack-btn:hover {
  border-color: var(--teal);
  color: var(--teal);
}

.stack-btn-primary {
  background: var(--teal);
  color: #ffffff;
  border-color: var(--teal);
}

.stack-btn-primary:hover {
  background: var(--teal-dark);
  border-color: var(--teal-dark);
  color: #ffffff;
}

/* Toggle stack button on cards and rows */
.btn-stack-toggle {
  background: var(--surface-2);
  border: 0.5px solid var(--border);
  border-radius: 4px;
  padding: 3px 8px;
  font-size: 11px;
  color: var(--text-secondary);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  transition: background-color 0.12s ease, border-color 0.12s ease, color 0.12s ease;
  font-family: inherit;
}

.btn-stack-toggle:hover {
  border-color: var(--teal);
  color: var(--teal);
}

.btn-stack-toggle.in-stack {
  background: var(--teal-tint);
  border-color: var(--teal);
  color: var(--teal);
  font-weight: 500;
}

/* ==========================================================================
   FEATURE 4: Detail Drawer Tabs & Prompt Simulator
   ========================================================================== */
.drawer-tabs-bar {
  display: flex;
  border-bottom: 0.5px solid var(--border);
  background: var(--surface-1);
  padding: 0 16px;
  gap: 8px;
}

.drawer-tab-btn {
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  padding: 10px 14px;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-muted);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: color 0.12s ease, border-color 0.12s ease;
  font-family: inherit;
}

.drawer-tab-btn:hover {
  color: var(--text-primary);
}

.drawer-tab-btn.active {
  color: var(--teal);
  border-bottom-color: var(--teal);
}

.prompt-sim-wrap {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.prompt-input-row {
  display: flex;
  flex-direction: column;
  gap: 6px;
  background: var(--surface-1);
  border: 0.5px solid var(--border);
  border-radius: 8px;
  padding: 12px;
}

.prompt-input-row label {
  font-size: 11.5px;
  font-weight: 500;
  color: var(--text-secondary);
}

.prompt-input-box {
  width: 100%;
  background: var(--surface-2);
  border: 0.5px solid var(--border-strong);
  border-radius: 6px;
  padding: 8px 10px;
  font-size: 12px;
  color: var(--text-primary);
  font-family: inherit;
  outline: none;
  transition: border-color 0.12s ease;
}

.prompt-input-box:focus {
  border-color: var(--teal);
  box-shadow: 0 0 0 2px var(--teal-tint);
}

.prompt-template-card {
  background: var(--surface-1);
  border: 0.5px solid var(--border);
  border-radius: 8px;
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.prompt-template-hd {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.prompt-template-title {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-primary);
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.prompt-code-box {
  background: var(--surface-0);
  border: 0.5px solid var(--border);
  border-radius: 6px;
  padding: 10px 12px;
  font-family: var(--font-mono, monospace);
  font-size: 11.5px;
  color: var(--text-primary);
  white-space: pre-wrap;
  word-break: break-word;
  line-height: 1.5;
  user-select: all;
  position: relative;
}

/* ==========================================================================
   FEATURE 5: Side-by-Side Skill Comparator Matrix Modal
   ========================================================================== */
.comparator-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(4px);
  z-index: 105;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.2s ease, visibility 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.comparator-backdrop.open {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.comparator-panel {
  background: var(--surface-2);
  border: 0.5px solid var(--border-strong);
  border-radius: 14px;
  width: 920px;
  max-width: 96vw;
  max-height: 88vh;
  box-shadow: 0 16px 44px rgba(0, 0, 0, 0.28);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: compScaleIn 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes compScaleIn {
  from { opacity: 0; transform: scale(0.96); }
  to { opacity: 1; transform: scale(1); }
}

.comparator-hd {
  padding: 16px 20px;
  background: var(--surface-1);
  border-bottom: 0.5px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.comparator-title-group h2 {
  font-size: 15px;
  font-weight: 500;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 8px;
}

.comparator-title-group .sub {
  font-size: 11.5px;
  color: var(--text-muted);
  margin-top: 2px;
}

.comparator-body {
  padding: 20px;
  overflow-y: auto;
}

.comparator-matrix-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}

.comparator-matrix-table th,
.comparator-matrix-table td {
  padding: 10px 14px;
  border-bottom: 0.5px solid var(--border);
  text-align: left;
  vertical-align: top;
}

.comparator-matrix-table th:first-child,
.comparator-matrix-table td:first-child {
  width: 160px;
  font-weight: 500;
  color: var(--text-secondary);
  background: var(--surface-1);
}

/* ==========================================================================
   FEATURE 6: Category Quick Action Buttons
   ========================================================================== */
.cat-quick-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 10px;
  flex-wrap: wrap;
}

.cat-quick-btn {
  background: var(--surface-2);
  border: 0.5px solid var(--border);
  border-radius: 4px;
  padding: 3px 8px;
  font-size: 11px;
  color: var(--text-secondary);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  transition: background-color 0.12s ease, border-color 0.12s ease, color 0.12s ease;
  font-family: inherit;
}

.cat-quick-btn:hover {
  border-color: var(--teal);
  color: var(--teal);
}

.cat-quick-btn-primary {
  background: var(--teal-tint);
  border-color: var(--teal);
  color: var(--teal);
  font-weight: 500;
}

.cat-quick-btn-primary:hover {
  background: var(--teal);
  color: #ffffff;
}
