/* The side panel's game tab: one of the sidebar's game lists at a time. */

.panel-games {
  position: relative;
  display: flex;
  flex: 1;
  flex-direction: column;
  min-height: 0;
}

.panel-games__head {
  display: flex;
  flex: none;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
  height: 52px;
  padding: 0 var(--space-3) 0 6px;
}

.panel-games__switch {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  min-width: 0;
  height: var(--control-sm);
  padding: 0 10px;
  border: 0;
  border-radius: var(--radius-md);
  background: transparent;
  color: var(--ink);
  font: inherit;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
}

/* The list's name stays on one line, cut short rather than wrapping beside "See all" and the close. */
.panel-games__switch > span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.panel-games__switch:hover,
.panel-games__switch[aria-expanded="true"] {
  background: var(--surface-2);
}

.panel-games__chevron {
  flex: none;
  color: var(--ink-muted);
  transition: transform 0.15s ease;
}

.panel-games__switch[aria-expanded="true"] .panel-games__chevron {
  transform: rotate(180deg);
}

.panel-games__icon {
  display: inline-flex;
  flex: none;
}

.panel-games__icon--win { color: var(--win); }
.panel-games__icon--amber { color: var(--tile-amber); }
.panel-games__icon--pink { color: #FF6B8A; }
.panel-games__icon--accent { color: var(--focus); }

.panel-games__all,
.panel-games__link {
  flex: none;
  color: var(--focus);
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
}

.panel-games__all:hover,
.panel-games__link:hover {
  text-decoration: underline;
}

/* The list switcher */
.panel-games__menu {
  position: absolute;
  top: 48px;
  left: 10px;
  z-index: 2;
  display: flex;
  flex-direction: column;
  gap: 2px;
  width: min(268px, calc(100% - 20px));
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface-2);
  box-shadow: 0 16px 40px rgb(0 0 0 / calc(0.45 * var(--shade)));
}

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

.panel-games__option {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: var(--control-md);
  padding: 0 10px;
  border-radius: 8px;
  color: var(--ink);
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
}

.panel-games__option:hover {
  background: var(--surface-3);
}

.panel-games__option[aria-current] {
  background: var(--selected);
}

.panel-games__option-name {
  flex: 1;
}

.panel-games__count {
  color: var(--ink-muted);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}

/* The list */
.panel-games__body {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 2px;
  min-height: 0;
  padding: 0 var(--space-2) var(--space-3);
  overflow-y: auto;
  overscroll-behavior: contain;
}

.panel-games__label {
  margin: var(--space-3) var(--space-2) 6px;
  color: var(--ink-muted);
  font-size: 12px;
  font-weight: 600;
}

.panel-games__label:first-child {
  margin-top: 2px;
}

.panel-game {
  display: flex;
  flex: none;
  align-items: center;
  gap: var(--space-3);
  padding: 6px var(--space-2);
  border-radius: 12px;
  color: var(--ink);
  text-decoration: none;
}

.panel-game:hover {
  background: var(--surface-2);
}

.panel-game__art {
  position: relative;
  display: grid;
  flex: none;
  place-items: center;
  width: 56px;
  height: 84px;
  overflow: hidden;
  border-radius: 8px;
}

.panel-game__art .glyph {
  width: 32px;
  height: 32px;
}

.panel-game__image {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.panel-game__text {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}

.panel-game__name {
  overflow: hidden;
  font-size: 15px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.panel-game__tag {
  color: var(--ink-muted);
  font-size: 13px;
}

.panel-game__meta {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--ink-muted);
  font-size: 12px;
}

.panel-game__meta .live-dot {
  width: 7px;
  height: 7px;
}

/* Sign-in prompts and empty lists */
.panel-games__notice {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-3);
  margin: auto 0;
  padding: var(--space-8) var(--space-6);
  text-align: center;
}

.panel-games__notice .panel-games__icon {
  display: grid;
  place-items: center;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--surface-2);
}

.panel-games__notice-title {
  font-size: 16px;
}

.panel-games__notice p {
  margin: 0;
  color: var(--ink-muted);
  font-size: 14px;
  line-height: 1.6;
  text-wrap: balance;
}

/* On a phone: each game on a wide picture filling half the row, its name, studio and players
   beside it. */
@media (max-width: 767px) {
  .panel-games__body {
    padding: 0 0 var(--space-3);
  }

  .panel-games__label {
    margin-inline: var(--space-4);
  }

  .panel-game {
    gap: var(--space-4);
    padding: var(--space-2) var(--space-4);
  }

  .panel-game__art {
    flex: 0 0 50%;
    width: auto;
    height: auto;
    aspect-ratio: 16 / 9;
    border-radius: var(--radius-md);
  }

  .panel-game__image {
    object-position: center 35%;
  }

  .panel-game__name {
    font-size: 16px;
  }

  .panel-game__tag {
    font-size: 15px;
  }

  .panel-game__meta {
    font-size: 13px;
  }
}
