/* ═══════════════════════════════════════════════════════════════════
   Faultline Simulator — App-specific Styles
   Extends the core design system (styles.css)
   ═══════════════════════════════════════════════════════════════════ */

/* ── App Layout (three-panel) ────────────────────────────────────── */

.app-layout {
  display: grid;
  grid-template-columns: 320px 1fr 340px;
  height: calc(100vh - var(--nav-height));
  margin-top: var(--nav-height);
  overflow: hidden;
}

/* ── Sidebars ────────────────────────────────────────────────────── */

.sidebar {
  background: var(--bg-raised);
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  scrollbar-width: thin;
  scrollbar-color: var(--border-light) transparent;
}

.sidebar-left {
  border-right: 1px solid var(--border);
}

.sidebar-right {
  border-left: 1px solid var(--border);
}

.sidebar-section {
  padding: 16px;
  border-bottom: 1px solid var(--border);
}

.sidebar-section:last-child {
  border-bottom: none;
}

.sidebar-title {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  margin-bottom: 12px;
}

/* ── Center Panel ────────────────────────────────────────────────── */

.app-main {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--bg);
}

.map-container {
  flex: 1;
  position: relative;
  overflow: hidden;
}

.map-container canvas {
  width: 100%;
  height: 100%;
  display: block;
}

/* ── Outcome Banner ──────────────────────────────────────────────── */

.outcome-banner {
  padding: 10px 20px;
  text-align: center;
  font-weight: 600;
  font-size: 0.875rem;
  letter-spacing: 0.02em;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}

.outcome-banner.victory {
  background: rgba(34, 197, 94, 0.1);
  border-top-color: rgba(34, 197, 94, 0.3);
  color: #86efac;
}

.outcome-banner.stalemate {
  background: rgba(234, 179, 8, 0.1);
  border-top-color: rgba(234, 179, 8, 0.3);
  color: #fde047;
}

/* ── Controls Bar ────────────────────────────────────────────────── */

.controls-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  background: var(--bg-card);
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}

.controls-group {
  display: flex;
  align-items: center;
  gap: 6px;
}

.controls-separator {
  width: 1px;
  height: 24px;
  background: var(--border);
  flex-shrink: 0;
}

/* ── Small Buttons ───────────────────────────────────────────────── */

.btn-sm {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--bg-raised);
  color: var(--text);
  cursor: pointer;
  transition: all var(--transition);
  font-size: 0.875rem;
  padding: 0;
}

.btn-sm:hover {
  border-color: var(--border-light);
  background: var(--bg-card);
}

.btn-sm.active {
  border-color: var(--accent);
  color: var(--accent);
  background: rgba(124, 91, 240, 0.1);
}

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

.btn-sm svg {
  width: 16px;
  height: 16px;
  fill: currentColor;
}

.btn-label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 32px;
  padding: 0 12px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--bg-raised);
  color: var(--text);
  cursor: pointer;
  transition: all var(--transition);
  font-size: 0.8125rem;
  font-family: var(--font-body);
  white-space: nowrap;
}

.btn-label:hover {
  border-color: var(--border-light);
  background: var(--bg-card);
}

/* ── Range Inputs ────────────────────────────────────────────────── */

input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  height: 4px;
  border-radius: 2px;
  background: var(--border);
  outline: none;
  cursor: pointer;
}

input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--accent);
  border: 2px solid var(--bg-card);
  cursor: pointer;
}

input[type="range"]::-moz-range-thumb {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--accent);
  border: 2px solid var(--bg-card);
  cursor: pointer;
}

.speed-slider {
  width: 80px;
}

.timeline-slider {
  flex: 1;
  min-width: 120px;
}

/* ── Tick Display ────────────────────────────────────────────────── */

.tick-display {
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  color: var(--text-muted);
  white-space: nowrap;
  min-width: 100px;
}

.tick-display .tick-value {
  color: var(--text);
  font-weight: 500;
}

.tension-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 10px;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  background: rgba(124, 91, 240, 0.1);
  color: var(--accent);
  border: 1px solid rgba(124, 91, 240, 0.2);
}

/* ── TOML Editor ─────────────────────────────────────────────────── */

.editor-textarea {
  width: 100%;
  min-height: 300px;
  padding: 12px;
  background: var(--bg-code);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  line-height: 1.6;
  resize: vertical;
  outline: none;
  tab-size: 2;
}

.editor-textarea:focus {
  border-color: var(--accent);
}

.editor-actions {
  display: flex;
  gap: 8px;
  margin-top: 8px;
}

.validation-msg {
  margin-top: 8px;
  padding: 8px 12px;
  border-radius: var(--radius);
  font-size: 0.8125rem;
  font-family: var(--font-mono);
}

.validation-msg.error {
  background: rgba(220, 38, 38, 0.1);
  border: 1px solid rgba(220, 38, 38, 0.3);
  color: #fca5a5;
}

.validation-msg.success {
  background: rgba(34, 197, 94, 0.1);
  border: 1px solid rgba(34, 197, 94, 0.3);
  color: #86efac;
}

/* ── Tabs ─────────────────────────────────────────────────────────── */

.app-tabs {
  display: flex;
  border-bottom: 1px solid var(--border);
  background: var(--bg-card);
}

.app-tab {
  padding: 8px 16px;
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--text-muted);
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  cursor: pointer;
  transition: all var(--transition);
  font-family: var(--font-body);
}

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

.app-tab.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

.tab-content {
  display: none;
}

.tab-content.active {
  display: block;
}

/* ── Preset Selector ─────────────────────────────────────────────── */

.preset-select {
  width: 100%;
  padding: 8px 12px;
  background: var(--bg-code);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 0.8125rem;
  font-family: var(--font-body);
  cursor: pointer;
  outline: none;
}

.preset-select:focus {
  border-color: var(--accent);
}

.preset-select option {
  background: var(--bg-card);
  color: var(--text);
}

/* ── Event Log ───────────────────────────────────────────────────── */

.event-log-list {
  max-height: 300px;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--border-light) transparent;
}

.event-log-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 0;
  font-size: 0.8125rem;
  cursor: pointer;
  transition: background var(--transition);
  border-radius: 4px;
  padding-left: 4px;
  padding-right: 4px;
}

.event-log-item:hover {
  background: var(--bg-card);
}

.event-log-tick {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--text-dim);
  min-width: 40px;
}

.event-log-name {
  color: var(--text);
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.event-log-empty {
  color: var(--text-dim);
  font-size: 0.8125rem;
  font-style: italic;
  padding: 8px 0;
}

/* ── State Inspector ─────────────────────────────────────────────── */

.state-tree {
  font-size: 0.8125rem;
}

.state-faction {
  margin-bottom: 12px;
}

.state-faction-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 0;
  cursor: pointer;
  font-weight: 500;
}

.state-faction-color {
  width: 12px;
  height: 12px;
  border-radius: 3px;
  flex-shrink: 0;
}

.state-faction-name {
  flex: 1;
  color: #fff;
}

.state-faction-details {
  padding-left: 20px;
}

.state-row {
  display: flex;
  justify-content: space-between;
  padding: 3px 0;
  color: var(--text-muted);
}

.state-row .label {
  color: var(--text-dim);
}

.state-row .value {
  font-family: var(--font-mono);
  color: var(--text);
}

/* ── Results / Charts ────────────────────────────────────────────── */

.mc-controls {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-bottom: 12px;
}

.mc-input {
  width: 70px;
  padding: 6px 8px;
  background: var(--bg-code);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 0.8125rem;
  font-family: var(--font-mono);
  outline: none;
  text-align: center;
}

.mc-input:focus {
  border-color: var(--accent);
}

.chart-container {
  position: relative;
  width: 100%;
  margin-bottom: 16px;
}

.chart-container canvas {
  width: 100%;
  display: block;
  border-radius: var(--radius);
}

.chart-title {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.mc-summary-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.mc-stat {
  padding: 8px;
  background: var(--bg-code);
  border-radius: var(--radius);
  border: 1px solid var(--border);
}

.mc-stat .label {
  font-size: 0.6875rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-dim);
}

.mc-stat .value {
  font-family: var(--font-mono);
  font-size: 0.9375rem;
  font-weight: 500;
  color: var(--text);
}

/* ── Faction Builder ─────────────────────────────────────────────── */

.faction-card {
  padding: 12px;
  background: var(--bg-code);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 12px;
}

.faction-card-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
}

.form-group {
  margin-bottom: 10px;
}

.form-label {
  display: block;
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--text-muted);
  margin-bottom: 4px;
}

.form-input {
  width: 100%;
  padding: 6px 10px;
  background: var(--bg-raised);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 0.8125rem;
  font-family: var(--font-body);
  outline: none;
}

.form-input:focus {
  border-color: var(--accent);
}

.form-select {
  width: 100%;
  padding: 6px 10px;
  background: var(--bg-raised);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 0.8125rem;
  font-family: var(--font-body);
  cursor: pointer;
  outline: none;
}

.form-select:focus {
  border-color: var(--accent);
}

input[type="color"] {
  -webkit-appearance: none;
  appearance: none;
  width: 32px;
  height: 32px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: none;
  cursor: pointer;
  padding: 2px;
}

input[type="color"]::-webkit-color-swatch-wrapper {
  padding: 0;
}

input[type="color"]::-webkit-color-swatch {
  border: none;
  border-radius: 4px;
}

/* ── File Import/Export ───────────────────────────────────────────── */

.file-actions {
  display: flex;
  gap: 8px;
}

.file-input {
  display: none;
}

/* ── Spinner / Loading ───────────────────────────────────────────── */

.spinner {
  display: inline-block;
  width: 16px;
  height: 16px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

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

.loading-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(10, 10, 11, 0.8);
  z-index: 10;
}

/* ── Empty States ────────────────────────────────────────────────── */

.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 32px 16px;
  color: var(--text-dim);
  text-align: center;
  gap: 8px;
}

.empty-state svg {
  width: 32px;
  height: 32px;
  opacity: 0.5;
}

/* ── Responsive ──────────────────────────────────────────────────── */

@media (max-width: 1024px) {
  .app-layout {
    grid-template-columns: 280px 1fr 0;
  }
  .sidebar-right {
    display: none;
  }
  .sidebar-right.open {
    display: flex;
    position: fixed;
    right: 0;
    top: var(--nav-height);
    bottom: 0;
    width: 340px;
    z-index: 50;
  }
}

@media (max-width: 768px) {
  .app-layout {
    grid-template-columns: 1fr;
  }
  .sidebar-left {
    display: none;
  }
  .sidebar-left.open {
    display: flex;
    position: fixed;
    left: 0;
    top: var(--nav-height);
    bottom: 0;
    width: 320px;
    z-index: 50;
  }
}

/* ------------------------------------------------------------------ */
/* Feasibility matrix / kill chain / seam panels                       */
/* ------------------------------------------------------------------ */

.feasibility-table-wrap {
  overflow-x: auto;
  margin: 8px 0 4px 0;
}
.feasibility-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.75rem;
  font-family: "JetBrains Mono", monospace;
}
.feasibility-table th,
.feasibility-table td {
  padding: 6px 8px;
  text-align: right;
  border-bottom: 1px solid rgba(63, 63, 70, 0.5);
  white-space: nowrap;
}
.feasibility-table th {
  color: #a1a1aa;
  font-weight: 500;
  text-align: right;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.feasibility-table th:first-child,
.feasibility-table td.chain-name {
  text-align: left;
}
.feasibility-table td.chain-name {
  color: #e4e4e7;
  font-weight: 500;
}
.feasibility-table td.cost-asym {
  color: #f87171;
  font-weight: 600;
}

.conf-H { color: #4ade80; font-weight: 600; }
.conf-M { color: #facc15; font-weight: 600; }
.conf-L { color: #f87171; font-weight: 600; }

.chart-subtitle {
  font-size: 0.7rem;
  color: #a1a1aa;
  margin: 4px 0 8px 0;
  line-height: 1.5;
}

.campaign-panel {
  margin-top: 12px;
  padding: 10px 12px;
  background: rgba(24, 24, 27, 0.7);
  border: 1px solid rgba(63, 63, 70, 0.6);
  border-radius: 6px;
}
.campaign-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 6px;
  flex-wrap: wrap;
  gap: 8px;
}
.campaign-name {
  font-size: 0.8125rem;
  color: #e4e4e7;
  font-weight: 600;
}
.campaign-metrics {
  font-size: 0.7rem;
  color: #a1a1aa;
  display: flex;
  gap: 12px;
}
.campaign-metrics b {
  color: #e4e4e7;
  font-family: "JetBrains Mono", monospace;
}
.campaign-cost-row {
  display: flex;
  gap: 16px;
  font-size: 0.7rem;
  color: #a1a1aa;
  margin-bottom: 8px;
  flex-wrap: wrap;
}
.campaign-cost-row .label {
  display: block;
  text-transform: uppercase;
  font-size: 0.625rem;
  letter-spacing: 0.04em;
  color: #71717a;
}
.campaign-cost-row b {
  color: #e4e4e7;
  font-family: "JetBrains Mono", monospace;
  font-size: 0.8125rem;
}
.campaign-cost-row .cost-ratio b {
  color: #f87171;
}

.phase-flow {
  display: flex;
  align-items: stretch;
  gap: 6px;
  overflow-x: auto;
  padding: 8px 0 0 0;
}
.phase-node {
  min-width: 120px;
  padding: 6px 8px;
  background: rgba(39, 39, 42, 0.7);
  border: 1px solid rgba(63, 63, 70, 0.8);
  border-radius: 4px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.phase-label {
  font-size: 0.7rem;
  color: #e4e4e7;
  font-weight: 500;
  line-height: 1.2;
}
.phase-bars {
  height: 6px;
  background: rgba(24, 24, 27, 0.8);
  border-radius: 3px;
  overflow: hidden;
}
.phase-bar-fill {
  height: 100%;
  transition: width 0.2s;
}
.phase-stats {
  font-size: 0.625rem;
  font-family: "JetBrains Mono", monospace;
  color: #a1a1aa;
  display: flex;
  gap: 6px;
}
.phase-stats .stat-succ { color: #4ade80; }
.phase-stats .stat-det { color: #facc15; }
.phase-stats .stat-nr { color: #71717a; }
.phase-arrow {
  display: flex;
  align-items: center;
  color: #71717a;
  font-size: 1rem;
}

.domain-chip {
  display: inline-block;
  padding: 2px 6px;
  background: rgba(63, 63, 70, 0.5);
  border-radius: 3px;
  font-size: 0.65rem;
  font-family: "JetBrains Mono", monospace;
  color: #e4e4e7;
  margin: 2px 2px 2px 0;
}

/* ------------------------------------------------------------------ */
/* Interactive tutorial overlay                                        */
/* ------------------------------------------------------------------ */
.tutorial-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  pointer-events: none;
}
.tutorial-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  pointer-events: auto;
}
.tutorial-bubble {
  position: absolute;
  max-width: 360px;
  padding: 16px 18px;
  background: #18181b;
  border: 1px solid #3f3f46;
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
  pointer-events: auto;
  color: #e4e4e7;
  font-size: 0.8125rem;
  line-height: 1.45;
}
.tutorial-step-count {
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #71717a;
  margin-bottom: 6px;
}
.tutorial-title {
  font-size: 1rem;
  font-weight: 600;
  color: #f4f4f5;
  margin-bottom: 8px;
}
.tutorial-body {
  margin-bottom: 14px;
}
.tutorial-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}
.tutorial-skip {
  margin-right: auto;
  color: #a1a1aa;
}
.tutorial-target-highlight {
  outline: 2px solid #f59e0b !important;
  outline-offset: 4px;
  box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.55);
  border-radius: 4px;
  position: relative;
  z-index: 1001;
}
.btn-tutorial {
  margin-left: 8px;
}

/* ------------------------------------------------------------------ */
/* Tech Cards panel (OSINT-derived capability library)                 */
/* ------------------------------------------------------------------ */
.tech-panel-header {
  margin-bottom: 12px;
}
.tech-panel-title {
  font-size: 0.8125rem;
  font-weight: 600;
  color: #e4e4e7;
  margin-bottom: 4px;
}
.tech-panel-subtitle {
  font-size: 0.6875rem;
  color: #a1a1aa;
  line-height: 1.5;
}
.tech-group-title {
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #71717a;
  margin: 12px 0 6px 0;
  padding-top: 8px;
  border-top: 1px solid #3f3f46;
}
.tech-card {
  background: rgba(24, 24, 27, 0.7);
  border: 1px solid #3f3f46;
  border-radius: 6px;
  padding: 10px 11px;
  margin-bottom: 10px;
  font-size: 0.6875rem;
  color: #e4e4e7;
  transition: border-color 0.15s;
}
.tech-card:hover {
  border-color: #52525b;
}
.tech-card.present {
  border-color: #4ade8055;
}
.tech-card-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 4px;
}
.tech-card-name {
  font-weight: 600;
  color: #f4f4f5;
  font-size: 0.75rem;
  line-height: 1.3;
  flex: 1;
}
.tech-card-badge {
  display: inline-block;
  padding: 1px 6px;
  background: #4ade8033;
  color: #4ade80;
  border-radius: 3px;
  font-size: 0.6rem;
  text-transform: uppercase;
  font-weight: 500;
  margin-left: 4px;
}
.tech-card-category {
  font-size: 0.6rem;
  color: #71717a;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  white-space: nowrap;
}
.tech-card-desc {
  color: #d4d4d8;
  margin: 4px 0 6px 0;
  line-height: 1.45;
}
.tech-card-meta {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  font-family: "JetBrains Mono", monospace;
  font-size: 0.625rem;
  color: #a1a1aa;
  margin-bottom: 4px;
}
.tech-card-ref {
  font-size: 0.625rem;
  color: #71717a;
  font-style: italic;
  margin-bottom: 4px;
}
.tech-card-rationale {
  font-size: 0.65rem;
  color: #a1a1aa;
  margin-bottom: 6px;
  line-height: 1.45;
  padding-left: 8px;
  border-left: 2px solid #3f3f46;
}
.tech-card-effects {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-bottom: 6px;
}
.eff-chip {
  display: inline-block;
  padding: 2px 6px;
  background: rgba(63, 63, 70, 0.5);
  border-radius: 3px;
  font-size: 0.6rem;
  font-family: "JetBrains Mono", monospace;
  color: #d4d4d8;
}
.eff-chip b {
  color: #7c5bf0;
  margin-right: 2px;
}
.eff-k {
  color: #a1a1aa;
}
.tech-card-counter {
  font-size: 0.625rem;
  color: #a1a1aa;
  margin-bottom: 6px;
}
.tech-card-counter code {
  background: rgba(63, 63, 70, 0.5);
  padding: 1px 4px;
  border-radius: 2px;
  color: #f87171;
}
.tech-card-actions {
  display: flex;
  gap: 6px;
  margin-top: 6px;
}
.tech-card-faction {
  flex: 1;
  min-width: 0;
  font-size: 0.7rem;
  padding: 4px 6px;
  background: #18181b;
  border: 1px solid #3f3f46;
  border-radius: 4px;
  color: #e4e4e7;
}
.tech-card-add {
  white-space: nowrap;
}

/* ------------------------------------------------------------------ */
/* Tech Cards — domain tabs + search                                    */
/* ------------------------------------------------------------------ */
.tech-domain-tabs {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
  padding: 4px 0 8px 0;
  border-bottom: 1px solid #3f3f46;
  margin-bottom: 8px;
}
.tech-domain-tab {
  background: rgba(39, 39, 42, 0.6);
  border: 1px solid #3f3f46;
  color: #a1a1aa;
  font-size: 0.6875rem;
  font-weight: 500;
  padding: 4px 8px;
  border-radius: 4px;
  cursor: pointer;
  white-space: nowrap;
  font-family: inherit;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.tech-domain-tab:hover {
  background: rgba(63, 63, 70, 0.7);
  color: #e4e4e7;
}
.tech-domain-tab.active {
  background: rgba(124, 91, 240, 0.2);
  border-color: #7c5bf0;
  color: #f4f4f5;
}
.tech-domain-tab .tab-count {
  display: inline-block;
  margin-left: 4px;
  padding: 0 4px;
  background: rgba(63, 63, 70, 0.8);
  border-radius: 2px;
  font-size: 0.6rem;
  font-family: "JetBrains Mono", monospace;
  color: #d4d4d8;
}
.tech-domain-tab.active .tab-count {
  background: rgba(124, 91, 240, 0.35);
  color: #fff;
}

.tech-search-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}
.tech-search {
  flex: 1;
  font-size: 0.75rem;
  padding: 5px 8px;
  background: #18181b;
  border: 1px solid #3f3f46;
  border-radius: 4px;
  color: #e4e4e7;
  font-family: inherit;
}
.tech-search:focus {
  outline: none;
  border-color: #7c5bf0;
}
.tech-search-count {
  font-size: 0.625rem;
  color: #71717a;
  font-family: "JetBrains Mono", monospace;
  white-space: nowrap;
}

.tech-group-header {
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  padding: 6px 0;
  margin: 10px 0 4px 0;
  border-top: 1px solid #3f3f46;
  user-select: none;
}
.tech-group-header:hover {
  color: #f4f4f5;
}
.tech-group-chevron {
  color: #71717a;
  font-size: 0.7rem;
  width: 10px;
  display: inline-block;
}
.tech-group-header .tech-group-title {
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #a1a1aa;
  margin: 0;
  padding: 0;
  border-top: none;
}

.tech-card-domain-tag {
  display: inline-block;
  margin-top: 4px;
  padding: 1px 6px;
  background: rgba(124, 91, 240, 0.15);
  border: 1px solid rgba(124, 91, 240, 0.4);
  border-radius: 3px;
  font-size: 0.6rem;
  font-family: "JetBrains Mono", monospace;
  color: #a78bfa;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* ------------------------------------------------------------------ */
/* Pinned MC results + side-by-side comparison panel                  */
/* ------------------------------------------------------------------ */
.pinned-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 8px;
}
.pinned-card {
  background: rgba(24, 24, 27, 0.7);
  border: 1px solid #3f3f46;
  border-radius: 6px;
  padding: 8px 10px;
  font-size: 0.7rem;
  color: #e4e4e7;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.pinned-card.pin-sel-a {
  border-color: #7c5bf0;
  box-shadow: inset 4px 0 0 0 #7c5bf0;
}
.pinned-card.pin-sel-b {
  border-color: #facc15;
  box-shadow: inset 4px 0 0 0 #facc15;
}
.pinned-card-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 4px;
}
.pinned-label {
  font-weight: 600;
  color: #f4f4f5;
  font-size: 0.75rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.pin-x {
  background: none;
  border: none;
  color: #71717a;
  font-size: 1rem;
  line-height: 1;
  cursor: pointer;
  padding: 0 4px;
}
.pin-x:hover {
  color: #f87171;
}
.pinned-meta {
  display: flex;
  gap: 12px;
  font-size: 0.65rem;
  color: #a1a1aa;
  font-family: "JetBrains Mono", monospace;
  margin-bottom: 4px;
}
.pinned-winrates {
  font-size: 0.65rem;
  color: #d4d4d8;
  margin-bottom: 6px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.pin-win {
  font-family: "JetBrains Mono", monospace;
  background: rgba(63, 63, 70, 0.5);
  padding: 1px 6px;
  border-radius: 3px;
}
.pin-win-none {
  color: #71717a;
  font-style: italic;
}
.pinned-actions {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
}
.pin-btn {
  background: rgba(39, 39, 42, 0.8);
  border: 1px solid #3f3f46;
  color: #d4d4d8;
  font-size: 0.65rem;
  padding: 3px 8px;
  border-radius: 3px;
  cursor: pointer;
  font-family: inherit;
  transition: border-color 0.15s, background 0.15s, color 0.15s;
}
.pin-btn:hover {
  border-color: #52525b;
  color: #fff;
}
.pinned-compare-row {
  display: flex;
  gap: 6px;
  margin-top: 6px;
}
.pinned-compare-row .btn-label {
  font-size: 0.7rem;
  padding: 4px 10px;
  height: auto;
}

/* Comparison panel */
.cmp-panel {
  margin-top: 12px;
  background: rgba(24, 24, 27, 0.7);
  border: 1px solid #3f3f46;
  border-radius: 6px;
  padding: 10px 12px;
}
.cmp-header-title {
  font-size: 0.85rem;
  font-weight: 600;
  color: #f4f4f5;
  margin-bottom: 8px;
}
.cmp-vs {
  color: #71717a;
  font-weight: 400;
  font-size: 0.75rem;
  margin: 0 4px;
}
.cmp-warn {
  background: rgba(234, 179, 8, 0.1);
  border: 1px solid rgba(234, 179, 8, 0.3);
  color: #fde68a;
  font-size: 0.7rem;
  padding: 6px 8px;
  border-radius: 4px;
  margin-bottom: 8px;
  line-height: 1.4;
}
.cmp-headline {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 8px;
}
.cmp-stat {
  flex: 1 1 120px;
  background: rgba(39, 39, 42, 0.5);
  padding: 8px 10px;
  border-radius: 4px;
  border: 1px solid #3f3f46;
}
.cmp-stat .label {
  font-size: 0.625rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #71717a;
  margin-bottom: 4px;
}
.cmp-stat .value {
  font-family: "JetBrains Mono", monospace;
  font-size: 0.85rem;
  color: #e4e4e7;
}

.cmp-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.7rem;
  font-family: "JetBrains Mono", monospace;
}
.cmp-table th,
.cmp-table td {
  padding: 5px 6px;
  text-align: right;
  border-bottom: 1px solid rgba(63, 63, 70, 0.5);
  vertical-align: top;
}
.cmp-table th:first-child,
.cmp-table td.cmp-row-label {
  text-align: left;
  color: #e4e4e7;
  font-weight: 500;
}
.cmp-col-label {
  color: #d4d4d8;
  font-size: 0.7rem;
}
.cmp-col-sub {
  color: #71717a;
  font-size: 0.6rem;
  font-weight: 400;
  text-transform: none;
  letter-spacing: 0;
  margin-top: 2px;
}
.cmp-val {
  color: #e4e4e7;
}
.cmp-ci {
  color: #a1a1aa;
  font-size: 0.625rem;
  margin-top: 2px;
}
.delta-pos { color: #4ade80; }
.delta-neg { color: #f87171; }
.delta-zero { color: #71717a; }

/* ------------------------------------------------------------------ */
/* Diff modal                                                          */
/* ------------------------------------------------------------------ */
.diff-modal {
  position: fixed;
  inset: 0;
  z-index: 2000;
  background: rgba(0, 0, 0, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.diff-modal-card {
  background: #18181b;
  border: 1px solid #3f3f46;
  border-radius: 8px;
  width: min(900px, 100%);
  max-height: 100%;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.6);
}
.diff-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-bottom: 1px solid #3f3f46;
}
.diff-modal-title {
  font-size: 0.95rem;
  font-weight: 600;
  color: #f4f4f5;
}
.diff-modal-close {
  background: none;
  border: none;
  color: #a1a1aa;
  font-size: 1.4rem;
  line-height: 1;
  cursor: pointer;
  padding: 0 6px;
}
.diff-modal-close:hover { color: #fff; }
.diff-modal-controls {
  padding: 10px 16px;
  display: flex;
  align-items: center;
  gap: 10px;
  border-bottom: 1px solid #3f3f46;
  font-size: 0.75rem;
  color: #a1a1aa;
}
.diff-modal-body {
  flex: 1;
  overflow: auto;
  padding: 12px 16px;
  font-family: "JetBrains Mono", monospace;
  font-size: 0.75rem;
  background: #0f0f12;
}
.diff-meta {
  white-space: pre;
  color: #a1a1aa;
  border-bottom: 1px solid #3f3f46;
  padding-bottom: 6px;
  margin-bottom: 8px;
}
.diff-empty {
  color: #71717a;
  font-style: italic;
  padding: 16px 0;
}
.diff-hunk-header {
  background: rgba(124, 91, 240, 0.1);
  color: #a78bfa;
  padding: 2px 8px;
  margin: 8px 0 4px 0;
  border-radius: 3px;
  font-size: 0.7rem;
}
.diff-line {
  display: flex;
  gap: 6px;
  padding: 1px 4px;
  white-space: pre-wrap;
  word-break: break-word;
}
.diff-marker {
  width: 12px;
  flex-shrink: 0;
  text-align: center;
  color: #71717a;
  font-weight: 600;
}
.diff-text {
  flex: 1;
  white-space: pre-wrap;
  word-break: break-word;
}
.diff-eq { color: #d4d4d8; }
.diff-add {
  background: rgba(34, 197, 94, 0.1);
  color: #86efac;
}
.diff-add .diff-marker { color: #4ade80; }
.diff-del {
  background: rgba(220, 38, 38, 0.1);
  color: #fca5a5;
}
.diff-del .diff-marker { color: #f87171; }
