/* ==========================================================================
   NeonForge · Feature styles
   Playground, votes & reputation, badges, file-integrity scans, advanced
   search & filters, live coding widget, moderation and Prism.js tokens.
   ========================================================================== */

/* ---------- Refresh without re-animating ---------- */
.post.is-refreshed,
.comment-list.is-rerender .comment {
  animation: none;
}

/* ---------- Category & engine chips ---------- */
.tag-red { --chip: var(--red-rgb); }
.side-filter.tag-red .icon { color: var(--red); }
.side-filter.engine-filter .icon { color: var(--violet); }

.engine-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 28px;
  padding: 0 10px;
  border-radius: 8px;
  border: 1px solid rgba(var(--violet-rgb), 0.35);
  background: rgba(var(--violet-rgb), 0.08);
  color: #c4b5fd;
  font-size: 12.5px;
  font-weight: 600;
  transition: all var(--fast);
}

.engine-chip .icon {
  width: 14px;
  height: 14px;
}

.engine-chip small {
  font-size: 11px;
  color: var(--muted);
  font-weight: 500;
}

.engine-chip:hover {
  background: rgba(var(--violet-rgb), 0.16);
  box-shadow: 0 0 16px -4px rgba(var(--violet-rgb), 0.7);
}

.engine-chip.is-active {
  background: rgba(var(--violet-rgb), 0.26);
  border-color: rgba(var(--violet-rgb), 0.85);
  color: #fff;
  box-shadow: 0 0 18px -4px rgba(var(--violet-rgb), 0.85);
}

.engine-chip.is-active small {
  color: #ddd6fe;
}

/* ---------- Verified mark, level chips, badges ---------- */
.verified-mark {
  display: inline-grid;
  place-items: center;
  margin-left: 4px;
  vertical-align: middle;
  color: var(--cyan);
}

.verified-mark .icon {
  width: 16px;
  height: 16px;
  fill: rgba(var(--cyan-rgb), 0.2);
  filter: drop-shadow(0 0 6px rgba(var(--cyan-rgb), 0.7));
}

.profile-identity h1 .verified-mark .icon {
  width: 22px;
  height: 22px;
}

.level-chip {
  --lv: var(--cyan-rgb);
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 20px;
  padding: 0 7px;
  border-radius: 6px;
  background: rgba(var(--lv), 0.12);
  border: 1px solid rgba(var(--lv), 0.35);
  color: rgb(var(--lv));
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.03em;
  white-space: nowrap;
  vertical-align: middle;
}

.level-chip .icon {
  width: 11px;
  height: 11px;
}

.lv-1 { --lv: 148, 163, 184; }
.lv-2 { --lv: var(--lime-rgb); }
.lv-3 { --lv: var(--cyan-rgb); }
.lv-4 { --lv: var(--magenta-rgb); }
.lv-5 { --lv: var(--amber-rgb); }
.lv-6 { --lv: var(--red-rgb); }

.xp-text {
  color: var(--muted);
}

.badge-icon,
.badge-chip,
.shelf-badge {
  --b: var(--cyan-rgb);
}

.badge-cyan { --b: var(--cyan-rgb); }
.badge-amber { --b: var(--amber-rgb); }
.badge-magenta { --b: var(--magenta-rgb); }
.badge-lime { --b: var(--lime-rgb); }
.badge-violet { --b: var(--violet-rgb); }
.badge-red { --b: var(--red-rgb); }

.badge-icon {
  display: inline-grid;
  place-items: center;
  width: 20px;
  height: 20px;
  border-radius: 6px;
  background: rgba(var(--b), 0.16);
  color: rgb(var(--b));
  box-shadow: 0 0 12px -3px rgba(var(--b), 0.8);
}

.badge-icon .icon {
  width: 12px;
  height: 12px;
}

.badge-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 26px;
  padding: 0 10px;
  border-radius: 999px;
  border: 1px solid rgba(var(--b), 0.45);
  background: linear-gradient(135deg, rgba(var(--b), 0.16), rgba(var(--b), 0.05));
  color: rgb(var(--b));
  font-size: 12px;
  font-weight: 700;
}

.badge-chip .icon {
  width: 14px;
  height: 14px;
}

.side-user-info strong,
.account-card strong {
  display: inline-flex;
  align-items: center;
}

.side-user-badges,
.account-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 2px;
}

/* ---------- XP progress & reputation ---------- */
.xp-progress {
  grid-column: 1 / -1;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.xp-progress small {
  font-size: 11.5px;
  color: var(--muted);
}

.xp-bar {
  display: block;
  height: 6px;
  border-radius: 999px;
  background: rgba(132, 148, 205, 0.14);
  overflow: hidden;
}

.xp-bar.large {
  height: 10px;
}

.xp-bar > span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--cyan), var(--magenta));
  box-shadow: 0 0 12px rgba(var(--magenta-rgb), 0.7);
  transition: width 400ms var(--ease);
}

.reputation-panel {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 18px;
  margin: 18px 22px 0;
  padding: 16px;
  border-radius: var(--radius);
  border: 1px solid rgba(var(--magenta-rgb), 0.28);
  background: linear-gradient(135deg, rgba(var(--magenta-rgb), 0.1), rgba(var(--cyan-rgb), 0.06));
}

.reputation-level {
  display: flex;
  align-items: center;
  gap: 12px;
}

.reputation-level div {
  display: flex;
  flex-direction: column;
}

.reputation-level strong {
  font-size: 17px;
}

.reputation-level small {
  color: var(--muted);
  font-size: 12.5px;
}

.level-orb {
  --lv: var(--cyan-rgb);
  display: grid;
  place-items: center;
  width: 52px;
  height: 52px;
  border-radius: 16px;
  font-family: var(--mono);
  font-size: 22px;
  font-weight: 800;
  color: #fff;
  background: radial-gradient(circle at 30% 25%, rgba(var(--lv), 0.9), rgba(var(--lv), 0.35));
  box-shadow: 0 0 0 1px rgba(var(--lv), 0.6), 0 0 26px -4px rgba(var(--lv), 0.9);
}

.reputation-progress {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.reputation-progress small {
  color: var(--muted);
  font-size: 12.5px;
}

.reputation-progress b {
  color: var(--text);
}

.profile-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 14px 22px 0;
}

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

.shelf-badge {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  border-radius: var(--radius);
  border: 1px solid rgba(var(--b), 0.35);
  background: linear-gradient(135deg, rgba(var(--b), 0.12), rgba(var(--ink-rgb), 0.4));
}

.shelf-badge.is-locked {
  filter: grayscale(1);
  opacity: 0.45;
  border-style: dashed;
}

.shelf-badge-icon {
  display: grid;
  place-items: center;
  flex-shrink: 0;
  width: 42px;
  height: 42px;
  border-radius: 12px;
  background: rgba(var(--b), 0.18);
  color: rgb(var(--b));
  box-shadow: 0 0 18px -6px rgba(var(--b), 0.9);
}

.shelf-badge-text {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.shelf-badge-text small {
  color: var(--muted);
  font-size: 12px;
}

.achievements-card {
  padding: 20px;
}

.xp-guide ul {
  list-style: none;
  margin: 0 0 12px;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px 18px;
}

.xp-guide li {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  padding: 6px 0;
  border-bottom: 1px dashed var(--border);
  font-size: 13.5px;
  color: var(--text-dim);
}

.xp-guide li b {
  font-family: var(--mono);
  color: var(--lime);
}

.xp-guide p {
  font-size: 12.5px;
}

.manage-chips {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 6px;
}

/* ---------- Votes ---------- */
.vote-box {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 3px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: rgba(var(--ink-rgb), 0.5);
  flex-shrink: 0;
}

.vote-btn {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 9px;
  color: var(--text-dim);
  transition: background var(--fast), color var(--fast), transform var(--fast);
}

.vote-btn .icon {
  width: 19px;
  height: 19px;
}

.vote-btn:hover:not(:disabled) {
  background: var(--surface-hover);
  color: var(--text);
}

.vote-btn:active:not(:disabled) {
  transform: scale(0.9);
}

.vote-btn:disabled {
  opacity: 0.35;
}

.vote-up.is-active {
  color: var(--cyan);
  background: rgba(var(--cyan-rgb), 0.14);
}

.vote-up.is-active .icon {
  fill: currentColor;
  filter: drop-shadow(0 0 6px rgba(var(--cyan-rgb), 0.9));
  animation: pop 320ms var(--ease);
}

.vote-down.is-active {
  color: var(--red);
  background: rgba(var(--red-rgb), 0.14);
}

.vote-down.is-active .icon {
  fill: currentColor;
  filter: drop-shadow(0 0 6px rgba(var(--red-rgb), 0.9));
  animation: pop 320ms var(--ease);
}

.vote-score {
  min-width: 34px;
  text-align: center;
  font-family: var(--mono);
  font-weight: 700;
  font-size: 14px;
  color: var(--text-dim);
}

.vote-score.is-positive { color: var(--cyan); }
.vote-score.is-negative { color: var(--red); }

.vote-score.bump {
  animation: score-bump 380ms var(--ease);
}

@keyframes score-bump {
  40% {
    transform: scale(1.45);
    text-shadow: 0 0 14px currentColor;
  }
}

/* ---------- File integrity (scan) ---------- */
.scan-badge {
  --s: var(--lime-rgb);
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 26px;
  padding: 0 9px;
  border-radius: 7px;
  border: 1px solid rgba(var(--s), 0.45);
  background: rgba(var(--s), 0.1);
  color: rgb(var(--s));
  font-size: 11.5px;
  font-weight: 700;
  white-space: nowrap;
  transition: box-shadow var(--fast), background var(--fast);
}

.scan-badge .icon {
  width: 14px;
  height: 14px;
}

.scan-badge:hover {
  background: rgba(var(--s), 0.18);
  box-shadow: 0 0 14px -3px rgba(var(--s), 0.8);
}

.scan-safe { --s: var(--lime-rgb); }
.scan-pending { --s: 148, 163, 184; }
.scan-warning { --s: var(--amber-rgb); }
.scan-quarantined { --s: var(--red-rgb); }

.scan-pending .icon,
.scan-mini.scan-pending .icon {
  animation: spin 1.4s linear infinite;
}

.scan-mini {
  --s: var(--lime-rgb);
  display: inline-grid;
  place-items: center;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: rgba(var(--s), 0.16);
  color: rgb(var(--s));
}

.scan-mini .icon {
  width: 12px;
  height: 12px;
}

.action-download.is-blocked {
  color: var(--red);
  opacity: 0.7;
}

.scan-notice {
  --s: var(--amber-rgb);
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid rgba(var(--s), 0.4);
  background: rgba(var(--s), 0.08);
  color: rgb(var(--s));
  font-size: 13px;
  text-align: left;
}

.scan-notice.scan-quarantined { --s: var(--red-rgb); }

.scan-notice span:not(.scan-notice-more) {
  flex: 1;
}

.scan-notice-more {
  font-weight: 700;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.code-toolbar-end {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.code-toolbar-end .code-tool {
  margin-left: 0;
}

.scan-report {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 16px;
}

.scan-report-head {
  --s: var(--lime-rgb);
  display: flex;
  align-items: center;
  gap: 12px;
}

.scan-report.scan-warning .scan-report-head { --s: var(--amber-rgb); }
.scan-report.scan-quarantined .scan-report-head { --s: var(--red-rgb); }
.scan-report.scan-pending .scan-report-head { --s: 148, 163, 184; }

.scan-report-head > .icon {
  width: 38px;
  height: 38px;
  padding: 8px;
  border-radius: 12px;
  background: rgba(var(--s), 0.15);
  color: rgb(var(--s));
  box-shadow: 0 0 18px -4px rgba(var(--s), 0.8);
}

.scan-report.scan-pending .scan-report-head > .icon {
  animation: spin 1.4s linear infinite;
}

.scan-report-head div {
  display: flex;
  flex-direction: column;
}

.scan-report-head small {
  color: var(--muted);
  font-size: 12px;
}

.scan-hash {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 6px 6px 10px;
  border-radius: 9px;
  background: rgba(var(--ink-rgb), 0.6);
  border: 1px solid var(--border);
  font-size: 12px;
}

.scan-hash span {
  color: var(--muted);
  font-weight: 700;
  font-size: 10.5px;
  letter-spacing: 0.06em;
}

.scan-hash code {
  flex: 1;
  padding: 0;
  border: 0;
  background: none;
  color: var(--text-dim);
}

.scan-hash .icon-btn {
  width: 28px;
  height: 28px;
}

.scan-checks {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 13px;
}

.scan-checks li {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text-dim);
}

.scan-checks .icon {
  width: 16px;
  height: 16px;
  padding: 2px;
  border-radius: 50%;
  stroke-width: 3;
}

.scan-checks .is-ok .icon {
  background: rgba(var(--lime-rgb), 0.18);
  color: var(--lime);
}

.scan-checks .is-fail .icon {
  background: rgba(var(--red-rgb), 0.18);
  color: var(--red);
}

.scan-findings {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 10px;
  border-radius: 9px;
  background: rgba(var(--amber-rgb), 0.08);
  border: 1px solid rgba(var(--amber-rgb), 0.3);
  font-size: 12.5px;
  color: #fde68a;
}

.scan-findings span {
  display: flex;
  align-items: center;
  gap: 6px;
}

.scan-findings .icon {
  width: 14px;
  height: 14px;
}

.scan-override {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--muted);
}

.scan-override .icon {
  width: 14px;
  height: 14px;
}

.scan-mod-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
}

.scan-disclaimer {
  font-size: 11.5px;
  color: #5c6380;
}

/* ---------- Moderation on cards ---------- */
.post.is-flagged {
  border-color: rgba(var(--red-rgb), 0.35);
  box-shadow: var(--shadow), 0 0 40px -24px rgba(var(--red-rgb), 0.8);
}

.flag-actions {
  display: inline-flex;
  gap: 6px;
  margin-left: auto;
}

/* ---------- Web playground ---------- */
.playground {
  border-radius: var(--radius);
  border: 1px solid rgba(var(--magenta-rgb), 0.28);
  background: var(--shade-05);
  overflow: hidden;
  box-shadow: 0 0 34px -20px rgba(var(--magenta-rgb), 0.8);
}

.pg-toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  padding: 6px 8px 6px 12px;
  background: rgba(var(--ink-2-rgb), 0.8);
  border-bottom: 1px solid var(--border);
}

.pg-title {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 700;
  color: var(--magenta);
}

.pg-title .icon {
  width: 15px;
  height: 15px;
}

.pg-tabs {
  display: flex;
  gap: 2px;
  padding: 3px;
  border-radius: 9px;
  background: rgba(var(--ink-rgb), 0.7);
}

.pg-tab {
  position: relative;
  height: 28px;
  padding: 0 12px;
  border-radius: 7px;
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
}

.pg-tab:hover {
  color: var(--text);
}

.pg-tab.is-active {
  color: var(--text);
  background: rgba(var(--magenta-rgb), 0.2);
  box-shadow: inset 0 0 0 1px rgba(var(--magenta-rgb), 0.5);
}

.pg-dot {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--amber);
}

.pg-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-left: auto;
}

.pg-icon {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 8px;
  color: var(--text-dim);
}

.pg-icon:hover:not(:disabled) {
  background: var(--surface-hover);
  color: var(--text);
}

.pg-icon:disabled {
  opacity: 0.3;
}

.pg-icon .icon {
  width: 16px;
  height: 16px;
}

.pg-views {
  display: flex;
  gap: 2px;
  padding: 3px;
  border-radius: 9px;
  background: rgba(var(--ink-rgb), 0.7);
}

.pg-view {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 28px;
  padding: 0 10px;
  border-radius: 7px;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
}

.pg-view .icon {
  width: 14px;
  height: 14px;
}

.pg-view:hover {
  color: var(--text);
}

.pg-view.is-active {
  color: var(--text);
  background: rgba(var(--cyan-rgb), 0.18);
}

.pg-run {
  color: var(--lime);
}

.pg-run.is-active {
  background: rgba(var(--lime-rgb), 0.2);
  color: #ecfccb;
  box-shadow: 0 0 14px -4px rgba(var(--lime-rgb), 0.9);
}

.pg-body {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
}

.playground.view-split .pg-body {
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
}

.playground.view-code .pg-preview-pane,
.playground.view-preview .pg-editor-pane {
  display: none;
}

.pg-editor-pane {
  min-width: 0;
}

.playground.view-split .pg-editor-pane {
  border-right: 1px solid var(--border);
}

.pg-editor {
  position: relative;
  height: 320px;
}

.pg-highlight,
.pg-input {
  position: absolute;
  inset: 0;
  margin: 0;
  padding: 14px 16px;
  border: 0;
  font-family: var(--mono);
  font-size: 13px;
  line-height: 1.6;
  tab-size: 2;
  white-space: pre;
  overflow-wrap: normal;
  word-break: normal;
  letter-spacing: normal;
}

.pg-highlight {
  overflow: hidden;
  color: #d4d9ee;
  pointer-events: none;
}

.pg-highlight code {
  font: inherit;
}

.pg-input {
  width: 100%;
  height: 100%;
  resize: none;
  overflow: auto;
  background: transparent;
  color: transparent;
  -webkit-text-fill-color: transparent;
  caret-color: var(--cyan);
  outline: none;
}

.pg-input::selection {
  background: rgba(var(--cyan-rgb), 0.28);
}

.pg-input:focus-visible {
  box-shadow: inset 0 0 0 1px rgba(var(--cyan-rgb), 0.45);
}

.pg-preview-pane {
  display: flex;
  flex-direction: column;
  min-width: 0;
  background: var(--shade-0b);
}

.pg-frame {
  display: block;
  width: 100%;
  height: 320px;
  border: 0;
  background: var(--shade-0b);
}

.playground.view-split .pg-frame {
  height: 210px;
}

.pg-console {
  border-top: 1px solid var(--border);
  background: var(--shade-05);
}

.pg-console-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 12px;
  font-size: 11.5px;
  font-weight: 700;
  color: var(--muted);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.pg-console-head span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.pg-console-head .icon {
  width: 13px;
  height: 13px;
}

.pg-console-head .link-btn {
  font-size: 11.5px;
  text-transform: none;
  letter-spacing: 0;
}

.pg-console-log {
  max-height: 110px;
  min-height: 56px;
  overflow-y: auto;
  padding: 0 12px 8px;
  font-family: var(--mono);
  font-size: 12px;
}

.pg-log-line {
  padding: 3px 0;
  border-bottom: 1px solid rgba(132, 148, 205, 0.06);
  color: var(--text-dim);
  white-space: pre-wrap;
  word-break: break-word;
}

.pg-log-line::before {
  content: '›';
  margin-right: 8px;
  color: var(--cyan);
}

.pg-log-line.log-warn {
  color: var(--amber);
}

.pg-log-line.log-error {
  color: var(--danger-text);
}

.pg-log-line.log-error::before {
  content: '✕';
  color: var(--red);
}

.pg-log-empty {
  color: #4b5270;
  font-size: 12px;
}

.pg-status {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  padding: 6px 12px;
  border-top: 1px solid var(--border);
  background: rgba(var(--ink-2-rgb), 0.6);
  font-size: 11.5px;
  color: var(--muted);
}

.pg-status span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.pg-status .icon {
  width: 13px;
  height: 13px;
  color: var(--lime);
}

.pg-status b {
  color: var(--amber);
}

.playground.is-authoring {
  border-color: rgba(var(--cyan-rgb), 0.35);
}

[data-playground-editor] {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

[data-playground-editor] .field-hint {
  display: flex;
  align-items: center;
  gap: 6px;
}

[data-playground-editor] .field-hint .icon {
  width: 14px;
  height: 14px;
  color: var(--cyan);
}

.mini-segmented {
  display: inline-flex;
  gap: 2px;
  padding: 3px;
  border-radius: 10px;
  background: rgba(var(--ink-rgb), 0.7);
  border: 1px solid var(--border);
}

.mini-segment {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 28px;
  padding: 0 10px;
  border-radius: 7px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--muted);
  cursor: pointer;
}

.mini-segment input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.mini-segment .icon {
  width: 14px;
  height: 14px;
}

.mini-segment.is-active {
  color: var(--text);
  background: rgba(var(--magenta-rgb), 0.2);
  box-shadow: inset 0 0 0 1px rgba(var(--magenta-rgb), 0.5);
}

.mini-segment:has(input:focus-visible) {
  outline: 2px solid var(--cyan);
}

/* ---------- Prism.js tokens ---------- */
.token.comment,
.token.prolog,
.token.doctype,
.token.cdata {
  color: #5f6a8f;
  font-style: italic;
}

.token.punctuation { color: #9aa3c4; }
.token.keyword,
.token.atrule,
.token.tag,
.token.important { color: #ff79c6; }
.token.boolean,
.token.number,
.token.constant { color: #fbbf24; }
.token.string,
.token.char,
.token.attr-value,
.token.inserted,
.token.selector { color: #a3e635; }
.token.function,
.token.attr-name { color: #22d3ee; }
.token.class-name,
.token.builtin,
.token.macro,
.token.directive,
.token.property { color: #c4b5fd; }
.token.operator,
.token.entity,
.token.url { color: var(--tok-tag); }
.token.regex,
.token.variable,
.token.symbol { color: #fb923c; }
.token.deleted { color: var(--danger-text); }
.token.bold { font-weight: 700; }
.token.italic { font-style: italic; }

/* ---------- Navbar search panel ---------- */
.search-panel {
  position: absolute;
  top: calc(100% + 10px);
  left: 0;
  z-index: 90;
  width: min(460px, calc(100vw - 24px));
  max-height: min(70vh, 560px);
  overflow-y: auto;
  padding: 8px;
  border-radius: var(--radius);
  background: rgba(16, 19, 32, 0.98);
  border: 1px solid var(--border-strong);
  box-shadow: var(--shadow-pop), 0 0 50px -20px rgba(var(--cyan-rgb), 0.6);
  backdrop-filter: var(--blur);
  -webkit-backdrop-filter: var(--blur);
  color: var(--text);
  cursor: default;
}

.search-section {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 6px 0;
}

.search-section + .search-section {
  border-top: 1px solid var(--border);
}

.search-label {
  padding: 4px 8px 6px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.search-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 0 8px 4px;
}

.search-chips .is-active {
  box-shadow: 0 0 0 2px var(--cyan);
}

.search-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 8px;
  border-radius: 10px;
  color: var(--text);
  text-align: left;
}

.search-item:hover,
.search-item.is-active {
  background: var(--surface-hover);
  text-decoration: none;
}

.search-item.is-active {
  box-shadow: inset 0 0 0 1px rgba(var(--cyan-rgb), 0.5);
}

.search-item-icon:not([class*='kind-']) {
  --kind: var(--violet-rgb);
}

.search-item-icon {
  display: grid;
  place-items: center;
  flex-shrink: 0;
  width: 32px;
  height: 32px;
  border-radius: 9px;
  background: rgba(var(--kind), 0.14);
  color: rgb(var(--kind));
}

.search-item-icon .icon {
  width: 16px;
  height: 16px;
}

.search-item-text {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.search-item-text strong {
  display: block;
  font-size: 13.5px;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.search-item-text small {
  font-size: 12px;
  color: var(--muted);
}

.search-panel mark {
  background: rgba(var(--cyan-rgb), 0.22);
  color: #cffafe;
  border-radius: 3px;
  padding: 0 1px;
}

.search-all {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  margin-top: 4px;
  padding: 10px;
  border-radius: 10px;
  border-top: 1px solid var(--border);
  color: var(--cyan);
  font-size: 13px;
  font-weight: 600;
  text-align: left;
}

.search-all span {
  flex: 1;
}

.search-all:hover,
.search-all.is-active {
  background: rgba(var(--cyan-rgb), 0.08);
}

.search-hint,
.search-empty {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  padding: 8px;
  font-size: 12.5px;
  color: var(--muted);
}

.search-empty .icon {
  width: 16px;
  height: 16px;
}

/* ---------- Feed toolbar filters ---------- */
.toolbar-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.toolbar-row .sort-tabs {
  flex: 1;
  min-width: 0;
}

.filter-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
  height: 36px;
  padding: 0 12px;
  border-radius: 10px;
  border: 1px solid var(--border-strong);
  color: var(--text-dim);
  font-weight: 600;
  font-size: 13px;
  transition: all var(--fast);
}

.filter-toggle .icon {
  width: 15px;
  height: 15px;
}

.filter-toggle b {
  display: grid;
  place-items: center;
  min-width: 18px;
  height: 18px;
  border-radius: 999px;
  background: var(--magenta);
  color: #fff;
  font-size: 11px;
}

.filter-toggle:hover,
.filter-toggle.is-open {
  border-color: rgba(var(--magenta-rgb), 0.55);
  color: var(--text);
  background: rgba(var(--magenta-rgb), 0.08);
}

.advanced-filters {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 12px 6px 6px;
  border-top: 1px solid var(--border);
}

.filter-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.filter-group-label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.filter-group-label .icon {
  width: 14px;
  height: 14px;
}

.filter-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

/* ---------- Live indicator and feed live strip ---------- */

.live-now-indicator {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 24px;
  padding: 0 10px;
  border-radius: 7px;
  background: rgba(132, 148, 205, 0.14);
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.12em;
  white-space: nowrap;
}

.live-now-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: currentColor;
}

.live-now-indicator.is-on {
  background: var(--red);
  color: #fff;
  box-shadow: 0 0 18px -2px rgba(var(--red-rgb), 0.95);
}

.live-now-indicator.is-on .live-now-dot {
  background: #fff;
  animation: pulse-dot 1.4s infinite;
}

.live-strip {
  display: none;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-color: rgba(var(--red-rgb), 0.35);
}

.live-strip-list {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  scrollbar-width: none;
}

.live-strip-list::-webkit-scrollbar {
  display: none;
}

.live-strip-item {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
  padding: 5px 12px 5px 5px;
  border-radius: 999px;
  border: 1px solid rgba(var(--red-rgb), 0.35);
  background: rgba(var(--red-rgb), 0.06);
  text-align: left;
}

.live-strip-item span {
  display: flex;
  flex-direction: column;
}

.live-strip-item strong {
  font-size: 13px;
}

.live-strip-item small {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  color: var(--muted);
}

.live-strip-item small .icon {
  width: 12px;
  height: 12px;
}

@media (max-width: 1240px) {
  .live-strip {
    display: flex;
  }
}

@media (min-width: 1241px) {
  .live-strip-slot {
    display: none;
  }
}

/* ---------- Watch (live session) modal ---------- */
.watch-modal.modal {
  max-width: 940px;
}

.watch-modal .modal-title {
  gap: 12px;
}

.watch {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 280px;
  gap: 16px;
}

.watch-screen {
  display: flex;
  flex-direction: column;
  min-width: 0;
  border-radius: var(--radius);
  border: 1px solid rgba(var(--red-rgb), 0.35);
  background: var(--shade-05);
  overflow: hidden;
  box-shadow: 0 0 40px -18px rgba(var(--red-rgb), 0.8);
}

.watch-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 12px;
  background: rgba(var(--ink-2-rgb), 0.85);
  border-bottom: 1px solid var(--border);
  font-size: 12px;
  color: var(--muted);
}

.watch-file,
.watch-stats span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.watch-file {
  font-family: var(--mono);
  color: var(--cyan);
}

.watch-stats {
  display: inline-flex;
  gap: 14px;
}

.watch-topbar .icon {
  width: 14px;
  height: 14px;
}

.watch-code {
  position: relative;
  height: 380px;
  margin: 0;
  padding: 16px;
  overflow: auto;
  font-size: 13px;
  line-height: 1.6;
  color: #d4d9ee;
  white-space: pre;
}

.watch-caret {
  display: inline-block;
  width: 8px;
  height: 16px;
  margin-left: 1px;
  vertical-align: text-bottom;
  background: var(--cyan);
  box-shadow: 0 0 8px var(--cyan);
  animation: caret-blink 1s steps(1) infinite;
}

@keyframes caret-blink {
  50% {
    opacity: 0;
  }
}

.watch-side {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-width: 0;
}

.watch-streamer {
  display: flex;
  gap: 12px;
  align-items: center;
}

.watch-streamer strong {
  display: inline-flex;
  align-items: center;
}

.watch-streamer p {
  font-size: 12.5px;
  color: var(--text-dim);
}

.watch-buttons {
  display: flex;
  gap: 8px;
}

.watch-chat {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: rgba(var(--ink-rgb), 0.55);
}

.watch-chat-head {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  border-bottom: 1px solid var(--border);
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
}

.watch-chat-head .icon {
  width: 14px;
  height: 14px;
}

.watch-chat-log {
  height: 250px;
  overflow-y: auto;
  padding: 8px 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.watch-chat-line {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  font-size: 12.5px;
  color: var(--text-dim);
  animation: post-in 260ms var(--ease) both;
}

.watch-chat-line .avatar {
  --size: 24px;
}

.watch-chat-line b {
  color: var(--text);
}

.watch-note {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--muted);
}

.watch-note .icon {
  width: 14px;
  height: 14px;
}

.profile-live-title .btn {
  margin-left: 8px;
}

/* ---------- Leaderboard ---------- */
.leaderboard {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.leader-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 8px;
  border-radius: 10px;
  color: var(--text);
}

.leader-row:hover {
  background: var(--surface-hover);
  text-decoration: none;
}

.leader-rank {
  display: grid;
  place-items: center;
  flex-shrink: 0;
  width: 24px;
  height: 24px;
  border-radius: 7px;
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
  background: rgba(132, 148, 205, 0.1);
}

.leader-rank .icon {
  width: 14px;
  height: 14px;
}

.leader-rank.rank-1 { color: #fde047; background: rgba(250, 204, 21, 0.16); box-shadow: 0 0 12px -2px rgba(250, 204, 21, 0.7); }
.leader-rank.rank-2 { color: #e2e8f0; background: rgba(226, 232, 240, 0.12); }
.leader-rank.rank-3 { color: #fdba74; background: rgba(251, 146, 60, 0.14); }

.leader-info {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-width: 0;
}

.leader-info strong {
  display: inline-flex;
  align-items: center;
  font-size: 13.5px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.leader-info small {
  font-size: 11.5px;
  color: var(--muted);
}

.leader-xp {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  font-family: var(--mono);
  font-weight: 700;
  font-size: 13px;
  color: var(--magenta);
}

.leader-xp small {
  font-size: 10px;
  color: var(--muted);
}

/* ---------- Moderation ---------- */
.side-count,
.menu-count {
  margin-left: auto;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  font-size: 11px;
  font-weight: 800;
  background: var(--red);
  color: #fff;
  box-shadow: 0 0 10px rgba(var(--red-rgb), 0.7);
}

.stat-grid.mod-stats {
  padding: 0;
}

.mod-queue {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.mod-item {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 16px;
}

.mod-item-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

.mod-author {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text);
  min-width: 0;
}

.mod-author:hover {
  text-decoration: none;
}

.mod-author > span:not(.avatar) {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.mod-author strong {
  display: inline-flex;
  align-items: center;
  font-size: 14px;
}

.mod-author small {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
}

.mod-item-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.mod-title {
  font-weight: 700;
  font-size: 16px;
  color: var(--text);
}

.mod-reasons {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.mod-reason {
  --m: 148, 163, 184;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 24px;
  padding: 0 9px;
  border-radius: 7px;
  background: rgba(var(--m), 0.12);
  color: rgb(var(--m));
  font-size: 12px;
  font-weight: 600;
}

.mod-reason .icon {
  width: 13px;
  height: 13px;
}

.mod-reason.danger { --m: var(--red-rgb); }
.mod-reason.warning { --m: var(--amber-rgb); }

.mod-reports {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.mod-reports li {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 10px 12px;
  border-radius: 10px;
  background: rgba(var(--ink-rgb), 0.5);
  border-left: 3px solid rgba(var(--red-rgb), 0.6);
  font-size: 13px;
}

.mod-reports span {
  color: var(--text-dim);
}

.mod-reports small {
  color: var(--muted);
  font-size: 12px;
}

.mod-findings {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 12.5px;
  color: #fde68a;
}

.mod-findings span {
  display: flex;
  align-items: center;
  gap: 6px;
}

.mod-findings .icon {
  width: 14px;
  height: 14px;
}

.mod-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
}

.mod-panel {
  padding: 20px;
}

.mod-panel > .muted {
  margin: -8px 0 12px;
  font-size: 13px;
}

.verify-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.verify-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px;
  border-radius: 10px;
}

.verify-row:hover {
  background: var(--surface-hover);
}

.mod-log {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.mod-log-entry {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: start;
  gap: 10px;
  padding: 10px 6px;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
  color: var(--text-dim);
}

.mod-log-entry small {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

.mod-log-entry time {
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
}

.mod-log-icon {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background: rgba(var(--magenta-rgb), 0.12);
  color: var(--magenta);
}

.mod-log-icon .icon {
  width: 14px;
  height: 14px;
}

/* ---------- Responsive ---------- */
@media (max-width: 960px) {
  .search-panel {
    position: fixed;
    top: calc(var(--nav-h) + 6px);
    left: 8px;
    right: 8px;
    width: auto;
  }

  .watch {
    grid-template-columns: minmax(0, 1fr);
  }

  .watch-code {
    height: 260px;
  }

  .watch-chat-log {
    height: 160px;
  }
}

@media (max-width: 720px) {
  .playground.view-split .pg-body {
    grid-template-columns: minmax(0, 1fr);
  }

  .playground.view-split .pg-editor-pane {
    border-right: 0;
    border-bottom: 1px solid var(--border);
  }

  .pg-editor {
    height: 260px;
  }

  .pg-actions {
    width: 100%;
    margin-left: 0;
    justify-content: space-between;
  }
}

@media (max-width: 640px) {
  .reputation-panel {
    grid-template-columns: minmax(0, 1fr);
    margin: 16px 16px 0;
  }

  .profile-badges {
    padding-left: 16px;
    padding-right: 16px;
  }

  .badge-shelf,
  .xp-guide ul {
    grid-template-columns: minmax(0, 1fr);
  }

  .vote-btn {
    width: 32px;
  }

  .code-toolbar-end .scan-badge span:not(.sr-only),
  .code-lines {
    display: none;
  }

  .filter-toggle span {
    display: none;
  }

  .mod-log-entry {
    grid-template-columns: auto minmax(0, 1fr);
  }

  .mod-log-entry time {
    grid-column: 2;
  }

  .xp-text {
    display: none;
  }
}
