/* Combat.log Reviews - Main Styles */

/* ========= CSS Reset & Base ===================== */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: 'Segoe UI', 'Cascadia Code', 'Consolas', sans-serif;
  background: #0d0d12;
  color: #e0e0e8;
  overflow: hidden;
  height: 100vh;
}

/* ========= Page Routing ===================== */
.page {
  display: none;
  width: 100%;
  height: 100vh;
}

.page.active {
  display: flex;
  flex-direction: column;
}

/* ========= Homepage ===================== */
#page-homepage {
  overflow-y: auto;
  padding: 0;
}

.homepage-header {
  max-width: 1000px;
  margin: 0 auto 2rem;
  text-align: center;
}

.homepage-header h1 {
  font-size: 2.5rem;
  color: #a0a0ff;
  margin-bottom: 0.5rem;
  text-shadow: 0 0 20px rgba(160, 160, 255, 0.3);
}

.homepage-header p {
  color: #888;
  font-size: 1.1rem;
}

/* Upload Card — outer frame is plain, dotted border only on drop zone */
.upload-card {
  max-width: 600px;
  margin: 0 auto 3rem;
  background: #1a1a24;
  border: 1px solid #222;
  border-radius: 12px;
  padding: 2rem;
  text-align: center;
}

.upload-card h2 {
  color: #a0a0ff;
  margin-bottom: 1rem;
}

/* The dotted drop-zone is the ONLY interactive area for file selection */
.upload-drop-zone {
  max-width: 100%;
  background: #16161e;
  border: 2px dashed #3a3a4a;
  border-radius: 10px;
  padding: 2.5rem 2rem;
  text-align: center;
  transition: border-color 0.2s, background 0.2s;
  cursor: pointer;
}

.upload-drop-zone:hover,
.upload-drop-zone.dragover {
  border-color: #5a5aff;
  background: #1e1e2e;
}

.upload-drop-zone p {
  color: #888;
  margin: 0;
}

.browse-link {
  color: #4a4aff;
  text-decoration: underline;
  cursor: pointer;
  user-select: none;
}

.browse-link:hover {
  color: #5a5aff;
}

/* Upload status */
.upload-status {
  margin-top: 0.75rem;
  color: #777;
  font-size: 0.85rem;
  min-height: 1.2em;
}

/* Pre-upload density preview */
.preview-section {
  margin-top: 1rem;
  text-align: left;
}

.preview-hint {
  font-size: 0.78rem;
  color: #555;
  text-align: center;
  margin-bottom: 0.4rem;
}

.preview-canvas {
  display: block;
  width: 100%;
  height: 80px;
  border-radius: 6px;
  cursor: crosshair;
  border: 1px solid #222;
}

.preview-range-label {
  font-size: 0.8rem;
  color: #888;
  text-align: center;
  margin-top: 0.4rem;
  font-variant-numeric: tabular-nums;
}

/* Upload button */
.upload-card .upload-btn {
  display: block;
  margin: 1rem auto 0;
  padding: 0.75rem 2rem;
  background: #4a4aff;
  color: white;
  border: none;
  border-radius: 8px;
  font-size: 1rem;
  cursor: pointer;
  transition: background 0.2s;
}

.upload-card .upload-btn:hover:not(:disabled) {
  background: #5a5aff;
}

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

.upload-card .name-input {
  display: block;
  width: 80%;
  max-width: 300px;
  margin: 1rem auto 0;
  padding: 0.5rem 1rem;
  background: #0d0d12;
  border: 1px solid #333;
  border-radius: 6px;
  color: #e0e0e8;
  font-size: 0.95rem;
}

.upload-card .name-input::placeholder {
  color: #555;
}

/* Timestamp Range Inputs */
.timestamp-inputs {
  display: flex;
  gap: 1rem;
  justify-content: center;
  margin-top: 1rem;
}

.timestamp-inputs label {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  font-size: 0.85rem;
  color: #888;
}

.timestamp-inputs input[type="time"] {
  padding: 0.4rem 0.6rem;
  background: #0d0d12;
  border: 1px solid #333;
  border-radius: 4px;
  color: #e0e0e8;
  font-size: 0.85rem;
}

/* Recent Events Table */
.events-section h2 {
  max-width: 1000px;
  margin: 0 auto 1rem;
  color: #a0a0ff;
  font-size: 1.3rem;
}

.events-table-wrapper {
  max-width: 1000px;
  margin: 0 auto;
}

.events-table {
  width: 100%;
  border-collapse: collapse;
  background: #1a1a24;
  border-radius: 8px;
  overflow: hidden;
}

.events-table th {
  text-align: left;
  padding: 0.75rem 1rem;
  background: #12121c;
  color: #888;
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.events-table td {
  padding: 0.75rem 1rem;
  border-top: 1px solid #222;
  font-size: 0.95rem;
}

.events-table tr:hover td {
  background: #1e1e2e;
}

.events-table .view-btn {
  padding: 0.4rem 1rem;
  background: #3a3aff;
  color: white;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.85rem;
  transition: background 0.2s;
  text-decoration: none;
}

.events-table .view-btn:hover {
  background: #4a4aff;
}

.events-table .delete-btn {
  padding: 0.4rem 0.8rem;
  background: transparent;
  color: #666;
  border: 1px solid #333;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.85rem;
  transition: all 0.2s;
  margin-left: 0.5rem;
}

.events-table .delete-btn:hover {
  color: #ff6b6b;
  border-color: #ff6b6b;
}

.events-table .event-name {
  color: #e0e0e8;
  font-weight: 500;
}

.events-table .event-name a {
  color: inherit;
  text-decoration: none;
}

.events-table .event-name a:hover {
  color: #a0a0ff;
}

/* Empty State */
.empty-state {
  text-align: center;
  padding: 3rem;
  color: #555;
  font-size: 1.1rem;
}

.empty-state .icon {
  font-size: 3rem;
  margin-bottom: 1rem;
}

/* Loading Spinner */
.spinner {
  display: inline-block;
  width: 24px;
  height: 24px;
  border: 3px solid #333;
  border-top-color: #4a4aff;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  vertical-align: middle;
  margin-right: 0.5rem;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Loading overlay */
.loading-overlay {
  position: fixed;
  inset: 0;
  background: rgba(13, 13, 18, 0.8);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.loading-overlay .spinner-box {
  text-align: center;
  color: #a0a0ff;
  font-size: 1.1rem;
}

/* Determinate progress bar (contributor-log upload + merge) */
.progress-box {
  min-width: 320px;
  max-width: 90vw;
}

.progress-label {
  color: #a0a0ff;
  font-size: 1.05rem;
  margin-bottom: 0.6rem;
}

.progress-track {
  width: 100%;
  height: 10px;
  background: #1f1f29;
  border: 1px solid #333;
  border-radius: 6px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, #4a4aff, #4ecdc4);
  border-radius: 6px;
  transition: width 0.25s ease;
}

.progress-detail {
  margin-top: 0.5rem;
  color: #8a8a9a;
  font-size: 0.85rem;
  min-height: 1em;
}

/* Inline variant inside the event-detail upload status area */
.upload-status .progress-track { height: 8px; }
.upload-status .progress-label { font-size: 0.9rem; margin-bottom: 0.4rem; color: #a0a0ff; }

/* ========= Timeline View Layout ===================== */
/* display/flex-direction/height are all handled by .page and .page.active — no ID override needed */

/* Top Bar */
.timeline-bar {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.5rem 1rem;
  background: #1a1a24;
  border-bottom: 1px solid #222;
  min-height: 48px;
  flex-shrink: 0;
}

.timeline-bar .back-btn {
  padding: 0.3rem 0.8rem;
  background: transparent;
  border: 1px solid #333;
  border-radius: 6px;
  color: #a0a0ff;
  cursor: pointer;
  font-size: 0.85rem;
  transition: all 0.2s;
}

.timeline-bar .back-btn:hover {
  background: #222;
}

.timeline-bar .event-name {
  color: #e0e0e8;
  font-weight: 500;
  font-size: 1rem;
  flex-shrink: 0;
}

.timeline-bar .timestamp-range {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex: 1;
}

.timeline-bar .timestamp-range label {
  font-size: 0.8rem;
  color: #666;
}

.timeline-bar .timestamp-range input[type="time"] {
  padding: 0.25rem 0.5rem;
  background: #0d0d12;
  border: 1px solid #333;
  border-radius: 4px;
  color: #e0e0e8;
  font-size: 0.8rem;
}

.timeline-bar .zoom-controls {
  display: flex;
  gap: 0.25rem;
  flex-shrink: 0;
}

.timeline-bar .zoom-btn {
  padding: 0.25rem 0.6rem;
  background: #222;
  border: 1px solid #333;
  border-radius: 4px;
  color: #aaa;
  cursor: pointer;
  font-size: 0.75rem;
  transition: all 0.2s;
}

.timeline-bar .zoom-btn:hover,
.timeline-bar .zoom-btn.active {
  background: #3a3aff;
  color: white;
  border-color: #4a4aff;
}

/* ========= Timeline management strip ===================== */
.timeline-manage-bar {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.35rem 1rem;
  background: #090910;
  border-bottom: 1px solid #181820;
  flex-shrink: 0;
  min-height: 36px;
}

.tl-event-stats {
  color: #444;
  font-size: 0.78rem;
  white-space: nowrap;
  margin-right: 0.25rem;
}

.tl-manage-btn {
  background: transparent;
  border: 1px solid #222;
  color: #666;
  border-radius: 5px;
  padding: 0.2rem 0.65rem;
  font-size: 0.78rem;
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s;
  white-space: nowrap;
}
.tl-manage-btn:hover          { border-color: #3a3a5a; color: #aaa; }
.tl-manage-btn.active         { border-color: #4a4aaa; color: #9090e0; background: rgba(80,80,160,0.08); }

.tl-manage-spacer { flex: 1; }

/* ===== Inline merge-progress feed (shown to every viewer while logs merge) ===== */
.tl-merge-progress {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  min-width: 0;            /* allow the rows to shrink/ellipsize in the flex bar */
  max-width: 460px;
}

.tl-merge-row {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.74rem;
  color: #8a8ac0;
  white-space: nowrap;
  min-width: 0;
}

.tl-merge-name  { color: #cfcfe6; font-weight: 600; }
.tl-merge-label { color: #7a7aa0; }
.tl-merge-detail {
  color: #555;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}

.tl-merge-bar {
  position: relative;
  width: 90px;
  height: 4px;
  border-radius: 3px;
  background: #1a1a2a;
  overflow: hidden;
  flex-shrink: 0;
}
.tl-merge-fill {
  position: absolute;
  left: 0; top: 0; bottom: 0;
  background: linear-gradient(90deg, #4a4aaa, #6a6ae0);
  border-radius: 3px;
  transition: width 0.4s ease;
}
.tl-merge-indeterminate {
  width: 35%;
  animation: tl-merge-slide 1.1s ease-in-out infinite;
}
@keyframes tl-merge-slide {
  0%   { left: -35%; }
  100% { left: 100%; }
}

.tl-merge-error { color: #ff6b6b; }
.tl-merge-error .tl-merge-label { color: #ff6b6b; }

/* ========= Timeline management panels ===================== */
.timeline-manage-panels {
  background: #0c0c16;
  border-bottom: 1px solid #181820;
  flex-shrink: 0;
  max-height: 380px;
  overflow-y: auto;
}

.tl-panel {
  padding: 1rem 1.5rem;
  max-width: 900px;
}

/* Main Content Area */
.timeline-content {
  display: flex;
  flex: 1;
  overflow: hidden;
  position: relative; /* anchor for the loading overlay */
}

/* Loading overlay covering the analyze panels while the TDL loads. */
.timeline-load-overlay {
  position: absolute;
  inset: 0;
  z-index: 60;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(15, 15, 22, 0.94);
}

.timeline-load-overlay .tl-load-box {
  text-align: center;
}

.timeline-load-overlay .spinner-lg {
  width: 34px;
  height: 34px;
  border-width: 3px;
  margin-right: 0;
}

.timeline-load-overlay .tl-load-title {
  margin-top: 1rem;
  font-size: 1rem;
  color: #cfcfe6;
}

.timeline-load-overlay .tl-load-sub {
  margin-top: 0.35rem;
  font-size: 0.8rem;
  color: #777;
}

/* Non-blocking live-update toast (server preparing / loading newer data). */
.tdl-update-banner {
  position: absolute;
  top: 10px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 70;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.4rem 0.9rem;
  background: rgba(30, 30, 46, 0.96);
  border: 1px solid #3a3a52;
  border-radius: 999px;
  color: #cfcfe6;
  font-size: 0.8rem;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.45);
  pointer-events: none; /* never blocks interaction with the data underneath */
}

.tdl-update-banner .spinner-sm {
  width: 14px;
  height: 14px;
  border-width: 2px;
  margin-right: 0;
}

/* ── Participant panel (left column) ── */
#participant-panel {
  width: 200px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  background: #10101a;
  border-right: 1px solid #222;
  overflow: hidden;
}

.participant-pinned {
  flex-shrink: 0;
  background: #10101a;
  border-bottom: 1px solid #222;
}

.participant-list {
  flex: 1;
  overflow-y: auto;
}

.participant-row {
  position: relative;
  display: flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.38rem 0.75rem;
  cursor: pointer;
  border-bottom: 1px solid rgba(255,255,255,0.02);
  transition: background 0.1s;
  overflow: hidden;
}
.participant-row:hover    { background: rgba(255,255,255,0.03); }
.participant-row.selected { background: rgba(74,74,255,0.1); }

.participant-bar {
  position: absolute;
  left: 0; top: 0; bottom: 0;
  pointer-events: none;
  border-radius: 0 2px 2px 0;
}

.participant-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
  position: relative;
}

.participant-name {
  flex: 1;
  font-size: 0.78rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  position: relative;
  color: #bbb;
}
.participant-row.selected .participant-name { color: #e0e0f0; }

.participant-dmg {
  font-size: 0.7rem;
  color: #555;
  position: relative;
  flex-shrink: 0;
  font-variant-numeric: tabular-nums;
}
.participant-row.selected .participant-dmg { color: #777; }

/* ── Column 2: Chart + Stats ── */
.column-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-width: 0;
}

/* Chart mode + resolution bar */
.chart-mode-bar {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  flex-wrap: wrap;
  padding: 0.2rem 0.5rem;
  background: #0d0d12;
  border-bottom: 1px solid #1a1a24;
  flex-shrink: 0;
}

.chart-mode-btn {
  padding: 0.15rem 0.55rem;
  border: 1px solid #2a2a3a;
  background: none;
  color: #555;
  border-radius: 3px;
  cursor: pointer;
  font-size: 0.7rem;
  font-family: inherit;
  transition: color 0.15s, border-color 0.15s;
}

.chart-mode-btn:hover  { color: #aaa; border-color: #444; }
.chart-mode-btn.active { color: #c0c0ff; border-color: #5a5aff; background: rgba(90,90,255,0.08); }

.chart-mode-group { display: flex; align-items: center; gap: 0.25rem; flex-shrink: 0; }

.chart-res-group {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  border-left: 1px solid #2a2a3a;
  padding-left: 0.4rem;
  margin-left: 0.1rem;
  flex-shrink: 0;
}
.chart-res-auto {
  padding: 0.1rem 0.4rem;
  border: 1px solid #222;
  background: none;
  color: #555;
  font-size: 0.65rem;
  border-radius: 3px;
  cursor: pointer;
  transition: color 0.12s, border-color 0.12s;
}
.chart-res-auto:hover  { color: #888; border-color: #3a3a4a; }
.chart-res-auto.active { color: #a0a0e8; border-color: #4a4a9a; background: rgba(74,74,154,0.12); }

/* Deaths detail — kill feed (top half of the deaths stats view). */
.death-feed { max-height: 220px; overflow-y: auto; margin-top: 2px; }
.death-feed-row { display: flex; align-items: center; gap: 6px; font-size: 0.72rem; padding: 1px 0; }
.death-feed-time { color: #555; font-size: 0.66rem; font-variant-numeric: tabular-nums; }
.death-skull { opacity: 0.85; }
.death-feed-click { cursor: pointer; border-radius: 3px; }
.death-feed-click:hover { background: rgba(255,255,255,0.05); }

.chart-res-slider {
  width: 90px;
  cursor: pointer;
  accent-color: #6a6ac8;
}

.chart-zoom-reset {
  padding: 0.1rem 0.5rem;
  border: 1px solid #2a2a4a;
  background: none;
  color: #6060a0;
  font-size: 0.65rem;
  border-radius: 3px;
  cursor: pointer;
  margin-left: 0.2rem;
  transition: color 0.12s, border-color 0.12s;
}
.chart-zoom-reset:hover { color: #a0a0ff; border-color: #5a5aff; }

/* ── Chart scrollbar ── */
.chart-sb-container {
  height: 22px;
  display: flex;
  align-items: center;
  padding: 0 16px 0 52px; /* mirrors canvas padding.left/right */
  background: #0d0d14;
  border-top: 1px solid #131320;
  flex-shrink: 0;
}
.chart-sb-track {
  position: relative;
  width: 100%;
  height: 8px;
  background: #1a1a2e;
  border-radius: 4px;
  cursor: pointer;
  user-select: none;
}
.chart-sb-thumb {
  position: absolute;
  top: 0;
  height: 100%;
  background: #353570;
  border-radius: 4px;
  cursor: grab;
  user-select: none;
  min-width: 16px;
}
.chart-sb-thumb:active { cursor: grabbing; }
.chart-sb-handle {
  position: absolute;
  top: 0;
  width: 8px;
  height: 100%;
  background: #5a5aaa;
  cursor: ew-resize;
}
#chart-sb-left  { left: 0;  border-radius: 4px 2px 2px 4px; }
#chart-sb-right { right: 0; border-radius: 2px 4px 4px 2px; }
/* grip dots on handles */
#chart-sb-left::after, #chart-sb-right::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 2px;
  height: 4px;
  background: rgba(255,255,255,0.35);
  border-radius: 1px;
  box-shadow: 0 -3px 0 rgba(255,255,255,0.35), 0 3px 0 rgba(255,255,255,0.35);
}

/* Damage chart (fixed height) */
#chart-container {
  height: 200px;
  flex-shrink: 0;
  position: relative;
  background: #0f0f16;
  border-bottom: 1px solid #222;
  overflow: hidden;
  cursor: crosshair;
}

#chart-container canvas {
  width: 100%;
  height: 100%;
}

#chart-container .tooltip {
  /* fixed (viewport-relative) so the overflow:hidden on #chart-container and
     .column-main can't crop it; positioned in JS from viewport coordinates. */
  position: fixed;
  background: rgba(20,20,30,0.95);
  border: 1px solid #333;
  border-radius: 6px;
  padding: 0.5rem 0.75rem;
  font-size: 0.8rem;
  color: #e0e0e8;
  pointer-events: none;
  z-index: 100;
  white-space: nowrap;
  display: none;
  max-width: 200px;
}

/* Buff/debuff timeline panel (collapsible, below the chart scrollbar; player-scoped) */
.buff-tl-panel {
  flex-shrink: 0;
  background: #0f0f16;
  border-bottom: 1px solid #222;
}
.buff-tl-header {
  display: flex;
  align-items: stretch;
  background: #14141f;
  border-bottom: 1px solid #222;
}
.buff-tl-toggle {
  flex: 1;
  text-align: left;
  background: none;
  border: none;
  color: #8a8aa0;
  font-size: 0.72rem;
  letter-spacing: 0.02em;
  padding: 5px 10px;
  cursor: pointer;
}
.buff-tl-toggle:hover { color: #c8c8e0; }
.buff-tl-toggle #buff-tl-arrow { color: #5a5a72; display: inline-block; width: 0.9em; }
.buff-tl-filters { display: flex; align-items: center; gap: 4px; padding: 0 8px; }
.buff-tl-filter {
  background: #1b1b28;
  border: 1px solid #2a2a3a;
  color: #6a6a82;
  font-size: 0.66rem;
  letter-spacing: 0.02em;
  padding: 2px 8px;
  border-radius: 10px;
  cursor: pointer;
}
.buff-tl-filter:hover { color: #c8c8e0; }
.buff-tl-filter#buff-tl-filter-buff.active   { background: rgba(79,194,138,0.18);  border-color: #4fc28a; color: #7fe0ad; }
.buff-tl-filter#buff-tl-filter-debuff.active { background: rgba(224,114,106,0.18); border-color: #e0726a; color: #f0938c; }
.buff-tl-body { position: relative; }
.buff-tl-scroll {
  position: relative;
  max-height: 168px;
  overflow-y: auto;
  background: #0f0f16;
}
.buff-tl-scroll canvas { display: block; width: 100%; }
#buff-timeline-tooltip {
  /* fixed so the buff-tl scroll/pane overflow can't crop it (positioned in JS). */
  position: fixed;
  background: rgba(20,20,30,0.95);
  border: 1px solid #333;
  border-radius: 6px;
  padding: 0.4rem 0.6rem;
  font-size: 0.78rem;
  color: #e0e0e8;
  pointer-events: none;
  z-index: 100;
  white-space: nowrap;
  display: none;
  max-width: 220px;
}

/* Stats panel (below chart) */
#stats-panel {
  flex: 1;
  overflow-y: auto;
  background: #12121c;
  padding: 0.85rem 1rem;
}

#stats-panel .empty {
  color: #555;
  text-align: center;
  padding: 2rem 1rem;
  font-size: 0.9rem;
}

.stats-section {
  margin-bottom: 1rem;
}

.stats-section-title {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: #555;
  margin-bottom: 0.45rem;
}

.stats-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.22rem 0;
  font-size: 0.82rem;
  border-bottom: 1px solid rgba(255,255,255,0.03);
}
.stats-row:last-child { border-bottom: none; }

.stats-name  { color: #888; }
.stats-value { color: #e0e0e8; font-variant-numeric: tabular-nums; }
.stats-value.damage  { color: #ff6b6b; }
.stats-value.healing { color: #4ecdc4; }

.stats-bar-row {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.18rem 0;
  font-size: 0.78rem;
}

.stats-bar-name {
  width: 90px;
  flex-shrink: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: #aaa;
}

.stats-bar-bg {
  flex: 1;
  height: 4px;
  background: #1a1a24;
  border-radius: 2px;
  overflow: hidden;
}

.stats-bar-fill {
  height: 100%;
  border-radius: 2px;
}

.stats-bar-val {
  flex-shrink: 0;
  min-width: 42px;
  text-align: right;
  color: #666;
  font-variant-numeric: tabular-nums;
}

/* Highlighted row when a player is selected */
.stats-bar-row--sel .stats-bar-name { color: #d0d0f0; }
.stats-bar-row--sel .stats-bar-val  { color: #9090cc; }

/* Ranking mode tab strip */
.rank-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 3px;
  margin-bottom: 0.6rem;
}

.rank-tab {
  padding: 0.2rem 0.5rem;
  background: transparent;
  border: 1px solid #2a2a3a;
  border-radius: 4px;
  color: #555;
  font-size: 0.7rem;
  cursor: pointer;
  transition: all 0.12s;
  white-space: nowrap;
}
.rank-tab:hover       { border-color: #3a3a5a; color: #999; }
.rank-tab.active      { border-color: #5858c8; color: #a0a0f0; background: rgba(88,88,200,0.1); }

.stats-empty-mode {
  color: #444;
  font-size: 0.78rem;
  line-height: 1.5;
  padding: 0.5rem 0;
}

.stats-dismiss-btn {
  background: none;
  border: none;
  color: #555;
  font-size: 1rem;
  cursor: pointer;
  padding: 0 0.15rem;
  line-height: 1;
  flex-shrink: 0;
}
.stats-dismiss-btn:hover { color: #aaa; }

.stats-range-badge {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.7rem;
  color: #a0a0f0;
  padding: 0.1rem 0 0.35rem;
  border-bottom: 1px solid #1e1e2e;
  margin-bottom: 0.25rem;
}
.stats-range-badge .stats-dismiss-btn { font-size: 0.85rem; color: #555; }

/* ── Log expand panel ── */
.log-expand {
  padding: 0.45rem 1rem 0.45rem 1.5rem;
  background: #0a0a12;
  border-left: 2px solid #3a3aff;
  font-size: 0.75rem;
  line-height: 1.5;
}

.log-expand-section {
  color: #444;
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  margin: 0.35rem 0 0.15rem;
}
.log-expand-section:first-child { margin-top: 0; }

.log-expand-item {
  color: #777;
  padding: 0.05rem 0;
}

.attr-role {
  color: #5858b0;
  font-size: 0.68rem;
  margin-right: 0.2rem;
}

/* ── Event-detail value + effect-row styles (shared by the graph) ─── */
.mu-val { font-weight: 700; }
.mu-val.damage   { color: #ff6b6b; }
.mu-val.healing  { color: #4ecdc4; }

.mu-fx-empty { color: #3c3c4a; font-style: italic; padding: 0.1rem 0; }

.mu-effect {
  padding: 0.12rem 0.35rem;
  margin: 0.12rem 0;
  border-radius: 3px;
  border-left: 2px solid transparent;
  background: #11111b;
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.3rem;
}
.mu-effect.buff   { border-color: #2c6f68; }
.mu-effect.debuff { border-color: #7a3030; }
.mu-effect.mu-affected {
  background: #1f1a10;
  box-shadow: inset 0 0 0 1px #4a3a18;
}
.mu-fx-name { color: #b7b7c8; }
.mu-effect.buff   .mu-fx-name { color: #8fdcd4; }
.mu-effect.debuff .mu-fx-name { color: #e89b9b; }
.mu-fx-tag {
  color: #ffcf66;
  background: #3a2f12;
  font-size: 0.6rem;
  padding: 0 0.25rem;
  border-radius: 2px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}
.mu-fx-by { color: #6a6a82; font-size: 0.64rem; }

.mu-foot {
  color: #55556a;
  font-size: 0.64rem;
  margin-top: 0.35rem;
}

/* ── Per-line provenance (moderation) ────────────────────────── */
.mu-prov { margin-top: 0.6rem; border-top: 1px solid #2a2a38; padding-top: 0.5rem; }
.mu-prov-head { display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; }
.prov-badge { font-size: 0.78rem; font-weight: 600; }
.prov-badge.ok   { color: #4ecdc4; }
.prov-badge.mod  { color: #e0b15f; }
.prov-badge.warn { color: #ff8a5f; }
.prov-toggle {
  background: none; border: 1px solid #3a3a52; border-radius: 4px;
  color: #9a9ad6; font-size: 0.72rem; padding: 0.15rem 0.5rem; cursor: pointer;
}
.prov-toggle:hover { border-color: #5a5a82; color: #cfcfe6; }
.mu-prov-list { margin-top: 0.5rem; display: flex; flex-direction: column; gap: 0.3rem; }
.mu-prov-row { display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; font-size: 0.8rem; }
.prov-name { color: #cfcfe6; }
.prov-remove {
  background: none; border: 1px solid #5a2a2a; border-radius: 4px;
  color: #ff8a5f; font-size: 0.72rem; padding: 0.1rem 0.45rem; cursor: pointer;
}
.prov-remove:hover { background: #2a1515; border-color: #ff6b6b; color: #ff6b6b; }
.mu-prov-note { font-size: 0.74rem; color: #8a8a9a; margin-top: 0.2rem; }
.mu-prov-note.warn { color: #c89a7f; }

/* ── Event-detail network graph ──────────────────────────────── */
.mu-graph { font-size: 0.72rem; }
.mu-graph-skill {
  text-align: center;
  color: #9a9ad6;
  font-size: 0.7rem;
  margin-bottom: 0.3rem;
}
.mu-graph svg { overflow: visible; }
.mu-graph svg g[data-player]:hover rect { stroke: #ffcf66; }

.mu-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  justify-content: center;
  margin-top: 0.35rem;
}
.mu-lg {
  color: #888;
  font-size: 0.62rem;
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
}
.mu-lg::before {
  content: '';
  width: 14px;
  height: 0;
  border-top: 2px solid var(--c, #666);
  display: inline-block;
}

.mu-graph-hint {
  color: #4a4a5c;
  font-size: 0.64rem;
  text-align: center;
  margin-top: 0.4rem;
  font-style: italic;
}

.mu-fxlist-head {
  color: #cfcfe6;
  font-size: 0.7rem;
  font-weight: 600;
  margin: 0.5rem 0 0.25rem;
  padding-top: 0.4rem;
  border-top: 1px solid #1c1c2a;
}
.mu-fxlist .mu-effect { margin: 0.12rem 0; }

.detail-card {
  background: #1a1a24;
  border-radius: 8px;
  padding: 1rem;
  margin-bottom: 0.75rem;
}

.detail-card h3 {
  color: #a0a0ff;
  font-size: 0.9rem;
  margin-bottom: 0.5rem;
}

.detail-card .detail-row {
  display: flex;
  justify-content: space-between;
  padding: 0.25rem 0;
  font-size: 0.85rem;
  border-bottom: 1px solid #1e1e28;
}

.detail-card .detail-row:last-child {
  border-bottom: none;
}

.detail-card .detail-label {
  color: #777;
}

.detail-card .detail-value {
  color: #e0e0e8;
  font-weight: 500;
}

.detail-card .detail-value.damage {
  color: #ff6b6b;
}

.detail-card .detail-value.healing {
  color: #4ecdc4;
}

/* Attribution Chain */
.attribution-chain {
  list-style: none;
  padding: 0;
}

.attribution-chain li {
  padding: 0.4rem 0.5rem;
  margin: 0.25rem 0;
  background: #0f0f16;
  border-radius: 4px;
  border-left: 3px solid #4a4aff;
  font-size: 0.8rem;
  color: #b0b0c0;
}

.attribution-chain li .source-type {
  color: #a0a0ff;
  font-weight: 500;
  margin-right: 0.25rem;
}

/* Buff/Debuff Context */
.effect-context {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-top: 0.5rem;
}

.effect-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.2rem 0.6rem;
  border-radius: 12px;
  font-size: 0.75rem;
  font-weight: 500;
}

.effect-badge.buff {
  background: rgba(78, 205, 196, 0.15);
  color: #4ecdc4;
  border: 1px solid rgba(78, 205, 196, 0.3);
}

.effect-badge.debuff {
  background: rgba(255, 107, 107, 0.15);
  color: #ff6b6b;
  border: 1px solid rgba(255, 107, 107, 0.3);
}

/* ========= Damage Log Sidebar ===================== */
.column-sidebar {
  width: 400px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  background: #12121c;
  border-left: 1px solid #222;
}

.damage-log-header {
  padding: 0.75rem 1rem;
  background: #1a1a24;
  border-bottom: 1px solid #222;
}

.damage-log-header h3 {
  color: #a0a0ff;
  font-size: 0.9rem;
  margin-bottom: 0.5rem;
}

.damage-log-search {
  width: 100%;
  padding: 0.4rem 0.6rem;
  background: #0d0d12;
  border: 1px solid #333;
  border-radius: 4px;
  color: #e0e0e8;
  font-size: 0.8rem;
}

.damage-log-search::placeholder {
  color: #555;
}

/* Buff/debuff line toggles — show/hide the consolidated effect lines in the log. */
.damage-log-toggles {
  display: flex;
  gap: 0.4rem;
  margin-top: 0.5rem;
}

.dl-toggle {
  flex: 1;
  padding: 0.3rem 0.5rem;
  background: #0d0d12;
  border: 1px solid #2a2a38;
  border-radius: 4px;
  color: #666;
  font-size: 0.72rem;
  cursor: pointer;
}

.dl-toggle:hover { border-color: #3a3a52; color: #999; }
#damage-log-buffs.active   { border-color: #4fc28a; color: #4fc28a; background: rgba(79, 194, 138, 0.1); }
#damage-log-debuffs.active { border-color: #e0726a; color: #e0726a; background: rgba(224, 114, 106, 0.1); }

.damage-log-content {
  flex: 1;
  overflow-y: auto;
}

/* Full-height spacer that holds the scrollbar for the virtualized log list. */
.damage-log-content .dl-sizer {
  position: relative;
  width: 100%;
}

.damage-log-content .log-line {
  position: absolute;
  left: 0;
  right: 0;
  height: 28px;
  box-sizing: border-box;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.3rem 0.6rem;
  font-family: 'Cascadia Code', 'Consolas', monospace;
  font-size: 0.76rem;
  line-height: 1.4;
  color: #aaa;
  border-bottom: 1px solid rgba(255, 255, 255, 0.02);
  cursor: pointer;
  transition: background 0.1s;
  white-space: nowrap;
}

.damage-log-content .log-line .text {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* The numeric outcome sits in its own column so it's never the part that gets
   ellipsized — the descriptive text shrinks first. */
.damage-log-content .log-line .value {
  flex-shrink: 0;
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  margin-left: auto;
}

.damage-log-content .log-line:hover {
  background: rgba(255, 255, 255, 0.03);
}

.damage-log-content .log-line.selected {
  background: rgba(74, 74, 255, 0.15);
}

/* Transient highlight when a line is jumped-to (kill feed / Biggest D). Fades out
   on its own so it doesn't read as a persistent selection — the user can click the
   line straight away for its matchup graph. */
.damage-log-content .log-line.flash-reveal {
  animation: log-flash 1.5s ease-out;
}
@keyframes log-flash {
  0%   { background: rgba(255, 214, 102, 0.55); }
  100% { background: rgba(255, 214, 102, 0); }
}

.damage-log-content .log-line .time {
  color: #555;
  flex-shrink: 0;
}

.damage-log-content .log-line.damage .value { color: #ff6b6b; }
.damage-log-content .log-line.healing .value { color: #4ecdc4; }
.damage-log-content .log-line.blocked .value { color: #888; }
.damage-log-content .log-line.evacued .value { color: #666; }
.damage-log-content .log-line.bloodlust { background: #1a0a1a; }
.damage-log-content .log-line.bloodlust .text { color: #c084fc; }
.damage-log-content .log-line.bloodlust .value { color: #a855f7; }

/* Consolidated buff/debuff application lines (<caster> [effect] → <holder>). */
.damage-log-content .log-line.state-buff   .text { color: #79c2a0; }
.damage-log-content .log-line.state-debuff .text { color: #d18a82; }
.damage-log-content .log-line .log-unknown { color: #555; font-style: italic; }
/* Cross-faction buff likely received by a mount/pet sharing a player's name. */
.damage-log-content .log-line .log-mount { color: #c79a5a; font-style: italic; }

/* Collapsed group header for same-caster/same-effect/same-second buff bursts. */
.damage-log-content .log-line.log-group .log-caret { color: #888; margin-right: 0.25rem; display: inline-block; width: 0.8em; }
.damage-log-content .log-line.log-group .log-count { font-weight: 700; }
.damage-log-content .log-line.log-child .text { padding-left: 1.3rem; opacity: 0.92; }

/* Scrollbar Styling */
::-webkit-scrollbar {
  width: 8px;
}

::-webkit-scrollbar-track {
  background: #0d0d12;
}

::-webkit-scrollbar-thumb {
  background: #333;
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: #555;
}

/* ========= Nav link (homepage → group events) ===================== */
.nav-link {
  color: #5a5aff;
  text-decoration: none;
  font-size: 0.9rem;
}
.nav-link:hover { color: #8080ff; }

/* ========= Generic page bar (non-timeline pages) ===================== */
.page-bar {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.6rem 1.5rem;
  background: #1a1a24;
  border-bottom: 1px solid #222;
  flex-shrink: 0;
  min-height: 48px;
}

.page-bar .back-btn {
  padding: 0.3rem 0.8rem;
  background: transparent;
  border: 1px solid #333;
  border-radius: 6px;
  color: #a0a0ff;
  cursor: pointer;
  font-size: 0.85rem;
  transition: all 0.2s;
}
.page-bar .back-btn:hover { background: #222; }

.page-title {
  font-weight: 600;
  font-size: 1rem;
  color: #e0e0e8;
  white-space: nowrap;
}

.page-bar-hint {
  flex: 1;
  font-size: 0.75rem;
  color: #444;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.action-btn {
  padding: 0.35rem 1rem;
  background: #3a3aff;
  color: white;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.85rem;
  transition: background 0.2s;
  white-space: nowrap;
}
.action-btn:hover:not(:disabled)   { background: #4a4aff; }
.action-btn:disabled { opacity: 0.45; cursor: not-allowed; }

.ghost-btn {
  padding: 0.35rem 0.9rem;
  background: transparent;
  color: #aaa;
  border: 1px solid #444;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.85rem;
  transition: all 0.2s;
}
.ghost-btn:hover { color: #e0e0e8; border-color: #666; }

/* Inline create form */
.inline-form {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1.5rem;
  background: #14141c;
  border-bottom: 1px solid #222;
  flex-shrink: 0;
}
.inline-form .name-input {
  flex: 1;
  max-width: 420px;
  padding: 0.45rem 0.9rem;
  background: #0d0d12;
  border: 1px solid #333;
  border-radius: 6px;
  color: #e0e0e8;
  font-size: 0.95rem;
}
.inline-form .name-input::placeholder { color: #555; }

/* Scrollable page body */
.page-scroll {
  flex: 1;
  overflow-y: auto;
  padding: 1.5rem;
}

/* Status badges */
.status-badge {
  display: inline-block;
  padding: 0.15rem 0.6rem;
  border-radius: 10px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.status-open    { background: rgba(78,205,196,0.15); color: #4ecdc4; }
.status-merging { background: rgba(255,230,109,0.15); color: #ffe66d; }
.status-ready   { background: rgba(74,74,255,0.15);  color: #8080ff; }

/* ========= Event Detail page ===================== */
.detail-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
  max-width: 1100px;
  margin: 0 auto 1.5rem;
}

@media (max-width: 800px) {
  .detail-grid { grid-template-columns: 1fr; }
}

.detail-section {
  max-width: 1100px;
  margin: 0 auto 1.5rem;
}

.section-title {
  color: #a0a0ff;
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 0.75rem;
}

.info-card {
  background: #1a1a24;
  border: 1px solid #222;
  border-radius: 10px;
  padding: 1rem 1.25rem;
  margin-bottom: 1rem;
}

.info-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.35rem 0;
  border-bottom: 1px solid #1e1e2e;
  font-size: 0.9rem;
}
.info-row:last-child { border-bottom: none; }

.info-label { color: #666; }

/* PIN display */
.pin-box {
  background: #1a1a24;
  border: 1px solid #333;
  border-radius: 10px;
  padding: 1.25rem;
  text-align: center;
}

.pin-label {
  font-size: 0.75rem;
  color: #666;
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 0.5rem;
}

.pin-code {
  font-size: 2.2rem;
  font-weight: 700;
  letter-spacing: 0.35em;
  color: #a0a0ff;
  font-family: 'Cascadia Code', 'Consolas', monospace;
  margin-bottom: 0.75rem;
}

.pin-hint {
  font-size: 0.8rem;
  color: #555;
  margin-top: 0.75rem;
  line-height: 1.5;
}

/* ========= Homepage redesign ===================== */
.home-header {
  text-align: center;
  padding: 1.5rem 2rem 0.75rem;
}

.home-header h1 {
  font-size: 2rem;
  color: #a0a0ff;
  margin-bottom: 0.25rem;
  text-shadow: 0 0 16px rgba(160, 160, 255, 0.25);
}

.home-header p {
  color: #666;
  font-size: 0.95rem;
}

.home-toolbar {
  display: flex;
  gap: 0.75rem;
  align-items: center;
  padding: 0.65rem 2rem;
  background: #0d0d12;
  position: sticky;
  top: 0;
  z-index: 10;
  border-bottom: 1px solid #1a1a26;
}

.search-input {
  flex: 1;
  max-width: 360px;
  padding: 0.45rem 0.85rem;
  background: #1a1a24;
  border: 1px solid #2a2a3a;
  border-radius: 6px;
  color: #e0e0e8;
  font-size: 0.9rem;
}

.search-input::placeholder { color: #555; }
.search-input:focus { outline: none; border-color: #4a4aff; }

/* Collapsible panel (upload / join-PIN) */
.collapsible-panel {
  background: #12121c;
  border-bottom: 1px solid #1e1e2e;
  padding: 1.25rem 2rem;
}

.panel-inner {
  max-width: 640px;
}

.panel-inner--narrow {
  max-width: 420px;
}

.panel-footer {
  display: flex;
  gap: 0.75rem;
  align-items: center;
  margin-top: 0.85rem;
  flex-wrap: wrap;
}

.panel-footer .name-input {
  flex: 1;
  min-width: 160px;
  max-width: 280px;
  padding: 0.45rem 0.85rem;
  background: #0d0d12;
  border: 1px solid #333;
  border-radius: 6px;
  color: #e0e0e8;
  font-size: 0.9rem;
}

.panel-footer .name-input::placeholder { color: #555; }

.panel-hint {
  color: #777;
  font-size: 0.88rem;
  margin-bottom: 0.85rem;
}

/* PIN entry */
.pin-entry-row {
  display: flex;
  gap: 0.75rem;
  align-items: center;
}

.pin-input-field {
  width: 110px;
  padding: 0.45rem 0.75rem;
  background: #0d0d12;
  border: 1px solid #333;
  border-radius: 6px;
  color: #e0e0e8;
  font-size: 1.1rem;
  letter-spacing: 0.2em;
  text-align: center;
  font-family: 'Cascadia Code', 'Consolas', monospace;
}

.pin-input-field:focus { outline: none; border-color: #4a4aff; }

/* Events section on homepage */
.events-section {
  padding: 1.25rem 2rem;
  max-width: 1100px;
  margin: 0 auto;
  width: 100%;
}

/* ========= Event Detail redesign ===================== */
/* Remove page-scroll default padding so summary bar goes full-width */
#event-detail-body { padding: 0; }

.event-summary-bar {
  padding: 0.65rem 1.5rem;
  background: #12121c;
  border-bottom: 1px solid #1e1e2e;
  font-size: 0.85rem;
  color: #888;
  display: flex;
  gap: 0.5rem;
  align-items: center;
  flex-wrap: wrap;
  flex-shrink: 0;
}

.event-summary-bar .sum-dot { color: #3a3a4a; }

.detail-body-inner {
  padding: 1.5rem;
  max-width: 1000px;
  margin: 0 auto;
  width: 100%;
}

.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
}

/* Add-log upload panel */
.add-log-panel {
  background: #12121c;
  border: 1px solid #222;
  border-radius: 8px;
  padding: 1.25rem;
  margin-bottom: 1.25rem;
}

/* Contributors read-only table */
.contributors-table {
  width: 100%;
  border-collapse: collapse;
  background: #1a1a24;
  border-radius: 8px;
  overflow: hidden;
  margin-bottom: 0.5rem;
}

.contributors-table th {
  text-align: left;
  padding: 0.55rem 1rem;
  background: #12121c;
  color: #666;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.contributors-table td {
  padding: 0.65rem 1rem;
  border-top: 1px solid #1e1e28;
  font-size: 0.9rem;
}

.contributors-table tr:hover td { background: rgba(255,255,255,0.02); }

.contributors-table .mono {
  font-family: 'Cascadia Code', 'Consolas', monospace;
  font-size: 0.8rem;
  color: #aaa;
}

.contributors-empty {
  padding: 1.5rem;
  text-align: center;
  color: #555;
  background: #1a1a24;
  border-radius: 8px;
  margin-bottom: 0.5rem;
}

/* Manage section */
.manage-section {
  margin-top: 2rem;
  border-top: 1px solid #1e1e2e;
  padding-top: 1rem;
}

.manage-toggle-btn {
  background: transparent;
  border: none;
  color: #555;
  font-size: 0.82rem;
  cursor: pointer;
  padding: 0.25rem 0;
  transition: color 0.15s;
}

.manage-toggle-btn:hover { color: #888; }

.manage-panel { margin-top: 1rem; }

.manage-inner {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.manage-block {
  background: #12121c;
  border: 1px solid #1e1e2e;
  border-radius: 8px;
  padding: 1rem 1.25rem;
}

.manage-label {
  font-size: 0.75rem;
  color: #555;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 0.75rem;
}

.manage-row { margin-bottom: 0.5rem; }

.manage-hint {
  font-size: 0.85rem;
  color: #666;
}

.manage-pin-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-top: 0.5rem;
}

.share-pin {
  font-family: 'Cascadia Code', 'Consolas', monospace;
  color: #a0a0ff;
  font-size: 1.2rem;
  letter-spacing: 0.2em;
}

.copy-btn {
  padding: 0.25rem 0.7rem;
  background: transparent;
  border: 1px solid #3a3a4a;
  border-radius: 5px;
  color: #777;
  font-size: 0.78rem;
  cursor: pointer;
  transition: all 0.15s;
}

.copy-btn:hover { border-color: #a0a0ff; color: #a0a0ff; }

/* Admin contributor list inside manage panel */
.manage-contribs { display: flex; flex-direction: column; gap: 0.5rem; }

.manage-contrib-row {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.5rem 0;
  border-bottom: 1px solid #1e1e28;
}

.manage-contrib-row:last-child { border-bottom: none; }

.manage-contrib-name {
  flex: 1;
  font-size: 0.9rem;
}

.manage-contrib-date {
  color: #666;
  font-size: 0.82rem;
  flex-shrink: 0;
}

.remove-btn {
  background: transparent;
  border: 1px solid #333;
  border-radius: 5px;
  color: #666;
  font-size: 0.8rem;
  padding: 0.2rem 0.6rem;
  cursor: pointer;
  transition: all 0.15s;
  flex-shrink: 0;
}

.remove-btn:hover {
  color: #ff6b6b;
  border-color: #ff6b6b;
  background: rgba(255,107,107,0.07);
}

/* ========= Event CTA (when combined log has data) ===================== */
.events-cta {
  background: linear-gradient(135deg, #12121c 0%, #1a1a2e 100%);
  border: 1px solid #2a2a4a;
  border-radius: 12px;
  padding: 2rem;
  text-align: center;
  margin-bottom: 2rem;
}

.events-cta-count {
  font-size: 3rem;
  font-weight: 700;
  color: #a0a0ff;
  line-height: 1;
  margin-bottom: 0.25rem;
}

.events-cta-label {
  color: #777;
  font-size: 0.9rem;
  margin-bottom: 1.25rem;
}

.cta-analyze-btn {
  display: inline-block;
  padding: 0.65rem 2rem;
  background: #4a4aff;
  color: white;
  border: none;
  border-radius: 8px;
  font-size: 1rem;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.2s, transform 0.1s;
}

.cta-analyze-btn:hover {
  background: #5a5aff;
  transform: translateY(-1px);
}

/* ========= Auth gate ===================== */
.auth-gate-prompt {
  color: #aaa;
  font-size: 0.9rem;
  margin-bottom: 0.85rem;
}

.auth-divider {
  text-align: center;
  color: #444;
  font-size: 0.82rem;
  margin: 1rem 0;
  position: relative;
}

.auth-divider::before,
.auth-divider::after {
  content: '';
  position: absolute;
  top: 50%;
  width: 35%;
  height: 1px;
  background: #2a2a3a;
}
.auth-divider::before { left: 0; }
.auth-divider::after  { right: 0; }

.discord-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 1.25rem;
  background: #5865F2;
  color: white;
  border: none;
  border-radius: 7px;
  font-size: 0.9rem;
  cursor: pointer;
  transition: background 0.15s;
}

.discord-btn:hover { background: #6b77f5; }

.auth-note {
  color: #555;
  font-size: 0.8rem;
  margin-top: 0.75rem;
  line-height: 1.4;
}

/* ========= Logged-in user indicators ===================== */

/* Small bar above the upload form when the user is authenticated via Discord */
.user-auth-bar {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.5rem 0.75rem;
  background: rgba(88, 101, 242, 0.1);
  border: 1px solid rgba(88, 101, 242, 0.2);
  border-radius: 6px;
  margin-bottom: 1rem;
  font-size: 0.85rem;
  color: #aaa;
}

.user-auth-bar strong { color: #c0c0ff; }

/* User chip in the homepage toolbar */
.home-user-chip {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.3rem 0.75rem;
  background: rgba(88, 101, 242, 0.12);
  border: 1px solid rgba(88, 101, 242, 0.25);
  border-radius: 20px;
  font-size: 0.82rem;
  color: #aaa;
  white-space: nowrap;
}

.home-user-name {
  color: #b0b0e0;
  font-weight: 500;
}

/* Compact Discord login button for toolbars and page bars */
.discord-login-btn {
  display: inline-flex;
  align-items: center;
  padding: 0.3rem 0.8rem;
  background: #5865F2;
  color: white;
  border: none;
  border-radius: 6px;
  font-size: 0.8rem;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s;
}
.discord-login-btn:hover { background: #6b77f5; }

/* Slot on the right side of the event detail page bar */
.page-bar-auth {
  display: flex;
  align-items: center;
}

/* Minimal text-only button — used for Logout inline links */
.link-btn {
  background: none;
  border: none;
  color: #5865F2;
  font-size: inherit;
  cursor: pointer;
  padding: 0;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.link-btn:hover { color: #8a93ff; }

/* ========= Contributor toggle ===================== */
.contrib-toggle-btn {
  background: transparent;
  border: none;
  color: #666;
  font-size: 0.85rem;
  cursor: pointer;
  padding: 0.25rem 0;
  transition: color 0.15s;
}

.contrib-toggle-btn:hover { color: #a0a0ff; }

/* "you" badge in contributor table */
.you-badge {
  display: inline-block;
  font-size: 0.7rem;
  padding: 0.1rem 0.4rem;
  background: rgba(160, 160, 255, 0.15);
  color: #a0a0ff;
  border-radius: 8px;
  margin-left: 0.4rem;
  vertical-align: middle;
}

.contributors-table .my-row td {
  background: rgba(160, 160, 255, 0.04);
}

/* ========= Homepage creation success card ===================== */
.creation-success {
  background: #14141e;
  border: 1px solid #2a2a4a;
  border-radius: 12px;
  padding: 2rem;
  margin-bottom: 1.5rem;
  max-width: 640px;
}

.creation-success-title {
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: #4ecdc4;
  margin-bottom: 0.4rem;
}

.creation-success-name {
  font-size: 1.4rem;
  font-weight: 600;
  color: #e0e0e8;
  margin-bottom: 1.25rem;
}

.creation-success-body {
  margin-bottom: 1.25rem;
}

.creation-pin-block {
  background: #0d0d14;
  border: 1px solid #2a2a3a;
  border-radius: 8px;
  padding: 1rem 1.25rem;
  margin-bottom: 0.75rem;
}

.creation-pin-label {
  color: #888;
  font-size: 0.85rem;
  margin-bottom: 0.75rem;
}

.creation-pin-row {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.creation-pin-code {
  font-family: 'Cascadia Code', 'Consolas', monospace;
  font-size: 2rem;
  font-weight: 700;
  letter-spacing: 0.3em;
  color: #a0a0ff;
}

.creation-stats {
  color: #666;
  font-size: 0.85rem;
}

.creation-actions {
  display: flex;
  gap: 0.75rem;
  align-items: center;
}

/* ========= Admin Panel ===================== */

.admin-section {
  max-width: 900px;
  padding: 2rem;
}

.admin-section-header {
  margin-bottom: 1.5rem;
}

.admin-section-header h2 {
  font-size: 1.1rem;
  color: #e0e0e8;
  margin-bottom: 0.4rem;
}

.admin-hint {
  font-size: 0.82rem;
  color: #555;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  flex-wrap: wrap;
}

.admin-users-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}

.admin-users-table th {
  text-align: left;
  color: #555;
  font-weight: 500;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 0 0.75rem 0.6rem;
  border-bottom: 1px solid #1a1a26;
}

.admin-users-table td {
  padding: 0.6rem 0.75rem;
  border-bottom: 1px solid #111118;
  color: #c0c0d0;
  vertical-align: middle;
}

.admin-users-table .my-row td { background: rgba(88,101,242,0.04); }

.discord-id-cell { display: flex; align-items: center; gap: 0.5rem; }

.discord-id-code {
  font-family: monospace;
  font-size: 0.78rem;
  color: #666;
  background: #0d0d14;
  padding: 0.15rem 0.4rem;
  border-radius: 3px;
  border: 1px solid #1a1a26;
}

.role-select {
  background: #1a1a28;
  border: 1px solid #2a2a3a;
  border-radius: 5px;
  color: #c0c0d0;
  padding: 0.2rem 0.5rem;
  font-size: 0.82rem;
  cursor: pointer;
}
.role-select:focus { outline: none; border-color: #4a4aaa; }

.role-badge {
  display: inline-block;
  padding: 0.15rem 0.5rem;
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 600;
  background: #1a1a28;
  color: #666;
  border: 1px solid #2a2a3a;
}
.role-badge.role-mod   { background: rgba(80,160,80,0.12); color: #6dc46d; border-color: rgba(80,160,80,0.25); }
.role-badge.role-admin { background: rgba(242,101,88,0.12); color: #e88; border-color: rgba(242,101,88,0.25); }

.role-status {
  font-size: 0.78rem;
  white-space: nowrap;
}

.admin-lastseen { color: #444; font-size: 0.8rem; }
.admin-self-note { color: #444; font-size: 0.78rem; }

.admin-bootstrap-note {
  margin-top: 2rem;
  padding: 0.85rem 1rem;
  background: #0d0d14;
  border: 1px solid #1a1a26;
  border-radius: 6px;
  font-size: 0.8rem;
  color: #555;
  line-height: 1.6;
}
.admin-bootstrap-note code {
  background: #141420;
  padding: 0.1rem 0.35rem;
  border-radius: 3px;
  color: #8888cc;
  font-size: 0.78rem;
}

/* Admin nav link in the user chip */
.admin-nav-link {
  color: #888;
  font-size: 0.78rem;
  text-decoration: none;
  padding: 0.1rem 0.45rem;
  border: 1px solid #2a2a3a;
  border-radius: 4px;
  transition: color 0.15s, border-color 0.15s;
}
.admin-nav-link:hover { color: #bbb; border-color: #3a3a5a; }

/* ========= Knowledge Base Page ===================== */

.kb-body { display: flex; flex-direction: column; overflow: hidden; padding: 0; }

/* Tabs */
.kb-tabs { display: flex; gap: 0; border-bottom: 1px solid #1e1e2e; background: #0b0b14; flex-shrink: 0; }
.kb-tab {
  padding: 0.6rem 1.2rem; background: none; border: none;
  border-bottom: 2px solid transparent; color: #666; cursor: pointer;
  font-size: 0.8rem; display: flex; align-items: center; gap: 0.4rem; transition: color 0.1s;
}
.kb-tab:hover { color: #999; }
.kb-tab.active { color: #a0a0ff; border-bottom-color: #5a5aff; }
.kb-count { font-size: 0.65rem; padding: 0.1rem 0.35rem; background: #1e1e2e; border-radius: 10px; color: #555; }
.kb-count-warn   { background: #2a1e10; color: #ff9f43; }
.kb-count-review { background: #251e10; color: #ffcc66; }

/* Master-detail layout */
.kb-layout { display: flex; flex: 1; min-height: 0; }

/* List panel */
.kb-list-panel {
  width: 260px; flex-shrink: 0; display: flex; flex-direction: column;
  border-right: 1px solid #0e0e1c; overflow: hidden;
}
.kb-list-controls {
  padding: 7px; border-bottom: 1px solid #0e0e1c;
  display: flex; flex-direction: column; gap: 6px; flex-shrink: 0;
}
.kb-search {
  width: 100%; background: #0f0f1a; border: 1px solid #1a1a2a; border-radius: 4px;
  color: #ccc; padding: 5px 8px; font-size: 0.75rem; box-sizing: border-box;
}
.kb-search:focus { outline: none; border-color: #5a5aff; }
.kb-filter-btns { display: flex; gap: 3px; }
.kb-filter-btn {
  flex: 1; padding: 3px 0; background: transparent; border: 1px solid #1a1a2a;
  border-radius: 3px; color: #6f6f92; font-size: 0.65rem; cursor: pointer; text-align: center;
}
.kb-filter-btn:hover { color: #777; border-color: #333; }
.kb-filter-btn.active { background: #111128; border-color: #3a3aaa; color: #a0a0ff; }

/* Tags add row */
.kb-tags-add-row {
  display: flex; gap: 5px; align-items: center;
  padding: 7px; border-bottom: 1px solid #0e0e1c; flex-shrink: 0;
}
.kb-tags-add-input {
  flex: 1; background: #0f0f1a; border: 1px solid #1a1a2a; border-radius: 4px;
  color: #ccc; padding: 4px 7px; font-size: 0.72rem;
}
.kb-tags-add-input:focus { outline: none; border-color: #5a5aff; }
.kb-tags-add-input::placeholder { color: #50506b; }

/* List items */
.kb-list-items { flex: 1; overflow-y: auto; }
.kb-list-empty { padding: 20px 10px; text-align: center; color: #5f5f7e; font-size: 0.72rem; }
.kb-list-item {
  display: flex; justify-content: space-between; align-items: center;
  padding: 7px 10px; cursor: pointer;
  border-bottom: 1px solid #0a0a14; border-left: 2px solid transparent;
  transition: background 0.1s;
}
.kb-list-item:hover { background: #0d0d1a; }
.kb-list-item.active { background: #0e0e22; border-left-color: #5a5aff; }
.kb-li-name {
  font-size: 0.78rem; color: #aaa; flex: 1; min-width: 0;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.kb-list-item.active .kb-li-name { color: #ddd; }
.kb-li-status { display: flex; align-items: center; gap: 4px; margin-left: 6px; flex-shrink: 0; }
.kb-li-tier { font-size: 0.58rem; padding: 1px 5px; border-radius: 3px; white-space: nowrap; }
.kb-li-hard { background: #2a0d0d; color: #ff6b6b; }
.kb-li-soft { background: #2a1a0d; color: #ff9f43; }
.kb-li-dmgtype { font-size: 0.58rem; padding: 1px 5px; border-radius: 3px; white-space: nowrap; }
.kb-li-dmg-physical { background: #0f1e0f; color: #5abe5a; }
.kb-li-dmg-magic    { background: #0d1030; color: #7aa2ff; }
.kb-li-dmg-siege    { background: #231212; color: #ff8c42; }
.kb-li-dmg-healing  { background: #0d2020; color: #44ccaa; }
.kb-li-dmg-utility  { background: #181818; color: #555; }

/* Damage type checkboxes in skill detail */
.kb-dtype-options { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.kb-dtype-label {
  display: flex; align-items: center; gap: 4px;
  font-size: 0.75rem; color: #808092; cursor: pointer; user-select: none;
  padding: 3px 8px; border: 1px solid #1a1a2a; border-radius: 3px;
  transition: color 0.1s, border-color 0.1s, background 0.1s;
}
.kb-dtype-label.checked            { background: #111128; }
.kb-dtype-physical.checked         { border-color: #2a4a2a; color: #5abe5a; }
.kb-dtype-magic.checked            { border-color: #1e2060; color: #7aa2ff; }
.kb-dtype-siege.checked            { border-color: #3a1a0a; color: #ff8c42; }
.kb-dtype-healing.checked          { border-color: #0a3028; color: #44ccaa; }
.kb-dtype-utility { border-style: dashed; }
.kb-dtype-utility.checked          { border-color: #333; color: #666; }
.kb-li-tagcount, .kb-li-condcount { font-size: 0.58rem; color: #6f6f92; }
.kb-li-unset { font-size: 0.7rem; color: #5f5f7e; }
.kb-li-meta { font-size: 0.6rem; color: #5f5f7e; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 90px; }
.kb-li-entity { font-size: 0.58rem; padding: 1px 5px; border-radius: 3px; white-space: nowrap; background: #101828; color: #4a90c0; }
.kb-li-entity-review { background: #1e1608; color: #c09a30; }
.kb-kindstatus { font-size: 0.55rem; padding: 1px 5px; border-radius: 3px; margin-left: 0.35rem; vertical-align: middle; }
.kb-kindstatus-manual   { background: #0d2318; color: #4ade80; }
.kb-kindstatus-inferred { background: #1a1a2a; color: #8888aa; }
.kb-li-faction { font-size: 0.58rem; padding: 1px 5px; border-radius: 3px; white-space: nowrap; }
.kb-li-faction-nuia    { background: #0d1428; color: #6699ff; }
.kb-li-faction-haranya { background: #1e0d0d; color: #ff6666; }
.kb-li-faction-pirate  { background: #1a0d2a; color: #cc88ff; }
.kb-li-faction-pve     { background: #0d1e0d; color: #66bb66; }

/* Faction picker in player detail */
.kb-faction-options { display: flex; gap: 5px; flex-wrap: wrap; margin-top: 6px; }
.kb-faction-btn {
  padding: 4px 12px; font-size: 0.72rem; border-radius: 4px; cursor: pointer;
  background: transparent; border: 1px solid #1a1a2a; color: #6f6f92;
  transition: background 0.1s, color 0.1s;
}
.kb-faction-btn:hover:not(:disabled)  { border-color: #333; color: #999; }
.kb-faction-btn:disabled              { cursor: default; opacity: 0.5; }
.kb-faction-nuia.active    { background: #0d1428; border-color: #3355aa; color: #6699ff; }
.kb-faction-haranya.active { background: #1e0d0d; border-color: #882222; color: #ff6666; }
.kb-faction-pirate.active  { background: #1a0d2a; border-color: #662299; color: #cc88ff; }
.kb-faction-pve.active     { background: #0d1e0d; border-color: #226622; color: #66bb66; }
.kb-faction-nuia:hover:not(:disabled)    { color: #6699ff; }
.kb-faction-haranya:hover:not(:disabled) { color: #ff6666; }
.kb-faction-pirate:hover:not(:disabled)  { color: #cc88ff; }
.kb-faction-pve:hover:not(:disabled)     { color: #66bb66; }

/* Entity review banner in skill detail */
.kb-entity-review-banner {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 12px;
  margin-bottom: 16px; padding: 10px 12px;
  background: #1e1608; border: 1px solid #3d2e08; border-radius: 5px;
  font-size: 0.75rem; color: #c09a30;
}
.kb-entity-review-msg { flex: 1; line-height: 1.4; }
.kb-entity-review-actions { display: flex; flex-direction: column; gap: 4px; flex-shrink: 0; }
.kb-entity-review-dismiss,
.kb-entity-review-promote {
  padding: 3px 10px; font-size: 0.68rem; border-radius: 3px; cursor: pointer;
  white-space: nowrap; text-align: center;
}
.kb-entity-review-dismiss {
  background: #252010; border: 1px solid #4d3e10; color: #c09a30;
}
.kb-entity-review-dismiss:hover { background: #2f2812; border-color: #6a5518; }
.kb-entity-review-promote {
  background: #0d1e10; border: 1px solid #1e4a22; color: #66bb66;
}
.kb-entity-review-promote:hover { background: #102414; border-color: #2a6030; }

/* Detail panel */
.kb-detail-panel { flex: 1; overflow-y: auto; min-width: 0; }
.kb-detail-empty {
  height: 100%; display: flex; align-items: center; justify-content: center;
  color: #5f5f7e; font-size: 0.85rem;
}
.kb-detail-card { padding: 20px 24px; max-width: 680px; }
.kb-detail-head {
  display: flex; align-items: flex-start; justify-content: space-between;
  margin-bottom: 20px; gap: 12px;
}
.kb-detail-title-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; flex: 1; min-width: 0; }
.kb-detail-title { font-size: 1.1rem; font-weight: 600; color: #ddd; margin: 0; line-height: 1.2; }
.kb-detail-seen { font-size: 0.68rem; color: #5f5f7e; }
.kb-detail-clear {
  font-size: 0.68rem; color: #7a3333; background: transparent;
  border: 1px solid #3a1818; border-radius: 3px; padding: 4px 10px;
  cursor: pointer; flex-shrink: 0; white-space: nowrap;
}
.kb-detail-clear:hover { color: #ff5555; border-color: #aa2222; }

/* Fields */
.kb-field { margin-bottom: 16px; }
.kb-field-label {
  font-size: 0.63rem; text-transform: uppercase; letter-spacing: 0.07em;
  color: #7878a0; margin-bottom: 7px; display: flex; align-items: center; gap: 8px;
}
.kb-field-row { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.kb-field-row-inline { display: flex; gap: 24px; flex-wrap: wrap; }
.kb-field-group { display: flex; flex-direction: column; gap: 5px; }
.kb-field-hint { font-size: 0.62rem; color: #6f6f92; display: block; margin-top: 2px; }
.kb-kind-why { line-height: 1.7; }
.kb-kind-why .kb-rel-target { font-size: 0.66rem; padding: 1px 5px; vertical-align: baseline; }
.kb-field-sublabel { font-size: 0.66rem; color: #9a9ab8; margin-right: 6px; align-self: center; }
.kb-field-input { width: 100%; box-sizing: border-box; }
.kb-amp-types { display: flex; gap: 4px; margin-top: 6px; }

/* kb-input */
.kb-input {
  background: transparent; border: none; border-bottom: 1px solid #1e1e2e;
  color: #999; font-size: 0.78rem; padding: 3px 4px; font-family: inherit;
}
.kb-input:focus { outline: none; border-bottom-color: #5a5aff; color: #ccc; }
.kb-input::placeholder { color: #50506b; }

/* CC tier (large, prominent) */
.kb-cctier-options { display: flex; gap: 6px; }
.kb-cctier-opt {
  padding: 6px 16px; font-size: 0.8rem; background: #0f0f1c;
  border: 1px solid #1c1c2c; border-radius: 4px; color: #6f6f92; cursor: pointer;
}
.kb-cctier-opt:hover { border-color: #3a3a5a; color: #666; }
.kb-cctier-opt.active                  { background: #111128; border-color: #5a5aff; color: #9090ff; }
.kb-cctier-opt.active.kb-cctier-hard   { background: #2a0d0d; border-color: #dd4444; color: #ff7070; }
.kb-cctier-opt.active.kb-cctier-soft   { background: #2a1a0d; border-color: #cc7700; color: #ffaa44; }

/* Gen amp */
.kb-amp-label {
  display: flex; align-items: center; gap: 5px;
  font-size: 0.78rem; color: #666; cursor: pointer;
}
.kb-amp-subfields { display: flex; flex-direction: column; gap: 8px; margin-top: 8px; }
.kb-amp-row { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.kb-amp-sublabel {
  font-size: 0.6rem; color: #7878a0; text-transform: uppercase;
  letter-spacing: 0.05em; width: 80px; flex-shrink: 0;
}

/* Chip input */
.kb-chip-wrap {
  display: flex; flex-wrap: wrap; align-items: center; gap: 5px;
  min-height: 34px; padding: 4px 6px;
  background: #090910; border: 1px solid #18182a; border-radius: 4px;
}
.kb-chip {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 8px 3px 9px; background: #12123a;
  border: 1px solid #3030aa; border-radius: 10px;
  font-size: 0.7rem; color: #9090ee;
}
.kb-chip-x { background: none; border: none; color: #3a3a88; cursor: pointer; font-size: 0.8rem; line-height: 1; padding: 0; }
.kb-chip-x:hover { color: #ff6b6b; }
.kb-chip-adder { position: relative; flex: 1; min-width: 90px; }
.kb-chip-input {
  background: transparent; border: none; color: #666;
  font-size: 0.72rem; padding: 3px 4px; width: 100%; outline: none; font-family: inherit;
}
.kb-chip-input::placeholder { color: #50506b; }
.kb-chip-drop {
  position: absolute; top: calc(100% + 3px); left: 0; z-index: 200;
  background: #0f0f22; border: 1px solid #2a2a55; border-radius: 4px;
  min-width: 160px; max-height: 180px; overflow-y: auto; display: none;
}
.kb-drop-item {
  display: block; width: 100%; text-align: left; padding: 5px 10px;
  background: none; border: none; color: #777; font-size: 0.72rem;
  cursor: pointer; font-family: inherit;
}
.kb-drop-item:hover { background: #151530; color: #ccc; }

/* Select dropdowns */
.kb-select {
  background: #0f0f1c; border: 1px solid #1c1c2c; border-radius: 4px;
  color: #aaa; font-size: 0.78rem; padding: 5px 8px; cursor: pointer; min-width: 130px;
}
.kb-select:focus { outline: none; border-color: #5a5aff; }

/* Type toggle buttons (reused in conditions) */
.kb-type-btn {
  font-size: 0.65rem; padding: 0.15rem 0.4rem;
  background: #151520; border: 1px solid #252535;
  border-radius: 3px; color: #555; cursor: pointer; transition: all 0.1s; white-space: nowrap;
}
.kb-type-btn:hover { border-color: #3a3a5a; color: #888; }
.kb-type-btn-sm { padding: 0.1rem 0.3rem; font-size: 0.6rem; }
.kb-type-btn.active                    { background: #111128; border-color: #5a5aff; color: #a0a0ff; }
.kb-type-btn.active[data-type="hard"],
.kb-type-btn.active[data-type="hardcc"]{ background: #2a0d0d; border-color: #ff6b6b; color: #ff6b6b; }
.kb-type-btn.active[data-type="soft"],
.kb-type-btn.active[data-type="softcc"]{ background: #2a1a0d; border-color: #ff9f43; color: #ff9f43; }
.kb-type-btn.active[data-type="dmgtype"]  { background: #0f1e0f; border-color: #5abe5a; color: #5abe5a; }
.kb-type-btn.active[data-type="action-r"] { background: #1a1020; border-color: #a78bfa; color: #a78bfa; }
.kb-type-btn.active[data-type="side"],
.kb-type-btn.active[data-type="checkmode"],
.kb-type-btn.active[data-type="single"],
.kb-type-btn.active[data-type="aoe"],
.kb-type-btn.active[data-type="cast-aoe"],
.kb-type-btn.active[data-type="multi"],
.kb-type-btn.active[data-type="self"]  { background: #111128; border-color: #5a5aff; color: #a0a0ff; }

/* Clear / action / ghost */
.kb-clear-btn { background: none; border: none; color: #333; cursor: pointer; font-size: 0.9rem; line-height: 1; padding: 0; }
.kb-clear-btn:hover { color: #ff6b6b; }
.kb-action-btn {
  padding: 4px 10px; background: #1a1a3a; border: 1px solid #3a3a6a;
  border-radius: 4px; color: #a0a0ff; font-size: 0.72rem; cursor: pointer; white-space: nowrap;
}
.kb-action-btn:hover { background: #222244; border-color: #5a5aff; }
.kb-ghost-btn {
  padding: 4px 10px; background: transparent; border: 1px solid #2a2a4a;
  border-radius: 4px; color: #555; font-size: 0.72rem; cursor: pointer; white-space: nowrap;
}
.kb-ghost-btn:hover { color: #888; border-color: #444; }
.kb-ghost-btn.active { color: #4ade80; border-color: #2f6f43; background: #4ade801a; }
.kb-reviewed-badge { color: #4ade80; }
.stats-eff-type { font-size: 0.68em; color: #6a6a82; text-transform: uppercase; letter-spacing: 0.03em; }

/* Category badge */
.kb-category-tag {
  font-size: 0.6rem; padding: 0.08rem 0.3rem; border-radius: 3px;
  text-transform: uppercase; letter-spacing: 0.03em;
}
.kb-cat-debuff { background: #2a0d18; color: #ff6b8a; border: 1px solid #4d1a30; }
.kb-cat-buff   { background: #0d1e2a; color: #4ecdc4; border: 1px solid #1a3d4d; }

/* Condition list */
.kb-cond-list { display: flex; flex-direction: column; gap: 6px; }
.kb-cond-add-inline { font-size: 0.68rem; padding: 2px 8px; margin-left: 6px; vertical-align: middle; }
.kb-cond-empty-txt { font-size: 0.75rem; color: #66668a; padding: 8px 0; }
.kb-cond-row {
  display: flex; align-items: center; flex-wrap: wrap; gap: 4px;
  padding: 6px 8px; background: #0c0c18; border: 1px solid #151525; border-radius: 4px;
}
.kb-cond-lbl   { font-size: 0.65rem; color: #7878a0; white-space: nowrap; }
.kb-cond-arrow { color: #5f5f7e; font-size: 0.8rem; padding: 0 2px; }
.kb-cond-check {
  display: flex; align-items: center; gap: 4px;
  font-size: 0.63rem; color: #7878a0; cursor: pointer;
  margin-left: auto; white-space: nowrap;
}
.kb-cond-select {
  background: #0f0f1a; border: 1px solid #222230; border-radius: 3px;
  color: #aaa; font-size: 0.68rem; padding: 2px 4px; cursor: pointer;
}
.kb-cond-select:focus { outline: none; border-color: #5a5aff; }
.kb-cond-input { width: 120px; font-size: 0.7rem; }

/* Examples */
.kb-ex-section { margin-top: 24px; padding-top: 16px; border-top: 1px solid #111120; }
.kb-ex-header { font-size: 0.62rem; text-transform: uppercase; letter-spacing: 0.07em; color: #66668a; margin-bottom: 10px; }
.kb-ex-loading, .kb-ex-empty { font-size: 0.72rem; color: #50506b; }
.kb-ex-group { margin-bottom: 14px; background: #06060e; border: 1px solid #0e0e1c; border-radius: 4px; overflow: hidden; }
.kb-ex-line { display: flex; flex-wrap: wrap; gap: 3px 10px; padding: 3px 8px; font-size: 0.68rem; align-items: baseline; }
.kb-ex-focus { background: #0e0e22; border-left: 2px solid #4a4aaa; }
.kb-ex-time { color: #66668a; flex-shrink: 0; font-family: monospace; font-size: 0.65rem; }
.kb-ex-text { color: #555; font-family: monospace; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1; }
.kb-ex-focus .kb-ex-text { color: #aaa; }
.kb-ex-raw  { flex-basis: 100%; font-size: 0.59rem; color: #4d4d63; font-family: monospace; padding-left: 10px; word-break: break-all; line-height: 1.3; }
.kb-ex-focus .kb-ex-raw { color: #333350; }

/* Tag used-by */
.kb-tag-used-by { display: flex; flex-wrap: wrap; gap: 6px; }
.kb-used-effect {
  font-size: 0.7rem; padding: 3px 10px; background: #0f0f1a;
  border: 1px solid #1a1a2a; border-radius: 3px; color: #555;
}

/* ========= Participant Perspective Bar ===================== */

.participant-perspective-bar {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.35rem 0.4rem;
  border-bottom: 1px solid #1a1a28;
  background: #09090f;
  flex-shrink: 0;
}

.persp-label {
  font-size: 0.6rem;
  color: #444;
  white-space: nowrap;
  margin-right: 0.15rem;
}

.persp-btn {
  font-size: 0.62rem;
  padding: 0.12rem 0;
  background: #151520;
  border: 1px solid #252535;
  border-radius: 3px;
  color: #555;
  cursor: pointer;
  flex: 1;
  text-align: center;
  transition: border-color 0.1s, color 0.1s;
}
.persp-btn:hover                   { border-color: #3a3a5a; color: #888; }
.persp-btn.active.persp-nuia       { background: #0d2a18; border-color: #4ade80; color: #4ade80; }
.persp-btn.active.persp-haranya    { background: #2a0d0d; border-color: #ff6b6b; color: #ff6b6b; }
.persp-btn.active.persp-pirate     { background: #1a0d2a; border-color: #9b59b6; color: #9b59b6; }

/* ========= Participant search ===================== */

.participant-search-bar {
  position: relative;
  padding: 0.35rem 0.4rem;
  border-bottom: 1px solid #1a1a28;
  background: #09090f;
  flex-shrink: 0;
}

.participant-search {
  width: 100%;
  box-sizing: border-box;
  font-size: 0.68rem;
  padding: 0.25rem 1.4rem 0.25rem 0.45rem;
  background: #151520;
  border: 1px solid #252535;
  border-radius: 3px;
  color: #ccc;
  outline: none;
  transition: border-color 0.1s;
}
.participant-search::placeholder { color: #444; }
.participant-search:focus        { border-color: #3a3a5a; }

.participant-search-clear {
  position: absolute;
  right: 0.7rem;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: #666;
  font-size: 0.9rem;
  line-height: 1;
  cursor: pointer;
  padding: 0 0.2rem;
}
.participant-search-clear:hover { color: #ccc; }

.participant-empty {
  padding: 0.6rem 0.5rem;
  font-size: 0.65rem;
  color: #555;
  text-align: center;
}

/* ========= Faction Tags (participant list) ===================== */

.faction-tag {
  font-size: 0.55rem;
  padding: 0.05rem 0.18rem;
  border-radius: 2px;
  font-weight: bold;
  flex-shrink: 0;
  line-height: 1.2;
}
.faction-tag.inferred        { opacity: 0.55; }

/* ========= Faction Picker (stats panel) ===================== */

.faction-btn {
  font-size: 0.68rem;
  padding: 0.18rem 0.4rem;
  background: #151520;
  border: 1px solid #252535;
  border-radius: 3px;
  color: #555;
  cursor: pointer;
  transition: border-color 0.1s, color 0.1s;
}
.faction-btn:hover  { border-color: var(--fc, #3a3a5a); color: var(--fc, #888); }
.faction-btn.active { /* colors applied inline via perspective */ }

/* Mount/pet shortcut: purple accent (matches the mount/pet conflict note) */
.faction-btn-mountpet { --fc: #9b6dff; margin-left: 0.25rem; }

/* ========= Stats panel loading (CC attribution) ============== */

.stats-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 1.5rem 0.5rem;
  font-size: 0.72rem;
  color: #666;
}
.stats-spinner {
  display: inline-block;
  width: 14px;
  height: 14px;
  border: 2px solid #2a2a3a;
  border-top-color: #4a4aff;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

/* ========= Player breakdown (stats panel) ===================== */

.stats-breakdown-group {
  margin-bottom: 2px;
  border-radius: 3px;
  overflow: hidden;
}

.stats-breakdown-header {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.22rem 0.3rem;
  font-size: 0.78rem;
  cursor: pointer;
  border-radius: 3px;
  transition: background 0.1s;
}
.stats-breakdown-header:hover { background: rgba(255,255,255,0.04); }
.stats-breakdown-group[data-expand]:hover .stats-expand-arrow { color: #aaa; }

.stats-expand-arrow {
  flex-shrink: 0;
  font-size: 0.6rem;
  color: #555;
  width: 8px;
  text-align: center;
}

.stats-skill-breakdown {
  padding: 0.1rem 0 0.1rem 0.5rem;
  border-left: 1px solid rgba(255,255,255,0.06);
  margin-left: 0.3rem;
  margin-bottom: 0.25rem;
}

.stats-skill-row {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.12rem 0;
  font-size: 0.72rem;
}

.stats-skill-name {
  width: 90px;
  flex-shrink: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: #666;
}

/* ========= Faction Groups (participant list) ===================== */

.faction-group-header {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.28rem 0.65rem;
  cursor: pointer;
  background: #0c0c15;
  border-bottom: 1px solid rgba(255,255,255,0.03);
  user-select: none;
}
.faction-group-header:hover { background: #101018; }

.faction-group-arrow {
  font-size: 0.6rem;
  color: #444;
  flex-shrink: 0;
  width: 8px;
}

.faction-group-label {
  font-size: 0.65rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  flex: 1;
}

.faction-group-count {
  font-size: 0.62rem;
  color: #444;
  margin-right: 0.2rem;
}

.participant-row.dimmed { opacity: 0.28; }

/* Centered faction show/hide region — the flexible middle of the chart-mode bar.
   Keeps flex:1 even when empty so the mode buttons and resolution controls stay
   pinned to the left and right edges. */
.faction-vis-bar {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 0.35rem;
  min-width: 0;
}

/* Same compact look as the Damage/Healing/CC buttons. Shown factions get an
   inline faction-colored highlight (set in JS); hidden ones use this plain style. */
.faction-vis-chip {
  padding: 0.15rem 0.55rem;
  border: 1px solid #2a2a3a;
  background: none;
  color: #555;
  border-radius: 3px;
  cursor: pointer;
  font-size: 0.7rem;
  font-family: inherit;
  transition: color 0.15s, border-color 0.15s, background 0.15s;
}
.faction-vis-chip:hover { color: #aaa; border-color: #444; }


.faction-inline {
  display: flex;
  gap: 0.25rem;
  align-items: center;
  flex-wrap: wrap;
  padding: 0.3rem 0 0.15rem;
}

.faction-inferred {
  font-size: 0.6rem;
  color: #444;
  margin-left: 0.1rem;
}

.faction-trace-btn {
  font-size: 0.6rem;
  width: 14px; height: 14px;
  line-height: 12px;
  padding: 0;
  margin-left: 0.25rem;
  border-radius: 50%;
  background: #1a1a2a;
  border: 1px solid #3a3a5a;
  color: #8888aa;
  cursor: pointer;
}
.faction-trace-btn:hover { border-color: #6666aa; color: #ccc; }

.faction-trace {
  margin: 0.25rem 0 0.2rem;
  padding: 0.4rem 0.5rem;
  background: #0e0e16;
  border: 1px solid #20202e;
  border-radius: 4px;
  font-size: 0.62rem;
  line-height: 1.5;
  color: #9a9ab0;
}
.ftrace-line { margin: 0.12rem 0; }
.ftrace-sub  { color: #6a6a80; padding-left: 0.5rem; }
.ftrace-warn {
  color: #f0b86c;
  background: #2a1d0e;
  border-left: 2px solid #cc8822;
  padding: 0.25rem 0.4rem;
  border-radius: 2px;
  margin: 0.25rem 0;
}

.faction-conflict-note {
  font-size: 0.62rem;
  line-height: 1.4;
  color: #c89ad6;
  background: #1c1226;
  border-left: 2px solid #9b59b6;
  padding: 0.3rem 0.45rem;
  border-radius: 2px;
  margin: 0.25rem 0 0.2rem;
}

/* ========= Responsive ===================== */
@media (max-width: 900px) {
  .column-sidebar {
    width: 320px;
  }
}

@media (max-width: 700px) {
  .column-sidebar {
    display: none;
  }

  .timeline-bar {
    flex-wrap: wrap;
  }
}

/* ========= KB redesign (entity / relationship) ===================== */
.kb-kind-badge {
  font-size: 0.58rem; padding: 0.08rem 0.4rem; border-radius: 3px;
  text-transform: uppercase; letter-spacing: 0.04em; flex-shrink: 0;
}
.kb-kind-skills  { background: #111128; color: #9090ff; border: 1px solid #2a2a6a; }
.kb-kind-effects { background: #2a0d18; color: #ff8aa8; border: 1px solid #4d1a30; }
.kb-kind-actors  { background: #0d1e0d; color: #6abf6a; border: 1px solid #1e4a1e; }
.kb-kind-tags    { background: #0f0f1a; color: #8a8a9e; border: 1px solid #2a2a3a; font-family: monospace; }

/* kind initial badge in the unified 'All' list */
.kb-li-kind {
  flex-shrink: 0; width: 15px; height: 15px; border-radius: 3px;
  font-size: 0.55rem; font-weight: 700; display: inline-flex; align-items: center; justify-content: center;
  background: #15152a; color: #8080c0; margin-right: 4px;
}

.kb-list-item.kb-li-ignored { opacity: 0.5; }
.kb-list-item.kb-li-ignored .kb-li-name { text-decoration: line-through; }

.kb-detail-actions { display: flex; gap: 6px; flex-shrink: 0; }

.kb-ignored-banner {
  margin-bottom: 14px; padding: 7px 10px; border-radius: 5px;
  background: #15151c; border: 1px solid #26263a; color: #9a9ab0; font-size: 0.72rem;
}

/* Relationship rows */
.kb-rel-list { display: flex; flex-direction: column; gap: 5px; margin-bottom: 8px; }
.kb-rel-row { background: #0c0c18; border: 1px solid #1a1a2c; border-radius: 4px; padding: 5px 8px; }
.kb-rel-main { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; }
.kb-rel-target {
  font-size: 0.76rem; color: #c0c0e0; background: #14143a; border: 1px solid #2a2a6a;
  border-radius: 4px; padding: 2px 8px; cursor: pointer;
}
.kb-rel-target:hover { border-color: #5a5aff; color: #e0e0ff; }
.kb-rel-dmg { background: #0f1e0f; border-color: #1e4a1e; color: #6abf6a; cursor: default; }
.kb-rel-cond {
  display: flex; align-items: center; flex-wrap: wrap; gap: 5px;
  margin-top: 6px; padding-top: 6px; border-top: 1px dashed #1c1c2e;
}

/* Reference picker */
.kb-ref-picker { position: relative; margin-top: 4px; }
.kb-ref-inline { flex: 1; min-width: 110px; margin-top: 0; }
.kb-ref-input {
  width: 100%; box-sizing: border-box; background: #0a0a14; border: 1px dashed #2a2a3e;
  border-radius: 4px; color: #bbb; font-size: 0.74rem; padding: 5px 8px; font-family: inherit;
}
.kb-ref-inline .kb-ref-input { border-style: solid; border-color: transparent; background: transparent; padding: 3px 4px; }
.kb-ref-input:focus { outline: none; border-color: #5a5aff; border-style: solid; }
.kb-ref-input::placeholder { color: #55556f; }
.kb-ref-drop {
  position: absolute; top: calc(100% + 3px); left: 0; z-index: 200; display: none;
  min-width: 180px; max-height: 200px; overflow-y: auto;
  background: #0f0f22; border: 1px solid #2a2a55; border-radius: 4px;
}
.kb-drop-create { color: #7ad17a; border-top: 1px solid #1c1c2e; }
.kb-drop-create:hover { background: #11220f; color: #a0e0a0; }

.kb-amp-adder { display: flex; align-items: center; flex-wrap: wrap; gap: 5px; }

/* Backlinks */
.kb-backlinks { display: flex; flex-wrap: wrap; gap: 6px; }
.kb-backlink {
  font-size: 0.72rem; padding: 3px 10px; background: #0f0f1a; border: 1px solid #24243a;
  border-radius: 3px; color: #9090c0; cursor: pointer;
}
.kb-backlink:hover { border-color: #5a5aff; color: #c0c0ff; }
