/* Level picker badge next to a game title (Cryptograms, Kakuro, Nonogram); see level-menu.js. */
.pv-level-menu {
  position: relative;
  flex: 0 0 auto;
  margin-right: auto;
}

.pv-level-menu__trigger {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  min-height: 32px;
  padding: 0.25rem 0.6rem 0.25rem 0.75rem;
  border: 1px solid color-mix(in srgb, var(--accent) 35%, transparent);
  border-radius: 999px;
  background: color-mix(in srgb, var(--accent-soft) 80%, transparent);
  color: var(--accent-strong);
  font: inherit;
  font-size: 0.88rem;
  font-weight: 700;
  line-height: 1.1;
  white-space: nowrap;
  cursor: pointer;
  transition: background-color 0.15s ease, border-color 0.15s ease;
}
.pv-level-menu__trigger:hover,
.pv-level-menu.is-open .pv-level-menu__trigger {
  background: var(--accent-soft);
  border-color: var(--accent);
}
.pv-level-menu__trigger:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
.pv-level-menu__chevron {
  width: 14px;
  height: 14px;
  flex: 0 0 auto;
  transition: transform 0.15s ease;
}
.pv-level-menu.is-open .pv-level-menu__chevron {
  transform: rotate(180deg);
}

/* The game's own level buttons, shown as a menu while the badge is open. */
.pv-level-menu .pv-level-menu__list {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  z-index: 30;
  display: none;
  min-width: 11.5rem;
  margin: 0;
  padding: 0.3rem;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface-strong);
  box-shadow: var(--shadow-md);
}
.pv-level-menu.is-open .pv-level-menu__list {
  display: grid;
  gap: 2px;
}
.pv-level-menu .pv-level-menu__list [data-level] {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  width: 100%;
  min-height: 38px;
  padding: 0.45rem 0.65rem;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--text);
  font: inherit;
  font-size: 0.95rem;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
}
.pv-level-menu .pv-level-menu__list [data-level] small {
  display: inline;
  color: var(--text-muted);
  font-size: 0.82rem;
  font-weight: 600;
}
.pv-level-menu .pv-level-menu__list [data-level]:hover,
.pv-level-menu .pv-level-menu__list [data-level]:focus-visible {
  background: color-mix(in srgb, var(--accent-soft) 70%, transparent);
  outline: none;
}
.pv-level-menu .pv-level-menu__list [data-level][aria-checked="true"] {
  background: var(--accent-soft);
  color: var(--accent-strong);
  font-weight: 800;
}

@media (max-width: 560px) {
  /* The badge is the only part of the title row that may give way on a narrow phone:
     a long level name ("Especialista") ends in "…" rather than pushing the row wider. */
  .pv-level-menu {
    flex: 0 1 auto;
    min-width: 0;
  }
  .pv-level-menu__trigger {
    gap: 0.2rem;
    max-width: 100%;
    min-height: 30px;
    padding-inline: 0.45rem 0.3rem;
    font-size: 0.78rem;
  }
  .pv-level-menu__value {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
  }
}
