/* EloTracker Ask Search: 2-Column Topbar Popover, /ask Workspace, & Live Slide-Over */
:root {
  --ask-bg: #ffffff;
  --ask-bg-soft: #f8fafc;
  --ask-border: #e2e8f0;
  --ask-text: #0f172a;
  --ask-muted: #64748b;
  --ask-accent: #2563eb;
  --ask-accent-soft: #eff6ff;
  --ask-accent-text: #1d4ed8;
  --ask-win: #16a34a;
  --ask-draw: #94a3b8;
  --ask-loss: #dc2626;
  --ask-shadow: 0 18px 42px -12px rgba(15, 23, 42, 0.22);
}
html.dark {
  --ask-bg: #1f2937;
  --ask-bg-soft: #111827;
  --ask-border: #374151;
  --ask-text: #f9fafb;
  --ask-muted: #9ca3af;
  --ask-accent: #3b82f6;
  --ask-accent-soft: rgba(59, 130, 246, 0.16);
  --ask-accent-text: #93c5fd;
  --ask-shadow: 0 20px 48px -12px rgba(0, 0, 0, 0.55);
}

/* Global Topbar Search wider for natural language */
.site-header .site-header-search { width: 30rem; max-width: 44vw; }
.site-header #topbar-search { width: 100%; }

/* 2-Column Smart Search Popover */
.ask-popover {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  width: 680px;
  max-width: calc(100vw - 24px);
  background: var(--ask-bg);
  border: 1px solid var(--ask-border);
  border-radius: 12px;
  box-shadow: var(--ask-shadow);
  z-index: 60;
  overflow: hidden;
  color: var(--ask-text);
}
.ask-popover[hidden] { display: none !important; }
.ask-popover-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 0.95fr);
}
@media (max-width: 767px) {
  .ask-popover { width: 100%; max-width: none; }
  .ask-popover-grid { grid-template-columns: 1fr; }
}
#sidebar .ask-popover { width: 100%; max-width: 100%; }
#sidebar .ask-popover-grid { grid-template-columns: 1fr; }
#sidebar .ask-pop-left { border-right: none; border-bottom: 1px solid var(--ask-border); max-height: 220px; }
#sidebar .ask-pop-right { max-height: 200px; }
.ask-pop-left { padding: 10px; border-right: 1px solid var(--ask-border); max-height: 440px; overflow-y: auto; }
.ask-pop-right { padding: 10px 12px; background: var(--ask-bg-soft); max-height: 440px; overflow-y: auto; }
@media (max-width: 767px) {
  .ask-pop-left { border-right: none; border-bottom: 1px solid var(--ask-border); }
}
.ask-pop-sec-label {
  font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em;
  color: var(--ask-muted); padding: 4px 8px 6px;
}
.ask-pop-item {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  width: 100%; text-align: left; padding: 8px 10px; border-radius: 8px;
  border: none; background: transparent; color: var(--ask-text);
  font-size: 13.5px; cursor: pointer; text-decoration: none;
}
.ask-pop-item:hover, .ask-pop-item.is-active {
  background: var(--ask-accent-soft); color: var(--ask-accent-text);
}
.ask-pop-item-main { display: flex; align-items: center; gap: 8px; min-width: 0; }
.ask-pop-name { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ask-pop-meta { font-size: 12px; color: var(--ask-muted); white-space: nowrap; flex-shrink: 0; }
.ask-pop-ask-row {
  background: var(--ask-accent-soft); color: var(--ask-accent-text);
  font-weight: 600; margin-bottom: 6px;
}
.ask-pop-typo {
  font-size: 10px; padding: 1px 6px; border-radius: 999px;
  background: rgba(245, 158, 11, 0.18); color: #d97706; font-weight: 600;
}
.ask-pop-suggest-btn {
  display: block; width: 100%; text-align: left; padding: 7px 10px; margin-bottom: 4px;
  border-radius: 8px; border: 1px solid var(--ask-border); background: var(--ask-bg);
  color: var(--ask-text); font-size: 12.5px; line-height: 1.35; cursor: pointer;
}
.ask-pop-suggest-btn:hover { border-color: var(--ask-accent); color: var(--ask-accent-text); }
.ask-pop-foot {
  display: flex; justify-content: space-between; align-items: center;
  padding: 7px 12px; border-top: 1px solid var(--ask-border);
  font-size: 11.5px; color: var(--ask-muted); background: var(--ask-bg-soft);
}
.ask-pop-foot a { color: var(--ask-accent-text); font-weight: 600; text-decoration: none; }

/* Homepage Quick-Ask Discovery Strip */
.home-ask-strip {
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px;
  margin: 10px 0 14px; font-size: 13px;
}
.home-ask-label { font-weight: 600; color: var(--ask-muted); margin-right: 2px; }
.home-ask-chip {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 5px 11px; border-radius: 999px;
  background: var(--ask-bg); border: 1px solid var(--ask-border);
  color: var(--ask-text); font-size: 12.5px; font-weight: 500; text-decoration: none;
  transition: border-color 0.12s, color 0.12s;
}
.home-ask-chip:hover { border-color: var(--ask-accent); color: var(--ask-accent-text); }

/* Dedicated /ask 2-Column Workspace */
.ask-page { max-width: 1280px; margin: 0 auto; padding: 6px 0 40px; color: var(--ask-text); }
.ask-page-header {
  display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-start;
  gap: 12px; margin-bottom: 16px;
}
.ask-page-title { font-size: 24px; font-weight: 700; margin: 0; line-height: 1.2; }
.ask-page-subtitle { font-size: 13.5px; color: var(--ask-muted); margin: 4px 0 0; }
.ask-back-pill {
  display: inline-flex; align-items: center; padding: 6px 12px; border-radius: 999px;
  border: 1px solid var(--ask-border); background: var(--ask-bg); color: var(--ask-text);
  font-size: 13px; font-weight: 500; text-decoration: none;
}
.ask-page-grid {
  display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 20px; align-items: start;
}
@media (max-width: 1023px) {
  .ask-page-grid { grid-template-columns: 1fr; }
}

.ask-composer-card, .ask-rail-card, .ask-card, .ask-empty-card {
  background: var(--ask-bg); border: 1px solid var(--ask-border); border-radius: 12px; padding: 16px;
}
.ask-composer-card { margin-bottom: 14px; }
.ask-composer-row { display: flex; gap: 8px; align-items: center; }
.ask-composer-input-wrap { position: relative; flex: 1; min-width: 0; }
.ask-composer-icon {
  position: absolute; left: 12px; top: 50%; transform: translateY(-50%);
  width: 18px; height: 18px; color: var(--ask-muted); pointer-events: none;
}
#ask-page-input {
  width: 100%; padding: 10px 12px 10px 38px; border-radius: 9px;
  border: 1px solid var(--ask-border); background: var(--ask-bg-soft);
  color: var(--ask-text); font-size: 15px; outline: none;
}
#ask-page-input:focus { border-color: var(--ask-accent); box-shadow: 0 0 0 3px var(--ask-accent-soft); }
.ask-btn-primary {
  padding: 10px 18px; border-radius: 9px; border: none; background: var(--ask-accent);
  color: #fff; font-weight: 600; font-size: 14px; cursor: pointer; white-space: nowrap;
}
.ask-btn-primary:hover { filter: brightness(1.06); }
.ask-btn-ghost {
  padding: 10px 12px; border-radius: 9px; border: 1px solid var(--ask-border);
  background: transparent; color: var(--ask-muted); font-size: 13.5px; cursor: pointer;
}
.ask-context-bar {
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px;
  margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--ask-border); font-size: 12.5px;
}
.ask-context-badge {
  background: var(--ask-accent-soft); color: var(--ask-accent-text);
  padding: 3px 9px; border-radius: 999px; font-weight: 600;
}
.ask-context-hint { color: var(--ask-muted); }
.ask-context-reset {
  margin-left: auto; background: none; border: none; color: var(--ask-accent-text);
  font-weight: 600; cursor: pointer; font-size: 12.5px;
}

.ask-status {
  padding: 10px 14px; border-radius: 9px; margin-bottom: 12px;
  background: var(--ask-accent-soft); color: var(--ask-accent-text); font-size: 13.5px; font-weight: 500;
}
.ask-status.is-error { background: rgba(220, 38, 38, 0.14); color: #ef4444; }

.ask-empty-card h2 { font-size: 17px; font-weight: 700; margin: 0 0 6px; }
.ask-empty-card p { font-size: 13.5px; color: var(--ask-muted); margin: 0 0 14px; }
.ask-starter-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
@media (max-width: 639px) { .ask-starter-grid { grid-template-columns: 1fr; } }
.ask-starter-btn {
  display: flex; flex-direction: column; align-items: flex-start; gap: 4px;
  padding: 12px; border-radius: 10px; border: 1px solid var(--ask-border);
  background: var(--ask-bg-soft); color: var(--ask-text); text-align: left; cursor: pointer;
}
.ask-starter-btn:hover { border-color: var(--ask-accent); }
.ask-starter-tag {
  font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em;
  color: var(--ask-accent-text);
}

/* Answer Cards */
.ask-stream { display: flex; flex-direction: column; gap: 16px; }
.ask-card-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; margin-bottom: 8px; }
.ask-card-title { font-size: 19px; font-weight: 700; margin: 0; line-height: 1.25; }
.ask-card-sub { font-size: 13px; color: var(--ask-muted); margin: 3px 0 0; }
.ask-card-latency { font-size: 11.5px; color: var(--ask-muted); white-space: nowrap; }
.ask-correction-banner {
  font-size: 12.5px; padding: 6px 10px; border-radius: 8px; margin-bottom: 10px;
  background: rgba(245, 158, 11, 0.14); color: #b45309;
}
html.dark .ask-correction-banner { color: #fbbf24; }
.ask-card-summary { font-size: 14px; line-height: 1.55; margin: 0 0 12px; }
.ask-kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 8px; margin-bottom: 12px; }
.ask-kpi {
  padding: 10px 12px; border-radius: 9px; background: var(--ask-bg-soft); border: 1px solid var(--ask-border);
}
.ask-kpi-label { font-size: 11px; color: var(--ask-muted); text-transform: uppercase; letter-spacing: 0.04em; font-weight: 600; }
.ask-kpi-val { font-size: 17px; font-weight: 700; margin-top: 2px; }

.ask-wdl-wrap { margin-bottom: 14px; }
.ask-wdl-bar { display: flex; height: 10px; border-radius: 999px; overflow: hidden; background: var(--ask-border); }
.ask-wdl-w { background: var(--ask-win); }
.ask-wdl-d { background: var(--ask-draw); }
.ask-wdl-l { background: var(--ask-loss); }
.ask-wdl-legend { display: flex; justify-content: space-between; font-size: 11.5px; color: var(--ask-muted); margin-top: 4px; }

.ask-bullets { margin: 0 0 12px 18px; padding: 0; font-size: 13.5px; line-height: 1.55; }
.ask-bullets li { margin-bottom: 4px; }

.ask-table-wrap { overflow-x: auto; border: 1px solid var(--ask-border); border-radius: 9px; margin-bottom: 12px; }
.ask-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.ask-table th {
  text-align: left; padding: 8px 10px; font-size: 11.5px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.04em; color: var(--ask-muted);
  background: var(--ask-bg-soft); border-bottom: 1px solid var(--ask-border); white-space: nowrap;
}
.ask-table td { padding: 8px 10px; border-bottom: 1px solid var(--ask-border); vertical-align: middle; }
.ask-table tr:last-child td { border-bottom: none; }
.ask-table a { color: var(--ask-accent-text); text-decoration: none; font-weight: 500; }
.ask-table a:hover { text-decoration: underline; }
.ask-eco-pill {
  display: inline-block; padding: 1px 6px; border-radius: 5px; font-size: 11px; font-weight: 700;
  background: var(--ask-bg-soft); border: 1px solid var(--ask-border); color: var(--ask-muted); margin-right: 5px;
}
.ask-res-pill {
  display: inline-block; padding: 2px 7px; border-radius: 6px; font-weight: 700; font-size: 12px;
  background: var(--ask-accent-soft); color: var(--ask-accent-text); white-space: nowrap;
}
.ask-pager { display: flex; align-items: center; justify-content: space-between; font-size: 12.5px; color: var(--ask-muted); margin-bottom: 10px; }
.ask-pager-btns { display: flex; gap: 6px; }
.ask-pager button {
  padding: 5px 10px; border-radius: 7px; border: 1px solid var(--ask-border);
  background: var(--ask-bg); color: var(--ask-text); cursor: pointer; font-size: 12.5px;
}
.ask-pager button:disabled { opacity: 0.45; cursor: default; }

.ask-links-row, .ask-followups-row { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 8px; }
.ask-ext-link {
  display: inline-flex; align-items: center; padding: 5px 10px; border-radius: 8px;
  background: var(--ask-bg-soft); border: 1px solid var(--ask-border);
  color: var(--ask-accent-text); font-size: 12.5px; font-weight: 600; text-decoration: none;
}
.ask-followup-chip {
  padding: 5px 11px; border-radius: 999px; border: 1px solid var(--ask-border);
  background: var(--ask-bg); color: var(--ask-text); font-size: 12.5px; cursor: pointer;
}
.ask-followup-chip:hover { border-color: var(--ask-accent); color: var(--ask-accent-text); }
.ask-provenance { font-size: 11.5px; color: var(--ask-muted); margin-top: 10px; padding-top: 8px; border-top: 1px solid var(--ask-border); }

/* Right Rail (Suggested Queries) */
.ask-right-rail { position: sticky; top: 76px; display: flex; flex-direction: column; gap: 14px; }
.ask-rail-head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 10px; }
.ask-rail-head h2 { font-size: 15px; font-weight: 700; margin: 0; }
.ask-rail-sub { font-size: 11.5px; color: var(--ask-muted); }
.ask-cat-pills { display: flex; flex-wrap: wrap; gap: 5px; margin-bottom: 10px; }
.ask-cat-pill {
  padding: 4px 9px; border-radius: 999px; border: 1px solid var(--ask-border);
  background: var(--ask-bg-soft); color: var(--ask-muted); font-size: 11.5px; font-weight: 600; cursor: pointer;
}
.ask-cat-pill[aria-selected="true"] {
  background: var(--ask-accent); border-color: var(--ask-accent); color: #fff;
}
.ask-rail-list { display: flex; flex-direction: column; gap: 6px; }
.ask-rail-btn {
  display: block; width: 100%; text-align: left; padding: 8px 10px; border-radius: 8px;
  border: 1px solid var(--ask-border); background: var(--ask-bg-soft); color: var(--ask-text);
  font-size: 13px; line-height: 1.35; cursor: pointer;
}
.ask-rail-btn:hover { border-color: var(--ask-accent); color: var(--ask-accent-text); background: var(--ask-bg); }
.ask-recent-clear { background: none; border: none; color: var(--ask-muted); font-size: 12px; cursor: pointer; }

/* Slide-Over Drawer for /live and /game/* spectators */
.ask-drawer-backdrop {
  position: fixed; inset: 0; background: rgba(15, 23, 42, 0.4); z-index: 70;
}
.ask-drawer {
  position: fixed; top: 0; right: 0; bottom: 0; width: 520px; max-width: 96vw;
  background: var(--ask-bg); border-left: 1px solid var(--ask-border);
  box-shadow: var(--ask-shadow); z-index: 75; display: flex; flex-direction: column;
  color: var(--ask-text);
}
.ask-drawer[hidden], .ask-drawer-backdrop[hidden] { display: none !important; }
.ask-drawer-head {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 12px 16px; border-bottom: 1px solid var(--ask-border);
}
.ask-drawer-head strong { font-size: 15px; }
.ask-drawer-actions { display: flex; align-items: center; gap: 8px; }
.ask-drawer-expand {
  padding: 5px 10px; border-radius: 7px; background: var(--ask-accent-soft);
  color: var(--ask-accent-text); font-size: 12.5px; font-weight: 600; text-decoration: none;
}
.ask-drawer-close {
  width: 30px; height: 30px; border-radius: 7px; border: 1px solid var(--ask-border);
  background: transparent; color: var(--ask-text); font-size: 18px; cursor: pointer;
}
.ask-drawer-body { flex: 1; overflow-y: auto; padding: 14px 16px; }
