/* ═══════════════════════════════════════════════
   SIDEBARS — Live Games, My Board, Chat
   Fixed overlay panels with WebSocket-driven content
   ═══════════════════════════════════════════════ */
.panel {
  position: fixed;
  top: var(--nav-h, 64px);
  bottom: 0;
  background: var(--surface);
  z-index: 40;
  display: flex;
  flex-direction: column;
  transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  overflow: hidden;
  border-top: 0;
}
.panel--left {
  left: 0;
  width: 320px;
  border-right: 1px solid var(--border);
  transform: translateX(-100%);
}
.panel--right {
  right: 0;
  width: 360px;
  border-left: 1px solid var(--border);
  transform: translateX(100%);
}
.panel--open {
  transform: translateX(0);
}
.panel__head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 16px;
  height: 40px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.panel__title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-heading);
  flex: 1;
}
.panel__count {
  font-family: var(--font-display);
  font-size: 12px;
  font-weight: 700;
  color: var(--blue);
  margin-left: 4px;
}
.panel__pin {
  background: none;
  border: none;
  color: var(--text-dim);
  cursor: pointer;
  padding: 4px;
  line-height: 1;
  transition: color 0.2s, transform 0.2s;
  display: flex;
  align-items: center;
}
.panel__pin:hover { color: var(--text-muted); }
.panel__pin--active {
  color: var(--blue);
  transform: rotate(45deg);
}
.panel__pin--active:hover { color: var(--blue-light); }
.panel__pin--active svg { fill: currentColor; }
.panel__close {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px;
  font-size: 18px;
  line-height: 1;
  transition: color 0.2s;
}
.panel__close:hover { color: var(--text); }
.panel__body {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}
.panel__tabs {
  display: flex;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.panel__tab {
  flex: 1;
  padding: 10px 12px;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  font-family: var(--font-display);
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-muted);
  cursor: pointer;
  transition: color 0.2s, border-color 0.2s;
}
.panel__tab:hover { color: var(--text); }
.panel__tab--active {
  color: var(--blue);
  border-bottom-color: var(--blue);
}
.panel__empty {
  padding: 40px 16px;
  text-align: center;
  color: var(--text-muted);
  font-size: 13px;
  line-height: 1.5;
}
.panel__empty-icon {
  font-size: 32px;
  margin-bottom: 12px;
  opacity: 0.4;
}

/* ═══════ NAV TOGGLE BUTTONS ═══════ */
.nav__panels {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-left: 16px;
  margin-right: 12px;
}
.nav__panel-btn {
  position: relative;
  background: none;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  cursor: pointer;
  padding: 6px 8px;
  font-size: 15px;
  line-height: 1;
  transition: color 0.2s, border-color 0.2s, background 0.2s;
  display: flex;
  align-items: center;
  gap: 4px;
}
.nav__panel-btn:hover {
  color: var(--text);
  border-color: rgba(255,255,255,0.12);
}
.nav__panel-btn--active {
  color: var(--blue);
  border-color: var(--blue);
  background: rgba(33,150,243,0.08);
}
.nav__panel-btn__label {
  font-family: var(--font-display);
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.nav__panel-btn__badge {
  position: absolute;
  top: -5px;
  right: -5px;
  min-width: 16px;
  height: 16px;
  background: var(--danger);
  color: #fff;
  font-size: 9px;
  font-weight: 700;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 4px;
  line-height: 1;
}

/* ═══════ LIVE GAME CARDS ═══════ */
.lg-card {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: background 0.2s;
  text-decoration: none;
  color: inherit;
  display: block;
}
.lg-card:hover { background: var(--surface-hover); }
.lg-card__head {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 8px;
}
.lg-card__live {
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: #fff;
  background: var(--danger);
  padding: 2px 6px;
  border-radius: 3px;
}
.lg-card__half { background: var(--warning); }
.lg-card__period {
  font-size: 11px;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}
.lg-card__row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
}
.lg-card__dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  flex-shrink: 0;
}
.lg-card__team {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  color: var(--text-heading);
  flex: 1;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.lg-card__score {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 16px;
  color: var(--blue);
  font-variant-numeric: tabular-nums;
  min-width: 28px;
  text-align: right;
}
.lg-card__chat-btn {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-top: 8px;
  background: none;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 4px 8px;
  cursor: pointer;
  transition: all 0.2s;
  width: 100%;
  justify-content: center;
}
.lg-card__chat-btn:hover {
  border-color: var(--blue);
  color: var(--blue);
}

/* ═══════ MY BOARD ═══════ */
.board-item {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: inherit;
  cursor: pointer;
  transition: background 0.2s;
}
.board-item:hover { background: var(--surface-hover); }
.board-item__badge {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 11px;
  color: #fff;
  flex-shrink: 0;
  overflow: hidden;
}
.board-item__badge img { width: 100%; height: 100%; object-fit: contain; }
.board-item__info { flex: 1; min-width: 0; }
.board-item__name {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 13px;
  color: var(--text-heading);
  text-transform: uppercase;
  letter-spacing: 0.02em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.board-item__detail {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 2px;
}
.board-item__unfollow {
  background: none;
  border: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.2s;
  flex-shrink: 0;
}
.board-item__unfollow:hover {
  border-color: var(--danger);
  color: var(--danger);
}

/* ═══════ CHAT PANEL ═══════ */
.chat { display: flex; flex-direction: column; height: 100%; }
.chat__match {
  padding: 8px 16px;
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 6px;
}
.chat__match .live-dot { width: 6px; height: 6px; }
.chat__messages {
  flex: 1;
  overflow-y: auto;
  padding: 12px 16px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}
.chat__msg { font-size: 13px; line-height: 1.4; }
.chat__msg-user {
  font-weight: 600;
  color: var(--blue);
  margin-right: 6px;
}
.chat__msg-text { color: var(--text); word-break: break-word; }
.chat__msg-time {
  font-size: 10px;
  color: var(--text-dim);
  margin-left: 6px;
  font-variant-numeric: tabular-nums;
}
.chat__empty {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  font-size: 13px;
  text-align: center;
  padding: 32px;
  gap: 8px;
}
.chat__empty-icon { font-size: 28px; opacity: 0.4; }
.chat__form {
  padding: 12px 16px;
  border-top: 1px solid var(--border);
  display: flex;
  gap: 8px;
  flex-shrink: 0;
}
.chat__input {
  flex: 1;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 13px;
  padding: 8px 12px;
  outline: none;
  transition: border-color 0.2s;
}
.chat__input:focus { border-color: var(--blue); }
.chat__input::placeholder { color: var(--text-dim); }
.chat__send {
  background: var(--blue);
  border: none;
  color: #fff;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background 0.2s;
  flex-shrink: 0;
}
.chat__send:hover { background: var(--blue-dim); }
.chat__send:disabled { opacity: 0.5; cursor: not-allowed; }
.chat__login {
  padding: 16px;
  text-align: center;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
  font-size: 13px;
  color: var(--text-muted);
}
.chat__login a { color: var(--blue); font-weight: 600; }

/* ═══════ PANEL BACKDROP (mobile overlay) ═══════ */
.panel-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  top: var(--nav-h, 66px);
  background: rgba(0,0,0,0.6);
  z-index: 39;
}

/* ═══════ RESPONSIVE ═══════ */
@media (max-width: 1180px) {
  .panel { bottom: calc(var(--tabbar-h, 68px) + env(safe-area-inset-bottom, 0px)); }
  .panel-backdrop { bottom: calc(var(--tabbar-h, 68px) + env(safe-area-inset-bottom, 0px)); }
}
@media (max-width: 768px) {
  .panel--left,
  .panel--right { width: 100% !important; }
  .panel-backdrop--visible { display: block; }
  .nav__panel-btn__label { display: none; }
}
@media (max-width: 480px) {
  .nav__panels { gap: 2px; margin-right: 8px; }
  .nav__panel-btn { padding: 5px 6px; font-size: 14px; }
}

/* ═══════ PUSH LAYOUT (desktop: panels push content) ═══════ */
.main,
.footer {
  transition: margin-left 0.25s cubic-bezier(0.4, 0, 0.2, 1),
              margin-right 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}
.nav {
  transition: box-shadow 0.4s,
              left 0.25s cubic-bezier(0.4, 0, 0.2, 1),
              right 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}
@media (min-width: 769px) {
  body.push-left .nav  { left: 320px; }
  body.push-right .nav { right: 360px; }
  body.push-left .main,
  body.push-left .footer  { margin-left: 320px; }
  body.push-right .main,
  body.push-right .footer { margin-right: 360px; }

  /* Instant panel reveal when body has push class (FOUC prevention) */
  body.push-left .panel--left  { transform: translateX(0); }
  body.push-right .panel--right { transform: translateX(0); }

}