/* ═══════════════════════════════════════════════════════════════
   НИТИ ВРЕМЕНИ — Modern Dark UI
   Font: Inter (body) · JetBrains Mono (dates/labels)
   ═══════════════════════════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600&family=JetBrains+Mono:wght@400;500&display=swap');

/* ── TOKENS ────────────────────────────────────────────────────── */
:root {
  --bg:         #0c0c10;
  --bg-2:       #111118;
  --bg-3:       #17171f;
  --bg-hover:   rgba(255,255,255,0.05);
  --border:     rgba(255,255,255,0.07);
  --border-2:   rgba(255,255,255,0.12);

  --text:       #e2e2ee;
  --text-2:     #8a8aaa;
  --text-3:     #52527a;

  --accent:     #7c6fff;
  --accent-dim: rgba(124,111,255,0.18);

  --font:       'Inter', system-ui, sans-serif;
  --mono:       'JetBrains Mono', 'Courier New', monospace;

  /* Track colors — vibrant but harmonious */
  --c-geology:    #f59e0b;
  --c-russia:     #f43f5e;
  --c-petersburg: #38bdf8;
  --c-europe:     #34d399;
  --c-world:      #a78bfa;
  --c-science:    #22d3ee;
  --c-cosmos:     #818cf8;
  --c-wars:       #fb923c;
  --c-art:        #f472b6;
  --c-religion:   #fbbf24;
  --c-user:       #4ade80;
  --c-wikidata:   #94a3b8;

  /* Layout */
  --topbar-h:    48px;
  --labels-w:    148px;
  --axis-h:      34px;
  --status-h:    26px;
  --panel-w:     420px;
}

/* ── RESET ──────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; overflow: hidden; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 13px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior: none;
}

/* ── SCROLLBARS ─────────────────────────────────────────────────── */
::-webkit-scrollbar { width: 4px; height: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); border-radius: 2px; }
::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.2); }

/* ── APP SHELL ──────────────────────────────────────────────────── */
.app {
  display: flex;
  flex-direction: column;
  height: 100vh;
  width: 100vw;
  overflow: hidden;
}

/* ── TOP BAR ────────────────────────────────────────────────────── */
.topbar {
  height: var(--topbar-h);
  min-height: var(--topbar-h);
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 0 18px;
  background: var(--bg-2);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  z-index: 300;
}

.topbar-logo {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}
.logo-glyph {
  color: var(--accent);
  font-size: 16px;
}
.logo-text {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  letter-spacing: -0.01em;
  white-space: nowrap;
}

/* Scale tabs */
.scale-tabs {
  display: flex;
  gap: 2px;
  background: var(--bg-3);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 3px;
}
.scale-tab {
  background: none;
  border: none;
  color: var(--text-2);
  font-family: var(--font);
  font-size: 12px;
  font-weight: 500;
  padding: 3px 12px;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
}
.scale-tab:hover { color: var(--text); background: var(--bg-hover); }
.scale-tab.active {
  background: var(--accent);
  color: #fff;
}

/* Topbar right */
.topbar-right {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-left: auto;
}

/* Search */
.search-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-3);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0 10px;
  height: 30px;
  transition: border-color 0.15s;
}
.search-wrap:focus-within { border-color: var(--accent); }
.search-icon { color: var(--text-3); font-size: 15px; }
.search-input {
  background: none;
  border: none;
  color: var(--text);
  font-family: var(--font);
  font-size: 12px;
  outline: none;
  width: 200px;
}
.search-input::placeholder { color: var(--text-3); }

/* Buttons */
.btn-top {
  background: var(--bg-3);
  border: 1px solid var(--border);
  color: var(--text-2);
  font-family: var(--font);
  font-size: 12px;
  font-weight: 500;
  padding: 0 12px;
  height: 30px;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
}
.btn-top:hover { color: var(--text); border-color: var(--border-2); }
.btn-top--accent {
  background: var(--accent-dim);
  border-color: rgba(124,111,255,0.35);
  color: #a89fff;
}
.btn-top--accent:hover {
  background: rgba(124,111,255,0.28);
  color: #c4baff;
}

.zoom-indicator {
  font-family: var(--mono);
  font-size: 10px;
  color: var(--text-3);
  min-width: 36px;
  text-align: center;
}

/* ── MAIN AREA ──────────────────────────────────────────────────── */
.main {
  flex: 1;
  display: flex;
  overflow: hidden;
  min-height: 0;
  position: relative;
}


/* ── FLOATING TRACKS PANEL ─────────────────────────────────────── */
.tracks-panel {
  position: fixed;
  top: 50%;
  transform: translateY(-50%);
  left: 12px;
  z-index: 300;
  background: rgba(10, 10, 14, 0.82);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 12px;
  min-width: 152px;
  max-width: 190px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.5);
  overflow: hidden;
  transition: transform 0.25s ease, opacity 0.2s;
}
.tracks-panel.collapsed .tracks-panel-list {
  display: none;
}
.tracks-panel.collapsed .tracks-panel-collapse {
  transform: rotate(180deg);
}

.tracks-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 7px 10px 7px 12px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
  cursor: default;
  user-select: none;
}
.tracks-panel-title {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-3);
}
.tracks-panel-collapse {
  background: none;
  border: none;
  color: var(--text-3);
  font-size: 14px;
  line-height: 1;
  cursor: pointer;
  padding: 2px 4px;
  border-radius: 4px;
  transition: background 0.15s, transform 0.25s;
  rotate: 90deg;
}
.tracks-panel-collapse:hover { background: rgba(255,255,255,0.08); }

.tracks-panel-list {
  padding: 4px 0;
  max-height: calc(100vh - var(--topbar-h) - 60px);
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,0.08) transparent;
}

/* ── TRACK LABEL ROW ────────────────────────────────────────── */
.track-label {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 12px;
  cursor: pointer;
  transition: background 0.15s, opacity 0.2s;
  user-select: none;
}
.track-label:hover { background: rgba(255,255,255,0.05); }
.track-label.label--hidden { opacity: 0.35; }

.label-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
}
.label-text {
  font-size: 11px;
  font-weight: 500;
  color: var(--text-2);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
}
.label-count {
  font-family: var(--mono);
  font-size: 9px;
  color: var(--text-3);
  flex-shrink: 0;
}
.label-eye {
  font-size: 11px;
  color: var(--text-3);
  opacity: 0;
  flex-shrink: 0;
  transition: opacity 0.15s;
}
.track-label:hover .label-eye { opacity: 1; }

/* ── LANE NAME TAG (subtle label on the track line in canvas) ──── */
.lane-name-tag {
  position: absolute;
  left: 6px;
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  opacity: 0.22;
  pointer-events: none;
  white-space: nowrap;
  user-select: none;
}

/* ── CANVAS WRAP (full width) ───────────────────────────────────── */
.canvas-wrap {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  position: relative;
  min-width: 0;
}

/* ── AXIS BAR ───────────────────────────────────────────────────── */
.axis-bar {
  height: var(--axis-h);
  min-height: var(--axis-h);
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(14, 15, 23, 0.95);
  display: flex;
  align-items: stretch;
  overflow: hidden;
  flex-shrink: 0;
  z-index: 50;
  position: relative;
}
.axis-inner {
  position: relative;
  flex: 1;
  height: 100%;
  pointer-events: none;
  overflow: hidden;
}
.axis-tick {
  position: absolute;
  top: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  pointer-events: none;
  transform: translateX(-50%);
}
.axis-tick::before {
  content: '';
  width: 1px;
  height: 8px;
  background: rgba(255, 255, 255, 0.3);
  display: block;
  margin-top: 4px;
}
.axis-tick-label {
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 500;
  color: #cbd5e1;
  white-space: nowrap;
  margin-top: 2px;
  letter-spacing: 0.02em;
}

.cursor-year {
  position: absolute;
  top: 6px;
  right: 12px;
  font-family: var(--mono);
  font-size: 10px;
  color: var(--accent);
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.15s;
}
.cursor-year.visible { opacity: 1; }

/* ── LANES WRAP ─────────────────────────────────────────────────── */
.lanes-wrap {
  flex: 1;
  overflow: hidden;       /* 2D пан через JS, нативный скролл отключён */
  position: relative;
  cursor: crosshair;
  user-select: none;
}
.lanes-wrap.cursor-grab     { cursor: grab; }
.lanes-wrap.cursor-grabbing { cursor: grabbing; }
.lanes-wrap.cursor-freepan  { cursor: all-scroll; }

/* Canvas inner (horizontally translated for panning) */
.canvas-inner {
  position: absolute;
  top: 0;
  left: 0;
  will-change: transform;
  /* height = sum of lane heights, set by JS */
  /* width = baseCanvasWidth * zoom, set by JS */
}

/* ── CURSOR LINE ────────────────────────────────────────────────── */
.cursor-line {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 1px;
  background: rgba(124,111,255,0.35);
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.1s;
  z-index: 20;
}
.cursor-line.visible { opacity: 1; }

/* ── TRACK LANE ─────────────────────────────────────────────────── */
.track-lane {
  position: relative;
  width: 100%;
  /* height и margin-bottom задаются через JS */
  overflow: visible;
  border-bottom: 1px dashed rgba(255, 255, 255, 0.08);
  box-sizing: border-box;
}
.track-lane.lane--macro {
  border-bottom-style: solid;
  border-bottom-color: rgba(255, 255, 255, 0.05);
}
.track-lane.lane--macro .lane-name-tag {
  font-size: 10px;
  opacity: 0.85;
}

/* The actual horizontal line */
.track-line {
  position: absolute;
  left: 200px;
  right: 40px;
  height: 1px;
  /* bottom set by JS */
  pointer-events: none;
  transition: opacity 0.2s, height 0.2s, box-shadow 0.2s;
}
.track-line.line--highlight {
  opacity: 1 !important;
  height: 2px !important;
  box-shadow: 0 0 12px currentColor, 0 0 4px currentColor;
  z-index: 4;
}

/* ── EVENT NODE PARTS ───────────────────────────────────────────── */

/* Dot on the track line */
.ev-dot {
  position: absolute;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  transform: translateX(-50%);
  pointer-events: none;
  z-index: 5;
  /* No size transitions — dots stay fixed */
}

/* Vertical stem */
.ev-stem {
  position: absolute;
  width: 1px;
  transform: translateX(-0.5px);
  pointer-events: none;
  z-index: 4;
  opacity: 0.6;
}

/* Event card (clickable) */
.ev-card {
  position: absolute;
  width: 150px;
  transform: translateX(-50%);
  padding: 5px 9px 6px 11px;
  background: var(--bg-3);
  border: 1px solid var(--border);
  border-left: 2px solid;
  border-radius: 6px;
  cursor: pointer;
  z-index: 10;
  transition: background 0.15s, border-color 0.15s, transform 0.12s;
  animation: card-in 0.2s ease-out both;
  user-select: none;
}
@keyframes card-in {
  from { opacity: 0; transform: translateX(-50%) translateY(4px); }
  to   { opacity: 1; transform: translateX(-50%) translateY(0); }
}
.ev-card:hover {
  background: var(--bg-hover);
  transform: translateX(-50%) translateY(-2px);
  z-index: 20;
}
.ev-card:hover ~ .ev-stem { opacity: 0.9; }
.ev-card.card--highlight {
  background: rgba(124,111,255,0.15);
  border-color: var(--accent) !important;
  box-shadow: 0 0 0 1px rgba(124,111,255,0.4);
}

.ev-year {
  font-family: var(--mono);
  font-size: 9px;
  color: var(--text-3);
  letter-spacing: 0.03em;
  display: block;
  margin-bottom: 1px;
}
.ev-title {
  font-size: 11px;
  font-weight: 500;
  color: var(--text);
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* ── PERIOD EVENTS (curly brace & elevated card) ───────────────── */
.ev-period-brace-wrap {
  position: absolute;
  height: 16px;
  cursor: pointer;
  z-index: 8;
  pointer-events: auto;
}
.period-brace-svg {
  display: block;
  width: 100%;
  height: 16px;
  overflow: visible;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.5));
}
.ev-period-brace-wrap:hover .period-brace-svg path {
  stroke-width: 2;
  filter: brightness(1.4) drop-shadow(0 0 5px currentColor);
}
.ev-period-brace-wrap.period--active .period-brace-svg path {
  stroke-width: 2.5;
  filter: drop-shadow(0 0 10px rgba(255,255,255,0.8)) drop-shadow(0 0 4px rgba(255,255,255,1));
}

.ev-period-stem {
  position: absolute;
  width: 1px;
  pointer-events: none;
  z-index: 5;
  opacity: 0.45;
}

.ev-period-card {
  position: absolute;
  width: 160px;
  transform: translateX(-50%);
  padding: 5px 9px 6px 11px;
  background: var(--bg-3);
  border: 1px solid var(--border);
  border-left: 3px solid;
  border-radius: 6px;
  cursor: pointer;
  z-index: 15;
  transition: background 0.15s, transform 0.12s, border-color 0.15s;
  user-select: none;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(8px);
  animation: card-in 0.2s ease-out both;
}
.ev-period-card:hover {
  background: var(--bg-hover);
  transform: translateX(-50%) translateY(-2px);
  z-index: 25;
}
.ev-period-card.card--highlight {
  background: rgba(124, 111, 255, 0.2);
  border-color: var(--accent) !important;
  box-shadow: 0 0 12px rgba(124, 111, 255, 0.4);
}

.ev-period-badge {
  display: inline-block;
  font-family: var(--mono);
  font-size: 9px;
  font-weight: 500;
  padding: 1px 5px;
  border-radius: 3px;
  margin-bottom: 3px;
  letter-spacing: 0.02em;
}

/* Cluster dot: shows when cards are hidden due to density */
.ev-cluster-dot {
  position: absolute;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  transform: translate(-50%, 50%);
  border: 2px solid var(--bg);
  z-index: 7;
  pointer-events: none;
  opacity: 0.75;
}

/* ── STATUS BAR ─────────────────────────────────────────────────── */
.status-bar {
  height: var(--status-h);
  min-height: var(--status-h);
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 16px;
  background: var(--bg-2);
  border-top: 1px solid var(--border);
  font-family: var(--mono);
  font-size: 10px;
  color: var(--text-3);
  flex-shrink: 0;
  overflow: hidden;
}
.sb-sep { opacity: 0.4; }

/* ═════════════════════════════════════════════════════════════════
   DETAIL PANEL
   ═════════════════════════════════════════════════════════════════ */
.detail-panel {
  position: fixed;
  top: 0;
  right: 0;
  width: var(--panel-w);
  height: 100vh;
  background: var(--bg-2);
  border-left: 1px solid var(--border-2);
  z-index: 500;
  transform: translateX(100%);
  transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.detail-panel.panel--open {
  transform: translateX(0);
}

.detail-inner {
  display: flex;
  flex-direction: column;
  height: 100%;
}

.detail-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.detail-track-badge {
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding-bottom: 1px;
  border-bottom: 1px solid currentColor;
}
.detail-close {
  background: none;
  border: none;
  color: var(--text-3);
  font-size: 14px;
  cursor: pointer;
  padding: 4px;
  border-radius: 4px;
  transition: color 0.12s, background 0.12s;
}
.detail-close:hover { color: var(--text); background: var(--bg-hover); }

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

.detail-year {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--text-3);
  margin-bottom: 8px;
}
.detail-title {
  font-size: 20px;
  font-weight: 600;
  color: var(--text);
  line-height: 1.3;
  margin-bottom: 12px;
  letter-spacing: -0.01em;
}
.detail-desc {
  font-size: 13px;
  color: var(--text-2);
  font-style: italic;
  line-height: 1.6;
}
.detail-divider {
  height: 1px;
  background: var(--border);
  margin: 16px 0;
}
.detail-text {
  font-size: 13px;
  color: var(--text-2);
  line-height: 1.7;
}
.detail-section-label {
  font-family: var(--mono);
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-3);
  margin-bottom: 10px;
}
.detail-wiki-img {
  width: 100%;
  max-height: 180px;
  object-fit: cover;
  border-radius: 4px;
  margin-bottom: 10px;
  display: none;
}
.detail-wiki-text {
  font-size: 12px;
  color: var(--text-3);
  line-height: 1.6;
  font-style: italic;
  margin-bottom: 8px;
}
.detail-wiki-link {
  font-family: var(--mono);
  font-size: 10px;
  color: var(--accent);
  text-decoration: none;
}
.detail-wiki-link:hover { text-decoration: underline; }

.contemp-list { list-style: none; display: flex; flex-direction: column; gap: 4px; }
.contemp-item {
  display: flex;
  flex-direction: column;
  gap: 1px;
  padding: 6px 10px;
  border-left: 2px solid var(--border);
  border-radius: 0 4px 4px 0;
  cursor: pointer;
  transition: background 0.12s, border-color 0.12s;
}
.contemp-item:hover { background: var(--bg-hover); border-left-color: var(--accent); }
.contemp-track { font-family: var(--mono); font-size: 8px; letter-spacing: 0.08em; opacity: 0.8; text-transform: uppercase; }
.contemp-year { font-family: var(--mono); font-size: 9px; color: var(--text-3); }
.contemp-title { font-size: 11px; color: var(--text-2); line-height: 1.3; }

.detail-foot {
  padding: 14px 18px;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}
.btn-delete {
  width: 100%;
  background: none;
  border: 1px solid rgba(244,63,94,0.3);
  color: rgba(244,63,94,0.7);
  font-family: var(--font);
  font-size: 12px;
  padding: 8px;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.15s;
}
.btn-delete:hover { background: rgba(244,63,94,0.1); border-color: #f43f5e; color: #f43f5e; }

/* ═════════════════════════════════════════════════════════════════
   MODALS
   ═════════════════════════════════════════════════════════════════ */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(8,8,14,0.7);
  backdrop-filter: blur(4px);
  z-index: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
}
.modal-overlay.modal--open {
  opacity: 1;
  pointer-events: auto;
}

.modal-box {
  background: var(--bg-2);
  border: 1px solid var(--border-2);
  border-radius: 12px;
  width: 460px;
  max-width: calc(100vw - 32px);
  max-height: calc(100vh - 64px);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transform: translateY(10px) scale(0.98);
  transition: transform 0.2s;
}
.modal-overlay.modal--open .modal-box { transform: none; }
.modal-box--wide { width: 600px; }

.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.modal-title {
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.01em;
}
.modal-close {
  background: none;
  border: none;
  color: var(--text-3);
  font-size: 14px;
  cursor: pointer;
  padding: 4px 6px;
  border-radius: 4px;
  transition: all 0.12s;
}
.modal-close:hover { color: var(--text); background: var(--bg-hover); }

/* Form */
.modal-form {
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  overflow-y: auto;
}
.form-label {
  display: flex;
  flex-direction: column;
  gap: 5px;
  font-size: 11px;
  font-weight: 500;
  color: var(--text-2);
}
.form-label span { color: var(--accent); }
.form-input, .form-select, .form-textarea {
  background: var(--bg-3);
  border: 1px solid var(--border);
  color: var(--text);
  font-family: var(--font);
  font-size: 13px;
  padding: 8px 11px;
  border-radius: 6px;
  outline: none;
  transition: border-color 0.15s;
  width: 100%;
}
.form-input:focus, .form-select:focus, .form-textarea:focus { border-color: var(--accent); }
.form-input::placeholder, .form-textarea::placeholder { color: var(--text-3); }
.form-select {
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8'%3E%3Cpath d='M0 0l6 8 6-8z' fill='%2352527a'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 11px center;
  padding-right: 30px;
}
.form-select option { background: var(--bg-2); }
.form-select--sm { width: auto; font-size: 12px; padding: 5px 28px 5px 10px; }
.form-textarea { resize: vertical; min-height: 72px; }
.btn-submit {
  background: var(--accent);
  border: none;
  color: #fff;
  font-family: var(--font);
  font-size: 13px;
  font-weight: 500;
  padding: 10px;
  border-radius: 6px;
  cursor: pointer;
  transition: opacity 0.15s;
  margin-top: 4px;
}
.btn-submit:hover { opacity: 0.85; }

/* Wiki modal */
.wiki-search-row {
  display: flex;
  gap: 8px;
  padding: 14px 20px 10px;
  border-bottom: 1px solid var(--border);
}
.wiki-search-row .form-input { flex: 1; }
.btn-wiki-go {
  background: var(--accent);
  border: none;
  color: #fff;
  font-family: var(--font);
  font-size: 12px;
  font-weight: 500;
  padding: 0 16px;
  border-radius: 6px;
  cursor: pointer;
  white-space: nowrap;
  transition: opacity 0.15s;
}
.btn-wiki-go:hover { opacity: 0.85; }

.wiki-filter {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 20px;
  border-bottom: 1px solid var(--border);
}
.wiki-filter-label { font-size: 11px; color: var(--text-3); white-space: nowrap; }

.wiki-results {
  flex: 1;
  overflow-y: auto;
  padding: 12px 20px;
  max-height: 380px;
  min-height: 100px;
}
.wiki-hint { font-size: 12px; color: var(--text-3); font-style: italic; }
.wiki-loading { font-family: var(--mono); font-size: 11px; color: var(--text-3); }
.wiki-count { font-size: 11px; color: var(--text-3); margin-bottom: 8px; }

.wiki-list { list-style: none; display: flex; flex-direction: column; gap: 3px; }
.wiki-item {
  display: grid;
  grid-template-columns: 90px 1fr auto;
  grid-template-rows: auto auto;
  gap: 2px 10px;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  transition: background 0.12s, border-color 0.12s;
}
.wiki-item:hover { background: var(--bg-hover); border-color: var(--border-2); }
.wiki-item-year { font-family: var(--mono); font-size: 9px; color: var(--text-3); grid-row:1; grid-column:1; align-self: center; }
.wiki-item-title { font-size: 12px; font-weight: 500; color: var(--text); grid-row:1; grid-column:2; }
.wiki-item-desc { font-size: 10px; color: var(--text-3); grid-row:2; grid-column:1/3; font-style: italic; }
.btn-wiki-add {
  grid-row: 1/3;
  grid-column: 3;
  align-self: center;
  background: var(--bg-3);
  border: 1px solid var(--border);
  color: var(--text-2);
  font-size: 11px;
  padding: 4px 10px;
  border-radius: 4px;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.12s;
}
.btn-wiki-add:hover { border-color: var(--accent); color: var(--accent); }
.btn-wiki-add:disabled { opacity: 0.4; cursor: default; }
