/*
 * panels.css — classic desktop right panels (spec 06 §2.7) and the frequency table shared
 * with the advanced "频率统计" module (spec 06 §3.7). Values and rule order copied from the
 * original (CSS 2629–2857). Number cells themselves are styled in base.css.
 * `.side-panel-close` / `.expert-panel-close-btn` are dead in the original (no such
 * elements in the page) and kept for parity.
 */

.desktop-side-panel {
  display: none;
}

@media (min-width: 768px) {
  .desktop-side-panel {
    display: flex;
    flex-direction: column;
    position: fixed;
    z-index: 500;
    border: 1px solid rgba(245, 216, 142, .38);
    border-radius: 0;
    background: linear-gradient(180deg, #0e192af7, #060c16fa);
    box-shadow: inset 0 1px #ffffff0f, 0 20px 60px #00000080, 0 0 24px #60c9ff14;
    overflow: hidden;
    -webkit-user-select: none;
    user-select: none;
  }

  .side-panel-36 {
    top: 0;
    left: calc(min(100vw, 56.25vh) + 12px);
    width: 500px;
    height: 500px;
  }

  .side-panel-72 {
    top: 512px;
    left: calc(min(100vw, 56.25vh) + 12px);
    width: min(1175px, calc(100vw - min(100vw, 56.25vh) - 24px));
    height: 371px;
  }

  .desktop-side-panel[hidden] {
    display: none;
  }
}

.side-panel-header {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 42px;
  padding: 6px 10px;
  border-bottom: 1px solid rgba(245, 216, 142, .22);
  background: linear-gradient(180deg, #1a2c44f5, #0c1626fa);
  cursor: grab;
}

.side-panel-header:active {
  cursor: grabbing;
}

.side-panel-header strong {
  flex: 1;
  color: #fff7df;
  font-size: 14px;
  font-weight: 850;
  white-space: nowrap;
  pointer-events: none;
}

.side-panel-close {
  flex: 0 0 auto;
  width: 28px;
  min-height: 28px;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, .16);
  border-radius: 50%;
  background: #ffffff14;
  color: #fff7dfd1;
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
}

.side-panel-close:hover {
  background: #ff64642e;
  border-color: #ff64646b;
}

.side-panel-grid {
  --history-line: #d7dbe4;
  flex: 1 1 0;
  display: grid;
  grid-template-columns: repeat(var(--side-columns, 36), minmax(0, 1fr));
  grid-auto-rows: var(--side-cell-size, 14px);
  align-content: start;
  gap: 0;
  border-top: 1px solid var(--history-line);
  border-left: 1px solid var(--history-line);
  overflow-y: auto;
  overflow-x: hidden;
  overscroll-behavior: contain;
  background: #111b2a;
}

.side-panel-grid .history-cell {
  font-size: clamp(9px, var(--side-cell-size, 14px), 14px);
  font-weight: 380;
}

.side-panel-grid .history-cell.num-9 {
  font-size: clamp(9px, var(--side-cell-size, 14px), 14px);
  font-weight: 500;
}

.side-panel-grid .pending-countdown {
  font-weight: 900;
}

.desktop-side-panel.is-dragging {
  transition: none !important;
  opacity: .92;
}

@media (min-width: 768px) {
  .expert-panel {
    top: 0;
    left: calc(min(100vw, 56.25vh) + 524px);
    width: calc(100vw - min(100vw, 56.25vh) - 536px);
    min-width: 320px;
    height: 500px;
  }
}

.expert-panel-close-btn {
  position: absolute;
  right: 6px;
  top: 6px;
  z-index: 10;
}

.expert-panel-body {
  flex: 1 1 0;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 6px 8px;
  font-size: 11px;
  color: #e8f0ff;
}

.expert-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 11px;
  font-variant-numeric: tabular-nums;
}

.expert-table th,
.expert-table td {
  padding: 2px 4px;
  text-align: center;
  border-bottom: 1px solid rgba(255, 255, 255, .06);
  white-space: nowrap;
}

.expert-table th {
  color: #f5d88ee0;
  font-weight: 800;
  font-size: 10px;
  border-bottom-color: #f5d88e38;
}

.expert-table td:first-child {
  font-weight: 900;
}

.expert-table .hot {
  color: #ff6b6b;
}

.expert-table .cold {
  color: #6bcfff;
}

.expert-table .deviation-up {
  color: #ff6b6b;
}

.expert-table .deviation-down {
  color: #6bcfff;
}

.expert-section-title {
  margin: 6px 0 4px;
  padding: 3px 6px;
  border-left: 3px solid rgba(245, 216, 142, .72);
  background: #f5d88e0f;
  color: #fff7df;
  font-size: 11px;
  font-weight: 850;
}

.expert-section-title:first-child {
  margin-top: 0;
}

.expert-bar-row {
  display: flex;
  align-items: center;
  gap: 4px;
  margin: 2px 0;
}

.expert-bar-label {
  flex: 0 0 24px;
  color: #fff7dfd1;
  font-size: 10px;
  font-weight: 800;
}

.expert-bar-track {
  flex: 1;
  height: 14px;
  border-radius: 3px;
  background: #ffffff0f;
  overflow: hidden;
  position: relative;
}

.expert-bar-fill {
  height: 100%;
  border-radius: 3px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 9px;
  font-weight: 800;
  color: #fff;
  min-width: 24px;
  transition: width .3s ease;
}

.expert-bar-fill.bar-big {
  background: linear-gradient(90deg, #e94040, #ff7a5c);
}

.expert-bar-fill.bar-small {
  background: linear-gradient(90deg, #3a8fd4, #6bcfff);
}

.expert-bar-fill.bar-odd {
  background: linear-gradient(90deg, #a855f7, #d08aff);
}

.expert-bar-fill.bar-even {
  background: linear-gradient(90deg, #22c55e, #6ee7b7);
}

.expert-bar-value {
  flex: 0 0 36px;
  text-align: right;
  color: #fff7dfb8;
  font-size: 9px;
  font-weight: 700;
}

.expert-table .streak-warn {
  color: #ffb347;
  font-weight: 900;
}

.expert-table .streak-danger {
  color: #ff5252;
  font-weight: 900;
}
