/* ============================================
   PROBLEMS — LeetCode-style layout
   Three-column: left sidebar | main | right sidebar
   Tag cloud, company sidebar, detail two-panel,
   markdown solutions, status tracking, discussion
   ============================================ */

/* --- Role Badges --- */
.role-badge {
  display: inline-block;
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  padding: 1px 6px;
  border-radius: 4px;
  vertical-align: middle;
  margin-right: 4px;
}
.role-badge--qr {
  background: rgba(99, 102, 241, 0.18);
  color: #818cf8;
  border: 1px solid rgba(99, 102, 241, 0.3);
}
.role-badge--qt {
  background: rgba(34, 197, 94, 0.18);
  color: #4ade80;
  border: 1px solid rgba(34, 197, 94, 0.3);
}
.role-badge--swe {
  background: rgba(251, 146, 60, 0.18);
  color: #fb923c;
  border: 1px solid rgba(251, 146, 60, 0.3);
}

/* --- Three-Column Layout --- */
.problems-layout {
  display: grid;
  grid-template-columns: 240px 1fr 220px;
  gap: var(--space-5);
  align-items: start;
}

/* --- Left Sidebar --- */
.problems-sidebar {
  position: sticky;
  top: calc(var(--nav-height) + var(--space-4));
  max-height: calc(100vh - var(--nav-height) - var(--space-8));
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,0.1) transparent;
}

.sidebar__title {
  font-size: var(--text-xs);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  margin-bottom: var(--space-2);
  font-weight: var(--font-semibold);
  padding: 0 var(--space-2);
}

.sidebar__categories {
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.sidebar__cat-btn {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 6px 10px;
  border: none;
  background: none;
  color: var(--text-secondary);
  font-size: var(--text-sm);
  font-family: var(--font-sans);
  cursor: pointer;
  border-radius: var(--radius-sm);
  transition: all var(--transition-fast);
  text-align: left;
  gap: var(--space-2);
}

.sidebar__cat-btn:hover {
  background: rgba(255,255,255,0.04);
  color: var(--text-primary);
}

.sidebar__cat-btn--active {
  background: rgba(99,102,241,0.12);
  color: var(--accent-primary);
  font-weight: var(--font-medium);
}

.sidebar__cat-icon {
  margin-right: 6px;
  font-size: 0.85em;
}

.sidebar__cat-count {
  font-size: var(--text-xs);
  font-family: var(--font-mono);
  background: rgba(255,255,255,0.06);
  color: var(--text-muted);
  padding: 1px 7px;
  border-radius: var(--radius-full);
  min-width: 22px;
  text-align: center;
}

.sidebar__divider {
  height: 1px;
  background: var(--border-color);
  margin: var(--space-3) var(--space-2);
}

/* --- Right Sidebar (Companies) --- */
.problems-sidebar-right {
  position: sticky;
  top: calc(var(--nav-height) + var(--space-4));
  max-height: calc(100vh - var(--nav-height) - var(--space-8));
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,0.1) transparent;
}

.sidebar-right__search {
  display: block;
  width: 100%;
  padding: 5px 10px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  background: rgba(255,255,255,0.03);
  color: var(--text-primary);
  font-size: 11px;
  font-family: var(--font-sans);
  margin-bottom: var(--space-2);
  transition: border-color var(--transition-fast);
}

.sidebar-right__search::placeholder {
  color: var(--text-muted);
}

.sidebar-right__search:focus {
  outline: none;
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 2px rgba(99,102,241,0.1);
}

.sidebar-right__companies {
  display: flex;
  flex-direction: column;
  gap: 1px;
}

/* Hide inline company bar on desktop (right sidebar visible) */
@media (min-width: 1101px) {
  #company-bar-container {
    display: none;
  }
}

/* --- Header --- */
.problems-header {
  margin-bottom: var(--space-4);
}

.problems-header__top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  margin-bottom: var(--space-1);
}

.problems-header__title {
  font-size: var(--text-2xl);
  font-weight: var(--font-bold);
  letter-spacing: -0.02em;
}

.problems-header__actions {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  flex-shrink: 0;
}

.problems-header__meta {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  flex-wrap: wrap;
}

.problems-header__subtitle {
  font-size: var(--text-sm);
  color: var(--text-muted);
}

/* --- Stub Toggle --- */
.stub-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: var(--text-xs);
  color: var(--text-muted);
  cursor: pointer;
  user-select: none;
}

.stub-toggle input[type="checkbox"] {
  accent-color: var(--accent-primary);
  width: 14px;
  height: 14px;
  cursor: pointer;
}

/* --- Mobile Category Selector --- */
.mobile-cat-filter {
  display: none;
}

/* --- Tag Cloud --- */
.tag-cloud {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: var(--space-3) var(--space-4);
  margin-bottom: var(--space-4);
}

.tag-cloud__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-2);
}

.tag-cloud__title {
  font-size: var(--text-xs);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  font-weight: var(--font-semibold);
}

.tag-cloud__clear {
  font-size: var(--text-xs);
  color: var(--accent-primary);
  background: none;
  border: none;
  cursor: pointer;
  font-family: var(--font-sans);
  padding: 2px 6px;
  border-radius: var(--radius-sm);
}

.tag-cloud__clear:hover {
  background: rgba(99,102,241,0.1);
}

.tag-cloud__pills,
.tag-cloud__expanded {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.tag-cloud__expanded {
  margin-top: 5px;
}

.tag-cloud__pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: var(--radius-full);
  background: rgba(255,255,255,0.04);
  border: 1px solid transparent;
  color: var(--text-secondary);
  font-size: 11px;
  font-family: var(--font-sans);
  cursor: pointer;
  transition: all var(--transition-fast);
  white-space: nowrap;
}

.tag-cloud__pill:hover {
  background: rgba(255,255,255,0.08);
  color: var(--text-primary);
  border-color: rgba(255,255,255,0.08);
}

.tag-cloud__pill--active {
  background: rgba(99,102,241,0.15);
  border-color: rgba(99,102,241,0.3);
  color: var(--accent-primary);
  font-weight: var(--font-medium);
}

.tag-cloud__count {
  font-size: 9px;
  color: var(--text-muted);
  font-family: var(--font-mono);
}

.tag-cloud__pill--active .tag-cloud__count {
  color: rgba(99,102,241,0.7);
}

.tag-cloud__expand {
  padding: 3px 10px;
  border-radius: var(--radius-full);
  background: none;
  border: 1px dashed rgba(255,255,255,0.12);
  color: var(--accent-primary);
  font-size: 11px;
  font-family: var(--font-sans);
  cursor: pointer;
  transition: all var(--transition-fast);
  white-space: nowrap;
}

.tag-cloud__expand:hover {
  background: rgba(99,102,241,0.06);
  border-color: rgba(99,102,241,0.3);
}

/* --- Company Bar (Horizontal) --- */
.company-bar {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: var(--space-3) var(--space-4);
  margin-bottom: var(--space-4);
}

.company-bar__header {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  margin-bottom: var(--space-2);
}

.company-bar__title {
  font-size: var(--text-xs);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  font-weight: var(--font-semibold);
  white-space: nowrap;
}

.company-bar__clear {
  font-size: var(--text-xs);
  color: var(--accent-primary);
  background: none;
  border: none;
  cursor: pointer;
  font-family: var(--font-sans);
  padding: 2px 6px;
  border-radius: var(--radius-sm);
  white-space: nowrap;
}

.company-bar__clear:hover {
  background: rgba(99,102,241,0.1);
}

.company-bar__search {
  flex: 1;
  min-width: 0;
  max-width: 160px;
  padding: 3px 10px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-full);
  background: rgba(255,255,255,0.03);
  color: var(--text-primary);
  font-size: 11px;
  font-family: var(--font-sans);
  transition: border-color var(--transition-fast);
}

.company-bar__search::placeholder {
  color: var(--text-muted);
}

.company-bar__search:focus {
  outline: none;
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 2px rgba(99,102,241,0.1);
}

.company-bar__scroll {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.company-bar__arrow {
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-full);
  background: rgba(255,255,255,0.03);
  color: var(--text-secondary);
  font-size: 16px;
  cursor: pointer;
  transition: all var(--transition-fast);
  font-family: var(--font-sans);
}

.company-bar__arrow:hover {
  background: rgba(99,102,241,0.08);
  border-color: rgba(99,102,241,0.3);
  color: var(--accent-primary);
}

.company-bar__pills {
  flex: 1;
  display: flex;
  gap: 6px;
  overflow-x: auto;
  scroll-behavior: smooth;
  padding: 2px 0;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.company-bar__pills::-webkit-scrollbar {
  display: none;
}

.company-bar__pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 12px;
  border-radius: var(--radius-full);
  background: rgba(34,197,94,0.06);
  border: 1px solid rgba(34,197,94,0.12);
  color: var(--text-secondary);
  font-size: 11px;
  font-family: var(--font-sans);
  cursor: pointer;
  transition: all var(--transition-fast);
  white-space: nowrap;
  flex-shrink: 0;
}

.company-bar__pill:hover {
  background: rgba(34,197,94,0.12);
  border-color: rgba(34,197,94,0.25);
  color: #22c55e;
}

.company-bar__pill--active {
  background: rgba(34,197,94,0.18);
  border-color: rgba(34,197,94,0.4);
  color: #22c55e;
  font-weight: var(--font-medium);
}

.company-bar__count {
  font-size: 9px;
  color: var(--text-muted);
  font-family: var(--font-mono);
}

.company-bar__pill--active .company-bar__count {
  color: rgba(34,197,94,0.7);
}

/* --- Filter / Search Bar --- */
.pf-bar {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  margin-bottom: var(--space-4);
}

.pf-bar__search {
  flex: 1;
  padding: 8px 14px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  background: var(--bg-card);
  color: var(--text-primary);
  font-size: var(--text-sm);
  font-family: var(--font-sans);
  transition: border-color var(--transition-fast);
}

.pf-bar__search::placeholder {
  color: var(--text-muted);
}

.pf-bar__search:focus {
  outline: none;
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 3px rgba(99,102,241,0.1);
}

.pf-bar__right {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  flex-shrink: 0;
}

.pf-bar__sort {
  padding: 6px 10px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  background: var(--bg-card);
  color: var(--text-secondary);
  font-size: var(--text-xs);
  font-family: var(--font-sans);
  cursor: pointer;
  transition: border-color var(--transition-fast);
}

.pf-bar__sort:focus {
  outline: none;
  border-color: var(--accent-primary);
}

.pf-bar__count {
  font-size: var(--text-xs);
  color: var(--text-muted);
  font-family: var(--font-mono);
  white-space: nowrap;
}

.pf-bar__clear-all {
  padding: 4px 10px;
  border-radius: var(--radius-full);
  border: 1px solid rgba(239,68,68,0.3);
  background: rgba(239,68,68,0.08);
  color: #ef4444;
  font-size: var(--text-xs);
  font-family: var(--font-sans);
  cursor: pointer;
  transition: all var(--transition-fast);
  white-space: nowrap;
}

.pf-bar__clear-all:hover {
  background: rgba(239,68,68,0.15);
  border-color: rgba(239,68,68,0.5);
}

/* --- Problem Table --- */
.problem-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
}

.problem-table thead th {
  position: sticky;
  top: var(--nav-height);
  z-index: 5;
  background: var(--bg-primary);
  font-size: var(--text-xs);
  font-weight: var(--font-semibold);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  text-align: left;
  padding: 8px 12px;
  border-bottom: 1px solid var(--border-color);
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
}

.problem-table thead th:hover {
  color: var(--text-primary);
}

.th-status { width: 36px; text-align: center; cursor: default; }
.th-num { width: 50px; }
.th-cat { width: 140px; }
.th-diff { width: 90px; text-align: center; }
.th-type { width: 100px; }

.problem-table tbody tr {
  border-bottom: 1px solid rgba(255,255,255,0.04);
  transition: background var(--transition-fast);
}

.problem-table tbody tr:nth-child(even) {
  background: rgba(255,255,255,0.012);
}

.problem-table tbody tr:hover {
  background: var(--bg-card-hover);
}

.problem-table td {
  padding: 10px 12px;
  font-size: var(--text-sm);
  vertical-align: middle;
}

.td-status {
  text-align: center;
  font-size: 14px;
  width: 36px;
}

.td-num {
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: var(--text-xs);
}

.td-title-link {
  color: var(--text-primary);
  text-decoration: none;
  font-weight: var(--font-medium);
  font-size: var(--text-sm);
  display: inline;
  margin-bottom: 2px;
}

.td-title-link:hover {
  color: var(--accent-primary);
}

.td-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 3px;
}

.td-tag {
  font-size: 10px;
  color: var(--text-muted);
  padding: 1px 6px;
  background: rgba(255,255,255,0.04);
  border-radius: var(--radius-full);
  opacity: 0.7;
}

.td-diff {
  text-align: center;
}

.td-type {
  font-size: var(--text-xs);
  color: var(--text-secondary);
}

.td-rating {
  text-align: center;
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  color: var(--text-secondary);
}

/* --- Stub Rows --- */
.problem-row--stub {
  opacity: 0.55;
}

.problem-row--stub:hover {
  opacity: 0.8;
}

.stub-badge {
  display: inline-block;
  font-size: 9px;
  font-weight: var(--font-semibold);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #f59e0b;
  background: rgba(245,158,11,0.12);
  border: 1px solid rgba(245,158,11,0.2);
  padding: 1px 6px;
  border-radius: var(--radius-full);
  margin-left: 6px;
  vertical-align: middle;
}

/* --- Difficulty Dots --- */
.diff-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-right: 6px;
  vertical-align: middle;
}

.diff-easy { background: #22c55e; }
.diff-medium { background: #f59e0b; }
.diff-hard { background: #ef4444; }

.diff-label {
  font-size: var(--text-xs);
  text-transform: capitalize;
}

/* --- Category Pill --- */
.cat-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 10px;
  border-radius: var(--radius-full);
  font-size: var(--text-xs);
  font-weight: var(--font-medium);
  white-space: nowrap;
}

/* --- Sort Arrow --- */
.sort-arrow {
  font-size: 10px;
  color: var(--text-muted);
  margin-left: 4px;
}

.sort-arrow--active {
  color: var(--accent-primary);
}

/* --- Badges --- */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 10px;
  border-radius: var(--radius-full);
  font-size: var(--text-xs);
  font-weight: var(--font-semibold);
  text-transform: capitalize;
}

.badge--easy {
  background: rgba(34,197,94,0.12);
  color: #22c55e;
}

.badge--medium {
  background: rgba(245,158,11,0.12);
  color: #f59e0b;
}

.badge--hard {
  background: rgba(239,68,68,0.12);
  color: #ef4444;
}

/* --- Badge small variant --- */
.badge--sm {
  font-size: 10px;
  padding: 1px 6px;
}

/* --- Filter Chips (empty state) --- */
.empty-state__chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: center;
  margin-top: var(--space-3);
  margin-bottom: var(--space-3);
}

.filter-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 12px;
  border-radius: var(--radius-full);
  background: rgba(99,102,241,0.1);
  border: 1px solid rgba(99,102,241,0.25);
  color: var(--accent-primary);
  font-size: var(--text-xs);
  font-family: var(--font-sans);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.filter-chip:hover {
  background: rgba(239,68,68,0.1);
  border-color: rgba(239,68,68,0.3);
  color: #ef4444;
}

/* --- Transition on update --- */
.problems-main--updating {
  opacity: 0.4;
  pointer-events: none;
  transition: opacity 80ms ease;
}

/* ============================================
   DETAIL VIEW — Two-panel layout
   Left: statement (sticky) | Right: solution
   ============================================ */

.breadcrumbs {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--text-sm);
  color: var(--text-muted);
  margin-bottom: var(--space-5);
}

.breadcrumbs a {
  color: var(--text-secondary);
  text-decoration: none;
}

.breadcrumbs a:hover {
  color: var(--accent-primary);
}

.breadcrumbs__sep {
  color: var(--text-muted);
  opacity: 0.5;
}

/* Two-panel detail layout */
.problem-detail-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-6);
  align-items: start;
}

.problem-detail-left {
  position: sticky;
  top: calc(var(--nav-height) + var(--space-4));
  max-height: calc(100vh - var(--nav-height) - var(--space-8));
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,0.1) transparent;
}

.problem-detail-right {
  min-width: 0;
}

/* Header */
.problem-detail__header {
  margin-bottom: var(--space-4);
}

.problem-detail__meta-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-bottom: var(--space-3);
}

.problem-detail__id-badge {
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  font-weight: var(--font-bold);
  color: var(--accent-primary);
  background: rgba(99,102,241,0.1);
  padding: 2px 10px;
  border-radius: var(--radius-full);
  border: 1px solid rgba(99,102,241,0.2);
}

.problem-detail__type-badge {
  font-size: var(--text-xs);
  padding: 2px 8px;
  border-radius: var(--radius-full);
  background: rgba(255,255,255,0.06);
  color: var(--text-secondary);
}

.problem-detail__rating {
  font-size: var(--text-xs);
  font-family: var(--font-mono);
  color: var(--text-muted);
}

.problem-detail__title {
  font-size: var(--text-xl);
  font-weight: var(--font-bold);
  letter-spacing: -0.02em;
  line-height: 1.3;
  margin-bottom: var(--space-3);
}

.problem-detail__tags-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: var(--space-2);
}

.detail-tag {
  font-size: 11px;
  padding: 2px 10px;
  border-radius: var(--radius-full);
  background: rgba(255,255,255,0.05);
  color: var(--text-secondary);
  text-decoration: none;
  border: 1px solid rgba(255,255,255,0.06);
  transition: all var(--transition-fast);
}

.detail-tag:hover {
  background: rgba(99,102,241,0.1);
  color: var(--accent-primary);
  border-color: rgba(99,102,241,0.2);
}

.problem-detail__companies {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: var(--space-2);
}

.company-tag {
  font-size: 11px;
  padding: 2px 10px;
  border-radius: var(--radius-full);
  background: rgba(34,197,94,0.08);
  color: #22c55e;
  text-decoration: none;
  border: 1px solid rgba(34,197,94,0.15);
  transition: all var(--transition-fast);
}

.company-tag:hover {
  background: rgba(34,197,94,0.15);
}

/* --- Status Actions (Detail View) --- */
.problem-detail__status-actions {
  display: none; /* Replaced by .problem-action-bar */
}

.status-btn {
  padding: 5px 14px;
  border-radius: var(--radius-full);
  border: 1px solid var(--border-color);
  background: rgba(255,255,255,0.03);
  color: var(--text-secondary);
  font-size: var(--text-xs);
  font-family: var(--font-sans);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.status-btn:hover {
  background: rgba(255,255,255,0.06);
  color: var(--text-primary);
  border-color: rgba(255,255,255,0.15);
}

.status-btn--active.status-btn--solved {
  background: rgba(34,197,94,0.12);
  border-color: rgba(34,197,94,0.3);
  color: #22c55e;
  font-weight: var(--font-medium);
}

.status-btn--active.status-btn--attempted {
  background: rgba(245,158,11,0.12);
  border-color: rgba(245,158,11,0.3);
  color: #f59e0b;
  font-weight: var(--font-medium);
}

/* Statement card */
.problem-detail__statement-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.problem-detail__statement-label {
  padding: var(--space-2) var(--space-4);
  font-size: var(--text-xs);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  font-weight: var(--font-semibold);
  background: rgba(255,255,255,0.02);
  border-bottom: 1px solid var(--border-color);
}

.problem-detail__statement {
  padding: var(--space-5) var(--space-4);
  line-height: 1.8;
  font-size: var(--text-sm);
}

/* --- Solution Gate (confirm before reveal) --- */
.solution-gate {
  text-align: center;
  padding: var(--space-8) var(--space-6);
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  position: relative;
}
.solution-gate__icon {
  color: var(--text-muted);
  margin-bottom: var(--space-3);
}
.solution-gate__title {
  font-size: var(--text-lg);
  font-weight: var(--font-semibold);
  color: var(--text-bright);
  margin-bottom: var(--space-2);
}
.solution-gate__desc {
  font-size: var(--text-sm);
  color: var(--text-secondary);
  max-width: 400px;
  margin: 0 auto var(--space-5);
  line-height: 1.5;
}
.solution-gate__btn {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: 8px 20px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-full);
  color: var(--accent);
  font-size: var(--text-sm);
  font-weight: var(--font-semibold);
  cursor: pointer;
  transition: all 0.15s ease;
  font-family: inherit;
}
.solution-gate__btn:hover {
  background: var(--accent-light);
  border-color: var(--accent-border);
  box-shadow: 0 2px 8px rgba(76, 139, 245, 0.2);
}

/* --- Detail Sections (Hints, Intuition, Solution, Discussion) --- */
.detail-section {
  margin-bottom: var(--space-4);
}

.detail-section__label {
  font-size: var(--text-xs);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  font-weight: var(--font-semibold);
  margin-bottom: var(--space-2);
}

.collapsible-toggle {
  width: 100%;
  text-align: left;
  padding: var(--space-3) var(--space-4);
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: var(--text-sm);
  font-weight: var(--font-semibold);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: var(--space-2);
  transition: all var(--transition-fast);
}

.collapsible-toggle:hover {
  background: var(--bg-card-hover);
}

.collapsible-toggle--open {
  border-bottom-left-radius: 0;
  border-bottom-right-radius: 0;
  border-bottom-color: transparent;
}

.collapsible-toggle__arrow {
  font-size: 10px;
  color: var(--text-muted);
  transition: transform var(--transition-fast);
}

.collapsible-content {
  display: none;
  padding: var(--space-5) var(--space-4);
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-top: none;
  border-radius: 0 0 var(--radius-md) var(--radius-md);
  line-height: 1.8;
}

.collapsible-content--visible {
  display: block;
}

/* Intuition toggle — teal accent */
.collapsible-toggle--intuition {
  background: rgba(20,184,166,0.05);
  border-color: rgba(20,184,166,0.2);
  color: #14b8a6;
}

.collapsible-toggle--intuition:hover {
  background: rgba(20,184,166,0.08);
}

.intuition-content {
  background: rgba(20,184,166,0.03);
  border-color: rgba(20,184,166,0.15);
}

/* Solution toggle */
.collapsible-toggle--solution {
  background: rgba(99,102,241,0.05);
  border-color: rgba(99,102,241,0.2);
  color: var(--accent-primary);
}

.collapsible-toggle--solution:hover {
  background: rgba(99,102,241,0.08);
}

.solution-content {
  border-color: rgba(99,102,241,0.15);
  position: relative;
}

.solution-watermark {
  margin-top: var(--space-4);
  padding-top: var(--space-3);
  border-top: 1px solid var(--border-color);
  text-align: right;
  font-size: 0.75rem;
  color: var(--text-tertiary, #999);
  letter-spacing: 0.03em;
  user-select: none;
  opacity: 0.6;
}

.hint-item {
  margin-bottom: var(--space-2);
}

/* --- Discussion Section --- */
.detail-section--discussion {
  margin-top: var(--space-4);
}

.discussion-entry {
  padding: var(--space-3);
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  margin-bottom: var(--space-2);
}

.discussion-entry__text {
  font-size: var(--text-sm);
  line-height: 1.7;
  margin-bottom: var(--space-2);
}

.discussion-entry__meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.discussion-entry__time {
  font-size: var(--text-xs);
  color: var(--text-muted);
  font-family: var(--font-mono);
}

.discussion-entry__delete {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 12px;
  cursor: pointer;
  padding: 2px 6px;
  border-radius: var(--radius-sm);
  transition: all var(--transition-fast);
}

.discussion-entry__delete:hover {
  color: #ef4444;
  background: rgba(239,68,68,0.1);
}

.discussion-input-row {
  display: flex;
  gap: var(--space-2);
  align-items: flex-start;
  margin-top: var(--space-2);
}

.discussion-input {
  flex: 1;
  padding: var(--space-2) var(--space-3);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  background: var(--bg-card);
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: var(--text-sm);
  line-height: 1.5;
  resize: vertical;
  min-height: 36px;
  transition: border-color var(--transition-fast);
}

.discussion-input:focus {
  outline: none;
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 3px rgba(99,102,241,0.1);
}

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

.discussion-empty {
  color: var(--text-muted);
  font-style: italic;
  font-size: var(--text-sm);
  padding: var(--space-2) 0;
}

/* --- Related Topics --- */
.detail-related {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: var(--space-3) var(--space-4);
  margin-top: var(--space-4);
}

.detail-related__title {
  font-size: var(--text-xs);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  font-weight: var(--font-semibold);
  margin-bottom: var(--space-2);
}

.detail-related__tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

/* --- Top Nav Bar (Back + Prev/Next) --- */
.problem-detail__nav-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-3) 0;
  margin-bottom: var(--space-4);
  border-bottom: 1px solid var(--border-color);
}

.problem-nav-back {
  font-size: var(--text-sm);
  color: var(--text-secondary);
  text-decoration: none;
  font-weight: var(--font-medium);
  transition: color var(--transition-fast);
}
.problem-nav-back:hover {
  color: var(--accent-primary);
}

.problem-detail__nav-arrows {
  display: flex;
  gap: var(--space-2);
}

.problem-nav-arrow {
  font-size: var(--text-sm);
  color: var(--text-secondary);
  text-decoration: none;
  padding: var(--space-1) var(--space-3);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  transition: all var(--transition-fast);
}
.problem-nav-arrow:hover {
  color: var(--accent-primary);
  border-color: rgba(99,102,241,0.3);
  background: rgba(99,102,241,0.05);
}
.problem-nav-arrow--disabled {
  opacity: 0.3;
  pointer-events: none;
}
.problem-nav-position {
  font-size: var(--text-xs);
  color: var(--text-muted);
  padding: var(--space-1) var(--space-2);
  white-space: nowrap;
  align-self: center;
}

/* --- Similar Problems --- */
.detail-section--similar {
  margin-top: var(--space-4);
}

.similar-problems {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.similar-problem-card {
  display: block;
  padding: var(--space-3);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  background: var(--bg-card);
  text-decoration: none;
  transition: all var(--transition-fast);
}
.similar-problem-card:hover {
  border-color: rgba(99,102,241,0.4);
  background: rgba(99,102,241,0.03);
}

.similar-problem-card__top {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 4px;
  flex-wrap: wrap;
}

.similar-problem-card__id {
  font-size: var(--text-xs);
  color: var(--text-muted);
  font-weight: var(--font-semibold);
}

.similar-problem-card__title {
  font-size: var(--text-sm);
  color: var(--text-primary);
  font-weight: var(--font-medium);
  line-height: 1.4;
}

.similar-problem-card__tags {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 4px;
}

/* Similarity score */
.similar-problem-card__score {
  margin-left: auto;
  font-size: 11px;
  font-weight: 600;
  color: var(--accent);
  white-space: nowrap;
}

/* Small category pill for similar cards */
.cat-pill--sm {
  font-size: 10px;
  padding: 1px 6px;
}

/* "See more" link */
.similar-problems__see-more {
  display: inline-block;
  margin-top: var(--space-3);
  font-size: var(--text-sm);
  color: var(--accent);
  text-decoration: none;
  font-weight: var(--font-medium);
  transition: color var(--transition-fast);
}
.similar-problems__see-more:hover {
  color: var(--accent-hover, var(--accent));
  text-decoration: underline;
}

/* --- Notes --- */
.detail-section--notes {
  margin-bottom: var(--space-4);
}

.problem-notes__textarea {
  width: 100%;
  min-height: 120px;
  padding: var(--space-3);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  background: var(--bg-card);
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: var(--text-sm);
  line-height: 1.6;
  resize: vertical;
  transition: border-color var(--transition-fast);
}
.problem-notes__textarea:focus {
  outline: none;
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 3px rgba(99,102,241,0.1);
}
.problem-notes__textarea::placeholder {
  color: var(--text-muted);
}

.no-solution {
  color: var(--text-muted);
  font-style: italic;
  padding: var(--space-4);
  text-align: center;
}

/* ============================================
   MARKDOWN RENDERED CONTENT
   ============================================ */

.math-content .md-p {
  margin-bottom: var(--space-3);
  line-height: 1.8;
}

.math-content .md-h1,
.math-content .md-h2,
.math-content .md-h3,
.math-content .md-h4 {
  font-weight: var(--font-bold);
  letter-spacing: -0.01em;
  margin-top: var(--space-5);
  margin-bottom: var(--space-3);
}

.math-content .md-h1:first-child,
.math-content .md-h2:first-child,
.math-content .md-h3:first-child {
  margin-top: 0;
}

.math-content .md-h1 { font-size: var(--text-lg); }
.math-content .md-h2 { font-size: var(--text-base); color: var(--accent-primary); }
.math-content .md-h3 { font-size: var(--text-sm); color: var(--text-primary); }
.math-content .md-h4 { font-size: var(--text-sm); color: var(--text-secondary); }

.math-content strong {
  color: var(--text-primary);
  font-weight: var(--font-semibold);
}

.math-content em {
  color: var(--text-secondary);
  font-style: italic;
}

.math-content .md-list {
  margin: var(--space-2) 0 var(--space-4);
  padding-left: var(--space-6);
}

.math-content .md-list li {
  margin-bottom: var(--space-2);
  line-height: 1.7;
}

.math-content .md-list--ordered {
  list-style-type: decimal;
}

.math-content .md-inline-code {
  font-family: var(--font-mono);
  font-size: 0.88em;
  background: rgba(255,255,255,0.06);
  padding: 1px 6px;
  border-radius: 3px;
  color: #e879f9;
}

.math-content .md-code-container {
  margin: var(--space-3) 0;
  border-radius: var(--radius-md);
  overflow: hidden;
  border: 1px solid var(--border-color);
}

.math-content .md-code-label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  padding: var(--space-1) var(--space-3);
  background: rgba(255,255,255,0.03);
  border-bottom: 1px solid var(--border-color);
}

.math-content .md-code {
  display: block;
  padding: var(--space-3) var(--space-4);
  background: rgba(0,0,0,0.3);
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  line-height: 1.6;
  overflow-x: auto;
  margin: 0;
}

.math-content .md-blockquote {
  margin: var(--space-4) 0;
  padding: var(--space-3) var(--space-4);
  background: rgba(255,255,255,0.03);
  border-left: 3px solid var(--accent-primary);
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
  color: var(--text-secondary);
  font-style: italic;
}

.math-content .md-blockquote--tip {
  border-left-color: #22c55e;
  background: rgba(34,197,94,0.05);
}

.math-content .md-blockquote--warning {
  border-left-color: #f59e0b;
  background: rgba(245,158,11,0.05);
}

.math-content .md-blockquote--definition {
  border-left-color: #6366f1;
  background: rgba(99,102,241,0.05);
}

.math-content .md-blockquote--example {
  border-left-color: #06b6d4;
  background: rgba(6,182,212,0.05);
}

.math-content .md-table-wrap {
  overflow-x: auto;
  margin: var(--space-3) 0;
}

.math-content .md-table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--text-sm);
}

.math-content .md-table th,
.math-content .md-table td {
  padding: var(--space-2) var(--space-3);
  border: 1px solid var(--border-color);
  text-align: left;
}

.math-content .md-table th {
  background: rgba(255,255,255,0.04);
  font-weight: var(--font-semibold);
}

.math-content .md-hr {
  border: none;
  height: 1px;
  background: var(--border-color);
  margin: var(--space-5) 0;
}

.math-content .katex-display {
  margin: var(--space-4) 0;
  overflow-x: auto;
}

.math-content .katex-display > .katex {
  text-align: left;
}

/* ============================================
   RESPONSIVE
   ============================================ */

@media (max-width: 1100px) {
  .problems-layout {
    grid-template-columns: 240px 1fr;
  }
  .problems-sidebar-right {
    display: none;
  }
  /* Show inline company bar as fallback */
  #company-bar-container {
    display: block !important;
  }
}

@media (max-width: 900px) {
  .problems-layout {
    grid-template-columns: 1fr;
  }
  .problems-sidebar {
    display: none;
  }
  .problems-sidebar-right {
    display: none;
  }
  .mobile-cat-filter {
    display: block;
    margin-bottom: var(--space-4);
  }
  .mobile-cat-filter select {
    width: 100%;
    padding: 8px 12px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
    background: var(--bg-card);
    color: var(--text-primary);
    font-size: var(--text-sm);
    font-family: var(--font-sans);
  }
  .th-type, .td-type {
    display: none;
  }
  .td-tags {
    display: none;
  }
  .tag-cloud__pills {
    flex-wrap: nowrap;
    overflow-x: auto;
    padding-bottom: var(--space-2);
    -webkit-overflow-scrolling: touch;
  }
  .tag-cloud__expanded { display: none !important; }
  .tag-cloud__expand { display: none; }
  .company-bar__search { max-width: 120px; }
  .problems-header__top {
    flex-direction: column;
    align-items: flex-start;
    gap: var(--space-2);
  }
  .problems-header__actions {
    width: 100%;
    justify-content: flex-start;
  }
  .pf-bar {
    flex-wrap: wrap;
  }
  .pf-bar__search {
    min-width: 0;
  }
  .problem-detail-layout {
    grid-template-columns: 1fr;
  }
  .problem-detail-left {
    position: static;
    max-height: none;
  }
}

@media (max-width: 600px) {
  .th-cat, .td-diff {
    display: none;
  }
  .pf-bar__right {
    flex-wrap: wrap;
  }
  .company-bar__arrow {
    display: none;
  }
  .company-bar__pills {
    scrollbar-width: thin;
  }

  /* Problem table → card layout on small screens */
  .problem-table thead {
    display: none;
  }
  .problem-table tbody tr {
    display: flex;
    flex-wrap: wrap;
    padding: var(--space-3) var(--space-2);
    border-bottom: 1px solid var(--border-color);
    gap: var(--space-1) var(--space-2);
    align-items: center;
  }
  .problem-table td {
    padding: 0;
    border: none;
    background: transparent !important;
  }
  .td-status { order: -1; flex-shrink: 0; }
  .td-num { order: 0; font-size: var(--text-xs); opacity: 0.6; flex-shrink: 0; }
  .td-title-link { order: 1; width: 100%; font-size: var(--text-sm); }
  .td-tags { display: flex !important; order: 2; width: 100%; overflow: hidden; }

  /* KaTeX overflow on mobile */
  .math-content .katex-display {
    max-width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
}

/* Action bar → icons only on very small screens */
@media (max-width: 480px) {
  .problem-action-bar {
    gap: var(--space-1);
  }
  .pab__btn {
    padding: 5px 10px;
    font-size: 11px;
  }
  .pab__btn span {
    display: none;
  }
  .pab__sep {
    display: none;
  }
  .pab__icon-btn {
    width: 30px;
    height: 30px;
  }
}

/* --- Load More --- */
.load-more-bar {
  text-align: center;
  padding: var(--space-4) 0;
}
.load-more-btn {
  padding: var(--space-2) var(--space-6);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  background: var(--bg-card);
  color: var(--text-secondary);
  font-size: var(--text-sm);
  font-family: var(--font-sans);
  cursor: pointer;
  transition: all var(--transition-fast);
}
.load-more-btn:hover {
  border-color: var(--accent-primary);
  color: var(--accent-primary);
  background: rgba(99,102,241,0.05);
}

/* --- Empty State --- */
.empty-state {
  text-align: center;
  padding: var(--space-12) var(--space-4);
}

.empty-state__icon {
  font-size: 2.5rem;
  margin-bottom: var(--space-3);
}

.empty-state__title {
  font-size: var(--text-lg);
  font-weight: var(--font-semibold);
  color: var(--text-primary);
  margin-bottom: var(--space-2);
}
