/* Openings panel (Lichess explorer comparison) inside the game window's right column.
   Colours come only from theme.css variables: the W/D/L bar uses the board's own light and
   dark squares for White and Black, --muted for draws, the accent gradient for share bars. */

.lx {
  margin: 12px 0 4px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: linear-gradient(145deg, rgba(255,255,255,0.05), rgba(0,0,0,0.03));
  min-width: 0;
}
.lx-toggle {
  width: 100%; display: flex; align-items: baseline; gap: 8px;
  background: transparent; border: none; border-radius: 12px; padding: 9px 12px; text-align: left;
}
.lx-title { font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); font-weight: 600; }
.lx-sub { font-size: 0.78rem; }
.lx-chev { margin-left: auto; align-self: center; color: var(--muted); transition: transform 0.15s ease; }
.lx-toggle[aria-expanded="false"] .lx-chev { transform: rotate(-90deg); }
.lx-body { padding: 0 12px 10px; }
.lx-body[hidden] { display: none; }

.lx-opening { font-weight: 600; margin: 0 0 8px; min-height: 0; }
.lx-opening:empty { display: none; }
.lx-eco { font-variant-numeric: tabular-nums; color: var(--accent); margin-right: 4px; }

.lx-controls { display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: center; margin-bottom: 8px; font-size: 0.82rem; }
.lx-band { display: flex; align-items: center; gap: 6px; min-width: 0; }
.lx-band select {
  font: inherit; color: var(--fg); background: var(--panel); border: 1px solid var(--line);
  border-radius: 8px; padding: 4px 6px; max-width: 100%; min-width: 0;
}
.lx-speeds { display: flex; flex-wrap: wrap; gap: 4px; }
.lx-speed {
  border-radius: 999px; padding: 2px 9px; font-size: 0.74rem; color: var(--muted); background: transparent;
}
.lx-speed.on { background: linear-gradient(135deg, var(--accent), var(--accent-2)); color: #fff; border-color: transparent; }

/* comparison table */
.lx-main { min-height: 40px; transition: opacity 0.15s ease; }
.lx-main.lx-stale { opacity: 0.45; }
.lx-table { width: 100%; border-collapse: collapse; font-size: 0.85rem; table-layout: fixed; }
.lx-table th {
  text-align: left; color: var(--muted); font-weight: 600; font-size: 0.7rem; text-transform: uppercase;
  letter-spacing: 0.04em; padding: 4px 6px; border-bottom: 1px solid var(--line);
}
.lx-c-move { width: 3.4rem; }
.lx-c-gap { width: 2.9rem; }
.lx-table .lx-gapcell { text-align: right; }
.lx-more td { text-align: center; padding: 4px; }
.lx-bandname { text-transform: none; letter-spacing: 0; font-weight: 500; }
.lx-table td { padding: 5px 6px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.lx-table tfoot td { color: var(--muted); font-size: 0.78rem; font-variant-numeric: tabular-nums; border-bottom: none; }
.lx-move { font-weight: 600; white-space: nowrap; }
.lx-row.lx-click { cursor: pointer; }
.lx-row.lx-click:hover, .lx-row.lx-click:focus-visible { background: rgba(99,102,241,0.1); outline: none; }
.lx-row.lx-gap-up { background: rgba(99,102,241,0.07); }
.lx-row.lx-gap-down { background: rgba(239,68,68,0.06); }

.lx-side { display: grid; gap: 3px; min-width: 0; }
.lx-shareline, .lx-scoreline { display: flex; align-items: center; gap: 6px; min-width: 0; }
.lx-pct { width: 2.9em; flex: none; font-variant-numeric: tabular-nums; text-align: right; }
.lx-sbar { flex: 1; height: 6px; border-radius: 999px; background: var(--line); overflow: hidden; min-width: 12px; }
.lx-sbar i { display: block; height: 100%; border-radius: 999px; background: linear-gradient(90deg, var(--accent), var(--accent-2)); }
.lx-wdl { flex: 1; display: flex; height: 8px; box-sizing: border-box; border-radius: 3px; overflow: hidden;
  margin-left: calc(2.9em + 6px); min-width: 12px; border: 1px solid color-mix(in srgb, var(--muted) 45%, transparent); }
.lx-wdl i, .lx-key { display: block; height: 100%; }
.lx-wdl .w, .lx-key.w { background: var(--board-light); }
.lx-wdl .d, .lx-key.d { background: var(--muted); }
.lx-wdl .b, .lx-key.b { background: var(--board-dark); }
.lx-score { width: 2.4em; flex: none; font-size: 0.72rem; color: var(--muted); font-variant-numeric: tabular-nums; text-align: right; }
.lx-none { padding-left: 6px; }

.lx-gap { font-size: 0.74rem; font-weight: 700; white-space: nowrap; font-variant-numeric: tabular-nums; }
.lx-gap.up { color: var(--accent); }
.lx-gap.down { color: #ef4444; }

.lx-legend { font-size: 0.72rem; line-height: 1.5; margin: 8px 0 0; }
.lx-key { display: inline-block; width: 9px; height: 9px; border-radius: 2px; margin: 0 3px 0 6px; vertical-align: -1px;
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--muted) 45%, transparent); }

/* states */
.lx-msg p, .lx-token p { margin: 4px 0 8px; font-size: 0.85rem; line-height: 1.45; }
.lx-token-row { display: flex; gap: 6px; flex-wrap: wrap; }
.lx-token-row input {
  flex: 1 1 160px; min-width: 0; font: inherit; color: var(--fg); background: var(--panel);
  border: 1px solid var(--line); border-radius: 10px; padding: 7px 10px;
}
.lx-foot { display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 8px; font-size: 0.72rem; }
.lx-foot:empty { display: none; }
.lx-foot-btns { display: flex; gap: 10px; }
.lx-link { background: transparent; border: none; padding: 2px 0; color: var(--accent); font-size: 0.72rem; }

.lx-skel { display: grid; gap: 8px; padding: 6px 0; }
.lx-skel-row { display: grid; grid-template-columns: 3em 1fr 1fr; gap: 10px; }
.lx-skel-row i { display: block; height: 12px; border-radius: 6px; background: var(--line); animation: lx-pulse 1.2s ease-in-out infinite; }
@keyframes lx-pulse { 50% { opacity: 0.45; } }
@media (prefers-reduced-motion: reduce) { .lx-skel-row i { animation: none; } }

@media (max-width: 760px) {
  .lx-table { font-size: 0.8rem; }
  .lx-table th, .lx-table td { padding: 5px 3px; }
  .lx-c-move { width: 2.9rem; }
  .lx-c-gap { width: 2.4rem; }
  .lx-pct { width: 2.6em; }
  .lx-wdl { margin-left: 0; }
  .lx-score { display: none; }
  .lx-row.lx-click td { padding-top: 8px; padding-bottom: 8px; }   /* thumb-sized rows */
}
